### Eclipse Workspace Patch 1.0
#P org.jboss.tools.runtime
Index: src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
===================================================================
--- src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java	(revision 25982)
+++ src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java	(working copy)
@@ -10,16 +10,12 @@
  ************************************************************************************/
 package org.jboss.tools.runtime.preferences;
 
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
 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.IFile;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -30,6 +26,7 @@
 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;
@@ -47,23 +44,18 @@
 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.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.IMemento;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.XMLMemento;
 import org.jboss.tools.runtime.Activator;
 import org.jboss.tools.runtime.JBossRuntimeLocator;
 import org.jboss.tools.runtime.JBossRuntimeStartup;
-import org.jboss.tools.runtime.ServerDefinition;
 import org.jboss.tools.runtime.JBossRuntimeStartup.IJBossRuntimePersistanceHandler;
-import org.jboss.tools.runtime.handlers.JbpmHandler;
+import org.jboss.tools.runtime.ServerDefinition;
 
 /**
  * @author Snjeza
@@ -72,6 +64,7 @@
 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$
@@ -99,10 +92,10 @@
 		
 		composite.setLayout(layout);
 		
-		createLink(composite, "See <a>WTP Runtime</a>", WTP_PREFERENCES_ID);
-		createLink(composite, "See <a>Seam Runtime</a>", SEAM_PREFERENCES_ID);
-		createLink(composite, "See <a>Drools Runtime</a>", DROOLS_PREFERENCES_ID);
-		createLink(composite, "See <a>JBPM Runtime</a>", JBPM_PREFERENCES_ID);
+		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);
 		
@@ -159,9 +152,6 @@
 		dialog.create();
 		dialog.open();
 	}
-	
-	private void exportServers() {
-	}
 
 	private void importRuntimes() {
 		PreferencesImportWizard wizard = new PreferencesImportWizard();
@@ -174,6 +164,7 @@
 			for( int i = 0; i < importHandlers.length; i++ ) {
 				importHandlers[i].importRuntimes();
 			}
+			refreshPreferencePage();
 		}
 	}
 	
@@ -265,10 +256,18 @@
 				}
 				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.
Index: src/org/jboss/tools/runtime/preferences/RuntimeDialog.java
===================================================================
--- src/org/jboss/tools/runtime/preferences/RuntimeDialog.java	(revision 25940)
+++ src/org/jboss/tools/runtime/preferences/RuntimeDialog.java	(working copy)
@@ -45,7 +45,7 @@
 		Composite contents = new Composite(area, SWT.NONE);
 		GridData gd = new GridData(GridData.FILL_BOTH);
 		gd.heightHint = 400;
-		gd.widthHint = 500;
+		gd.widthHint = 700;
 		contents.setLayoutData(gd);
 		contents.setLayout(new GridLayout());
 		getShell().setText("JBoss Runtimes");
@@ -64,8 +64,8 @@
 		table.setHeaderVisible(true);
 		table.setLinesVisible(true);
 
-		String[] columnNames = new String[] { "Name", "Version", "Type", "Location"};
-		int[] columnWidths = new int[] { 140, 50, 50, 245};
+		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);
@@ -121,6 +121,9 @@
 						return definition.getLocation().getAbsolutePath();
 					}
 				}
+				if (columnIndex == 4) {
+					return definition.getDescription();
+				}
 			}
 			return null;
 		}
Index: src/org/jboss/tools/runtime/JBossRuntimeStartup.java
===================================================================
--- src/org/jboss/tools/runtime/JBossRuntimeStartup.java	(revision 25940)
+++ src/org/jboss/tools/runtime/JBossRuntimeStartup.java	(working copy)
@@ -44,6 +44,7 @@
 
 public class JBossRuntimeStartup implements IStartup, IJBossRuntimePluginConstants {
 
+	private static IJBossRuntimePersistanceHandler[] jBossRuntimePersistanceHandler = null;
 	public static interface IJBossRuntimePersistanceHandler {
 		public void initializeRuntimes(List<ServerDefinition> serverDefinitions);
 		public void importRuntimes();
@@ -51,12 +52,15 @@
 	}
 
 	public static IJBossRuntimePersistanceHandler[] getPersistanceHandlers() {
-		return new 	IJBossRuntimePersistanceHandler[] {
-			new JbpmHandler(),
-			new DroolsHandler(),
-			new JBossASHandler(),
-			new SeamHandler()
-		};
+		if (jBossRuntimePersistanceHandler == null) {
+			jBossRuntimePersistanceHandler = new IJBossRuntimePersistanceHandler[] {
+					new JbpmHandler(),
+					new DroolsHandler(),
+					new JBossASHandler(),
+					new SeamHandler()
+			};
+		}
+		return jBossRuntimePersistanceHandler;
 	}
 	
 	private List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
Index: src/org/jboss/tools/runtime/JBossRuntimeLocator.java
===================================================================
--- src/org/jboss/tools/runtime/JBossRuntimeLocator.java	(revision 25940)
+++ src/org/jboss/tools/runtime/JBossRuntimeLocator.java	(working copy)
@@ -60,10 +60,16 @@
 			
 			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() {
 						
@@ -83,6 +89,9 @@
 							droolsFound = true;
 						}
 					}
+					if (monitor.isCanceled()) {
+						return serverDefinitions;
+					}
 					boolean jbpmFound = false;
 					if (!droolsFound) {
 						boolean isJBPM = isValidJbpmInstallation(root.getAbsolutePath());
@@ -97,6 +106,9 @@
 							jbpmFound = true;
 						}
 					}
+					if (monitor.isCanceled()) {
+						return serverDefinitions;
+					}
 					if (!droolsFound && !jbpmFound) {
 						children = root.listFiles();
 					}
@@ -106,6 +118,9 @@
 		} else {
 			children = File.listRoots();
 		}
+		if (monitor.isCanceled()) {
+			return serverDefinitions;
+		}
 		if (depth == 0) {
 			return serverDefinitions; 
 		}
@@ -140,6 +155,25 @@
 	}	
 
 	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);
Index: src/org/jboss/tools/runtime/handlers/SeamHandler.java
===================================================================
--- src/org/jboss/tools/runtime/handlers/SeamHandler.java	(revision 25940)
+++ src/org/jboss/tools/runtime/handlers/SeamHandler.java	(working copy)
@@ -53,23 +53,24 @@
 
 		// Initialize Seam Runtime from JBoss EAP
 		String seamGenBuildPath = getSeamGenBuildPath(SEAM_1_2_HOME, SEAM_1_2_HOME_CONFIGURATION);
-		SeamVersion seamVersion = getSeamVersion(seamGenBuildPath);
+		SeamVersion seamVersion = Activator.getSeamVersion(seamGenBuildPath);
 		addSeam1(map, seamGenBuildPath, seamVersion);
 		
 		// fix for https://jira.jboss.org/jira/browse/JBDS-1215 The installer could not find EAP 4.3 Seam runtimes in recent CP
 		seamGenBuildPath = getSeamGenBuildPath(SEAM_1_2_HOME_CP, SEAM_1_2_HOME_CONFIGURATION_CP);
-		seamVersion = getSeamVersion(seamGenBuildPath);
+		seamVersion = Activator.getSeamVersion(seamGenBuildPath);
 		addSeam1(map, seamGenBuildPath, seamVersion);
 
 		// Initialize Seam 2.0 Runtime from JBoss EAP
 		seamGenBuildPath = getSeamGenBuildPath(SEAM_2_0_HOME, SEAM_2_0_HOME_CONFIGURATION);
-		seamVersion = getSeamVersion(seamGenBuildPath);
+		seamVersion = Activator.getSeamVersion(seamGenBuildPath);
 		addSeam2(map, seamGenBuildPath, seamVersion);
 		
 		// fix for https://jira.jboss.org/jira/browse/JBDS-1215 The installer could not find EAP 4.3 Seam runtimes in recent CPs
 		seamGenBuildPath = getSeamGenBuildPath(SEAM_2_0_HOME_CP, SEAM_2_0_HOME_CONFIGURATION_CP);
-		seamVersion = getSeamVersion(seamGenBuildPath);
+		seamVersion = Activator.getSeamVersion(seamGenBuildPath);
 		addSeam2(map, seamGenBuildPath, seamVersion);
+		SeamRuntimeManager.getInstance().save();
 	}
 
 	private static void addSeam1(Map<String, SeamRuntime> map,
@@ -96,7 +97,7 @@
 	private static void addSeam(Map<String, SeamRuntime> map,
 			ServerDefinition serverDefinition, File seamFile) {
 		if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
-			SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
+			SeamVersion seamVersion = Activator.getSeamVersion(seamFile.getAbsolutePath());
 			if (seamVersion != null) {
 				String name = "Seam " + serverDefinition.getName() + " " + seamVersion; //$NON-NLS-1$ //$NON-NLS-2$
 				addSeam(map, seamFile.getAbsolutePath(), seamVersion, name);
@@ -104,24 +105,8 @@
 		}
 	}
 
-	private static SeamVersion getSeamVersion(String seamGenBuildPath) {
-		if (seamGenBuildPath == null || seamGenBuildPath.trim().length() <= 0) {
-			return null;
-		}
-		String fullVersion = SeamUtil.getSeamVersionFromManifest(seamGenBuildPath);
-		if (fullVersion == null) {
-			return null;	
-		}
-		String version = fullVersion.substring(0,3);
-		SeamVersion seamVersion = null;
-		if (version != null) {
-			seamVersion = SeamVersion.findByString(version);
-		}
-		return seamVersion;
-	}
-
 	private static void addSeam(Map<String, SeamRuntime> map, String seamPath,SeamVersion seamVersion, String name) {
-		if (!seamExists(seamPath)) {
+		if (!Activator.seamExists(seamPath)) {
 			File seamFolder = new File(seamPath);
 			if(seamFolder.exists() && seamFolder.isDirectory()) {
 				SeamRuntime rt = new SeamRuntime();
@@ -134,20 +119,6 @@
 		}
 	}
 
-	/**
-	 * @param seamPath
-	 * @return
-	 */
-	private static boolean seamExists(String seamPath) {
-		SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance().getRuntimes();
-		for (SeamRuntime sr:seamRuntimes) {
-			if (seamPath != null && seamPath.equals(sr.getHomeDir())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
 	private static String getSeamGenBuildPath(String seamHomePath,
 			String seamHomePathConfiguration) {
 		try {
Index: src/org/jboss/tools/runtime/ServerDefinition.java
===================================================================
--- src/org/jboss/tools/runtime/ServerDefinition.java	(revision 25940)
+++ src/org/jboss/tools/runtime/ServerDefinition.java	(working copy)
@@ -13,6 +13,7 @@
 import java.io.File;
 
 import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
+import static org.jboss.tools.runtime.IJBossRuntimePluginConstants.*;
 
 /**
  * @author Snjeza
@@ -23,6 +24,7 @@
 	private String name;
 	private String version;
 	private String type;
+	private String description;
 	private File location;
 	private boolean enabled = true;
 	
@@ -33,6 +35,7 @@
 		this.version = version;
 		this.type = type;
 		this.location = location;
+		this.description = null;
 	}
 	
 	/**
@@ -57,17 +60,23 @@
 	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
@@ -127,5 +136,41 @@
 	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 = Activator.includeSeam(this);
+				append(builder, includeSeam);
+			}
+			if (SOA_P.equals(type)) {
+				String includeDrools = Activator.includeDrools(this);
+				append(builder, includeDrools);
+				String includeJbpm = Activator.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/Activator.java
===================================================================
--- src/org/jboss/tools/runtime/Activator.java	(revision 25940)
+++ src/org/jboss/tools/runtime/Activator.java	(working copy)
@@ -10,9 +10,16 @@
  ******************************************************************************/
 package org.jboss.tools.runtime;
 
+import java.io.File;
+
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
+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;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -78,4 +85,77 @@
 		Activator.getDefault().getLog().log(status);
 	}
 
+	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;
+		}
+		String fullVersion = SeamUtil.getSeamVersionFromManifest(seamGenBuildPath);
+		if (fullVersion == null) {
+			return null;	
+		}
+		String version = fullVersion.substring(0,3);
+		SeamVersion seamVersion = null;
+		if (version != null) {
+			seamVersion = SeamVersion.findByString(version);
+		}
+		return seamVersion;
+	}
+	
+	/**
+	 * @param seamPath
+	 * @return
+	 */
+	public static boolean seamExists(String seamPath) {
+		SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance().getRuntimes();
+		for (SeamRuntime sr:seamRuntimes) {
+			if (seamPath != null && seamPath.equals(sr.getHomeDir())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public static String includeDrools(ServerDefinition serverDefinition) {
+		StringBuilder builder = new StringBuilder();
+		File droolsRoot = serverDefinition.getLocation(); //$NON-NLS-1$
+		if (droolsRoot.isDirectory()) {
+			builder.append("Drools");
+			if (serverDefinition.getVersion() != null && serverDefinition.getVersion().length() > 0) {
+				builder.append(" ");
+				builder.append(serverDefinition.getVersion());
+			}
+		}
+		return builder.toString();
+	}
+
+	public static String includeJbpm(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;
+			}
+			builder.append(version);
+		}
+		return builder.toString();
+	}
 }
