[jbosstools-commits] JBoss Tools SVN: r31443 - in trunk: as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards and 4 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue May 24 10:00:32 EDT 2011
Author: snjeza
Date: 2011-05-24 10:00:31 -0400 (Tue, 24 May 2011)
New Revision: 31443
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties
Log:
JBIDE-8906 jboss runtime detection doesn't spot AS 7 installations
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -11,6 +11,7 @@
package org.jboss.ide.eclipse.as.core.server.bean;
import java.io.File;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Properties;
import java.util.zip.ZipEntry;
@@ -54,6 +55,17 @@
BIN_PATH+File.separatorChar + TWIDDLE_JAR_NAME,
new String[]{V6_0,V5_1, V5_0, V4_2, V4_0, V3_2}, new ASServerTypeCondition());
+ public static final JBossServerType AS7 = new JBossServerType(
+ "AS", //$NON-NLS-1$
+ "Application Server", //$NON-NLS-1$
+ "modules" + File.separatorChar + //$NON-NLS-1$
+ "org" + File.separatorChar + //$NON-NLS-1$
+ "jboss" + File.separatorChar + //$NON-NLS-1$
+ "as" + File.separatorChar + //$NON-NLS-1$
+ "server" + File.separatorChar + //$NON-NLS-1$
+ "main", //$NON-NLS-1$
+ new String[]{V7_0,}, new AS7ServerTypeCondition());
+
public static final JBossServerType EAP_STD = new JBossServerType(
"EAP_STD",//$NON-NLS-1$
"Enterprise Application Platform",//$NON-NLS-1$
@@ -94,7 +106,7 @@
UNKNOWN_STR,
UNKNOWN_STR,
"",//$NON-NLS-1$
- new String[]{V6_0, V5_1, V5_0, V4_3, V4_2, V4_0, V3_2}, null);
+ new String[]{V7_0, V6_0, V5_1, V5_0, V4_3, V4_2, V4_0, V3_2}, null);
public String toString() {
return id;
@@ -194,6 +206,19 @@
}
}
+ public static class AS7ServerTypeCondition implements Condition {
+
+ public boolean isServerRoot(File location) {
+ String standaloneScriptPath = new StringBuilder(location.getAbsolutePath())
+ .append(File.separator)
+ .append("bin") //$NON-NLS-1$
+ .append(File.separator)
+ .append("standalone.sh") //$NON-NLS-1$
+ .toString();
+ return new File(standaloneScriptPath).exists();
+ }
+ }
+
public static class SOAPServerTypeCondition extends EAPServerTypeCondition{
public boolean isServerRoot(File location) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -12,6 +12,7 @@
package org.jboss.ide.eclipse.as.core.server.bean;
import java.io.File;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Properties;
import java.util.zip.ZipEntry;
@@ -35,6 +36,8 @@
public JBossServerType getServerType(File location) {
if(JBossServerType.AS.isServerRoot(location)) {
return JBossServerType.AS;
+ } else if(JBossServerType.AS7.isServerRoot(location)) {
+ return JBossServerType.AS7;
} else if(JBossServerType.EAP_STD.isServerRoot(location)) {
return JBossServerType.EAP_STD;
} else if(JBossServerType.EAP.isServerRoot(location) && JBossServerType.SOAP.isServerRoot(location)) {
@@ -56,6 +59,18 @@
}
public String getFullServerVersion(File systemJarFile) {
+ if (systemJarFile.isDirectory()) {
+ File[] files = systemJarFile.listFiles(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar"); //$NON-NLS-1$
+ }
+ });
+ if (files != null && files.length == 1) {
+ systemJarFile = files[0];
+ }
+ }
+
String version = null;
ZipFile jar = null;
if(systemJarFile.canRead()) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -98,6 +98,8 @@
JBossServerType type = loader.getServerType(path.toFile());
if( type == JBossServerType.AS)
return createASRuntime(path, loader);
+ if( type == JBossServerType.AS7)
+ return createAS7Runtime(path, loader);
if( type == JBossServerType.EAP)
return createEAPRuntime(path, loader);
if( type == JBossServerType.SOAP)
@@ -105,6 +107,16 @@
return null;
}
+ private static IRuntimeWorkingCopy createAS7Runtime(IPath path, ServerBeanLoader loader) {
+ String runtimeTypeId = IJBossToolingConstants.AS_70;
+ try {
+ IRuntimeWorkingCopy wc = createRuntimeWorkingCopy(runtimeTypeId, path.toOSString(), IJBossRuntimeResourceConstants.DEFAULT_CONFIGURATION);
+ return launchRuntimeWizard(wc);
+ } catch( CoreException ce) {
+ }
+ return null;
+ }
+
private static IRuntimeWorkingCopy createASRuntime(IPath path, ServerBeanLoader loader) {
String version = new ServerBeanLoader().getFullServerVersion(new File(path.toFile(), JBossServerType.AS.getSystemJarPath()));
String runtimeTypeId = null;
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -50,7 +50,8 @@
"org.jboss.ide.eclipse.as.runtime.51", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.runtime.60", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.runtime.eap.43", //$NON-NLS-1$
- "org.jboss.ide.eclipse.as.runtime.eap.50" //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.eap.50", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.70" //$NON-NLS-1$
};
public static final String HSQLDB_DRIVER_JAR_NAME = "hsqldb.jar"; //$NON-NLS-1$
@@ -80,6 +81,7 @@
"org.jboss.ide.eclipse.as.60", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.eap.43", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.eap.50", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.70" //$NON-NLS-1$
};
public static final String JBOSS_AS_NAME[] = {
@@ -90,7 +92,8 @@
Messages.JBossRuntimeStartup_JBoss_Application_Server_5_1,
Messages.JBossRuntimeStartup_JBoss_Application_Server_6_0,
Messages.JBossRuntimeStartup_JBoss_EAP_Server_4_3,
- Messages.JBossRuntimeStartup_JBoss_EAP_Server_5_0
+ Messages.JBossRuntimeStartup_JBoss_EAP_Server_5_0,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_7_0
};
public static final String JBOSS_AS_HOST = "localhost"; //$NON-NLS-1$
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -15,6 +15,7 @@
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.jboss.tools.runtime.messages"; //$NON-NLS-1$
public static String JBossRuntimeStartup_JBoss_Application_Server_6_0;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_7_0;
public static String JBossRuntimeStartup_Cannot_create_new_JBoss_Server;
public static String JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile;
public static String JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver;
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/DroolsHandler.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -18,9 +18,11 @@
import org.drools.eclipse.util.DroolsRuntime;
import org.drools.eclipse.util.DroolsRuntimeManager;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
import org.jboss.tools.runtime.core.model.ServerDefinition;
+import org.osgi.framework.Bundle;
public class DroolsHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
@@ -134,4 +136,13 @@
serverDefinition.getIncludedServerDefinitions().add(sd);
}
}
+
+ @Override
+ public boolean isValid() {
+ if (super.isValid()) {
+ Bundle droolsBundle = Platform.getBundle("org.eclipse.drools");
+ return droolsBundle != null;
+ }
+ return false;
+ }
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -13,8 +13,6 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Properties;
@@ -51,7 +49,6 @@
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBeanLoader;
@@ -63,6 +60,8 @@
public class JBossASHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+ private static final int JBOSS_AS7_INDEX = 8;
+
public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
createInitialJBossServer();
createJBossServerFromDefinitions(serverDefinitions);
@@ -138,6 +137,8 @@
index = 4;
} else if ("6.0".equals(version)) { //$NON-NLS-1$
index = 5;
+ } else if ("7.0".equals(version)) { //$NON-NLS-1$
+ index = 8;
}
createJBossServer(serverDefinition.getLocation(),index,serverDefinition.getName(),serverDefinition.getName() + " " + RUNTIME); //$NON-NLS-1$
}
@@ -279,20 +280,21 @@
server.setHost(JBOSS_AS_HOST);
server.setName(name);
- // JBossServer.DEPLOY_DIRECTORY
- // JBIDE-7822
- //String deployVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
- //((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory", deployVal); //$NON-NLS-1$
- ((ServerWorkingCopy) server).setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_SERVER);
+ if (index != JBOSS_AS7_INDEX) {
+ // JBossServer.DEPLOY_DIRECTORY
+ // JBIDE-7822
+ //String deployVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
+ //((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory", deployVal); //$NON-NLS-1$
+ ((ServerWorkingCopy) server).setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_SERVER);
- // IDeployableServer.TEMP_DEPLOY_DIRECTORY
- String deployTmpFolderVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp").append("jbosstoolsTemp").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.tempDeployDirectory", deployTmpFolderVal); //$NON-NLS-1$
+ // IDeployableServer.TEMP_DEPLOY_DIRECTORY
+ String deployTmpFolderVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp").append("jbosstoolsTemp").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.tempDeployDirectory", deployTmpFolderVal); //$NON-NLS-1$
- // If we'd need to set up a username / pw for JMX, do it here.
-// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
-// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
-
+ // If we'd need to set up a username / pw for JMX, do it here.
+// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
+// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
+ }
server.save(false, progressMonitor);
return server;
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties 2011-05-24 14:00:31 UTC (rev 31443)
@@ -7,6 +7,7 @@
JBossRuntimeStartup_JBoss_Application_Server_5_0=JBoss Application Server 5.0
JBossRuntimeStartup_JBoss_Application_Server_5_1=JBoss Application Server 5.1
JBossRuntimeStartup_JBoss_Application_Server_6_0=JBoss Application Server 6.0
+JBossRuntimeStartup_JBoss_Application_Server_7_0=JBoss Application Server 7.0
JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
JBossRuntimeStartup_JBoss_EAP_Server_5_0=JBoss EAP Server 5.0
JBossRuntimeStartup_Runtime=Runtime
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -250,7 +250,7 @@
public static boolean runtimeExists(ServerDefinition serverDefinition) {
Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
for (IRuntimeDetector detector:detectors) {
- if (detector.exists(serverDefinition)) {
+ if (detector.isEnabled() && detector.exists(serverDefinition)) {
return true;
}
}
@@ -258,17 +258,19 @@
}
public static void refreshPreferencePage(Shell shell) {
- Shell mainShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ Shell mainShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
if (shell != null && !shell.isDisposed()) {
shell.close();
- } else {
- shell = Display.getCurrent().getActiveShell();
- if (shell != mainShell) {
- shell.close();
- }
}
- shell = mainShell;
- PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, RuntimePreferencePage.ID, null, null);
+ shell = Display.getCurrent().getActiveShell();
+ if (shell != mainShell && shell != null) {
+ shell.close();
+ }
+ PreferenceDialog preferenceDialog = PreferencesUtil
+ .createPreferenceDialogOn(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(),
+ RuntimePreferencePage.ID, null, null);
preferenceDialog.open();
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-05-24 09:55:23 UTC (rev 31442)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-05-24 14:00:31 UTC (rev 31443)
@@ -256,7 +256,13 @@
setReturnCode(OK);
close();
if (needRefresh) {
- RuntimeUIActivator.refreshPreferencePage(getShell());
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ RuntimeUIActivator.refreshPreferencePage(getShell());
+ }
+ });
+
}
}
More information about the jbosstools-commits
mailing list