[jbosstools-commits] JBoss Tools SVN: r30895 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal and 7 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Apr 28 03:20:07 EDT 2011
Author: rob.stryker at jboss.com
Date: 2011-04-28 03:20:06 -0400 (Thu, 28 Apr 2011)
New Revision: 30895
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java
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/internal/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.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/plugin.xml
Log:
AS7 work, heavy lifting, wizard / editor / desperate for "functioning" status
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 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -16,15 +16,16 @@
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.wst.server.core.IRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
/**
*
* @author Rob Stryker
*/
public interface IJBossServerRuntime {
- public static String PROPERTY_VM_ID = "PROPERTY_VM_ID"; //$NON-NLS-1$
- public static String PROPERTY_VM_TYPE_ID = "PROPERTY_VM_TYPE_ID"; //$NON-NLS-1$
- public static String PROPERTY_EXECUTION_ENVIRONMENT = "PROPERTY_EXEC_ENVIRONMENT"; //$NON-NLS-1$
+ public static String PROPERTY_VM_ID = AbstractLocalJBossServerRuntime.PROPERTY_VM_ID;
+ public static String PROPERTY_VM_TYPE_ID = AbstractLocalJBossServerRuntime.PROPERTY_VM_TYPE_ID;
+ public static String PROPERTY_EXECUTION_ENVIRONMENT =AbstractLocalJBossServerRuntime.PROPERTY_EXECUTION_ENVIRONMENT;
public static String PROPERTY_CONFIGURATION_NAME = "org.jboss.ide.eclipse.as.core.runtime.configurationName"; //$NON-NLS-1$
public static String PROPERTY_CONFIG_LOCATION="org.jboss.ide.eclipse.as.core.runtime.configurationLocation"; //$NON-NLS-1$
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.internal.launching.environments.EnvironmentsManager;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.util.IConstants;
+
+public abstract class AbstractLocalJBossServerRuntime extends RuntimeDelegate {
+ public static String PROPERTY_VM_ID = "PROPERTY_VM_ID"; //$NON-NLS-1$
+ public static String PROPERTY_VM_TYPE_ID = "PROPERTY_VM_TYPE_ID"; //$NON-NLS-1$
+ public static String PROPERTY_EXECUTION_ENVIRONMENT = "PROPERTY_EXEC_ENVIRONMENT"; //$NON-NLS-1$
+
+ public void setDefaults(IProgressMonitor monitor) {
+ getRuntimeWorkingCopy().setName(getNextRuntimeName());
+ setExecutionEnvironment(getDefaultExecutionEnvironment(getRuntime().getRuntimeType()));
+ setVM(null);
+ }
+
+ protected String getNextRuntimeName() {
+ String version = getRuntime().getRuntimeType().getVersion();
+ String base = Messages.jboss + " " + version + " " + Messages.runtime; //$NON-NLS-1$//$NON-NLS-2$
+ return getNextRuntimeName(base);
+ }
+
+ public abstract String getDefaultRunArgs();
+ public abstract String getDefaultRunVMArgs();
+
+ public static String getNextRuntimeName(String base) {
+ IRuntime rt = ServerCore.findRuntime(base);
+ if (rt == null)
+ return base;
+
+ int i = 0;
+ while (rt != null) {
+ rt = ServerCore.findRuntime(base + " " + ++i); //$NON-NLS-1$
+ }
+ return base + " " + i; //$NON-NLS-1$
+ }
+
+ public IVMInstall getVM() {
+ if (getVMInstallTypeId() != null) {
+ String id = getAttribute(PROPERTY_VM_ID, (String)null);
+ String type = getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
+
+ IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(type);
+ IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
+
+ for (int i = 0; i < vmInstalls.length; i++) {
+ if (id.equals(vmInstalls[i].getId()))
+ return vmInstalls[i];
+ }
+ }
+ if( getExecutionEnvironment() != null ) {
+ IVMInstall[] installs = getExecutionEnvironment().getCompatibleVMs();
+ if( getExecutionEnvironment().getDefaultVM() != null )
+ return getExecutionEnvironment().getDefaultVM();
+ if( installs != null && installs.length > 0 && installs[0] != null )
+ return installs[0];
+ }
+ // not found, return default vm
+ return getDefaultVMInstall();
+ }
+
+ public void setVM(IVMInstall selectedVM) {
+ if (selectedVM == null) {
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, (String) null);
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, (String) null);
+ } else {
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
+ setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM
+ .getVMInstallType().getId());
+ }
+ }
+
+ public boolean isUsingDefaultJRE() {
+ return getVMInstallTypeId() == null;
+ }
+
+ protected String getVMInstallTypeId() {
+ return getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
+ }
+
+ protected IVMInstall getDefaultVMInstall() {
+ return getExecutionEnvironment().getDefaultVM();
+ }
+
+ public static IVMInstall[] getValidJREs(IRuntimeType type) {
+ return getDefaultExecutionEnvironment(type) == null ? new IVMInstall[0]
+ : getDefaultExecutionEnvironment(type).getCompatibleVMs();
+ }
+
+ public IExecutionEnvironment getExecutionEnvironment() {
+ String id = getAttribute(PROPERTY_EXECUTION_ENVIRONMENT, (String)null);
+ return id == null ? getDefaultExecutionEnvironment(getRuntime().getRuntimeType()) :
+ EnvironmentsManager.getDefault().getEnvironment(id);
+ }
+
+ public static IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType) {
+ String typeId = rtType.getId();
+ if( typeId.equals(IConstants.EAP_50) || typeId.equals(IConstants.AS_60)) {
+ return EnvironmentsManager.getDefault().getEnvironment("JavaSE-1.6"); //$NON-NLS-1$
+ }
+ return EnvironmentsManager.getDefault().getEnvironment("J2SE-1.4"); //$NON-NLS-1$
+ }
+
+ public void setExecutionEnvironment(IExecutionEnvironment environment) {
+ setAttribute(PROPERTY_EXECUTION_ENVIRONMENT, environment.getId());
+ }
+
+
+}
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 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -82,7 +82,7 @@
/**
* No changes will be made to this API and new server
- * types are expected to subclass the getDeployFolder() api's
+ * types are expected to override the getDeployFolder() api's
*
* @param jbs
* @param type
@@ -96,7 +96,7 @@
String val = jbs.getAttribute(DEPLOY_DIRECTORY, (String)null);
if( val != null ) {
IPath val2 = new Path(val);
- return ServerUtil.makeGlobal(jbsrt, val2).toString();
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(), val2).toString();
}
// if no value is set, default to metadata
type = DEPLOY_METADATA;
@@ -109,7 +109,7 @@
String config = jbsrt.getJBossConfiguration();
IPath p = new Path(loc).append(config)
.append(IJBossServerConstants.DEPLOY);
- return ServerUtil.makeGlobal(jbsrt, p).toString();
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(), p).toString();
}
return null;
}
@@ -118,11 +118,13 @@
return getTempDeployFolder(this, getDeployLocationType());
}
+ @Deprecated
public static String getTempDeployFolder(JBossServer jbs, String type) {
IServer server = jbs.getServer();
IJBossServerRuntime jbsrt = getRuntime(server);
if( type.equals(DEPLOY_CUSTOM))
- return ServerUtil.makeGlobal(jbsrt, new Path(server.getAttribute(TEMP_DEPLOY_DIRECTORY, ""))).toString(); //$NON-NLS-1$
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(),
+ new Path(server.getAttribute(TEMP_DEPLOY_DIRECTORY, ""))).toString(); //$NON-NLS-1$
if( type.equals(DEPLOY_METADATA)) {
return JBossServerCorePlugin.getServerStateLocation(server).
append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
@@ -132,7 +134,7 @@
IPath p = new Path(loc)
.append(config).append(IJBossServerConstants.TMP)
.append(IJBossServerConstants.JBOSSTOOLS_TMP);
- return ServerUtil.makeGlobal(jbsrt, p).toString();
+ return ServerUtil.makeGlobal(jbsrt.getRuntime(), p).toString();
}
return null;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -40,7 +40,7 @@
public IStatus canChangeState(String launchMode);
}
- public static HashMap<String, Class> delegateClassMap;
+ private static HashMap<String, Class> delegateClassMap;
static {
delegateClassMap = new HashMap<String, Class>();
delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, LocalJBossBehaviorDelegate.class);
@@ -61,9 +61,9 @@
if( id.equals(lastModeId) && delegate != null && delegate.getBehaviourTypeId().equals(id))
return delegate;
- Class c = delegateClassMap.get(id);
+ Class c = getDelegateMap().get(id);
if( c == null )
- c = delegateClassMap.get(LocalPublishMethod.LOCAL_PUBLISH_METHOD);
+ c = getDelegateMap().get(LocalPublishMethod.LOCAL_PUBLISH_METHOD);
try {
JBossBehaviourDelegate o = (JBossBehaviourDelegate)c.newInstance();
@@ -76,6 +76,10 @@
return delegate;
}
+ protected HashMap<String, Class> getDelegateMap() {
+ return delegateClassMap;
+ }
+
public void stop(boolean force) {
getDelegate().stop(force);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -18,16 +18,9 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.launching.environments.EnvironmentsManager;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
-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.Messages;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
@@ -35,46 +28,26 @@
import org.jboss.ide.eclipse.as.core.util.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-public class LocalJBossServerRuntime extends RuntimeDelegate implements IJBossServerRuntime {
+public class LocalJBossServerRuntime extends AbstractLocalJBossServerRuntime implements IJBossServerRuntime {
public void setDefaults(IProgressMonitor monitor) {
- getRuntimeWorkingCopy().setName(getNextRuntimeName());
+ super.setDefaults(monitor);
setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, IJBossServerConstants.DEFAULT_CONFIGURATION);
- setExecutionEnvironment(getDefaultExecutionEnvironment(getRuntime().getRuntimeType()));
- setVM(null);
}
- private String getNextRuntimeName() {
- String version = getRuntime().getRuntimeType().getVersion();
- String base = null;
-
- // hack for eap 5.1, which is now using the 5.0 runtime type id
- if( isEAP(getRuntime()) && version.equals(IConstants.V5_0))
- version = "5.x"; //$NON-NLS-1$
-
- if( getRuntime().getRuntimeType().getId().startsWith("org.jboss.ide.eclipse.as.runtime.eap.")) { //$NON-NLS-1$
- base = Messages.jboss + " EAP " + version + " " + Messages.runtime; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- base = Messages.jboss + " " + version + " " + Messages.runtime; //$NON-NLS-1$//$NON-NLS-2$
+ protected String getNextRuntimeName() {
+ if( isEAP(getRuntime())) {
+ String version = "5.x"; //$NON-NLS-1$
+ String base = Messages.jboss + " EAP " + version + " " + Messages.runtime; //$NON-NLS-1$ //$NON-NLS-2$
+ return getNextRuntimeName(base);
}
- return getNextRuntimeName(base);
+ return super.getNextRuntimeName();
}
+
public static boolean isEAP(IRuntime rt) {
return rt.getRuntimeType().getId().startsWith("org.jboss.ide.eclipse.as.runtime.eap."); //$NON-NLS-1$
}
- public static String getNextRuntimeName(String base) {
- IRuntime rt = ServerCore.findRuntime(base);
- if (rt == null)
- return base;
-
- int i = 0;
- while (rt != null) {
- rt = ServerCore.findRuntime(base + " " + ++i); //$NON-NLS-1$
- }
- return base + " " + i; //$NON-NLS-1$
- }
-
public IStatus validate() {
IStatus s = super.validate();
if( !s.isOK()) return s;
@@ -85,42 +58,7 @@
return Status.OK_STATUS;
}
-
- public IVMInstall getVM() {
- if (getVMInstallTypeId() != null) {
- String id = getAttribute(PROPERTY_VM_ID, (String)null);
- String type = getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
-
- IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(type);
- IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
-
- for (int i = 0; i < vmInstalls.length; i++) {
- if (id.equals(vmInstalls[i].getId()))
- return vmInstalls[i];
- }
- }
- if( getExecutionEnvironment() != null ) {
- IVMInstall[] installs = getExecutionEnvironment().getCompatibleVMs();
- if( getExecutionEnvironment().getDefaultVM() != null )
- return getExecutionEnvironment().getDefaultVM();
- if( installs != null && installs.length > 0 && installs[0] != null )
- return installs[0];
- }
- // not found, return default vm
- return getDefaultVMInstall();
- }
-
- public void setVM(IVMInstall selectedVM) {
- if (selectedVM == null) {
- setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, (String) null);
- setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, (String) null);
- } else {
- 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)""); //$NON-NLS-1$
}
@@ -169,14 +107,6 @@
return envVars;
}
- public boolean isUsingDefaultJRE() {
- return getVMInstallTypeId() == null;
- }
-
- protected String getVMInstallTypeId() {
- return getAttribute(PROPERTY_VM_TYPE_ID, (String)null);
- }
-
public String getConfigLocation() {
return getAttribute(PROPERTY_CONFIG_LOCATION, IConstants.SERVER);
}
@@ -195,31 +125,4 @@
return new Path(cl);
return getRuntime().getLocation().append(cl);
}
-
- protected IVMInstall getDefaultVMInstall() {
- return getExecutionEnvironment().getDefaultVM();
- }
-
- public static IVMInstall[] getValidJREs(IRuntimeType type) {
- return getDefaultExecutionEnvironment(type) == null ? new IVMInstall[0]
- : getDefaultExecutionEnvironment(type).getCompatibleVMs();
- }
-
- public IExecutionEnvironment getExecutionEnvironment() {
- String id = getAttribute(PROPERTY_EXECUTION_ENVIRONMENT, (String)null);
- return id == null ? getDefaultExecutionEnvironment(getRuntime().getRuntimeType()) :
- EnvironmentsManager.getDefault().getEnvironment(id);
- }
-
- public static IExecutionEnvironment getDefaultExecutionEnvironment(IRuntimeType rtType) {
- String typeId = rtType.getId();
- if( typeId.equals(IConstants.EAP_50) || typeId.equals(IConstants.AS_60)) {
- return EnvironmentsManager.getDefault().getEnvironment("JavaSE-1.6"); //$NON-NLS-1$
- }
- return EnvironmentsManager.getDefault().getEnvironment("J2SE-1.4"); //$NON-NLS-1$
- }
-
- public void setExecutionEnvironment(IExecutionEnvironment environment) {
- setAttribute(PROPERTY_EXECUTION_ENVIRONMENT, environment.getId());
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.launch;
-import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,10 +27,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.launching.RuntimeClasspathEntry;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IVMInstall;
@@ -50,7 +45,6 @@
import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.IStartLaunchSetupParticipant;
import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.StartLaunchDelegate;
-import org.jboss.ide.eclipse.as.core.server.internal.launch.RunJarContainerWrapper.RunJarContainer;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
import org.jboss.ide.eclipse.as.core.util.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -10,29 +10,53 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
+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.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
public class JBoss7Server extends JBossServer implements IJBoss7Deployment {
public void setDefaults(IProgressMonitor monitor) {
super.setDefaults(monitor);
- setAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_CUSTOM);
+ setAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_SERVER);
setAttribute(IJBossToolingConstants.WEB_PORT_DETECT, false);
setAttribute(IJBossToolingConstants.WEB_PORT, IJBossToolingConstants.JBOSS_WEB_DEFAULT_PORT);
}
public boolean hasJMXProvider() {
return false;
}
+
+ @Override
+ public String getDeployLocationType() {
+ return getAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_SERVER);
+ }
+
public String getDeployFolder(String type) {
if( type.equals(DEPLOY_SERVER) ) {
- // TODO make sure this is correct?! Upstream APIs have this wrong
+ // TODO make sure this is correct?! Upstream APIs have this wrong for as7
+ IRuntime rt = getServer().getRuntime();
+ IPath p = rt.getLocation().append(AS7_STANDALONE).append(AS7_DEPLOYMENTS);
+ return ServerUtil.makeGlobal(rt, p).toString();
}
return getDeployFolder(this, type);
}
+ // Just force it to be in metadata location, for now
+ public String getTempDeployFolder() {
+ IPath p = JBossServerCorePlugin.getServerStateLocation(getServer()).
+ append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+ if( !p.toFile().exists()) {
+ p.toFile().mkdirs();
+ }
+ return p.toString();
+ }
+
public static boolean supportsJBoss7MarkerDeployment(IServer server) {
boolean retval = (server.loadAdapter(IJBoss7Deployment.class, new NullProgressMonitor()) != null);
return retval;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -11,6 +11,7 @@
package org.jboss.ide.eclipse.as.core.server.internal.v7;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
@@ -22,11 +23,26 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class JBoss7ServerBehavior extends JBossServerBehavior {
+ private static HashMap<String, Class> delegateClassMap;
+ static {
+ delegateClassMap = new HashMap<String, Class>();
+ delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, LocalJBoss7BehaviorDelegate.class);
+ }
+ public static void addDelegateMapping(String s, Class c) {
+ delegateClassMap.put(s, c);
+ }
+ protected HashMap<String, Class> getDelegateMap() {
+ return delegateClassMap;
+ }
+
+
public void stop(boolean force) {
setServerStopped();
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.v7;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
+
+public class LocalJBoss7BehaviorDelegate extends LocalJBossBehaviorDelegate {
+ public IStatus canChangeState(String launchMode) {
+ return Status.CANCEL_STATUS;
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7ServerRuntime.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -10,14 +10,30 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
-public class LocalJBoss7ServerRuntime extends LocalJBossServerRuntime {
- // TODO
+public class LocalJBoss7ServerRuntime extends AbstractLocalJBossServerRuntime {
@Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ }
+ @Override
public IStatus validate() {
return Status.OK_STATUS;
}
+
+ @Override
+ public String getDefaultRunArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDefaultRunVMArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -26,6 +26,9 @@
public static final String FOLDER_LOG = "log"; //$NON-NLS-1$
public static final String ENDORSED = "endorsed"; //$NON-NLS-1$
public static final String NATIVE = "native"; //$NON-NLS-1$
+ public static final String AS7_STANDALONE = "standalone";//$NON-NLS-1$
+ public static final String AS7_DEPLOYMENTS = "deployments";//$NON-NLS-1$
+
public static final String[] JBOSS_TEMPORARY_FOLDERS = new String[] { WORK, DATA, FOLDER_TMP, FOLDER_LOG};
public static final String TWIDDLE_JAR = "twiddle.jar"; //$NON-NLS-1$
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -37,20 +37,34 @@
.append(serverID.replace(' ', '_'));
}
+ @Deprecated
public static IPath makeRelative(IJBossServerRuntime rt, IPath p) {
+ if( rt.getRuntime() != null )
+ return makeRelative(rt.getRuntime(), p);
+ return p;
+ }
+
+ public static IPath makeRelative(IRuntime rt, IPath p) {
if( p.isAbsolute() && rt != null) {
- if(rt.getRuntime().getLocation().isPrefixOf(p)) {
- int size = rt.getRuntime().getLocation().toOSString().length();
+ if(rt.getLocation().isPrefixOf(p)) {
+ int size = rt.getLocation().toOSString().length();
return new Path(p.toOSString().substring(size)).makeRelative();
}
}
return p;
}
+ @Deprecated
public static IPath makeGlobal(IJBossServerRuntime rt, IPath p) {
+ if( rt.getRuntime() != null )
+ return makeGlobal(rt.getRuntime(), p);
+ return p;
+ }
+
+ public static IPath makeGlobal(IRuntime rt, IPath p) {
if( !p.isAbsolute() ) {
- if( rt != null && rt.getRuntime() != null && rt.getRuntime().getLocation() != null ) {
- return rt.getRuntime().getLocation().append(p).makeAbsolute();
+ if( rt != null && rt.getLocation() != null ) {
+ return rt.getLocation().append(p).makeAbsolute();
}
return p.makeAbsolute();
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -55,6 +55,7 @@
public static String rwf_Explanation;
public static String rwf_NameInUse;
public static String rwf_homeMissingFiles;
+ public static String rwf_jboss7homeNotValid;
public static String rwf_homeIncorrectVersion;
public static String rwf_nameTextBlank;
public static String rwf_homeDirBlank;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-04-28 07:20:06 UTC (rev 30895)
@@ -14,6 +14,7 @@
rwf_Explanation=A JBoss Server runtime references a JBoss installation directory.\nIt can be used to set up classpaths for projects which depend on this runtime,\nas well as by a "server" which will be able to start and stop instances of JBoss.
rwf_NameInUse=Runtime name already in use
rwf_homeMissingFiles=The home directory does not exist or is missing the run.jar.
+rwf_jboss7homeNotValid=The home directory does not point to a valid JBoss installation.
rwf_homeIncorrectVersion=This server type expects a version of {0} but the server directory is of version {1}.
rwf_nameTextBlank=The name field must not be blank
rwf_homeDirBlank=The directory field must not be blank
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -372,9 +372,9 @@
JBossServer jbs = ServerConverter.getJBossServer(page.getServer().getOriginal());
String newDir = getHelper().getAttribute(IDeployableServer.DEPLOY_DIRECTORY,
- jbs == null ? "" : jbs.getDeployFolder(jbs, getDeployType()));
+ jbs == null ? "" : jbs.getDeployFolder());
String newTemp = getHelper().getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY,
- jbs == null ? "" : jbs.getTempDeployFolder(jbs, getDeployType()));
+ jbs == null ? "" : jbs.getTempDeployFolder());
deployText.removeModifyListener(deployListener);
deployText.setText(newDir);
deployText.addModifyListener(deployListener);
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7ServerWizardFragment.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -0,0 +1,98 @@
+package org.jboss.ide.eclipse.as.ui.wizards;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+public class JBoss7ServerWizardFragment extends JBossRuntimeWizardFragment {
+
+ @Override
+ public boolean hasComposite() {
+ return true;
+ }
+
+ @Override
+ protected void updateModels() {
+ // Do nothing
+ }
+
+ @Override
+ protected void createWidgets(Composite main) {
+ createExplanation(main);
+ createNameComposite(main);
+ createHomeComposite(main);
+ }
+
+ protected void fillWidgets() {
+ IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ if (rt != null) {
+ try {
+ fillNameWidgets(rt);
+ fillHomeDir(rt);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ @Override
+ protected void updatePage() {
+ // Do Nothing
+ updateErrorMessage();
+ }
+
+ protected String getErrorString() {
+ if (nameText == null)
+ // not yet initialized. no errors
+ return null;
+
+ if (getRuntime(name) != null)
+ return Messages.rwf_NameInUse;
+
+ if (!isHomeValid())
+ return Messages.rwf_homeMissingFiles;
+
+ if (name == null || name.equals("")) //$NON-NLS-1$
+ return Messages.rwf_nameTextBlank;
+
+ return null;
+ }
+
+ @Override
+ protected boolean isHomeValid() {
+ if( homeDir == null || homeDir.equals("") || !(new File(homeDir).exists()))
+ return false;
+ return true;
+ }
+
+ @Override
+ protected String getVersionString(File loc) {
+ // TODO clean this up for later
+ return "7.0";
+ }
+
+ @Override
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IRuntime rt = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ ((IRuntimeWorkingCopy)rt).setLocation(new Path(homeDir));
+ }
+
+ @Override
+ public void exit() {
+ IRuntime r = (IRuntime) getTaskModel()
+ .getObject(TaskModel.TASK_RUNTIME);
+ IRuntimeWorkingCopy runtimeWC = r.isWorkingCopy() ? ((IRuntimeWorkingCopy) r)
+ : r.createWorkingCopy();
+
+ runtimeWC.setName(name);
+ runtimeWC.setLocation(new Path(homeDir));
+ getTaskModel().putObject(TaskModel.TASK_RUNTIME, runtimeWC);
+ }
+}
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 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-04-28 07:20:06 UTC (rev 30895)
@@ -95,49 +95,52 @@
*/
public class JBossRuntimeWizardFragment extends WizardFragment {
- private IWizardHandle handle;
- private boolean beenEntered = false;
+ protected IWizardHandle handle;
+ protected boolean beenEntered = false;
- private Label nameLabel, homeDirLabel,
+ protected Label nameLabel, homeDirLabel,
installedJRELabel, explanationLabel;
- private Text nameText, homeDirText;
- private Combo jreCombo;
- private int jreComboIndex;
- private Button homeDirButton, jreButton;
- private Composite nameComposite, homeDirComposite, jreComposite;
- private String name, homeDir;
+ protected Text nameText, homeDirText;
+ protected Combo jreCombo;
+ protected int jreComboIndex;
+ protected Button homeDirButton, jreButton;
+ protected Composite nameComposite, homeDirComposite, jreComposite;
+ protected String name, homeDir;
// Configuration stuff
- private Composite configComposite;
- private Group configGroup;
- private Label configDirLabel;
- private Text configDirText;
- private JBossConfigurationTableViewer configurations;
- private Button configCopy, configBrowse, configDelete;
- private String configDirTextVal;
+ protected Composite configComposite;
+ protected Group configGroup;
+ protected Label configDirLabel;
+ protected Text configDirText;
+ protected JBossConfigurationTableViewer configurations;
+ protected Button configCopy, configBrowse, configDelete;
+ protected String configDirTextVal;
// jre fields
protected List<IVMInstall> installedJREs;
protected String[] jreNames;
protected int defaultVMIndex;
- private IVMInstall selectedVM;
- private String originalName;
+ protected IVMInstall selectedVM;
+ protected String originalName;
public Composite createComposite(Composite parent, IWizardHandle handle) {
this.handle = handle;
-
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(new FormLayout());
+ updateModels();
+ createWidgets(main);
+ fillWidgets();
+ updateWizardHandle(parent);
+ return main;
+ }
+
+ protected void updateModels() {
updateJREs();
- createExplanation(main);
- createNameComposite(main);
- createHomeComposite(main);
- createJREComposite(main);
- createConfigurationComposite(main);
- fillWidgets();
-
+ }
+
+ protected void updateWizardHandle(Composite parent) {
// make modifications to parent
IRuntime r = (IRuntime) getTaskModel()
.getObject(TaskModel.TASK_RUNTIME);
@@ -151,8 +154,15 @@
handle.setImageDescriptor(getImageDescriptor());
handle.setDescription(description);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.jboss.ide.eclipse.as.doc.user.new_server_runtime"); //$NON-NLS-1$
- return main;
}
+
+ protected void createWidgets(Composite main) {
+ createExplanation(main);
+ createNameComposite(main);
+ createHomeComposite(main);
+ createJREComposite(main);
+ createConfigurationComposite(main);
+ }
protected boolean isEAP() {
IRuntime rt = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
@@ -164,61 +174,72 @@
return JBossServerUISharedImages.getImageDescriptor(imageKey);
}
- private void fillWidgets() {
- boolean canEdit = true;
-
- IJBossServerRuntime rt = getRuntime();
- if (rt != null) {
- originalName = rt.getRuntime().getName();
- nameText.setText(originalName);
- name = originalName;
+ protected void fillNameWidgets(IRuntime rt) {
+ originalName = rt.getName();
+ nameText.setText(originalName);
+ name = originalName;
+ }
+
+ protected void fillHomeDir(IRuntime rt) {
+ if( rt.getLocation() == null ) {
+ // new runtime creation
+ Preferences prefs = JBossServerUIPlugin.getDefault().getPluginPreferences();
+ String value = prefs.getString(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX + rt.getRuntimeType().getId());
- if( rt.getRuntime().getLocation() == null ) {
- // new runtime creation
- Preferences prefs = JBossServerUIPlugin.getDefault().getPluginPreferences();
- String value = prefs.getString(IPreferenceKeys.RUNTIME_HOME_PREF_KEY_PREFIX + rt.getRuntime().getRuntimeType().getId());
-
- String locationDefault = Platform.getOS().equals(Platform.WS_WIN32)
- ? "c:/program files/jboss-" : "/usr/bin/jboss-"; //$NON-NLS-1$ //$NON-NLS-2$
- String version = rt.getRuntime().getRuntimeType().getVersion();
- locationDefault += version + ".x"; //$NON-NLS-1$
-
- homeDir = (value != null && value.length() != 0) ? value : locationDefault;
- } else {
- // old runtime, load from it
- homeDir = rt.getRuntime().getLocation().toOSString();
- }
- homeDirText.setText(homeDir);
-
- ((IRuntimeWorkingCopy)rt.getRuntime()).setLocation(new Path(homeDir));
- String dirText = rt.getConfigLocation();
- configDirText.setText(dirText == null ? IConstants.SERVER : dirText);
- configurations.setConfiguration(rt.getJBossConfiguration() == null
- ? IConstants.DEFAULT_CONFIGURATION : rt.getJBossConfiguration());
-
- if (rt.isUsingDefaultJRE()) {
- jreCombo.select(0);
- } else {
- IVMInstall install = rt.getVM();
- if( install != null ) {
- String vmName = install.getName();
- String[] jres = jreCombo.getItems();
- for (int i = 0; i < jres.length; i++) {
- if (vmName.equals(jres[i]))
- jreCombo.select(i);
- }
+ String locationDefault = Platform.getOS().equals(Platform.WS_WIN32)
+ ? "c:/program files/jboss-" : "/usr/bin/jboss-"; //$NON-NLS-1$ //$NON-NLS-2$
+ String version = rt.getRuntimeType().getVersion();
+ locationDefault += version + ".x"; //$NON-NLS-1$
+ homeDir = (value != null && value.length() != 0) ? value : locationDefault;
+ } else {
+ // old runtime, load from it
+ homeDir = rt.getLocation().toOSString();
+ }
+ homeDirText.setText(homeDir);
+
+ ((IRuntimeWorkingCopy)rt).setLocation(new Path(homeDir));
+ homeDirText.setEditable(true);
+ homeDirButton.setEnabled(true);
+ }
+
+ protected void fillConfigWidgets(IJBossServerRuntime jbsrt) {
+ String dirText = jbsrt.getConfigLocation();
+ configDirText.setText(dirText == null ? IConstants.SERVER : dirText);
+ configurations.setConfiguration(jbsrt.getJBossConfiguration() == null
+ ? IConstants.DEFAULT_CONFIGURATION : jbsrt.getJBossConfiguration());
+ configurations.getTable().setVisible(true);
+ }
+
+ protected void fillJREWidgets(IJBossServerRuntime jbsrt) {
+ if (jbsrt.isUsingDefaultJRE()) {
+ jreCombo.select(0);
+ } else {
+ IVMInstall install = jbsrt.getVM();
+ if( install != null ) {
+ String vmName = install.getName();
+ String[] jres = jreCombo.getItems();
+ for (int i = 0; i < jres.length; i++) {
+ if (vmName.equals(jres[i]))
+ jreCombo.select(i);
}
}
- jreComboIndex = jreCombo.getSelectionIndex();
- homeDirText.setEditable(canEdit);
- homeDirButton.setEnabled(canEdit);
- configurations.getTable().setVisible(canEdit);
- if( jreCombo.getSelectionIndex() < 0 && jreCombo.getItemCount() > 0)
- jreCombo.select(0);
}
+ jreComboIndex = jreCombo.getSelectionIndex();
+ if( jreCombo.getSelectionIndex() < 0 && jreCombo.getItemCount() > 0)
+ jreCombo.select(0);
}
+
+ protected void fillWidgets() {
+ IJBossServerRuntime rt = getRuntime();
+ if (rt != null) {
+ fillNameWidgets(rt.getRuntime());
+ fillHomeDir(rt.getRuntime());
+ fillConfigWidgets(rt);
+ fillJREWidgets(rt);
+ }
+ }
- private IJBossServerRuntime getRuntime() {
+ protected IJBossServerRuntime getRuntime() {
IRuntime r = (IRuntime) getTaskModel()
.getObject(TaskModel.TASK_RUNTIME);
IJBossServerRuntime ajbsrt = null;
@@ -230,7 +251,7 @@
return ajbsrt;
}
- private void createExplanation(Composite main) {
+ protected void createExplanation(Composite main) {
explanationLabel = new Label(main, SWT.WRAP);
FormData data = new FormData();
data.top = new FormAttachment(0, 5);
@@ -240,7 +261,7 @@
explanationLabel.setText(Messages.rwf_Explanation);
}
- private void createNameComposite(Composite main) {
+ protected void createNameComposite(Composite main) {
// Create our name composite
nameComposite = new Composite(main, SWT.NONE);
@@ -276,7 +297,7 @@
nameText.setLayoutData(nameTextData);
}
- private void createHomeComposite(Composite main) {
+ protected void createHomeComposite(Composite main) {
// Create our composite
homeDirComposite = new Composite(main, SWT.NONE);
@@ -332,7 +353,7 @@
homeDirButton.setLayoutData(buttonData);
}
- private void createJREComposite(Composite main) {
+ protected void createJREComposite(Composite main) {
// Create our composite
jreComposite = new Composite(main, SWT.NONE);
@@ -401,7 +422,7 @@
}
- private void createConfigurationComposite(Composite main) {
+ protected void createConfigurationComposite(Composite main) {
UIUtil u = new UIUtil(); // top bottom left right
configComposite = new Composite(main, SWT.NONE);
configComposite.setLayoutData(u.createFormData(
@@ -539,7 +560,7 @@
}
// Launchable only from UI thread
- private void updatePage() {
+ protected void updatePage() {
String folder;
if (!isHomeValid()) {
configurations.getControl().setEnabled(false);
@@ -566,7 +587,7 @@
updateErrorMessage();
}
- private void updateErrorMessage() {
+ protected void updateErrorMessage() {
String error = getErrorString();
if (error == null) {
String warn = getWarningString();
@@ -601,9 +622,6 @@
if (name == null || name.equals("")) //$NON-NLS-1$
return Messages.rwf_nameTextBlank;
- if (homeDir == null || homeDir.equals("")) //$NON-NLS-1$
- return Messages.rwf_homeDirBlank;
-
if (jreComboIndex < 0)
return Messages.rwf_NoVMSelected;
@@ -613,20 +631,25 @@
return null;
}
- private String getWarningString() {
+ protected String getWarningString() {
if( getHomeVersionWarning() != null )
return getHomeVersionWarning();
return null;
}
protected boolean isHomeValid() {
- if( homeDir == null || !(new File(homeDir).exists())) return false;
+ if( homeDir == null || homeDir.equals("") || !(new File(homeDir).exists())) return false;
return new Path(homeDir).append("bin").append("run.jar").toFile().exists(); //$NON-NLS-1$ //$NON-NLS-2$
}
+ protected String getVersionString(File loc) {
+ String version = new ServerBeanLoader().getFullServerVersion(loc);
+ return version;
+ }
+
protected String getHomeVersionWarning() {
File loc = new File(homeDir, JBossServerType.AS.getSystemJarPath());
- String version = new ServerBeanLoader().getFullServerVersion(loc);
+ String version = getVersionString(loc);
IRuntime rt = (IRuntime) getTaskModel().getObject(
TaskModel.TASK_RUNTIME);
String v = rt.getRuntimeType().getVersion();
@@ -641,7 +664,7 @@
return version.startsWith(v) ? null : NLS.bind(Messages.rwf_homeIncorrectVersion, v, version);
}
- private void browseHomeDirClicked() {
+ protected void browseHomeDirClicked() {
File file = new File(homeDir);
if (!file.exists()) {
file = null;
@@ -756,7 +779,7 @@
return true;
}
- private IRuntime getRuntime(String runtimeName) {
+ protected IRuntime getRuntime(String runtimeName) {
if (runtimeName.equals(originalName))
return null; // name is same as original. No clash.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2011-04-28 01:22:05 UTC (rev 30894)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2011-04-28 07:20:06 UTC (rev 30895)
@@ -34,13 +34,22 @@
typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.eap.43,org.jboss.ide.eclipse.as.runtime.eap.50,org.jboss.ide.eclipse.as.runtime.60"
id="org.jboss.ide.eclipse.as.ui.JBossRuntimeWizardFragment"/>
<fragment
+ class="org.jboss.ide.eclipse.as.ui.wizards.JBoss7ServerWizardFragment"
+ id="org.jboss.ide.eclipse.as.ui.jboss7ServerWizardFragment"
+ typeIds="org.jboss.ide.eclipse.as.runtime.70"/>
+ <fragment
class="org.jboss.ide.eclipse.as.ui.wizards.JBossServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.jbossServerWizardFragment"
- typeIds="%AllJBossServerTypes"/>
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43,org.jboss.ide.eclipse.as.eap.50,org.jboss.ide.eclipse.as.60"/>
+ <!--
<fragment
+ class="org.jboss.ide.eclipse.as.ui.wizards.JBoss7ServerWizardFragment"
+ id="org.jboss.ide.eclipse.as.ui.jboss7ServerWizardFragment"
+ typeIds="org.jboss.ide.eclipse.as.70"/> -->
+ <fragment
class="org.jboss.ide.eclipse.as.ui.wizards.StrippedServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.strippedServerWizardFragment"
- typeIds="org.jboss.ide.eclipse.as.systemCopyServer,org.jboss.ide.eclipse.as.70"/>
+ typeIds="org.jboss.ide.eclipse.as.systemCopyServer"/>
</extension>
<extension point="org.eclipse.ui.startup">
@@ -175,7 +184,7 @@
id="org.jboss.ide.eclipse.as.ui.editor.passwordSection"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
- typeIds="%AllJBossServerTypes"/>
+ typeIds="%JBossServer6AndBelow"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.ServerModeSection"
id="org.jboss.ide.eclipse.as.ui.editor.serverModeSection"
More information about the jbosstools-commits
mailing list