[jbosstools-commits] JBoss Tools SVN: r35616 - 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:49:49 EDT 2011
Author: rob.stryker at jboss.com
Date: 2011-10-13 07:49:49 -0400 (Thu, 13 Oct 2011)
New Revision: 35616
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/ImportProjectWizardModel.java
Log:
JBIDE-9793 - NPE when using php cartridge + improving UI in that case.
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 11:29:34 UTC (rev 35615)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-13 11:49:49 UTC (rev 35616)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
@@ -62,7 +64,7 @@
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
-public class AdapterWizardPage extends AbstractOpenshiftWizardPage implements IWizardPage {
+public class AdapterWizardPage extends AbstractOpenshiftWizardPage implements IWizardPage, PropertyChangeListener {
private AdapterWizardPageModel model;
private Combo suitableRuntimes;
@@ -72,7 +74,7 @@
private Label modeLabel;
private Link addRuntimeLink;
private Label runtimeLabel;
-
+ private Button serverAdapterCheckbox;
public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
super(
@@ -82,6 +84,7 @@
"Server Adapter",
wizard);
this.model = new AdapterWizardPageModel(model);
+ model.addPropertyChangeListener(this);
}
@Override
@@ -204,7 +207,7 @@
private void fillServerAdapterGroup(Group serverAdapterGroup) {
Composite c = new Composite(serverAdapterGroup, SWT.NONE);
c.setLayout(new FormLayout());
- Button serverAdapterCheckbox = new Button(c, SWT.CHECK);
+ serverAdapterCheckbox = new Button(c, SWT.CHECK);
serverAdapterCheckbox.setText("Create a JBoss server adapter");
final Button serverAdapterCheckbox2 = serverAdapterCheckbox;
serverAdapterCheckbox.addSelectionListener(new SelectionListener() {
@@ -218,7 +221,7 @@
}
});
- runtimeLabel = new Label(c, SWT.BORDER);
+ runtimeLabel = new Label(c, SWT.NONE);
runtimeLabel.setText("Local Runtime: ");
suitableRuntimes = new Combo(c, SWT.READ_ONLY);
@@ -327,6 +330,8 @@
if( type != null ) {
IRuntime[] runtimes = getRuntimesOfType(type.getId());
fillRuntimeCombo(suitableRuntimes, runtimes);
+ } else {
+ suitableRuntimes.setItems(new String[0]);
}
}
@@ -387,4 +392,24 @@
}
}
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if( ImportProjectWizardModel.APPLICATION.equals(evt.getPropertyName())) {
+ handleApplicationChanged();
+ }
+ }
+
+ private void handleApplicationChanged() {
+ // we need to enable or disable all the server widgets depending on
+ // if we can make a server out of this
+ serverTypeToCreate = getServerTypeToCreate();
+ boolean canCreateServer = serverTypeToCreate != null;
+ serverAdapterCheckbox.setEnabled(canCreateServer);
+ serverAdapterCheckbox.setSelection(canCreateServer);
+ enableServerWidgets(canCreateServer);
+ refreshValidRuntimes();
+ model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
+ model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER, canCreateServer);
+ }
+
}
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-10-13 11:29:34 UTC (rev 35615)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-10-13 11:49:49 UTC (rev 35616)
@@ -53,10 +53,10 @@
private HashMap<String, Object> dataModel = new HashMap<String, Object>();
- private static final String USER = "user";
- private static final String APPLICATION = "application";
- private static final String REMOTE_NAME = "remoteName";
- private static final String CLONE_DIR = "cloneDir";
+ protected static final String USER = "user";
+ protected static final String APPLICATION = "application";
+ protected static final String REMOTE_NAME = "remoteName";
+ protected static final String CLONE_DIR = "cloneDir";
public void setProperty(String key, Object value) {
Object oldVal = dataModel.get(key);
More information about the jbosstools-commits
mailing list