[jbosstools-commits] JBoss Tools SVN: r43954 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 24 05:38:55 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-24 05:38:55 -0400 (Mon, 24 Sep 2012)
New Revision: 43954

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
Log:
JBIDE-12695

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java	2012-09-24 08:12:04 UTC (rev 43953)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractLocalJBossServerRuntime.java	2012-09-24 09:38:55 UTC (rev 43954)
@@ -77,9 +77,19 @@
 		
 		if( getExecutionEnvironment() != null ) {
 			IVMInstall[] installs = getExecutionEnvironment().getCompatibleVMs();
+			// IF your execution env has a default vm:
 			if( getExecutionEnvironment().getDefaultVM() != null )
 				return getExecutionEnvironment().getDefaultVM();
-			if( installs != null && installs.length > 0 && installs[0] != null )
+			// Check if the workspace default vm is in the list
+			IVMInstall workspaceDefault = JavaRuntime.getDefaultVMInstall();
+			
+			if( installs != null && workspaceDefault != null ) {
+				for( int i = 0; i < installs.length; i++) {
+					if( workspaceDefault.equals(installs[i]))
+						return workspaceDefault;
+				}
+			}
+			if( installs != null && installs.length > 0 && installs[0] != null)
 				return installs[0];
 		}
 		// not found, return default vm
@@ -106,7 +116,8 @@
 	}
 
 	protected IVMInstall getDefaultVMInstall() {
-		return getExecutionEnvironment().getDefaultVM();
+		IVMInstall i = getExecutionEnvironment().getDefaultVM();
+		return i == null ? JavaRuntime.getDefaultVMInstall() : i;
 	}
 	
 	public IVMInstall[] getValidJREs(IRuntimeType type) {



More information about the jbosstools-commits mailing list