From: Tuukka Lehtonen Date: Wed, 21 Nov 2018 12:43:02 +0000 (+0200) Subject: Externalize strings in org.simantics.scl.ui X-Git-Tag: v1.43.0~136^2~257 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F84%2F2484%2F12;p=simantics%2Fplatform.git Externalize strings in org.simantics.scl.ui 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 --- 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 index 000000000..8c941cc3f --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/ModuleSelectionDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/ModuleSelectionDialog.java index 8d07d60b1..66541a7be 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/ModuleSelectionDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/ModuleSelectionDialog.java @@ -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> 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.>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(); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/OntologyImportModulesAction.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/OntologyImportModulesAction.java index 1c9198015..13080d683 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/OntologyImportModulesAction.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/OntologyImportModulesAction.java @@ -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 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$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesImportModulesAction.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesImportModulesAction.java index 8a960f825..1a50da2cd 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesImportModulesAction.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/SCLModulesImportModulesAction.java @@ -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 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 index 000000000..7b21b5ab2 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/imports/messages.properties @@ -0,0 +1,2 @@ +OntologyImportModulesAction_AddOntology=Add Ontology +SCLModulesImportModulesAction_AddModulesFromProject=Add Modules from Project diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/Activator.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/Activator.java index f68f2876e..57633e517 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/Activator.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/Activator.java @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposal.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposal.java index da2186fd8..3d837aace 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposal.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposal.java @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposalProvider.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposalProvider.java index 34464476b..82843cd62 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposalProvider.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposalProvider.java @@ -37,14 +37,14 @@ public class SCLContentProposalProvider implements IContentProposalProvider { ArrayList proposals = new ArrayList(); 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 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()]); } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/StyledTextContentAdapter.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/StyledTextContentAdapter.java index a6deb92c0..dd71e323b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/StyledTextContentAdapter.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/StyledTextContentAdapter.java @@ -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(); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java index 7ecbaa371..3a687e0d9 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java @@ -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 index 000000000..f531f9314 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDefinitionSelectionDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDefinitionSelectionDialog.java index 843b88fe2..8b8896d24 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDefinitionSelectionDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDefinitionSelectionDialog.java @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDocumentationBrowser.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDocumentationBrowser.java index fe871ab1c..f5cdfbf60 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDocumentationBrowser.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/SCLDocumentationBrowser.java @@ -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$ } } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/TestSCLDocumentationBrowser.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/TestSCLDocumentationBrowser.java index a1365544b..803cdf30b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/TestSCLDocumentationBrowser.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/TestSCLDocumentationBrowser.java @@ -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 index 000000000..347b82cb4 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/messages.properties @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java index ab9e033d0..b00196883 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/AbstractCommandConsole.java @@ -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 { @@ -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; } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/ConsoleActions.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/ConsoleActions.java index 744b83c9b..074a6112b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/ConsoleActions.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/ConsoleActions.java @@ -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 index 000000000..f2ecd0fd6 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Preferences.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Preferences.java index a9d76a2f0..1d55d1fe3 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Preferences.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/Preferences.java @@ -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 s, String delimiter) { - if (s == null || s.isEmpty()) return ""; + if (s == null || s.isEmpty()) return ""; //$NON-NLS-1$ Iterator iter = s.iterator(); StringBuilder builder = new StringBuilder(iter.next()); while( iter.hasNext() ) diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsole.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsole.java index 7221158c1..9df117f7e 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsole.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsole.java @@ -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 currentJobs = new THashSet(); @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java index 67de0b2ff..bab62144b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java @@ -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 index 000000000..7db5b8b03 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/messages.properties @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/MatchingBracketsEditStrategy.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/MatchingBracketsEditStrategy.java index d28732522..68b3f638b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/MatchingBracketsEditStrategy.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/MatchingBracketsEditStrategy.java @@ -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; } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/ReplaceTabsBySpaces.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/ReplaceTabsBySpaces.java index a01295dcb..08e403a69 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/ReplaceTabsBySpaces.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/ReplaceTabsBySpaces.java @@ -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$ } } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLAnnotationAccessNew.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLAnnotationAccessNew.java index d129f4c05..181d8533b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLAnnotationAccessNew.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLAnnotationAccessNew.java @@ -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); } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLDocumentSetup.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLDocumentSetup.java index 41a3bf239..5ed03d54b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLDocumentSetup.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLDocumentSetup.java @@ -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); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLSourceViewerConfigurationNew.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLSourceViewerConfigurationNew.java index 88e9f8f1b..70a8e082e 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLSourceViewerConfigurationNew.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLSourceViewerConfigurationNew.java @@ -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) { diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLTextEditorNew.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLTextEditorNew.java index 190b93904..f66a1b230 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLTextEditorNew.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/SCLTextEditorNew.java @@ -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)); } } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionAssistProcessor.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionAssistProcessor.java index f779435ea..c02946c7b 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionAssistProcessor.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionAssistProcessor.java @@ -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) == '.') diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionProposal.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionProposal.java index 3734513cb..fb63c18e0 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionProposal.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionProposal.java @@ -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) { diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLTextEditorEnvironment.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLTextEditorEnvironment.java index 98b519177..ffe709f45 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLTextEditorEnvironment.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLTextEditorEnvironment.java @@ -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 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 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)); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/DebugPartionTokenScanner.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/DebugPartionTokenScanner.java index a87ed5107..16e008d57 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/DebugPartionTokenScanner.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/DebugPartionTokenScanner.java @@ -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); } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/FindSCLSearchAction.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/FindSCLSearchAction.java index 15da4192b..feffb74f7 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/FindSCLSearchAction.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/FindSCLSearchAction.java @@ -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' }; - 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(); } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleEditor2DocumentProvider.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleEditor2DocumentProvider.java index cf6bf9a87..d252a9230 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleEditor2DocumentProvider.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleEditor2DocumentProvider.java @@ -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); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleSelectionDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleSelectionDialog.java index b853f4096..7b04360e5 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleSelectionDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLModuleSelectionDialog.java @@ -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() { @Override public boolean execute(String moduleName) { diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPartitionScanner.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPartitionScanner.java index 4b1158cfd..26de81bea 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPartitionScanner.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPartitionScanner.java @@ -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$ }); } } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPresentationReconciler.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPresentationReconciler.java index ef6d5633a..b74e35fb2 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPresentationReconciler.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLPresentationReconciler.java @@ -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); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/StandardSCLModuleEditorInput.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/StandardSCLModuleEditorInput.java index 77477e8a8..fbe13fd86 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/StandardSCLModuleEditorInput.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/StandardSCLModuleEditorInput.java @@ -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 index 000000000..3eee2fd7b --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/messages.properties @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/BasicImportModulesAction.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/BasicImportModulesAction.java index ba5de128f..db8348e58 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/BasicImportModulesAction.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/BasicImportModulesAction.java @@ -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 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; } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ExternalImportModulesAction.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ExternalImportModulesAction.java index 7c3b042c7..3082f27ab 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ExternalImportModulesAction.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ExternalImportModulesAction.java @@ -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 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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java index f8fb202e3..d8d289386 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManageImportsDialog.java @@ -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 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) diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManualImportModulesAction.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManualImportModulesAction.java index 987c0deb3..d1136d374 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManualImportModulesAction.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManualImportModulesAction.java @@ -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 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 index 000000000..4ab1c766e --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/SCLModuleSelectionDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/SCLModuleSelectionDialog.java index 32a42a473..bddd0960d 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/SCLModuleSelectionDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/SCLModuleSelectionDialog.java @@ -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 index 000000000..678ab8836 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/messages.properties @@ -0,0 +1,14 @@ +BasicImportModulesAction_AddModules=Add Modules +ExternalImportModulesAction_AddExternalModule=Add External Module +ManageImportsDialog_Delete=Delete +ManageImportsDialog_Disable=Disable +ManageImportsDialog_Enable=Enable +ManageImportsDialog_LocalName=Local name +ManageImportsDialog_MakePersistent=Make Persistent +ManageImportsDialog_MakeTransient=Make Transient +ManageImportsDialog_ManageImports=Manage Imports +ManageImportsDialog_Module=Module +ManageImportsDialog_Status=Status +ManualImportModulesAction_AddFreeformModule=Add Freeform Module +ManualImportModulesAction_SelectModule=Select Module +ManualImportModulesAction_SelectModuleMsg=Write the full name of the module diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/info/SCLInfo.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/info/SCLInfo.java index c37a9421f..a9ad2111d 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/info/SCLInfo.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/info/SCLInfo.java @@ -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 index 000000000..baa7b2e4f --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/SCLIssuesView.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/SCLIssuesView.java index 9f4994eb1..ff7d7f57c 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/SCLIssuesView.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/SCLIssuesView.java @@ -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 index 000000000..ef3682941 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/issues/messages.properties @@ -0,0 +1,3 @@ +SCLIssuesView_Description=Description +SCLIssuesView_Module=Module +SCLIssuesView_Refresh=Refresh diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleAction.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleAction.java index 1d70442c8..fb47d553e 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleAction.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleAction.java @@ -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 result = new THashMap(); 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(); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleDialog.java index 7dcfc2f0e..107837f95 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleDialog.java @@ -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(); } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleValidator.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleValidator.java index d3236c0dd..a8d252f09 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleValidator.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/CreateModuleValidator.java @@ -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 index 000000000..27a6eda3c --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/ModuleNameTreeEntry.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/ModuleNameTreeEntry.java index 2461e5231..ec5050815 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/ModuleNameTreeEntry.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/ModuleNameTreeEntry.java @@ -6,8 +6,8 @@ import java.util.Iterator; import gnu.trove.map.hash.THashMap; public class ModuleNameTreeEntry implements Comparable { - 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 { 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); } diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/PluginSelectionDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/PluginSelectionDialog.java index 30e84f8fb..cafda7ab6 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/PluginSelectionDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/PluginSelectionDialog.java @@ -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; diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleBrowser.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleBrowser.java index 90d297c1a..82dcd4558 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleBrowser.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleBrowser.java @@ -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); diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTreeContentProvider.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTreeContentProvider.java index d73639c70..bb7d80dfd 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTreeContentProvider.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTreeContentProvider.java @@ -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 index 000000000..4dddc73f1 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/messages.properties @@ -0,0 +1,8 @@ +CreateModuleDialog_Browse=Browse... +CreateModuleDialog_CreateNewModule=Create New Module +CreateModuleDialog_ModuleName=Module name +CreateModuleDialog_Package=Package +CreateModuleDialog_Plugin=Plugin +SCLModuleBrowser_NewModuleDots=New Module... +SCLModuleBrowser_RefreshModules=Refresh Modules +SCLModuleBrowser_SCLModules=SCL Modules 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 index 000000000..b2dea8b33 --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchQuery.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchQuery.java index 264cbc57a..724730a08 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchQuery.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchQuery.java @@ -73,7 +73,7 @@ public class SCLSearchQuery implements ISearchQuery { @Override public String getLabel() { - return "Search references for "; + return Messages.SCLSearchQuery_SearchReferencesFor; } @Override diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResult.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResult.java index 859a29d16..dd048ec46 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResult.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResult.java @@ -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 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java index bed4fb123..feace875f 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java @@ -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 index 000000000..0a73e524b --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/messages.properties @@ -0,0 +1,2 @@ +SCLSearchQuery_SearchReferencesFor=Search references for +SCLSearchResult_SCLSearchLabelFor=SCL search result label for {0} 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 index 000000000..b9489d7db --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/SCLTestsDialog.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/SCLTestsDialog.java index 75e6e836e..a595a81d4 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/SCLTestsDialog.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/SCLTestsDialog.java @@ -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 tests; public SCLTestsDialog(Shell shell, List 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 index 000000000..4fb12e9eb --- /dev/null +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/tests/messages.properties @@ -0,0 +1,4 @@ +SCLTestsDialog_MonitorSearchingTests=Searching tests.. +SCLTestsDialog_NoName=No name\! +SCLTestsDialog_RunSCLTests=Run SCL Tests +SCLTestsDialog_RunTest=Run Test diff --git a/i18n.md b/i18n.md new file mode 100644 index 000000000..8da7b4ad0 --- /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* +* ...