changeset 135:eef52fe80553

Make wizard page names describe functionality Make it easier to share wizard pages between wizards by making names reflect purpose rather than which wizard is using them.
author Omair Majid <omajid@redhat.com>
date Tue, 03 Jun 2014 17:32:08 -0400
parents 01068177f080
children 31d0ab4467ad
files com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/NewProjectInformationPage.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreationWizard.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlProjectSelectionPage.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizard.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizardPage.java
diffstat 7 files changed, 161 insertions(+), 156 deletions(-) [+]
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java	Tue Jun 03 17:32:07 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java	Tue Jun 03 17:32:08 2014 -0400
@@ -78,15 +78,15 @@
     public static String PluginXmlProjectSelectionPage_projectNameLabel;
     public static String PluginXmlProjectSelectionPage_title;
     public static String ThermostatProjectCreationWizard_dialogTitle;
-    public static String ThermostatProjectCreationWizardPage_artifactIdLabel;
-    public static String ThermostatProjectCreationWizardPage_groupIdLabel;
-    public static String ThermostatProjectCreationWizardPage_packagePrefixLabel;
-    public static String ThermostatProjectCreationWizardPage_thermostatVersionErrorMessage;
-    public static String ThermostatProjectCreationWizardPage_thermostatVersionLabel;
-    public static String ThermostatProjectCreationWizardPage_versionErrorMessage;
-    public static String ThermostatProjectCreationWizardPage_versionLabel;
-    public static String ThermostatProjectCreationWizardPage_wizardDescription;
-    public static String ThermostatProjectCreationWizardPage_wizardTitle;
+    public static String NewProjectInformationPage_artifactIdLabel;
+    public static String NewProjectInformationPage_groupIdLabel;
+    public static String NewProjectInformationPage_packagePrefixLabel;
+    public static String NewProjectInformationPage_thermostatVersionErrorMessage;
+    public static String NewProjectInformationPage_thermostatVersionLabel;
+    public static String NewProjectInformationPage_versionErrorMessage;
+    public static String NewProjectInformationPage_versionLabel;
+    public static String NewProjectInformationPage_wizardDescription;
+    public static String NewProjectInformationPage_wizardTitle;
 
     static {
         // initialize resource bundle
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties	Tue Jun 03 17:32:07 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties	Tue Jun 03 17:32:08 2014 -0400
@@ -70,12 +70,12 @@
 PluginXmlProjectSelectionPage_projectNameLabel=&Project:
 PluginXmlProjectSelectionPage_title=Thermostat Wizard
 ThermostatProjectCreationWizard_dialogTitle=Create New Thermostat Plugin
-ThermostatProjectCreationWizardPage_artifactIdLabel=Artifact Id
-ThermostatProjectCreationWizardPage_groupIdLabel=Group Id
-ThermostatProjectCreationWizardPage_packagePrefixLabel=Package Prefix
-ThermostatProjectCreationWizardPage_thermostatVersionErrorMessage=Invalid thermostat version
-ThermostatProjectCreationWizardPage_thermostatVersionLabel=Thermostat Version
-ThermostatProjectCreationWizardPage_versionErrorMessage=Version must not be empty
-ThermostatProjectCreationWizardPage_versionLabel=Version
-ThermostatProjectCreationWizardPage_wizardDescription=This wizard creates a new Thermostat Plugin.
-ThermostatProjectCreationWizardPage_wizardTitle=Thermostat projects Wizard
+NewProjectInformationPage_artifactIdLabel=Artifact Id
+NewProjectInformationPage_groupIdLabel=Group Id
+NewProjectInformationPage_packagePrefixLabel=Package Prefix
+NewProjectInformationPage_thermostatVersionErrorMessage=Invalid thermostat version
+NewProjectInformationPage_thermostatVersionLabel=Thermostat Version
+NewProjectInformationPage_versionErrorMessage=Version must not be empty
+NewProjectInformationPage_versionLabel=Version
+NewProjectInformationPage_wizardDescription=This wizard creates a new Thermostat Plugin.
+NewProjectInformationPage_wizardTitle=Thermostat projects Wizard
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/NewProjectInformationPage.java	Tue Jun 03 17:32:08 2014 -0400
@@ -0,0 +1,135 @@
+package com.redhat.thermostat.tools.eclipse.plugin.wizards;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.wizard.WizardPageSupport;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.redhat.thermostat.tools.eclipse.plugin.Messages;
+import com.redhat.thermostat.tools.eclipse.plugin.Validators;
+
+public class NewProjectInformationPage extends WizardPage {
+
+    static final String PAGE_NAME = "newProjectInformation"; //$NON-NLS-1$
+
+    private ProjectModel model = new ProjectModel();
+    private DataBindingContext context;
+
+    public NewProjectInformationPage() {
+        super(PAGE_NAME);
+        setTitle(Messages.NewProjectInformationPage_wizardTitle);
+        setDescription(Messages.NewProjectInformationPage_wizardDescription);
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+        Composite container = new Composite(parent, SWT.NULL);
+        GridLayout layout = new GridLayout(2, false);
+        container.setLayout(layout);
+
+        context = new DataBindingContext();
+
+        createLabelAndInputField(container, Messages.NewProjectInformationPage_groupIdLabel, "groupId", //$NON-NLS-1$
+                new Validators.ValidIdRequired(Messages.NewProjectInformationPage_groupIdLabel));
+
+        createLabelAndInputField(container, Messages.NewProjectInformationPage_artifactIdLabel, "artifactId", //$NON-NLS-1$
+                new Validators.ValidIdRequired(Messages.NewProjectInformationPage_artifactIdLabel));
+
+        createLabelAndInputField(container, Messages.NewProjectInformationPage_versionLabel, "version", //$NON-NLS-1$
+                new Validators.NonEmptyStringRequired(Messages.NewProjectInformationPage_versionErrorMessage));
+
+        createLabelAndInputField(container, Messages.NewProjectInformationPage_packagePrefixLabel, "packageName", //$NON-NLS-1$
+                new Validators.PackageNameRequired());
+
+        createLabelAndInputField(container, Messages.NewProjectInformationPage_thermostatVersionLabel, "thermostatVersion", //$NON-NLS-1$
+                new Validators.VersionRequired(Messages.NewProjectInformationPage_thermostatVersionErrorMessage));
+
+        setControl(container);
+
+        WizardPageSupport.create(this, context);
+    }
+
+    private void createLabelAndInputField(Composite container, String labelText, String propertyName, IValidator validator) {
+        Label label = new Label(container, SWT.NULL);
+        label.setText(labelText);
+
+        Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
+        text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(text);
+        IObservableValue modelValue = PojoObservables.observeValue(model, propertyName);
+        UpdateValueStrategy targetToModelStrategy = new UpdateValueStrategy();
+        targetToModelStrategy.setBeforeSetValidator(validator);
+        context.bindValue(widgetValue, modelValue, targetToModelStrategy, null);
+    }
+
+    @Override
+    public void dispose() {
+        context.dispose();
+
+        super.dispose();
+    }
+
+    public ProjectModel getProjectInformation() {
+        return model;
+    }
+
+    static class ProjectModel {
+        private String groupId;
+        private String artifactId;
+        private String version;
+
+        private String packageName;
+
+        private String thermostatVersion;
+
+        public String getGroupId() {
+            return groupId;
+        }
+
+        public void setGroupId(String groupId) {
+            this.groupId = groupId;
+        }
+
+        public String getArtifactId() {
+            return artifactId;
+        }
+
+        public void setArtifactId(String artifactId) {
+            this.artifactId = artifactId;
+        }
+
+        public String getVersion() {
+            return version;
+        }
+
+        public void setVersion(String version) {
+            this.version = version;
+        }
+
+        public String getPackageName() {
+            return packageName;
+        }
+
+        public void setPackageName(String packageName) {
+            this.packageName = packageName;
+        }
+
+        public String getThermostatVersion() {
+            return thermostatVersion;
+        }
+
+        public void setThermostatVersion(String thermostatVersion) {
+            this.thermostatVersion = thermostatVersion;
+        }
+    }
+}
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreationWizard.java	Tue Jun 03 17:32:07 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreationWizard.java	Tue Jun 03 17:32:08 2014 -0400
@@ -23,7 +23,7 @@
         this.selection = selection;
 
         setWindowTitle(Messages.PluginXmlCreationWizard_windowTitle);
-}
+    }
 
     @Override
     public void addPages() {
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlProjectSelectionPage.java	Tue Jun 03 17:32:07 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlProjectSelectionPage.java	Tue Jun 03 17:32:08 2014 -0400
@@ -30,12 +30,15 @@
 import com.redhat.thermostat.tools.eclipse.plugin.Messages;
 
 public class PluginXmlProjectSelectionPage extends WizardPage {
+
+    static final String PAGE_NAME = "selectProjectForPluginXml"; //$NON-NLS-1$
+
     private Text containerText;
 
     private ISelection selection;
 
     public PluginXmlProjectSelectionPage(ISelection selection) {
-        super("wizardPage"); //$NON-NLS-1$
+        super(PAGE_NAME);
         setTitle(Messages.PluginXmlProjectSelectionPage_title);
         setDescription(Messages.PluginXmlProjectSelectionPage_description);
         this.selection = selection;
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizard.java	Tue Jun 03 17:32:07 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizard.java	Tue Jun 03 17:32:08 2014 -0400
@@ -11,11 +11,11 @@
 
 import com.redhat.thermostat.tools.eclipse.plugin.Activator;
 import com.redhat.thermostat.tools.eclipse.plugin.Messages;
-import com.redhat.thermostat.tools.eclipse.plugin.wizards.ThermostatProjectCreationWizardPage.ProjectModel;
+import com.redhat.thermostat.tools.eclipse.plugin.wizards.NewProjectInformationPage.ProjectModel;
 
 public class ThermostatProjectCreationWizard extends Wizard implements INewWizard {
 
-    private ThermostatProjectCreationWizardPage pageOne;
+    private NewProjectInformationPage pageOne;
 
     @Override
     public void init(IWorkbench workbench, IStructuredSelection selection) {
@@ -25,7 +25,7 @@
 
     @Override
     public void addPages() {
-        pageOne = new ThermostatProjectCreationWizardPage();
+        pageOne = new NewProjectInformationPage();
         addPage(pageOne);
     }
 
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizardPage.java	Tue Jun 03 17:32:07 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-package com.redhat.thermostat.tools.eclipse.plugin.wizards;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.UpdateValueStrategy;
-import org.eclipse.core.databinding.beans.PojoObservables;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.databinding.wizard.WizardPageSupport;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-import com.redhat.thermostat.tools.eclipse.plugin.Messages;
-import com.redhat.thermostat.tools.eclipse.plugin.Validators;
-
-public class ThermostatProjectCreationWizardPage extends WizardPage {
-
-    private ProjectModel model = new ProjectModel();
-    private DataBindingContext context;
-
-    public ThermostatProjectCreationWizardPage() {
-        super("wizardPage"); //$NON-NLS-1$
-        setTitle(Messages.ThermostatProjectCreationWizardPage_wizardTitle);
-        setDescription(Messages.ThermostatProjectCreationWizardPage_wizardDescription);
-    }
-
-    @Override
-    public void createControl(Composite parent) {
-        Composite container = new Composite(parent, SWT.NULL);
-        GridLayout layout = new GridLayout(2, false);
-        container.setLayout(layout);
-
-        context = new DataBindingContext();
-
-        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_groupIdLabel, "groupId", //$NON-NLS-1$
-                new Validators.ValidIdRequired(Messages.ThermostatProjectCreationWizardPage_groupIdLabel));
-
-        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_artifactIdLabel, "artifactId", //$NON-NLS-1$
-                new Validators.ValidIdRequired(Messages.ThermostatProjectCreationWizardPage_artifactIdLabel));
-
-        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_versionLabel, "version", //$NON-NLS-1$
-                new Validators.NonEmptyStringRequired(Messages.ThermostatProjectCreationWizardPage_versionErrorMessage));
-
-        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_packagePrefixLabel, "packageName", //$NON-NLS-1$
-                new Validators.PackageNameRequired());
-
-        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_thermostatVersionLabel, "thermostatVersion", //$NON-NLS-1$
-                new Validators.VersionRequired(Messages.ThermostatProjectCreationWizardPage_thermostatVersionErrorMessage));
-
-        setControl(container);
-
-        WizardPageSupport.create(this, context);
-    }
-
-    private void createLabelAndInputField(Composite container, String labelText, String propertyName, IValidator validator) {
-        Label label = new Label(container, SWT.NULL);
-        label.setText(labelText);
-
-        Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
-        text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(text);
-        IObservableValue modelValue = PojoObservables.observeValue(model, propertyName);
-        UpdateValueStrategy targetToModelStrategy = new UpdateValueStrategy();
-        targetToModelStrategy.setBeforeSetValidator(validator);
-        context.bindValue(widgetValue, modelValue, targetToModelStrategy, null);
-    }
-
-    @Override
-    public void dispose() {
-        context.dispose();
-
-        super.dispose();
-    }
-
-    public ProjectModel getProjectInformation() {
-        return model;
-    }
-
-    static class ProjectModel {
-        private String groupId;
-        private String artifactId;
-        private String version;
-
-        private String packageName;
-
-        private String thermostatVersion;
-
-        public String getGroupId() {
-            return groupId;
-        }
-
-        public void setGroupId(String groupId) {
-            this.groupId = groupId;
-        }
-
-        public String getArtifactId() {
-            return artifactId;
-        }
-
-        public void setArtifactId(String artifactId) {
-            this.artifactId = artifactId;
-        }
-
-        public String getVersion() {
-            return version;
-        }
-
-        public void setVersion(String version) {
-            this.version = version;
-        }
-
-        public String getPackageName() {
-            return packageName;
-        }
-
-        public void setPackageName(String packageName) {
-            this.packageName = packageName;
-        }
-
-        public String getThermostatVersion() {
-            return thermostatVersion;
-        }
-
-        public void setThermostatVersion(String thermostatVersion) {
-            this.thermostatVersion = thermostatVersion;
-        }
-    }
-}