Author: snjeza
Date: 2012-05-31 15:04:56 -0400 (Thu, 31 May 2012)
New Revision: 41590
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java
Log:
JBDS-2183 - EAP6 installed with JBDS should have name "jboss-eap-6" in Servers
view instead of "jboss-as"
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java
===================================================================
---
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java 2012-05-31
19:03:22 UTC (rev 41589)
+++
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java 2012-05-31
19:04:56 UTC (rev 41590)
@@ -40,7 +40,7 @@
public class JBossRuntimeStartup {
private static final String JBOSS_EAP_HOME = "../../jboss-eap"; // JBoss EAP
home directory (relative to plugin)- <RHDS_HOME>/jbossas. //$NON-NLS-1$
-
+ private static final String EAP = "EAP"; //$NON-NLS-1$
private static final String LOCATIONS_FILE_NAME =
"runtime_locations.properties"; //$NON-NLS-1$
private static final String LOCATIONS_FILE = "../../../../studio/" +
LOCATIONS_FILE_NAME; //$NON-NLS-1$
private static final String LOCATIONS_FILE_CONFIGURATION = "../../studio/" +
LOCATIONS_FILE_NAME; //$NON-NLS-1$
@@ -58,6 +58,10 @@
runtimePath.getServerDefinitions().clear();
for (RuntimeDefinition serverDefinition : serverDefinitions) {
serverDefinition.setRuntimePath(runtimePath);
+ if (EAP.equals(serverDefinition.getType())) {
+ String name = getUniqueName("jboss-eap-" + serverDefinition.getVersion(),
serverDefinition, serverDefinitions);
+ serverDefinition.setName(name);
+ }
}
initializeRuntimes(serverDefinitions);
}
@@ -82,6 +86,28 @@
}
}
+ private static String getUniqueName(String name, RuntimeDefinition serverDefinition,
List<RuntimeDefinition> serverDefinitions) {
+ int i = 0;
+ boolean end = false;
+ while (!end) {
+ end = true;
+ for (RuntimeDefinition definition : serverDefinitions) {
+ if (definition == serverDefinition) {
+ continue;
+ }
+ if (i > 0) {
+ name = name + "(" + i + ")";
+ }
+ if (name.equals(definition.getName())) {
+ i++;
+ end = false;
+ break;
+ }
+ }
+ }
+ return name;
+ }
+
public static void initializeRuntimes(List<RuntimeDefinition> serverDefinitions)
{
Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
for( IRuntimeDetector detector:detectors) {
Show replies by date