Bug 233270

Summary: [model] CreateCompilationUnitOperation runs with wrong ISchedulingRule
Product: [Eclipse Project] JDT Reporter: Paul Fullbright <paul.fullbright>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: Olivier_Thomann
Version: 3.4   
Target Milestone: 3.5 M2   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 232849    

Description Paul Fullbright CLA 2008-05-21 12:23:17 EDT
This is a near verbatim replica of bug 95288.  Changes are highlighted.

"I have an operation that creates *several JPA entities within a given project*.  I run this operation using the *project* as the scheduling rule.  The problem
is that I have to call *PackageFragment#createCompilationUnit(...)* which runs
the Create*CompilationUnit*Operation under a scheduling rule of WorkspaceRoot. 
This causes an IllegalArgumentException to be thrown.  This means I have to
change my operation to run with the WorkspaceRoot as the scheduling rule.  I see
no reason why the creation of a *CompilationUnit* would need a scheduling rule
broader than the *PackageFragment* under which it is being created."

In addition, I might suggest that similar operations also be examined.
Comment 1 Jerome Lanneluc CLA 2008-09-08 10:33:52 EDT
I'm not sure why you're seeing an IWorkspaceSchedulingRule. The code is using IResourceRuleFactory.createRule(...) which returns an IFolder corresponding to the package. This was fixed by bug 50320.

Added CreateCompilationUnitTests.testSchedulingRule().
Comment 2 Olivier Thomann CLA 2008-09-15 10:00:05 EDT
Verified for 3.5M2 using I20080914-2000