Author: scabanovich
Date: 2012-01-10 20:54:58 -0500 (Tue, 10 Jan 2012)
New Revision: 37754
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
When checking what has changed in classpath, we should take into account
'excluded' attribute.
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 2012-01-11
01:51:33 UTC (rev 37753)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java 2012-01-11
01:54:58 UTC (rev 37754)
@@ -49,6 +49,7 @@
Set<String> projects = new HashSet<String>();
LibraryNames libraryNames = new LibraryNames();
+ int excudedState = 0;
List<LibsListener> listeners = new ArrayList<LibsListener>();
@@ -83,10 +84,16 @@
}
public boolean update() {
+ boolean result = false;
int cpv = classpathVersion;
- boolean result = hasToUpdatePaths() && updatePaths(getNewPaths(), cpv);
- if(result) fire();
- if(paths == null && result) return true;
+ if(hasToUpdatePaths()) {
+ result = updatePaths(getNewPaths(), cpv);
+ if(isExcludedStateChanged()) {
+ result = true;
+ }
+ if(result) fire();
+ if(paths == null && result) return true;
+ }
if(paths != null) updateFileSystems(paths);
fsVersion = pathsVersion;
@@ -132,6 +139,38 @@
projects = result;
}
+ private boolean isExcludedStateChanged() {
+ try {
+ int es = computeExcludedState();
+ if(es != excudedState) {
+ excudedState = es;
+ return true;
+ }
+ } catch (JavaModelException e) {
+ ModelPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+
+ private int computeExcludedState() throws JavaModelException {
+ int result = 0;
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(getProjectResource());
+ if(javaProject != null) {
+ IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
+ for (int i = 0; i < es.length; i++) {
+ IPath p = es[i].getPath();
+ IPath[] ps = es[i].getExclusionPatterns();
+ if(ps != null && ps.length > 0) {
+ for (int j = 0; j < ps.length; j++) {
+ String key = p.toString() + "/" + ps[j].toString();
+ result += key.hashCode();
+ }
+ }
+ }
+ }
+ return result;
+ }
+
private synchronized boolean updatePaths(List<String> newPaths, int cpv) {
if(cpv <= pathsVersion) {
return false;