Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbridgha2006-07-26 19:22:04 +0000
committercbridgha2006-07-26 19:22:04 +0000
commit352faedde1316281395077f926eba7adc51396f9 (patch)
tree14ca1c9a8cd044ae31bafc73a6c3f00fd5cb2cc2
parent8dd88d8b7b4e25fc690a4032f0fbc9e4cdb67174 (diff)
downloadwebtools.javaee-352faedde1316281395077f926eba7adc51396f9.tar.gz
webtools.javaee-352faedde1316281395077f926eba7adc51396f9.tar.xz
webtools.javaee-352faedde1316281395077f926eba7adc51396f9.zip
[146328] JS undo last change
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java78
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java8
2 files changed, 78 insertions, 8 deletions
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
index f31a135fb..c4fd613da 100644
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
+++ b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
@@ -24,7 +24,10 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -69,7 +72,17 @@ public abstract class FlexibleProjectContainer
static
{
+ // Register the resource listener that will listen for changes to
+ // resources relevant to flexible project containers across the
+ // workspace and refresh them as necessary.
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+
+ ws.addResourceChangeListener( new Listener(),
+ IResourceChangeEvent.POST_CHANGE );
+
// Read the decorations from the workspace metadata.
+
final String plugin = CommonFrameworksPlugin.PLUGIN_ID;
decorations = new ClasspathDecorationsManager( plugin );
}
@@ -425,4 +438,69 @@ public abstract class FlexibleProjectContainer
return false;
}
+ private static class Listener
+
+ implements IResourceChangeListener
+
+ {
+ public void resourceChanged( final IResourceChangeEvent event )
+ {
+ // Locate all of the flexible project containers.
+
+ final ArrayList containers = new ArrayList();
+
+ final IProject[] projects
+ = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+
+ for( int i = 0; i < projects.length; i++ )
+ {
+ final IProject project = projects[ i ];
+
+ try
+ {
+ if( isJavaProject( project ) )
+ {
+ final IJavaProject jproj = JavaCore.create( project );
+ final IClasspathEntry[] cpes = jproj.getRawClasspath();
+
+ for( int j = 0; j < cpes.length; j++ )
+ {
+ final IClasspathEntry cpe = cpes[ j ];
+
+ if( cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER )
+ {
+ final IClasspathContainer cont
+ = JavaCore.getClasspathContainer( cpe.getPath(), jproj );
+
+ if( cont instanceof FlexibleProjectContainer )
+ {
+ containers.add( cont );
+ }
+ }
+ }
+ }
+ }
+ catch( JavaModelException e )
+ {
+ CommonFrameworksPlugin.log( e );
+ }
+ }
+
+ // Refresh the containers that are out of date.
+
+ final IResourceDelta delta = event.getDelta();
+
+ for( int i = 0, n = containers.size(); i < n; i++ )
+ {
+ final FlexibleProjectContainer c
+ = (FlexibleProjectContainer) containers.get( i );
+
+ if( c.isOutOfDate( delta ) )
+ {
+ c.refresh();
+ }
+ }
+ }
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
index 8cd907565..275a95211 100644
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
@@ -17,7 +17,6 @@ import java.util.List;
import java.util.Vector;
import org.eclipse.core.internal.boot.PlatformURLConnection;
-import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -35,7 +34,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler;
-import org.eclipse.jst.j2ee.internal.web.classpath.WebAppLibrariesContainerUpdater;
import org.eclipse.jst.j2ee.internal.web.util.WebEditAdapterFactory;
import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
@@ -258,7 +256,6 @@ public class WebPlugin extends WTPPlugin implements ResourceLocator {
public void stop(BundleContext context) throws Exception {
super.stop(context);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(WebAppLibrariesContainerUpdater.getInstance());
}
public void start(BundleContext context) throws Exception {
@@ -266,11 +263,6 @@ public class WebPlugin extends WTPPlugin implements ResourceLocator {
//WebAppResourceFactory.register(WTPResourceFactoryRegistry.INSTANCE);
IAdapterManager manager = Platform.getAdapterManager();
manager.registerAdapters(new WebEditAdapterFactory(), ArtifactEditModel.class);
-
- // Register the resource listener that will listen for changes to
- // resources relevant to flexible project containers across the
- // workspace and refresh them as necessary.
- ResourcesPlugin.getWorkspace().addResourceChangeListener(WebAppLibrariesContainerUpdater.getInstance(), IResourceChangeEvent.POST_CHANGE);
}

Back to the top