Author: max.andersen(a)jboss.com
Date: 2007-10-31 09:23:27 -0400 (Wed, 31 Oct 2007)
New Revision: 4590
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/WorkaroundFor207146.java
Log:
fix to Workaround207146 to not run when not needed and make sure all deltas are checkked.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/WorkaroundFor207146.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/WorkaroundFor207146.java 2007-10-31
08:05:04 UTC (rev 4589)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/WorkaroundFor207146.java 2007-10-31
13:23:27 UTC (rev 4590)
@@ -46,6 +46,10 @@
public static class WebContentUpdater implements IResourceChangeListener {
public void resourceChanged(IResourceChangeEvent event) {
+ if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
+ //SeamGuiPlugin.getDefault().logInfo("No reason to run");
+ return;
+ }
ManifestChangeDetector visitor = new ManifestChangeDetector();
try {
event.getDelta().accept(visitor);
@@ -55,7 +59,7 @@
if(visitor.skip) return; // skip listener if MANIFEST.MF and WEB-INF were changed
IResourceDelta[] delta = event.getDelta().getAffectedChildren();
-
+
// go trough changed resources
for (IResourceDelta resourceDelta : delta) {
IProject prj = resourceDelta.getResource().getProject();
@@ -63,28 +67,33 @@
if(comp==null) continue;
final IVirtualFolder root = comp.getRootFolder();
// check that changes in WebContent folder
- if(event.getDelta().findMember(root.getUnderlyingFolder().getFullPath())==null) {
- return;
+ IResourceDelta foundMember =
event.getDelta().findMember(root.getUnderlyingFolder().getFullPath());
+ if(foundMember!=null) {
+ //SeamGuiPlugin.getDefault().logInfo("Refreshing package explorer to workaround
Eclipse bug 207146: " + findMember.getFullPath());
+ refreshPackageExplorer();
+ return; // only required to refresh once.
}
- // Refresh Package Explorer
- Display display = Display.getDefault();
- if(display==null) {
- return;
- }
- display.asyncExec(new Runnable() {
- public void run() {
- PackageExplorerPart p = PackageExplorerPart.getFromActivePerspective();
- if(p!=null) {
- TreeViewer tv = p.getTreeViewer();
- if(tv!=null) {
- tv.refresh();
- }
- }
- }
- });
+ }
+ }
+ private void refreshPackageExplorer() {
+ // Refresh Package Explorer
+ Display display = Display.getDefault();
+ if(display==null) {
return;
}
+ display.asyncExec(new Runnable() {
+ public void run() {
+ PackageExplorerPart p = PackageExplorerPart.getFromActivePerspective();
+ if(p!=null) {
+ TreeViewer tv = p.getTreeViewer();
+ if(tv!=null) {
+
+ tv.refresh();
+ }
+ }
+ }
+ });
}
}
Show replies by date