changeset 124:f425cf9c32e8

Externalize strings in project wizard
author Omair Majid <omajid@redhat.com>
date Wed, 26 Mar 2014 13:06:12 -0400
parents a0c68ec37305
children 871145d042ba
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/PluginXmlCreator.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 5 files changed, 38 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java	Wed Mar 26 10:23:30 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java	Wed Mar 26 13:06:12 2014 -0400
@@ -77,6 +77,16 @@
     public static String PluginXmlProjectSelectionPage_projectMustBeWritable;
     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;
 
     static {
         // initialize resource bundle
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties	Wed Mar 26 10:23:30 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties	Wed Mar 26 13:06:12 2014 -0400
@@ -69,3 +69,13 @@
 PluginXmlProjectSelectionPage_projectMustBeWritable=Project must be writable
 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=Thermostat Version must not be empty
+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
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreator.java	Wed Mar 26 10:23:30 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreator.java	Wed Mar 26 13:06:12 2014 -0400
@@ -61,9 +61,9 @@
 
     private InputStream getInitialContentStream() {
         String contents = "<?xml version=\"1.0\"?>\n" //$NON-NLS-1$
-                + "<plugin xmlns=\"" + SchemaConstants.SCHEMA_NAMESPACE + "\"\n" //$NON-NLS-1$ $NON-NLS-2$
+                + "<plugin xmlns=\"" + SchemaConstants.SCHEMA_NAMESPACE + "\"\n" //$NON-NLS-1$ //$NON-NLS-2$
                 + "        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" //$NON-NLS-1$
-                + "        xsi:schemaLocation=\"" + SchemaConstants.getSchemaLocation() + "\">\n" //$NON-NLS-1$ $NON-NLS-2$
+                + "        xsi:schemaLocation=\"" + SchemaConstants.getSchemaLocation() + "\">\n" //$NON-NLS-1$ //$NON-NLS-2$
                 + "</plugin>"; //$NON-NLS-1$
 
         return new ByteArrayInputStream(contents.getBytes());
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizard.java	Wed Mar 26 10:23:30 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizard.java	Wed Mar 26 13:06:12 2014 -0400
@@ -10,6 +10,7 @@
 import org.eclipse.ui.IWorkbench;
 
 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;
 
 public class ThermostatProjectCreationWizard extends Wizard implements INewWizard {
@@ -18,7 +19,7 @@
 
     @Override
     public void init(IWorkbench workbench, IStructuredSelection selection) {
-        setWindowTitle("Create New Thermostat Plugin");
+        setWindowTitle(Messages.ThermostatProjectCreationWizard_dialogTitle);
         setNeedsProgressMonitor(true);
     }
 
@@ -53,7 +54,7 @@
         try {
             creator.create();
         } catch (IOException e) {
-            throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, "Error creating project", e));
+            throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, "Error creating project", e)); //$NON-NLS-1$
         }
     }
 
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizardPage.java	Wed Mar 26 10:23:30 2014 -0400
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizardPage.java	Wed Mar 26 13:06:12 2014 -0400
@@ -15,6 +15,7 @@
 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 {
@@ -23,9 +24,9 @@
     private DataBindingContext context;
 
     public ThermostatProjectCreationWizardPage() {
-        super("wizardPage");
-        setTitle("Thermostat Wizard");
-        setDescription("This wizard creates a new Thermostat Plugin.");
+        super("wizardPage"); //$NON-NLS-1$
+        setTitle(Messages.ThermostatProjectCreationWizardPage_wizardTitle);
+        setDescription(Messages.ThermostatProjectCreationWizardPage_wizardDescription);
     }
 
     @Override
@@ -36,20 +37,20 @@
 
         context = new DataBindingContext();
 
-        createLabelAndInputField(container, "&Group Id:", "groupId",
-                new Validators.ValidIdRequired("Group Id"));
+        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_groupIdLabel, "groupId", //$NON-NLS-1$
+                new Validators.ValidIdRequired(Messages.ThermostatProjectCreationWizardPage_groupIdLabel));
 
-        createLabelAndInputField(container, "&Artifact Id:", "artifactId",
-                new Validators.ValidIdRequired("Artifact Id"));
+        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_artifactIdLabel, "artifactId", //$NON-NLS-1$
+                new Validators.ValidIdRequired(Messages.ThermostatProjectCreationWizardPage_artifactIdLabel));
 
-        createLabelAndInputField(container, "&Version:", "version",
-                new Validators.NonEmptyStringRequired("Version must not be empty"));
+        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_versionLabel, "version", //$NON-NLS-1$
+                new Validators.NonEmptyStringRequired(Messages.ThermostatProjectCreationWizardPage_versionErrorMessage));
 
-        createLabelAndInputField(container, "&Package Prefix:", "packageName",
+        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_packagePrefixLabel, "packageName", //$NON-NLS-1$
                 new Validators.PackageNameRequired());
 
-        createLabelAndInputField(container, "&Thermostat Version:", "thermostatVersion",
-                new Validators.NonEmptyStringRequired("Thermostat Version must not be empty"));
+        createLabelAndInputField(container, Messages.ThermostatProjectCreationWizardPage_thermostatVersionLabel, "thermostatVersion", //$NON-NLS-1$
+                new Validators.NonEmptyStringRequired(Messages.ThermostatProjectCreationWizardPage_thermostatVersionErrorMessage));
 
         setControl(container);