Permalink
Browse files

[368492] Finish button not disabled when no entries selected

  • Loading branch information...
1 parent 1b220ff commit 0af7bba3f6eb926f40e8d5b79b013ddb84c75efb @elsony elsony committed Aug 21, 2012
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,6 +40,10 @@
protected Map<String, WizardFragment> fragmentMap = new HashMap<String, WizardFragment>();
+ // Storing the NewRuntimeComposite is required to determine if the selected item
+ // by the user is a valid server runtime
+ protected NewRuntimeComposite comp;
+
public NewRuntimeWizardFragment() {
// do nothing
}
@@ -58,7 +62,8 @@ public boolean hasComposite() {
* @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
*/
public Composite createComposite(Composite parent, IWizardHandle wizard) {
- return new NewRuntimeComposite(parent, wizard, getTaskModel(), type, version, runtimeTypeId);
+ comp = new NewRuntimeComposite(parent, wizard, getTaskModel(), type, version, runtimeTypeId);
+ return comp;
}
public List getChildFragments() {
@@ -121,4 +126,13 @@ protected WizardFragment getWizardFragment(String typeId) {
fragmentMap.put(typeId, fragment);
return fragment;
}
+
+ public boolean isComplete(){
+ // If the selected runtime is invalid, the wizard
+ // should not allow the user to press Finish
+ if (comp.hasValidSelectedRuntime()){
+ return true;
+ }
+ return false;
+ }
}
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -202,4 +202,17 @@ public void setVisible(boolean visible) {
c[i].setVisible(visible);
}
}
+
+ /**
+ *
+ * Determines if the selected runtime is a
+ * valid.
+ *
+ */
+ public boolean hasValidSelectedRuntime(){
+ if (runtime == null){
+ return false;
+ }
+ return true;
+ }
}

0 comments on commit 0af7bba

Please sign in to comment.