]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Externalize strings in org.simantics.desktop.ui 04/2504/3
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 28 Nov 2018 15:12:28 +0000 (17:12 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 7 Dec 2018 16:19:51 +0000 (18:19 +0200)
gitlab #210

Change-Id: Id1ac35d76c9cd9b6541b9c6eed1b21322d30fbb7

bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/DesktopProjectFeature.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportModel.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportSharedLibrary.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportSharedLibrary.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java [new file with mode: 0644]
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/NewModel.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties [new file with mode: 0644]
i18n.md

index c3b3b6f18b08e97ddc64d925b914729defb8a5d6..01526a56f5f7d4df3703a01a0f058c84271d8c26 100644 (file)
@@ -16,7 +16,7 @@ import org.simantics.project.features.AbstractProjectFeature;
 
 public class DesktopProjectFeature extends AbstractProjectFeature {
 
 
 public class DesktopProjectFeature extends AbstractProjectFeature {
 
-    private static final String DEFAULT_PERSPECTIVE = "org.simantics.desktop.modelling.perspective";
+    private static final String DEFAULT_PERSPECTIVE = "org.simantics.desktop.modelling.perspective"; //$NON-NLS-1$
 
     @Override
     public void configure() throws ProjectException {
 
     @Override
     public void configure() throws ProjectException {
index 81bcc0357ba8cc07b920c130ea2a983b171ee2e2..b75c0bd442a3ddd8e43bd4374de460eb5ed87191 100644 (file)
@@ -53,7 +53,7 @@ public class ExportModel extends AbstractHandler {
             context.setHint(SelectionHints.KEY_MAIN, lib);
 
                        IStructuredSelection sel = new StructuredSelection(context);
             context.setHint(SelectionHints.KEY_MAIN, lib);
 
                        IStructuredSelection sel = new StructuredSelection(context);
-               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.modelExportWizard");
+               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.modelExportWizard"); //$NON-NLS-1$
                } catch (DatabaseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (DatabaseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
index 96f7da83094e142d9ee1998b12943cbf5f2d995c..be11bcccca857ae26f66e5f75db375ed5a4a63d3 100644 (file)
@@ -40,7 +40,7 @@ public class ExportSharedLibrary extends AbstractHandler {
 
                                @Override
                                public Resource perform(ReadGraph graph) throws DatabaseException {
 
                                @Override
                                public Resource perform(ReadGraph graph) throws DatabaseException {
-                                       List<Resource> ontologies =  Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
+                                       List<Resource> ontologies =  Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE); //$NON-NLS-1$ //$NON-NLS-2$
                                        if(ontologies.size() == 1) return ontologies.iterator().next();
                                        return null;
                                }
                                        if(ontologies.size() == 1) return ontologies.iterator().next();
                                        return null;
                                }
@@ -52,7 +52,7 @@ public class ExportSharedLibrary extends AbstractHandler {
             context.setHint(SelectionHints.KEY_MAIN, lib);
 
                        IStructuredSelection sel = new StructuredSelection(context);
             context.setHint(SelectionHints.KEY_MAIN, lib);
 
                        IStructuredSelection sel = new StructuredSelection(context);
-               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyExportWizard");
+               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyExportWizard"); //$NON-NLS-1$
                } catch (DatabaseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (DatabaseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
index 25d7d3a1715922fc1a79010b633b01fb8458e9a0..8bb0783f317f861c345d76ca9be64732556861b0 100644 (file)
@@ -35,20 +35,20 @@ public class ImportModel extends AbstractHandler {
         // Get imported transferable graph file using FileDialog
         Shell shell = HandlerUtil.getActiveShellChecked(event);
         FileDialog fd = new FileDialog(shell, SWT.OPEN);
         // Get imported transferable graph file using FileDialog
         Shell shell = HandlerUtil.getActiveShellChecked(event);
         FileDialog fd = new FileDialog(shell, SWT.OPEN);
-        fd.setText("Import Model");
+        fd.setText(Messages.ImportModel_ImportModel);
 
 
-        String path = Activator.getDefault().getPreferenceStore().getString("IMPORT_MODEL_PATH");
+        String path = Activator.getDefault().getPreferenceStore().getString("IMPORT_MODEL_PATH"); //$NON-NLS-1$
         if(path.isEmpty() || !(new File(path).exists())){
         if(path.isEmpty() || !(new File(path).exists())){
-               path = System.getProperty("user.dir");
+               path = System.getProperty("user.dir"); //$NON-NLS-1$
         }
         
         fd.setFilterPath(path);
         }
         
         fd.setFilterPath(path);
-        String[] filterExt = {"*.tg", "*.*"};
+        String[] filterExt = {"*.tg", "*.*"}; //$NON-NLS-1$ //$NON-NLS-2$
         fd.setFilterExtensions(filterExt);
         final String selected = fd.open();
         if(selected == null) return null;
 
         fd.setFilterExtensions(filterExt);
         final String selected = fd.open();
         if(selected == null) return null;
 
-        Job job = new DatabaseJob("Import model") {
+        Job job = new DatabaseJob(Messages.ImportModel_DatabaseImportModel) { 
 
             @Override
             protected IStatus run(IProgressMonitor monitor) {
 
             @Override
             protected IStatus run(IProgressMonitor monitor) {
index 113c11926cbe69e068dc8b6efe827041ef2491f9..0bc9852f9997dbefb076e207fb80117c22b81996 100644 (file)
@@ -25,7 +25,7 @@ public class ImportSharedLibrary extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         
                IStructuredSelection sel = new StructuredSelection();
     public Object execute(ExecutionEvent event) throws ExecutionException {
         
                IStructuredSelection sel = new StructuredSelection();
-       ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyImportWizard");
+       ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyImportWizard"); //$NON-NLS-1$
        return null;
         
     }
        return null;
         
     }
diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java
new file mode 100644 (file)
index 0000000..805f90d
--- /dev/null
@@ -0,0 +1,23 @@
+package org.simantics.desktop.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.desktop.ui.internal.messages"; //$NON-NLS-1$
+       public static String ImportModel_DatabaseImportModel;
+       public static String ImportModel_ImportModel;
+       public static String NewModel_0_Failed;
+       public static String NewModel_Book1;
+       public static String NewModel_Library;
+       public static String NewModel_NewModel;
+       public static String NewModel_Sheet1;
+       public static String NewModel_Sheet2;
+       public static String NewModel_Sheet3;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ffa408e3cfaf2a7f9b561dbd34a6de8ad14edc69..ad759314c68d11962981df7801d486d745cd6e73 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.DatabaseJob;
 import org.simantics.Simantics;
 import org.simantics.db.Resource;
 import org.simantics.DatabaseJob;
 import org.simantics.Simantics;
 import org.simantics.db.Resource;
@@ -39,7 +40,7 @@ public class NewModel extends AbstractHandler {
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        Job job = new DatabaseJob("Creating Model") {
+        Job job = new DatabaseJob(Messages.NewModel_NewModel) {  
             @Override
             protected IStatus run(IProgressMonitor monitor) {
                 try {
             @Override
             protected IStatus run(IProgressMonitor monitor) {
                 try {
@@ -51,7 +52,7 @@ public class NewModel extends AbstractHandler {
                     });
                     return Status.OK_STATUS;
                 } catch (DatabaseException e) {
                     });
                     return Status.OK_STATUS;
                 } catch (DatabaseException e) {
-                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, getName() + " failed.", e);
+                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.NewModel_0_Failed, getName()), e);
                 }
             }
         };
                 }
             }
         };
@@ -64,13 +65,13 @@ public class NewModel extends AbstractHandler {
         Resource model = ModelingUtils.createModel(graph, type, name);
         Resource conf = graph.syncRequest(new Configuration(model));
 
         Resource model = ModelingUtils.createModel(graph, type, name);
         Resource conf = graph.syncRequest(new Configuration(model));
 
-        ModelingUtils.addSCLMainToModel(graph, model, "SCLMain", "");
-        ModelingUtils.createLocalLibrary(graph, model, "Library");
+        ModelingUtils.addSCLMainToModel(graph, model, "SCLMain", ""); //$NON-NLS-1$ //$NON-NLS-2$
+        ModelingUtils.createLocalLibrary(graph, model, Messages.NewModel_Library);
 
 
-        Resource book = SpreadsheetGraphUtils.createBook(graph, conf, "Book1");
-        SpreadsheetUtils.createSheet(graph, book, "Sheet1", new String[] { }, new int[] { 50 });
-        SpreadsheetUtils.createSheet(graph, book, "Sheet2", new String[] { }, new int[] { 50 });
-        SpreadsheetUtils.createSheet(graph, book, "Sheet3", new String[] { }, new int[] { 50 });
+        Resource book = SpreadsheetGraphUtils.createBook(graph, conf, Messages.NewModel_Book1);
+        SpreadsheetUtils.createSheet(graph, book, Messages.NewModel_Sheet1, new String[] { }, new int[] { 50 });
+        SpreadsheetUtils.createSheet(graph, book, Messages.NewModel_Sheet2, new String[] { }, new int[] { 50 });
+        SpreadsheetUtils.createSheet(graph, book, Messages.NewModel_Sheet3, new String[] { }, new int[] { 50 });
 
         return model;
     }
 
         return model;
     }
diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties
new file mode 100644 (file)
index 0000000..53d837f
--- /dev/null
@@ -0,0 +1,9 @@
+ImportModel_DatabaseImportModel=Import model\r
+ImportModel_ImportModel=Import Model\r
+NewModel_0_Failed={0} failed.\r
+NewModel_Book1=Book1\r
+NewModel_Library=Library\r
+NewModel_NewModel=Creating Model\r
+NewModel_Sheet1=Sheet1\r
+NewModel_Sheet2=Sheet2\r
+NewModel_Sheet3=Sheet3\r
diff --git a/i18n.md b/i18n.md
index 28e1314d6f1d40bdb0291928112713db8f45ce13..cfa0c38a6a056e1f94262f884b72aace9428ac80 100644 (file)
--- a/i18n.md
+++ b/i18n.md
@@ -1,24 +1,24 @@
 ## Strings externalized from bundles ##
 
 * [x] org.simantics.scl.ui
 ## Strings externalized from bundles ##
 
 * [x] org.simantics.scl.ui
+* [x] org.simantics.db.procore.ui
+* [x] org.simantics.debug.ui 
+* [x] org.simantics.desktop.ui
+* ...
+
 
 ## TODO ##
 * /org.simantics.browsing.ui 
 * /org.simantics.browsing.ui.common (All can be ignored)
 
 ## TODO ##
 * /org.simantics.browsing.ui 
 * /org.simantics.browsing.ui.common (All can be ignored)
-* /org.simantics.browsing.ui.feature (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.graph (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.graph  (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.graph.impl (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.model
 * /org.simantics.browsing.ui.nattable
 * /org.simantics.browsing.ui.graph (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.graph  (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.graph.impl (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.model
 * /org.simantics.browsing.ui.nattable
-* /org.simantics.browsing.ui.nattable.feature (Nothing to Exeternalize)
 * /org.simantics.browsing.ui.ontology (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.platform (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.swt (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.debug.browser.ui (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.ontology (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.platform (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.swt (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.debug.browser.ui (Nothing to Exeternalize or all can be ignored) 
-* /org.simantics.db.procore.ui
-* /org.simantics.debug.ui 
-* /org.simantics.desktop.ui
 * /org.simantics.desktop.ui.ontology
 * /org.simantics.document.ui
 * /org.simantics.document.ui.ontology
 * /org.simantics.desktop.ui.ontology
 * /org.simantics.document.ui
 * /org.simantics.document.ui.ontology
 * /org.simantics.help.ui
 * /org.simantics.image.ui
 * /org.simantics.issues.ui
 * /org.simantics.help.ui
 * /org.simantics.image.ui
 * /org.simantics.issues.ui
-* /org.simantics.issues.ui.feature
 * /org.simantics.issues.ui.ontology
 * /org.simantics.logging.ui
 * /org.simantics.message.ui
 * /org.simantics.migration.ui
 * /org.simantics.modeling.ui
 * /org.simantics.modeling.ui.workbench
 * /org.simantics.issues.ui.ontology
 * /org.simantics.logging.ui
 * /org.simantics.message.ui
 * /org.simantics.migration.ui
 * /org.simantics.modeling.ui
 * /org.simantics.modeling.ui.workbench
-* /org.simantics.modeling.ui.workbench.feature
-* /org.simantics.platform.ui.feature
 * /org.simantics.platform.ui.ontology
 * /org.simantics.scenegraph.ui
 * /org.simantics.simulation.ui
 * /org.simantics.spreadsheet.ui
 * /org.simantics.platform.ui.ontology
 * /org.simantics.scenegraph.ui
 * /org.simantics.simulation.ui
 * /org.simantics.spreadsheet.ui
-* /org.simantics.spreadsheet.ui.feature
 * /org.simantics.structural.ui
 * /org.simantics.team.ui
 * /org.simantics.tests.modelled.ui
 * /org.simantics.structural.ui
 * /org.simantics.team.ui
 * /org.simantics.tests.modelled.ui
-* /org.simantics.tests.modelled.ui.feature
 * /org.simantics.tests.modelled.ui.ontology
 * /org.simantics.ui
 * /org.simantics.tests.modelled.ui.ontology
 * /org.simantics.ui
-* /org.simantics.ui.workbench.feature
 * /org.simantics.ui.workspace.tracker
 * /org.simantics.utils.ui
 * /org.simantics.ui.workspace.tracker
 * /org.simantics.utils.ui
-* /org.simantics.utils.ui.feature
 * /org.simantics.wiki.ui
 * /org.simantics.wiki.ui
-* /org.simantics.wiki.ui.feature
+
 * 
 *
 * ...
 * 
 *
 * ...