[jbosstools-commits] JBoss Tools SVN: r43635 - in trunk/as: features/org.jboss.ide.eclipse.as.feature and 9 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Sep 13 03:52:48 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-13 03:52:48 -0400 (Thu, 13 Sep 2012)
New Revision: 43635

Added:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DownloadRuntimeToWTPRuntime.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossRuntimePluginConstants.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossASDownloadRuntimeFilter.java
Removed:
   trunk/as/features/org.jboss.tools.runtime.as.detector.feature/
   trunk/as/plugins/org.jboss.tools.runtime.as.detector/
Modified:
   trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
   trunk/as/features/pom.xml
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
   trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
   trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
   trunk/as/plugins/pom.xml
   trunk/as/site/category.xml
Log:
JBIDE-12583

Modified: trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
===================================================================
--- trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml	2012-09-13 07:52:48 UTC (rev 43635)
@@ -39,10 +39,6 @@
    <includes
          id="org.jboss.ide.eclipse.as.serverAdapter.wtp.feature"
          version="0.0.0"/>
-   <includes
-         id="org.jboss.tools.runtime.as.detector.feature"
-         version="0.0.0"/>
-
    <requires>
       <import plugin="org.eclipse.ui" version="3.7.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.core.runtime" version="3.7.0" match="greaterOrEqual"/>

Modified: trunk/as/features/pom.xml
===================================================================
--- trunk/as/features/pom.xml	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/features/pom.xml	2012-09-13 07:52:48 UTC (rev 43635)
@@ -19,7 +19,6 @@
 
 		<module>org.jboss.ide.eclipse.as.feature</module>
 		<module>org.jboss.ide.eclipse.as.test.feature</module>
-		<module>org.jboss.tools.runtime.as.detector.feature</module>
 	</modules>
 </project>
 	

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF	2012-09-13 07:52:48 UTC (rev 43635)
@@ -1,54 +1,59 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.jboss.ide.eclipse.as.core;singleton:=true
-Bundle-Version: 2.4.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.core.JBossServerCorePlugin
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
- org.eclipse.debug.core;bundle-version="3.7.0",
- org.eclipse.jdt.launching;bundle-version="3.6.0",
- org.eclipse.jdt.core;bundle-version="3.7.0",
- org.eclipse.jst.server.core;bundle-version="1.2.101",
- org.eclipse.wst.server.core;bundle-version="1.1.302",
- org.eclipse.jst.j2ee;bundle-version="1.1.500",
- org.eclipse.wst.xml.core;bundle-version="1.1.600",
- org.apache.ant;bundle-version="1.7.1",
- org.eclipse.core.variables;bundle-version="3.2.500",
- org.eclipse.jem.util;bundle-version="2.1.2",
- org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
- org.jboss.ide.eclipse.as.wtp.core,
- org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
- org.eclipse.wst.common.frameworks;bundle-version="1.2.0",
- org.eclipse.jst.jee;bundle-version="1.0.401",
- org.eclipse.core.commands;bundle-version="3.6.0",
- org.eclipse.pde.core;bundle-version="3.7.0",
- org.eclipse.jst.j2ee.web;bundle-version="1.1.500",
- org.jboss.ide.eclipse.as.management.core,
- org.eclipse.equinox.security;bundle-version="1.1.1",
- org.jboss.ide.eclipse.as.dmr;bundle-version="2.3.0"
-Bundle-ActivationPolicy: lazy
-Export-Package: org.jboss.ide.eclipse.as.core,
- org.jboss.ide.eclipse.as.core.extensions.descriptors,
- org.jboss.ide.eclipse.as.core.extensions.events,
- org.jboss.ide.eclipse.as.core.extensions.polling,
- org.jboss.ide.eclipse.as.core.modules,
- org.jboss.ide.eclipse.as.core.publishers,
- org.jboss.ide.eclipse.as.core.publishers.patterns,
- org.jboss.ide.eclipse.as.core.resolvers,
- org.jboss.ide.eclipse.as.core.server,
- org.jboss.ide.eclipse.as.core.server.bean,
- org.jboss.ide.eclipse.as.core.server.internal,
- org.jboss.ide.eclipse.as.core.server.internal.extendedproperties,
- org.jboss.ide.eclipse.as.core.server.internal.launch,
- org.jboss.ide.eclipse.as.core.server.internal.launch.configuration,
- org.jboss.ide.eclipse.as.core.server.internal.v7,
- org.jboss.ide.eclipse.as.core.server.v7.management,
- org.jboss.ide.eclipse.as.core.server.xpl,
- org.jboss.ide.eclipse.as.core.util
-Bundle-ClassPath: dom4j-1.6.1.jar,
- jaxen-1.1-beta-6.jar,
- getopt.jar,
- .
-Bundle-Vendor: %Bundle-Vendor.0
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.core;singleton:=true
+Bundle-Version: 2.4.0.qualifier
+Bundle-Activator: org.jboss.ide.eclipse.as.core.JBossServerCorePlugin
+Bundle-Localization: plugin
+Require-Bundle: org.apache.ant;bundle-version="1.7.1",
+ org.eclipse.equinox.security;bundle-version="1.1.1",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.eclipse.core.commands;bundle-version="3.6.0",
+ org.eclipse.debug.core;bundle-version="3.7.0",
+ org.eclipse.jem.util;bundle-version="2.1.2",
+ org.eclipse.jdt.launching;bundle-version="3.6.0",
+ org.eclipse.jdt.core;bundle-version="3.7.0",
+ org.eclipse.jst.jee;bundle-version="1.0.401",
+ org.eclipse.jst.j2ee;bundle-version="1.1.500",
+ org.eclipse.jst.j2ee.web;bundle-version="1.1.500",
+ org.eclipse.jst.server.core;bundle-version="1.2.101",
+ org.eclipse.wst.server.core;bundle-version="1.1.302",
+ org.eclipse.wst.xml.core;bundle-version="1.1.600",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
+ org.eclipse.wst.common.frameworks;bundle-version="1.2.0",
+ org.eclipse.pde.core;bundle-version="3.7.0",
+ org.eclipse.datatools.connectivity;bundle-version="1.2.2";resolution:=optional,
+ org.eclipse.datatools.connectivity.db.generic;bundle-version="1.0.1";resolution:=optional,
+ org.jboss.ide.eclipse.as.wtp.core,
+ org.jboss.ide.eclipse.as.management.core,
+ org.jboss.ide.eclipse.as.dmr;bundle-version="2.3.0",
+ org.jboss.tools.runtime.core;bundle-version="2.0.0",
+ org.jboss.tools.runtime.ui;bundle-version="2.0.0"
+Bundle-ActivationPolicy: lazy
+Export-Package: org.jboss.ide.eclipse.as.core,
+ org.jboss.ide.eclipse.as.core.extensions.descriptors,
+ org.jboss.ide.eclipse.as.core.extensions.events,
+ org.jboss.ide.eclipse.as.core.extensions.polling,
+ org.jboss.ide.eclipse.as.core.modules,
+ org.jboss.ide.eclipse.as.core.publishers,
+ org.jboss.ide.eclipse.as.core.publishers.patterns,
+ org.jboss.ide.eclipse.as.core.resolvers,
+ org.jboss.ide.eclipse.as.core.runtime,
+ org.jboss.ide.eclipse.as.core.server,
+ org.jboss.ide.eclipse.as.core.server.bean,
+ org.jboss.ide.eclipse.as.core.server.internal,
+ org.jboss.ide.eclipse.as.core.server.internal.extendedproperties,
+ org.jboss.ide.eclipse.as.core.server.internal.launch,
+ org.jboss.ide.eclipse.as.core.server.internal.launch.configuration,
+ org.jboss.ide.eclipse.as.core.server.internal.v7,
+ org.jboss.ide.eclipse.as.core.server.v7.management,
+ org.jboss.ide.eclipse.as.core.server.xpl,
+ org.jboss.ide.eclipse.as.core.util
+Bundle-ClassPath: dom4j-1.6.1.jar,
+ jaxen-1.1-beta-6.jar,
+ getopt.jar,
+ .
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -108,6 +108,28 @@
 	
 	public static String UpdateDeploymentScannerJobName;
 	
+	
+	/* From runtime detection */
+	public static String JBossRuntimeStartup_JBoss_Application_Server_6_0;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_7_0;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_7_1;
+	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;
+	public static String JBossRuntimeStartup_Cannot_create_new_DB_Driver;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_3_2;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_4_0;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_4_2;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_5_0;
+	public static String JBossRuntimeStartup_JBoss_Application_Server_5_1;
+	public static String JBossRuntimeStartup_JBoss_EAP_Server_4_3;
+	public static String JBossRuntimeStartup_JBoss_EAP_Server_5_0;
+	public static String JBossRuntimeStartup_JBoss_EAP_Server_6_0;
+	// NEW_SERVER_ADAPTER add logic for new adapter here
+	public static String JBossRuntimeStartup_Runtime;
+	public static String JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database;
+	public static String JBossRuntimeStartup_The_JBoss_AS_H2_embedded_database;
+
 	static {
 		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
 	}

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties	2012-09-13 07:52:48 UTC (rev 43635)
@@ -85,4 +85,24 @@
 RuntimeFolderDoesNotExist=The server's runtime folder does not exist: {0}
 JBossConfigurationFolderDoesNotExist=The server's configuration folder does not exist: {0}
 JBossAS7ConfigurationFileDoesNotExist=The server's configuration file does not exist: {0}
-UpdateDeploymentScannerJobName=Updating Deployment Scanners for Server: {0}
\ No newline at end of file
+UpdateDeploymentScannerJobName=Updating Deployment Scanners for Server: {0}
+
+#From runtime detection
+JBossRuntimeStartup_Cannot_create_new_JBoss_Server=Can''t create new JBoss Server
+JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile=Can''t create new DTP Connection Profile for JBoss AS Hypersonic embedded database
+JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver=Can''t create new HSQL DB Driver.
+JBossRuntimeStartup_Cannot_create_new_DB_Driver=Can''t create new DB Driver.
+JBossRuntimeStartup_JBoss_Application_Server_3_2=JBoss Application Server 3.2
+JBossRuntimeStartup_JBoss_Application_Server_4_0=JBoss Application Server 4.0
+JBossRuntimeStartup_JBoss_Application_Server_4_2=JBoss Application Server 4.2
+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_Application_Server_7_1=JBoss Application Server 7.1
+JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
+JBossRuntimeStartup_JBoss_EAP_Server_5_0=JBoss EAP Server 5.0
+JBossRuntimeStartup_JBoss_EAP_Server_6_0=JBoss EAP Server 6.0
+JBossRuntimeStartup_Runtime=Runtime
+JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database=The JBoss AS Hypersonic embedded database
+JBossRuntimeStartup_The_JBoss_AS_H2_embedded_database=The JBoss AS H2 embedded database

Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DownloadRuntimeToWTPRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DownloadRuntimeToWTPRuntime.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DownloadRuntimeToWTPRuntime.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -0,0 +1,67 @@
+package org.jboss.ide.eclipse.as.core.runtime;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.DownloadRuntime;
+
+public class DownloadRuntimeToWTPRuntime implements IJBossToolingConstants {
+	private static HashMap<String, String[]> map;
+	static {
+		map = new HashMap<String, String[]>();
+		map.put(AS_32, new String[]{DOWNLOAD_RT_328});
+		map.put(AS_40, new String[]{DOWNLOAD_RT_405});
+		map.put(AS_42, new String[]{DOWNLOAD_RT_423});
+		map.put(AS_50, new String[]{DOWNLOAD_RT_501});
+		map.put(AS_51, new String[]{DOWNLOAD_RT_510});
+		map.put(AS_60, new String[]{DOWNLOAD_RT_610});
+		map.put(AS_70, new String[]{DOWNLOAD_RT_701, DOWNLOAD_RT_702});
+		map.put(AS_71, new String[]{DOWNLOAD_RT_710, DOWNLOAD_RT_711});
+		// NEW_SERVER_ADAPTER
+	}
+	
+	
+	public static IRuntimeType getWTPRuntime(DownloadRuntime rt) {
+		Iterator<String> keyIt = map.keySet().iterator();
+		while(keyIt.hasNext()) {
+			String k = keyIt.next();
+			String[] val = map.get(k);
+			if( Arrays.asList(val).contains(rt.getId())) {
+				return ServerCore.findRuntimeType(k);
+			}
+		}
+		return null;
+	}
+	
+	public static DownloadRuntime[] getDownloadRuntimes(IRuntimeType type) {
+		Map<String, DownloadRuntime> dlRuntimes = RuntimeCoreActivator.getDefault().getDownloadRuntimes();
+		return getDownloadRuntimes(type, dlRuntimes);
+	}
+	
+	public static DownloadRuntime[] getDownloadRuntimes(IRuntimeType type, DownloadRuntime[] dlRuntimes) {
+		HashMap<String, DownloadRuntime> map = new HashMap<String, DownloadRuntime>();
+		for( int i = 0; i < dlRuntimes.length; i++ ) {
+			map.put(dlRuntimes[i].getId(), dlRuntimes[i]);
+		}
+		return getDownloadRuntimes(type, map);
+	}
+	
+	public static DownloadRuntime[] getDownloadRuntimes(IRuntimeType type, Map<String, DownloadRuntime> dlRuntimes) {
+		String[] all = map.get(type.getId());
+		ArrayList<DownloadRuntime> ret = new ArrayList<DownloadRuntime>();
+		for( int i = 0; i < all.length;i++ ) {
+			DownloadRuntime r = dlRuntimes.get(all[i]);
+			if( r != null )
+				ret.add(r);
+		}
+		return (DownloadRuntime[]) ret.toArray(new DownloadRuntime[ret.size()]);
+		
+	}
+}

Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java (from rev 43615, trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/DriverUtility.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.runtime;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
+import org.eclipse.datatools.connectivity.drivers.DriverInstance;
+import org.eclipse.datatools.connectivity.drivers.DriverManager;
+import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants;
+import org.eclipse.datatools.connectivity.drivers.IPropertySet;
+import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
+import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
+import org.eclipse.wst.server.core.IServerType;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+
+public class DriverUtility implements IJBossRuntimePluginConstants {
+	public static final HashMap<String,String> SERVER_DRIVER_LOCATION = new HashMap<String, String>();
+	static {
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_AS_32, HSQLDB_DRIVER_3X_4X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_AS_40, HSQLDB_DRIVER_3X_4X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_AS_42, HSQLDB_DRIVER_3X_4X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_AS_50, HSQLDB_DRIVER_5X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_AS_51, HSQLDB_DRIVER_5X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_AS_60, HSQLDB_DRIVER_5X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_EAP_43, HSQLDB_DRIVER_3X_4X_LOCATION);
+		SERVER_DRIVER_LOCATION.put(IJBossToolingConstants.SERVER_EAP_50, HSQLDB_DRIVER_5X_LOCATION);
+	}
+
+	/**
+	 * Creates HSQL DB Driver
+	 * @param jbossASLocation location of JBoss AS
+	 * @param index 
+	 * @throws ConnectionProfileException
+	 * @return driver instance
+	 */
+	public void createDriver(String jbossASLocation, IServerType serverType) throws ConnectionProfileException {
+		if(ProfileManager.getInstance().getProfileByName(DEFAULT_DS) != null) {
+			// Don't create the driver a few times
+			return;
+		}
+		String driverPath;
+		try {
+			driverPath = getDriverPath(jbossASLocation, serverType);
+		} catch (IOException e) {
+			JBossServerCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR,
+					JBossServerCorePlugin.PLUGIN_ID, Messages.JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver, e));
+			return;
+		}
+		if (driverPath == null) {
+			JBossServerCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR,
+					JBossServerCorePlugin.PLUGIN_ID, Messages.JBossRuntimeStartup_Cannot_create_new_DB_Driver));
+		}
+
+		DriverInstance driver = getDriver(serverType);
+		if (driver == null) {
+			TemplateDescriptor descr = getDriverTemplateDescriptor(serverType);
+			IPropertySet instance = new PropertySetImpl(getDriverName(serverType), getDriverDefinitionId(serverType));
+			instance.setName(getDriverName(serverType));
+			instance.setID(getDriverDefinitionId(serverType));
+			Properties props = new Properties();
+
+			IConfigurationElement[] template = descr.getProperties();
+			for (int i = 0; i < template.length; i++) {
+				IConfigurationElement prop = template[i];
+				String id = prop.getAttribute("id"); //$NON-NLS-1$
+
+				String value = prop.getAttribute("value"); //$NON-NLS-1$
+				props.setProperty(id, value == null ? "" : value); //$NON-NLS-1$
+			}
+			props.setProperty(DTP_DB_URL_PROPERTY_ID, getDriverUrl(serverType)); 
+			props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr.getId());
+			props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, driverPath);
+			if( isAS7StyleServer(serverType)) {
+				props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, "org.h2.Driver");//$NON-NLS-1$
+				props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, "H2 driver");//$NON-NLS-1$
+				props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, "jdbc:h2:mem");//$NON-NLS-1$
+				props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, "sa");//$NON-NLS-1$
+			}
+			
+			instance.setBaseProperties(props);
+			DriverManager.getInstance().removeDriverInstance(instance.getID());
+			System.gc();
+			DriverManager.getInstance().addDriverInstance(instance);
+		}
+
+		driver = DriverManager.getInstance().getDriverInstanceByName(getDriverName(serverType));
+		if (driver != null && ProfileManager.getInstance().getProfileByName(DEFAULT_DS) == null) {
+			// create profile
+			Properties props = new Properties();
+			props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, 
+					getDriverDefinitionId(serverType));
+			props.setProperty(IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID, ""); //$NON-NLS-1$
+			props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
+			props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID,	driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
+			props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
+			props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, "Default"); //$NON-NLS-1$
+			props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, ""); //$NON-NLS-1$
+			props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, "false"); //$NON-NLS-1$
+			props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID));
+			props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID));
+
+			if( isAS7StyleServer(serverType)) {
+				ProfileManager.getInstance().createProfile(DEFAULT_DS,	Messages.JBossRuntimeStartup_The_JBoss_AS_H2_embedded_database, H2_PROFILE_ID, props, "", false); //$NON-NLS-1$ 
+			} else {
+				ProfileManager.getInstance().createProfile(DEFAULT_DS,	Messages.JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database, HSQL_PROFILE_ID, props, "", false); //$NON-NLS-1$
+			}
+		}
+		
+	}
+
+	protected static String getDriverUrl(IServerType serverType) {
+		if( isAS7StyleServer(serverType)) {
+			return "jdbc:h2:mem";//$NON-NLS-1$
+		} else {
+			return "jdbc:hsqldb:.";//$NON-NLS-1$
+		}
+	}
+
+	private static String getDriverDefinitionId(IServerType serverType) {
+		if( isAS7StyleServer(serverType)) {
+			return H2_DRIVER_DEFINITION_ID;
+		} else {
+			return HSQL_DRIVER_DEFINITION_ID;
+		}
+	}
+
+	private static String getDriverName(IServerType serverType) {
+		if( isAS7StyleServer(serverType)) {
+			return H2_DRIVER_NAME;
+		} else {
+			return HSQL_DRIVER_NAME;
+		}
+	}
+
+	protected static TemplateDescriptor getDriverTemplateDescriptor(IServerType serverType) {
+		if( isAS7StyleServer(serverType)) {
+			return TemplateDescriptor.getDriverTemplateDescriptor(H2_DRIVER_TEMPLATE_ID);
+		} else {
+			return TemplateDescriptor.getDriverTemplateDescriptor(HSQL_DRIVER_TEMPLATE_ID);
+		}
+	}
+
+	protected static DriverInstance getDriver(IServerType serverType) {
+		if( isAS7StyleServer(serverType)) {
+			return DriverManager.getInstance().getDriverInstanceByName(H2_DRIVER_NAME);
+		}
+		return DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
+	}
+
+	private static String getDriverPath(String jbossASLocation, IServerType serverType)
+			throws IOException {
+		String driverPath;
+		if (isAS7StyleServer(serverType)) {
+			File file = new File(jbossASLocation + "/modules/com/h2database/h2/main").getCanonicalFile();//$NON-NLS-1$
+			File[] fileList = file.listFiles(new FilenameFilter() {
+				
+				@Override
+				public boolean accept(File dir, String name) {
+					if (name.startsWith("h2") && name.endsWith(".jar")) {//$NON-NLS-1$ //$NON-NLS-2$
+						return true;
+					}
+					return false;
+				}
+			});
+			if (fileList != null && fileList.length > 0) {
+				return fileList[0].getCanonicalPath();
+			}
+			return null;
+		} else {
+			String loc = SERVER_DRIVER_LOCATION.get(serverType.getId());
+			driverPath = new File(jbossASLocation + loc).getCanonicalPath();
+		}
+		return driverPath;
+	}
+
+	private static boolean isAS7StyleServer(IServerType type) {
+		if( type != null ) {
+			String id = type.getId();
+			return IJBossToolingConstants.SERVER_AS_70.equals(id) || 
+					IJBossToolingConstants.SERVER_AS_71.equals(id) ||
+					IJBossToolingConstants.SERVER_EAP_60.equals(id);
+		}
+		return false;
+	}
+
+}

Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossRuntimePluginConstants.java (from rev 43615, trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossRuntimePluginConstants.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossRuntimePluginConstants.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.runtime;
+
+import org.jboss.ide.eclipse.as.core.Messages;
+
+
+public interface IJBossRuntimePluginConstants {
+	public static final String DEFAULT_DS = "DefaultDS";//$NON-NLS-1$
+	public static final String RUNTIME = Messages.JBossRuntimeStartup_Runtime;
+	public static final String EAP = "EAP"; //$NON-NLS-1$
+	public static final String EAP_STD = "EAP_STD"; //$NON-NLS-1$
+	public static final String SOA_P = "SOA-P"; //$NON-NLS-1$
+	public static final String SOA_P_STD = "SOA-P-STD"; //$NON-NLS-1$
+	public static final String EPP = "EPP"; //$NON-NLS-1$
+	public static final String EWP = "EWP"; //$NON-NLS-1$
+	public static final String AS = "AS"; //$NON-NLS-1$
+	
+	public static final String HSQLDB_DRIVER_JAR_NAME = "hsqldb.jar"; //$NON-NLS-1$
+	
+	public static final String HSQLDB_DRIVER_3X_4X_LOCATION = "/server/default/lib/" + HSQLDB_DRIVER_JAR_NAME; //$NON-NLS-1$
+	
+	public static final String HSQLDB_DRIVER_5X_LOCATION = "/common/lib/" + HSQLDB_DRIVER_JAR_NAME; //$NON-NLS-1$
+		
+	public static final String HSQL_DRIVER_DEFINITION_ID 
+												= "DriverDefn.Hypersonic DB"; //$NON-NLS-1$
+
+	public static final String H2_DRIVER_DEFINITION_ID 
+												= "DriverDefn.H2 DB"; //$NON-NLS-1$
+
+	public static final String HSQL_DRIVER_NAME = "Hypersonic DB"; //$NON-NLS-1$
+	
+	public static final String H2_DRIVER_NAME = "H2 Database"; //$NON-NLS-1$
+
+	public static final String HSQL_DRIVER_TEMPLATE_ID 
+						= "org.eclipse.datatools.enablement.hsqldb.1_8.driver"; //$NON-NLS-1$
+	
+	public static final String H2_DRIVER_TEMPLATE_ID 
+					= "org.eclipse.datatools.connectivity.db.generic.genericDriverTemplate"; //$NON-NLS-1$
+
+	public static final String DTP_DB_URL_PROPERTY_ID 
+								= "org.eclipse.datatools.connectivity.db.URL"; //$NON-NLS-1$
+
+	public static final String HSQL_PROFILE_ID = "org.eclipse.datatools.enablement.hsqldb.connectionProfile";//$NON-NLS-1$
+	
+	public static final String H2_PROFILE_ID = "org.eclipse.datatools.connectivity.db.generic.connectionProfile";//$NON-NLS-1$
+
+}

Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java (from rev 43615, trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -0,0 +1,395 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.runtime;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+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.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+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;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.tools.runtime.core.JBossRuntimeLocator;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetectorDelegate;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.RuntimeDefinition;
+import org.osgi.framework.Bundle;
+
+public class JBossASHandler extends AbstractRuntimeDetectorDelegate implements IJBossRuntimePluginConstants {
+	
+	private static String[] hasIncludedRuntimes = new String[] {SOA_P, EAP, EPP, EWP, SOA_P_STD};
+	private static final String DROOLS = "DROOLS";  //$NON-NLS-1$
+	private static final String ESB = "ESB"; //$NON-NLS-1$
+	
+	// This constants are made to avoid dependency with org.jboss.ide.eclipse.as.core plugin
+	public static final String RUNTIME_TYPES[] = IJBossToolingConstants.ALL_JBOSS_RUNTIMES;
+	public static final String SERVER_TYPES[] = IJBossToolingConstants.ALL_JBOSS_SERVERS;
+	
+	public static final HashMap<String,String> SERVER_DEFAULT_NAME = new HashMap<String, String>();
+	static {
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_32, Messages.JBossRuntimeStartup_JBoss_Application_Server_3_2);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_40, Messages.JBossRuntimeStartup_JBoss_Application_Server_4_0);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_42, Messages.JBossRuntimeStartup_JBoss_Application_Server_4_2);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_50, Messages.JBossRuntimeStartup_JBoss_Application_Server_5_0);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_51, Messages.JBossRuntimeStartup_JBoss_Application_Server_5_1);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_60, Messages.JBossRuntimeStartup_JBoss_Application_Server_6_0);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_EAP_43, Messages.JBossRuntimeStartup_JBoss_EAP_Server_4_3);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_EAP_50, Messages.JBossRuntimeStartup_JBoss_EAP_Server_5_0);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_70, Messages.JBossRuntimeStartup_JBoss_Application_Server_7_0);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_71, Messages.JBossRuntimeStartup_JBoss_Application_Server_7_1);
+		SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_EAP_60, Messages.JBossRuntimeStartup_JBoss_EAP_Server_6_0);
+	}
+
+	public void initializeRuntimes(List<RuntimeDefinition> runtimeDefinitions) {
+		createJBossServerFromDefinitions(runtimeDefinitions);
+	}
+		
+	private static File getLocation(RuntimeDefinition runtimeDefinitions) {
+		String type = runtimeDefinitions.getType();
+		String version = runtimeDefinitions.getVersion();
+		if (EAP.equals(type) && version != null && version.startsWith("6") ) {//$NON-NLS-1$
+			return runtimeDefinitions.getLocation();
+		}
+		if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type)) {
+			return new File(runtimeDefinitions.getLocation(), "jboss-as");//$NON-NLS-1$
+		}
+		if (SOA_P_STD.equals(type)) {
+			return new File(runtimeDefinitions.getLocation(),"jboss-esb"); //$NON-NLS-1$					
+		}
+		if(EWP.equals(type)) {
+				return new File(runtimeDefinitions.getLocation(),"jboss-as-web"); //$NON-NLS-1$
+		}
+		if (AS.equals(type) || EAP_STD.equals(type)) {
+			return runtimeDefinitions.getLocation();
+		}
+		return null;
+	}
+	
+	public static void createJBossServerFromDefinitions(List<RuntimeDefinition> runtimeDefinitions) {
+		for (RuntimeDefinition runtimeDefinition:runtimeDefinitions) {
+			if (runtimeDefinition.isEnabled()) {
+				File asLocation = getLocation(runtimeDefinition);
+				if (asLocation == null || !asLocation.isDirectory()) {
+					continue;
+				}
+				String type = runtimeDefinition.getType();
+				if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type)
+						|| SOA_P_STD.equals(type) || EWP.equals(type)
+						|| EAP_STD.equals(type) || AS.equals(type)) {
+					String typeId = new ServerBeanLoader(asLocation).getServerAdapterId();
+					String name = runtimeDefinition.getName();
+					String runtimeName = name + " " + RUNTIME; //$NON-NLS-1$
+					createJBossServer(asLocation, typeId, name, runtimeName);
+				}
+			}
+			createJBossServerFromDefinitions(runtimeDefinition.getIncludedRuntimeDefinitions());
+		}	
+	}
+
+	private static boolean serverExistsForPath(IPath locPath) {
+		IServer[] servers = ServerCore.getServers();
+		for (int i = 0; i < servers.length; i++) {
+			IRuntime runtime = servers[i].getRuntime();
+			if(runtime != null && runtime.getLocation() != null && runtime.getLocation().equals(locPath)) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	private static IRuntime findRuntimeForPath(IPath locPath) {
+		IRuntime[] runtimes = ServerCore.getRuntimes();
+		for (int i = 0; i < runtimes.length; i++) {
+			if (runtimes[i] == null || runtimes[i].getLocation() == null) {
+				continue;
+			}
+			if (runtimes[i].getLocation().equals(locPath)) {
+				return runtimes[i];
+			}
+		}
+		return null;
+	}
+	
+	private static void createJBossServer(File asLocation, String serverTypeId, String name, String runtimeName) {
+		if (asLocation == null || !asLocation.isDirectory() || serverTypeId == null)
+			return;
+		IServerType serverType = ServerCore.findServerType(serverTypeId);
+		if( serverType == null )
+			return;
+		IRuntimeType rtType = serverType.getRuntimeType();
+		if( rtType == null )
+			return;
+		
+		IPath jbossAsLocationPath = new Path(asLocation.getAbsolutePath());
+		if( serverExistsForPath(jbossAsLocationPath))
+			return;
+		
+		IRuntime runtime = findRuntimeForPath(jbossAsLocationPath);
+		IProgressMonitor progressMonitor = new NullProgressMonitor();
+		try {
+			if (runtime == null) {
+				runtime = createRuntime(runtimeName, asLocation.getAbsolutePath(), progressMonitor, rtType);
+			}
+			if (runtime != null) {
+				createServer(progressMonitor, runtime, serverType, name);
+			}
+
+			new DriverUtility().createDriver(asLocation.getAbsolutePath(), serverType);
+		} catch (CoreException e) {
+			JBossServerCorePlugin.log(IStatus.ERROR, Messages.JBossRuntimeStartup_Cannot_create_new_JBoss_Server,e);
+		} catch (ConnectionProfileException e) {
+			JBossServerCorePlugin.log(IStatus.ERROR, Messages.JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile,e);
+		}
+	}
+
+	/**
+	 * Creates new JBoss AS Runtime
+	 * @param jbossASLocation location of JBoss AS
+	 * @param progressMonitor
+	 * @return runtime working copy
+	 * @throws CoreException
+	 */
+	private static IRuntime createRuntime(String runtimeName, String jbossASLocation, 
+			IProgressMonitor progressMonitor, IRuntimeType rtType) throws CoreException {
+		IRuntimeWorkingCopy runtime = null;
+		IPath jbossAsLocationPath = new Path(jbossASLocation);
+		runtime = rtType.createRuntime(null, progressMonitor);
+		runtime.setLocation(jbossAsLocationPath);
+		if(runtimeName!=null) {
+			runtime.setName(runtimeName);				
+		}
+		return runtime.save(false, progressMonitor);
+	}
+
+	/**
+	 * Creates new JBoss Server
+	 * @param progressMonitor
+	 * @param runtime parent JBoss AS Runtime
+	 * @return server working copy
+	 * @throws CoreException
+	 */
+	private static void createServer(IProgressMonitor progressMonitor, IRuntime runtime,
+			IServerType serverType, String name) throws CoreException {
+		if (name == null)
+			name = SERVER_DEFAULT_NAME.get(serverType.getId());
+		if( !serverWithNameExists(name)) {
+			IServerWorkingCopy serverWC = serverType.createServer(null, null,
+					new NullProgressMonitor());
+			serverWC.setRuntime(runtime);
+			serverWC.setName(name);
+			serverWC.setServerConfiguration(null);
+			serverWC.setAttribute(IDeployableServer.SERVER_MODE,  LocalPublishMethod.LOCAL_PUBLISH_METHOD); 
+			serverWC.save(true, new NullProgressMonitor());
+		}
+	}
+	
+	private static boolean serverWithNameExists(String name) {
+		IServer[] servers = ServerCore.getServers();
+		for (IServer server:servers) {
+			if (name.equals(server.getName()) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public RuntimeDefinition getRuntimeDefinition(File root,
+			IProgressMonitor monitor) {
+		if (monitor.isCanceled() || root == null || !isEnabled()) {
+			return null;
+		}
+		ServerBeanLoader loader = new ServerBeanLoader(root);
+		ServerBean serverBean = loader.getServerBean();
+		
+		if (!JBossServerType.UNKNOWN.equals(serverBean.getType())) {
+			RuntimeDefinition runtimeDefinition = new RuntimeDefinition(serverBean.getName(), 
+					serverBean.getVersion(), serverBean.getType().getId(), new File(serverBean.getLocation()));
+			calculateIncludedRuntimeDefinition(runtimeDefinition, monitor);
+			return runtimeDefinition;
+		}
+		return null;
+	}
+	
+	private void calculateIncludedRuntimeDefinition(
+			RuntimeDefinition runtimeDefinition, IProgressMonitor monitor) {
+		if (runtimeDefinition == null || runtimeDefinition.getType() == null) {
+			return;
+		}
+		String type = runtimeDefinition.getType();
+		if (!hasIncludedRuntimes(type)) {
+			return;
+		}
+		runtimeDefinition.getIncludedRuntimeDefinitions().clear();
+		List<RuntimeDefinition> runtimeDefinitions = runtimeDefinition
+				.getIncludedRuntimeDefinitions();
+		JBossRuntimeLocator locator = new JBossRuntimeLocator();
+		final File location = getLocation(runtimeDefinition);
+		File[] directories = runtimeDefinition.getLocation().listFiles(
+				new FileFilter() {
+					public boolean accept(File file) {
+						if (!file.isDirectory() || file.equals(location)) {
+							return false;
+						}
+						return true;
+					}
+				});
+		boolean saved = isEnabled();
+		try {
+			setEnabled(false);
+			for (File directory : directories) {
+				List<RuntimeDefinition> definitions = new ArrayList<RuntimeDefinition>();
+				locator.searchDirectory(directory, definitions, 1, monitor);
+				for (RuntimeDefinition definition:definitions) {
+					definition.setParent(runtimeDefinition);
+				}
+				runtimeDefinitions.addAll(definitions);
+			}
+			if (SOA_P.equals(type) || SOA_P_STD.equals(type)) {
+				addDrools(runtimeDefinition);
+				addEsb(runtimeDefinition);
+			}
+		} finally {
+			setEnabled(saved);
+		}
+	}
+
+	private void addDrools(RuntimeDefinition runtimeDefinition) {
+		if (runtimeDefinition == null) {
+			return;
+		}
+		Bundle drools = Platform.getBundle("org.drools.eclipse"); //$NON-NLS-1$
+		Bundle droolsDetector = Platform
+				.getBundle("org.jboss.tools.runtime.drools.detector");//$NON-NLS-1$
+		if (drools != null && droolsDetector != null) {
+			File droolsRoot = runtimeDefinition.getLocation();
+			if (droolsRoot.isDirectory()) {
+				String name = "Drools - " + runtimeDefinition.getName();//$NON-NLS-1$
+				RuntimeDefinition droolsDefinition = new RuntimeDefinition(
+						name, runtimeDefinition.getVersion(), DROOLS,
+						droolsRoot);
+				droolsDefinition.setParent(runtimeDefinition);
+				runtimeDefinition.getIncludedRuntimeDefinitions().add(
+						droolsDefinition);
+			}
+		}
+	}
+	
+	private void addEsb(RuntimeDefinition runtimeDefinition) {
+		if (runtimeDefinition == null) {
+			return;
+		}
+		Bundle esb = Platform.getBundle("org.jboss.tools.esb.project.core");//$NON-NLS-1$
+		Bundle esbDetectorPlugin = Platform
+				.getBundle("org.jboss.tools.runtime.esb.detector");//$NON-NLS-1$
+		if (esb != null && esbDetectorPlugin != null) {
+			String type = runtimeDefinition.getType();
+			File esbRoot;
+			if (SOA_P.equals(type)) {
+				esbRoot = runtimeDefinition.getLocation();
+			} else {
+				esbRoot = new File(runtimeDefinition.getLocation(), "jboss-esb"); //$NON-NLS-1$
+			}
+			if (esbRoot.isDirectory()) {
+				String name = "ESB - " + runtimeDefinition.getName();//$NON-NLS-1$
+				String version="";//$NON-NLS-1$
+				RuntimeDefinition esbDefinition = new RuntimeDefinition(
+						name, version, ESB,
+						esbRoot);
+				IRuntimeDetector esbDetector = RuntimeCoreActivator.getDefault().getEsbDetector();
+				if (esbDetector != null) {
+					version = esbDetector.getVersion(esbDefinition);
+					esbDefinition.setVersion(version);
+				}
+				
+				esbDefinition.setParent(runtimeDefinition);
+				runtimeDefinition.getIncludedRuntimeDefinitions().add(
+						esbDefinition);
+			}
+		}
+	}
+
+	private boolean hasIncludedRuntimes(String type) {
+		for (String t:hasIncludedRuntimes) {
+			if (t.equals(type)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	@Override
+	public boolean exists(RuntimeDefinition serverDefinition) {
+		if (serverDefinition == null || serverDefinition.getLocation() == null) {
+			return false;
+		}
+		File location = getLocation(serverDefinition);
+		if (location == null || !location.isDirectory()) {
+			return false;
+		}
+		String path = location.getAbsolutePath();
+		if (path == null) {
+			return false;
+		}
+		IServer[] servers = ServerCore.getServers();
+		for (int i = 0; i < servers.length; i++) {
+			IRuntime runtime = servers[i].getRuntime();
+			if (runtime == null || runtime.getLocation() == null) {
+				continue;
+			}
+			if(path.equals(runtime.getLocation().toOSString())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	@Override
+	public void computeIncludedRuntimeDefinition(
+			RuntimeDefinition runtimeDefinition) {
+		if (runtimeDefinition == null) {
+			return;
+		}
+		String type = runtimeDefinition.getType();
+		if (AS.equals(type)) {
+			return;
+		}
+		calculateIncludedRuntimeDefinition(runtimeDefinition, new NullProgressMonitor());
+	}
+
+	@Override
+	public String getVersion(RuntimeDefinition runtimeDefinition) {
+		return runtimeDefinition.getVersion();
+	}
+	
+}

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -72,6 +72,21 @@
 	public static final String V7_1 = "7.1"; //$NON-NLS-1$
 	// NEW_SERVER_ADAPTER  Add the new version string above this line
 	
+	
+	
+	/* String constants for download runtime extensions */
+	public static final String DOWNLOAD_RT_328 = "org.jboss.tools.runtime.core.as.328"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_405 = "org.jboss.tools.runtime.core.as.405"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_423 = "org.jboss.tools.runtime.core.as.423"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_501 = "org.jboss.tools.runtime.core.as.501"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_510 = "org.jboss.tools.runtime.core.as.510"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_610 = "org.jboss.tools.runtime.core.as.610"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_701 = "org.jboss.tools.runtime.core.as.701"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_702 = "org.jboss.tools.runtime.core.as.702"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_710 = "org.jboss.tools.runtime.core.as.710"; //$NON-NLS-1$
+	public static final String DOWNLOAD_RT_711 = "org.jboss.tools.runtime.core.as.711"; //$NON-NLS-1$
+
+	
 	/* Files or folders inside the TOOLING */
 	public static final String LOG = "log"; //$NON-NLS-1$
 	public static final String TEMP_DEPLOY = "tempDeploy"; //$NON-NLS-1$

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml	2012-09-13 07:52:48 UTC (rev 43635)
@@ -500,13 +500,6 @@
             sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
             sourcePathComputerId="org.eclipse.jst.server.generic.core.sourcePathComputer"/>
       <launchConfigurationType
-            delegate="org.jboss.ide.eclipse.as.core.server.internal.launch.TwiddleLaunchConfiguration"
-            id="org.jboss.ide.eclipse.as.core.server.twiddleConfiguration"
-            modes="run"
-            name="Twiddle"
-            public="false">
-      </launchConfigurationType>
-      <launchConfigurationType
             delegate="org.jboss.ide.eclipse.as.core.server.internal.launch.StopLaunchConfiguration"
             id="org.jboss.ide.eclipse.as.core.server.stopLaunchConfiguration"
             modes="run"
@@ -1218,4 +1211,110 @@
       </factory>
    </extension>
    
+   
+   
+   
+   
+   
+   
+   <!-- From as-handler for runtime detection -->
+   
+	<extension
+         point="org.jboss.tools.runtime.core.runtimeDetectors">
+    	<runtimeDetector 
+    	    id="org.jboss.tools.runtime.handlers.JBossASHandler"
+    		name="JBoss AS"
+       		class="org.jboss.ide.eclipse.as.core.runtime.JBossASHandler"
+       		preferenceId="org.eclipse.wst.server.ui.runtime.preferencePage"
+       		priority="100"/>
+	</extension>
+	
+	
+   <extension
+         point="org.jboss.tools.runtime.core.downloadruntimes">
+      <runtime
+            id="org.jboss.tools.runtime.core.as.328" 
+            name="JBoss AS 3.2.8"
+            version="3.2.8"
+            size="100MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://repository.jboss.org/sourceforge/jboss-3.2.8.SP1.zip"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.405" 
+            name="JBoss AS 4.0.5"
+            version="4.0.5"
+            size="100MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://repository.jboss.org/sourceforge/jboss-4.0.5.GA.zip"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.423" 
+            name="JBoss AS 4.2.3"
+            version="4.2.3"
+            size="100MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://sourceforge.net/projects/jboss/files/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip?use_mirror=autoselect"
+            disclaimer="true"/>
+          
+      <runtime
+            id="org.jboss.tools.runtime.core.as.501" 
+            name="JBoss AS 5.0.1"
+            version="5.0.1"
+            size="100MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://repository.jboss.org/sourceforge/jboss-5.0.1.GA.zip"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.510" 
+            name="JBoss AS 5.1.0"
+            version="5.1.0"
+            size="100MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://repository.jboss.org/sourceforge/jboss-5.1.0.GA.zip"
+            disclaimer="true"/>
+            
+      <runtime
+            id="org.jboss.tools.runtime.core.as.610" 
+            name="JBoss AS 6.1.0"
+            version="6.1.0.Final"
+            size="183MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://download.jboss.org/jbossas/6.1/jboss-as-distribution-6.1.0.Final.zip?use_mirror=autoselect"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.701" 
+            name="JBoss AS 7.0.1 Everything (NOT Java EE6 Certified)"
+            version="7.0.1.Final"
+            size="74MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://download.jboss.org/jbossas/7.0/jboss-as-7.0.1.Final/jboss-as-7.0.1.Final.zip?use_mirror=autoselect"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.702" 
+            name="JBoss AS 7.0.2 Everything (NOT Java EE6 Certified)"
+            version="7.0.2.Final"
+            size="75MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-7.0.2.Final.zip?use_mirror=autoselect"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.711" 
+            name="JBoss AS 7.1.1 Certified Java EE 6 Full Profile"
+            version="7.1.1.Final"
+            size="127MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip?use_mirror=autoselect"
+            disclaimer="true"/>
+      <runtime
+            id="org.jboss.tools.runtime.core.as.710" 
+            name="JBoss AS 7.1.0 Certified Java EE 6 Full Profile"
+            version="7.1.0.Final"
+            size="100MB"
+            licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.txt"
+            url="http://download.jboss.org/jbossas/7.1/jboss-as-7.1.0.Final/jboss-as-7.1.0.Final.zip?use_mirror=autoselect"
+            disclaimer="true"/>
+     <!-- NEW_SERVER_ADAPTER add new downloadable runtimes here. 
+          Also, if adding new, make sure to update DownloadRuntimeToWTPRuntime -->
+     </extension>
 </plugin>

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF	2012-09-13 07:52:48 UTC (rev 43635)
@@ -1,77 +1,79 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.jboss.ide.eclipse.as.ui;singleton:=true
-Bundle-Version: 2.4.0.qualifier
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui.ide;bundle-version="3.7.0",
- org.eclipse.jface.text;bundle-version="3.7.0",
- org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
- org.eclipse.ui.editors;bundle-version="3.7.0",
- org.eclipse.ui;bundle-version="3.7.0",
- org.eclipse.core.filebuffers;bundle-version="3.5.200",
- org.eclipse.core.variables;bundle-version="3.2.500",
- org.eclipse.core.expressions;bundle-version="3.4.200",
- org.eclipse.jdt.core;bundle-version="3.7.0",
- org.eclipse.debug.ui;bundle-version="3.7.0",
- org.eclipse.jdt.debug;bundle-version="3.7.0",
- org.eclipse.jdt.launching;bundle-version="3.6.0",
- org.eclipse.jdt.ui;bundle-version="3.7.0",
- org.eclipse.core.runtime;bundle-version="3.7.0",
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
- org.eclipse.ui.console;bundle-version="3.5.100",
- org.eclipse.jdt.core.manipulation;bundle-version="1.3.0",
- org.eclipse.search;bundle-version="3.6.100",
- org.eclipse.ui.forms;bundle-version="3.5.100",
- org.eclipse.core.resources;bundle-version="3.7.100",
- org.eclipse.jface;bundle-version="3.7.0",
- com.ibm.icu;bundle-version="4.2.1",
- org.eclipse.jst.server.ui;bundle-version="1.1.201",
- org.eclipse.wst.server.core;bundle-version="1.1.302",
- org.eclipse.wst.server.ui;bundle-version="1.1.305",
- org.eclipse.wst.server.ui.doc.user;bundle-version="1.1.300",
- org.eclipse.jdt.debug.ui;bundle-version="3.6.0",
- org.eclipse.text;bundle-version="3.5.100",
- org.eclipse.debug.core;bundle-version="3.7.0",
- org.eclipse.ui.views;bundle-version="3.6.0",
- org.eclipse.wst.xml.ui;bundle-version="1.1.200",
- org.eclipse.wst.sse.ui;bundle-version="1.3.0",
- org.eclipse.wst.sse.core;bundle-version="1.1.600",
- org.eclipse.wst.xml.core;bundle-version="1.1.600",
- org.eclipse.core.filesystem;bundle-version="1.3.100",
- org.eclipse.jst.server.core;bundle-version="1.2.101",
- org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
- org.eclipse.jst.servlet.ui;bundle-version="1.1.500",
- org.eclipse.jst.j2ee;bundle-version="1.1.500",
- org.eclipse.jst.j2ee.ui;bundle-version="1.1.500",
- org.eclipse.wst.web.ui;bundle-version="1.1.400",
- org.eclipse.wst.common.frameworks.ui;bundle-version="1.2.0",
- org.eclipse.jem.util;bundle-version="2.1.2",
- org.apache.ant;bundle-version="1.7.1",
- org.jboss.ide.eclipse.as.core,
- org.eclipse.ui.navigator;bundle-version="3.5.0",
- org.eclipse.ui.views.log;bundle-version="1.0.200",
- org.eclipse.jst.j2ee.core;bundle-version="1.2.100",
- org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.200",
- org.jboss.ide.eclipse.as.wtp.core;bundle-version="2.3.0",
- org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
- org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
- org.jboss.ide.eclipse.as.management.core;bundle-version="1.0.0",
- org.jboss.ide.eclipse.as.dmr;bundle-version="2.3.0",
- org.eclipse.ui.browser;bundle-version="3.3.101"
-Bundle-ActivationPolicy: lazy
-Export-Package: org.jboss.ide.eclipse.as.ui,
- org.jboss.ide.eclipse.as.ui.actions,
- org.jboss.ide.eclipse.as.ui.console,
- org.jboss.ide.eclipse.as.ui.dialogs,
- org.jboss.ide.eclipse.as.ui.editor,
- org.jboss.ide.eclipse.as.ui.launch,
- org.jboss.ide.eclipse.as.ui.preferences,
- org.jboss.ide.eclipse.as.ui.views,
- org.jboss.ide.eclipse.as.ui.views.as7.management.content,
- org.jboss.ide.eclipse.as.ui.views.server.extensions,
- org.jboss.ide.eclipse.as.ui.wizards,
- org.jboss.tools.as.wst.server.ui.xpl
-Bundle-Activator: org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin
-Bundle-Vendor: %Bundle-Vendor.0
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.ui;singleton:=true
+Bundle-Version: 2.4.0.qualifier
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.eclipse.jface.text;bundle-version="3.7.0",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
+ org.eclipse.ui.editors;bundle-version="3.7.0",
+ org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.filebuffers;bundle-version="3.5.200",
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.eclipse.core.expressions;bundle-version="3.4.200",
+ org.eclipse.jdt.core;bundle-version="3.7.0",
+ org.eclipse.debug.ui;bundle-version="3.7.0",
+ org.eclipse.jdt.debug;bundle-version="3.7.0",
+ org.eclipse.jdt.launching;bundle-version="3.6.0",
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
+ org.eclipse.ui.console;bundle-version="3.5.100",
+ org.eclipse.jdt.core.manipulation;bundle-version="1.3.0",
+ org.eclipse.search;bundle-version="3.6.100",
+ org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.eclipse.jface;bundle-version="3.7.0",
+ com.ibm.icu;bundle-version="4.2.1",
+ org.eclipse.jst.server.ui;bundle-version="1.1.201",
+ org.eclipse.wst.server.core;bundle-version="1.1.302",
+ org.eclipse.wst.server.ui;bundle-version="1.1.305",
+ org.eclipse.wst.server.ui.doc.user;bundle-version="1.1.300",
+ org.eclipse.jdt.debug.ui;bundle-version="3.6.0",
+ org.eclipse.text;bundle-version="3.5.100",
+ org.eclipse.debug.core;bundle-version="3.7.0",
+ org.eclipse.ui.views;bundle-version="3.6.0",
+ org.eclipse.wst.xml.ui;bundle-version="1.1.200",
+ org.eclipse.wst.sse.ui;bundle-version="1.3.0",
+ org.eclipse.wst.sse.core;bundle-version="1.1.600",
+ org.eclipse.wst.xml.core;bundle-version="1.1.600",
+ org.eclipse.core.filesystem;bundle-version="1.3.100",
+ org.eclipse.jst.server.core;bundle-version="1.2.101",
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
+ org.eclipse.jst.servlet.ui;bundle-version="1.1.500",
+ org.eclipse.jst.j2ee;bundle-version="1.1.500",
+ org.eclipse.jst.j2ee.ui;bundle-version="1.1.500",
+ org.eclipse.wst.web.ui;bundle-version="1.1.400",
+ org.eclipse.wst.common.frameworks.ui;bundle-version="1.2.0",
+ org.eclipse.jem.util;bundle-version="2.1.2",
+ org.apache.ant;bundle-version="1.7.1",
+ org.jboss.ide.eclipse.as.core,
+ org.eclipse.ui.navigator;bundle-version="3.5.0",
+ org.eclipse.ui.views.log;bundle-version="1.0.200",
+ org.eclipse.jst.j2ee.core;bundle-version="1.2.100",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.200",
+ org.jboss.ide.eclipse.as.wtp.core;bundle-version="2.3.0",
+ org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
+ org.jboss.ide.eclipse.as.management.core;bundle-version="1.0.0",
+ org.jboss.ide.eclipse.as.dmr;bundle-version="2.3.0",
+ org.eclipse.ui.browser;bundle-version="3.3.101",
+ org.jboss.tools.runtime.core;bundle-version="2.0.0",
+ org.jboss.tools.runtime.ui;bundle-version="2.0.0"
+Bundle-ActivationPolicy: lazy
+Export-Package: org.jboss.ide.eclipse.as.ui,
+ org.jboss.ide.eclipse.as.ui.actions,
+ org.jboss.ide.eclipse.as.ui.console,
+ org.jboss.ide.eclipse.as.ui.dialogs,
+ org.jboss.ide.eclipse.as.ui.editor,
+ org.jboss.ide.eclipse.as.ui.launch,
+ org.jboss.ide.eclipse.as.ui.preferences,
+ org.jboss.ide.eclipse.as.ui.views,
+ org.jboss.ide.eclipse.as.ui.views.as7.management.content,
+ org.jboss.ide.eclipse.as.ui.views.server.extensions,
+ org.jboss.ide.eclipse.as.ui.wizards,
+ org.jboss.tools.as.wst.server.ui.xpl
+Bundle-Activator: org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6

Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossASDownloadRuntimeFilter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossASDownloadRuntimeFilter.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossASDownloadRuntimeFilter.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -0,0 +1,23 @@
+package org.jboss.ide.eclipse.as.ui.wizards;
+
+import java.util.Arrays;
+
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.jboss.ide.eclipse.as.core.runtime.DownloadRuntimeToWTPRuntime;
+import org.jboss.tools.runtime.core.model.DownloadRuntime;
+import org.jboss.tools.runtime.core.model.IDownloadRuntimeFilter;
+
+public class JBossASDownloadRuntimeFilter implements IDownloadRuntimeFilter {
+	private IRuntimeType runtimeType;
+	public JBossASDownloadRuntimeFilter(IRuntimeType rtType) {
+		this.runtimeType = rtType;
+	}
+	public boolean accepts(DownloadRuntime runtime) {
+		DownloadRuntime[] all = DownloadRuntimeToWTPRuntime.getDownloadRuntimes(runtimeType);
+		return Arrays.asList(all).contains(runtime);
+	}
+	public DownloadRuntime[] filter(DownloadRuntime[] runtimes) {
+		return DownloadRuntimeToWTPRuntime.getDownloadRuntimes(runtimeType, runtimes);
+	}
+
+}

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	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java	2012-09-13 07:52:48 UTC (rev 43635)
@@ -12,19 +12,15 @@
 
 import java.io.File;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 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.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.jdt.launching.IVMInstall;
@@ -42,8 +38,6 @@
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.BusyIndicator;
@@ -63,7 +57,6 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
@@ -76,8 +69,6 @@
 import org.eclipse.wst.server.core.TaskModel;
 import org.eclipse.wst.server.core.internal.IInstallableRuntime;
 import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.LicenseWizardFragment;
 import org.eclipse.wst.server.ui.wizard.IWizardHandle;
 import org.eclipse.wst.server.ui.wizard.WizardFragment;
 import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
@@ -92,6 +83,9 @@
 import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
 import org.jboss.ide.eclipse.as.ui.Messages;
 import org.jboss.ide.eclipse.as.ui.UIUtil;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.IDownloadRuntimes;
+import org.jboss.tools.runtime.ui.download.DownloadRuntimes;
 import org.osgi.service.prefs.BackingStoreException;
 
 /**
@@ -348,8 +342,7 @@
 		downloadAndInstallButton = new Button(homeDirComposite, SWT.NONE);
 		downloadAndInstallButton.setText(Messages.rwf_DownloadRuntime);
 		downloadAndInstallButton.addSelectionListener(new DownloadAndInstallListener());
-		final IInstallableRuntime ir = ServerPlugin.findInstallableRuntime(getRuntimeType().getId());
-		downloadAndInstallButton.setEnabled(ir != null);
+		downloadAndInstallButton.setEnabled(true); 
 		
 		// Add listeners
 		homeDirText.addModifyListener(new ModifyListener() {
@@ -379,70 +372,14 @@
 
 	protected class DownloadAndInstallListener extends SelectionAdapter {
 		public void widgetSelected(SelectionEvent se) {
-			downloadAndInstallButton.setEnabled(false);
-			String license = null;
-			final IInstallableRuntime ir = ServerPlugin.findInstallableRuntime(getRuntimeType().getId());
-			
-			try {
-				license = ir.getLicense(new NullProgressMonitor());
-			} catch (CoreException e) {
+			IDownloadRuntimes downloader = RuntimeCoreActivator.getDefault().getDownloader();
+			if( downloader != null ) {
+				HashMap<String, Object> data = new HashMap<String, Object>();
+				data.put(DownloadRuntimes.SHELL, downloadAndInstallButton.getShell() );
+				IRuntimeType type = getRuntimeType();
+				data.put(IDownloadRuntimes.RUNTIME_FILTER, new JBossASDownloadRuntimeFilter(type));
+				downloader.execute(data);
 			}
-			TaskModel taskModel = new TaskModel();
-			taskModel.putObject(LicenseWizardFragment.LICENSE, license);
-			TaskWizard wizard2 = new TaskWizard(Messages.rwf_DownloadAndInstallRuntimeWizard, new WizardFragment() {
-				protected void createChildFragments(List list) {
-					list.add(new LicenseWizardFragment());
-				}
-			}, taskModel);
-			
-			WizardDialog dialog2 = new WizardDialog(downloadAndInstallButton.getShell(), wizard2);
-			if (dialog2.open() == Window.CANCEL) {
-				downloadAndInstallButton.setEnabled(true);
-				return;
-			}
-			DirectoryDialog dialog = new DirectoryDialog(downloadAndInstallButton.getShell());
-			dialog.setMessage(Messages.rwf_DownloadServerFileChooser);
-			dialog.setFilterPath(homeDirText.getText());
-			String selectedDirectory = dialog.open();
-			if (selectedDirectory != null) {
-//				ir.install(new Path(selectedDirectory));
-				final IPath installPath = new Path(selectedDirectory);
-				final Job installRuntimeJob = new Job(
-						NLS.bind(Messages.rwf_InstallingRuntimeJob, getRuntimeType().getName())) {
-					public boolean belongsTo(Object family) {
-						return ServerPlugin.PLUGIN_ID.equals(family);
-					}
-					
-					protected IStatus run(IProgressMonitor monitor) {
-						try {
-							ir.install(installPath, monitor);
-						} catch (CoreException ce) {
-							return ce.getStatus();
-						}
-						
-						return Status.OK_STATUS;
-					}
-				};
-				
-				homeDirText.setText(selectedDirectory);
-				JobChangeAdapter jobListener = new JobChangeAdapter() {
-					public void done(IJobChangeEvent event) {
-						installRuntimeJob.removeJobChangeListener(this);
-						Display.getDefault().asyncExec(new Runnable() {
-							public void run() {
-								if( !downloadAndInstallButton.isDisposed())
-									downloadAndInstallButton.setEnabled(true);
-							}
-				        });
-					}
-				};
-				installRuntimeJob.addJobChangeListener(jobListener);
-				installRuntimeJob.schedule();
-				handle.setMessage(Messages.rwf_DownloadingMayTakeLongTime, IMessageProvider.WARNING);
-				MessageDialog.openWarning(downloadAndInstallButton.getShell(), Messages.rwf_InstallingASTitle, 
-						NLS.bind(Messages.rwf_DownloadingMayTakeLongTime, selectedDirectory));
-				((TitleAreaDialog)((IWizardPage)handle).getWizard().getContainer()).close();
-			}
 		}
 	}
 	

Modified: trunk/as/plugins/pom.xml
===================================================================
--- trunk/as/plugins/pom.xml	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/plugins/pom.xml	2012-09-13 07:52:48 UTC (rev 43635)
@@ -26,7 +26,6 @@
 		<module>org.jboss.ide.eclipse.as.jmx.integration</module>
 		<module>org.jboss.ide.eclipse.as.management.core</module>
 		<module>org.jboss.ide.eclipse.as.management.as71</module>
-		<module>org.jboss.tools.runtime.as.detector</module>
 	</modules>
 </project>
 	

Modified: trunk/as/site/category.xml
===================================================================
--- trunk/as/site/category.xml	2012-09-13 05:32:15 UTC (rev 43634)
+++ trunk/as/site/category.xml	2012-09-13 07:52:48 UTC (rev 43635)
@@ -12,13 +12,6 @@
 		<category name="JBoss Tools as Nightly Build Update Site" />
 	</feature>
 
-	<feature url="features/org.jboss.tools.runtime.as.detector.feature_0.0.0.jar" id="org.jboss.tools.runtime.as.detector.feature" version="0.0.0">
-		<category name="JBoss Tools as Nightly Build Update Site" />
-	</feature>
-	<feature url="features/org.jboss.tools.runtime.as.detector.feature.source_0.0.0.jar" id="org.jboss.tools.runtime.as.detector.feature.source" version="0.0.0">
-		<category name="JBoss Tools as Nightly Build Update Site" />
-	</feature>
-
 	<feature url="features/org.jboss.ide.eclipse.as.test.feature_0.0.0.jar" id="org.jboss.ide.eclipse.as.test.feature" version="0.0.0">
 		<category name="JBoss Tools as Nightly Build Update Site" />
 	</feature>



More information about the jbosstools-commits mailing list