Author: dgolovin
Date: 2008-10-30 18:12:51 -0400 (Thu, 30 Oct 2008)
New Revision: 11376
Modified:
branches/jbosstools-3.0.0.Beta1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java
Log:
https://jira.jboss.org/jira/browse/JBDS-461 fixed
Modified:
branches/jbosstools-3.0.0.Beta1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java 2008-10-30
22:00:31 UTC (rev 11375)
+++
branches/jbosstools-3.0.0.Beta1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java 2008-10-30
22:12:51 UTC (rev 11376)
@@ -168,11 +168,8 @@
jbossASLocation = jbossASLocation.trim();
- IRuntimeWorkingCopy runtime = null;
IProgressMonitor progressMonitor = new NullProgressMonitor();
- if (runtime == null) {
- runtime = createRuntime(name + " Runtime", jbossASLocation,
progressMonitor, index);
- }
+ IRuntime runtime = createRuntime(jbossASLocation, progressMonitor, index, name +
" Runtime");
if (runtime != null) {
createServer(progressMonitor, runtime, index, name);
}
@@ -200,7 +197,7 @@
}
}
- IRuntimeWorkingCopy runtime = null;
+ IRuntime runtime = null;
IRuntime[] runtimes = ServerCore.getRuntimes();
for (int i = 0; i < runtimes.length; i++) {
if (runtimes[0].getLocation().equals(jbossASLocation)) {
@@ -211,7 +208,7 @@
IProgressMonitor progressMonitor = new NullProgressMonitor();
if (runtime == null) {
- runtime = createRuntime(null, jbossASLocation, progressMonitor, 2);
+ runtime = createRuntime(jbossASLocation, progressMonitor, 2,null);
}
if (runtime != null) {
createServer(progressMonitor, runtime, 2, null);
@@ -240,7 +237,7 @@
* @throws ConnectionProfileException
*/
public static IServerWorkingCopy initJBossAS(String jbossASLocation, IProgressMonitor
progressMonitor) throws CoreException, ConnectionProfileException {
- IRuntimeWorkingCopy runtime = createRuntime(null, jbossASLocation, progressMonitor,
2);
+ IRuntime runtime = createRuntime(jbossASLocation, progressMonitor, 2, null);
IServerWorkingCopy server = null;
if (runtime != null) {
server = createServer(progressMonitor, runtime, 2, null);
@@ -256,7 +253,7 @@
* @return runtime working copy
* @throws CoreException
*/
- private static IRuntimeWorkingCopy createRuntime(String runtimeName, String
jbossASLocation, IProgressMonitor progressMonitor, int index) throws CoreException {
+ private static IRuntime createRuntime(String jbossASLocation, IProgressMonitor
progressMonitor, int index, String name) throws CoreException {
IRuntimeWorkingCopy runtime = null;
String type = null;
String version = null;
@@ -266,8 +263,8 @@
if (runtimeTypes.length > 0) {
runtime = runtimeTypes[0].createRuntime(runtimeId, progressMonitor);
runtime.setLocation(jbossAsLocationPath);
- if(runtimeName!=null) {
- runtime.setName(runtimeName);
+ if(name != null) {
+ ((RuntimeWorkingCopy) runtime).setAttribute(RuntimeWorkingCopy.PROPERTY_NAME,name);
}
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
// IJBossServerRuntime.PROPERTY_VM_ID
@@ -276,10 +273,10 @@
((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_TYPE_ID",
defaultVM.getVMInstallType().getId());
// IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME
((RuntimeWorkingCopy)
runtime).setAttribute("org.jboss.ide.eclipse.as.core.runtime.configurationName",
JBOSS_AS_DEFAULT_CONFIGURATION_NAME);
-
- runtime.save(false, progressMonitor);
+
+ return runtime.save(false, progressMonitor);
}
- return runtime;
+ return null;
}
/**
@@ -289,7 +286,7 @@
* @return server working copy
* @throws CoreException
*/
- private static IServerWorkingCopy createServer(IProgressMonitor progressMonitor,
IRuntimeWorkingCopy runtime, int index, String name) throws CoreException {
+ private static IServerWorkingCopy createServer(IProgressMonitor progressMonitor,
IRuntime runtime, int index, String name) throws CoreException {
IServerType serverType = ServerCore.findServerType(JBOSS_AS_TYPE_ID[index]);
IServerWorkingCopy server = serverType.createServer(null, null, runtime,
progressMonitor);