[425789] Provide mechanism to control manual creation of server and
runtime creation wizard
diff --git a/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
index e6d0332..ae651e9 100644
--- a/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.server.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.server.core; singleton:=true
-Bundle-Version: 1.5.100.qualifier
+Bundle-Version: 1.6.0.qualifier
Bundle-Activator: org.eclipse.wst.server.core.internal.ServerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.server.core/schema/runtimeTypes.exsd b/plugins/org.eclipse.wst.server.core/schema/runtimeTypes.exsd
index b6dd595..7cec2b4 100644
--- a/plugins/org.eclipse.wst.server.core/schema/runtimeTypes.exsd
+++ b/plugins/org.eclipse.wst.server.core/schema/runtimeTypes.exsd
@@ -127,6 +127,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="supportsManualCreation" type="boolean">
+ <annotation>
+ <documentation>
+ boolean value "true" or "false" to specify whether this runtime type supports manual creation via the runtime creation wizard. This setting can be used for system runtimes or deprecated runtimes. If "true", the runtime will show on the list of selectable runtime types on the runtime creation wizard; otherwise, the runtime will be hidden from the runtime creation wizard. If not specified, the default value is true.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -190,7 +197,7 @@
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.<br>
+ Copyright (c) 2000, 2014 IBM Corporation and others.<br>
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License v1.0 which accompanies
this distribution, and is available at
diff --git a/plugins/org.eclipse.wst.server.core/schema/serverTypes.exsd b/plugins/org.eclipse.wst.server.core/schema/serverTypes.exsd
index 20cd1fc..317cd83 100644
--- a/plugins/org.eclipse.wst.server.core/schema/serverTypes.exsd
+++ b/plugins/org.eclipse.wst.server.core/schema/serverTypes.exsd
@@ -116,6 +116,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="supportsManualCreation" type="boolean">
+ <annotation>
+ <documentation>
+ boolean value "true" or "false" to specify whether this server type supports manual creation via the server creation wizard. This setting can be used for system servers or deprecated servers. If "true", the server will show on the list of selectable server types on the server creation wizard; otherwise, the server will be hidden from the server creation wizard. If not specified, the default value is true.
+ </documentation>
+ </annotation>
+ </attribute>
<attribute name="supportsRemoteHosts" type="boolean">
<annotation>
<documentation>
@@ -236,7 +243,7 @@
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.<br>
+ Copyright (c) 2000, 2014 IBM Corporation and others.<br>
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License v1.0 which accompanies
this distribution, and is available at
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java
index afa1ee8..b6c7af9 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -176,6 +176,25 @@
return null;
return element.getDeclaringExtension().getContributor().getName();
}
+
+ /**
+ * Returns <code>true</code> if this type of runtime can be created manually
+ * from the runtime creation wizard.
+ * Returns <code>false</code> if the runtime type can only be programmatically
+ * and hide from the runtime creation wizard.
+ *
+ * @return <code>true</code> if this type of runtime can be created manually
+ * from the runtime creation wizard, and <code>false</code> if it cannot.
+ * @since 1.6
+ */
+ public boolean supportsManualCreation() {
+ try {
+ String supportsManualCreation = element.getAttribute("supportsManualCreation");
+ return (supportsManualCreation == null || supportsManualCreation.toLowerCase().equals("true"));
+ } catch (Exception e) {
+ return true;
+ }
+ }
public String toString() {
return "RuntimeType[" + getId() + ", " + getName() + "]";
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
index 948ac46..8106605 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -157,6 +157,25 @@
}
}
+ /**
+ * Returns <code>true</code> if this type of server can be created manually
+ * from the server creation wizard.
+ * Returns <code>false</code> if the server type can only be programmatically
+ * and hide from the server creation wizard.
+ *
+ * @return <code>true</code> if this type of server can be created manually
+ * from the server creation wizard, and <code>false</code> if it cannot.
+ * @since 1.6
+ */
+ public boolean supportsManualCreation() {
+ try {
+ String supportsManualCreation = element.getAttribute("supportsManualCreation");
+ return (supportsManualCreation == null || supportsManualCreation.toLowerCase().equals("true"));
+ } catch (Exception e) {
+ return true;
+ }
+ }
+
public boolean supportsRemoteHosts() {
try {
String hosts = element.getAttribute("supportsRemoteHosts");
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
index e169f84..d2de6aa 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,7 +13,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.RuntimeType;
/**
* Runtime type content provider.
*/
@@ -52,6 +54,15 @@
for (int i = 0; i < size; i++) {
IRuntimeType runtimeType = runtimeTypes[i];
if (!creation || runtimeType.canCreate()) {
+ try {
+ if (!((RuntimeType)runtimeType).supportsManualCreation()) {
+ // Hide this runtime type from the list.
+ continue;
+ }
+ } catch (Exception e) {
+ // Do nothing since all IRuntimeType should be instance of RuntimeType.
+ }
+
TreeElement ele = getOrCreate(list, runtimeType.getVendor());
ele.contents.add(runtimeType);
elementToParentMap.put(runtimeType, ele);
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
index 70085d4..acded76 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
import java.util.List;
import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.internal.ServerType;
import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
import org.eclipse.wst.server.ui.internal.Trace;
/**
@@ -72,6 +73,14 @@
if (serverTypeId != null && !serverType.getId().startsWith(serverTypeId))
return false;
+ try {
+ if (!((ServerType)serverType).supportsManualCreation()) {
+ return false;
+ }
+ } catch (Exception e) {
+ // Do nothing since all IServerType should be instance of ServerType.
+ }
+
IRuntimeType runtimeType = serverType.getRuntimeType();
if (runtimeType == null)
return false;