Author: scabanovich
Date: 2007-10-18 07:54:48 -0400 (Thu, 18 Oct 2007)
New Revision: 4329
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
JBIDE-982
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-10-18
11:46:12 UTC (rev 4328)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-10-18
11:54:48 UTC (rev 4329)
@@ -15,6 +15,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@@ -84,9 +86,18 @@
seamEnablement.setValue(hasSeamSupport);
SeamRuntime rs = SeamRuntimeManager.getInstance().getDefaultRuntime();
+
+ Set<String> names = new TreeSet<String>();
+ names.addAll(SeamRuntimeManager.getInstance().getRuntimeNames());
+ if(hasSeamSupport) {
+ String currentName = seamProject.getRuntimeName();
+ if(currentName != null) names.add(currentName);
+ }
+ List<String> namesAsList = new ArrayList<String>();
+ namesAsList.addAll(names);
runtime =
IFieldEditorFactory.INSTANCE.createComboWithButton(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_RUNTIME,
- SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_RUNTIME,
SeamRuntimeManager.getInstance().getRuntimeNames(),
+ SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_RUNTIME, namesAsList,
rs==null?"":rs.getName(),true,new NewSeamRuntimeAction(),(IValidator)null);
//$NON-NLS-1$
List<IFieldEditor> editorOrder = new ArrayList<IFieldEditor>();
@@ -94,9 +105,9 @@
editorOrder.add(runtime);
if (hasSeamSupport) {
- SeamRuntime current = seamProject.getRuntime();
- if (current != null) {
- runtime.setValue(current.getName());
+ String currentName = seamProject.getRuntimeName();
+ if (currentName != null) {
+ runtime.setValue(currentName);
} else {
runtime.setValue("");
}
@@ -148,6 +159,7 @@
} else if(hasDependents(project)) {
setEnablement(seamEnablement, false);
}
+ validate();
return composite;
}
@@ -253,8 +265,13 @@
// setErrorMessage(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_IS_NOT_SELECTED);
} else {
setValid(true);
- setErrorMessage(null);
- setMessage(null, IMessageProvider.WARNING);
+ String value = runtime.getValueAsString();
+ if(Boolean.TRUE.equals(seamEnablement.getValue()) &&
SeamRuntimeManager.getInstance().findRuntimeByName(value) == null) {
+ setErrorMessage("Runtime " + value + " does not exist.");
+ } else {
+ setErrorMessage(null);
+ setMessage(null, IMessageProvider.WARNING);
+ }
}
}