[jbosstools-commits] JBoss Tools SVN: r44031 - trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 26 06:34:34 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-26 06:34:34 -0400 (Wed, 26 Sep 2012)
New Revision: 44031

Modified:
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java
Log:
simple code cleanup, very safe, for runtime extension manager to be more clear

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java	2012-09-26 10:20:29 UTC (rev 44030)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java	2012-09-26 10:34:34 UTC (rev 44031)
@@ -121,16 +121,6 @@
 	
 	// This method will load one detector from a configuration element
 	private IRuntimeDetector loadOneDeclaredRuntimeDetector(IConfigurationElement configurationElement) {
-		IRuntimeDetectorDelegate delegate = null;
-		try {
-			delegate = (IRuntimeDetectorDelegate) configurationElement.createExecutableExtension("class");
-		} catch (CoreException e) {
-			RuntimeCoreActivator.getDefault().logError(e);
-			// TODO 
-//			detector = new InvalidRuntimeDetector();
-//			detector.setValid(false);
-		}
-		
 		String name = configurationElement.getAttribute(NAME);
 		String preferenceId = configurationElement.getAttribute(PREFERENCE_ID);
 		String id = configurationElement.getAttribute(ID);
@@ -145,15 +135,17 @@
 			priority = Integer.MAX_VALUE;
 		}
 
-		if( delegate != null ) {
+		IRuntimeDetectorDelegate delegate = null;
+		try {
+			delegate = (IRuntimeDetectorDelegate) configurationElement.createExecutableExtension("class");
 			RuntimeDetector detector = new RuntimeDetector(
 					name, id, preferenceId, priority, delegate);
 			detector.setEnabled(Boolean.parseBoolean(enabled));
 			return detector;
+		} catch (CoreException e) {
+			RuntimeCoreActivator.getDefault().logError(e);
+			return new InvalidRuntimeDetector(name, id, preferenceId, priority);
 		}
-		
-		// return a new invalid
-		return new InvalidRuntimeDetector(name, id, preferenceId, priority);
 	}
 	
 	public Map<String, DownloadRuntime> loadDownloadRuntimes() {



More information about the jbosstools-commits mailing list