[jbosstools-commits] JBoss Tools SVN: r35612 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 13 07:05:30 EDT 2011


Author: rob.stryker at jboss.com
Date: 2011-10-13 07:05:30 -0400 (Thu, 13 Oct 2011)
New Revision: 35612

Modified:
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
JBIDE-9793 - NPE when using php cartridge

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-13 09:08:40 UTC (rev 35611)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-13 11:05:30 UTC (rev 35612)
@@ -70,6 +70,9 @@
 	private IRuntime runtimeDelegate;
 	private Label domainLabel;
 	private Label modeLabel;
+	private Link addRuntimeLink;
+	private Label runtimeLabel;
+	
 
 	public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
 		super(
@@ -183,9 +186,6 @@
 		modeLabel.setEnabled(enabled);
 	}
 
-	private Link addRuntimeLink;
-	private Label runtimeLabel;
-	
 	private void fillServerAdapterGroup(Group serverAdapterGroup) {
 		Composite c = new Composite(serverAdapterGroup, SWT.NONE);
 		c.setLayout(new FormLayout());
@@ -225,10 +225,11 @@
 		addRuntimeLink.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent e) {
 				IRuntimeType type = getValidRuntimeType();
-				showRuntimeWizard(type);
+				if( type != null )
+					showRuntimeWizard(type);
 			}
 		});
-
+		
 		serverAdapterCheckbox.setLayoutData(UIUtil.createFormData2(0, 5, null, 0, 0, 5, null, 0));
 		runtimeLabel.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, 0, 5, null, 0));
 		addRuntimeLink.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, null, 0, 100, -5));
@@ -238,6 +239,8 @@
 		// 0, 0, 5, 100, 0));
 		modeLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null, 0, 0, 5, 100, 0));
 		serverAdapterCheckbox.setSelection(true);
+		model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER,
+				serverAdapterCheckbox2.getSelection());
 	}
 
 	private void updateSelectedRuntimeDelegate() {
@@ -291,6 +294,9 @@
 			suitableRuntimes.select(0);
 			updateSelectedRuntimeDelegate();
 		}
+		IRuntimeType type = getValidRuntimeType();
+		addRuntimeLink.setEnabled(type != null);
+
 		try {
 			domainLabel.setText("Host: " + model.getParentModel().getApplication().getApplicationUrl());
 			modeLabel.setText("Mode: Source");
@@ -302,8 +308,11 @@
 	}
 
 	protected void refreshValidRuntimes() {
-		IRuntime[] runtimes = getRuntimesOfType(getValidRuntimeType().getId());
-		fillRuntimeCombo(suitableRuntimes, runtimes);
+		IRuntimeType type = getValidRuntimeType();
+		if( type != null ) {
+			IRuntime[] runtimes = getRuntimesOfType(type.getId());
+			fillRuntimeCombo(suitableRuntimes, runtimes);
+		}
 	}
 
 	/* Stolen from NewManualServerComposite */



More information about the jbosstools-commits mailing list