Bug 51986 - [Wizards][Jobs] Need to move file creation to extendable job.
Summary: [Wizards][Jobs] Need to move file creation to extendable job.
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Boris Bokowski CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2004-02-13 13:31 EST by Tod Creasey CLA
Modified: 2009-02-26 17:53 EST (History)
2 users (show)

See Also:


Attachments
Patch with initial refactoring (1.78 KB, patch)
2004-02-13 13:36 EST, Tod Creasey CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2004-02-13 13:31:56 EST
M7

The WizardNewFileCreationPage creates a WorkspaceModifyOperation when it 
creates the file. There should be two changes

1) The file creation code should be moved to a job with locks for just the 
parent
2) It should be refactored into a protected method for subclassing by other 
applications.

Here is the offending code:

WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
		protected void execute(IProgressMonitor monitor) throws 
CoreException,
			InterruptedException
		{
			try {
				monitor.beginTask
(IDEWorkbenchMessages.getString("WizardNewFileCreationPage.progress"), 
2000); //$NON-NLS-1$
				ContainerGenerator generator = new 
ContainerGenerator(containerPath);
				generator.generateContainer(new 
SubProgressMonitor(monitor, 1000));
				createFile(newFileHandle,initialContents, new 
SubProgressMonitor(monitor, 1000));
			} finally {
				monitor.done();
			}
		}
	};

Issues:
1) Need to create a lock
2) Need to run the progress in the progress part until the job is done. This 
is a good test case for our general wizards strategy.
Comment 1 Tod Creasey CLA 2004-02-13 13:36:21 EST
Created attachment 7895 [details]
Patch with initial refactoring
Comment 2 John Arthorne CLA 2004-02-13 14:15:32 EST
This should be just a matter for passing an appropriate scheduling rule to the
WorkspaceModifyOperation constructor. Use
IResourceRuleFactory.createRule(resource) to obtain an appropriate scheduling rule.
Comment 3 Tod Creasey CLA 2004-03-29 10:43:00 EST
Not on the 3.0 plan
Comment 4 Tod Creasey CLA 2004-06-28 11:27:20 EDT
Reopening now that 3.0 has shipped
Comment 5 John Arthorne CLA 2009-02-26 17:53:45 EST
The current code uses an appropriate scheduling rule. This code was all rewritten by Susan when adding support for resource undo in 3.3, and it uses appropriate scheduling rules.