Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeboer2006-07-28 22:16:35 +0000
committerdeboer2006-07-28 22:16:35 +0000
commit879f8eb6fd6c9132184472ad0900e146201aa4a0 (patch)
tree66717b0ca9f0d085e6134f675934e30f25dbed14
parent05bfab80d884088bf80c3b4afa7a794434a3865f (diff)
downloadwebtools.servertools-879f8eb6fd6c9132184472ad0900e146201aa4a0.tar.gz
webtools.servertools-879f8eb6fd6c9132184472ad0900e146201aa4a0.tar.xz
webtools.servertools-879f8eb6fd6c9132184472ad0900e146201aa4a0.zip
[148314] Unbound classpath container doesn't update
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java3
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/JavaServerPlugin.java29
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.java2
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.properties4
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainer.java67
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java5
-rw-r--r--plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java1
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/plugin.properties7
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeClasspathProvider.java17
-rw-r--r--plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/Messages.properties2
10 files changed, 93 insertions, 44 deletions
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
index 81428c79c..4bcd7ce91 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
@@ -83,6 +83,7 @@ public abstract class RuntimeClasspathProviderDelegate {
*
* @param runtime the runtime to resolve the container label for
* @return a classpath container label
+ * @deprecated method is no longer required. the runtime type name is used instead
*/
public String getClasspathContainerLabel(IRuntime runtime) {
return null;
@@ -110,7 +111,7 @@ public abstract class RuntimeClasspathProviderDelegate {
* @param runtime the runtime to resolve the container label for
* @param id the classpath entry id
* @return a classpath container label
- * @deprecated should use the equivalent method without the unused id variable
+ * @deprecated method is no longer required. the runtime type name is used instead
*/
public String getClasspathContainerLabel(IRuntime runtime, String id) {
return getClasspathContainerLabel(runtime);
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/JavaServerPlugin.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/JavaServerPlugin.java
index 7c7fa05b8..7f81dda28 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/JavaServerPlugin.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/JavaServerPlugin.java
@@ -83,15 +83,15 @@ public class JavaServerPlugin extends Plugin {
runtimeListener = new IRuntimeLifecycleListener() {
public void runtimeAdded(IRuntime runtime) {
- handleRuntimeChange(runtime);
+ handleRuntimeChange(runtime, 0);
}
public void runtimeChanged(IRuntime runtime) {
- handleRuntimeChange(runtime);
+ handleRuntimeChange(runtime, 1);
}
public void runtimeRemoved(IRuntime runtime) {
- handleRuntimeChange(runtime);
+ handleRuntimeChange(runtime, 2);
}
};
@@ -110,15 +110,25 @@ public class JavaServerPlugin extends Plugin {
* Handle a runtime change by potentially updating the classpath container.
*
* @param runtime a runtime
+ * @deprecated should not be called directly, will be removed
*/
- protected void handleRuntimeChange(final IRuntime runtime) {
+ protected void handleRuntimeChange(IRuntime runtime) {
+ handleRuntimeChange(runtime, 1);
+ }
+
+ /**
+ * Handle a runtime change by potentially updating the classpath container.
+ *
+ * @param runtime a runtime
+ */
+ protected void handleRuntimeChange(final IRuntime runtime, final int act) {
if (runtime == null)
throw new IllegalArgumentException();
Trace.trace(Trace.FINEST, "Possible runtime change: " + runtime);
final RuntimeClasspathProviderWrapper rcpw = findRuntimeClasspathProvider(runtime.getRuntimeType());
- if (rcpw != null && rcpw.hasRuntimeClasspathChanged(runtime)) {
+ if (rcpw != null && (rcpw.hasRuntimeClasspathChanged(runtime) || act != 1)) {
final IPath serverContainerPath = new Path(RuntimeClasspathContainer.SERVER_CONTAINER)
.append(rcpw.getId()).append(runtime.getId());
@@ -138,7 +148,7 @@ public class JavaServerPlugin extends Plugin {
for (int i = 0; i < size; i++) {
if (projects[i].isAccessible()) {
try {
- IJavaProject javaProject = JavaCore.create(projects[i]);
+ IJavaProject javaProject = JavaCore.create(projects[i]); // TODO is java project?
boolean found = false;
IClasspathEntry[] ce = javaProject.getRawClasspath();
@@ -152,8 +162,11 @@ public class JavaServerPlugin extends Plugin {
Trace.trace(Trace.FINEST, "Classpath change on: " + projects[i] + " " + found);
if (found) {
- RuntimeClasspathContainer container = new RuntimeClasspathContainer(
- serverContainerPath, rcpw, runtime);
+ IRuntime runtime2 = runtime;
+ if (act == 2)
+ runtime2 = null;
+ RuntimeClasspathContainer container = new RuntimeClasspathContainer(projects[i],
+ serverContainerPath, rcpw, runtime2, runtime.getId());
JavaCore.setClasspathContainer(serverContainerPath, new IJavaProject[] { javaProject },
new IClasspathContainer[] {container}, null);
}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.java
index f278bab86..ad24995b1 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.java
@@ -18,6 +18,8 @@ public class Messages extends NLS {
public static String errorLocation;
public static String errorJRE;
public static String classpathContainerDescription;
+ public static String classpathContainer;
+ public static String classpathContainerUnbound;
public static String copyingTask;
public static String deletingTask;
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.properties b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.properties
index 5ecea2a4b..97f0fe599 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.properties
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/Messages.properties
@@ -9,7 +9,9 @@
# IBM Corporation - initial API and implementation
###############################################################################
-classpathContainerDescription=Server Classpath Container
+classpathContainerDescription=Server Library
+classpathContainer={0} [{1}]
+classpathContainerUnbound={0} [{1}] (unbound)
errorLocation=Invalid location.
errorJRE=Invalid JRE.
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainer.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainer.java
index a429a52a6..18180907b 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainer.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainer.java
@@ -10,11 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.core.internal;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
/**
*
*/
@@ -27,6 +30,8 @@ public class RuntimeClasspathContainer implements IClasspathContainer {
private IPath path;
private RuntimeClasspathProviderWrapper delegate;
private IRuntime runtime;
+ private String runtimeId;
+ private IProject project;
/**
* Create a new runtime classpath container.
@@ -35,7 +40,7 @@ public class RuntimeClasspathContainer implements IClasspathContainer {
* @param delegate
* @param runtime
* @param id
- * @deprecated should use the equivalent method without the unused id variable
+ * @deprecated should use the constructor that accepts a project
*/
public RuntimeClasspathContainer(IPath path, RuntimeClasspathProviderWrapper delegate, IRuntime runtime, String id) {
this.path = path;
@@ -49,6 +54,7 @@ public class RuntimeClasspathContainer implements IClasspathContainer {
* @param path
* @param delegate
* @param runtime
+ * @deprecated should use the constructor that accepts a project
*/
public RuntimeClasspathContainer(IPath path, RuntimeClasspathProviderWrapper delegate, IRuntime runtime) {
this.path = path;
@@ -56,6 +62,23 @@ public class RuntimeClasspathContainer implements IClasspathContainer {
this.runtime = runtime;
}
+ /**
+ * Create a new runtime classpath container.
+ *
+ * @param project
+ * @param path
+ * @param delegate
+ * @param runtime
+ * @param runtimeId
+ */
+ public RuntimeClasspathContainer(IProject project, IPath path, RuntimeClasspathProviderWrapper delegate, IRuntime runtime, String runtimeId) {
+ this.project = project;
+ this.path = path;
+ this.delegate = delegate;
+ this.runtime = runtime;
+ this.runtimeId = runtimeId;
+ }
+
/** (non-Javadoc)
* @see org.eclipse.jdt.core.IClasspathContainer#getClasspathEntries()
*/
@@ -74,13 +97,14 @@ public class RuntimeClasspathContainer implements IClasspathContainer {
* @see org.eclipse.jdt.core.IClasspathContainer#getDescription()
*/
public String getDescription() {
- if (runtime != null && delegate != null) {
- String s = delegate.getClasspathContainerLabel(runtime);
- if (s != null)
- return s;
+ if (runtime != null) {
+ if (runtime != null) {
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
+ return NLS.bind(Messages.classpathContainer, runtimeType.getName(), runtime.getName());
+ }
}
-
- return Messages.classpathContainerDescription;
+ return NLS.bind(Messages.classpathContainerUnbound, Messages.classpathContainerDescription, runtimeId);
}
/** (non-Javadoc)
@@ -96,4 +120,33 @@ public class RuntimeClasspathContainer implements IClasspathContainer {
public IPath getPath() {
return path;
}
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RuntimeClasspathContainer))
+ return false;
+
+ RuntimeClasspathContainer rcc = (RuntimeClasspathContainer) obj;
+ if (delegate != null && !delegate.equals(rcc.delegate))
+ return false;
+
+ if (runtime == null && rcc.runtime != null)
+ return false;
+
+ if (runtime != null && !runtime.equals(rcc.runtime))
+ return false;
+
+ if (runtimeId != null && !runtimeId.equals(rcc.runtimeId))
+ return false;
+
+ if (project == null && rcc.project != null)
+ return false;
+
+ if (project != null && !project.equals(rcc.project))
+ return false;
+
+ if (path != null && !path.equals(rcc.path))
+ return false;
+
+ return true;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java
index bd591635f..5b1585596 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java
@@ -27,14 +27,15 @@ public class RuntimeClasspathContainerInitializer extends ClasspathContainerInit
if (containerPath.segment(0).equals(RuntimeClasspathContainer.SERVER_CONTAINER)) {
RuntimeClasspathProviderWrapper delegate = null;
IRuntime runtime = null;
+ String runtimeId = null;
if (containerPath.segmentCount() > 2) {
delegate = JavaServerPlugin.findRuntimeClasspathProvider(containerPath.segment(1));
- String runtimeId = containerPath.segment(2);
+ runtimeId = containerPath.segment(2);
if (runtimeId != null)
runtime = ServerCore.findRuntime(runtimeId);
}
- RuntimeClasspathContainer container = new RuntimeClasspathContainer(containerPath, delegate, runtime);
+ RuntimeClasspathContainer container = new RuntimeClasspathContainer(project.getProject(), containerPath, delegate, runtime, runtimeId);
JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
}
}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java
index 94c7ccdfe..d6e5737ab 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java
@@ -140,6 +140,7 @@ public class RuntimeClasspathProviderWrapper {
/*
* @see RuntimeClasspathProviderDelegate#getClasspathContainerLabel(IRuntime)
+ * @deprecated No longer used
*/
public String getClasspathContainerLabel(IRuntime runtime) {
if (runtime == null)
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties b/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
index 2232a5afd..af99fd746 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
+++ b/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
@@ -24,13 +24,6 @@ runtimeTypeTomcat50Description=Apache Tomcat v5.0 supports J2EE 1.2, 1.3, and 1.
runtimeTypeTomcat55Label=Apache Tomcat v5.5
runtimeTypeTomcat55Description=Apache Tomcat v5.5 supports J2EE 1.2, 1.3, and 1.4 Web modules.
-# runtime target
-target32runtime=Tomcat v3.2 runtime
-target40runtime=Tomcat v4.0 runtime
-target41runtime=Tomcat v4.1 runtime
-target50runtime=Tomcat v5.0 runtime
-target55runtime=Tomcat v5.5 runtime
-
# --------------- Servers ---------------
tomcat32ServerType=Tomcat v3.2 Server
tomcat32ServerDescription=Publishes and runs J2EE Web projects and server configurations to a local Tomcat server.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeClasspathProvider.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeClasspathProvider.java
index d8a8a9d48..e3850c469 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeClasspathProvider.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeClasspathProvider.java
@@ -39,23 +39,6 @@ public class TomcatRuntimeClasspathProvider extends RuntimeClasspathProviderDele
}
/**
- * @see RuntimeClasspathProviderDelegate#getClasspathContainerLabel(IRuntime)
- */
- public String getClasspathContainerLabel(IRuntime runtime) {
- String id2 = runtime.getRuntimeType().getId();
- if (id2.indexOf("32") > 0)
- return Messages.target32runtime;
- else if (id2.indexOf("40") > 0)
- return Messages.target40runtime;
- else if (id2.indexOf("41") > 0)
- return Messages.target41runtime;
- else if (id2.indexOf("50") > 0)
- return Messages.target50runtime;
-
- return Messages.target55runtime;
- }
-
- /**
* @see RuntimeClasspathProviderDelegate#resolveClasspathContainer(IRuntime)
*/
public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
diff --git a/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/Messages.properties b/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/Messages.properties
index f12f916a8..aa531d636 100644
--- a/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/Messages.properties
+++ b/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/Messages.properties
@@ -19,7 +19,7 @@ runtimeTypeJRE=&JRE:
runtimeTypeDefaultJRE=Workbench default JRE
runtimeTypeInstalledJREs=In&stalled JREs...
-classpathContainer=Server Runtime
+classpathContainer=Server Library
classpathContainerDescription=Select a server runtime to add to the classpath
classpathContainerRuntimeList=Select a &runtime to add to the classpath:

Back to the top