Author: adietish
Date: 2011-02-04 11:44:52 -0500 (Fri, 04 Feb 2011)
New Revision: 29013
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java
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/InstanceFilterPage.java
Log:
[JBIDE-8332] added field decorations to FilterImage- and FilterInstance-dialogs
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java 2011-02-04
16:44:52 UTC (rev 29013)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IFieldMatcher;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
+public abstract class AbstractFilterPage extends WizardPage {
+
+ protected final static String EMPTY_RULE = "ErrorFilterEmptyRule.msg";
//$NON-NLS-1$
+ protected final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg";
//$NON-NLS-1$
+
+ protected final static String DEFAULT_LABEL = "DefaultButton.label";
//$NON-NLS-1$
+
+ private DeltaCloud cloud;
+
+ public AbstractFilterPage(String name, String title, String description, DeltaCloud
cloud) {
+ super(name);
+ this.cloud = cloud;
+ setTitle(title);
+ setDescription(description);
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ private ModifyListener textListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+ };
+
+ private SelectionAdapter buttonListener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button b = (Button) e.widget;
+ Text text = getTextWidget(b);
+ if (text != null) {
+ text.setText(ICloudElementFilter.ALL_MATCHER_EXPRESSION);
+ }
+ }
+ };
+
+
+ protected abstract Text getTextWidget(Button button);
+
+ protected abstract void validate();
+
+ protected String validate(Text text, ControlDecoration decoration, String formError) {
+ String error = null;
+ if (text.getText().length() == 0) {
+ error = WizardMessages.getString(EMPTY_RULE);
+ } else if (text.getText().contains(ICloudElementFilter.EXPRESSION_DELIMITER)) {
+ error = WizardMessages.getString(INVALID_SEMICOLON);
+ }
+ if (error != null) {
+ decoration.setDescriptionText(error);
+ decoration.show();
+ setPageComplete(false);
+ setErrorMessage(error);
+ return error;
+ } else {
+ return formError;
+ }
+ }
+
+ protected Label createRuleLabel(String text, Composite container) {
+ Label label = new Label(container, SWT.NULL);
+ label.setText(text);
+ return label;
+ }
+
+ protected Button createDefaultRuleButton(final Composite container) {
+ Button button = new Button(container, SWT.NULL);
+ button.setText(WizardMessages.getString(DEFAULT_LABEL));
+ button.addSelectionListener(buttonListener);
+ return button;
+ }
+
+ protected Text createRuleText(IFieldMatcher rule, final Composite container) {
+ Assert.isNotNull(rule, "Rule may not be null");
+
+ Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
+ text.setText(rule.toString());
+ text.addModifyListener(textListener);
+ return text;
+ }
+
+ protected DeltaCloud getDeltaCloud() {
+ return cloud;
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/AbstractFilterPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-02-04
16:35:57 UTC (rev 29012)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java 2011-02-04
16:44:52 UTC (rev 29013)
@@ -10,14 +10,8 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
@@ -27,30 +21,23 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IFieldMatcher;
import org.jboss.tools.deltacloud.core.IImageFilter;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
* @author Jeff Johnston
*/
-public class ImageFilterPage extends WizardPage {
+public class ImageFilterPage extends AbstractFilterPage {
private final static String NAME = "ImageFilter.name"; //$NON-NLS-1$
private final static String TITLE = "ImageFilter.title"; //$NON-NLS-1$
private final static String DESC = "ImageFilter.desc"; //$NON-NLS-1$
private final static String FILTER_LABEL = "ImageFilter.label"; //$NON-NLS-1$
- private final static String EMPTY_RULE = "ErrorFilterEmptyRule.msg";
//$NON-NLS-1$
- private final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg";
//$NON-NLS-1$
private final static String NAME_LABEL = "Name.label"; //$NON-NLS-1$
private final static String ID_LABEL = "Id.label"; //$NON-NLS-1$
private final static String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
private final static String DESC_LABEL = "Desc.label"; //$NON-NLS-1$
- private final static String DEFAULT_LABEL = "DefaultButton.label";
//$NON-NLS-1$
- private DeltaCloud cloud;
private Text nameText;
private ControlDecoration nameDecoration;
private Button defaultName;
@@ -65,11 +52,7 @@
private Button defaultDesc;
public ImageFilterPage(DeltaCloud cloud) {
- super(WizardMessages.getString(NAME));
- this.cloud = cloud;
- setDescription(WizardMessages.getString(DESC));
- setTitle(WizardMessages.getString(TITLE));
- setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ super(WizardMessages.getString(NAME), WizardMessages.getString(TITLE),
WizardMessages.getString(DESC), cloud);
setPageComplete(false);
}
@@ -89,44 +72,23 @@
return descText.getText();
}
- private ModifyListener textListener = new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
+ @Override
+ protected Text getTextWidget(Button button) {
+ Text text = null;
+ if (button == defaultName) {
+ text = nameText;
+ } else if (button == defaultId) {
+ text = idText;
+ } else if (button == defaultArch) {
+ text = archText;
+ } else if (button == defaultDesc) {
+ text = descText;
}
- };
+ return text;
+ }
- private SelectionAdapter buttonListener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- Button b = (Button) e.widget;
- Text text = getTextWidget(b);
- if (text != null) {
- text.setText(ICloudElementFilter.ALL_MATCHER_EXPRESSION);
- }
- }
-
- private Text getTextWidget(Button button) {
- Text text = null;
- if (button == defaultName) {
- text = nameText;
- }
- else if (button == defaultId) {
- text = idText;
- }
- else if (button == defaultArch) {
- text = archText;
- }
- else if (button == defaultDesc) {
- text = descText;
- }
- return text;
- }
-
- };
-
- private void validate() {
+ @Override
+ protected void validate() {
nameDecoration.hide();
idDecoration.hide();
archDecoration.hide();
@@ -139,24 +101,6 @@
setPageComplete(error == null);
setErrorMessage(error);
}
-
- private String validate(Text text, ControlDecoration decoration, String formError) {
- String error = null;
- if (text.getText().length() == 0) {
- error = WizardMessages.getString(EMPTY_RULE);
- } else if (text.getText().contains(ICloudElementFilter.EXPRESSION_DELIMITER)) {
- error = WizardMessages.getString(INVALID_SEMICOLON);
- }
- if (error != null) {
- decoration.setDescriptionText(error);
- decoration.show();
- setPageComplete(false);
- setErrorMessage(error);
- return error;
- } else {
- return formError;
- }
- }
@Override
public void createControl(Composite parent) {
@@ -166,7 +110,7 @@
layout.marginWidth = 5;
container.setLayout(layout);
- IImageFilter filter = cloud.getImageFilter();
+ IImageFilter filter = getDeltaCloud().getImageFilter();
Label label = new Label(container, SWT.NULL);
label.setText(WizardMessages.getString(FILTER_LABEL));
@@ -268,27 +212,4 @@
setControl(container);
setPageComplete(true);
}
-
- private Label createRuleLabel(String text, Composite container) {
- Label label = new Label(container, SWT.NULL);
- label.setText(text);
- return label;
- }
-
- private Button createDefaultRuleButton(final Composite container) {
- Button button = new Button(container, SWT.NULL);
- button.setText(WizardMessages.getString(DEFAULT_LABEL));
- button.addSelectionListener(buttonListener);
- return button;
- }
-
- private Text createRuleText(IFieldMatcher rule, final Composite container) {
- Assert.isNotNull(rule, "Rule may not be null");
-
- Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
- text.setText(rule.toString());
- text.addModifyListener(textListener);
- return text;
- }
-
}
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-02-04
16:35:57 UTC (rev 29012)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java 2011-02-04
16:44:52 UTC (rev 29013)
@@ -10,36 +10,27 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IFieldMatcher;
import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
* @author Jeff Johnston
*/
-public class InstanceFilterPage extends WizardPage {
+public class InstanceFilterPage extends AbstractFilterPage {
private final static String NAME = "InstanceFilter.name"; //$NON-NLS-1$
private final static String TITLE = "InstanceFilter.title"; //$NON-NLS-1$
private final static String DESC = "InstanceFilter.desc"; //$NON-NLS-1$
private final static String FILTER_LABEL = "InstanceFilter.label";
//$NON-NLS-1$
- private final static String EMPTY_RULE = "ErrorFilterEmptyRule.msg";
//$NON-NLS-1$
- private final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg";
//$NON-NLS-1$
private final static String NAME_LABEL = "Name.label"; //$NON-NLS-1$
private final static String ID_LABEL = "Id.label"; //$NON-NLS-1$
private final static String ALIAS_LABEL = "Alias.label"; //$NON-NLS-1$
@@ -48,34 +39,34 @@
private final static String KEYNAME_LABEL = "Key.label"; //$NON-NLS-1$
private final static String REALM_LABEL = "Realm.label"; //$NON-NLS-1$
private final static String PROFILE_LABEL = "Profile.label"; //$NON-NLS-1$
- private final static String DEFAULT_LABEL = "DefaultButton.label";
//$NON-NLS-1$
- private DeltaCloud cloud;
private Text nameText;
- private Text idText;
- private Text aliasText;
- private Text imageIdText;
- private Text ownerIdText;
- private Text keyIdText;
- private Text realmText;
- private Text profileText;
-
+ private ControlDecoration nameDecoration;
private Button defaultName;
+ private Text idText;
+ private ControlDecoration idDecoration;
private Button defaultId;
+ private Text aliasText;
+ private ControlDecoration aliasDecoration;
private Button defaultAlias;
+ private Text imageIdText;
+ private ControlDecoration imageDecoration;
private Button defaultImageId;
+ private Text ownerIdText;
private Button defaultOwnerId;
+ private ControlDecoration ownerDecoration;
+ private Text keyIdText;
+ private ControlDecoration keyIdDecoration;
private Button defaultKeyId;
+ private Text realmText;
+ private ControlDecoration realmDecoration;
private Button defaultRealm;
+ private Text profileText;
+ private ControlDecoration profileDecoration;
private Button defaultProfile;
public InstanceFilterPage(DeltaCloud cloud) {
- super(WizardMessages.getString(NAME));
- this.cloud = cloud;
- setDescription(WizardMessages.getString(DESC));
- setTitle(WizardMessages.getString(TITLE));
- setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
- setPageComplete(false);
+ super(WizardMessages.getString(NAME), WizardMessages.getString(TITLE),
WizardMessages.getString(DESC), cloud);
}
public String getNameRule() {
@@ -110,102 +101,70 @@
return profileText.getText();
}
- private ModifyListener Listener = new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- // TODO Auto-generated method stub
- validate();
+ @Override
+ protected Text getTextWidget(Button button) {
+ Text text = null;
+ if (button == defaultName) {
+ text = nameText;
+ } else if (button == defaultId) {
+ text = idText;
+ } else if (button == defaultAlias) {
+ text = aliasText;
+ } else if (button == defaultImageId) {
+ text = imageIdText;
+ } else if (button == defaultOwnerId) {
+ text = ownerIdText;
+ } else if (button == defaultKeyId) {
+ text = keyIdText;
+ } else if (button == defaultRealm) {
+ text = realmText;
+ } else if (button == defaultProfile) {
+ text = profileText;
}
- };
+ return text;
+ }
- private SelectionAdapter buttonListener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- Button b = (Button) e.widget;
- Text text = getTextWidget(b);
- if (text != null) {
- text.setText(ICloudElementFilter.ALL_MATCHER_EXPRESSION);
- }
- }
-
- private Text getTextWidget(Button button) {
- Text text = null;
- if (button == defaultName) {
- text = nameText;
- }
- else if (button == defaultId) {
- text = idText;
- }
- else if (button == defaultAlias) {
- text = aliasText;
- }
- else if (button == defaultImageId) {
- text = imageIdText;
- }
- else if (button == defaultOwnerId) {
- text = ownerIdText;
- }
- else if (button == defaultKeyId) {
- text = keyIdText;
- }
- else if (button == defaultRealm) {
- text = realmText;
- }
- else if (button == defaultProfile) {
- text = profileText;
- }
- return text;
- }
- };
-
- private void validate() {
- boolean complete = true;
- boolean error = false;
-
- if (nameText.getText().length() == 0 ||
- idText.getText().length() == 0 ||
- aliasText.getText().length() == 0 ||
- imageIdText.getText().length() == 0 ||
- ownerIdText.getText().length() == 0 ||
- keyIdText.getText().length() == 0 ||
- realmText.getText().length() == 0 ||
- profileText.getText().length() == 0) {
-
- setErrorMessage(WizardMessages.getString(EMPTY_RULE));
- error = true;
- } else if (nameText.getText().contains(";") ||
- idText.getText().contains(";") ||
- aliasText.getText().contains(";") ||
- imageIdText.getText().contains(";") ||
- ownerIdText.getText().contains(";") ||
- keyIdText.getText().contains(";") ||
- realmText.getText().contains(";") ||
- profileText.getText().contains(";")) {
- setErrorMessage(WizardMessages.getString(INVALID_SEMICOLON));
- error = true;
- }
-
- if (!error)
- setErrorMessage(null);
- setPageComplete(complete && !error);
+ @Override
+ protected void validate() {
+ nameDecoration.hide();
+ idDecoration.hide();
+ aliasDecoration.hide();
+ imageDecoration.hide();
+ ownerDecoration.hide();
+ keyIdDecoration.hide();
+ realmDecoration.hide();
+ profileDecoration.hide();
+
+ String error = null;
+ error = validate(nameText, nameDecoration, error);
+ error = validate(idText, idDecoration, error);
+ error = validate(aliasText, aliasDecoration, error);
+ error = validate(imageIdText, imageDecoration, error);
+ error = validate(ownerIdText, ownerDecoration, error);
+ error = validate(keyIdText, keyIdDecoration, error);
+ error = validate(realmText, realmDecoration, error);
+ error = validate(profileText, profileDecoration, error);
+ setPageComplete(error == null);
+ setErrorMessage(error);
}
@Override
public void createControl(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
GridLayoutFactory.fillDefaults().numColumns(3).spacing(8, 4).applyTo(container);
-
+
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);
-
- IInstanceFilter filter = cloud.getInstanceFilter();
+ GridDataFactory.fillDefaults().span(3, 1).align(SWT.LEFT, SWT.CENTER).indent(0,
14).hint(SWT.DEFAULT, 30)
+ .applyTo(label);
+ IInstanceFilter filter = getDeltaCloud().getInstanceFilter();
+
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.RIGHT, SWT.CENTER).applyTo(defaultName);
@@ -213,6 +172,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(aliasLabel);
this.aliasText = createRuleText(filter.getAliasRule(), container);
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);
@@ -220,6 +180,7 @@
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.RIGHT, SWT.CENTER).applyTo(defaultId);
@@ -227,6 +188,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(imageIdLabel);
this.imageIdText = createRuleText(filter.getImageIdRule(), container);
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);
@@ -234,6 +196,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(ownerIdLabel);
this.ownerIdText = createRuleText(filter.getOwnerIdRule(), container);
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);
@@ -241,6 +204,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(keyNameLabel);
this.keyIdText = createRuleText(filter.getKeyNameRule(), container);
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);
@@ -248,12 +212,14 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(realmLabel);
this.realmText = createRuleText(filter.getRealmRule(), container);
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);
Label profileLabel = createRuleLabel(WizardMessages.getString(PROFILE_LABEL),
container);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(profileLabel);
this.profileText = createRuleText(filter.getProfileRule(), container);
+ 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);
@@ -261,26 +227,4 @@
setControl(container);
setPageComplete(true);
}
-
- private Label createRuleLabel(String text, Composite container) {
- Label label = new Label(container, SWT.NULL);
- label.setText(text);
- return label;
- }
-
- private Button createDefaultRuleButton(final Composite container) {
- Button button = new Button(container, SWT.NULL);
- button.setText(WizardMessages.getString(DEFAULT_LABEL));
- button.addSelectionListener(buttonListener);
- return button;
- }
-
- private Text createRuleText(IFieldMatcher rule, final Composite container) {
- Assert.isNotNull(rule, "Rule may not be null");
-
- Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
- text.setText(rule.toString());
- text.addModifyListener(Listener);
- return text;
- }
}