Author: rob.stryker(a)jboss.com
Date: 2008-10-20 18:30:16 -0400 (Mon, 20 Oct 2008)
New Revision: 11019
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
Log:
JBIDE-2235
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2008-10-20
22:05:56 UTC (rev 11018)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2008-10-20
22:30:16 UTC (rev 11019)
@@ -221,10 +221,11 @@
public static String EditorCPD_Value;
public static String EditorCPD_DefaultShellTitle;
public static String EditorCPD_DefaultDescription;
+ public static String EditorCPD_RestoreDefault;
- public static String Customize;
+ public static String Configure;
// misc
public static String ServerSaveFailed;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2008-10-20
22:05:56 UTC (rev 11018)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2008-10-20
22:30:16 UTC (rev 11019)
@@ -199,7 +199,8 @@
EditorCPD_Value=Current Value
EditorCPD_DefaultShellTitle=Edit Port
EditorCPD_DefaultDescription=This wizard allows you to edit which xpath is used to locate
a port used by the tooling.\nThis will not change any server files, only what ports are
used to interact with it.
-Customize=Customize...
+EditorCPD_RestoreDefault=Restore Default
+Configure=Configure...
# misc
ServerSaveFailed=Server save failed
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java 2008-10-20
22:05:56 UTC (rev 11018)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ChangePortDialog.java 2008-10-20
22:30:16 UTC (rev 11019)
@@ -34,7 +34,7 @@
import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs.XPathDialog;
public class ChangePortDialog extends TitleAreaDialog {
-
+ private static final int RESTORE_DEFAULT = 35;
public static class ChangePortDialogInfo {
public String port;
public String defaultValue;
@@ -71,6 +71,7 @@
: Messages.EditorCPD_DefaultDescription);
getShell().setText(info.shellTitle != null ? info.shellTitle
: Messages.EditorCPD_DefaultShellTitle);
+ selectionChanged();
return c;
}
@@ -118,7 +119,7 @@
String[] stuff = (String[]) list.toArray(new String[list.size()]);
listWidget.setItems(stuff);
for( int i = 0; i < stuff.length; i++ )
- if( stuff[i] == info.currentXPath)
+ if( stuff[i].equals(info.currentXPath))
listWidget.select(i);
}
@@ -223,4 +224,21 @@
public String getSelection() {
return selected;
}
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ createButton(parent, RESTORE_DEFAULT, Messages.EditorCPD_RestoreDefault, false);
+ }
+
+ protected void buttonPressed(int buttonId) {
+ super.buttonPressed(buttonId);
+ if( RESTORE_DEFAULT == buttonId) {
+ String[] items = listWidget.getItems();
+ for( int i = 0; i < items.length; i++ )
+ if( items[i].equals(info.defaultValue)) {
+ listWidget.select(i);
+ return;
+ }
+ }
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2008-10-20
22:05:56 UTC (rev 11018)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2008-10-20
22:30:16 UTC (rev 11019)
@@ -91,7 +91,7 @@
return new SetPortCommand(helper.getWorkingCopy(), helper,
Messages.EditorChangeJNDICommandName,
IJBossServerConstants.JNDI_PORT, IJBossServerConstants.JNDI_PORT_DETECT,
IJBossServerConstants.JNDI_PORT_DETECT_XPATH,
IJBossServerConstants.JNDI_PORT_DEFAULT_XPATH,
- text, detect, currentXPath, listener);
+ this);
}
protected ChangePortDialogInfo getDialogInfo() {
ChangePortDialogInfo info = new ChangePortDialogInfo();
@@ -114,7 +114,7 @@
return new SetPortCommand(helper.getWorkingCopy(), helper,
Messages.EditorChangeWebCommandName,
IJBossServerConstants.WEB_PORT, IJBossServerConstants.WEB_PORT_DETECT,
IJBossServerConstants.WEB_PORT_DETECT_XPATH,
IJBossServerConstants.WEB_PORT_DEFAULT_XPATH,
- text, detect, currentXPath, listener);
+ this);
}
protected ChangePortDialogInfo getDialogInfo() {
ChangePortDialogInfo info = new ChangePortDialogInfo();
@@ -187,12 +187,13 @@
label.setText(labelText);
detect.setText(Messages.EditorAutomaticallyDetectPort);
- link.setText("<a href=\"\">" + Messages.Customize +
"</a>");
+ link.setText("<a href=\"\">" + Messages.Configure +
"</a>");
return child;
}
protected void initialize() {
boolean shouldDetect = helper.getAttribute(detectXPathKey, true);
detect.setSelection(shouldDetect);
+ link.setEnabled(shouldDetect);
text.setEnabled(!shouldDetect);
text.setEditable(!shouldDetect);
currentXPath = helper.getAttribute(currentXPathKey, defaultXPath);
@@ -315,19 +316,21 @@
Button button;
Listener listener;
String xpath;
+ Link link;
public SetPortCommand(IServerWorkingCopy server, ServerAttributeHelper helper, String
name,
String textAttribute, String overrideAttribute, String overridePathAttribute,
- String pathDefault, Text text, Button button, String xpath, Listener listener) {
+ String pathDefault, PortEditorExtension ext) { //Text text, Button button, String
xpath, Listener listener) {
super(server, name);
this.helper = helper;
this.textAttribute = textAttribute;
this.overrideAttribute = overrideAttribute;
this.overridePathAttribute = overridePathAttribute;
this.defaultPath = pathDefault;
- this.text = text;
- this.button = button;
- this.listener = listener;
- this.xpath = xpath;
+ this.text = ext.text;
+ this.button = ext.detect;
+ this.listener = ext.listener;
+ this.xpath = ext.currentXPath;
+ this.link = ext.link;
}
public void execute() {
@@ -338,6 +341,7 @@
preOverride = helper.getAttribute(overrideAttribute, true);
helper.setAttribute(textAttribute, text.getText());
helper.setAttribute(overrideAttribute, button.getSelection());
+ link.setEnabled(button.getSelection());
helper.setAttribute(overridePathAttribute, xpath);
text.setEnabled(!button.getSelection());
@@ -353,8 +357,9 @@
// set new values
helper.setAttribute(textAttribute, preText);
helper.setAttribute(overrideAttribute, preOverride);
+ link.setEnabled(preOverride);
helper.setAttribute(overridePathAttribute, prePath);
-
+
// update ui
text.removeListener(SWT.Modify, listener);
button.removeListener(SWT.Selection, listener);