]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Externalize strings in org.simantics.scl.ui 84/2484/12
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 21 Nov 2018 12:43:02 +0000 (14:43 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 21 Nov 2018 21:14:41 +0000 (21:14 +0000)
Also touched SCL console import dialog related code in
org.simantics.modeling.ui to keep the UI uniform within this commit.

gitlab #210

Change-Id: I7eb67633ecb32227fa2aceaf3cdf21ed3026495b

74 files changed:
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/ModuleSelectionDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/OntologyImportModulesAction.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesImportModulesAction.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/Activator.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposal.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposalProvider.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/StyledTextContentAdapter.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDefinitionSelectionDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDocumentationBrowser.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/TestSCLDocumentationBrowser.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/ConsoleActions.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Preferences.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsole.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/MatchingBracketsEditStrategy.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/ReplaceTabsBySpaces.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLAnnotationAccessNew.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLDocumentSetup.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLSourceViewerConfigurationNew.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLTextEditorNew.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionAssistProcessor.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionProposal.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLTextEditorEnvironment.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/DebugPartionTokenScanner.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/FindSCLSearchAction.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenDeclaration.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLDefinition.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLModule.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleEditor2.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleEditor2DocumentProvider.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleSelectionDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPartitionScanner.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPresentationReconciler.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/StandardSCLModuleEditorInput.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/BasicImportModulesAction.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ExternalImportModulesAction.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManualImportModulesAction.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/SCLModuleSelectionDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/info/SCLInfo.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/SCLIssuesView.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleAction.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleValidator.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/ModuleNameTreeEntry.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/PluginSelectionDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleBrowser.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTreeContentProvider.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchQuery.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResult.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/messages.properties [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/Messages.java [new file with mode: 0644]
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/SCLTestsDialog.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/messages.properties [new file with mode: 0644]
i18n.md [new file with mode: 0644]

diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/Messages.java
new file mode 100644 (file)
index 0000000..8c941cc
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.modeling.ui.scl.imports;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.scl.imports.messages"; //$NON-NLS-1$
+       public static String OntologyImportModulesAction_AddOntology;
+       public static String SCLModulesImportModulesAction_AddModulesFromProject;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 8d07d60b1bb111ab1fbd96619e4b3eedc84a84d3..66541a7be90449e85626ae6ad480bf74d37f83e8 100644 (file)
@@ -22,7 +22,7 @@ import org.simantics.utils.ui.dialogs.ShowError;
 
 public class ModuleSelectionDialog extends FilteredItemsSelectionDialog {
 
-    private static final String SCL_MODULE_SELECTION_DIALOG = "SCL_MODULE_SELECTION_DIALOG";
+    private static final String SCL_MODULE_SELECTION_DIALOG = "SCL_MODULE_SELECTION_DIALOG"; //$NON-NLS-1$
     
     Read<Collection<String>> query;
     
@@ -60,7 +60,7 @@ public class ModuleSelectionDialog extends FilteredItemsSelectionDialog {
                 if(patternText != null && patternText.length() > 0)
                     patternMatcher.setPattern(patternText);
                 else 
-                    patternMatcher.setPattern("*");
+                    patternMatcher.setPattern("*"); //$NON-NLS-1$
             }
             
             @Override
@@ -68,7 +68,7 @@ public class ModuleSelectionDialog extends FilteredItemsSelectionDialog {
                 if(getPattern().indexOf('/') > 0)
                     return matches((String)item);
                 else {
-                    for(String part : ((String)item).split("/"))
+                    for(String part : ((String)item).split("/")) //$NON-NLS-1$
                         if(matches(part))
                             return true;
                     return false;
@@ -105,8 +105,8 @@ public class ModuleSelectionDialog extends FilteredItemsSelectionDialog {
                     TransientCacheListener.<Collection<String>>instance()))
                 contentProvider.add(module, itemsFilter);
         } catch (DatabaseException e) {
-            ShowError.showError("Failed to find modules",
-                    "Exception was thrown during search for modules", e);
+            ShowError.showError("Failed to find modules", //$NON-NLS-1$
+                    "Exception was thrown during search for modules", e); //$NON-NLS-1$
             close();
         }
 
index 1c9198015031e17a5fe4fe52f85afaadc2d03dec..13080d6833c9f15149d2bd5713cc17a62f7a52f2 100644 (file)
@@ -12,12 +12,13 @@ public class OntologyImportModulesAction extends ImportModulesAction {
     public static final OntologyImportModulesAction INSTANCE = new OntologyImportModulesAction();
             
     public OntologyImportModulesAction() {
-        super("Add ontology", 10.0);
+        super(Messages.OntologyImportModulesAction_AddOntology, 10.0);
     }
 
     @Override
     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
         ModuleSelectionDialog dialog = new ModuleSelectionDialog(shell, OntologiesQuery.INSTANCE);
+        dialog.setTitle(Messages.OntologyImportModulesAction_AddOntology);
         if(dialog.open() == Dialog.OK) {
             for(Object r : dialog.getResult()) {
                 String uri = (String)r;
@@ -30,13 +31,13 @@ public class OntologyImportModulesAction extends ImportModulesAction {
     }
     
     public String getDefaultLocalName(String ontologyUri) {
-        if(ontologyUri.contains("/Layer0-"))
-            return "L0";
-        if(ontologyUri.contains("/Structural-"))
-            return "STR";
-        if(ontologyUri.contains("/Modeling-"))
-            return "MOD";
-        return "";
+        if(ontologyUri.contains("/Layer0-")) //$NON-NLS-1$
+            return "L0"; //$NON-NLS-1$
+        if(ontologyUri.contains("/Structural-")) //$NON-NLS-1$
+            return "STR"; //$NON-NLS-1$
+        if(ontologyUri.contains("/Modeling-")) //$NON-NLS-1$
+            return "MOD"; //$NON-NLS-1$
+        return ""; //$NON-NLS-1$
     }
 
 }
index 8a960f825bb451a86b9c642182b1b089e3da6f38..1a50da2cd18e7adc4eb3f805745a7a84501f2bfc 100644 (file)
@@ -13,17 +13,18 @@ public class SCLModulesImportModulesAction extends ImportModulesAction {
     public static final SCLModulesImportModulesAction INSTANCE = new SCLModulesImportModulesAction();
             
     public SCLModulesImportModulesAction() {
-        super("Add modules from project", 20.0);
+        super(Messages.SCLModulesImportModulesAction_AddModulesFromProject, 20.0);
     }
 
     @Override
     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
         ModuleSelectionDialog dialog = new ModuleSelectionDialog(shell,
                 new SCLModulesQuery(Simantics.getProjectResource()));
+        dialog.setTitle(Messages.SCLModulesImportModulesAction_AddModulesFromProject);
         if(dialog.open() == Dialog.OK) {
             for(Object r : dialog.getResult()) {
                 String uri = (String)r;
-                new CommandSessionImportEntry(uri, "", true).addTo(imports);
+                new CommandSessionImportEntry(uri, "", true).addTo(imports); //$NON-NLS-1$
             }
             return true;
         }
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/messages.properties
new file mode 100644 (file)
index 0000000..7b21b5a
--- /dev/null
@@ -0,0 +1,2 @@
+OntologyImportModulesAction_AddOntology=Add Ontology
+SCLModulesImportModulesAction_AddModulesFromProject=Add Modules from Project
index f68f2876e83087c3a88dc30a5a456a7028909694..57633e517894f81ee951ff5daec509e532e817ca 100644 (file)
@@ -12,7 +12,7 @@ import org.simantics.scl.ui.imports.internal.ManualImportModulesAction;
 
 public class Activator extends AbstractUIPlugin {
 
-    public static final String PLUGIN_ID = "org.simantics.scl.ui";
+    public static final String PLUGIN_ID = "org.simantics.scl.ui"; //$NON-NLS-1$
 
     private static Activator INSTANCE;
     
@@ -29,14 +29,14 @@ public class Activator extends AbstractUIPlugin {
     
     @Override
     protected void initializeImageRegistry(ImageRegistry reg) {
-        reg.put("arrow_left", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_left.png") );
-        reg.put("arrow_right", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_right.png") );
-        reg.put("arrow_refresh", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_refresh.png") );
-        reg.put("find", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/find.png") );
-        reg.put("disk", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/disk.png") );
-        reg.put("error", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/error.png") );
-        reg.put("import_error", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/import_error.png") );
-        reg.put("warning", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/warning.png") );
+        reg.put("arrow_left", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_left.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("arrow_right", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_right.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("arrow_refresh", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_refresh.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("find", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/find.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("disk", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/disk.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("error", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/error.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("import_error", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/import_error.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        reg.put("warning", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/warning.png") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
     
     @Override
index da2186fd8648746a8c750f0dbcc7efdfcdc85a36..3d837aacef126286ecd742668a0e3207832abb6b 100644 (file)
@@ -44,7 +44,7 @@ public class SCLContentProposal implements IContentProposal {
 
     @Override
     public String getLabel() {
-        return name + " :: " + type + "  (" + module + ")";
+        return name + " :: " + type + "  (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
     @Override
index 34464476b287e2b0e5e3647569b3a03937034753..82843cd624fbd4afa50be3ef2f6beaf3693b4b83 100644 (file)
@@ -37,14 +37,14 @@ public class SCLContentProposalProvider implements IContentProposalProvider {
         
         ArrayList<IContentProposal> proposals = new ArrayList<IContentProposal>();
         for(SCLValue value : values)
-            if(!value.isPrivate() && !(value.getName().name.contains("$") &&
+            if(!value.isPrivate() && !(value.getName().name.contains("$") && //$NON-NLS-1$
                     Character.isLetter(value.getName().name.charAt(0))))
                 proposals.add(new SCLContentProposal(value));
         
         prefix = prefix.toLowerCase();
         for(Map.Entry<String,Type> entry : session.localNamesForContentProposals().entrySet())
             if(entry.getKey().toLowerCase().startsWith(prefix))
-                proposals.add(new SCLContentProposal(entry.getKey(), "LocalEnvironment", entry.getValue()));
+                proposals.add(new SCLContentProposal(entry.getKey(), "LocalEnvironment", entry.getValue())); //$NON-NLS-1$
         
         return proposals.toArray(new IContentProposal[proposals.size()]);
     }
index a6deb92c0ab884bce3179de97693b45d7a721064..dd71e323b0b2a500d6c67452df72dad99d4079e5 100644 (file)
@@ -77,7 +77,7 @@ public class StyledTextContentAdapter implements IControlContentAdapter, IContro
         while (--offset >= 0 && (Character.isJavaIdentifierPart(currentText.charAt(offset)) && !Character.isWhitespace(currentText.charAt(offset))))
             length--;
                
-               int nameSpaceBeginRange = currentText.lastIndexOf(".", caretEndRange - 1);
+               int nameSpaceBeginRange = currentText.lastIndexOf(".", caretEndRange - 1); //$NON-NLS-1$
                if (nameSpaceBeginRange > length)
                    length = nameSpaceBeginRange;
                int endRange = currentText.length();
index 7ecbaa371161873fd7eabd156a2291fc99e7ac40..3a687e0d921c0abba54cc10afb88f88d416dc501 100644 (file)
@@ -15,17 +15,17 @@ public class LaunchSCLDocumentationBrowser extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         Display display = PlatformUI.getWorkbench().getDisplay();
         Shell shell = new Shell(display);
-        shell.setText("SCL Documentation browser");
+        shell.setText(Messages.LaunchSCLDocumentationBrowser_SCLDocumentationBrowser);
         shell.setLayout(new FillLayout());
         SCLDocumentationBrowser browser;
         try {
             browser = new SCLDocumentationBrowser(shell);
         } catch (SWTError e) {
-            System.out.println("Could not instantiate the browser: " + e.getMessage());
+            System.out.println("Could not instantiate the browser: " + e.getMessage()); //$NON-NLS-1$
             display.dispose();
             return null;
         }
-        browser.setLocation("Prelude");
+        browser.setLocation("Prelude"); //$NON-NLS-1$
         shell.open();
         
         return null;
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/Messages.java
new file mode 100644 (file)
index 0000000..f531f93
--- /dev/null
@@ -0,0 +1,23 @@
+package org.simantics.scl.ui.browser;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.browser.messages"; //$NON-NLS-1$
+       public static String LaunchSCLDocumentationBrowser_SCLDocumentationBrowser;
+       public static String SCLDefinitionSelectionDialog_ChooseSCLDefinition;
+       public static String SCLDocumentationBrowser_BackTT;
+       public static String SCLDocumentationBrowser_FindSCLDefinitionTT;
+       public static String SCLDocumentationBrowser_ForwardTT;
+       public static String SCLDocumentationBrowser_RefreshPageTT;
+       public static String SCLDocumentationBrowser_SaveDocumentationToDiskTT;
+       public static String SCLDocumentationBrowser_SaveDocumentationDialog_Msg;
+       public static String SCLDocumentationBrowser_SaveDocumentationDialog_Title;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 843b88fe203b999a6fe3f7ac21b946bfac8ae5da..8b8896d24e6870dd85cdf67bad2869491d02b0df 100644 (file)
@@ -22,11 +22,11 @@ import org.simantics.scl.osgi.SCLOsgi;
 import org.simantics.scl.ui.Activator;
 
 public class SCLDefinitionSelectionDialog extends FilteredItemsSelectionDialog {
-    private static final String DIALOG_SETTINGS = "SCLDefinitionSelectionDialogSettings";
+    private static final String DIALOG_SETTINGS = "SCLDefinitionSelectionDialogSettings"; //$NON-NLS-1$
 
     public SCLDefinitionSelectionDialog(Shell shell) {
         super(shell, false);
-        setTitle("Choose an SCL definition");
+        setTitle(Messages.SCLDefinitionSelectionDialog_ChooseSCLDefinition);
         setSelectionHistory(new DefinitionSelectionHistory());
         setListLabelProvider(new LabelProvider() {
             @Override
@@ -35,9 +35,9 @@ public class SCLDefinitionSelectionDialog extends FilteredItemsSelectionDialog {
                     return (String)element;
                 SCLValue value = (SCLValue)element;
                 if(element == null)
-                    return "";
+                    return ""; //$NON-NLS-1$
                 Name name = value.getName();
-                return name.name + " (" + name.module + ") :: " + value.getType();
+                return name.name + " (" + name.module + ") :: " + value.getType(); //$NON-NLS-1$ //$NON-NLS-2$
             }
         });
     }
@@ -78,13 +78,13 @@ public class SCLDefinitionSelectionDialog extends FilteredItemsSelectionDialog {
                 if(patternText != null && patternText.length() > 0)
                     patternMatcher.setPattern(patternText);
                 else 
-                    patternMatcher.setPattern("*");
+                    patternMatcher.setPattern("*"); //$NON-NLS-1$
             }
             
             @Override
             public boolean matchItem(Object item) {
                 String text = item.toString();
-                if(getPattern().contains("/"))
+                if(getPattern().contains("/")) //$NON-NLS-1$
                     return matches(text);
                 else {
                     int p = text.lastIndexOf('/');
@@ -132,8 +132,8 @@ public class SCLDefinitionSelectionDialog extends FilteredItemsSelectionDialog {
     }
 
     private boolean isTupleValue(Name name) {
-        return name.module.equals(Types.BUILTIN) && name.name.startsWith("(") &&
-                (name.name.equals("()") || name.name.charAt(1) == ',');
+        return name.module.equals(Types.BUILTIN) && name.name.startsWith("(") && //$NON-NLS-1$
+                (name.name.equals("()") || name.name.charAt(1) == ','); //$NON-NLS-1$
     }
 
     @Override
index fe871ab1c5cc58452d85c6610bc73307cbf0282e..f5cdfbf60120c9928f2c745a7e12b4e984c95fdd 100644 (file)
@@ -46,14 +46,14 @@ import org.simantics.scl.ui.Activator;
 
 public class SCLDocumentationBrowser {
     
-    public static final String STANDARD_LIBRARY = "StandardLibrary";
+    public static final String STANDARD_LIBRARY = "StandardLibrary"; //$NON-NLS-1$
 
     Browser browser;
     Button backButton;
     Text pageName;
     Button refreshButton;
     Button forwardButton;
-    String currentPageName = "";
+    String currentPageName = ""; //$NON-NLS-1$
     Button saveButton;
     Button findButton;
     Tree navigationTree;
@@ -95,9 +95,9 @@ public class SCLDocumentationBrowser {
     
     private void refresh() {
         SCLOsgi.SOURCE_REPOSITORY.checkUpdates();
-        final Object yOffset = browser.evaluate("return window.pageYOffset !== undefined ? window.pageYOffset : ((document.compatMode || \"\") === \"CSS1Compat\") ? document.documentElement.scrollTop : document.body.scrollTop;");
+        final Object yOffset = browser.evaluate("return window.pageYOffset !== undefined ? window.pageYOffset : ((document.compatMode || \"\") === \"CSS1Compat\") ? document.documentElement.scrollTop : document.body.scrollTop;"); //$NON-NLS-1$
         if(yOffset != null)
-            executeWhenCompleted("window.scroll(0,"+yOffset+");");
+            executeWhenCompleted("window.scroll(0,"+yOffset+");"); //$NON-NLS-1$ //$NON-NLS-2$
         browser.setUrl(locationHistory.get(locationHistoryPosition));
         updateNavigationTree();
     }
@@ -133,29 +133,29 @@ public class SCLDocumentationBrowser {
         
         backButton = new Button(buttons, SWT.PUSH);
         buttons.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_GRAY));
-        backButton.setToolTipText("Back (Alt-Left)");
+        backButton.setToolTipText(Messages.SCLDocumentationBrowser_BackTT);
         backButton.setEnabled(false);
-        backButton.setImage(Activator.getInstance().getImageRegistry().get("arrow_left"));
+        backButton.setImage(Activator.getInstance().getImageRegistry().get("arrow_left")); //$NON-NLS-1$
         
         forwardButton = new Button(buttons, SWT.PUSH);
-        forwardButton.setToolTipText("Forward (Alt-Right)");
+        forwardButton.setToolTipText(Messages.SCLDocumentationBrowser_ForwardTT);
         forwardButton.setEnabled(false);
-        forwardButton.setImage(Activator.getInstance().getImageRegistry().get("arrow_right"));
+        forwardButton.setImage(Activator.getInstance().getImageRegistry().get("arrow_right")); //$NON-NLS-1$
         
         refreshButton = new Button(buttons, SWT.PUSH);
-        refreshButton.setToolTipText("Refresh page (Ctrl-R)");
-        refreshButton.setImage(Activator.getInstance().getImageRegistry().get("arrow_refresh"));
+        refreshButton.setToolTipText(Messages.SCLDocumentationBrowser_RefreshPageTT);
+        refreshButton.setImage(Activator.getInstance().getImageRegistry().get("arrow_refresh")); //$NON-NLS-1$
         
         pageName = new Text(buttons, SWT.BORDER | SWT.SINGLE);
         GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(pageName);
 
         findButton = new Button(buttons, SWT.PUSH);
-        findButton.setToolTipText("Find SCL definitions (Ctrl-H)");
-        findButton.setImage(Activator.getInstance().getImageRegistry().get("find"));
+        findButton.setToolTipText(Messages.SCLDocumentationBrowser_FindSCLDefinitionTT);
+        findButton.setImage(Activator.getInstance().getImageRegistry().get("find")); //$NON-NLS-1$
 
         saveButton = new Button(buttons, SWT.PUSH);
-        saveButton.setToolTipText("Save documentation to disk");
-        saveButton.setImage(Activator.getInstance().getImageRegistry().get("disk"));
+        saveButton.setToolTipText(Messages.SCLDocumentationBrowser_SaveDocumentationToDiskTT);
+        saveButton.setImage(Activator.getInstance().getImageRegistry().get("disk")); //$NON-NLS-1$
         
         SashForm browserBox = new SashForm(composite, SWT.BORDER | SWT.HORIZONTAL);
         GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(browserBox);
@@ -192,10 +192,10 @@ public class SCLDocumentationBrowser {
         browser.addLocationListener(new LocationAdapter() {
             public void changing(LocationEvent event) {
                 String location = event.location;
-                if(location.startsWith("about:blank"))
+                if(location.startsWith("about:blank")) //$NON-NLS-1$
                     return;
                 newLocation(location);
-                if(location.startsWith("about:")) {
+                if(location.startsWith("about:")) { //$NON-NLS-1$
                     location = location.substring(6);
                     setCurrentLocation(location);
                     int hashPos = location.indexOf('#');
@@ -206,14 +206,14 @@ public class SCLDocumentationBrowser {
                     }
                     else
                         fragment = null;
-                    if(location.endsWith(".html"))
+                    if(location.endsWith(".html")) //$NON-NLS-1$
                         location = location.substring(0, location.length()-5);
                     
                     String html = HtmlDocumentationGeneration.generate(SCLOsgi.MODULE_REPOSITORY, location, null);
                     
                     browser.setText(html);
                     if(fragment != null)
-                        executeWhenCompleted("location.hash = \"" + fragment + "\";");
+                        executeWhenCompleted("location.hash = \"" + fragment + "\";"); //$NON-NLS-1$ //$NON-NLS-2$
                     event.doit = false;
                 }
                 else
@@ -245,7 +245,7 @@ public class SCLDocumentationBrowser {
                         return;
                     }
                     if(e.keyCode == 'k' || e.keyCode == 'K') {
-                        pageName.setText("?");
+                        pageName.setText("?"); //$NON-NLS-1$
                         pageName.setSelection(1);
                         pageName.setFocus();
                         return;
@@ -256,24 +256,24 @@ public class SCLDocumentationBrowser {
                     }
                 }
                 if(e.keyCode == SWT.PAGE_DOWN) {
-                    browser.execute("window.scrollBy(0,0.8*(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight));");
+                    browser.execute("window.scrollBy(0,0.8*(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight));"); //$NON-NLS-1$
                 }
                 else if(e.keyCode == SWT.PAGE_UP) {
-                    browser.execute("window.scrollBy(0,-0.8*(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight));");
+                    browser.execute("window.scrollBy(0,-0.8*(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight));"); //$NON-NLS-1$
                 }
                 else if(e.keyCode == SWT.ARROW_DOWN) {
-                    browser.execute("window.scrollBy(0,100);");
+                    browser.execute("window.scrollBy(0,100);"); //$NON-NLS-1$
                 }
                 else if(e.keyCode == SWT.ARROW_UP) {
-                    browser.execute("window.scrollBy(0,-100);");
+                    browser.execute("window.scrollBy(0,-100);"); //$NON-NLS-1$
                 }
                 else if(e.keyCode == SWT.HOME) {
                     if(e.widget != pageName)
-                        browser.execute("window.scroll(0,0);");
+                        browser.execute("window.scroll(0,0);"); //$NON-NLS-1$
                 }
                 else if(e.keyCode == SWT.END) {
                     if(e.widget != pageName)
-                        browser.execute("window.scroll(0,document.body.scrollHeight);");
+                        browser.execute("window.scroll(0,document.body.scrollHeight);"); //$NON-NLS-1$
                 }
             }
             
@@ -285,7 +285,7 @@ public class SCLDocumentationBrowser {
         MouseWheelListener wheelListener = new MouseWheelListener() { 
             @Override
             public void mouseScrolled(MouseEvent e) {
-                browser.execute("window.scrollBy(0,"+e.count*(-30)+");");
+                browser.execute("window.scrollBy(0,"+e.count*(-30)+");"); //$NON-NLS-1$ //$NON-NLS-2$
             }
         };
         composite.addMouseWheelListener(wheelListener);
@@ -327,16 +327,16 @@ public class SCLDocumentationBrowser {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 DirectoryDialog dialog = new DirectoryDialog(saveButton.getShell());
-                dialog.setText("Select the directory for storing the documentation.");
-                dialog.setMessage("Select a directory where the documentation is generated to.");
+                dialog.setText(Messages.SCLDocumentationBrowser_SaveDocumentationDialog_Title);
+                dialog.setMessage(Messages.SCLDocumentationBrowser_SaveDocumentationDialog_Msg);
                 String directory = dialog.open();
                 if(directory != null) {
                     try {
                         GenerateAllHtmlDocumentation.generate(SCLOsgi.MODULE_REPOSITORY, Paths.get(directory));
                     } catch (IOException ex) {
                         ex.printStackTrace();
-                        ErrorDialog.openError(saveButton.getShell(), "Documentation generation failed", null,
-                                new Status(Status.ERROR, "org.simantics.scl.ui", 0, ex.toString(), ex));
+                        ErrorDialog.openError(saveButton.getShell(), "Documentation generation failed", null, //$NON-NLS-1$
+                                new Status(Status.ERROR, "org.simantics.scl.ui", 0, ex.toString(), ex)); //$NON-NLS-1$
                     }
                 }
             }
@@ -348,7 +348,7 @@ public class SCLDocumentationBrowser {
         if(dialog.open() == SCLDefinitionSelectionDialog.OK) {
             SCLValue value = (SCLValue)dialog.getFirstResult();
             if(value != null) {
-                setLocation(value.getName().module + "#" + HtmlEscape.escape(value.getName().name));
+                setLocation(value.getName().module + "#" + HtmlEscape.escape(value.getName().name)); //$NON-NLS-1$
             }
         }
     }
@@ -417,6 +417,6 @@ public class SCLDocumentationBrowser {
     }
 
     public void setLocation(String path) {
-        browser.setUrl("about:" + path);
+        browser.setUrl("about:" + path); //$NON-NLS-1$
     }
 }
index a1365544b7483ce0306f38cb4840de9e3943929b..803cdf30b487e876b16d23606cc5648054f927b2 100644 (file)
@@ -13,17 +13,17 @@ public class TestSCLDocumentationBrowser {
     public void testDocumentationBrowser() throws Exception {
         Display display = new Display();
         Shell shell = new Shell(display);
-        shell.setText("SCL module documentation");
+        shell.setText("SCL module documentation"); //$NON-NLS-1$
         shell.setLayout(new FillLayout());
         SCLDocumentationBrowser browser;
         try {
             browser = new SCLDocumentationBrowser(shell);
         } catch (SWTError e) {
-            System.out.println("Could not instantiate Browser: " + e.getMessage());
+            System.out.println("Could not instantiate Browser: " + e.getMessage()); //$NON-NLS-1$
             display.dispose();
             return;
         }
-        browser.setLocation("Prelude");
+        browser.setLocation("Prelude"); //$NON-NLS-1$
         shell.open();
         while (!shell.isDisposed()) {
             if (!display.readAndDispatch())
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/messages.properties
new file mode 100644 (file)
index 0000000..347b82c
--- /dev/null
@@ -0,0 +1,9 @@
+LaunchSCLDocumentationBrowser_SCLDocumentationBrowser=SCL Documentation Browser
+SCLDefinitionSelectionDialog_ChooseSCLDefinition=Choose an SCL Definition
+SCLDocumentationBrowser_BackTT=Back (Alt-Left)
+SCLDocumentationBrowser_FindSCLDefinitionTT=Find SCL Definitions (Ctrl-H)
+SCLDocumentationBrowser_ForwardTT=Forward (Alt-Right)
+SCLDocumentationBrowser_RefreshPageTT=Refresh Page (Ctrl-R)
+SCLDocumentationBrowser_SaveDocumentationToDiskTT=Save Documentation to Disk
+SCLDocumentationBrowser_SaveDocumentationDialog_Msg=Select the directory where to generate the documentation
+SCLDocumentationBrowser_SaveDocumentationDialog_Title=Select Output Directory
index ab9e033d020cca6d2537c83a35020c976419a8a7..b0019688386fcbbf8f7d019dad052630c75410d0 100644 (file)
@@ -57,7 +57,7 @@ public abstract class AbstractCommandConsole extends Composite {
      */
     public static final int HIDE_INPUT = 1 << 0;
 
-    public static final String PLUGIN_ID = "org.simantics.scl.ui";
+    public static final String PLUGIN_ID = "org.simantics.scl.ui"; //$NON-NLS-1$
 
     public static final int COMMAND_HISTORY_SIZE = 50;
     
@@ -119,7 +119,7 @@ public abstract class AbstractCommandConsole extends Composite {
         // Initialize current text font
         fontRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
         fontRegistry.addListener(fontRegistryListener);
-        FontDescriptor font = FontDescriptor.createFrom( fontRegistry.getFontData("org.simantics.scl.consolefont") );
+        FontDescriptor font = FontDescriptor.createFrom( fontRegistry.getFontData("org.simantics.scl.consolefont") ); //$NON-NLS-1$
         setTextFont(font);
 
         setLayout(new FormLayout());
@@ -184,14 +184,14 @@ public abstract class AbstractCommandConsole extends Composite {
         GC gc = new GC(deco);
         int inputLeftPos = gc.getFontMetrics().getAverageCharWidth()*2;
         gc.dispose();
-        deco.setText(">");
+        deco.setText(">"); //$NON-NLS-1$
         deco.setLayoutData( formData(sash, 100, 0, new Tuple2(0, inputLeftPos)) );
 
         // Input area
         input = new StyledText(this, SWT.MULTI);
         input.setFont(textFont);
         input.setLayoutData( formData(sash, 100, new Tuple2(0, inputLeftPos), 100) );
-        adjustInputSize("");
+        adjustInputSize(""); //$NON-NLS-1$
         input.addVerifyKeyListener(event -> {
             switch(event.keyCode) {
             case SWT.KEYPAD_CR:
@@ -228,19 +228,19 @@ public abstract class AbstractCommandConsole extends Composite {
             }
         });
         input.addVerifyListener(e -> {
-            if(e.text.contains("\n")) {
+            if(e.text.contains("\n")) { //$NON-NLS-1$
                 int lineId = input.getLineAtOffset(e.start);
                 int lineOffset = input.getOffsetAtLine(lineId);
                 int indentAmount;
                 for(indentAmount=0;
                         lineOffset+indentAmount < input.getCharCount() && 
-                        input.getTextRange(lineOffset+indentAmount, 1).equals(" ");
+                        input.getTextRange(lineOffset+indentAmount, 1).equals(" "); //$NON-NLS-1$
                         ++indentAmount);
                 StringBuilder indent = new StringBuilder();
                 indent.append('\n');
                 for(int i=0;i<indentAmount;++i)
                     indent.append(' ');
-                e.text = e.text.replace("\n", indent);
+                e.text = e.text.replace("\n", indent); //$NON-NLS-1$
             }
         });
         input.addModifyListener(e -> {
@@ -336,7 +336,7 @@ public abstract class AbstractCommandConsole extends Composite {
             Tuple2 t = (Tuple2) o;
             return new FormAttachment((Integer) t.c0, (Integer) t.c1);
         }
-        throw new IllegalArgumentException("argument not supported: " + o);
+        throw new IllegalArgumentException("argument not supported: " + o); //$NON-NLS-1$
     }
 
     private int getOffsetInInput(int x, int y) {
@@ -366,7 +366,7 @@ public abstract class AbstractCommandConsole extends Composite {
     
     String validatedText;
     
-    Job validationJob = new Job("SCL input validation") {
+    Job validationJob = new Job("SCL input validation") { //$NON-NLS-1$
 
         @Override
         protected IStatus run(IProgressMonitor monitor) {
@@ -377,7 +377,7 @@ public abstract class AbstractCommandConsole extends Composite {
         
     };
     
-    Job preValidationJob = new Job("SCL input validation") {
+    Job preValidationJob = new Job("SCL input validation") { //$NON-NLS-1$
         @Override
         protected IStatus run(IProgressMonitor monitor) {
             if(!input.isDisposed()) {
@@ -483,7 +483,7 @@ public abstract class AbstractCommandConsole extends Composite {
         
         // Print it into output area
         //appendOutput("> " + command.replace("\n", "\n  ") + "\n", greenColor, null);
-        input.setText("");
+        input.setText(""); //$NON-NLS-1$
         
         // Execute
         execute(command);
@@ -520,7 +520,7 @@ public abstract class AbstractCommandConsole extends Composite {
                 range.start = 0;
                 range.length = 1;
                 input.setStyleRange(range);
-                getLogger().error("The following error message didn't have a proper location: {}", annotation.description, e);
+                getLogger().error("The following error message didn't have a proper location: {}", annotation.description, e); //$NON-NLS-1$
             }
         }
     }
@@ -566,7 +566,7 @@ public abstract class AbstractCommandConsole extends Composite {
     
     public void clear() {
         outputModiLock = true;
-        output.setText("");
+        output.setText(""); //$NON-NLS-1$
         outputModiLock = false;
     }
 
index 744b83c9be8ae84b59616ec5fe591586b6be73e8..074a6112ba63fa41469650ad70110a4b49d5ad70 100644 (file)
@@ -10,22 +10,22 @@ import org.simantics.scl.ui.Activator;
 class ConsoleActions {
 
     public static Action createInterruptAction(SCLConsole console) {
-        Action interruptAction = new Action("Interrupt current command",
-                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/stop.png")) {
+        Action interruptAction = new Action(Messages.ConsoleActions_InterruptCurrentCommand,
+                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/stop.png")) { //$NON-NLS-1$ //$NON-NLS-2$
             @Override
             public void run() {
                 console.interruptCurrentCommands();
             }
         };
         interruptAction.setDisabledImageDescriptor(
-                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/stop_disabled.png"));
+                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/stop_disabled.png")); //$NON-NLS-1$ //$NON-NLS-2$
         interruptAction.setEnabled(false);
         return interruptAction;
     }
 
     public static Action createClearAction(SCLConsole console) {
-        Action clearAction = new Action("Clear console",
-                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/clear_console.png")) {
+        Action clearAction = new Action(Messages.ConsoleActions_ClearConsole,
+                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/clear_console.png")) { //$NON-NLS-1$ //$NON-NLS-2$
             @Override
             public void run() {
                 setEnabled(false);
@@ -33,7 +33,7 @@ class ConsoleActions {
             }
         };
         clearAction.setDisabledImageDescriptor(
-                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/clear_console_disabled.png"));
+                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/clear_console_disabled.png")); //$NON-NLS-1$ //$NON-NLS-2$
         clearAction.setEnabled(false);
         return clearAction;
     }
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Messages.java
new file mode 100644 (file)
index 0000000..f2ecd0f
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.scl.ui.console;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.console.messages"; //$NON-NLS-1$
+       public static String ConsoleActions_ClearConsole;
+       public static String ConsoleActions_InterruptCurrentCommand;
+       public static String SCLConsoleView_ManageImports;
+       public static String SCLConsoleView_RefreshAutomatically;
+       public static String SCLConsoleView_RefreshCompleted;
+       public static String SCLConsoleView_RefreshModules;
+       public static String SCLConsoleView_RunTests;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index a9d76a2f0839d1ea0d04a2a7a167c3d45fc67c8c..1d55d1fe3139558be1a334c9c513cb9fa4187021 100644 (file)
@@ -12,12 +12,12 @@ import java.util.TreeSet;
  */
 public final class Preferences {
 
-    public static final String  COMMAND_HISTORY = "COMMAND_HISTORY";
+    public static final String  COMMAND_HISTORY = "COMMAND_HISTORY"; //$NON-NLS-1$
 
-    private static final String DELIMITER       = "¤¤¤¤";
+    private static final String DELIMITER       = "¤¤¤¤"; //$NON-NLS-1$
 
     public static String join(Collection<String> s, String delimiter) {
-        if (s == null || s.isEmpty()) return "";
+        if (s == null || s.isEmpty()) return ""; //$NON-NLS-1$
         Iterator<String> iter = s.iterator();
         StringBuilder builder = new StringBuilder(iter.next());
         while( iter.hasNext() )
index 7221158c1bacfbfa8d91e27791ab84a49c8ee388..9df117f7e1288ef63869002bfde0952f8a42249e 100644 (file)
@@ -42,7 +42,7 @@ public class SCLConsole extends AbstractCommandConsole {
      */
     public static final int EXCLUDE_CONTRIBUTED_LISTENERS = 1 << 10;
 
-       public static final String JOB_NAME = "org.simantics.scl.console.job";
+       public static final String JOB_NAME = "org.simantics.scl.console.job"; //$NON-NLS-1$
        public static final long TERMINATE_GRACE_PERIOD = 1000L;
        
        private THashSet<Job> currentJobs = new THashSet<Job>();
@@ -53,15 +53,15 @@ public class SCLConsole extends AbstractCommandConsole {
        SCLReportingHandler handler = new AbstractSCLReportingHandler() {
         @Override
         public void print(String text) {
-            appendOutput(text + "\n", null, null);
+            appendOutput(text + "\n", null, null); //$NON-NLS-1$
         }
         @Override
         public void printError(String error) {
-            appendOutput(error + "\n", redColor, null);
+            appendOutput(error + "\n", redColor, null); //$NON-NLS-1$
         }
         @Override
         public void printCommand(String command) {
-            appendOutput("> " + command.replace("\n", "\n  ") + "\n", greenColor, null);
+            appendOutput("> " + command.replace("\n", "\n  ") + "\n", greenColor, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
         }
     };
 
@@ -90,7 +90,7 @@ public class SCLConsole extends AbstractCommandConsole {
                     input, 
                     styledTextContentAdapter, 
                     contentProvider, 
-                    KeyStroke.getInstance("Ctrl+Space"), 
+                    KeyStroke.getInstance("Ctrl+Space"),  //$NON-NLS-1$
                     null);
             contentProposalAdapter.setAutoActivationDelay(200);
         } catch (ParseException e) {
@@ -135,7 +135,7 @@ public class SCLConsole extends AbstractCommandConsole {
     }
     
     private String jobNameFromCommand(String command) {
-        return command.split("\n")[0];
+        return command.split("\n")[0]; //$NON-NLS-1$
     }
 
     @Override
index 67de0b2ffe9e02571d75ec114c22416498e51274..bab62144b5e514ffbcdd6f6984b650e7875a4e76 100644 (file)
@@ -43,11 +43,11 @@ import org.simantics.scl.ui.tests.SCLTestsDialog;
 
 public class SCLConsoleView extends ViewPart {
 
-    public static final String PLUGIN_ID = "org.simantics.scl.ui";
-    public static final String IMPORTS = "imports";
-    public static final String REFRESH_AUTOMATICALLY = "refresh-automatically";
-    public static final String SEPARATOR = ";";
-    public static final String DISABLED_TAG = "[DISABLED]";
+    public static final String PLUGIN_ID = "org.simantics.scl.ui"; //$NON-NLS-1$
+    public static final String IMPORTS = "imports"; //$NON-NLS-1$
+    public static final String REFRESH_AUTOMATICALLY = "refresh-automatically"; //$NON-NLS-1$
+    public static final String SEPARATOR = ";"; //$NON-NLS-1$
+    public static final String DISABLED_TAG = "[DISABLED]"; //$NON-NLS-1$
     
     IPersistentPreferenceStore store;
     SCLConsole console;
@@ -67,10 +67,10 @@ public class SCLConsoleView extends ViewPart {
                 disabled = true;
                 entryString = entryString.substring(DISABLED_TAG.length());
             }
-            String[] parts = entryString.split("=");
+            String[] parts = entryString.split("="); //$NON-NLS-1$
             CommandSessionImportEntry entry;
             if(parts.length == 1)
-                entry = new CommandSessionImportEntry(parts[0], "", true);
+                entry = new CommandSessionImportEntry(parts[0], "", true); //$NON-NLS-1$
             else
                 entry = new CommandSessionImportEntry(parts[1], parts[0], true);
             entry.disabled = disabled;
@@ -93,7 +93,7 @@ public class SCLConsoleView extends ViewPart {
                     b.append(DISABLED_TAG);
                 if(!entry.localName.isEmpty()) {
                     b.append(entry.localName);
-                    b.append("=");
+                    b.append("="); //$NON-NLS-1$
                 }
                 b.append(entry.moduleName);
             }
@@ -131,8 +131,8 @@ public class SCLConsoleView extends ViewPart {
                 try {
                     // Bit of a haxx solution to get around a deadlock caused by simply
                     // running the test with test.run()
-                    console.execute("import \"Commands/Tests\"");
-                    console.execute("runByName \"" + test.getName() + "\"");
+                    console.execute("import \"Commands/Tests\""); //$NON-NLS-1$
+                    console.execute("runByName \"" + test.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
 //                    test.run();
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -200,9 +200,9 @@ public class SCLConsoleView extends ViewPart {
         });
         
         // Refresh action
-        toolBarManager.add(new Action("Refresh modules", IAction.AS_DROP_DOWN_MENU) {
+        toolBarManager.add(new Action(Messages.SCLConsoleView_RefreshModules, IAction.AS_DROP_DOWN_MENU) {
             {
-                setImageDescriptor(Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_refresh.png"));
+                setImageDescriptor(Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_refresh.png")); //$NON-NLS-1$ //$NON-NLS-2$
                 setMenuCreator(new IMenuCreator() {
                     Menu menu;
                     @Override
@@ -215,7 +215,7 @@ public class SCLConsoleView extends ViewPart {
                         if(menu == null) {
                             menu = new Menu(parent);
                             refreshAutomaticallyItem = new MenuItem(menu, SWT.CHECK);
-                            refreshAutomaticallyItem.setText("Refresh automatically");
+                            refreshAutomaticallyItem.setText(Messages.SCLConsoleView_RefreshAutomatically);
                             refreshAutomaticallyItem.setSelection(refreshAutomatically);
                             refreshAutomaticallyItem.addSelectionListener(new SelectionAdapter() {
                                 @Override
@@ -238,11 +238,11 @@ public class SCLConsoleView extends ViewPart {
             public void run() {
                 console.getSession().getModuleRepository().getSourceRepository().checkUpdates();
                 console.getSession().updateRuntimeEnvironment(true);
-                console.appendOutput("refresh completed\n", console.greenColor, null);
+                console.appendOutput(Messages.SCLConsoleView_RefreshCompleted, console.greenColor, null);
             }
         });
-        toolBarManager.add(new Action("Manage imports",
-                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/configure_imports.png")) {
+        toolBarManager.add(new Action(Messages.SCLConsoleView_ManageImports,
+                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/configure_imports.png")) { //$NON-NLS-1$ //$NON-NLS-2$
             @Override
             public void run() {
                 manageImports();
@@ -251,8 +251,8 @@ public class SCLConsoleView extends ViewPart {
 
         // Show action for running SCL tests if in development mode
         if (Platform.inDevelopmentMode()) {
-            toolBarManager.add(new Action("Run tests",
-                    Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/run_tests.png")) {
+            toolBarManager.add(new Action(Messages.SCLConsoleView_RunTests,
+                    Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/run_tests.png")) { //$NON-NLS-1$ //$NON-NLS-2$
                 @Override
                 public void run() {
                     sclTestDialog();
@@ -292,7 +292,7 @@ public class SCLConsoleView extends ViewPart {
                 for (String file : files) {
                     Path p = Paths.get(file).toAbsolutePath();
                     if (isScriptFile(p)) {
-                        console.execute("runFromFile \"" + p.toString().replace('\\', '/') + "\"");
+                        console.execute("runFromFile \"" + p.toString().replace('\\', '/') + "\""); //$NON-NLS-1$ //$NON-NLS-2$
                     }
                 }
             }
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/messages.properties
new file mode 100644 (file)
index 0000000..7db5b8b
--- /dev/null
@@ -0,0 +1,7 @@
+ConsoleActions_ClearConsole=Clear Console
+ConsoleActions_InterruptCurrentCommand=Interrupt Current Command
+SCLConsoleView_ManageImports=Manage Imports
+SCLConsoleView_RefreshAutomatically=Refresh Automatically
+SCLConsoleView_RefreshCompleted=refresh completed\n
+SCLConsoleView_RefreshModules=Refresh Modules
+SCLConsoleView_RunTests=Run Tests
index d287325222b617e61a673ee57527e9896200a33c..68b3f638bc5860af2acc5d32e41b9456bbe4a354 100644 (file)
@@ -10,17 +10,17 @@ public class MatchingBracketsEditStrategy implements IAutoEditStrategy {
        
        public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
                if (c.length == 0 && c.text != null) {
-                       if(c.text.equals("(")) {
-                               c.text = "()";
+                       if(c.text.equals("(")) { //$NON-NLS-1$
+                               c.text = "()"; //$NON-NLS-1$
                                justAddedClosingBracket = ')';
                        }
-                       else if(c.text.equals("[")) {
-                               c.text = "[]";
+                       else if(c.text.equals("[")) { //$NON-NLS-1$
+                               c.text = "[]"; //$NON-NLS-1$
                                justAddedClosingBracket = ']';
                        }
                        else {
                                if(c.text.length() == 1 && c.text.charAt(0) == justAddedClosingBracket) {
-                                       c.text = "";
+                                       c.text = ""; //$NON-NLS-1$
                                        c.shiftsCaret = false;
                                        c.caretOffset = c.offset+1;
                                }
index a01295dcbfdce20003b302662a77425ebe67434f..08e403a69c5c0d2f39647ae9a18ba287611f0488 100644 (file)
@@ -8,7 +8,7 @@ public class ReplaceTabsBySpaces implements IAutoEditStrategy {
 
        public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
                if (c.length == 0 && c.text != null && c.text.indexOf('\t') >= 0) {
-                       c.text = c.text.replace("\t", "    ");
+                       c.text = c.text.replace("\t", "    "); //$NON-NLS-1$ //$NON-NLS-2$
                }               
        }
        
index d129f4c054d534481f2810f090e68260df54d167..181d8533bd0c6f5072ae70c2dc8f7088ce9ff81a 100644 (file)
@@ -47,10 +47,10 @@ final class SCLAnnotationAccessNew implements IAnnotationAccess, IAnnotationAcce
 
     @Override
     public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
-        Image image = registry.get("error");
+        Image image = registry.get("error"); //$NON-NLS-1$
         if(image == null) {
-            registry.put("error", ImageDescriptor.createFromFile(getClass(), "error_tsk.gif"));
-            image = registry.get("error");
+            registry.put("error", ImageDescriptor.createFromFile(getClass(), "error_tsk.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+            image = registry.get("error"); //$NON-NLS-1$
         }
         ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
     }
index 41a3bf239b729c2ad84a1d1188000982b52cc42d..5ed03d54b98fc65d4e084c95e7ec64a8f5ac8932 100644 (file)
@@ -14,14 +14,14 @@ import org.eclipse.jface.text.rules.Token;
 
 public class SCLDocumentSetup implements IDocumentSetupParticipant {
     
-    public static final String COMMENT = "COMMENT";
-    public static final String STRING = "STRING";
+    public static final String COMMENT = "COMMENT"; //$NON-NLS-1$
+    public static final String STRING = "STRING"; //$NON-NLS-1$
     
     public static final String[] PARTITION_TYPES = new String[] {
         COMMENT, STRING
     };
     
-    public static final String SCL_PARTIONING = "SCL_PARTIONING";
+    public static final String SCL_PARTIONING = "SCL_PARTIONING"; //$NON-NLS-1$
     
     
     @Override
@@ -29,10 +29,10 @@ public class SCLDocumentSetup implements IDocumentSetupParticipant {
         if(document instanceof IDocumentExtension3) {
             RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
             scanner.setPredicateRules(new IPredicateRule[] {
-                    new MultiLineRule("/*", "*/", new Token(COMMENT)),
-                    new EndOfLineRule("//", new Token(COMMENT)),
-                    new MultiLineRule("\"\"\"", "\"\"\"", new Token(STRING), '\\'),
-                    new PatternRule("\"", "\"", new Token(STRING), '\\', true),
+                    new MultiLineRule("/*", "*/", new Token(COMMENT)), //$NON-NLS-1$ //$NON-NLS-2$
+                    new EndOfLineRule("//", new Token(COMMENT)), //$NON-NLS-1$
+                    new MultiLineRule("\"\"\"", "\"\"\"", new Token(STRING), '\\'), //$NON-NLS-1$ //$NON-NLS-2$
+                    new PatternRule("\"", "\"", new Token(STRING), '\\', true), //$NON-NLS-1$ //$NON-NLS-2$
             });
             IDocumentPartitioner partitioner = new FastPartitioner(scanner, PARTITION_TYPES);
             ((IDocumentExtension3)document).setDocumentPartitioner(SCL_PARTIONING, partitioner);
index 88e9f8f1bca88d670967081cc4388372d5da2e05..70a8e082ecbc9da4f34ad3c3f21371369dd35c1e 100644 (file)
@@ -36,7 +36,7 @@ public class SCLSourceViewerConfigurationNew extends SourceViewerConfiguration {
         this.resourceManager = resourceManager;
         this.preferenceStore = EditorsUI.getPreferenceStore();
         
-        this.sclTextEditorEnvironment = new SCLTextEditorEnvironment("");
+        this.sclTextEditorEnvironment = new SCLTextEditorEnvironment(""); //$NON-NLS-1$
     }
 
     public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
index 190b9390481a28d1598d415276927bae4944754c..f66a1b2300144da36529f5b27183323f525fab51 100644 (file)
@@ -51,9 +51,9 @@ public class SCLTextEditorNew extends Composite {
         OverviewRuler rightRuler = 
             new OverviewRuler(annotationAccess, 12, sharedTextColors);
         rightRuler.setModel(annotationModel);
-        rightRuler.addAnnotationType("error");
-        rightRuler.setAnnotationTypeLayer("error", 0);
-        rightRuler.setAnnotationTypeColor("error", sharedTextColors.getColor(new RGB(255,0,128)));
+        rightRuler.addAnnotationType("error"); //$NON-NLS-1$
+        rightRuler.setAnnotationTypeLayer("error", 0); //$NON-NLS-1$
+        rightRuler.setAnnotationTypeColor("error", sharedTextColors.getColor(new RGB(255,0,128))); //$NON-NLS-1$
         
         viewer = new SourceViewer(this, 
                 leftRuler, rightRuler,
@@ -71,8 +71,8 @@ public class SCLTextEditorNew extends Composite {
         // Annotations to text area
         AnnotationPainter annotationPainter = 
             new AnnotationPainter(viewer, annotationAccess);        
-        annotationPainter.addAnnotationType("error");
-        annotationPainter.setAnnotationTypeColor("error", sharedTextColors.getColor(new RGB(255,0,128)));
+        annotationPainter.addAnnotationType("error"); //$NON-NLS-1$
+        annotationPainter.setAnnotationTypeColor("error", sharedTextColors.getColor(new RGB(255,0,128))); //$NON-NLS-1$
         viewer.addPainter(annotationPainter);
         annotationModel.addAnnotationModelListener(annotationPainter);
         
@@ -128,7 +128,7 @@ public class SCLTextEditorNew extends Composite {
                     ++end;
             }
             annotationModel.addAnnotation(
-                    new Annotation("error", true, error.description), 
+                    new Annotation("error", true, error.description),  //$NON-NLS-1$
                     new Position(begin, end-begin));   
         }
     }
index f779435ead4ae4a6f35d6dbdbe92f408641641cc..c02946c7bf7e829eaa6d05db6a3ab31ab8676246 100644 (file)
@@ -12,7 +12,7 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 public class SCLCompletionAssistProcessor implements IContentAssistProcessor {
     
 //    private String lastPrefix = null;
-    private String lastError = "";
+    private String lastError = ""; //$NON-NLS-1$
     private SCLTextEditorEnvironment sclTextEditorEnvironment;
     
     public SCLCompletionAssistProcessor(SCLTextEditorEnvironment sclTextEditorEnvironment) {
@@ -27,7 +27,7 @@ public class SCLCompletionAssistProcessor implements IContentAssistProcessor {
             tmpOffset = selection.getOffset() + selection.getLength();
         final int offset = tmpOffset;
         IDocument document = viewer.getDocument();
-        String tmpPrefix = "";
+        String tmpPrefix = ""; //$NON-NLS-1$
         try {
             tmpPrefix = getPrefix(document, offset);
         } catch (BadLocationException e) {
@@ -40,7 +40,7 @@ public class SCLCompletionAssistProcessor implements IContentAssistProcessor {
     private static String getPrefix(IDocument doc, int offset) throws BadLocationException {
         int docLen = doc.getLength();
         if (doc == null || offset > docLen || docLen == 0)
-            return "";
+            return ""; //$NON-NLS-1$
 
         int length= 0;
         while (--offset >= 0 && Character.isJavaIdentifierPart(doc.getChar(offset)) || doc.getChar(offset) == '.')
index 3734513cb6c3588b054e13a03b7cc15d9d4de1b6..fb63c18e020a9adc33d5724f9a25f9cd65047df1 100644 (file)
@@ -23,10 +23,10 @@ import org.simantics.scl.ui.Activator;
 
 public class SCLCompletionProposal implements ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2, ICompletionProposalExtension3, ICompletionProposalExtension4, ICompletionProposalExtension5 {
     
-    private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage();
-    private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage();
-    private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage();
-    private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage();
+    private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
     
     private final String content;
     private final String name;
@@ -41,13 +41,13 @@ public class SCLCompletionProposal implements ICompletionProposal, ICompletionPr
         String tempModule = value.getName().module;
         int p = tempName.lastIndexOf('.');
         if(p >= 0) {
-            tempModule = tempModule + "." + tempName.substring(0, p);
+            tempModule = tempModule + "." + tempName.substring(0, p); //$NON-NLS-1$
             tempName = tempName.substring(p+1);
         }
         this.name = tempName;
         this.module = tempModule;
         this.documentation = value.getDocumentation();
-        this.content = name + " :: " + value.getType() + "  (" + module + ")";
+        this.content = name + " :: " + value.getType() + "  (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         this.replacementOffset = replacementOffset;
         this.prefix = prefix;
 //        System.out.println(prefix);
@@ -60,7 +60,7 @@ public class SCLCompletionProposal implements ICompletionProposal, ICompletionPr
     public SCLCompletionProposal(String name, String module, SCLCompletionType completionType, int replacementOffset, String prefix) {
         this.name = name;
         this.module = module;
-        this.content = name + " (" + module + ")";
+        this.content = name + " (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$
         this.documentation = null;
         this.replacementOffset = replacementOffset;
         this.prefix = prefix;
@@ -141,13 +141,13 @@ public class SCLCompletionProposal implements ICompletionProposal, ICompletionPr
 //            String sadd = doc.get(start, end);
 //            System.out.println("toReplace : " + sadd);
             if (p.y > 0) {
-                doc.replace(p.x, p.y, "");
+                doc.replace(p.x, p.y, ""); //$NON-NLS-1$
                 doc.replace(offset, 0, getName());
             } else {
                 String currentText = doc.get(offset - prefix.length(), prefix.length());
                 if (currentText.equals(getName()))
                     return;
-                doc.replace(offset - prefix.length(), prefix.length(), "");
+                doc.replace(offset - prefix.length(), prefix.length(), ""); //$NON-NLS-1$
                 doc.replace(offset - prefix.length(), 0, getName());
             }
         } catch (BadLocationException x) {
index 98b51917744aaa43d7f179a0712e72b23bfdb29a..ffe709f45b768a9ff6c3cd5172b783fd349b5fa9 100644 (file)
@@ -45,12 +45,12 @@ public class SCLTextEditorEnvironment {
     
     public void updateEnvironment(IDocument document) {
         String contents = document.get();
-        String[] lines = contents.split("\\R+");
+        String[] lines = contents.split("\\R+"); //$NON-NLS-1$
         List<ImportDeclaration> imports = new ArrayList<>();
-        imports.add(new ImportDeclaration("StandardLibrary", ""));
+        imports.add(new ImportDeclaration("StandardLibrary", "")); //$NON-NLS-1$ //$NON-NLS-2$
         for (String line : lines) {
             line = line.trim();
-            if (line.startsWith("import") || line.startsWith("include")) {
+            if (line.startsWith("import") || line.startsWith("include")) { //$NON-NLS-1$ //$NON-NLS-2$
                 SCLParserImpl parser = new SCLParserImpl(new StringReader(line));
                 try {
                     ImportDeclaration importDecl = (ImportDeclaration)parser.parseImport();
@@ -82,14 +82,14 @@ public class SCLTextEditorEnvironment {
         List<SCLCompletionProposal> proposals = new ArrayList<>();
         for(SCLValue value : Environments.findValuesForPrefix(env, prefix)) {
             Name name = value.getName();
-            if((name.module.equals(moduleName) || !value.isPrivate()) && !(name.name.contains("$") && Character.isLetter(name.name.charAt(0))))
+            if((name.module.equals(moduleName) || !value.isPrivate()) && !(name.name.contains("$") && Character.isLetter(name.name.charAt(0)))) //$NON-NLS-1$
                 proposals.add(new SCLCompletionProposal(value, offset - lastPart.length(), lastPart));
         }
         for(TCon type : Environments.findTypesForPrefix(env, prefix)) {
             proposals.add(new SCLCompletionProposal(type.name, type.module, SCLCompletionType.TYPE, offset - lastPart.length(), lastPart));
         }
         
-        if(!prefix.contains(".")) {
+        if(!prefix.contains(".")) { //$NON-NLS-1$
             for (ImportDeclaration decl : cachedImports) {
                 if (decl.localName != null && !decl.localName.isEmpty() && decl.localName.toLowerCase().startsWith(prefix.toLowerCase())) {
                     proposals.add(new SCLCompletionProposal(decl.localName, decl.moduleName, SCLCompletionType.CONST, offset - prefix.length(), prefix));
index a87ed51073ff7332df91724a5db29d5973ea9ade..16e008d5782066de17eac562b2448e1b2b778054 100644 (file)
@@ -13,34 +13,34 @@ public class DebugPartionTokenScanner implements IPartitionTokenScanner {
 
     @Override
     public void setRange(IDocument document, int offset, int length) {
-        System.out.println(">>> setRange(" + offset + ", " + length + ")");
+        System.out.println(">>> setRange(" + offset + ", " + length + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         base.setRange(document, offset, length);
     }
 
     @Override
     public IToken nextToken() {
         IToken result = base.nextToken();
-        System.out.println(">>> nextToken -> " + result + " " + result.getData());
+        System.out.println(">>> nextToken -> " + result + " " + result.getData()); //$NON-NLS-1$ //$NON-NLS-2$
         return result;
     }
 
     @Override
     public int getTokenOffset() {
         int result = base.getTokenOffset();
-        System.out.println(">>> getTokenOffset -> " + result);
+        System.out.println(">>> getTokenOffset -> " + result); //$NON-NLS-1$
         return result;
     }
 
     @Override
     public int getTokenLength() {
         int result = base.getTokenLength();
-        System.out.println(">>> getTokenLength -> " + result);
+        System.out.println(">>> getTokenLength -> " + result); //$NON-NLS-1$
         return result;
     }
 
     @Override
     public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
-        System.out.println(">>> setPartialRange(" + offset + ", " + length + ", " + contentType + ", " + partitionOffset + ")");
+        System.out.println(">>> setPartialRange(" + offset + ", " + length + ", " + contentType + ", " + partitionOffset + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
         base.setPartialRange(document, offset, length, contentType, partitionOffset);
     }
     
index 15da4192ba9ec6410ab4dd4eba1a9859c74df83a..feffb74f7d4426caa8cb1e7d5bf03574eefe722e 100644 (file)
@@ -35,7 +35,7 @@ public class FindSCLSearchAction extends AbstractHandler {
         return text.substring(startPos, endPos);
     }
     
-    private static final String SYMBOL_CHARS = "!$%&*+/<=>?@\\^|-:~.";
+    private static final String SYMBOL_CHARS = "!$%&*+/<=>?@\\^|-:~."; //$NON-NLS-1$
     
     private static boolean isSymbolPart(char c) {
         for(int i=0;i<SYMBOL_CHARS.length();++i)
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/Messages.java
new file mode 100644 (file)
index 0000000..b826e7a
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.scl.ui.editor2;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.editor2.messages"; //$NON-NLS-1$
+       public static String SCLModuleEditor2DocumentProvider_Status_SCLSourceNotFound;
+       public static String SCLModuleSelectionDialog_ChooseSCLModule;
+       public static String SCLModuleSelectionDialog_Searching;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 421328c164222346da2c9eb073f222afe841c601..baa7020c5f4a78a21434234e90230d0627b92f7d 100644 (file)
@@ -35,7 +35,7 @@ public class OpenDeclaration extends AbstractHandler {
         return text.substring(startPos, endPos);
     }
     
-    private static final String SYMBOL_CHARS = "!$%&*+/<=>?@\\^|-:~.";
+    private static final String SYMBOL_CHARS = "!$%&*+/<=>?@\\^|-:~."; //$NON-NLS-1$
     
     private static boolean isSymbolPart(char c) {
         for(int i=0;i<SYMBOL_CHARS.length();++i)
@@ -88,7 +88,7 @@ public class OpenDeclaration extends AbstractHandler {
         
         // Find the line where the caret is
         String lineAtCaret = extractLineAt(text, caretOffset);
-        if(lineAtCaret.startsWith("import ") || lineAtCaret.startsWith("include ")) {
+        if(lineAtCaret.startsWith("import ") || lineAtCaret.startsWith("include ")) { //$NON-NLS-1$ //$NON-NLS-2$
             int p1 = lineAtCaret.indexOf('"', 6);
             int p2 = lineAtCaret.indexOf('"', p1+1);
             SCLModuleEditorInput input = (SCLModuleEditorInput)moduleEditor.getEditorInput();
@@ -99,7 +99,7 @@ public class OpenDeclaration extends AbstractHandler {
                        OpenSCLModule.scheduleOpenModule(moduleName);
                 }
             } catch (InvalidModulePathException e) {
-                LOGGER.error("Could not open declaration {} {}", input.getModuleName(), lineAtCaret, e);
+                LOGGER.error("Could not open declaration {} {}", input.getModuleName(), lineAtCaret, e); //$NON-NLS-1$
             }
         }
         else {
index 33fb30d4be124956e9b8ed76f3e53f90e9e7c010..bb8332a390bd6cb0b3c92e12a0ac3e3bdaa46ea0 100644 (file)
@@ -40,14 +40,14 @@ public class OpenSCLDefinition extends AbstractHandler {
                 return;
             SCLModuleEditorInput input = new StandardSCLModuleEditorInput(moduleName);
             try {
-                SCLModuleEditor2 editor = (SCLModuleEditor2)page.openEditor(input, "org.simantics.scl.ui.editor2");
+                SCLModuleEditor2 editor = (SCLModuleEditor2)page.openEditor(input, "org.simantics.scl.ui.editor2"); //$NON-NLS-1$
                 if(location != Locations.NO_LOCATION) {
                     int begin = Locations.beginOf(location);
                     int end = Locations.endOf(location);
                     editor.selectAndReveal(begin, end-begin);
                 }
             } catch (PartInitException e) {
-                LOGGER.error("", e);
+                LOGGER.error("", e); //$NON-NLS-1$
             }
         };
     }
index b2df02fb4f0dc22e661926b34a8eac157c8f4b30..2be6609ce7ceb82df2480827362506fc46571db3 100644 (file)
@@ -32,9 +32,9 @@ public class OpenSCLModule extends AbstractHandler {
                 return;
             SCLModuleEditorInput input = new StandardSCLModuleEditorInput(moduleName);
             try {
-                page.openEditor(input, "org.simantics.scl.ui.editor2");
+                page.openEditor(input, "org.simantics.scl.ui.editor2"); //$NON-NLS-1$
             } catch (PartInitException e) {
-                LOGGER.error("Could not open module {} ", moduleName, e);
+                LOGGER.error("Could not open module {} ", moduleName, e); //$NON-NLS-1$
             }
         };
     }
index cbc6d9a0c2ec6fe4e8d923161ff1d93ab715be8c..43e4a80a0b80d8d91cf65120a286700970ae0587 100644 (file)
@@ -55,8 +55,8 @@ public class SCLAnnotationModel extends AnnotationModel {
             for(CompilationError error : errors) {
                 Annotation annotation = new Annotation(
                         error.severity == ErrorSeverity.ERROR || error.severity == ErrorSeverity.IMPORT_ERROR ?
-                                "org.eclipse.ui.workbench.texteditor.error" :
-                                    "org.eclipse.ui.workbench.texteditor.warning",
+                                "org.eclipse.ui.workbench.texteditor.error" : //$NON-NLS-1$
+                                    "org.eclipse.ui.workbench.texteditor.warning", //$NON-NLS-1$
                                     true, error.description);
                 int begin = Locations.beginOf(error.location);
                 int end = Locations.endOf(error.location);
index b7ab0f170ab92ae8c6572733c04a7d0c956e14d9..1b2096eb9c63932478c8e291bc442e7dd19986ba 100644 (file)
@@ -37,10 +37,10 @@ public class SCLModuleEditor2 extends TextEditor {
     
     private static final char[] CHARS = new char[] { '(', ')', '{', '}', '[', ']', '<', '>' };
     
-    private static final String MATCHING_BRACKETS = "matchingBrackets";
-    private static final String MATCHING_BRACKETS_COLOR = "matchingBracketsColor";
-    private static final String HIGHLIGHT_BRACKET_AT_CARET_LOCATION = "highlightBracketAtCaretLocation";
-    private static final String ENCLOSING_BRACKETS = "enclosingBrackets";
+    private static final String MATCHING_BRACKETS = "matchingBrackets"; //$NON-NLS-1$
+    private static final String MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
+    private static final String HIGHLIGHT_BRACKET_AT_CARET_LOCATION = "highlightBracketAtCaretLocation"; //$NON-NLS-1$
+    private static final String ENCLOSING_BRACKETS = "enclosingBrackets"; //$NON-NLS-1$
     
     private boolean disposed = false;
     protected ResourceManager resourceManager;
@@ -64,7 +64,7 @@ public class SCLModuleEditor2 extends TextEditor {
             throws PartInitException {
         super.init(site, input);
         getPreferenceStore().setValue(MATCHING_BRACKETS, true);
-        getPreferenceStore().setValue(MATCHING_BRACKETS_COLOR, "192,192,192");
+        getPreferenceStore().setValue(MATCHING_BRACKETS_COLOR, "192,192,192"); //$NON-NLS-1$
         getPreferenceStore().setValue(HIGHLIGHT_BRACKET_AT_CARET_LOCATION, true);
         getPreferenceStore().setValue(ENCLOSING_BRACKETS, true);
     }
@@ -72,7 +72,7 @@ public class SCLModuleEditor2 extends TextEditor {
     @Override
     public void createPartControl(Composite parent) {
         super.createPartControl(parent);
-        getEditorSite().getService(IContextService.class).activateContext("org.simantics.scl.ui.editor");
+        getEditorSite().getService(IContextService.class).activateContext("org.simantics.scl.ui.editor"); //$NON-NLS-1$
         updatePartName();
     }
 
index cf6bf9a87c6ade46606a2794453891406d19526e..d252a92306d74e1399caa9a5bca30175ba1ee78f 100644 (file)
@@ -50,14 +50,14 @@ public class SCLModuleEditor2DocumentProvider extends AbstractDocumentProvider {
         updateTextualModuleSource(element);
         if(currentSource == null)
             throw new CoreException(
-                    new Status(Status.ERROR, "org.simantics.scl.ui", "Source for the SCL module could not be found.")
+                    new Status(Status.ERROR, "org.simantics.scl.ui", Messages.SCLModuleEditor2DocumentProvider_Status_SCLSourceNotFound) //$NON-NLS-1$
                     );
         Document document;
         try {
             document = new Document(currentSource.getSourceText(null));
         } catch (IOException e) {
             throw new CoreException(
-                    new Status(Status.ERROR, "org.simantics.scl.ui", "Reading SCL module failed.", e)
+                    new Status(Status.ERROR, "org.simantics.scl.ui", "Reading SCL module failed.", e) //$NON-NLS-1$ //$NON-NLS-2$
                     );
         }
         IDocumentPartitioner partitioner = new FastPartitioner(new SCLPartitionScanner(), SCLPartitionScanner.PARTITION_TYPES);
index b853f4096e435f727b46bf2d661185adbe9e8e08..7b04360e555c0095e283adb9265b2aaa939c2cd3 100644 (file)
@@ -14,25 +14,23 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
 import org.eclipse.ui.dialogs.SearchPattern;
-import org.simantics.scl.compiler.common.names.Name;
-import org.simantics.scl.compiler.elaboration.modules.SCLValue;
 import org.simantics.scl.osgi.SCLOsgi;
 import org.simantics.scl.ui.Activator;
 
 import gnu.trove.procedure.TObjectProcedure;
 
 public class SCLModuleSelectionDialog extends FilteredItemsSelectionDialog {
-    private static final String DIALOG_SETTINGS = "SCLModuleSelectionDialogSettings";
+    private static final String DIALOG_SETTINGS = "SCLModuleSelectionDialogSettings"; //$NON-NLS-1$
 
     public SCLModuleSelectionDialog(Shell shell) {
         super(shell, false);
-        setTitle("Choose an SCL module");
+        setTitle(Messages.SCLModuleSelectionDialog_ChooseSCLModule);
         setSelectionHistory(new ModuleSelectionHistory());
         setListLabelProvider(new LabelProvider() {
             @Override
             public String getText(Object element) {
                 if(element == null)
-                    return "";
+                    return ""; //$NON-NLS-1$
                 return (String)element;
             }
         });
@@ -74,13 +72,13 @@ public class SCLModuleSelectionDialog extends FilteredItemsSelectionDialog {
                 if(patternText != null && patternText.length() > 0)
                     patternMatcher.setPattern(patternText);
                 else 
-                    patternMatcher.setPattern("*");
+                    patternMatcher.setPattern("*"); //$NON-NLS-1$
             }
             
             @Override
             public boolean matchItem(Object item) {
                 String text = item.toString();
-                if(getPattern().contains("/"))
+                if(getPattern().contains("/")) //$NON-NLS-1$
                     return matches(text);
                 else {
                     int p = text.lastIndexOf('/');
@@ -114,7 +112,7 @@ public class SCLModuleSelectionDialog extends FilteredItemsSelectionDialog {
     protected void fillContentProvider(AbstractContentProvider contentProvider,
             ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
                     throws CoreException {
-        progressMonitor.beginTask("Searching", 1); //$NON-NLS-1$
+        progressMonitor.beginTask(Messages.SCLModuleSelectionDialog_Searching, 1); 
         SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure<String>() {
             @Override
             public boolean execute(String moduleName) {
index 4b1158cfde0421440c23f12aec86bfa5d42a362c..26de81bea82c8715fc8b4eea8096bd27e2e44077 100644 (file)
@@ -9,8 +9,8 @@ import org.eclipse.jface.text.rules.SingleLineRule;
 import org.eclipse.jface.text.rules.Token;
 
 public class SCLPartitionScanner extends RuleBasedPartitionScanner {
-    public static final String SCL_COMMENT = "COMMENT";
-    public static final String SCL_STRING = "STRING";
+    public static final String SCL_COMMENT = "COMMENT"; //$NON-NLS-1$
+    public static final String SCL_STRING = "STRING"; //$NON-NLS-1$
     
     public static final IToken COMMENT_TOKEN = new Token(SCL_COMMENT);
     public static final IToken STRING_TOKEN = new Token(SCL_STRING);
@@ -24,10 +24,10 @@ public class SCLPartitionScanner extends RuleBasedPartitionScanner {
         super();
 
         setPredicateRules(new IPredicateRule[] {
-                new EndOfLineRule("//", COMMENT_TOKEN),
-                new MultiLineRule("\"\"\"", "\"\"\"", STRING_TOKEN, (char) 0, true),
-                new SingleLineRule("\"", "\"", STRING_TOKEN, '\\'),
-                new MultiLineRule("/*", "*/", COMMENT_TOKEN, (char) 0, true),
+                new EndOfLineRule("//", COMMENT_TOKEN), //$NON-NLS-1$
+                new MultiLineRule("\"\"\"", "\"\"\"", STRING_TOKEN, (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$
+                new SingleLineRule("\"", "\"", STRING_TOKEN, '\\'), //$NON-NLS-1$ //$NON-NLS-2$
+                new MultiLineRule("/*", "*/", COMMENT_TOKEN, (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$
         });
     }
 }
index ef6d5633a4318c92e8942a688ea919af52faf9b3..b74e35fb29d2da65ced075b24ff40b0204d0a9c2 100644 (file)
@@ -20,8 +20,8 @@ import org.eclipse.swt.graphics.RGB;
 import org.simantics.scl.ui.info.SCLInfo;
 
 public class SCLPresentationReconciler extends PresentationReconciler {
-    private static final FontDescriptor FONT_NORMAL = FontDescriptor.createFrom("Consolas", 10, SWT.NORMAL);
-    private static final FontDescriptor FONT_BOLD = FontDescriptor.createFrom("Consolas", 10, SWT.BOLD);
+    private static final FontDescriptor FONT_NORMAL = FontDescriptor.createFrom("Consolas", 10, SWT.NORMAL); //$NON-NLS-1$
+    private static final FontDescriptor FONT_BOLD = FontDescriptor.createFrom("Consolas", 10, SWT.BOLD); //$NON-NLS-1$
     
     public SCLPresentationReconciler(ResourceManager resourceManager) {
         Font font = resourceManager.createFont(FONT_NORMAL);
index 77477e8a828f69b7690aedfd7995d694fd02a829..fbe13fd86a54d1badbfe9900ac9fd5282aca9578 100644 (file)
@@ -83,7 +83,7 @@ public class StandardSCLModuleEditorInput implements SCLModuleEditorInput, IPers
 
     @Override
     public String getFactoryId() {
-        return "org.simantics.scl.ui.editor.inputFactory";
+        return "org.simantics.scl.ui.editor.inputFactory"; //$NON-NLS-1$
     }
 
 }
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/messages.properties
new file mode 100644 (file)
index 0000000..3eee2fd
--- /dev/null
@@ -0,0 +1,3 @@
+SCLModuleEditor2DocumentProvider_Status_SCLSourceNotFound=Source for the SCL module could not be found.
+SCLModuleSelectionDialog_ChooseSCLModule=Choose an SCL Module
+SCLModuleSelectionDialog_Searching=Searching
index ba5de128fc2fe8c14c0067c1fbedcc2d23a763d0..db8348e5867663ad11639fecdc100fe9d818716c 100644 (file)
@@ -12,15 +12,16 @@ public class BasicImportModulesAction extends ImportModulesAction {
     public static final BasicImportModulesAction INSTANCE = new BasicImportModulesAction();
             
     public BasicImportModulesAction() {
-        super("Add modules", 0.0);
+        super(Messages.BasicImportModulesAction_AddModules, 0.0);
     }
 
     @Override
     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
         SCLModuleSelectionDialog dialog = new SCLModuleSelectionDialog(shell);
+        dialog.setTitle(Messages.BasicImportModulesAction_AddModules);
         if(dialog.open() == Dialog.OK) {
             for(Object r : dialog.getResult()) {
-                new CommandSessionImportEntry((String)r, "", true).addTo(imports);
+                new CommandSessionImportEntry((String)r, "", true).addTo(imports); //$NON-NLS-1$
             }
             return true;
         }
index 7c3b042c72e674238f46a522ebf6ede4916e8074..3082f27abfdec7c349fe8bfd8d70cce51500fd42 100644 (file)
@@ -12,17 +12,17 @@ public class ExternalImportModulesAction extends ImportModulesAction {
     public static final ExternalImportModulesAction INSTANCE = new ExternalImportModulesAction();
             
     public ExternalImportModulesAction() {
-        super("Add external module", 95.0);
+        super(Messages.ExternalImportModulesAction_AddExternalModule, 95.0);
     }
 
     @Override
     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
         FileDialog dialog = new FileDialog(shell);
-        dialog.setFilterExtensions(new String[] {"*.scl"});
+        dialog.setFilterExtensions(new String[] {"*.scl"}); //$NON-NLS-1$
         
         String result = dialog.open();
         if(result != null) {
-            new CommandSessionImportEntry("file:" + result, "", true).addTo(imports);
+            new CommandSessionImportEntry("file:" + result, "", true).addTo(imports); //$NON-NLS-1$ //$NON-NLS-2$
             return true;
         }
         else
index f8fb202e3375c9f3b96174e8efd855b8b17a03c9..d8d2893863ab9971fc61e4f92564a6f514e27598 100644 (file)
@@ -70,7 +70,7 @@ public class ManageImportsDialog extends TrayDialog {
     @Override
     protected void configureShell(Shell newShell) {
         super.configureShell(newShell);
-        newShell.setText("Manage Imports");
+        newShell.setText(Messages.ManageImportsDialog_ManageImports);
         newShell.setMinimumSize(800, 600);
     }
 
@@ -106,7 +106,7 @@ public class ManageImportsDialog extends TrayDialog {
         // Column 1: module name
         TableViewerColumn column1 = new TableViewerColumn(tableViewer, SWT.NONE);
         column1.getColumn().setWidth(300);
-        column1.getColumn().setText("Module");
+        column1.getColumn().setText(Messages.ManageImportsDialog_Module);
         column1.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
@@ -153,7 +153,7 @@ public class ManageImportsDialog extends TrayDialog {
         // Column 2: local name
         TableViewerColumn column2 = new TableViewerColumn(tableViewer, SWT.NONE);
         column2.getColumn().setWidth(100);
-        column2.getColumn().setText("Local name");
+        column2.getColumn().setText(Messages.ManageImportsDialog_LocalName);
         column2.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
@@ -184,7 +184,7 @@ public class ManageImportsDialog extends TrayDialog {
         // Column 3: status
         TableViewerColumn column3 = new TableViewerColumn(tableViewer, SWT.NONE);
         column3.getColumn().setWidth(200);
-        column3.getColumn().setText("Status");
+        column3.getColumn().setText(Messages.ManageImportsDialog_Status);
         column3.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
@@ -232,7 +232,7 @@ public class ManageImportsDialog extends TrayDialog {
                 
                 {
                     MenuItem menuItem = new MenuItem(menu, SWT.NONE);
-                    menuItem.setText("Delete");
+                    menuItem.setText(Messages.ManageImportsDialog_Delete);
                     menuItem.addSelectionListener(new SelectionAdapter() {
                         public void widgetSelected(SelectionEvent e) {
                             THashSet<CommandSessionImportEntry> removedEntries =
@@ -248,7 +248,7 @@ public class ManageImportsDialog extends TrayDialog {
                 }
                 if(hasTransient) {
                     MenuItem menuItem = new MenuItem(menu, SWT.NONE);
-                    menuItem.setText("Make persistent");
+                    menuItem.setText(Messages.ManageImportsDialog_MakePersistent);
                     menuItem.addSelectionListener(new SelectionAdapter() {
                         public void widgetSelected(SelectionEvent e) {
                             for(CommandSessionImportEntry entry : entries)
@@ -259,7 +259,7 @@ public class ManageImportsDialog extends TrayDialog {
                 }
                 if(hasPersistent) {
                     MenuItem menuItem = new MenuItem(menu, SWT.NONE);
-                    menuItem.setText("Make transient");
+                    menuItem.setText(Messages.ManageImportsDialog_MakeTransient);
                     menuItem.addSelectionListener(new SelectionAdapter() {
                         public void widgetSelected(SelectionEvent e) {
                             for(CommandSessionImportEntry entry : entries)
@@ -270,7 +270,7 @@ public class ManageImportsDialog extends TrayDialog {
                 }
                 if(hasDisabled) {
                     MenuItem menuItem = new MenuItem(menu, SWT.NONE);
-                    menuItem.setText("Enable");
+                    menuItem.setText(Messages.ManageImportsDialog_Enable);
                     menuItem.addSelectionListener(new SelectionAdapter() {
                         public void widgetSelected(SelectionEvent e) {
                             for(CommandSessionImportEntry entry : entries)
@@ -281,7 +281,7 @@ public class ManageImportsDialog extends TrayDialog {
                 }
                 if(hasEnabled) {
                     MenuItem menuItem = new MenuItem(menu, SWT.NONE);
-                    menuItem.setText("Disable");
+                    menuItem.setText(Messages.ManageImportsDialog_Disable);
                     menuItem.addSelectionListener(new SelectionAdapter() {
                         public void widgetSelected(SelectionEvent e) {
                             for(CommandSessionImportEntry entry : entries)
index 987c0deb379bf0fb4ef194ef48e03ba9bac6106c..d1136d374ca48c65049a8d7231a5d9c90a9364f4 100644 (file)
@@ -13,15 +13,15 @@ public class ManualImportModulesAction extends ImportModulesAction {
     public static final ManualImportModulesAction INSTANCE = new ManualImportModulesAction();
             
     public ManualImportModulesAction() {
-        super("Add freeform module", 100.0);
+        super(Messages.ManualImportModulesAction_AddFreeformModule, 100.0);
     }
 
     @Override
     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
-        InputDialog dialog = new InputDialog(shell, "Select module", "Write the full name of the module",
-                "", null);
+        InputDialog dialog = new InputDialog(shell, Messages.ManualImportModulesAction_SelectModule,
+                       Messages.ManualImportModulesAction_SelectModuleMsg, "", null); //$NON-NLS-1$
         if(dialog.open() == Dialog.OK) {
-            new CommandSessionImportEntry(dialog.getValue(), "", true).addTo(imports);
+            new CommandSessionImportEntry(dialog.getValue(), "", true).addTo(imports); //$NON-NLS-1$
             return true;
         }
         else
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/Messages.java
new file mode 100644 (file)
index 0000000..4ab1c76
--- /dev/null
@@ -0,0 +1,28 @@
+package org.simantics.scl.ui.imports.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.imports.internal.messages"; //$NON-NLS-1$
+       public static String BasicImportModulesAction_AddModules;
+       public static String ExternalImportModulesAction_AddExternalModule;
+       public static String ManageImportsDialog_Delete;
+       public static String ManageImportsDialog_Disable;
+       public static String ManageImportsDialog_Enable;
+       public static String ManageImportsDialog_LocalName;
+       public static String ManageImportsDialog_MakePersistent;
+       public static String ManageImportsDialog_MakeTransient;
+       public static String ManageImportsDialog_ManageImports;
+       public static String ManageImportsDialog_Module;
+       public static String ManageImportsDialog_Status;
+       public static String ManualImportModulesAction_AddFreeformModule;
+       public static String ManualImportModulesAction_SelectModule;
+       public static String ManualImportModulesAction_SelectModuleMsg;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 32a42a47355e2087883e980a8d44a74e68430d32..bddd0960dd6ee4b020e0ed26a3a00233a32f8e48 100644 (file)
@@ -19,7 +19,7 @@ import org.simantics.scl.ui.Activator;
 
 public class SCLModuleSelectionDialog extends FilteredItemsSelectionDialog {
 
-    private static final String SCL_MODULE_SELECTION_DIALOG = "SCL_MODULE_SELECTION_DIALOG";
+    private static final String SCL_MODULE_SELECTION_DIALOG = "SCL_MODULE_SELECTION_DIALOG"; //$NON-NLS-1$
     
     public SCLModuleSelectionDialog(Shell shell) {
         super(shell, true);
@@ -54,7 +54,7 @@ public class SCLModuleSelectionDialog extends FilteredItemsSelectionDialog {
                 if(patternText != null && patternText.length() > 0)
                     patternMatcher.setPattern(patternText);
                 else 
-                    patternMatcher.setPattern("*");
+                    patternMatcher.setPattern("*"); //$NON-NLS-1$
             }
             
             @Override
@@ -62,7 +62,7 @@ public class SCLModuleSelectionDialog extends FilteredItemsSelectionDialog {
                 if(getPattern().indexOf('/') > 0)
                     return matches((String)item);
                 else {
-                    for(String part : ((String)item).split("/"))
+                    for(String part : ((String)item).split("/")) //$NON-NLS-1$
                         if(matches(part))
                             return true;
                     return false;
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/messages.properties
new file mode 100644 (file)
index 0000000..678ab88
--- /dev/null
@@ -0,0 +1,14 @@
+BasicImportModulesAction_AddModules=Add Modules\r
+ExternalImportModulesAction_AddExternalModule=Add External Module\r
+ManageImportsDialog_Delete=Delete\r
+ManageImportsDialog_Disable=Disable\r
+ManageImportsDialog_Enable=Enable\r
+ManageImportsDialog_LocalName=Local name\r
+ManageImportsDialog_MakePersistent=Make Persistent\r
+ManageImportsDialog_MakeTransient=Make Transient\r
+ManageImportsDialog_ManageImports=Manage Imports\r
+ManageImportsDialog_Module=Module\r
+ManageImportsDialog_Status=Status\r
+ManualImportModulesAction_AddFreeformModule=Add Freeform Module\r
+ManualImportModulesAction_SelectModule=Select Module\r
+ManualImportModulesAction_SelectModuleMsg=Write the full name of the module\r
index c37a9421f53bacb3f4c310381b160e7716d32727..a9ad2111d6d807134c7af65c38e6565fdee07a49 100644 (file)
@@ -3,46 +3,46 @@ package org.simantics.scl.ui.info;
 public class SCLInfo {
 
     public static String[] RESERVED_WORDS = new String[] {
-        "module",
+        "module", //$NON-NLS-1$
             
-        "data",
-        "type",
-        "effect",
-        "class",
-        "deriving",
-        "instance",
+        "data", //$NON-NLS-1$
+        "type", //$NON-NLS-1$
+        "effect", //$NON-NLS-1$
+        "class", //$NON-NLS-1$
+        "deriving", //$NON-NLS-1$
+        "instance", //$NON-NLS-1$
         
-        "if",
-        "then",        
-        "else",      
-        "match",
-        "with",
-        "where",
-        "do",
-        "mdo",
-        "let",
-        "in",
+        "if", //$NON-NLS-1$
+        "then",         //$NON-NLS-1$
+        "else",       //$NON-NLS-1$
+        "match", //$NON-NLS-1$
+        "with", //$NON-NLS-1$
+        "where", //$NON-NLS-1$
+        "do", //$NON-NLS-1$
+        "mdo", //$NON-NLS-1$
+        "let", //$NON-NLS-1$
+        "in", //$NON-NLS-1$
         
-        "infix",
-        "infixl",
-        "infixr",
+        "infix", //$NON-NLS-1$
+        "infixl", //$NON-NLS-1$
+        "infixr", //$NON-NLS-1$
         
-        "import",
-        "include",
-        "hiding",
-        "importJava",
+        "import", //$NON-NLS-1$
+        "include", //$NON-NLS-1$
+        "hiding", //$NON-NLS-1$
+        "importJava", //$NON-NLS-1$
         
-        "as",
-        "forall",
-        "rule",
-        "ruleset",
-        "constraint",
-        "extends",
-        "by",
-        "select",
-        "enforce",
-        "transformation",
-        "when"
+        "as", //$NON-NLS-1$
+        "forall", //$NON-NLS-1$
+        "rule", //$NON-NLS-1$
+        "ruleset", //$NON-NLS-1$
+        "constraint", //$NON-NLS-1$
+        "extends", //$NON-NLS-1$
+        "by", //$NON-NLS-1$
+        "select", //$NON-NLS-1$
+        "enforce", //$NON-NLS-1$
+        "transformation", //$NON-NLS-1$
+        "when" //$NON-NLS-1$
     };
     
 }
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/Messages.java
new file mode 100644 (file)
index 0000000..baa7b2e
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.scl.ui.issues;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.issues.messages"; //$NON-NLS-1$
+       public static String SCLIssuesView_Description;
+       public static String SCLIssuesView_Module;
+       public static String SCLIssuesView_Refresh;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 9f4994eb1ddd42b141d680a370e0b60be1018cbe..ff7d7f57c2d93a903fd147cbd0b4e89619045554 100644 (file)
@@ -63,14 +63,14 @@ public class SCLIssuesView extends ViewPart {
     public void init(IViewSite site, IMemento memento)
             throws PartInitException {
         super.init(site, memento);
-        IAction action = new Action("Refresh") {
+        IAction action = new Action(Messages.SCLIssuesView_Refresh) {
             @Override
             public void run() {
                 tableViewer.setInput(SCLOsgi.MODULE_REPOSITORY);
 //                issuesContentProvider.refresh()
             }
         };
-        action.setImageDescriptor(imageRegistry.getDescriptor("arrow_refresh"));
+        action.setImageDescriptor(imageRegistry.getDescriptor("arrow_refresh")); //$NON-NLS-1$
         site.getActionBars().getToolBarManager().add(action);
     }
     
@@ -90,7 +90,7 @@ public class SCLIssuesView extends ViewPart {
         table.setLinesVisible(true);
 
         column1 = new TableViewerColumn(tableViewer, SWT.NONE);
-        column1.getColumn().setText("Module");
+        column1.getColumn().setText(Messages.SCLIssuesView_Module);
         column1.getColumn().setWidth(COLUMN1_DEFAULT_WIDTH);
         column1.getColumn().setResizable(true);
         column1.setLabelProvider(new ColumnLabelProvider() {
@@ -103,15 +103,15 @@ public class SCLIssuesView extends ViewPart {
             public Image getImage(Object element) {
                 SCLIssuesTableEntry entry = (SCLIssuesTableEntry)element;
                 return entry.error.severity == ErrorSeverity.ERROR
-                        ? imageRegistry.get("error")
+                        ? imageRegistry.get("error") //$NON-NLS-1$
                         : entry.error.severity == ErrorSeverity.IMPORT_ERROR
-                        ? imageRegistry.get("import_error")
-                        : imageRegistry.get("warning");
+                        ? imageRegistry.get("import_error") //$NON-NLS-1$
+                        : imageRegistry.get("warning"); //$NON-NLS-1$
             }
         });
         
         column2 = new TableViewerColumn(tableViewer, SWT.NONE);
-        column2.getColumn().setText("Description");
+        column2.getColumn().setText(Messages.SCLIssuesView_Description);
         column2.getColumn().setResizable(false);
         column2.setLabelProvider(new ColumnLabelProvider() {
             @Override
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/messages.properties
new file mode 100644 (file)
index 0000000..ef36829
--- /dev/null
@@ -0,0 +1,3 @@
+SCLIssuesView_Description=Description\r
+SCLIssuesView_Module=Module\r
+SCLIssuesView_Refresh=Refresh\r
index 1d70442c85d709f5162f06da8e7427ca8b252404..fb47d553e0a19a4bc60c004dd4d1632966a04c4c 100644 (file)
@@ -12,15 +12,15 @@ import org.simantics.scl.ui.Activator;
 import gnu.trove.map.hash.THashMap;
 
 public class CreateModuleAction {
-    public static final String PREFIX = "reference:file:/";
+    public static final String PREFIX = "reference:file:/"; //$NON-NLS-1$
     
     public static final void createModule(Bundle bundle, String packageName, String moduleName) throws IOException {
         String bundleLocation = bundle.getLocation();
         bundleLocation = bundleLocation.substring(PREFIX.length());
         
-        Path packagePath = Paths.get(bundleLocation).resolve("scl").resolve(packageName);
+        Path packagePath = Paths.get(bundleLocation).resolve("scl").resolve(packageName); //$NON-NLS-1$
         Files.createDirectories(packagePath);
-        Path modulePath = packagePath.resolve(moduleName + ".scl");
+        Path modulePath = packagePath.resolve(moduleName + ".scl"); //$NON-NLS-1$
         if(Files.exists(modulePath))
             return;
         Files.createFile(modulePath);
@@ -31,7 +31,7 @@ public class CreateModuleAction {
         THashMap<String,Bundle> result = new THashMap<String,Bundle>();
         for(Bundle bundle : context.getBundles()) {
             String location = bundle.getLocation();
-            if(location.endsWith(".jar") || !location.startsWith(PREFIX))
+            if(location.endsWith(".jar") || !location.startsWith(PREFIX)) //$NON-NLS-1$
                 continue;
             location = location.substring(PREFIX.length());
             Path bundlePath = Paths.get(location);
@@ -46,21 +46,21 @@ public class CreateModuleAction {
         for(Bundle bundle : bundles.values()) {
             String location = bundle.getLocation();
             location = location.substring(PREFIX.length());
-            Path packagePath = Paths.get(location).resolve("scl").resolve(packageName);
+            Path packagePath = Paths.get(location).resolve("scl").resolve(packageName); //$NON-NLS-1$
             if(Files.exists(packagePath))
                 return bundle.getSymbolicName();
         }
         int p = packageName.lastIndexOf('/');
         if(p == -1)
-            return "";
+            return ""; //$NON-NLS-1$
         else
             return findBestPlugin(bundles, packageName.substring(0, p));
     }
 
     public static int packageMatchLength(Bundle bundle, String packageName) {
-        if(bundle.getEntry("scl") == null)
+        if(bundle.getEntry("scl") == null) //$NON-NLS-1$
             return 0;
-        packageName = "scl/" + packageName;
+        packageName = "scl/" + packageName; //$NON-NLS-1$
         while(packageName.length() > 3) {
             if(bundle.getEntry(packageName) != null)
                 return packageName.length();
index 7dcfc2f0e65fdc19c270260f9ee5e1f656d88e7b..107837f95a213436978b9519c90ccd8c4f96088a 100644 (file)
@@ -34,8 +34,8 @@ public class CreateModuleDialog extends Dialog {
 
     SCLModuleBrowser parentBrowser;
     
-    String initialPackageName = "";
-    String initialPluginName = "";
+    String initialPackageName = ""; //$NON-NLS-1$
+    String initialPluginName = ""; //$NON-NLS-1$
     
     Text packageName;
     Text moduleName;
@@ -57,7 +57,7 @@ public class CreateModuleDialog extends Dialog {
 
     @Override
     protected Control createDialogArea(Composite parent) {
-        getShell().setText("Create New Module");
+        getShell().setText(Messages.CreateModuleDialog_CreateNewModule);
         getShell().addDisposeListener(new DisposeListener() {
             @Override
             public void widgetDisposed(DisposeEvent e) {
@@ -71,7 +71,7 @@ public class CreateModuleDialog extends Dialog {
 
         // Package name
         Label packageNameLabel = new Label(composite, SWT.NONE);
-        packageNameLabel.setText("Package");
+        packageNameLabel.setText(Messages.CreateModuleDialog_Package);
         GridDataFactory.fillDefaults().applyTo(packageNameLabel);
 
         packageName = new Text(composite, SWT.BORDER);
@@ -81,7 +81,7 @@ public class CreateModuleDialog extends Dialog {
 
         // Module name
         Label moduleNameLabel = new Label(composite, SWT.NONE);
-        moduleNameLabel.setText("Module name");
+        moduleNameLabel.setText(Messages.CreateModuleDialog_ModuleName);
         GridDataFactory.fillDefaults().applyTo(moduleNameLabel);
 
         moduleName = new Text(composite, SWT.BORDER);
@@ -90,7 +90,7 @@ public class CreateModuleDialog extends Dialog {
 
         // Plugin
         Label pluginNameLabel = new Label(composite, SWT.NONE);
-        pluginNameLabel.setText("Plugin");
+        pluginNameLabel.setText(Messages.CreateModuleDialog_Plugin);
         GridDataFactory.fillDefaults().applyTo(pluginNameLabel);
 
         Composite pluginNameComposite = new Composite(composite, SWT.NONE);
@@ -103,7 +103,7 @@ public class CreateModuleDialog extends Dialog {
         pluginName.addModifyListener(modifyListener);
         
         Button browsePlugins = new Button(pluginNameComposite, SWT.PUSH);
-        browsePlugins.setText("Browse...");
+        browsePlugins.setText(Messages.CreateModuleDialog_Browse);
         GridDataFactory.fillDefaults().applyTo(browsePlugins);
         browsePlugins.addSelectionListener(new SelectionAdapter() {
             @Override
@@ -145,7 +145,7 @@ public class CreateModuleDialog extends Dialog {
         
         boolean validModuleName = CreateModuleValidator.isValidModuleName(moduleName.getText());
         if(validModuleName && validPackageName) {
-            String fullModuleName = packageName.getText() + "/" + moduleName.getText();
+            String fullModuleName = packageName.getText() + "/" + moduleName.getText(); //$NON-NLS-1$
             validModuleName = SCLOsgi.SOURCE_REPOSITORY.getModuleSource(fullModuleName, null) == null;
         }
         moduleName.setBackground(validModuleName ? normalBackground : errorBackground);
@@ -175,11 +175,11 @@ public class CreateModuleDialog extends Dialog {
             if(bundle != null) {
                 CreateModuleAction.createModule(bundle, packageName.getText(), moduleName.getText());
                 parentBrowser.refresh();
-                OpenSCLModule.scheduleOpenModule(packageName.getText() + "/" + moduleName.getText());
+                OpenSCLModule.scheduleOpenModule(packageName.getText() + "/" + moduleName.getText()); //$NON-NLS-1$
             }
         } catch (IOException e) {
-            ErrorDialog.openError(getParentShell(), "Module creation failed", e.getMessage(),
-                    new Status(Status.ERROR, "org.simantics.scl.ui", e.getMessage()));
+            ErrorDialog.openError(getParentShell(), "Module creation failed", e.getMessage(), //$NON-NLS-1$
+                    new Status(Status.ERROR, "org.simantics.scl.ui", e.getMessage())); //$NON-NLS-1$
         }
         super.okPressed();
     }
index d3236c0dd0f3a051c3deccf2300e1acf13243164..a8d252f09f5ba949cd3034f97b32eef3c0d7b8f6 100644 (file)
@@ -4,7 +4,7 @@ public class CreateModuleValidator {
     public static boolean isValidPackageName(String packageName) {
         if(packageName.isEmpty())
             return true;
-        for(String part : packageName.split("/", -1))
+        for(String part : packageName.split("/", -1)) //$NON-NLS-1$
             if(!isValidModuleName(part))
                 return false;
         return true;
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/Messages.java
new file mode 100644 (file)
index 0000000..27a6eda
--- /dev/null
@@ -0,0 +1,22 @@
+package org.simantics.scl.ui.modulebrowser;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.modulebrowser.messages"; //$NON-NLS-1$
+       public static String CreateModuleDialog_Browse;
+       public static String CreateModuleDialog_CreateNewModule;
+       public static String CreateModuleDialog_ModuleName;
+       public static String CreateModuleDialog_Package;
+       public static String CreateModuleDialog_Plugin;
+       public static String SCLModuleBrowser_NewModuleDots;
+       public static String SCLModuleBrowser_RefreshModules;
+       public static String SCLModuleBrowser_SCLModules;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 2461e5231e5535a504092acb15c0d132cb4b97c3..ec5050815251a22da54496703e7d7a905cd722df 100644 (file)
@@ -6,8 +6,8 @@ import java.util.Iterator;
 import gnu.trove.map.hash.THashMap;
 
 public class ModuleNameTreeEntry implements Comparable<ModuleNameTreeEntry> {
-    public static final String STANDARD_LIBRARY = "StandardLibrary";
-    public static final String HTTP_PREFIX = "http://";
+    public static final String STANDARD_LIBRARY = "StandardLibrary"; //$NON-NLS-1$
+    public static final String HTTP_PREFIX = "http://"; //$NON-NLS-1$
     
     public final ModuleNameTreeEntry parent;
     public final String fullName;
@@ -51,12 +51,12 @@ public class ModuleNameTreeEntry implements Comparable<ModuleNameTreeEntry> {
             String newFullName;
             if(parent == null) {
                 if(name.equals(STANDARD_LIBRARY))
-                    newFullName = "";
+                    newFullName = ""; //$NON-NLS-1$
                 else
                     newFullName = name;
             }
             else
-                newFullName = fullName + "/" + name;
+                newFullName = fullName + "/" + name; //$NON-NLS-1$
             entry = new ModuleNameTreeEntry(this, newFullName, name);
             childMap.put(name, entry);
         }
index 30e84f8fbf0f694f47ef58019a9ea93bced87bc7..cafda7ab6ba5c5b594ae3dc302d80f5f2702da4a 100644 (file)
@@ -19,7 +19,7 @@ import org.simantics.scl.ui.Activator;
 
 public class PluginSelectionDialog extends FilteredItemsSelectionDialog {
 
-    private static final String PLUGIN_SELECTION_DIALOG = "PLUGIN_SELECTION_DIALOG";
+    private static final String PLUGIN_SELECTION_DIALOG = "PLUGIN_SELECTION_DIALOG"; //$NON-NLS-1$
     
     public static class Entry {
         Bundle bundle;
@@ -39,7 +39,7 @@ public class PluginSelectionDialog extends FilteredItemsSelectionDialog {
             public String getText(Object element) {
                 Entry entry = (Entry)element;
                 if(entry == null)
-                    return "NULL";
+                    return "NULL"; //$NON-NLS-1$
                 return entry.bundle.getSymbolicName();
             }
         });
@@ -74,7 +74,7 @@ public class PluginSelectionDialog extends FilteredItemsSelectionDialog {
                 if(patternText != null && patternText.length() > 0)
                     patternMatcher.setPattern(patternText);
                 else 
-                    patternMatcher.setPattern("*");
+                    patternMatcher.setPattern("*"); //$NON-NLS-1$
             }
             
             @Override
@@ -84,7 +84,7 @@ public class PluginSelectionDialog extends FilteredItemsSelectionDialog {
                 if(getPattern().indexOf('/') > 0)
                     return matches(name);
                 else {
-                    for(String part : name.split("/"))
+                    for(String part : name.split("/")) //$NON-NLS-1$
                         if(matches(part))
                             return true;
                     return false;
index 90d297c1a246b07a2c680e0d24dc09fa5f520f79..82dcd45584e473acc914a990e665d570d3834ab2 100644 (file)
@@ -24,7 +24,7 @@ public class SCLModuleBrowser extends ViewPart {
     @Override
     public void createPartControl(Composite parent) {
         this.content = new SCLModuleTree(parent, SWT.NONE, SCLOsgi.MODULE_REPOSITORY);
-        setPartName("SCL Modules");
+        setPartName(Messages.SCLModuleBrowser_SCLModules);
         
         // Opening modules
         content.addDoubleClickListener(new IDoubleClickListener() {
@@ -41,8 +41,8 @@ public class SCLModuleBrowser extends ViewPart {
         
         // Toolbar
         IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
-        toolBarManager.add(new Action("Refresh modules",
-                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_refresh.png")) {
+        toolBarManager.add(new Action(Messages.SCLModuleBrowser_RefreshModules,
+                Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/arrow_refresh.png")) { //$NON-NLS-1$ //$NON-NLS-2$
             @Override
             public void run() {
                 refresh();
@@ -55,7 +55,7 @@ public class SCLModuleBrowser extends ViewPart {
         menuMgr.addMenuListener(new IMenuListener() {
             public void menuAboutToShow(IMenuManager manager) {
                 ModuleNameTreeEntry entry = (ModuleNameTreeEntry)content.getStructuredSelection().getFirstElement();
-                manager.add(new Action("New Module...") {
+                manager.add(new Action(Messages.SCLModuleBrowser_NewModuleDots) {
                     @Override
                     public void run() {
                         CreateModuleDialog dialog = new CreateModuleDialog(content.getControl().getShell(), SCLModuleBrowser.this);
index d73639c70a7985a3a1a753431806bd162f133f24..bb7d80dfd59e17659e5fc792b3a3204f142f03a8 100644 (file)
@@ -6,7 +6,7 @@ import org.simantics.scl.compiler.module.repository.ModuleRepository;
 
 public class SCLModuleTreeContentProvider implements ITreeContentProvider {
     private ModuleRepository repository;
-    private final ModuleNameTreeEntry rootEntry = new ModuleNameTreeEntry(null, "", "");
+    private final ModuleNameTreeEntry rootEntry = new ModuleNameTreeEntry(null, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
     
     public void update() {
         rootEntry.clearModuleFlags();
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/messages.properties
new file mode 100644 (file)
index 0000000..4dddc73
--- /dev/null
@@ -0,0 +1,8 @@
+CreateModuleDialog_Browse=Browse...\r
+CreateModuleDialog_CreateNewModule=Create New Module\r
+CreateModuleDialog_ModuleName=Module name\r
+CreateModuleDialog_Package=Package\r
+CreateModuleDialog_Plugin=Plugin\r
+SCLModuleBrowser_NewModuleDots=New Module...\r
+SCLModuleBrowser_RefreshModules=Refresh Modules\r
+SCLModuleBrowser_SCLModules=SCL Modules\r
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/Messages.java
new file mode 100644 (file)
index 0000000..b2dea8b
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.scl.ui.search;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.search.messages"; //$NON-NLS-1$
+       public static String SCLSearchQuery_SearchReferencesFor;
+       public static String SCLSearchResult_SCLSearchLabelFor;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 264cbc57a201098be5ea0e3249bca1d9a37eff92..724730a080112ebfec0fdfc2f22a465d5a1f7020 100644 (file)
@@ -73,7 +73,7 @@ public class SCLSearchQuery implements ISearchQuery {
 
     @Override
     public String getLabel() {
-        return "Search references for ";
+        return Messages.SCLSearchQuery_SearchReferencesFor;
     }
 
     @Override
index 859a29d16b51b8d2dbefce007fedb2ba02c0e244..dd048ec46f19f135cbf51b70bce97f2b0c9a2816 100644 (file)
@@ -2,6 +2,7 @@ package org.simantics.scl.ui.search;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.search.ui.ISearchQuery;
 import org.eclipse.search.ui.text.AbstractTextSearchResult;
 import org.eclipse.search.ui.text.IEditorMatchAdapter;
@@ -19,7 +20,7 @@ public class SCLSearchResult  extends AbstractTextSearchResult implements IEdito
 
     @Override
     public String getLabel() {
-        return "SCL search result label for " + query.getValueName();
+        return NLS.bind(Messages.SCLSearchResult_SCLSearchLabelFor , query.getValueName());
     }
 
     @Override
index bed4fb123591a2c98df61d3e6bb14618e7d8a4e0..feace875f50dde17fbfe70f6e3b1c4f821c004a2 100644 (file)
@@ -316,7 +316,7 @@ public class SCLSearchResultPage extends AbstractTextSearchViewPage {
                 SCLExpressionTableEntry entry = (SCLExpressionTableEntry) element;
                 return entry.getContent();
             } else {
-                return "unsupported element " + String.valueOf(element);
+                return "unsupported element " + String.valueOf(element); //$NON-NLS-1$
             }
         }
 
@@ -373,7 +373,7 @@ public class SCLSearchResultPage extends AbstractTextSearchViewPage {
                 SCLExpressionTableEntry entry = (SCLExpressionTableEntry) element;
                 return entry.getContent();
             } else {
-                return "unsupported element " + String.valueOf(element);
+                return "unsupported element " + String.valueOf(element); //$NON-NLS-1$
             }
         }
         
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/messages.properties
new file mode 100644 (file)
index 0000000..0a73e52
--- /dev/null
@@ -0,0 +1,2 @@
+SCLSearchQuery_SearchReferencesFor=Search references for \r
+SCLSearchResult_SCLSearchLabelFor=SCL search result label for {0}\r
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/Messages.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/Messages.java
new file mode 100644 (file)
index 0000000..b9489d7
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.scl.ui.tests;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.scl.ui.tests.messages"; //$NON-NLS-1$
+       public static String SCLTestsDialog_MonitorSearchingTests;
+       public static String SCLTestsDialog_NoName;
+       public static String SCLTestsDialog_RunSCLTests;
+       public static String SCLTestsDialog_RunTest;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 75e6e836e539aaea4e7b5069766765bbc5310cdb..a595a81d4512755db89eed621c1ef3a5d45c71f4 100644 (file)
@@ -22,21 +22,21 @@ import org.simantics.scl.ui.Activator;
 
 public class SCLTestsDialog extends FilteredItemsSelectionDialog {
 
-    private static final String SCL_TEST_DIALOG_SETTINGS = "SCLTestDialogSettings";
+    private static final String SCL_TEST_DIALOG_SETTINGS = "SCLTestDialogSettings"; //$NON-NLS-1$
     
     private List<TestRunnable> tests;
 
     public SCLTestsDialog(Shell shell, List<TestRunnable> tests, boolean multi) {
         super(shell, multi);
         this.tests = tests;
-        setTitle("Run SCL Tests");
+        setTitle(Messages.SCLTestsDialog_RunSCLTests);
         setListLabelProvider(new LabelProvider() {
             
             @Override
             public String getText(Object element) {
                 if (element != null)
                     return ((TestRunnable) element).getName();
-                return "No name!";
+                return Messages.SCLTestsDialog_NoName;
             }
         });
         setSelectionHistory(new ResourceSelectionHistory());
@@ -78,7 +78,7 @@ public class SCLTestsDialog extends FilteredItemsSelectionDialog {
     protected void createButtonsForButtonBar(Composite parent) {
         super.createButtonsForButtonBar(parent);
         Button okButton = getButton(IDialogConstants.OK_ID);
-        okButton.setText("Run test");
+        okButton.setText(Messages.SCLTestsDialog_RunTest);
         setButtonLayoutData(okButton);
     }
 
@@ -107,7 +107,7 @@ public class SCLTestsDialog extends FilteredItemsSelectionDialog {
                 if(patternText != null && patternText.length() > 0)
                     patternMatcher.setPattern(patternText);
                 else 
-                    patternMatcher.setPattern("**");
+                    patternMatcher.setPattern("**"); //$NON-NLS-1$
             }
             @Override
             public boolean matchItem(Object item) {
@@ -115,7 +115,7 @@ public class SCLTestsDialog extends FilteredItemsSelectionDialog {
                 if(getPattern().indexOf('/') > 0)
                     return matches(testName);
                 else {
-                    for(String part : (testName.split("/")))
+                    for(String part : (testName.split("/"))) //$NON-NLS-1$
                         if(matches(part))
                             return true;
                     return false;
@@ -145,7 +145,7 @@ public class SCLTestsDialog extends FilteredItemsSelectionDialog {
     protected void fillContentProvider(AbstractContentProvider contentProvider,
             ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
             throws CoreException {
-        progressMonitor.beginTask("Searching tests..", tests.size());
+        progressMonitor.beginTask(Messages.SCLTestsDialog_MonitorSearchingTests, tests.size());
         for (TestRunnable test : tests) {
             contentProvider.add(test, itemsFilter);
             progressMonitor.worked(1);
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/messages.properties b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/messages.properties
new file mode 100644 (file)
index 0000000..4fb12e9
--- /dev/null
@@ -0,0 +1,4 @@
+SCLTestsDialog_MonitorSearchingTests=Searching tests..\r
+SCLTestsDialog_NoName=No name\!\r
+SCLTestsDialog_RunSCLTests=Run SCL Tests\r
+SCLTestsDialog_RunTest=Run Test\r
diff --git a/i18n.md b/i18n.md
new file mode 100644 (file)
index 0000000..8da7b4a
--- /dev/null
+++ b/i18n.md
@@ -0,0 +1,10 @@
+## Strings externalized from bundles ##
+
+* [x] org.simantics.scl.ui
+
+## TODO ##
+
+* [ ] org.simantics.event
+* [ ] org.simantics.modeling.ui
+* [ ] org.simantics.browsing.ui*
+* ...