Author: akazakov
Date: 2008-04-09 09:00:47 -0400 (Wed, 09 Apr 2008)
New Revision: 7449
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/widget/editor/BaseFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.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-1990
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
12:51:38 UTC (rev 7448)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-04-09
13:00:47 UTC (rev 7449)
@@ -163,7 +163,7 @@
registerEditor(projectNameEditor, generalGroup);
- IFieldEditor connProfileEditor =
SeamWizardFactory.createConnectionProfileSelectionFieldEditor(getConnectionProfile(),
ValidatorFactory.NO_ERRORS_VALIDATOR);
+ IFieldEditor connProfileEditor =
SeamWizardFactory.createConnectionProfileSelectionFieldEditor(getConnectionProfile(),
ValidatorFactory.NO_ERRORS_VALIDATOR, true);
registerEditor(connProfileEditor, generalGroup);
Group deploymentGroup = createGroup(
@@ -434,9 +434,11 @@
}
private String getConnectionProfile() {
- String defaultDs = SeamProjectPreferences.getStringPreference(
- SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE);
- return getProfileNameList().contains(defaultDs)?defaultDs:""; //$NON-NLS-1$
+ String ds = preferences.get(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
null);
+ if(ds==null) {
+ ds =
SeamProjectPreferences.getStringPreference(SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE);
+ }
+ return (ds!=null && getProfileNameList().contains(ds))?ds:"";
//$NON-NLS-1$
}
private String getEjbProjectName() {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2008-04-09
12:51:38 UTC (rev 7448)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2008-04-09
13:00:47 UTC (rev 7449)
@@ -166,6 +166,9 @@
public void setEnabled(boolean enabled) {
this.enabled = enabled;
Control[] controls = getSwtControls();
+ if(controls==null) {
+ return;
+ }
for(int i=0;i<controls.length;i++) {
Control control = controls[i];
control.setEnabled(enabled);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2008-04-09
12:51:38 UTC (rev 7448)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2008-04-09
13:00:47 UTC (rev 7449)
@@ -42,13 +42,16 @@
buttonAction = action;
buttonAction.setFieldEditor(this);
}
-
+
@Override
public void doFillIntoGrid(Object parent) {
}
@Override
public Object[] getEditorControls() {
+ if(button==null) {
+ return null;
+ }
return new Control[]{button.getControl()};
}
@@ -68,6 +71,7 @@
public Object[] getEditorControls(Object composite) {
if(button==null && composite!=null) {
button = new PushButtonField((Composite)composite,buttonAction);
+ setEnabled(isEnabled());
}
return new Control[]{button.getControl()};
}
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
12:51:38 UTC (rev 7448)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2008-04-09
13:00:47 UTC (rev 7449)
@@ -11,6 +11,8 @@
package org.jboss.tools.seam.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -174,24 +176,48 @@
/**
* Creates Selection Field of Connection Profiles
* @param defaultValue
+ * @param canBeEmpty
* @return
*/
- public static IFieldEditor createConnectionProfileSelectionFieldEditor(Object
defaultValue, IValidator validator) {
+ public static IFieldEditor createConnectionProfileSelectionFieldEditor(Object
defaultValue, IValidator validator, boolean canBeEmpty) {
EditConnectionProfileAction editAction = new EditConnectionProfileAction(validator);
NewConnectionProfileAction newAction = new NewConnectionProfileAction(validator);
+ List<String> profiles = getConnectionProfileNameList();
+ if(canBeEmpty) {
+ profiles.add(0, "");
+ }
IFieldEditor connProfileSelEditor =
IFieldEditorFactory.INSTANCE.createComboWithTwoButtons(
ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_CONNECTION_PROFILE,
- getConnectionProfileNameList(),
+ profiles,
defaultValue,
false, editAction,
newAction,
ValidatorFactory.NO_ERRORS_VALIDATOR);
editAction.setEditor(connProfileSelEditor);
newAction.setEditor(connProfileSelEditor);
+ final ButtonFieldEditor editButton =
(ButtonFieldEditor)((CompositeEditor)connProfileSelEditor).getEditors().get(2);
+ editButton.setEnabled(!"".equals(defaultValue));
+ if(canBeEmpty) {
+ connProfileSelEditor.addPropertyChangeListener(new PropertyChangeListener(){
+ public void propertyChange(PropertyChangeEvent evt) {
+ boolean ediatble = !"".equals(evt.getNewValue());
+ editButton.setEnabled(ediatble);
+ }
+ });
+ }
return connProfileSelEditor;
}
+ /**
+ * Creates Selection Field of Connection Profiles
+ * @param defaultValue
+ * @return
+ */
+ public static IFieldEditor createConnectionProfileSelectionFieldEditor(Object
defaultValue, IValidator validator) {
+ return createConnectionProfileSelectionFieldEditor(defaultValue, validator, false);
+ }
+
private static class EditConnectionProfileAction extends
ButtonFieldEditor.ButtonPressedAction {
private IValidator validator;