[jbosstools-commits] JBoss Tools SVN: r43347 - in trunk: examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog and 6 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Aug 31 03:17:17 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-08-31 03:17:17 -0400 (Fri, 31 Aug 2012)
New Revision: 43347

Added:
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeExtensionManager.java
Modified:
   trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
   trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java
   trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
   trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionFrameworkTest.java
   trunk/seam/tests/org.jboss.tools.runtime.seam.detector.test/src/org/jboss/tools/runtime/seam/detector/test/SeamRuntimeDetectionTest.java
Log:
JBIDE-12525 to trunk

Modified: trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/as/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -350,7 +350,7 @@
 				RuntimeDefinition esbDefinition = new RuntimeDefinition(
 						name, version, ESB,
 						esbRoot);
-				IRuntimeDetector esbDetector = RuntimeCoreActivator.getEsbDetector();
+				IRuntimeDetector esbDetector = RuntimeCoreActivator.getDefault().getEsbDetector();
 				if (esbDetector != null) {
 					version = esbDetector.getVersion(esbDefinition);
 					esbDefinition.setVersion(version);

Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -581,7 +581,7 @@
 			});
 			
 		} else {
-			Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+			Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault()
 					.getRuntimeDetectors();
 			for (IRuntimeDetector detector : detectors) {
 				if (detector.isEnabled()) {

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/JBossRuntimeLocator.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -81,7 +81,7 @@
 		
 		monitor.setTaskName("Searching " + directory.getAbsolutePath());
 		
-		Set<IRuntimeDetector> runtimeDetectors = RuntimeCoreActivator.getRuntimeDetectors();
+		Set<IRuntimeDetector> runtimeDetectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 		for (IRuntimeDetector detector:runtimeDetectors) {
 			if (monitor.isCanceled()) {
 				return;

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeCoreActivator.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -11,18 +11,10 @@
 package org.jboss.tools.runtime.core;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.TreeSet;
 
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
@@ -30,7 +22,6 @@
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.jboss.tools.runtime.core.model.IRuntimeDetector;
-import org.jboss.tools.runtime.core.model.InvalidRuntimeDetector;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -46,14 +37,6 @@
 	// The plug-in ID
 	public static final String PLUGIN_ID = "org.jboss.tools.runtime.core"; //$NON-NLS-1$
 	private static final String ESB_DETECTOR_ID = "org.jboss.tools.runtime.handlers.EsbHandler"; //$NON-NLS-1$
-	private static final String RUNTIME_DETECTOR_EXTENSION_ID = "org.jboss.tools.runtime.core.runtimeDetectors";
-	
-	// Extension point property keys
-	private static final String NAME = "name";
-	private static final String PREFERENCE_ID = "preferenceId";
-	private static final String ID = "id";
-	private static final String ENABLED = "enabled";
-	private static final String PRIORITY = "priority";
 
 	// Preference key
 	private static final String ENABLED_DETECTORS = "enabledDetectors";
@@ -101,96 +84,26 @@
 		return plugin;
 	}
 
-	public static IRuntimeDetector getEsbDetector() {
-		return getOrLoadDefaultInstance().getEsbDetector2();
-	}
-
-	private static RuntimeCoreActivator getOrLoadDefaultInstance() {
-		if( getDefault() == null ) {
-			// load bundle
-			Bundle bundle = Platform.getBundle(PLUGIN_ID);
-			try {
-				bundle.start();
-			} catch(BundleException be) {
-				be.printStackTrace();
+	public IRuntimeDetector getEsbDetector() {
+		if (esbDetector == null) {
+			for (IRuntimeDetector detector:getDeclaredRuntimeDetectors()) {
+				if (ESB_DETECTOR_ID.equals(detector.getId())) {
+					esbDetector = detector;
+				}
 			}
 		}
-		return getDefault();
+		return esbDetector;
 	}
+
 	// Convenience method
-	public static Set<IRuntimeDetector> getDeclaredRuntimeDetectors() {
-		return getOrLoadDefaultInstance().getDeclaredRuntimeDetectors2();
-	}
-	
-	// Load all declared runtime detectors
-	public Set<IRuntimeDetector> getDeclaredRuntimeDetectors2() {
+	public Set<IRuntimeDetector> getDeclaredRuntimeDetectors() {
 		if( declaredRuntimeDetectors == null) {
-			declaredRuntimeDetectors = loadDeclaredRuntimeDetectors();
+			declaredRuntimeDetectors = RuntimeExtensionManager.getDefault().loadDeclaredRuntimeDetectors();
 		}
 		return declaredRuntimeDetectors;
 	}
 	
-	
-	// This method will do a full load and actually instantiate the classes
-	public Set<IRuntimeDetector> loadDeclaredRuntimeDetectors() {
-		Set<IRuntimeDetector> declared = new TreeSet<IRuntimeDetector>();
-		IExtensionRegistry registry = Platform.getExtensionRegistry();
-		IExtensionPoint extensionPoint = registry
-				.getExtensionPoint(RUNTIME_DETECTOR_EXTENSION_ID);
-		IExtension[] extensions = extensionPoint.getExtensions();
-		for (int i = 0; i < extensions.length; i++) {
-			IExtension extension = extensions[i];
-			IConfigurationElement[] configurationElements = extension
-					.getConfigurationElements();
-			for (int j = 0; j < configurationElements.length; j++) {
-				IRuntimeDetector dec = loadOneDeclaredRuntimeDetector(configurationElements[j]); 
-				if( !declared.contains(dec)) {
-					declared.add(dec);
-				}
-			}
-		}
-		return declared;
-	}
-
-	// This method will load one detector from a configuration element
-	private IRuntimeDetector loadOneDeclaredRuntimeDetector(IConfigurationElement configurationElement) {
-		IRuntimeDetector detector;
-		try {
-			detector = (IRuntimeDetector) configurationElement.createExecutableExtension("class");
-		} catch (CoreException e) {
-			log(e);
-			detector = new InvalidRuntimeDetector();
-			detector.setValid(false);
-		}
-		String name = configurationElement.getAttribute(NAME);
-		String preferenceId = configurationElement.getAttribute(PREFERENCE_ID);
-		String id = configurationElement.getAttribute(ID);
-		detector.setName(name);
-		detector.setPreferenceId(preferenceId);
-		detector.setId(id);
-		String enabled = configurationElement.getAttribute(ENABLED);
-		if (enabled == null || new Boolean(enabled).booleanValue()) {
-			detector.setEnabled(true);
-		} else {
-			detector.setEnabled(false);
-		}
-		String priorityString = configurationElement
-				.getAttribute(PRIORITY);
-		int priority;
-		try {
-			priority = Integer.parseInt(priorityString);
-		} catch (Exception ex) {
-			priority = Integer.MAX_VALUE;
-		}
-		detector.setPriority(priority);
-		return detector;
-	}
-	
-	public static Set<IRuntimeDetector> getRuntimeDetectors() {
-		return getOrLoadDefaultInstance().getRuntimeDetectors2();
-	}
-	
-	public Set<IRuntimeDetector> getRuntimeDetectors2() {
+	public Set<IRuntimeDetector> getRuntimeDetectors() {
 		if (runtimeDetectors == null) {
 			Set<IRuntimeDetector> tmp = getDeclaredRuntimeDetectors();
 			String enabledDetectors = getPreferences().get(ENABLED_DETECTORS,
@@ -216,7 +129,11 @@
 		return runtimeDetectors;
 	}
 
-	public static void saveEnabledDetectors(Set<IRuntimeDetector> allDetectors) {
+	public void saveEnabledDetectors() {
+		saveEnabledDetectors(getDeclaredRuntimeDetectors());
+	}
+	
+	public void saveEnabledDetectors(Set<IRuntimeDetector> allDetectors) {
 		StringBuilder builder = new StringBuilder();
 		for (IRuntimeDetector detector:allDetectors) {
 			if (detector.isEnabled()) {
@@ -237,27 +154,13 @@
 		}
 	}
 	
-	private static IEclipsePreferences getPreferences() {
-		return getOrLoadDefaultInstance().getPreferences2();
-	}
-	
-	private IEclipsePreferences getPreferences2() {
+	private  IEclipsePreferences getPreferences() {
 		if (prefs == null) {
 			prefs = ConfigurationScope.INSTANCE.getNode(PLUGIN_ID);
 		}
 		return prefs;
 	}
 	
-	public IRuntimeDetector getEsbDetector2() {
-		if (esbDetector == null) {
-			for (IRuntimeDetector detector:getDeclaredRuntimeDetectors()) {
-				if (ESB_DETECTOR_ID.equals(detector.getId())) {
-					esbDetector = detector;
-				}
-			}
-		}
-		return esbDetector;
-	}
 	public static void log(Throwable e) {
 		IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
 				.getLocalizedMessage(), e);

Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeExtensionManager.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeExtensionManager.java	                        (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/RuntimeExtensionManager.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -0,0 +1,86 @@
+package org.jboss.tools.runtime.core;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.runtime.core.model.IRuntimeDetector;
+import org.jboss.tools.runtime.core.model.InvalidRuntimeDetector;
+
+public class RuntimeExtensionManager {
+	private static final String RUNTIME_DETECTOR_EXTENSION_ID = "org.jboss.tools.runtime.core.runtimeDetectors";
+	
+	// Extension point property keys
+	private static final String NAME = "name";
+	private static final String PREFERENCE_ID = "preferenceId";
+	private static final String ID = "id";
+	private static final String ENABLED = "enabled";
+	private static final String PRIORITY = "priority";
+
+	private static RuntimeExtensionManager manager = null;
+	public static RuntimeExtensionManager getDefault() {
+		if( manager == null )
+			manager = new RuntimeExtensionManager();
+		return manager;
+	}
+	
+	// This method will do a full load and actually instantiate the classes
+	public Set<IRuntimeDetector> loadDeclaredRuntimeDetectors() {
+		Set<IRuntimeDetector> declared = new TreeSet<IRuntimeDetector>();
+		IExtensionRegistry registry = Platform.getExtensionRegistry();
+		IExtensionPoint extensionPoint = registry
+				.getExtensionPoint(RUNTIME_DETECTOR_EXTENSION_ID);
+		IExtension[] extensions = extensionPoint.getExtensions();
+		for (int i = 0; i < extensions.length; i++) {
+			IExtension extension = extensions[i];
+			IConfigurationElement[] configurationElements = extension
+					.getConfigurationElements();
+			for (int j = 0; j < configurationElements.length; j++) {
+				IRuntimeDetector dec = loadOneDeclaredRuntimeDetector(configurationElements[j]); 
+				if( !declared.contains(dec)) {
+					declared.add(dec);
+				}
+			}
+		}
+		return declared;
+	}
+	
+	// This method will load one detector from a configuration element
+	private IRuntimeDetector loadOneDeclaredRuntimeDetector(IConfigurationElement configurationElement) {
+		IRuntimeDetector detector;
+		try {
+			detector = (IRuntimeDetector) configurationElement.createExecutableExtension("class");
+		} catch (CoreException e) {
+			RuntimeCoreActivator.log(e);
+			detector = new InvalidRuntimeDetector();
+			detector.setValid(false);
+		}
+		String name = configurationElement.getAttribute(NAME);
+		String preferenceId = configurationElement.getAttribute(PREFERENCE_ID);
+		String id = configurationElement.getAttribute(ID);
+		detector.setName(name);
+		detector.setPreferenceId(preferenceId);
+		detector.setId(id);
+		String enabled = configurationElement.getAttribute(ENABLED);
+		if (enabled == null || new Boolean(enabled).booleanValue()) {
+			detector.setEnabled(true);
+		} else {
+			detector.setEnabled(false);
+		}
+		String priorityString = configurationElement
+				.getAttribute(PRIORITY);
+		int priority;
+		try {
+			priority = Integer.parseInt(priorityString);
+		} catch (Exception ex) {
+			priority = Integer.MAX_VALUE;
+		}
+		detector.setPriority(priority);
+		return detector;
+	}
+}

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/JBossRuntimeStartup.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -81,7 +81,7 @@
 	}
 
 	public static void initializeRuntimes(List<RuntimeDefinition> serverDefinitions) {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 		for( IRuntimeDetector detector:detectors) {
 			if (detector.isEnabled()) {
 				detector.initializeRuntimes(serverDefinitions);

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -114,8 +114,6 @@
 
 	private Set<RuntimePath> runtimePaths = new HashSet<RuntimePath>();
 	
-	private Set<IRuntimeDetector> runtimeDetectors;
-
 	private List<RuntimeDefinition> serverDefinitions;
 	
 	private ListenerList runtimePathChangeChangeListeners;
@@ -133,7 +131,6 @@
 		super.start(context);
 		plugin = this;
 		runtimePaths = null;
-		runtimeDetectors = null;
 	}
 
 	/*
@@ -253,7 +250,7 @@
 	}
 
 	public static boolean runtimeExists(RuntimeDefinition serverDefinition) {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 		for (IRuntimeDetector detector:detectors) {
 			if (detector.isEnabled() && detector.exists(serverDefinition)) {
 				return true;
@@ -281,9 +278,7 @@
 
 	public void saveRuntimePreferences() {
 		saveRuntimePaths();
-		if (runtimeDetectors != null) {
-			RuntimeCoreActivator.saveEnabledDetectors(runtimeDetectors);
-		}
+		RuntimeCoreActivator.getDefault().saveEnabledDetectors();
 	}
 	
 	private void initRuntimePaths() throws WorkbenchException {
@@ -335,7 +330,7 @@
 		}
 		if (computeIncluded) {
 			for(RuntimeDefinition definition:getServerDefinitions()) {
-				Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+				Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 				for (IRuntimeDetector detector:detectors) {
 					detector.computeIncludedRuntimeDefinition(definition);
 				}
@@ -455,15 +450,11 @@
 	}
 
 	public Set<IRuntimeDetector> getRuntimeDetectors() {
-		if (runtimeDetectors == null) {
-			runtimeDetectors = RuntimeCoreActivator.getRuntimeDetectors();
-		}
-		return runtimeDetectors;
+		return RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 	}
 
 	public void initDefaultRuntimePreferences() {
 		runtimePaths = new HashSet<RuntimePath>();
-		runtimeDetectors = RuntimeCoreActivator.getDeclaredRuntimeDetectors();
 	}
 	
 	public static void setTimestamp(Set<RuntimePath> runtimePaths2) {
@@ -480,7 +471,6 @@
 
 	public void refreshRuntimePreferences() {
 		runtimePaths = null;
-		runtimeDetectors = null;
 	}
 	
 	public static boolean runtimeCreated(RuntimeDefinition serverDefinition) {

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -59,7 +59,7 @@
 	private boolean canceled;
 	private boolean needRefresh;
 	private Label foundRuntimesLabel;
-	private List<RuntimeDefinition> serverDefinitions;
+	private List<RuntimeDefinition> runtimeDefinitions;
 	private Button hideCreatedRuntimes;
 	private int heightHint;
 
@@ -124,7 +124,7 @@
 				RuntimeDefinition definition = (RuntimeDefinition) event.getElement();
 				definition.setEnabled(!definition.isEnabled());
 				boolean enableOk = false;
-				List<RuntimeDefinition> serverDefinitions = getServerDefinitions(hideCreatedRuntimes.getSelection());
+				List<RuntimeDefinition> serverDefinitions = getRuntimeDefinitions(hideCreatedRuntimes.getSelection());
 				for (RuntimeDefinition serverDefinition:serverDefinitions) {
 					if (serverDefinition.isEnabled()) {
 						enableOk = true;
@@ -228,7 +228,7 @@
 	private void refresh(String message) {
 		running = false;
 		treeViewer.setInput(null);
-		List<RuntimeDefinition> serverDefinitions = getServerDefinitions(hideCreatedRuntimes.getSelection());
+		List<RuntimeDefinition> serverDefinitions = getRuntimeDefinitions(hideCreatedRuntimes.getSelection());
 		treeViewer.setInput(serverDefinitions);
 		for (RuntimeDefinition definition:serverDefinitions) {
 			treeViewer.setChecked(definition, definition.isEnabled());
@@ -256,8 +256,8 @@
 	@Override
 	protected void okPressed() {
 		getShell().setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
-		List<RuntimeDefinition> definitions = getServerDefinitions(true);
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
+		List<RuntimeDefinition> definitions = getRuntimeDefinitions(true);
 		for( IRuntimeDetector detector:detectors) {
 			if (detector.isEnabled()) {
 				detector.initializeRuntimes(definitions);
@@ -284,7 +284,7 @@
 		}
 		decrementNestingDepth();
 		getShell().setCursor(null);
-		int count = getServerDefinitions(true).size();
+		int count = getRuntimeDefinitions(true).size();
 		if (count == 0) {
 			hideCreatedRuntimes.setSelection(false);
 		}
@@ -330,12 +330,12 @@
 		return composite;
 	}
 
-	private List<RuntimeDefinition> getServerDefinitions(
+	private List<RuntimeDefinition> getRuntimeDefinitions(
 			boolean hideCreatedRuntimes) {
-		if (serverDefinitions == null) {
-			serverDefinitions = new ArrayList<RuntimeDefinition>();
+		if (runtimeDefinitions == null) {
+			runtimeDefinitions = new ArrayList<RuntimeDefinition>();
 		} else {
-			serverDefinitions.clear();
+			runtimeDefinitions.clear();
 		}
 		List<RuntimeDefinition> allDefinitions = getAllDefinitions();
 		for (RuntimePath runtimePath : runtimePaths) {
@@ -355,13 +355,13 @@
 		for (RuntimePath runtimePath : runtimePaths) {
 			for (RuntimeDefinition serverDefinition : runtimePath.getRuntimeDefinitions()) {
 				if (!hideCreatedRuntimes) {
-					serverDefinitions.add(serverDefinition);
+					runtimeDefinitions.add(serverDefinition);
 				} else if (!RuntimeUIActivator.runtimeCreated(serverDefinition)) {
-					serverDefinitions.add(serverDefinition);
+					runtimeDefinitions.add(serverDefinition);
 				}
 			}
 		}
-		return serverDefinitions;
+		return runtimeDefinitions;
 	}
 
 	protected List<RuntimeDefinition> getAllDefinitions(RuntimePath runtimePath) {

Modified: trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionFrameworkTest.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionFrameworkTest.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime/tests/org.jboss.tools.runtime.test/src/org/jboss/tools/runtime/test/RuntimeDetectionFrameworkTest.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -52,7 +52,7 @@
 
 	@Test
 	public void testInvalidDetectors() {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDeclaredRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getDeclaredRuntimeDetectors();
 		IRuntimeDetector invalidDetector = null;
 		for (IRuntimeDetector detector:detectors) {
 			if (detector instanceof InvalidRuntimeDetector) {
@@ -132,7 +132,7 @@
 		
 		
 		// initialize them
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 		for( IRuntimeDetector detector:detectors) {
 			if (detector.isEnabled()) {
 				detector.initializeRuntimes(runtimeDefinitions);

Modified: trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java
===================================================================
--- trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/src/org/jboss/tools/runtime/test/RuntimeDetectionTest.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -91,7 +91,7 @@
 		}
 		RuntimeUIActivator.getDefault().saveRuntimePaths();
 		List<RuntimeDefinition> serverDefinitions = new ArrayList<RuntimeDefinition>();
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault()
 				.getRuntimeDetectors();
 		for (IRuntimeDetector detector : detectors) {
 			if (detector.isEnabled()) {
@@ -108,15 +108,15 @@
 			List<RuntimeDefinition> serverDefinitions = locator
 					.searchForRuntimes(runtimePath.getPath(),
 							new NullProgressMonitor());
-			runtimePath.getServerDefinitions().clear();
+			runtimePath.getRuntimeDefinitions().clear();
 			for (RuntimeDefinition serverDefinition : serverDefinitions) {
 				serverDefinition.setRuntimePath(runtimePath);
 			}
-			runtimePath.getServerDefinitions().addAll(serverDefinitions);
+			runtimePath.getRuntimeDefinitions().addAll(serverDefinitions);
 		}
 		List<RuntimeDefinition> serverDefinitions = RuntimeUIActivator
 				.getDefault().getServerDefinitions();
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault()
 				.getRuntimeDetectors();
 		for (IRuntimeDetector detector : detectors) {
 			if (detector.isEnabled()) {
@@ -127,7 +127,7 @@
 
 	@Test
 	public void testRuntimeDetectors() {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault()
 				.getRuntimeDetectors();
 		assertTrue("Runtime detectors don't exist.", detectors.size() > 0);
 	}
@@ -394,7 +394,7 @@
 	
 	@Test
 	public void testInvalidDetectors() {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDeclaredRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getDeclaredRuntimeDetectors();
 		IRuntimeDetector invalidDetector = null;
 		for (IRuntimeDetector detector:detectors) {
 			if (detector instanceof InvalidRuntimeDetector) {

Modified: trunk/seam/tests/org.jboss.tools.runtime.seam.detector.test/src/org/jboss/tools/runtime/seam/detector/test/SeamRuntimeDetectionTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.runtime.seam.detector.test/src/org/jboss/tools/runtime/seam/detector/test/SeamRuntimeDetectionTest.java	2012-08-31 07:17:03 UTC (rev 43346)
+++ trunk/seam/tests/org.jboss.tools.runtime.seam.detector.test/src/org/jboss/tools/runtime/seam/detector/test/SeamRuntimeDetectionTest.java	2012-08-31 07:17:17 UTC (rev 43347)
@@ -101,13 +101,13 @@
 	
 	@Test
 	public void testRuntimeDetectors() {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 		assertTrue("Runtime detectors don't exist.", detectors.size() > 0);
 		assertTrue(handlerExists("org.jboss.tools.runtime.handlers.SeamHandler"));
 	}
 	
 	private boolean handlerExists(String id) {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getRuntimeDetectors();
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault().getRuntimeDetectors();
 		boolean found = false;
 		Iterator<IRuntimeDetector> i = detectors.iterator();
 		while(i.hasNext()) {
@@ -272,7 +272,7 @@
 	
 	/* Pass to all handlers the list of runtime definitions and let them initialize them */
 	private void initializeDefinitions(List<RuntimeDefinition> runtimeDefinitions) {
-		Set<IRuntimeDetector> detectors = RuntimeCoreActivator
+		Set<IRuntimeDetector> detectors = RuntimeCoreActivator.getDefault()
 				.getRuntimeDetectors();
 		for (IRuntimeDetector detector : detectors) {
 			if (detector.isEnabled()) {



More information about the jbosstools-commits mailing list