Lines 201-208
Link Here
|
201 |
|
201 |
|
202 |
private static final int MODULE_UPDATE_DELAY = 30; |
202 |
private static final int MODULE_UPDATE_DELAY = 30; |
203 |
public static final String MODULE_UPDATE_JOB_NAME = Messages.J2EEComponentClasspathUpdater_EAR_Libraries_Update_Jo_; |
203 |
public static final String MODULE_UPDATE_JOB_NAME = Messages.J2EEComponentClasspathUpdater_EAR_Libraries_Update_Jo_; |
|
|
204 |
public static final String FIND_NODE_JOB_NAME = Messages.J2EEComponentClasspathUpdater_Find_Node; |
204 |
|
205 |
|
205 |
private final ModuleUpdateJob moduleUpdateJob = new ModuleUpdateJob(); |
206 |
private final ModuleUpdateJob moduleUpdateJob = new ModuleUpdateJob(); |
|
|
207 |
|
208 |
public class FindNodeJob extends Job { |
209 |
|
210 |
IResourceDelta[] delta; |
211 |
|
212 |
@Override |
213 |
public boolean belongsTo(Object family) { |
214 |
if(family == FIND_NODE_JOB_NAME){ |
215 |
return true; |
216 |
} |
217 |
return super.belongsTo(family); |
218 |
} |
219 |
|
220 |
/* |
221 |
* Needs to notice changes to MANIFEST.MF in any J2EE projects, changes to |
222 |
* .component in any J2EE Projects, and any archive changes in EAR projects |
223 |
*/ |
224 |
|
225 |
private boolean findNode(IResourceDelta[] delta) { |
226 |
|
227 |
for (int i = 0; i < delta.length; i++) { |
228 |
if (delta[i].toString().indexOf(IJ2EEModuleConstants.COMPONENT_FILE_NAME) != -1) { |
229 |
StructureEdit core = StructureEdit |
230 |
.getStructureEditForRead(delta[i].getResource() |
231 |
.getProject()); |
232 |
if(null != core){ |
233 |
WorkbenchComponent component = core.getComponent(); |
234 |
if(component != null){ |
235 |
clearResourceTreeRootCache(component); |
236 |
} |
237 |
} |
238 |
} else { |
239 |
findNode(delta[i].getAffectedChildren()); |
240 |
} |
241 |
} |
242 |
|
243 |
return true; |
244 |
} |
245 |
|
246 |
|
247 |
public FindNodeJob(IResourceDelta[] d) { |
248 |
super(FIND_NODE_JOB_NAME); |
249 |
setRule(ResourcesPlugin.getWorkspace().getRoot()); |
250 |
setSystem(true); |
251 |
setDelta(d); |
252 |
} |
253 |
|
254 |
@Override |
255 |
protected IStatus run(IProgressMonitor monitor) { |
256 |
|
257 |
SafeRunner.run(new ISafeRunnable() { |
258 |
public void handleException(Throwable e) { |
259 |
J2EEPlugin.logError(e); |
260 |
} |
261 |
|
262 |
public void run() throws Exception { |
263 |
|
264 |
findNode(delta); |
265 |
|
266 |
} |
267 |
}); |
268 |
|
269 |
return Status.OK_STATUS; |
270 |
} |
271 |
|
272 |
public void setDelta(IResourceDelta[] delta) { |
273 |
this.delta = delta; |
274 |
} |
275 |
} |
206 |
|
276 |
|
207 |
public class ModuleUpdateJob extends Job { |
277 |
public class ModuleUpdateJob extends Job { |
208 |
|
278 |
|
Lines 431-437
Link Here
|
431 |
scheduleJob = true; |
501 |
scheduleJob = true; |
432 |
event.getDelta().accept(this); |
502 |
event.getDelta().accept(this); |
433 |
IResourceDelta[] d = event.getDelta().getAffectedChildren(); |
503 |
IResourceDelta[] d = event.getDelta().getAffectedChildren(); |
434 |
findNode(d); |
504 |
FindNodeJob newJob = createFindNodeJob(d); |
|
|
505 |
newJob.schedule(); |
435 |
} |
506 |
} |
436 |
break; |
507 |
break; |
437 |
} |
508 |
} |
Lines 443-448
Link Here
|
443 |
} |
514 |
} |
444 |
} |
515 |
} |
445 |
|
516 |
|
|
|
517 |
|
518 |
private FindNodeJob createFindNodeJob(IResourceDelta[] d) { |
519 |
|
520 |
return new FindNodeJob(d); |
521 |
} |
446 |
|
522 |
|
447 |
public static void clearResourceTreeRootCache(WorkbenchComponent aModule) { |
523 |
public static void clearResourceTreeRootCache(WorkbenchComponent aModule) { |
448 |
|
524 |
|
Lines 458-490
Link Here
|
458 |
if(null != resourceTreeAdapter){ |
534 |
if(null != resourceTreeAdapter){ |
459 |
resourceTreeAdapter.setResourceTreeRoot(null); |
535 |
resourceTreeAdapter.setResourceTreeRoot(null); |
460 |
} |
536 |
} |
461 |
} |
|
|
462 |
|
463 |
|
464 |
/* |
465 |
* Needs to notice changes to MANIFEST.MF in any J2EE projects, changes to |
466 |
* .component in any J2EE Projects, and any archive changes in EAR projects |
467 |
*/ |
468 |
|
469 |
public boolean findNode(IResourceDelta[] delta) { |
470 |
|
471 |
for (int i = 0; i < delta.length; i++) { |
472 |
if (delta[i].toString().indexOf(IJ2EEModuleConstants.COMPONENT_FILE_NAME) != -1) { |
473 |
StructureEdit core = StructureEdit |
474 |
.getStructureEditForRead(delta[i].getResource() |
475 |
.getProject()); |
476 |
if(null != core){ |
477 |
WorkbenchComponent component = core.getComponent(); |
478 |
if(component != null){ |
479 |
clearResourceTreeRootCache(component); |
480 |
} |
481 |
} |
482 |
} else { |
483 |
findNode(delta[i].getAffectedChildren()); |
484 |
} |
485 |
} |
486 |
|
487 |
return true; |
488 |
} |
537 |
} |
489 |
|
538 |
|
490 |
public boolean visit(IResourceDelta delta) { |
539 |
public boolean visit(IResourceDelta delta) { |