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

Bug 212285

Summary: [context] remove from context doesn't get the children of a non-java project
Product: z_Archived Reporter: Shawn Minto <shawn.minto>
Component: MylynAssignee: Shawn Minto <shawn.minto>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P2 CC: robert.elves
Version: unspecified   
Target Milestone: 2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
mylyn/context/zip
none
Test case patch
none
mylyn/context/zip none

Description Shawn Minto CLA 2007-12-07 12:15:14 EST
Remove from context doesn't get the children of a non-java project, so these files are left orphaned.  After some investigation, the problem is that all projects use the java project handle, which in turn makes the JavaStructureBridge.getChildren method called when manipulateInterestForElement is called.  When trying to get the children, a JavaModelException is thrown, and then no children are returned. Maybe if this happens, it should try to get the children from the resource structure bridge?
Comment 1 Shawn Minto CLA 2007-12-07 12:27:27 EST
Created attachment 84753 [details]
patch

Here is a simple patch that fixes this problem.  I have not included any tests or anything as I am unsure if this is the correct approach to take.
Comment 2 Shawn Minto CLA 2007-12-07 12:27:38 EST
Created attachment 84754 [details]
mylyn/context/zip
Comment 3 Mik Kersten CLA 2007-12-12 23:35:41 EST
Shawn: this changes the way Mylyn has always behaved in this respect, right?  I wonder if it should wait until 2.3 since this is a pretty major change.
Comment 4 Shawn Minto CLA 2007-12-13 12:18:57 EST
This is a pretty major change, but if a user has a project other than a java project (e.g. a feature project), and they attempt to remove from their context, the project is removed, but all of the children are left.  This can be a privacy concern if the user thinks that this information is gone, but it really isn't, and then shares the context publicly.
Comment 5 Robert Elves CLA 2008-02-20 13:19:55 EST
Raising priority due to privacy concerns.
Comment 6 Mik Kersten CLA 2008-02-20 23:57:39 EST
Shawn: I have applied the patch and all looks good, although note my comment in the code.  Could you provide a simple test case, and consider whether this handling can happen with a test instead of in the catch block?
Comment 7 Shawn Minto CLA 2008-02-22 12:30:06 EST
Created attachment 90491 [details]
Test case patch

Here is a test case for this.  I have also fixed up the other tests in the class and re-added it to the all java tests.  I don't think that I am able to do anything other than using the exception handling since the object created is a java project and only when the structure bridge tries to get the children does it throw an exception.  If you have any ideas what else could be done to make this more robust I am willing to re-implement my patch.
Comment 8 Shawn Minto CLA 2008-02-22 12:30:15 EST
Created attachment 90492 [details]
mylyn/context/zip
Comment 9 Mik Kersten CLA 2008-02-25 21:04:25 EST
Patch applied.  Great stuff Shawn.