Community
Participate
Working Groups
How to reproduce bug: 1. Open .java file in javaeditor 2. Use build path property to add that file to exclusion filter 3. File is displayed twice in package explorer
the package explorer does a full refresh of the project when receiving the delta resulting from setting the exclusion filter (class path change) It seems that after the delta the model still contains file. Moving to jdt.core
Isn't this a consequence of the concurrency bug in package explorer ?
No, this isn't a consequence of the concurrency bug since we get the delta and do a refresh. The concurrency bug happens when we get another delta during refreshing the viewer.
Here is what is happening: The delta: org.eclipse.jdt.core.ElementChangedEvent[source=Java Model[*]: {CHILDREN} Test[*]: {CHILDREN | CLASSPATH CHANGED} <project root>[*]: {ADDED TO CLASSPATH | REMOVED FROM CLASSPATH} ResourceDelta(/Test/.classpath)[*]] The children when asking the package fragment for is Java and Non Java chidren: children= Object[4] (id=834132) [0]= CompilationUnit (id=834144) name= "Inline2.java" occurrenceCount= 1 owner= DefaultWorkingCopyOwner (id=833952) parent= PackageFragment (id=834104) [1]= CompilationUnit (id=833844) name= "Inline.java" occurrenceCount= 1 owner= DefaultWorkingCopyOwner (id=833952) parent= PackageFragment (id=833956) [2]= CompilationUnit (id=834148) name= "M.java" occurrenceCount= 1 owner= DefaultWorkingCopyOwner (id=833952) parent= PackageFragment (id=834104) [3]= File (id=834152) path= Path (id=834232) workspace= Workspace (id=833564) Selecting[1] prints: [Working copy] Inline.java [in p1 [in <project root> [in Test]]] package p1 class Inline Selecting [3] prints: L/Test/p1/Inline.java The problem seems to be that the compilation unit is open in the editor and therefore a primary working copy exists. I see another problem here: since the CU isn't on the class path anymore the Java editor must be converted into a "non" Java Editor since some of the functions aren't available anymore. However we don't receive an event for this.
Indeed, once excluded from classpath, and as long as it is opened; a primary working copy is answered amongst package children. Fixed PackageFragment#getCompilationUnits(WorkingCopyOwner).
Need testcase.
> I see another problem here: since the CU isn't on the class path anymore the > Java editor must be converted into a "non" Java Editor since some of the > functions aren't available anymore. However we don't receive an event > for this. We do not broadcast this change, since the working copy still exists, but lives outside the classpath. You would need to handle it by yourself, when notified about source folder being ADDED/REMOVED from classpath.
Added regression test ExclusionPatternsTest.testAddExclusionOnPrimaryWorkingCopy()
Philippe, can we simply do the following when we receive the class path delta: take the project of the working copy and ask if the working copy is on the class path. Will this answer false in this case. CC Dani, since this affects the editor.
That's correct: if the working copy is excluded, IJavaProject#isOnClasspath (IJavaElement) will return false for the working copy.
fix verified in package explorer (I20040518-0816)
Closed as verified.