Author: adietish
Date: 2011-03-21 09:47:02 -0400 (Mon, 21 Mar 2011)
New Revision: 29918
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
[JBIDE-8326] added button that resets all filters
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java 2011-03-21
12:39:36 UTC (rev 29917)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java 2011-03-21
13:47:02 UTC (rev 29918)
@@ -37,6 +37,7 @@
protected final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg";
//$NON-NLS-1$
protected final static String DEFAULT_LABEL = "DefaultButton.label";
//$NON-NLS-1$
+ protected final static String DEFAULT_ALL_LABEL = "DefaultAllButton.label";
//$NON-NLS-1$
private DeltaCloud cloud;
@@ -63,11 +64,14 @@
Button b = (Button) e.widget;
Text text = getTextWidget(b);
if (text != null) {
- text.setText(ICloudElementFilter.ALL_MATCHER_EXPRESSION);
+ resetFilter(text);
}
}
};
+ protected void resetFilter(Text text) {
+ text.setText(ICloudElementFilter.ALL_MATCHER_EXPRESSION);
+ }
protected abstract Text getTextWidget(Button button);
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java 2011-03-21
12:39:36 UTC (rev 29917)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java 2011-03-21
13:47:02 UTC (rev 29918)
@@ -11,11 +11,12 @@
package org.jboss.tools.internal.deltacloud.ui.wizards;
import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -105,111 +106,69 @@
@Override
public void createControl(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
- FormLayout layout = new FormLayout();
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- container.setLayout(layout);
+ GridLayoutFactory.fillDefaults().numColumns(3).spacing(8, 4).applyTo(container);
IImageFilter filter = getDeltaCloud().getImageFilter();
Label label = new Label(container, SWT.NULL);
label.setText(WizardMessages.getString(FILTER_LABEL));
+ GridDataFactory.fillDefaults().span(3, 1).align(SWT.LEFT, SWT.CENTER).indent(0,
14).hint(SWT.DEFAULT, 30)
+ .applyTo(label);
Label nameLabel = createRuleLabel(WizardMessages.getString(NAME_LABEL), container);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(nameLabel);
this.nameText = createRuleText(filter.getNameRule(), container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(nameText);
this.nameDecoration = UIUtils.createErrorDecoration("", nameText);
this.defaultName = createDefaultRuleButton(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultName);
Label idLabel = createRuleLabel(WizardMessages.getString(ID_LABEL), container);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(idLabel);
this.idText = createRuleText(filter.getIdRule(), container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(idText);
this.idDecoration = UIUtils.createErrorDecoration("", idText);
this.defaultId = createDefaultRuleButton(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultId);
Label archLabel = createRuleLabel(WizardMessages.getString(ARCH_LABEL), container);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(archLabel);
this.archText = createRuleText(filter.getArchRule(), container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(archText);
this.archDecoration =
UIUtils.createErrorDecoration(WizardMessages.getString(""), archText);
this.defaultArch = createDefaultRuleButton(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultArch);
Label descLabel = createRuleLabel(WizardMessages.getString(DESC_LABEL), container);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(descLabel);
this.descText = createRuleText(filter.getDescRule(), container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(descText);
this.descDecoration = UIUtils.createErrorDecoration("", descText);
this.defaultDesc = createDefaultRuleButton(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultDesc);
- Point p1 = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point p3 = defaultName.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int centering = (p2.y - p1.y + 1) / 2;
- int centering2 = (p3.y - p2.y + 1) / 2;
+ Label dummyLabel = new Label(container, SWT.NONE);
+ GridDataFactory.fillDefaults().span(2, 1).align(SWT.RIGHT,
SWT.CENTER).applyTo(dummyLabel);
+ Button defaultAllButton = new Button(container, SWT.BORDER);
+ defaultAllButton.setText("Default All");
+ GridDataFactory.fillDefaults().indent(0, 10).align(SWT.RIGHT,
SWT.BOTTOM).applyTo(defaultAllButton);
+ defaultAllButton.addSelectionListener(onDefaultAllPressed());
- FormData f = new FormData();
- f.top = new FormAttachment(0);
- label.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(label, 11 + centering + centering2);
- f.left = new FormAttachment(0, 0);
- nameLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(label, 11);
- f.right = new FormAttachment(100);
- defaultName.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(label, 11 + centering2);
- f.left = new FormAttachment(archLabel, 5);
- f.right = new FormAttachment(defaultName, -10);
- nameText.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(nameLabel, 11 + centering + centering2);
- f.left = new FormAttachment(0, 0);
- idLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(nameLabel, 11);
- f.right = new FormAttachment(100);
- defaultId.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(nameLabel, 11 + centering2);
- f.left = new FormAttachment(archLabel, 5);
- f.right = new FormAttachment(defaultId, -10);
- idText.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(idLabel, 11 + centering + centering2);
- f.left = new FormAttachment(0, 0);
- archLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(idLabel, 11);
- f.right = new FormAttachment(100);
- defaultArch.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(idLabel, 11 + centering2);
- f.left = new FormAttachment(archLabel, 5);
- f.right = new FormAttachment(defaultArch, -10);
- archText.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(archLabel, 11 + centering + centering2);
- f.left = new FormAttachment(0, 0);
- descLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(archLabel, 11);
- f.right = new FormAttachment(100);
- defaultDesc.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(archLabel, 11 + centering2);
- f.left = new FormAttachment(archLabel, 5);
- f.right = new FormAttachment(defaultDesc, -10);
- descText.setLayoutData(f);
-
setControl(container);
setPageComplete(true);
}
+
+ private SelectionListener onDefaultAllPressed() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ resetFilter(nameText);
+ resetFilter(idText);
+ resetFilter(archText);
+ resetFilter(descText);
+ }
+ };
+ }
+
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java 2011-03-21
12:39:36 UTC (rev 29917)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java 2011-03-21
13:47:02 UTC (rev 29918)
@@ -14,6 +14,9 @@
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -134,7 +137,7 @@
keyIdDecoration.hide();
realmDecoration.hide();
profileDecoration.hide();
-
+
String error = null;
error = validate(nameText, nameDecoration, error);
error = validate(idText, idDecoration, error);
@@ -166,7 +169,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(nameText);
this.nameDecoration = UIUtils.createErrorDecoration("", nameText);
this.defaultName = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultName);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultName);
Label aliasLabel = createRuleLabel(WizardMessages.getString(ALIAS_LABEL), container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(aliasLabel);
@@ -174,7 +177,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(aliasText);
this.aliasDecoration = UIUtils.createErrorDecoration("", aliasText);
this.defaultAlias = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultAlias);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultAlias);
Label idLabel = createRuleLabel(WizardMessages.getString(ID_LABEL), container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(idLabel);
@@ -182,7 +185,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(idText);
this.idDecoration = UIUtils.createErrorDecoration("", idText);
this.defaultId = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultId);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultId);
Label imageIdLabel = createRuleLabel(WizardMessages.getString(IMAGE_ID_LABEL),
container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(imageIdLabel);
@@ -190,7 +193,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(imageIdText);
this.imageDecoration = UIUtils.createErrorDecoration("", imageIdText);
this.defaultImageId = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultImageId);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultImageId);
Label ownerIdLabel = createRuleLabel(WizardMessages.getString(OWNER_ID_LABEL),
container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(ownerIdLabel);
@@ -198,7 +201,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(ownerIdText);
this.ownerDecoration = UIUtils.createErrorDecoration("", ownerIdText);
this.defaultOwnerId = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultOwnerId);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultOwnerId);
Label keyNameLabel = createRuleLabel(WizardMessages.getString(KEYNAME_LABEL),
container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(keyNameLabel);
@@ -206,7 +209,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(keyIdText);
this.keyIdDecoration = UIUtils.createErrorDecoration("", keyIdText);
this.defaultKeyId = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultKeyId);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultKeyId);
Label realmLabel = createRuleLabel(WizardMessages.getString(REALM_LABEL), container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(realmLabel);
@@ -214,7 +217,7 @@
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(realmText);
this.realmDecoration = UIUtils.createErrorDecoration("", realmText);
this.defaultRealm = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultRealm);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultRealm);
Label profileLabel = createRuleLabel(WizardMessages.getString(PROFILE_LABEL),
container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(profileLabel);
@@ -222,9 +225,33 @@
this.profileDecoration = UIUtils.createErrorDecoration("", profileText);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(profileText);
this.defaultProfile = createDefaultRuleButton(container);
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(defaultProfile);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(defaultProfile);
+ Label dummyLabel = new Label(container, SWT.NONE);
+ GridDataFactory.fillDefaults().span(2, 1).align(SWT.RIGHT,
SWT.CENTER).applyTo(dummyLabel);
+ Button defaultAllButton = new Button(container, SWT.BORDER);
+ defaultAllButton.setText("Default All");
+ GridDataFactory.fillDefaults().indent(0, 10).align(SWT.RIGHT,
SWT.BOTTOM).applyTo(defaultAllButton);
+ defaultAllButton.addSelectionListener(onDefaultAllPressed());
+
setControl(container);
setPageComplete(true);
}
+
+ private SelectionListener onDefaultAllPressed() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ resetFilter(nameText);
+ resetFilter(idText);
+ resetFilter(aliasText);
+ resetFilter(imageIdText);
+ resetFilter(ownerIdText);
+ resetFilter(keyIdText);
+ resetFilter(realmText);
+ resetFilter(profileText);
+ }
+ };
+ }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2011-03-21
12:39:36 UTC (rev 29917)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2011-03-21
13:47:02 UTC (rev 29918)
@@ -55,6 +55,7 @@
NewButton.label=New...
DeleteButton.label=Delete
DefaultButton.label=Default
+DefaultAllButton.label=Default All
Pem.name=PEM file (*.pem)