From: Tuukka Lehtonen Date: Wed, 28 Nov 2018 15:12:28 +0000 (+0200) Subject: Externalize strings in org.simantics.desktop.ui X-Git-Tag: v1.43.0~136^2~238 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F2504%2F3;p=simantics%2Fplatform.git Externalize strings in org.simantics.desktop.ui gitlab #210 Change-Id: Id1ac35d76c9cd9b6541b9c6eed1b21322d30fbb7 --- diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/DesktopProjectFeature.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/DesktopProjectFeature.java index c3b3b6f18..01526a56f 100644 --- a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/DesktopProjectFeature.java +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/DesktopProjectFeature.java @@ -16,7 +16,7 @@ import org.simantics.project.features.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 { diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportModel.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportModel.java index 81bcc0357..b75c0bd44 100644 --- a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportModel.java +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportModel.java @@ -53,7 +53,7 @@ public class ExportModel extends AbstractHandler { 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(); diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportSharedLibrary.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportSharedLibrary.java index 96f7da830..be11bcccc 100644 --- a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportSharedLibrary.java +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportSharedLibrary.java @@ -40,7 +40,7 @@ public class ExportSharedLibrary extends AbstractHandler { @Override public Resource perform(ReadGraph graph) throws DatabaseException { - List ontologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE); + List 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; } @@ -52,7 +52,7 @@ public class ExportSharedLibrary extends AbstractHandler { 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(); diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java index 25d7d3a17..8bb0783f3 100644 --- a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java @@ -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); - 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())){ - path = System.getProperty("user.dir"); + path = System.getProperty("user.dir"); //$NON-NLS-1$ } 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; - Job job = new DatabaseJob("Import model") { + Job job = new DatabaseJob(Messages.ImportModel_DatabaseImportModel) { @Override protected IStatus run(IProgressMonitor monitor) { diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportSharedLibrary.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportSharedLibrary.java index 113c11926..0bc9852f9 100644 --- a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportSharedLibrary.java +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportSharedLibrary.java @@ -25,7 +25,7 @@ public class ImportSharedLibrary extends AbstractHandler { 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; } 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 index 000000000..805f90d98 --- /dev/null +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/NewModel.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/NewModel.java index ffa408e3c..ad759314c 100644 --- a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/NewModel.java +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/NewModel.java @@ -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.osgi.util.NLS; 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 { - Job job = new DatabaseJob("Creating Model") { + Job job = new DatabaseJob(Messages.NewModel_NewModel) { @Override protected IStatus run(IProgressMonitor monitor) { try { @@ -51,7 +52,7 @@ public class NewModel extends AbstractHandler { }); 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)); - 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; } 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 index 000000000..53d837f85 --- /dev/null +++ b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties @@ -0,0 +1,9 @@ +ImportModel_DatabaseImportModel=Import model +ImportModel_ImportModel=Import Model +NewModel_0_Failed={0} failed. +NewModel_Book1=Book1 +NewModel_Library=Library +NewModel_NewModel=Creating Model +NewModel_Sheet1=Sheet1 +NewModel_Sheet2=Sheet2 +NewModel_Sheet3=Sheet3 diff --git a/i18n.md b/i18n.md index 28e1314d6..cfa0c38a6 100644 --- a/i18n.md +++ b/i18n.md @@ -1,24 +1,24 @@ ## 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) -* /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.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.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 @@ -28,32 +28,25 @@ * /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.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.spreadsheet.ui.feature * /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.ui.workbench.feature * /org.simantics.ui.workspace.tracker * /org.simantics.utils.ui -* /org.simantics.utils.ui.feature * /org.simantics.wiki.ui -* /org.simantics.wiki.ui.feature + * * * ...