Author: scabanovich
Date: 2011-10-17 19:11:28 -0400 (Mon, 17 Oct 2011)
New Revision: 35739
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarSystemImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/LibsListener.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java
Log:
JBIDE-9918
https://issues.jboss.org/browse/JBIDE-9918
Jar modification is fired to builders.
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2011-10-17
22:01:57 UTC (rev 35738)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2011-10-17
23:11:28 UTC (rev 35739)
@@ -191,6 +191,7 @@
}
super.set(XModelObjectConstants.XML_ATTR_NAME, name);
super.set("EXTENSION", extension); //$NON-NLS-1$
+ safeChangeTimeStamp();
fireObjectChanged(null);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarSystemImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarSystemImpl.java 2011-10-17
22:01:57 UTC (rev 35738)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarSystemImpl.java 2011-10-17
23:11:28 UTC (rev 35739)
@@ -119,6 +119,9 @@
loaded = false;
loaded2 = false;
fire = true;
+ if(getParent() instanceof FileSystemsImpl) {
+ ((FileSystemsImpl)getParent()).getLibs().libraryChanged(this);
+ }
fireStructureChanged(3, null);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java 2011-10-17
22:01:57 UTC (rev 35738)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java 2011-10-17
23:11:28 UTC (rev 35739)
@@ -194,6 +194,9 @@
XModelObject o = object.getChildByPath(jsname);
if(o != null) {
fss.remove(o);
+ if(o instanceof JarSystemImpl) {
+ ((JarSystemImpl)o).update();
+ }
} else {
o = object.getModel().createModelObject(libEntity, null);
o.setAttributeValue(XModelObjectConstants.ATTR_NAME, jsname);
@@ -241,15 +244,15 @@
}
void fire() {
- LibsListener[] ls = null;
- synchronized(this) {
- ls = listeners.toArray(new LibsListener[0]);
- }
- if(ls != null) for (LibsListener listener: ls) {
+ for (LibsListener listener: getListeners()) {
listener.pathsChanged(paths);
}
}
+ private synchronized LibsListener[] getListeners() {
+ return listeners.toArray(new LibsListener[0]);
+ }
+
int classpathVersion = 0;
int pathsVersion = -1;
int fsVersion = -1;
@@ -285,6 +288,12 @@
return projects.contains(p.getName());
}
+ public void libraryChanged(JarSystemImpl jar) {
+ for (LibsListener listener: getListeners()) {
+ listener.libraryChanged(jar.getLocation());
+ }
+ }
+
}
class LibraryNames {
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/LibsListener.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/LibsListener.java 2011-10-17
22:01:57 UTC (rev 35738)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/LibsListener.java 2011-10-17
23:11:28 UTC (rev 35739)
@@ -19,4 +19,5 @@
*/
public interface LibsListener {
public void pathsChanged(List<String> paths);
+ public void libraryChanged(String path);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java 2011-10-17
22:01:57 UTC (rev 35738)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java 2011-10-17
23:11:28 UTC (rev 35739)
@@ -128,4 +128,11 @@
}
}
+ public void libraryChanged(String path) {
+ synchronized (this) {
+ libsModified = true;
+ processedPaths.remove(path);
+ }
+ }
+
}