Bug 233270 - [model] CreateCompilationUnitOperation runs with wrong ISchedulingRule
Summary: [model] CreateCompilationUnitOperation runs with wrong ISchedulingRule
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: 3.5 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 232849
  Show dependency tree
 
Reported: 2008-05-21 12:23 EDT by Paul Fullbright CLA
Modified: 2008-09-15 10:00 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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