[jbosstools-commits] JBoss Tools SVN: r17490 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 9 09:49:12 EDT 2009


Author: scabanovich
Date: 2009-09-09 09:49:12 -0400 (Wed, 09 Sep 2009)
New Revision: 17490

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3506

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java	2009-09-09 13:46:04 UTC (rev 17489)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java	2009-09-09 13:49:12 UTC (rev 17490)
@@ -31,8 +31,11 @@
 import org.jboss.tools.common.model.ui.attribute.editor.IPropertyEditor;
 import org.jboss.tools.common.model.ui.attribute.editor.MutableComboBoxFieldEditor;
 import org.jboss.tools.common.model.ui.attribute.editor.MutableMultipleChoiceFieldEditor;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
 
 
 import org.jboss.tools.common.meta.action.SpecialWizard;
@@ -42,6 +45,7 @@
 import org.jboss.tools.common.model.XModelObject;
 import org.jboss.tools.common.model.options.PreferenceModelUtilities;
 import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.jst.web.WebModelPlugin;
 import org.jboss.tools.jst.web.context.RegisterServerContext;
 import org.jboss.tools.jst.web.server.*;
 import org.jboss.tools.jst.web.ui.Messages;
@@ -220,6 +224,15 @@
 			ns[i] = rs[i].getName();
 			if(rs[i] == selectedRuntime || selectedRuntime1 == null) selectedRuntime1 = rs[i];
 		}
+		IProject p = context.getProjectHandle();
+		if(p != null && p.exists() && p.isAccessible()) {
+			try {
+				IRuntime sr = J2EEProjectUtilities.getServerRuntime(p);
+				if(sr != null) selectedRuntime1 = sr;
+			} catch (CoreException exc) {
+				WebModelPlugin.getPluginLog().logError(exc);
+			}
+		}
 		HUtil.hackAttributeConstraintList(new XEntityData[]{support.getEntityData()}, 0, ATTR_RUNTIME,  ns);
 		String runtimeName = (selectedRuntime1 != null) ? selectedRuntime1.getName() : ""; //$NON-NLS-1$
 		context.setRuntimeName(runtimeName);



More information about the jbosstools-commits mailing list