Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 51986

Summary: [Wizards][Jobs] Need to move file creation to extendable job.
Product: [Eclipse Project] Platform Reporter: Tod Creasey <Tod_Creasey>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WORKSFORME QA Contact: Boris Bokowski <bokowski>
Severity: enhancement    
Priority: P4 CC: john.arthorne, simon_arsenault
Version: 3.0Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch with initial refactoring none

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.