Author: akazakov
Date: 2008-04-09 10:25:50 -0400 (Wed, 09 Apr 2008)
New Revision: 7463
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/wizard/SeamWizardFactory.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1994 Fixed
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 2008-04-09
14:22:54 UTC (rev 7462)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-04-09
14:25:50 UTC (rev 7463)
@@ -142,7 +142,7 @@
IFieldEditor seamRuntimeEditor =
SeamWizardFactory.createSeamRuntimeSelectionFieldEditor(
getSeamVersions(),
- getSeamRuntimeName());
+ getSeamRuntimeName(), true);
seamRuntimeEditor.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Object value = evt.getNewValue();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2008-04-09
14:22:54 UTC (rev 7462)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2008-04-09
14:25:50 UTC (rev 7463)
@@ -162,12 +162,30 @@
* @return Editor to select seam runtime
*/
public static IFieldEditor createSeamRuntimeSelectionFieldEditor(SeamVersion[]
seamVersions, String defaultValue, NewSeamRuntimeAction action) {
+ return createSeamRuntimeSelectionFieldEditor(seamVersions, defaultValue, action,
false);
+ }
+
+ /**
+ * @param seamVersions Array of seam runtime versions. If length == 0 then use all
versions
+ * @param defaultSelection
+ * @param action
+ * @param canBeEmpty
+ * @return Editor to select seam runtime
+ */
+ public static IFieldEditor createSeamRuntimeSelectionFieldEditor(SeamVersion[]
seamVersions, String defaultValue, NewSeamRuntimeAction action, boolean canBeEmpty) {
if(seamVersions.length==0) {
seamVersions = SeamVersion.ALL_VERSIONS;
}
+ List<String> names = getRuntimeNames(seamVersions);
+ if(defaultValue!=null && defaultValue.trim().length()>0 &&
!names.contains(defaultValue)) {
+ names.add(0, defaultValue);
+ }
+ if(canBeEmpty) {
+ names.add(0, "");
+ }
IFieldEditor jBossSeamRuntimeEditor = IFieldEditorFactory.INSTANCE
.createComboWithButton(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
- SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_SEAM_RUNTIME, getRuntimeNames(seamVersions),
+ SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_SEAM_RUNTIME, names,
defaultValue,
true, action, (IValidator)null);
return jBossSeamRuntimeEditor;
@@ -376,8 +394,18 @@
* @return Editor to select seam runtime
*/
public static IFieldEditor createSeamRuntimeSelectionFieldEditor(SeamVersion[]
seamVersions, String defaultValue) {
+ return createSeamRuntimeSelectionFieldEditor(seamVersions, defaultValue, false);
+ }
+
+ /**
+ * @param seamVersions Array of seam runtime versions. If length == 0 then use all
versions
+ * @param defaultSelection
+ * @param canBeEmpty
+ * @return Editor to select seam runtime
+ */
+ public static IFieldEditor createSeamRuntimeSelectionFieldEditor(SeamVersion[]
seamVersions, String defaultValue, boolean canBeEmpty) {
DefaultNewSeamRuntimeAction action = new DefaultNewSeamRuntimeAction(seamVersions);
- IFieldEditor jBossSeamRuntimeEditor =
createSeamRuntimeSelectionFieldEditor(seamVersions, defaultValue, action);
+ IFieldEditor jBossSeamRuntimeEditor =
createSeamRuntimeSelectionFieldEditor(seamVersions, defaultValue, action, canBeEmpty);
action.setRuntimeSelectionEditor(jBossSeamRuntimeEditor);
return jBossSeamRuntimeEditor;
}
@@ -387,10 +415,7 @@
* @return Editor to select seam runtime of all versions
*/
public static IFieldEditor createSeamRuntimeSelectionFieldEditor(String defaultValue) {
- DefaultNewSeamRuntimeAction action = new DefaultNewSeamRuntimeAction(new
SeamVersion[0]);
- IFieldEditor jBossSeamRuntimeEditor = createSeamRuntimeSelectionFieldEditor(new
SeamVersion[0], defaultValue, action);
- action.setRuntimeSelectionEditor(jBossSeamRuntimeEditor);
- return jBossSeamRuntimeEditor;
+ return createSeamRuntimeSelectionFieldEditor(new SeamVersion[0], defaultValue, false);
}
private static List<String> getRuntimeNames(SeamVersion[] seamVersions) {