Author: snjeza
Date: 2011-11-27 10:05:01 -0500 (Sun, 27 Nov 2011)
New Revision: 36678
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java
Log:
JBIDE-10131 Project Examples only check if there is a runtime not if there is a server
setup
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java 2011-11-26
14:28:07 UTC (rev 36677)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java 2011-11-27
15:05:01 UTC (rev 36678)
@@ -35,7 +35,10 @@
import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.internal.RuntimeType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
@@ -191,6 +194,11 @@
if (runtimes.length > 0
&& ProjectFix.ANY.equals(allowedType)) {
for (IRuntime runtime:runtimes) {
+ //
https://issues.jboss.org/browse/JBIDE-10131
+ IServer server = getServer(runtime);
+ if (server == null) {
+ continue;
+ }
IRuntime componentPresent = isComponentPresent(fix, runtime);
if (componentPresent != null) {
return isComponentPresent(fix, runtime);
@@ -200,6 +208,11 @@
}
for (int i = 0; i < runtimes.length; i++) {
IRuntime runtime = runtimes[i];
+ //
https://issues.jboss.org/browse/JBIDE-10131
+ IServer server = getServer(runtime);
+ if (server == null) {
+ continue;
+ }
IRuntimeType runtimeType = runtime.getRuntimeType();
if (runtimeType != null && runtimeType.getId().equals(allowedType)) {
IRuntime componentPresent = isComponentPresent(fix, runtime);
@@ -212,6 +225,31 @@
return null;
}
+ private IServer getServer(IRuntime runtime) {
+ if (runtime == null) {
+ return null;
+ }
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType == null || runtimeType.getId() == null) {
+ return null;
+ }
+ IServer[] servers = ServerCore.getServers();
+ for (IServer server:servers) {
+ IServerType serverType = server.getServerType();
+ if (serverType == null) {
+ continue;
+ }
+ IRuntimeType serverRuntimeType = serverType.getRuntimeType();
+ if (serverRuntimeType == null) {
+ continue;
+ }
+ if (runtimeType.getId().equals(serverRuntimeType.getId())) {
+ return server;
+ }
+ }
+ return null;
+ }
+
private IRuntime isComponentPresent(ProjectFix fix, IRuntime runtime) {
String required_components = fix.getProperties().get(REQUIRED_COMPONENTS);
if (required_components == null) {