Author: rob.stryker(a)jboss.com
Date: 2008-02-14 05:18:08 -0500 (Thu, 14 Feb 2008)
New Revision: 6311
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerConstants.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListenerManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss32ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss40ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss42ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss50ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
Log:
JBIDE-1774 - changed wizards and server/runtime impl slightly to more closely match use
cases of WTP and it's API, using less internal functionality.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -273,7 +273,7 @@
ArrayList<XPathCategory> retVal = new ArrayList<XPathCategory>();
AbstractJBossServerRuntime ajbsr = (AbstractJBossServerRuntime)
server.getRuntime().loadAdapter(AbstractJBossServerRuntime.class, new
NullProgressMonitor());
- Path p = (Path)rtToPortsFile.get(ajbsr.getId());
+ Path p = (Path)rtToPortsFile.get(server.getRuntime().getRuntimeType().getVersion());
if( p == null ) return;
URL url = FileLocator.find(JBossServerCorePlugin.getDefault().getBundle(), p, null);
if( url == null ) return;
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerConstants.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerConstants.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerConstants.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -0,0 +1,38 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+/**
+ *
+ * @author Rob Stryker
+ *
+ */
+public interface IJBossServerConstants {
+ public static final String JBOSS_SERVER_HOME_DIR = "jboss.server.home.dir";
+ public static final String JBOSS_SERVER_BASE_DIR = "jboss.server.base.dir";
+ public static final String JBOSS_SERVER_NAME = "jboss.server.name";
+ public static final String JBOSS_HOME_DIR = "jboss.home.dir";
+
+ public static final String DEFAULT_SERVER_NAME = "default";
+ public static final String DEPLOY = "deploy";
+ public static final String SERVER = "server";
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerConstants.java
___________________________________________________________________
Name: svn:executable
+ *
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -22,6 +22,7 @@
package org.jboss.ide.eclipse.as.core.server;
import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.wst.server.core.IRuntime;
/**
*
@@ -33,7 +34,9 @@
public static String PROPERTY_CONFIGURATION_NAME =
"org.jboss.ide.eclipse.as.core.runtime.configurationName";
+ public IRuntime getRuntime();
public IVMInstall getVM();
+ public void setVM(IVMInstall install);
public String getJBossConfiguration();
- public String getId();
+ public void setJBossConfiguration(String config);
}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -1,38 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.server;
-
-/**
- *
- * @author Rob Stryker
- *
- */
-public interface IServerStartupParameters {
- public static final String JBOSS_SERVER_HOME_DIR = "jboss.server.home.dir";
- public static final String JBOSS_SERVER_BASE_DIR = "jboss.server.base.dir";
- public static final String JBOSS_SERVER_NAME = "jboss.server.name";
- public static final String JBOSS_HOME_DIR = "jboss.home.dir";
-
- public static final String DEFAULT_SERVER_NAME = "default";
- public static final String DEPLOY = "deploy";
- public static final String SERVER = "server";
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -25,7 +25,7 @@
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
/**
- *
+ * A server state poller will
* @author Rob Stryker
*
*/
@@ -40,9 +40,14 @@
public void beginPolling(IServer server, boolean expectedState, PollThread pt); //
expected to launch own thread
public boolean isComplete() throws PollingException;
public boolean getState() throws PollingException;
- public void cancel(int type); // cancel the polling
public void cleanup(); // clean up any resources / processes. Will ALWAYS be called
+ /**
+ * Cancel the polling.
+ * @param type CANCEL or TIMEOUT_REACHED
+ */
+ public void cancel(int type);
+
public class PollingException extends Exception {
public PollingException(String message) {super(message);}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListener.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListener.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -26,6 +26,8 @@
import org.eclipse.wst.server.core.ServerEvent;
/**
+ * This is a stub superclass which can be used
+ * to override only those methods you care about.
*
* @author Rob Stryker
*
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListenerManager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListenerManager.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/UnitedServerListenerManager.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -33,6 +33,11 @@
import org.eclipse.wst.server.core.ServerEvent;
/**
+ * The UnitedServerListenerManager keeps an array of
+ * UnitedServerListeners. The manager registers itself as
+ * a listener for all server operations and passes
+ * all requests to every UnitedServerListener that's been
+ * added to the model.
*
* @author Rob Stryker
*
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -21,29 +21,48 @@
*/
package org.jboss.ide.eclipse.as.core.server.internal;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.Messages;
-import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.model.RuntimeDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
public abstract class AbstractJBossServerRuntime extends RuntimeDelegate implements
IJBossServerRuntime {
public void setDefaults(IProgressMonitor monitor) {
- getRuntimeWorkingCopy().setLocation(new Path(""));
+ String location = Platform.getOS().equals(Platform.WS_WIN32)
+ ? "c:/program files/jboss-" : "/usr/bin/jboss-";
+ String version = getRuntime().getRuntimeType().getVersion();
+ location += version + ".x";
+ getRuntimeWorkingCopy().setLocation(new Path(location));
+ getRuntimeWorkingCopy().setName(getNextRuntimeName());
+ setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME,
IJBossServerConstants.DEFAULT_SERVER_NAME);
+ setVM(null);
}
+ private String getNextRuntimeName() {
+ String version = getRuntime().getRuntimeType().getVersion();
+ String base = "JBoss " + version + " Runtime";
+ IRuntime rt = ServerCore.findRuntime(base);
+ if (rt == null)
+ return base;
+
+ int i = 0;
+ while (rt != null) {
+ rt = ServerCore.findRuntime(base + " " + ++i);
+ }
+ return base + " " + i;
+ }
+
public IStatus validate() {
IStatus s = super.validate();
if( !s.isOK()) return s;
@@ -54,19 +73,6 @@
return Status.OK_STATUS;
}
- public void setVMInstall(IVMInstall selectedVM) {
- IRuntimeWorkingCopy copy = getRuntimeWorkingCopy();
- if( copy instanceof RuntimeWorkingCopy ) {
- ((RuntimeWorkingCopy)copy).setAttribute(PROPERTY_VM_ID, selectedVM.getId());
- ((RuntimeWorkingCopy)copy).setAttribute(PROPERTY_VM_TYPE_ID,
selectedVM.getVMInstallType().getId());
- try {
- copy.save(true, new NullProgressMonitor());
- } catch( CoreException ce ) {
-
- }
- }
- }
-
public IVMInstall getVM() {
String id = getAttribute(PROPERTY_VM_ID, (String)null);
String type = getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
@@ -83,9 +89,20 @@
return JavaRuntime.getDefaultVMInstall();
}
+ public void setVM(IVMInstall selectedVM) {
+ if( selectedVM == null )
+ selectedVM = JavaRuntime.getDefaultVMInstall();
+
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM
+ .getVMInstallType().getId());
+ }
+
public String getJBossConfiguration() {
return getAttribute(PROPERTY_CONFIGURATION_NAME, (String)"");
}
- public abstract String getId();
+ public void setJBossConfiguration(String config) {
+ setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, config);
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss32ServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss32ServerRuntime.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss32ServerRuntime.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -27,8 +27,4 @@
public JBoss32ServerRuntime() {
// TODO Auto-generated constructor stub
}
-
- public String getId() {
- return "3.2";
- }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss40ServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss40ServerRuntime.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss40ServerRuntime.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -26,7 +26,4 @@
public JBoss40ServerRuntime() {
}
- public String getId() {
- return "4.0";
- }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss42ServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss42ServerRuntime.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss42ServerRuntime.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -3,7 +3,4 @@
public class JBoss42ServerRuntime extends AbstractJBossServerRuntime {
public JBoss42ServerRuntime() {
}
- public String getId() {
- return "4.2";
- }
}
\ No newline at end of file
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss50ServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss50ServerRuntime.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss50ServerRuntime.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -3,7 +3,4 @@
public class JBoss50ServerRuntime extends AbstractJBossServerRuntime {
public JBoss50ServerRuntime() {
}
- public String getId() {
- return "5.0";
- }
}
\ No newline at end of file
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -52,7 +52,7 @@
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathQuery;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.IServerStartupParameters;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
/**
@@ -61,7 +61,7 @@
*
*/
public class JBossServer extends ServerDelegate
- implements IServerStartupParameters, IDeployableServer, IURLProvider {
+ implements IJBossServerConstants, IDeployableServer, IURLProvider {
public static final String SERVER_USERNAME =
"org.jboss.ide.eclipse.as.core.server.userName";
public static final String SERVER_PASSWORD =
"org.jboss.ide.eclipse.as.core.server.password";
@@ -282,11 +282,32 @@
}
+ // first class parameters
public String getUsername() {
- return getAttributeHelper().getAttribute(SERVER_USERNAME, "");
+ return getAttribute(SERVER_USERNAME, "");
}
-
+ public void setUsername(String name) {
+ setAttribute(SERVER_USERNAME, name);
+ }
+
public String getPassword() {
- return getAttributeHelper().getAttribute(SERVER_PASSWORD, "");
+ return getAttribute(SERVER_PASSWORD, "");
}
+ public void setPassword(String pass) {
+ setAttribute(SERVER_PASSWORD, pass);
+ }
+
+ public String getDeployFolder() {
+ return getAttribute(DEPLOY_DIRECTORY, "");
+ }
+ public void setDeployFolder(String folder) {
+ setAttribute(DEPLOY_DIRECTORY, folder);
+ }
+
+ public String getTempDeployFolder() {
+ return getAttribute(TEMP_DEPLOY_DIRECTORY, "");
+ }
+ public void setTempDeployFolder(String folder) {
+ setAttribute(TEMP_DEPLOY_DIRECTORY, folder);
+ }
}
\ No newline at end of file
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -28,7 +28,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
@@ -60,11 +59,11 @@
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
+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.server.IServerStartupParameters;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractJBossServerRuntime;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -73,18 +72,6 @@
*/
public class JBossRuntimeWizardFragment extends WizardFragment {
- private final static int NAME_CHANGED = 1;
- private final static int HOME_CHANGED = 2;
- private final static int JRE_CHANGED = 3;
- private final static int CONFIG_CHANGED = 4;
-
- private final static int SEVERITY_ALL = 1;
- private final static int SEVERITY_MAJOR = 2;
-
- public static final String LOCATION_TEXT = Platform.getOS().equals(Platform.WS_WIN32)
- ? "c:/program files/jboss-" : "/usr/bin/jboss-";
-
-
private IWizardHandle handle;
private Label nameLabel, homeDirLabel, installedJRELabel, configLabel,
explanationLabel;
@@ -96,15 +83,11 @@
private String name, homeDir, config;
// jre fields
- protected ArrayList installedJREs;
+ protected ArrayList<IVMInstall> installedJREs;
protected String[] jreNames;
protected int defaultVMIndex;
-
- private JBossConfigurationTableViewer configurations;
-
private IVMInstall selectedVM;
-
- private boolean pristine;
+ private JBossConfigurationTableViewer configurations;
private String originalName;
public Composite createComposite(Composite parent, IWizardHandle handle) {
@@ -120,14 +103,7 @@
createJREComposite(main);
createConfigurationComposite(main);
- // If it's an already filled runtime (ie not new) fill our widgets
- pristine = isPristineRuntime();
- if (!pristine) {
- fillWidgets();
- } else {
- setWidgetDefaults();
- }
- // initTaskModel();
+ fillWidgets();
// make modifications to parent
handle.setTitle(Messages.rwf_Title);
@@ -150,111 +126,45 @@
}
private void fillWidgets() {
- RuntimeWorkingCopy rwc = getRuntimeWorkingCopy();
- if (rwc != null) {
- originalName = rwc.getName();
+ boolean canEdit = true;
- nameText.setText(rwc.getName());
- homeDirText.setText(rwc.getLocation().toOSString());
- String configSelected = rwc.getAttribute(
- IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, "");
- configurations.setDefaultConfiguration(configSelected);
+ IJBossServerRuntime rt = getRuntime();
+ if (rt != null) {
+ originalName = rt.getRuntime().getName();
+ nameText.setText(rt.getRuntime().getName());
+ name = rt.getRuntime().getName();
+ homeDirText.setText(rt.getRuntime().getLocation().toOSString());
+ homeDir = rt.getRuntime().getLocation().toOSString();
+ config = rt.getJBossConfiguration();
+ configurations.setDefaultConfiguration(config);
+ configLabel.setText(Messages.wf_ConfigLabel + ": " + config);
- configurations.getTable().setVisible(false);
- configLabel.setText(Messages.wf_ConfigLabel + ": "
- + configSelected);
- homeDirText.setEditable(false);
- homeDirButton.setEnabled(false);
-
- Object o = rwc.loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- if (o != null) {
- IJBossServerRuntime jbsr = (IJBossServerRuntime) o;
- IVMInstall install = jbsr.getVM();
- String vmName = install.getName();
- String[] jres = jreCombo.getItems();
- for (int i = 0; i < jres.length; i++) {
- if (vmName.equals(jres[i]))
- jreCombo.select(i);
- }
+ IVMInstall install = rt.getVM();
+ String vmName = install.getName();
+ String[] jres = jreCombo.getItems();
+ for (int i = 0; i < jres.length; i++) {
+ if (vmName.equals(jres[i]))
+ jreCombo.select(i);
}
- }
- }
- private void setWidgetDefaults() {
- nameText.setText(generateNewRuntimeName());
- homeDirText.setText(LOCATION_TEXT + getRuntimeVersionId() + ".x");
- }
-
- public String getVersion() {
- IRuntime rt = (IRuntime) getTaskModel().getObject(
- TaskModel.TASK_RUNTIME);
- String id = rt.getRuntimeType().getId();
- if (id.equals("org.jboss.ide.eclipse.as.runtime.32"))
- return "3.2";
- else if (id.equals("org.jboss.ide.eclipse.as.runtime.40"))
- return "4.0";
- else if (id.equals("org.jboss.ide.eclipse.as.runtime.42"))
- return "4.2";
- return ""; // default
- }
-
- private String generateNewRuntimeName() {
- String base = Messages.rwf_BaseName.replace(Messages.wf_BaseNameVersionReplacement,
getVersion());
- IRuntime rt = ServerCore.findRuntime(base);
- if (rt == null)
- return base;
-
- int i = 0;
- while (rt != null) {
- rt = ServerCore.findRuntime(base + " " + ++i);
+ homeDirText.setEditable(canEdit);
+ homeDirButton.setEnabled(canEdit);
+ configurations.getTable().setVisible(canEdit);
}
- return base + " " + i;
}
- private RuntimeWorkingCopy getRuntimeWorkingCopy() {
+ private IJBossServerRuntime getRuntime() {
IRuntime r = (IRuntime) getTaskModel()
.getObject(TaskModel.TASK_RUNTIME);
- IRuntimeWorkingCopy wc;
- if (!(r instanceof IRuntimeWorkingCopy)) {
- wc = r.createWorkingCopy();
- } else {
- wc = (IRuntimeWorkingCopy) r;
+ IJBossServerRuntime ajbsrt = null;
+ if (r != null) {
+ ajbsrt = (IJBossServerRuntime) r
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
}
-
- if (wc instanceof RuntimeWorkingCopy) {
- RuntimeWorkingCopy rwc = (RuntimeWorkingCopy) wc;
- return rwc;
- }
- return null;
+ return ajbsrt;
}
- private String getRuntimeVersionId() {
- RuntimeWorkingCopy rwc = getRuntimeWorkingCopy();
- if( rwc != null ) {
- Object o = rwc.loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- if (o != null) {
- IJBossServerRuntime jbsr = (IJBossServerRuntime) o;
- return jbsr.getId();
- }
- }
- return "4.0";
- }
-
- private boolean isPristineRuntime() {
- RuntimeWorkingCopy rwc = getRuntimeWorkingCopy();
- if (rwc != null) {
- if (rwc.getAttribute(
- IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME,
- (String) null) == null) {
- return true;
- }
- return false;
- }
- return true;
- }
-
private void createExplanation(Composite main) {
explanationLabel = new Label(main, SWT.WRAP);
FormData data = new FormData();
@@ -262,7 +172,6 @@
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
explanationLabel.setLayoutData(data);
-
explanationLabel.setText(Messages.rwf_Explanation);
}
@@ -284,11 +193,10 @@
nameText = new Text(nameComposite, SWT.BORDER);
nameText.addModifyListener(new ModifyListener() {
-
public void modifyText(ModifyEvent e) {
- updatePage(NAME_CHANGED);
+ name = nameText.getText();
+ updatePage();
}
-
});
// organize widgets inside composite
@@ -318,16 +226,15 @@
// Create Internal Widgets
homeDirLabel = new Label(homeDirComposite, SWT.NONE);
homeDirLabel.setText(Messages.wf_HomeDirLabel);
-
homeDirText = new Text(homeDirComposite, SWT.BORDER);
-
homeDirButton = new Button(homeDirComposite, SWT.NONE);
homeDirButton.setText(Messages.browse);
// Add listeners
homeDirText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- updatePage(HOME_CHANGED);
+ homeDir = homeDirText.getText();
+ updatePage();
}
});
@@ -399,11 +306,11 @@
jreCombo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
- updatePage(JRE_CHANGED);
+ updatePage();
}
public void widgetSelected(SelectionEvent e) {
- updatePage(JRE_CHANGED);
+ updatePage();
}
});
@@ -426,90 +333,118 @@
}
- private void updatePage(int changed) {
- switch (changed) {
- case NAME_CHANGED:
- updateErrorMessage(SEVERITY_MAJOR);
- break;
- case HOME_CHANGED:
- if (!isHomeValid()) {
- configurations.getControl().setEnabled(false);
- configurations.setJBossHome(homeDirText.getText());
- } else {
- // No errors, clear the message and update the available
- // configurations
- configurations.setJBossHome(homeDirText.getText());
- configurations.setDefaultConfiguration(IServerStartupParameters.DEFAULT_SERVER_NAME);
+ private void createConfigurationComposite(Composite main) {
+ configComposite = new Composite(main, SWT.NONE);
- // update config variable
- int index = configurations.getTable().getSelectionIndex();
- if (index != -1)
- config = configurations.getTable().getItem(index).getText();
+ FormData cData = new FormData();
+ cData.left = new FormAttachment(0, 5);
+ cData.right = new FormAttachment(100, -5);
+ cData.top = new FormAttachment(jreComposite, 10);
+ cData.bottom = new FormAttachment(100, -5);
+ configComposite.setLayoutData(cData);
+
+ configComposite.setLayout(new FormLayout());
+
+ configLabel = new Label(configComposite, SWT.NONE);
+ configLabel.setText(Messages.wf_ConfigLabel);
+
+ configurations = new JBossConfigurationTableViewer(configComposite,
+ SWT.BORDER | SWT.SINGLE);
+
+ FormData labelData = new FormData();
+ labelData.left = new FormAttachment(0, 5);
+ configLabel.setLayoutData(labelData);
+
+ FormData viewerData = new FormData();
+ viewerData.left = new FormAttachment(0, 5);
+ viewerData.right = new FormAttachment(100, -5);
+ viewerData.top = new FormAttachment(configLabel, 5);
+ viewerData.bottom = new FormAttachment(100, -5);
+
+ configurations.getTable().setLayoutData(viewerData);
+
+ configurations.getTable().addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updatePage();
}
- updateErrorMessage(SEVERITY_MAJOR);
- break;
- case JRE_CHANGED:
- int sel = jreCombo.getSelectionIndex();
- if (sel != -1)
- selectedVM = (IVMInstall) installedJREs.get(sel);
- break;
- default:
- break;
- }
+ public void widgetSelected(SelectionEvent e) {
+ updatePage();
+ }
+
+ });
+
}
- private void updateErrorMessage(int severity) {
- String error = getErrorString(severity);
- if (error == null) {
- handle.setMessage(null, IMessageProvider.NONE);
- return;
+ private void updatePage() {
+ updateErrorMessage();
+ if (!isHomeValid()) {
+ configurations.getControl().setEnabled(false);
+ configurations.setJBossHome(homeDirText.getText());
+ } else {
+ configurations.setJBossHome(homeDirText.getText());
+ configurations
+ .setDefaultConfiguration(IJBossServerConstants.DEFAULT_SERVER_NAME);
}
- handle.setMessage(error, IMessageProvider.ERROR);
+ int sel = jreCombo.getSelectionIndex();
+ if (sel != -1)
+ selectedVM = installedJREs.get(sel);
+ else
+ selectedVM = null;
}
- private String getErrorString(int severity) {
- if(nameText==null) { // We haven't yet been created so don't know any errors
yet.
+ private void updateErrorMessage() {
+ String error = getErrorString();
+ if (error == null)
+ handle.setMessage(null, IMessageProvider.NONE);
+ else
+ handle.setMessage(error, IMessageProvider.ERROR);
+ }
+
+ private String getErrorString() {
+ if (nameText == null) {
+ // not yet initialized. no errors
return null;
}
- if (getRuntime(nameText.getText()) != null) {
+
+ if (getRuntime(name) != null) {
return Messages.rwf_NameInUse;
}
if (!isHomeValid())
return Messages.rwf_invalidDirectory;
- if (severity == SEVERITY_MAJOR)
- return null;
-
- // now give minor warnings
- if (nameText.getText().equals(""))
+ if (name == null || name.equals(""))
return Messages.rwf_nameTextBlank;
- if (homeDirText.getText().equals(""))
+ if (homeDir == null || homeDir.equals(""))
return Messages.rwf_homeDirBlank;
+ if (selectedVM == null)
+ return "No VM selected";
+
return null;
}
protected boolean isHomeValid() {
- return new
Path(homeDirText.getText()).append("bin").append("run.jar")
- .toFile().exists();
+ return homeDir != null
+ && new
Path(homeDir).append("bin").append("run.jar").toFile()
+ .exists();
}
private void browseHomeDirClicked() {
- File file = new File(homeDirText.getText());
+ File file = new File(homeDir);
if (!file.exists()) {
file = null;
}
File directory = getDirectory(file, homeDirComposite.getShell());
- if (directory == null) {
- return;
+ if (directory != null) {
+ homeDir = directory.getAbsolutePath();
+ homeDirText.setText(homeDir);
}
-
- homeDirText.setText(directory.getAbsolutePath());
}
protected File getDirectory(File startingDirectory, Shell shell) {
@@ -554,7 +489,7 @@
// JRE methods
protected void updateJREs() {
// get all installed JVMs
- installedJREs = new ArrayList();
+ installedJREs = new ArrayList<IVMInstall>();
IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
int size = vmInstallTypes.length;
for (int i = 0; i < size; i++) {
@@ -569,13 +504,12 @@
size = installedJREs.size();
jreNames = new String[size];
for (int i = 0; i < size; i++) {
- IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
+ IVMInstall vmInstall = installedJREs.get(i);
jreNames[i] = vmInstall.getName();
}
selectedVM = JavaRuntime.getDefaultVMInstall();
defaultVMIndex = installedJREs.indexOf(selectedVM);
-
}
// WST API methods
@@ -583,98 +517,30 @@
}
public void exit() {
- name = nameText.getText();
- homeDir = homeDirText.getText();
IRuntime r = (IRuntime) getTaskModel()
.getObject(TaskModel.TASK_RUNTIME);
- IRuntimeWorkingCopy runtimeWC;
- if (r instanceof IRuntimeWorkingCopy) {
- runtimeWC = (IRuntimeWorkingCopy) r;
- } else {
- runtimeWC = r.createWorkingCopy();
- }
+ IRuntimeWorkingCopy runtimeWC = r.isWorkingCopy() ? ((IRuntimeWorkingCopy) r)
+ : r.createWorkingCopy();
+
runtimeWC.setName(name);
runtimeWC.setLocation(new Path(homeDir));
-
- ((RuntimeWorkingCopy) runtimeWC).setAttribute(
- IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
- ((RuntimeWorkingCopy) runtimeWC).setAttribute(
- IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM
- .getVMInstallType().getId());
- ((RuntimeWorkingCopy) runtimeWC).setAttribute(
- IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configurations
- .getSelectedConfiguration());
-
+ IJBossServerRuntime srt = (IJBossServerRuntime) runtimeWC.loadAdapter(
+ IJBossServerRuntime.class, new NullProgressMonitor());
+ srt.setVM(selectedVM);
+ srt.setJBossConfiguration(configurations.getSelectedConfiguration());
getTaskModel().putObject(TaskModel.TASK_RUNTIME, runtimeWC);
}
- private void createConfigurationComposite(Composite main) {
- configComposite = new Composite(main, SWT.NONE);
-
- FormData cData = new FormData();
- cData.left = new FormAttachment(0, 5);
- cData.right = new FormAttachment(100, -5);
- cData.top = new FormAttachment(jreComposite, 10);
- cData.bottom = new FormAttachment(100, -5);
- configComposite.setLayoutData(cData);
-
- configComposite.setLayout(new FormLayout());
-
- configLabel = new Label(configComposite, SWT.NONE);
- configLabel.setText(Messages.wf_ConfigLabel);
-
- configurations = new JBossConfigurationTableViewer(configComposite,
- SWT.BORDER | SWT.SINGLE);
-
- FormData labelData = new FormData();
- labelData.left = new FormAttachment(0, 5);
- configLabel.setLayoutData(labelData);
-
- FormData viewerData = new FormData();
- viewerData.left = new FormAttachment(0, 5);
- viewerData.right = new FormAttachment(100, -5);
- viewerData.top = new FormAttachment(configLabel, 5);
- viewerData.bottom = new FormAttachment(100, -5);
-
- configurations.getTable().setLayoutData(viewerData);
-
- configurations.getTable().addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- updatePage(CONFIG_CHANGED);
- }
-
- public void widgetSelected(SelectionEvent e) {
- updatePage(CONFIG_CHANGED);
- }
-
- });
-
- }
-
public void performFinish(IProgressMonitor monitor) throws CoreException {
-
- IRuntime r = (IRuntime) getTaskModel()
- .getObject(TaskModel.TASK_RUNTIME);
- IRuntimeWorkingCopy runtimeWC = r.createWorkingCopy();
- runtimeWC.setName(name);
- runtimeWC.setLocation(new Path(homeDir));
- ((RuntimeWorkingCopy) runtimeWC).setAttribute(
- IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
- ((RuntimeWorkingCopy) runtimeWC).setAttribute(
- IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM
- .getVMInstallType().getId());
- ((RuntimeWorkingCopy) runtimeWC).setAttribute(
- IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configurations
- .getSelectedConfiguration());
-
- IRuntime saved = runtimeWC.save(false, new NullProgressMonitor());
+ exit();
+ IRuntimeWorkingCopy r = (IRuntimeWorkingCopy) getTaskModel().getObject(
+ TaskModel.TASK_RUNTIME);
+ IRuntime saved = r.save(false, new NullProgressMonitor());
getTaskModel().putObject(TaskModel.TASK_RUNTIME, saved);
}
public boolean isComplete() {
- String s = getErrorString(SEVERITY_ALL);
- return s == null ? true : false;
+ return getErrorString() == null ? true : false;
}
public boolean hasComposite() {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2008-02-14
09:26:56 UTC (rev 6310)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2008-02-14
10:18:08 UTC (rev 6311)
@@ -47,19 +47,13 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.internal.AbstractJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -113,15 +107,6 @@
return JBossServerUISharedImages.getImageDescriptor(imageKey);
}
- public String getVersion() {
- IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
- String id = rt.getRuntimeType().getId();
- if( id.equals("org.jboss.ide.eclipse.as.runtime.32")) return
"3.2";
- else if( id.equals("org.jboss.ide.eclipse.as.runtime.40")) return
"4.0";
- else if( id.equals("org.jboss.ide.eclipse.as.runtime.42")) return
"4.2";
- return ""; // default
- }
-
private void createExplanationLabel(Composite main) {
serverExplanationLabel = new Label(main, SWT.NONE);
FormData data = new FormData();
@@ -172,7 +157,8 @@
}
private String getDefaultNameText() {
- String base = Messages.swf_BaseName.replace(Messages.wf_BaseNameVersionReplacement,
getVersion());
+ IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ String base = Messages.swf_BaseName.replace(Messages.wf_BaseNameVersionReplacement,
rt.getRuntimeType().getVersion());
if( findServer(base) == null ) return base;
int i = 1;
while( ServerCore.findServer(base + " (" + i + ")") != null )
@@ -182,9 +168,8 @@
private IServer findServer(String name) {
IServer[] servers = ServerCore.getServers();
for( int i = 0; i < servers.length; i++ ) {
- Server server = (Server) servers[i];
- if (name.trim().equals(server.getName()))
- return server;
+ if (name.trim().equals(servers[i].getName()))
+ return servers[i];
}
return null;
}
@@ -353,31 +338,21 @@
// WST API methods
public void enter() {
- if(homeValLabel==null) {
+ if(homeValLabel==null)
return;
- }
- IRuntime r = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
- IRuntimeWorkingCopy wc;
- if( r instanceof IRuntimeWorkingCopy )
- wc = (IRuntimeWorkingCopy)r;
- else
- wc = r.createWorkingCopy();
-
- if( wc instanceof RuntimeWorkingCopy ) {
- RuntimeWorkingCopy rwc = (RuntimeWorkingCopy)wc;
- homeValLabel.setText(rwc.getLocation().toOSString());
- configValLabel.setText(rwc.getAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME,
""));
- AbstractJBossServerRuntime jbsrt =
(AbstractJBossServerRuntime)wc.loadAdapter(AbstractJBossServerRuntime.class, new
NullProgressMonitor());
- IVMInstall install = jbsrt.getVM();
- jreValLabel.setText(install.getInstallLocation().getAbsolutePath() + " (" +
install.getName() + ")");
- runtimeGroup.layout();
- String p = rwc.getLocation().append(
"server").append(configValLabel.getText()).append("deploy").toOSString();
- deployTmpFolderVal = rwc.getLocation().append(
"server").append(configValLabel.getText()).append("tmp").append("jbosstoolsTemp").toOSString();
- deployText.setText(p);
- deployVal = p;
- deployGroup.layout();
- }
+ IJBossServerRuntime srt = getRuntime();
+
+ homeValLabel.setText(srt.getRuntime().getLocation().toOSString());
+ configValLabel.setText(srt.getJBossConfiguration());
+ IVMInstall install = srt.getVM();
+ jreValLabel.setText(install.getInstallLocation().getAbsolutePath() + " (" +
install.getName() + ")");
+ String deployFolder = srt.getRuntime().getLocation().append(
"server").append(configValLabel.getText()).append("deploy").toOSString();
+ deployTmpFolderVal = srt.getRuntime().getLocation().append(
"server").append(configValLabel.getText()).append("tmp").append("jbosstoolsTemp").toOSString();
+ deployText.setText(deployFolder);
+ deployVal = deployFolder;
+ runtimeGroup.layout();
+ deployGroup.layout();
}
public void exit() {
@@ -387,14 +362,25 @@
IServerWorkingCopy serverWC = (IServerWorkingCopy)
getTaskModel().getObject(TaskModel.TASK_SERVER);
serverWC.setRuntime((IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME));
serverWC.setName(name);
- serverWC.setServerConfiguration(null);
- if( serverWC instanceof ServerWorkingCopy) {
- ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
- ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
- ((ServerWorkingCopy)serverWC).setAttribute(IDeployableServer.DEPLOY_DIRECTORY,
deployVal);
- ((ServerWorkingCopy)serverWC).setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY,
deployTmpFolderVal);
- new File(deployTmpFolderVal).mkdirs();
+ serverWC.setServerConfiguration(null); // no inside jboss folder
+ JBossServer jbs = (JBossServer)serverWC.loadAdapter(JBossServer.class, new
NullProgressMonitor());
+ jbs.setUsername(authUser);
+ jbs.setPassword(authPass);
+ jbs.setDeployFolder(deployVal);
+ jbs.setTempDeployFolder(deployTmpFolderVal);
+ new File(deployTmpFolderVal).mkdirs();
+ }
+
+ private IJBossServerRuntime getRuntime() {
+ IRuntime r = (IRuntime) getTaskModel()
+ .getObject(TaskModel.TASK_RUNTIME);
+ IJBossServerRuntime ajbsrt = null;
+ if (r != null) {
+ ajbsrt = (IJBossServerRuntime) r
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
}
+ return ajbsrt;
}
public boolean isComplete() {