### Eclipse Workspace Patch 1.0
#P org.jboss.tools.runtime
Index: icons/jboss.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
--- .settings/org.eclipse.jdt.core.prefs	(revision 24586)
+++ .settings/org.eclipse.jdt.core.prefs	(working copy)
@@ -1,7 +1,8 @@
-#Thu Dec 04 23:27:23 CET 2008
+#Thu Dec 02 21:41:17 CET 2010
 eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Index: src/org/jboss/tools/runtime/preferences/RuntimeDialog.java
===================================================================
--- src/org/jboss/tools/runtime/preferences/RuntimeDialog.java	(revision 26765)
+++ src/org/jboss/tools/runtime/preferences/RuntimeDialog.java	(working copy)
@@ -1,154 +0,0 @@
-package org.jboss.tools.runtime.preferences;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.jboss.tools.runtime.ServerDefinition;
-
-public class RuntimeDialog extends Dialog {
-	
-	private List<ServerDefinition> serverDefinitions;
-	private String path;
-	private CheckboxTableViewer tableViewer;
-
-	public RuntimeDialog(Shell parentShell, List<ServerDefinition> serverDefinitions , String path) {
-		super(parentShell);
-		setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
-				| SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
-		this.serverDefinitions = serverDefinitions;
-		this.path = path;
-		
-	}
-
-	@Override
-	protected Control createDialogArea(Composite parent) {
-		Composite area = (Composite) super.createDialogArea(parent);
-		Composite contents = new Composite(area, SWT.NONE);
-		GridData gd = new GridData(GridData.FILL_BOTH);
-		gd.heightHint = 400;
-		gd.widthHint = 700;
-		contents.setLayoutData(gd);
-		contents.setLayout(new GridLayout());
-		getShell().setText("JBoss Runtimes");
-		applyDialogFont(contents);
-		initializeDialogUnits(area);
-
-		Label label = new Label(contents, SWT.NULL);
-		String runtime = (serverDefinitions.size() == 1) ? "runtime" : "runtimes";
-		label.setText("The search found " + serverDefinitions.size() + " " + runtime + " while searching " + path + ".");
-		tableViewer = CheckboxTableViewer.newCheckList(contents, SWT.V_SCROLL
-				| SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
-		Table table = tableViewer.getTable();
-		gd = new GridData(GridData.FILL_BOTH);
-		gd.heightHint = 100;
-		table.setLayoutData(gd);
-		table.setHeaderVisible(true);
-		table.setLinesVisible(true);
-
-		String[] columnNames = new String[] { "Name", "Version", "Type", "Location", "Description"};
-		int[] columnWidths = new int[] { 140, 50, 50, 245, 200};
-		
-		for (int i = 0; i < columnNames.length; i++) {
-			TableColumn tc = new TableColumn(table, SWT.LEFT);
-			tc.setText(columnNames[i]);
-			tc.setWidth(columnWidths[i]);
-		}
-
-		tableViewer.setLabelProvider(new RuntimeLabelProvider());
-		tableViewer.setContentProvider(new RuntimeContentProvider(serverDefinitions));
-		tableViewer.setInput(serverDefinitions);
-		for (ServerDefinition definition:serverDefinitions) {
-			tableViewer.setChecked(definition, definition.isEnabled());
-		}
-		tableViewer.addCheckStateListener(new ICheckStateListener() {
-			
-			public void checkStateChanged(CheckStateChangedEvent event) {
-				ServerDefinition definition = (ServerDefinition) event.getElement();
-				definition.setEnabled(!definition.isEnabled());
-				boolean enableOk = false;
-				for (ServerDefinition serverDefinition:serverDefinitions) {
-					if (serverDefinition.isEnabled()) {
-						enableOk = true;
-					}
-				}
-				getButton(IDialogConstants.OK_ID).setEnabled(enableOk);
-			}
-		});
-		return area;
-	}
-	
-	private class RuntimeLabelProvider extends LabelProvider implements
-			ITableLabelProvider {
-
-		public Image getColumnImage(Object element, int columnIndex) {
-			return null;
-		}
-
-		public String getColumnText(Object element, int columnIndex) {
-			if (element instanceof ServerDefinition) {
-				ServerDefinition definition = (ServerDefinition) element;
-				if (columnIndex == 0) {
-					return definition.getName();
-				}
-				if (columnIndex == 1) {
-					return definition.getVersion();
-				}
-				if (columnIndex == 2) {
-					return definition.getType();
-				}
-				if (columnIndex == 3) {
-					File location = definition.getLocation();
-					if (location != null) {
-						return definition.getLocation().getAbsolutePath();
-					}
-				}
-				if (columnIndex == 4) {
-					return definition.getDescription();
-				}
-			}
-			return null;
-		}
-	}
-	
-	private class RuntimeContentProvider implements IStructuredContentProvider {
-
-		private List<ServerDefinition> serverDefinitions;
-
-		public RuntimeContentProvider(List<ServerDefinition> serverDefinitions) {
-			this.serverDefinitions = serverDefinitions;
-		}
-		
-		public Object[] getElements(Object inputElement) {
-			return serverDefinitions.toArray();
-		}
-
-		public void dispose() {
-			
-		}
-
-		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-			serverDefinitions = (List<ServerDefinition>) newInput;
-		}
-		
-	}
-
-}
Index: about.mappings
===================================================================
--- about.mappings	(revision 0)
+++ about.mappings	(revision 0)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Index: src/org/jboss/tools/runtime/JBossRuntimeLocator.java
===================================================================
--- src/org/jboss/tools/runtime/JBossRuntimeLocator.java	(revision 26765)
+++ src/org/jboss/tools/runtime/JBossRuntimeLocator.java	(working copy)
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * 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.tools.runtime;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-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;
-
-public class JBossRuntimeLocator implements IJBossRuntimePluginConstants {
-
-	public static final String JBPM3 = "jBPM3";
-	
-	public static final String JBPM4 = "jBPM4";
-	private final static String seamJarName = "jboss-seam.jar";
-	private final static String seamVersionAttributeName = "Seam-Version";
-
-	public JBossRuntimeLocator() {
-	}
-	
-	public List<ServerDefinition> searchForRuntimes(String path, IProgressMonitor monitor) {
-		return searchForRuntimes(new Path(path), monitor);
-	}
-
-	public List<ServerDefinition> searchForRuntimes(IPath path, IProgressMonitor monitor) {
-		ServerBeanLoader loader = new ServerBeanLoader();
-		List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
-		return searchForRuntimes(serverDefinitions, path, loader, 4, monitor);
-	}
-	
-	private List<ServerDefinition> searchForRuntimes(List<ServerDefinition> serverDefinitions, IPath path, ServerBeanLoader loader, int depth, IProgressMonitor monitor) {
-		if (monitor.isCanceled()) {
-			return serverDefinitions;
-		}
-		File[] children = null;
-		if (path != null) {
-			monitor.setTaskName("Searching " + path.toOSString());
-		}
-		if (path != null) {
-			File root = path.toFile();
-			ServerBean serverBean = loader.loadFromLocation(root);
-			
-			if (!JBossServerType.UNKNOWN.equals(serverBean.getType())) {
-				serverDefinitions.add(new ServerDefinition(serverBean));
-				if (monitor.isCanceled()) {
-					return serverDefinitions;
-				}
-			} else {
-				String seamVersion = getSeamVersionFromManifest(root.getAbsolutePath());
-				if (seamVersion != null) {
-					serverDefinitions.add(new ServerDefinition(root.getName(), seamVersion, SEAM, root.getAbsoluteFile()));
-					if (monitor.isCanceled()) {
-						return serverDefinitions;
-					}
-				} else {
-					String[] files = root.list(new FilenameFilter() {
-						
-						public boolean accept(File dir, String name) {
-							if (name.startsWith("drools-api") && name.endsWith(".jar") ) {
-								return true;
-							}
-							return false;
-						}
-					});
-					boolean droolsFound = false;
-					if (files != null && files.length > 0) {
-						String version = getImplementationVersion(root,files[0]);
-						if (version != null) {
-							version = version.substring(0,3);
-							serverDefinitions.add(new ServerDefinition(root.getName(), version, DROOLS, root.getAbsoluteFile()));
-							droolsFound = true;
-						}
-					}
-					if (monitor.isCanceled()) {
-						return serverDefinitions;
-					}
-					boolean jbpmFound = false;
-					if (!droolsFound) {
-						boolean isJBPM = isValidJbpmInstallation(root.getAbsolutePath());
-						if (isJBPM) {
-							String version = "unknown";
-							if (isJbpm3(root.getAbsolutePath())) {
-								version = JBPM3;
-							} else if (isJbpm4(root.getAbsolutePath())) {
-								version = JBPM4;
-							}
-							serverDefinitions.add(new ServerDefinition(root.getName(), version, JBPM, root.getAbsoluteFile()));
-							jbpmFound = true;
-						}
-					}
-					if (monitor.isCanceled()) {
-						return serverDefinitions;
-					}
-					if (!droolsFound && !jbpmFound) {
-						children = root.listFiles();
-					}
-				}
-				
-			}
-		} else {
-			children = File.listRoots();
-		}
-		if (monitor.isCanceled()) {
-			return serverDefinitions;
-		}
-		if (depth == 0) {
-			return serverDefinitions; 
-		}
-		if( children != null ) {
-			for( int i = 0; i < children.length; i++ ) {
-				if( children[i].isDirectory()) {
-					searchForRuntimes(serverDefinitions, new Path(children[i].getAbsolutePath()), loader, --depth, monitor);
-				}
-			}
-		}
-		return serverDefinitions;
-	}
-
-	/**
-	 * @param dir 
-	 * @param string
-	 * @return
-	 */
-	private String getImplementationVersion(File dir, String file) {
-		File jarFile = new File(dir, file);
-		if(!jarFile.isFile()) {
-			return null;
-		}
-		try {
-			JarFile jar = new JarFile(jarFile);
-			Attributes attributes = jar.getManifest().getMainAttributes();
-			String version = attributes.getValue("Implementation-Version");
-			return version;
-		} catch (IOException e) {
-			return null;
-		}
-	}	
-
-	public static String getSeamVersionFromManifest(String seamHome) {
-		File seamHomeFolder = new File(seamHome);
-		if (seamHomeFolder == null || !seamHomeFolder.isDirectory()) {
-			return null;
-		}
-		String[] seamFiles = seamHomeFolder.list(new FilenameFilter() {
-			
-			public boolean accept(File dir, String name) {
-				if ("seam-gen".equals(name)) {
-					return true;
-				}
-				if ("examples".equals(name)) {
-					return true;
-				}
-				return false;
-			}
-		});
-		if (seamFiles == null || seamFiles.length != 2) {
-			return null;
-		}
-		File jarFile = new File(seamHome, "lib/" + seamJarName);
-		if(!jarFile.isFile()) {
-			jarFile = new File(seamHome, seamJarName);
-			if(!jarFile.isFile()) {
-				return null;
-			}
-		}
-		try {
-			JarFile jar = new JarFile(jarFile);
-			Attributes attributes = jar.getManifest().getMainAttributes();
-			String version = attributes.getValue(seamVersionAttributeName);
-			return version;
-		} catch (IOException e) {
-			return null;
-		}
-	}
-	
-	public static boolean isJbpm3(String location) {
-		return new Path(location).append("/src/resources/gpd/version.info.xml").toFile().exists();
-	}
-	
-	public static boolean isJbpm4(String location) {
-		return new Path(location).append("/jbpm.jar").toFile().exists();
-	}
-	
-	private boolean isValidJbpmInstallation(String location) {
-		return isJbpm3(location) || isJbpm4(location);
-	}
-}
Index: plugin.properties
===================================================================
--- plugin.properties	(revision 25940)
+++ plugin.properties	(working copy)
@@ -1,5 +1,3 @@
 #Properties file for org.jboss.tools.runtime
 BundleVendor = JBoss by Red Hat
-BundleName = JBoss Runtime Initializer
-JBoss_Runtimes = JBoss Runtimes
-ImportExportJBossRuntimes = Import / Export JBoss Runtimes
\ No newline at end of file
+BundleName = JBoss Runtime Initializer
\ No newline at end of file
Index: src/org/jboss/tools/runtime/handlers/JbpmHandler.java
===================================================================
--- src/org/jboss/tools/runtime/handlers/JbpmHandler.java	(revision 26765)
+++ src/org/jboss/tools/runtime/handlers/JbpmHandler.java	(working copy)
@@ -10,25 +10,25 @@
  ************************************************************************************/
 package org.jboss.tools.runtime.handlers;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.wst.server.core.internal.IMemento;
-import org.eclipse.wst.server.core.internal.XMLMemento;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
 import org.jboss.tools.jbpm.preferences.JbpmInstallation;
 import org.jboss.tools.jbpm.preferences.PreferencesManager;
-import org.jboss.tools.runtime.Activator;
 import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeLocator;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
 
-public class JbpmHandler implements IJBossRuntimePersistanceHandler,IJBossRuntimePluginConstants {
+public class JbpmHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+	
+	private static final String JBPM3 = "jBPM3";
+	
+	private static final String JBPM4 = "jBPM4";
+	
 	public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
 		for (ServerDefinition serverDefinition : serverDefinitions) {
 			if (!jbpmExists(serverDefinition)) {
@@ -36,9 +36,9 @@
 				if (SOA_P.equals(type)) {
 					File jbpmRoot = new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
 					if (jbpmRoot.isDirectory()) {
-						String version = JBossRuntimeLocator.JBPM3;
-						if (JBossRuntimeLocator.isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
-							version = JBossRuntimeLocator.JBPM4;
+						String version = JBPM3;
+						if (isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
+							version = JBPM4;
 						}
 						PreferencesManager.getInstance().initializeDefaultJbpmInstallation(serverDefinition.getName(), jbpmRoot.getAbsolutePath(), version);
 					}
@@ -65,74 +65,55 @@
 		}
 		return false;
 	}
-	
-	/**
-	 * @param jbpms
-	 */
-	public static void loadJBPMInstalations(String jbpms) {
-		InputStream in = null;
-		try {
-			in = new ByteArrayInputStream(jbpms.getBytes("UTF-8"));
-			IMemento memento = XMLMemento.loadMemento(in);
-			IMemento[] children = memento.getChildren("installation");
-			for (int i = 0; i < children.length; i++) {
-				JbpmInstallation installation = new JbpmInstallation();
-				installation.name = children[i].getString("name");
-				installation.location = children[i].getString("location");
-				installation.version = children[i].getString("version");
-				PreferencesManager.getInstance().getJbpmInstallationMap()
-						.put(installation.name, installation);
-			}
-		} catch (Exception e) {
-			Activator.log(e);
-		} finally {
-			try {
-				if (in != null) {
-					in.close();
-				}
-			} catch (IOException e) {
-			}
-		}
-	}
 
-	public static void exportJbpms() {
-		File file = org.jboss.tools.jbpm.Activator.getDefault().getStateLocation().append("jbpm-installations.xml").toFile();
-		if (!file.exists()) {
-			Activator.getDefault().getPreferenceStore().setValue(Activator.JBPMS, "");
-			return;
+	public ServerDefinition getServerDefinition(File root,
+			IProgressMonitor monitor) {
+		if (monitor.isCanceled() || root == null) {
+			return null;
 		}
-		try {
-			XMLMemento memento = (XMLMemento) XMLMemento.loadMemento(file.getAbsolutePath());
-			String xmlString = memento.saveToString();
-			Activator.getDefault().getPreferenceStore().setValue(Activator.JBPMS, xmlString);
-			Activator.getDefault().savePluginPreferences();
-		} catch (Exception e) {
-			Activator.log (e);
+		boolean isJBPM = isValidJbpmInstallation(root.getAbsolutePath());
+		if (isJBPM) {
+			String version = "unknown";
+			if (isJbpm3(root.getAbsolutePath())) {
+				version = JBPM3;
+			} else if (isJbpm4(root.getAbsolutePath())) {
+				version = JBPM4;
+			}
+			return new ServerDefinition(root.getName(), version, JBPM, root.getAbsoluteFile());
 		}
+		return null;
 	}
-
-	public static String includeJbpm(ServerDefinition serverDefinition) {
+	
+	public static boolean isJbpm3(String location) {
+		return new Path(location).append("/src/resources/gpd/version.info.xml").toFile().exists();
+	}
+	
+	public static boolean isJbpm4(String location) {
+		return new Path(location).append("/jbpm.jar").toFile().exists();
+	}
+	
+	private boolean isValidJbpmInstallation(String location) {
+		return isJbpm3(location) || isJbpm4(location);
+	}
+	
+	public static String included(ServerDefinition serverDefinition) {
 		StringBuilder builder = new StringBuilder();
 		File jbpmRoot = new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
 		if (jbpmRoot.isDirectory()) {
-			String version = JBossRuntimeLocator.JBPM3;
-			if (JBossRuntimeLocator.isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
-				version = JBossRuntimeLocator.JBPM4;
+			String version = JBPM3;
+			if (isJbpm4(serverDefinition.getLocation().getAbsolutePath())) {
+				version = JBPM4;
 			}
 			builder.append(version);
 		}
 		return builder.toString();
 	}
-	
-	public void importRuntimes() {
-		String jbpms = Activator.getDefault().getPreferenceStore().getString(Activator.JBPMS);
-		if (jbpms != null && jbpms.trim().length() > 0) {
-			JbpmHandler.loadJBPMInstalations(jbpms);
+
+	@Override
+	public boolean exists(ServerDefinition serverDefinition) {
+		if (serverDefinition == null || serverDefinition.getLocation() == null) {
+			return false;
 		}
+		return jbpmExists(serverDefinition);
 	}
-
-	public void exportRuntimes() {
-		JbpmHandler.exportJbpms();
-	}
-
 }
Index: src/org/jboss/tools/runtime/ServerDefinition.java
===================================================================
--- src/org/jboss/tools/runtime/ServerDefinition.java	(revision 26765)
+++ src/org/jboss/tools/runtime/ServerDefinition.java	(working copy)
@@ -1,180 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2009 JBoss by Red Hat and others.
- * All rights reserved. This program and the accompanying materials 
- * are 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:
- *     JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.runtime;
-
-import java.io.File;
-
-import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
-import org.jboss.tools.runtime.handlers.DroolsHandler;
-import org.jboss.tools.runtime.handlers.JbpmHandler;
-import org.jboss.tools.runtime.handlers.SeamHandler;
-
-import static org.jboss.tools.runtime.IJBossRuntimePluginConstants.*;
-
-/**
- * @author Snjeza
- *
- */
-public class ServerDefinition {
-
-	private String name;
-	private String version;
-	private String type;
-	private String description;
-	private File location;
-	private boolean enabled = true;
-	
-	public ServerDefinition(String name, String version, String type,
-			File location) {
-		super();
-		this.name = name;
-		this.version = version;
-		this.type = type;
-		this.location = location;
-		this.description = null;
-	}
-	
-	/**
-	 * @param serverBean
-	 */
-	public ServerDefinition(ServerBean serverBean) {
-		this.name = serverBean.getName();
-		this.version = serverBean.getVersion();
-		this.type = serverBean.getType().getId();
-		this.location = new File(serverBean.getLocation());
-	}
-
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public String getVersion() {
-		return version;
-	}
-	public void setVersion(String version) {
-		this.version = version;
-	}
-	
-	public String getType() {
-		return type;
-	}
-	
-	public void setType(String type) {
-		this.type = type;
-		this.description = "";
-	}
-	
-	public File getLocation() {
-		return location;
-	}
-	
-	public void setLocation(File location) {
-		this.location = location;
-		this.description = "";
-	}
-
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result
-				+ ((location == null) ? 0 : location.hashCode());
-		result = prime * result + ((name == null) ? 0 : name.hashCode());
-		result = prime * result + ((type == null) ? 0 : type.hashCode());
-		result = prime * result + ((version == null) ? 0 : version.hashCode());
-		return result;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		ServerDefinition other = (ServerDefinition) obj;
-		if (location == null) {
-			if (other.location != null)
-				return false;
-		} else if (!location.equals(other.location))
-			return false;
-		if (name == null) {
-			if (other.name != null)
-				return false;
-		} else if (!name.equals(other.name))
-			return false;
-		if (type == null) {
-			if (other.type != null)
-				return false;
-		} else if (!type.equals(other.type))
-			return false;
-		if (version == null) {
-			if (other.version != null)
-				return false;
-		} else if (!version.equals(other.version))
-			return false;
-		return true;
-	}
-
-	@Override
-	public String toString() {
-		return "ServerDefinition [name=" + name + ", version=" + version
-				+ ", type=" + type + ", location=" + location + "]";
-	}
-
-	public boolean isEnabled() {
-		return enabled;
-	}
-
-	public void setEnabled(boolean enabled) {
-		this.enabled = enabled;
-	}
-
-	public String getDescription() {
-		if (type == null || location == null) {
-			return "";
-		}
-		if (description == null || description.length() == 0) {
-			StringBuilder builder = new StringBuilder();
-			if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
-				String includeSeam = SeamHandler.includeSeam(this);
-				append(builder, includeSeam);
-			}
-			if (SOA_P.equals(type)) {
-				String includeDrools = DroolsHandler.includeDrools(this);
-				append(builder, includeDrools);
-				String includeJbpm = JbpmHandler.includeJbpm(this);
-				append(builder, includeJbpm);
-			}
-			description = builder.toString();
-		}
-		return description;
-	}
-
-	private void append(StringBuilder builder, String string) {
-		if (string != null && string.length() > 0) {
-			if (builder.toString().length() == 0) {
-				builder.append("Includes ");
-			} else {
-				builder.append(", ");
-			}
-			builder.append(string);
-		}
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
-	
-}
Index: src/org/jboss/tools/runtime/handlers/DroolsHandler.java
===================================================================
--- src/org/jboss/tools/runtime/handlers/DroolsHandler.java	(revision 26765)
+++ src/org/jboss/tools/runtime/handlers/DroolsHandler.java	(working copy)
@@ -11,16 +11,18 @@
 package org.jboss.tools.runtime.handlers;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.drools.eclipse.util.DroolsRuntime;
 import org.drools.eclipse.util.DroolsRuntimeManager;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
 
-public class DroolsHandler implements IJBossRuntimePersistanceHandler,IJBossRuntimePluginConstants {
+public class DroolsHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
 
 	public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
 		List<DroolsRuntime> droolsRuntimes = new ArrayList<DroolsRuntime>();
@@ -66,7 +68,31 @@
 		return false;
 	}
 
-	public static String includeDrools(ServerDefinition serverDefinition) {
+	public ServerDefinition getServerDefinition(File root,
+			IProgressMonitor monitor) {
+		if (monitor.isCanceled() || root == null) {
+			return null;
+		}
+		String[] files = root.list(new FilenameFilter() {
+			
+			public boolean accept(File dir, String name) {
+				if (name.startsWith("drools-api") && name.endsWith(".jar") ) {
+					return true;
+				}
+				return false;
+			}
+		});
+		if (files != null && files.length > 0) {
+			String version = getImplementationVersion(root,files[0]);
+			if (version != null) {
+				version = version.substring(0,3);
+				return new ServerDefinition(root.getName(), version, DROOLS, root.getAbsoluteFile());
+			}
+		}
+		return null;
+	}
+	
+	public static String included(ServerDefinition serverDefinition) {
 		StringBuilder builder = new StringBuilder();
 		File droolsRoot = serverDefinition.getLocation(); //$NON-NLS-1$
 		if (droolsRoot.isDirectory()) {
@@ -78,14 +104,12 @@
 		}
 		return builder.toString();
 	}
-	public void importRuntimes() {
-		// TODO Auto-generated method stub
-		
-	}
 
-	public void exportRuntimes() {
-		// TODO Auto-generated method stub
-		
+	@Override
+	public boolean exists(ServerDefinition serverDefinition) {
+		if (serverDefinition == null || serverDefinition.getLocation() == null) {
+			return false;
+		}
+		return droolsExists(serverDefinition);
 	}
-
 }
Index: about.properties
===================================================================
--- about.properties	(revision 0)
+++ about.properties	(revision 0)
@@ -0,0 +1,2 @@
+blurb=JBoss Runtime Initializer\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss by Red Hat, contributors and others 2004 - 2010.  All rights reserved.\nVisit http\://jboss.org/tools
+
Index: about.ini
===================================================================
--- about.ini	(revision 0)
+++ about.ini	(revision 0)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which the
+# welcome page is to be opened.
+# optional
+
+
+
Index: src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
===================================================================
--- src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java	(revision 27012)
+++ src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java	(working copy)
@@ -1,299 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2009 JBoss by Red Hat and others.
- * All rights reserved. This program and the accompanying materials 
- * are 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:
- *     JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.runtime.preferences;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.layout.PixelConverter;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.internal.wizards.preferences.PreferencesExportWizard;
-import org.eclipse.ui.internal.wizards.preferences.PreferencesImportWizard;
-import org.jboss.tools.runtime.Activator;
-import org.jboss.tools.runtime.JBossRuntimeLocator;
-import org.jboss.tools.runtime.JBossRuntimeStartup;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
-
-/**
- * @author Snjeza
- * 
- */
-public class RuntimePreferencePage extends PreferencePage implements
-		IWorkbenchPreferencePage {
-
-	public static String ID = "org.jboss.tools.runtime.preferences.RuntimePreferencePage";
-	private static final String LASTPATH = "lastPath";
-	public static final String SEAM_PREFERENCES_ID = "org.jboss.tools.common.model.ui.seam"; //$NON-NLS-1$
-	public static final String WTP_PREFERENCES_ID = "org.eclipse.wst.server.ui.runtime.preferencePage"; //$NON-NLS-1$
-	private static final String DROOLS_PREFERENCES_ID = "org.drools.eclipse.preferences.DroolsRuntimesPreferencePage";
-	private static final String JBPM_PREFERENCES_ID = "org.jboss.tools.jbpm.locations";
-	
-	protected Map<String, Object> map = new HashMap<String, Object>();
-
-	private List<ServerDefinition> serverDefinitions;
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
-	 * .swt.widgets.Composite)
-	 */
-	@Override
-	protected Control createContents(Composite parent) {
-		noDefaultAndApplyButton();
-		initializeDialogUnits(parent);
-		
-		Composite composite = new Composite(parent, SWT.NONE);
-		GridLayout layout = new GridLayout(1, false);
-		
-		composite.setLayout(layout);
-		
-		createLink(composite, "See <a>WTP Runtimes</a>", WTP_PREFERENCES_ID);
-		createLink(composite, "See <a>Seam Runtimes</a>", SEAM_PREFERENCES_ID);
-		createLink(composite, "See <a>Drools Runtimes</a>", DROOLS_PREFERENCES_ID);
-		createLink(composite, "See <a>JBPM Runtimes</a>", JBPM_PREFERENCES_ID);
-		
-		new Label(composite, SWT.NONE);
-		
-		Label searchLabel = new Label(composite, SWT.NONE);
-		searchLabel.setText("JBoss AS, Seam, JBPM and Drools Runtimes will be configured based on the entered path.");
-		
-		Group runtimeGroup = new Group(composite, SWT.NONE);
-		layout = new GridLayout(1, false);
-		runtimeGroup.setLayout(layout);
-		runtimeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		runtimeGroup.setText("JBoss Runtimes");
-		Button searchButton = createButton(runtimeGroup, "Search for JBoss Runtimes", "Search...");
-		searchButton.addSelectionListener(new SelectionAdapter() {
-			
-			public void widgetSelected(SelectionEvent e) {
-				search();
-			}
-
-		});
-		
-//		Button exportButton = createButton(runtimeGroup, "Export JBoss Runtimes", "Export...");
-//		exportButton.addSelectionListener(new SelectionAdapter() {
-//			
-//			public void widgetSelected(SelectionEvent e) {
-//				exportRuntimes();
-//			}
-//
-//		});
-//		
-//		Button importButton = createButton(runtimeGroup, "Import JBoss Runtimes", "Import...");
-//		importButton.addSelectionListener(new SelectionAdapter() {
-//			
-//			public void widgetSelected(SelectionEvent e) {
-//				importRuntimes();
-//			}
-//
-//		});
-//		
-		setButtonDimensionHint(searchButton);
-//		setButtonDimensionHint(exportButton);
-//		setButtonDimensionHint(importButton);
-		Dialog.applyDialogFont(composite);
-		return composite;
-	}
-
-	private void exportRuntimes() {
-		IJBossRuntimePersistanceHandler[] exportHandlers = JBossRuntimeStartup.getPersistanceHandlers();
-		for( int i = 0; i < exportHandlers.length; i++ ) {
-			exportHandlers[i].exportRuntimes();
-		}
-		PreferencesExportWizard wizard = new PreferencesExportWizard();
-		wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
-		WizardDialog dialog = new WizardDialog(getShell(), wizard);
-		dialog.create();
-		dialog.open();
-	}
-
-	private void importRuntimes() {
-		PreferencesImportWizard wizard = new PreferencesImportWizard();
-		wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
-		WizardDialog dialog = new WizardDialog(getShell(), wizard);
-		dialog.create();
-		int ok = dialog.open();
-		if (ok == Window.OK) {
-			IJBossRuntimePersistanceHandler[] importHandlers = JBossRuntimeStartup.getPersistanceHandlers();
-			for( int i = 0; i < importHandlers.length; i++ ) {
-				importHandlers[i].importRuntimes();
-			}
-			refreshPreferencePage();
-		}
-	}
-	
-	private Button createButton(Composite parent, String labelText, String buttonText) {
-		GridLayout layout;
-		Composite composite = new Composite(parent,SWT.NONE);	
-		layout = new GridLayout(2, false);
-		layout.marginWidth = 0;
-		layout.marginHeight = 0;
-		composite.setLayout(layout);
-		composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		
-		Label label = new Label(composite, SWT.NONE);
-		label.setText(labelText);
-		GridData data= new GridData(GridData.FILL, GridData.CENTER, true, false);
-		data.widthHint= convertVerticalDLUsToPixels(50);
-		label.setLayoutData(data);
-		
-		Button button = new Button(composite, SWT.PUSH);
-		button.setText(buttonText);
-		data = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
-		//data.widthHint= convertVerticalDLUsToPixels(60);
-		button.setLayoutData(data);
-		return button;
-	}
-
-	private void createLink(Composite composite, String text, final String preferencesId) {
-		Link link = new Link(composite, SWT.NONE);
-		link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
-		link.setText(text);
-		link.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				PreferencesUtil.createPreferenceDialogOn(getShell(),preferencesId, null, null);
-			}
-		});
-	}
-
-	public void init(IWorkbench workbench) {
-	}
-	
-	private void search() {
-		IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
-		String lastUsedPath= dialogSettings.get(LASTPATH);
-		if (lastUsedPath == null) {
-			lastUsedPath= ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
-		}
-		DirectoryDialog dialog = new DirectoryDialog(getShell());
-		dialog.setMessage("Search for JBoss Runtimes");
-		dialog.setFilterPath(lastUsedPath);
-		final String path = dialog.open();
-		if (path == null) {
-			return;
-		}
-		dialogSettings.put(LASTPATH, path);
-		
-		IRunnableWithProgress op = new IRunnableWithProgress() {
-			
-			public void run(IProgressMonitor monitor) {
-				JBossRuntimeLocator locator = new JBossRuntimeLocator();
-				serverDefinitions = locator.searchForRuntimes(path, monitor);
-				
-			}
-		};
-		
-		try {
-			serverDefinitions = null;
-			new ProgressMonitorDialog(getShell()).run(true, true, op);
-		} catch (InvocationTargetException e) {
-			Activator.log(e);
-		} catch (InterruptedException e) {
-			//  ignore
-		}
-
-		if (serverDefinitions == null || serverDefinitions.size() == 0) {
-			MessageDialog.openInformation(null, "Search for JBoss Runtimes",
-							"The search found 0 runtimes while searching "
-									+ path + ".");
-		} else {
-			RuntimeDialog runtimeDialog = new RuntimeDialog(getShell(),
-					serverDefinitions, path);
-			int ok = runtimeDialog.open();
-			if (ok == Window.OK) {
-				Iterator<ServerDefinition> iterator = serverDefinitions.iterator();
-				while (iterator.hasNext()) {
-					 ServerDefinition definition = iterator.next();
-					 if (!definition.isEnabled()) {
-						 iterator.remove();
-					 }
-				}
-				JBossRuntimeStartup runtimeStartup = new JBossRuntimeStartup();
-				runtimeStartup.initializeRuntimes(serverDefinitions);
-				refreshPreferencePage();
-			}
-		}
-			
-	}
-
-	private void refreshPreferencePage() {
-		getShell().close();
-		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-		PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, ID, null, null);
-		preferenceDialog.open();
-	}
-	
-	/**
-	 * Returns a width hint for a button control.
-	 * @param button the button
-	 * @return the width hint
-	 */
-	public static int getButtonWidthHint(Button button) {
-		button.setFont(JFaceResources.getDialogFont());
-		PixelConverter converter= new PixelConverter(button);
-		int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
-		return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
-	}
-
-	/**
-	 * Sets width and height hint for the button control.
-	 * <b>Note:</b> This is a NOP if the button's layout data is not
-	 * an instance of <code>GridData</code>.
-	 *
-	 * @param button	the button for which to set the dimension hint
-	 */
-	public static void setButtonDimensionHint(Button button) {
-		Assert.isNotNull(button);
-		Object gd= button.getLayoutData();
-		if (gd instanceof GridData) {
-			((GridData)gd).widthHint= getButtonWidthHint(button);
-			((GridData)gd).horizontalAlignment = GridData.FILL;
-		}
-	}
-}
Index: src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- src/org/jboss/tools/runtime/handlers/JBossASHandler.java	(revision 25940)
+++ src/org/jboss/tools/runtime/handlers/JBossASHandler.java	(working copy)
@@ -10,15 +10,12 @@
  ******************************************************************************/
 package org.jboss.tools.runtime.handlers;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URL;
 import java.util.List;
 import java.util.Properties;
 
-import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IConfigurationElement;
@@ -49,22 +46,20 @@
 import org.eclipse.wst.server.core.IServerWorkingCopy;
 import org.eclipse.wst.server.core.ServerCore;
 import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.IMemento;
 import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
 import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.XMLMemento;
+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.tools.runtime.Activator;
 import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
 import org.jboss.tools.runtime.Messages;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
 
-public class JBossASHandler implements IJBossRuntimePersistanceHandler, IJBossRuntimePluginConstants {
-
+public class JBossASHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+	
 	public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
 		createInitialJBossServer();
 		createJBossServerFromDefinitions(serverDefinitions);
@@ -259,8 +254,10 @@
 		server.setName(name);
 		
 		// JBossServer.DEPLOY_DIRECTORY
-		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$
+		// 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$
@@ -341,64 +338,69 @@
 		
 	}
 
-	public void importRuntimes() {
-		String servers = Activator.getDefault().getPreferenceStore().getString(Activator.SERVERS);
-		if (servers != null && servers.trim().length() > 0) {
-			loadServerInstalations(servers);
+	public ServerDefinition getServerDefinition(File root,
+			IProgressMonitor monitor) {
+		if (monitor.isCanceled() || root == null) {
+			return null;
 		}
-	}
-	/**
-	 * @param servers
-	 */
-	private void loadServerInstalations(String servers) {
-		InputStream in = null;
-		try {
-			in = new ByteArrayInputStream(servers.getBytes("UTF-8"));
-			IMemento memento = XMLMemento.loadMemento(in);
-			
-			IMemento[] children = memento.getChildren("server");
-			int size = children.length;
-			
-			for (int i = 0; i < size; i++) {
-				ServerEx server = new ServerEx(null);
-				server.loadFromMemento(children[i], null);
-				IServerWorkingCopy wc = server.createWorkingCopy();
-				wc.save(false, null);
-			}
-		} catch (Exception e) {
-			Activator.log(e);
+		ServerBeanLoader loader = new ServerBeanLoader();
+		ServerBean serverBean = loader.loadFromLocation(root);
+		
+		if (!JBossServerType.UNKNOWN.equals(serverBean.getType())) {
+			ServerDefinition serverDefinition = new ServerDefinition(serverBean.getName(), 
+					serverBean.getVersion(), serverBean.getType().getId(), new File(serverBean.getLocation()));
+			serverDefinition.setDescription(includedRuntimes(serverDefinition));
+			return serverDefinition;
 		}
+		return null;
 	}
 
-	private static final String SERVER_DATA_FILE = "servers.xml";
-	public void exportRuntimes() {
-		String filename = ServerPlugin.getInstance().getStateLocation().append(SERVER_DATA_FILE).toOSString();
-		if ( !(new File(filename).exists()) ) {
-			Activator.getDefault().getPreferenceStore().setValue(Activator.SERVERS, "");
-			return;
+	@Override
+	public String includedRuntimes(ServerDefinition serverDefinition) {
+		if (serverDefinition == null || serverDefinition.getType() == null) {
+			return super.includedRuntimes(serverDefinition);
 		}
-		try {
-			XMLMemento memento = (XMLMemento) XMLMemento.loadMemento(filename);
-			String xmlString = memento.saveToString();
-			Activator.getDefault().getPreferenceStore().setValue(Activator.SERVERS, xmlString);
-			Activator.getDefault().savePluginPreferences();
-		} catch (Exception e) {
-			Activator.log (e);
+		StringBuilder builder = new StringBuilder();
+		String type = serverDefinition.getType();
+		
+		if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
+			String includeSeam = SeamHandler.included(serverDefinition);
+			append(builder, includeSeam);
 		}
+		if (SOA_P.equals(type)) {
+			String includeDrools = DroolsHandler.included(serverDefinition);
+			append(builder, includeDrools);
+			String includeJbpm = JbpmHandler.included(serverDefinition);
+			append(builder, includeJbpm);
+		}
+		return builder.toString();
+		
 	}
-	private static class ServerEx extends Server {
 
-		/**
-		 * @param file
-		 */
-		public ServerEx(IFile file) {
-			super(file);
+	private void append(StringBuilder builder, String string) {
+		if (string != null && string.length() > 0) {
+			if (builder.toString().length() == 0) {
+				builder.append("Includes ");
+			} else {
+				builder.append(", ");
+			}
+			builder.append(string);
 		}
-		
-		@Override
-		public void loadFromMemento(IMemento memento, IProgressMonitor monitor) {
-			super.loadFromMemento(memento, monitor);
+	}
+
+	@Override
+	public boolean exists(ServerDefinition serverDefinition) {
+		if (serverDefinition == null || serverDefinition.getLocation() == null) {
+			return false;
 		}
-		
+		String path = serverDefinition.getLocation().getAbsolutePath();
+		IServer[] servers = ServerCore.getServers();
+		for (int i = 0; i < servers.length; i++) {
+			IRuntime runtime = servers[i].getRuntime();
+			if(runtime != null && runtime.getLocation().equals(path)) {
+				return true;
+			}
+		}
+		return false;
 	}
 }
Index: .classpath
===================================================================
--- .classpath	(revision 24586)
+++ .classpath	(working copy)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: META-INF/MANIFEST.MF
===================================================================
--- META-INF/MANIFEST.MF	(revision 24586)
+++ META-INF/MANIFEST.MF	(working copy)
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %BundleName
 Bundle-SymbolicName: org.jboss.tools.runtime;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.2.0.qualifier
 Bundle-Activator: org.jboss.tools.runtime.Activator
 Bundle-Vendor: %BundleVendor
 Require-Bundle: org.eclipse.core.runtime,
@@ -18,9 +18,13 @@
  org.eclipse.datatools.connectivity;visibility:=reexport,
  org.eclipse.datatools.connectivity.db.generic,
  org.jboss.tools.common,
+ org.jboss.tools.runtime.core,
  org.jboss.ide.eclipse.as.core,
  org.jboss.tools.jbpm.common
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Bundle-Localization: plugin
+Export-Package: org.jboss.tools.runtime,
+ org.jboss.tools.runtime.handlers,
+ org.jboss.tools.runtime.preferences
 
Index: src/org/jboss/tools/runtime/JBossRuntimeStartup.java
===================================================================
--- src/org/jboss/tools/runtime/JBossRuntimeStartup.java	(revision 26765)
+++ src/org/jboss/tools/runtime/JBossRuntimeStartup.java	(working copy)
@@ -20,6 +20,7 @@
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
+import java.util.Set;
 import java.util.StringTokenizer;
 
 import org.eclipse.core.resources.IWorkspaceRoot;
@@ -35,33 +36,13 @@
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.navigator.CommonNavigator;
-import org.jboss.tools.runtime.handlers.DroolsHandler;
-import org.jboss.tools.runtime.handlers.JBossASHandler;
-import org.jboss.tools.runtime.handlers.JbpmHandler;
-import org.jboss.tools.runtime.handlers.SeamHandler;
+import org.jboss.tools.runtime.core.RuntimeCoreActivator;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
 import org.osgi.framework.Bundle;
 import org.osgi.service.prefs.BackingStoreException;
 
 public class JBossRuntimeStartup implements IStartup, IJBossRuntimePluginConstants {
-
-	private static IJBossRuntimePersistanceHandler[] jBossRuntimePersistanceHandler = null;
-	public static interface IJBossRuntimePersistanceHandler {
-		public void initializeRuntimes(List<ServerDefinition> serverDefinitions);
-		public void importRuntimes();
-		public void exportRuntimes();
-	}
-
-	public static IJBossRuntimePersistanceHandler[] getPersistanceHandlers() {
-		if (jBossRuntimePersistanceHandler == null) {
-			jBossRuntimePersistanceHandler = new IJBossRuntimePersistanceHandler[] {
-					new JbpmHandler(),
-					new DroolsHandler(),
-					new JBossASHandler(),
-					new SeamHandler()
-			};
-		}
-		return jBossRuntimePersistanceHandler;
-	}
 	
 	private List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
 	private IEclipsePreferences preferences;
@@ -75,9 +56,11 @@
 	}
 	
 	public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
-		IJBossRuntimePersistanceHandler[] handlers = getPersistanceHandlers();
-		for( int i = 0; i < handlers.length; i++ ) {
-			handlers[i].initializeRuntimes(serverDefinitions);
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+		for( IRuntimeDetector detector:detectors) {
+			if (detector.isEnabled()) {
+				detector.initializeRuntimes(serverDefinitions);
+			}
 		}
 		refreshCommonNavigator();
 	}
@@ -172,9 +155,7 @@
 			}
 		});
 	}
-	
 
-
 	private void parseServerFile() {
 		
 		try {
Index: src/org/jboss/tools/runtime/handlers/SeamHandler.java
===================================================================
--- src/org/jboss/tools/runtime/handlers/SeamHandler.java	(revision 26765)
+++ src/org/jboss/tools/runtime/handlers/SeamHandler.java	(working copy)
@@ -11,26 +11,34 @@
 package org.jboss.tools.runtime.handlers;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
 
 import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.osgi.service.datalocation.Location;
 import org.jboss.tools.runtime.Activator;
 import org.jboss.tools.runtime.IJBossRuntimePluginConstants;
-import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.ServerDefinition;
+import org.jboss.tools.runtime.core.model.AbstractRuntimeDetector;
+import org.jboss.tools.runtime.core.model.ServerDefinition;
 import org.jboss.tools.seam.core.SeamUtil;
 import org.jboss.tools.seam.core.project.facet.SeamRuntime;
 import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
 import org.jboss.tools.seam.core.project.facet.SeamVersion;
 
-public class SeamHandler implements IJBossRuntimePersistanceHandler, IJBossRuntimePluginConstants {
+public class SeamHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
+
+	private final static String seamJarName = "jboss-seam.jar";
+	private final static String seamVersionAttributeName = "Seam-Version";
+
 	public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
 		
 		Map<String, SeamRuntime> map = new HashMap<String,SeamRuntime>();
@@ -145,34 +153,6 @@
 		return ""; //$NON-NLS-1$
 	}
 
-	public void importRuntimes() {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void exportRuntimes() {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public static String includeSeam(ServerDefinition serverDefinition) {
-		StringBuilder builder = new StringBuilder();
-		for (String folder : IJBossRuntimePluginConstants.SEAM_HOME_FOLDER_OPTIONS) {
-			File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
-			if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
-				SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
-				if (seamVersion != null) {
-					if (builder.toString().length() > 0) {
-						builder.append(", ");
-					}
-					builder.append("Seam ");
-					builder.append(seamVersion);
-				}
-			}
-		} 
-		return builder.toString();
-	}
-
 	public static SeamVersion getSeamVersion(String seamGenBuildPath) {
 		if (seamGenBuildPath == null || seamGenBuildPath.trim().length() <= 0) {
 			return null;
@@ -203,4 +183,79 @@
 		return false;
 	}
 
+	public ServerDefinition getServerDefinition(File root,
+			IProgressMonitor monitor) {
+		if (monitor.isCanceled() || root == null) {
+			return null;
+		}
+		String seamVersion = getSeamVersionFromManifest(root.getAbsolutePath());
+		if (seamVersion != null) {
+			return new ServerDefinition(root.getName(), seamVersion, SEAM, root.getAbsoluteFile());
+		}
+		return null;
+	}
+
+	public static String getSeamVersionFromManifest(String seamHome) {
+		File seamHomeFolder = new File(seamHome);
+		if (seamHomeFolder == null || !seamHomeFolder.isDirectory()) {
+			return null;
+		}
+		String[] seamFiles = seamHomeFolder.list(new FilenameFilter() {
+			
+			public boolean accept(File dir, String name) {
+				if ("seam-gen".equals(name)) {
+					return true;
+				}
+				if ("examples".equals(name)) {
+					return true;
+				}
+				return false;
+			}
+		});
+		if (seamFiles == null || seamFiles.length != 2) {
+			return null;
+		}
+		File jarFile = new File(seamHome, "lib/" + seamJarName);
+		if(!jarFile.isFile()) {
+			jarFile = new File(seamHome, seamJarName);
+			if(!jarFile.isFile()) {
+				return null;
+			}
+		}
+		try {
+			JarFile jar = new JarFile(jarFile);
+			Attributes attributes = jar.getManifest().getMainAttributes();
+			String version = attributes.getValue(seamVersionAttributeName);
+			return version;
+		} catch (IOException e) {
+			return null;
+		}
+	}
+
+	public static String included(ServerDefinition serverDefinition) {
+		StringBuilder builder = new StringBuilder();
+		for (String folder : IJBossRuntimePluginConstants.SEAM_HOME_FOLDER_OPTIONS) {
+			File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
+			if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
+				SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
+				if (seamVersion != null) {
+					if (builder.toString().length() > 0) {
+						builder.append(", ");
+					}
+					builder.append("Seam ");
+					builder.append(seamVersion);
+				}
+			}
+		} 
+		return builder.toString();
+	}
+
+	@Override
+	public boolean exists(ServerDefinition serverDefinition) {
+		if (serverDefinition == null || serverDefinition.getLocation() == null) {
+			return false;
+		}
+		String path = serverDefinition.getLocation().getAbsolutePath();
+		return seamExists(path);
+	}
 }
Index: build.properties
===================================================================
--- build.properties	(revision 25327)
+++ build.properties	(working copy)
@@ -5,4 +5,7 @@
                plugin.xml,\
                plugin.properties,\
                about.html,\
-               icons/
+               about.ini,\
+               about.mappings,\
+               about.properties,\
+               jboss_about.png
Index: jboss_about.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: jboss_about.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: plugin.xml
===================================================================
--- plugin.xml	(revision 25940)
+++ plugin.xml	(working copy)
@@ -13,15 +13,6 @@
          point="org.eclipse.core.runtime.preferences">
       <initializer class="org.jboss.tools.runtime.preferences.JBossRuntimePreferencesInitializer"/>
    </extension>
-
-   <extension
-        point="org.eclipse.ui.preferencePages">
-     <page
-           category="org.jboss.tools.common.model.ui.MainPreferencePage"
-           class="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
-           id="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
-           name="%JBoss_Runtimes"/>
-   </extension>
    
    <extension
          point="org.eclipse.ui.preferenceTransfer">
@@ -70,4 +61,39 @@
    </extension>
    -->
    
+   <extension
+         point="org.jboss.tools.runtime.core.runtimeDetectors">
+    	<runtimeDetector 
+    	    id="org.jboss.tools.runtime.handlers.JBossASHandler"
+    		name="JBoss Server Runtime"
+       		class="org.jboss.tools.runtime.handlers.JBossASHandler"
+       		preferenceId="org.eclipse.wst.server.ui.runtime.preferencePage"/>
+	</extension>
+	
+	<extension
+         point="org.jboss.tools.runtime.core.runtimeDetectors">
+    	<runtimeDetector
+    		id="org.jboss.tools.runtime.handlers.DroolsHandler"
+    		name="Drools Runtime"
+       		class="org.jboss.tools.runtime.handlers.DroolsHandler"
+       		preferenceId="org.drools.eclipse.preferences.DroolsRuntimesPreferencePage"/>
+	</extension>
+	
+	<extension
+         point="org.jboss.tools.runtime.core.runtimeDetectors">
+    	<runtimeDetector
+    		id="org.jboss.tools.runtime.handlers.JbpmHandler" 
+    		name="jBPM Runtime"
+       		class="org.jboss.tools.runtime.handlers.JbpmHandler"
+       		preferenceId="org.jboss.tools.jbpm.locations"/>
+	</extension>
+	
+	<extension
+         point="org.jboss.tools.runtime.core.runtimeDetectors">
+    	<runtimeDetector
+    		id="org.jboss.tools.runtime.handlers.SeamHandler"
+    		name="Seam Runtime"
+       		class="org.jboss.tools.runtime.handlers.SeamHandler"
+       		preferenceId="org.jboss.tools.common.model.ui.seam"/>
+	</extension>
 </plugin>
#P org.jboss.tools.runtime.feature
Index: feature.xml
===================================================================
--- feature.xml	(revision 27129)
+++ feature.xml	(working copy)
@@ -1,22 +1,22 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
-      id="org.jboss.tools.runtime.feature"
-      label="%featureName"
-      version="1.1.0.qualifier"
-      provider-name="%providerName">
-
-   <description>
-      %description
-   </description>
-
-   <copyright>
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="org.jboss.tools.runtime.feature"
+      label="%featureName"
+      version="1.2.0.qualifier"
+      provider-name="%providerName">
+
+   <description>
+      %description
+   </description>
+
+   <copyright>
       JBoss by Red Hat
 Copyright 2009-2010, JBoss by Red Hat, and individual contributors as indicated
 by the @authors tag. See the copyright.txt in the distribution
-for a full listing of individual contributors.
-   </copyright>
-
-   <license url="http://osdn.dl.sourceforge.net/sourceforge/jboss/LGPL.html">
+for a full listing of individual contributors.
+   </copyright>
+
+   <license url="http://osdn.dl.sourceforge.net/sourceforge/jboss/LGPL.html">
       JBossTools is under the LGPL Licence
 GNU LESSER GENERAL PUBLIC LICENSE
 Version 2.1, February 1999 
@@ -422,14 +422,14 @@
 BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE
 WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY
 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
-END OF TERMS AND CONDITIONS
-   </license>
-
-   <plugin
-         id="org.jboss.tools.runtime"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-</feature>
+END OF TERMS AND CONDITIONS
+   </license>
+
+   <plugin
+         id="org.jboss.tools.runtime"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+</feature>
