Author: yradtsevich
Date: 2009-04-15 10:11:28 -0400 (Wed, 15 Apr 2009)
New Revision: 14757
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
RESOLVED - issue JBIDE-4108: VPE Refresh is broken with NPE
https://jira.jboss.org/jira/browse/JBIDE-4108
- GreedyRule has modified such a way that UIJobs created in different editors can be run
concurrently.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-04-15
12:34:57 UTC (rev 14756)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-04-15
14:11:28 UTC (rev 14757)
@@ -1387,7 +1387,7 @@
return Status.OK_STATUS;
}
};
- visualRefreshJob.setRule(new GreedyRule());
+ visualRefreshJob.setRule(new GreedyRule(this));
visualRefreshJob.setPriority(Job.SHORT);
visualRefreshJob.schedule();
}
@@ -2664,7 +2664,7 @@
return Status.OK_STATUS;
}
};
- reinitJob.setRule(new GreedyRule());
+ reinitJob.setRule(new GreedyRule(this));
reinitJob.schedule();
}
@@ -2755,16 +2755,25 @@
/**
* Jobs with different instances of {@code GreedyRule}
- * are never run in parallel.
+ * but the same {@code grredyObject} are
+ * never run concurrently.
*
* @author yradtsevich
*/
- private class GreedyRule implements ISchedulingRule {
+ private final class GreedyRule implements ISchedulingRule {
+ private Object greedyObject;
+ public GreedyRule(Object greedyObject) {
+ this.greedyObject = greedyObject;
+ }
public boolean contains(ISchedulingRule rule) {
return this == rule;
}
public boolean isConflicting(ISchedulingRule rule) {
- return this.getClass() == rule.getClass();
+ if (rule instanceof GreedyRule) {
+ return ((GreedyRule) rule).greedyObject == this.greedyObject;
+ } else {
+ return false;
+ }
}
}
}