Index: src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java =================================================================== RCS file: /cvs/java/javacore/src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java,v retrieving revision 1.28 diff -u -r1.28 MergedClassPathImplementation.java --- src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java 30 Jun 2006 20:07:52 -0000 1.28 +++ src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java 11 Sep 2006 15:42:15 -0000 @@ -269,38 +269,44 @@ this.addClassPath (cp); } } + + private int updateEntriesCounter; private void updateEntries (ClassPath cp) { boolean fire = false; List oldResources; + int id; synchronized (this) { - oldResources = (List) this.resourceMap.remove (cp); + id = ++updateEntriesCounter; + oldResources = (List) this.resourceMap.get (cp); assert oldResources != null : "Change in unknown classpath"; // NOI18N } List newResources = addClassPathResources (cp); synchronized (this) { - Collection toRemove = new HashSet (oldResources); - toRemove.removeAll (newResources); - newResources.removeAll (oldResources); //To Add - for (Iterator it = toRemove.iterator(); it.hasNext();) { - PathResourceImplementation resource = (PathResourceImplementation) it.next(); - oldResources.remove(resource); - if (!this.cachedResources.remove(resource)) { - if (!this.unresolvedRoots.remove (resource)) { - missingRoots.remove(resource.getRoots()[0]); + if (id==updateEntriesCounter) { + Collection toRemove = new HashSet (oldResources); + toRemove.removeAll (newResources); + newResources.removeAll (oldResources); //To Add + for (Iterator it = toRemove.iterator(); it.hasNext();) { + PathResourceImplementation resource = (PathResourceImplementation) it.next(); + oldResources.remove(resource); + if (!this.cachedResources.remove(resource)) { + if (!this.unresolvedRoots.remove (resource)) { + missingRoots.remove(resource.getRoots()[0]); + } + } + else { + fire = true; } } - else { - fire = true; + for (Iterator it = newResources.iterator(); it.hasNext();) { + PathResourceImplementation resource = (PathResourceImplementation) it.next(); + oldResources.add (resource); } + this.resourceMap.put (cp,oldResources); + this.unresolvedRoots.addAll(newResources); } - for (Iterator it = newResources.iterator(); it.hasNext();) { - PathResourceImplementation resource = (PathResourceImplementation) it.next(); - oldResources.add (resource); - } - this.resourceMap.put (cp,oldResources); - this.unresolvedRoots.addAll(newResources); } if (fire) { this.firePropertyChange(PROP_RESOURCES); @@ -454,6 +460,22 @@ Object wpk = pair.getKey(); if (key.equals(wpk)) { it.remove(); + return pair.getValue(); + } + } + } + return null; + } + + public Object get (Object key) { + if (key == null) { + return null; + } + synchronized (MergedClassPathImplementation.this) { + for (Iterator it = this.data.iterator(); it.hasNext();) { + WeakPair pair = (WeakPair) it.next (); + Object wpk = pair.getKey(); + if (key.equals(wpk)) { return pair.getValue(); } }