From: Tuukka Lehtonen Date: Thu, 6 Dec 2018 21:38:15 +0000 (+0200) Subject: Externalize strings X-Git-Tag: v1.43.0~136^2~234 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=47269fe0;p=simantics%2Fplatform.git Externalize strings * org.simantics.fileimport.ui * org.simantics.graphviz.ui * org.simantics.help.ui * org.simantics.image.ui * org.simantics.issues.ui * org.simantics.logging.ui * org.simantics.message.ui * org.simantics.migration.ui * org.simantics.modeling.ui (unfinished, contains around 1500 strings) gitlab #210 Change-Id: Ib408f94694481876dfbedcf81b86e607bce3f32d --- diff --git a/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/ImportFileHandler.java b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/ImportFileHandler.java index fbe3ce724..1bdcd1575 100644 --- a/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/ImportFileHandler.java +++ b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/ImportFileHandler.java @@ -40,13 +40,13 @@ public class ImportFileHandler { // Sanity check for (int i = 0; i < filterExtensions.length; i++) { String extension = filterExtensions[i]; - if (!extension.startsWith("*.")) { - System.err.println("Invalid extension filter provied: " + extension); + if (!extension.startsWith("*.")) { //$NON-NLS-1$ + System.err.println("Invalid extension filter provied: " + extension); //$NON-NLS-1$ } } FileDialog dialog = new FileDialog(shell, SWT.OPEN); - dialog.setText("Choose File"); + dialog.setText(Messages.ImportFileHandler_ChooseFile); dialog.setFilterExtensions(filterExtensions); dialog.setFilterNames(filterNames); final String fileName = dialog.open(); @@ -62,11 +62,11 @@ public class ImportFileHandler { selectedResource = a.getAdapter(Resource.class); } } catch(NullPointerException | ClassCastException npe) { - LOGGER.warn("Failed to find selection, passing null to file importer", npe); + LOGGER.warn("Failed to find selection, passing null to file importer", npe); //$NON-NLS-1$ } FileImportService.performFileImport(Paths.get(fileName), Optional.of(selectedResource), Optional.of((Consumer) t -> { - LOGGER.error("Could not import file " + fileName, t); + LOGGER.error("Could not import file " + fileName, t); //$NON-NLS-1$ })); } } \ No newline at end of file diff --git a/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/Messages.java b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/Messages.java new file mode 100644 index 000000000..b6aa8dc28 --- /dev/null +++ b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/Messages.java @@ -0,0 +1,15 @@ +package org.simantics.fileimport.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.fileimport.ui.messages"; //$NON-NLS-1$ + public static String ImportFileHandler_ChooseFile; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/messages.properties b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/messages.properties new file mode 100644 index 000000000..ef53624b6 --- /dev/null +++ b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/messages.properties @@ -0,0 +1 @@ +ImportFileHandler_ChooseFile=Choose File diff --git a/bundles/org.simantics.graphviz.ui/examples/org/simantics/graphviz/ui/examples/GraphvizComponentExample.java b/bundles/org.simantics.graphviz.ui/examples/org/simantics/graphviz/ui/examples/GraphvizComponentExample.java index dc9d1ada7..f8f775932 100644 --- a/bundles/org.simantics.graphviz.ui/examples/org/simantics/graphviz/ui/examples/GraphvizComponentExample.java +++ b/bundles/org.simantics.graphviz.ui/examples/org/simantics/graphviz/ui/examples/GraphvizComponentExample.java @@ -39,9 +39,9 @@ public class GraphvizComponentExample { private static Graph createGraph() { Graph graph = new Graph(); - Node node1 = new Node(graph, "A"); - Node node2 = new Node(graph, "B"); - new Edge(graph, node1, node2).setLabel("A to B"); + Node node1 = new Node(graph, "A"); //$NON-NLS-1$ + Node node2 = new Node(graph, "B"); //$NON-NLS-1$ + new Edge(graph, node1, node2).setLabel("A to B"); //$NON-NLS-1$ return graph; } diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/AbstractGraphvizEditorPart.java b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/AbstractGraphvizEditorPart.java index 2c39d32a7..2ee40c530 100644 --- a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/AbstractGraphvizEditorPart.java +++ b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/AbstractGraphvizEditorPart.java @@ -75,7 +75,7 @@ public abstract class AbstractGraphvizEditorPart extends EditorPart { * @param graph */ public void asyncSetGraph(final Graph graph) { - Job job = new Job("Layouting a graph") { + Job job = new Job(Messages.AbstractGraphvizEditorPart_LayoutingAGraph) { @Override protected IStatus run(IProgressMonitor monitor) { diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent.java b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent.java index 6ba556da0..9bcf9433d 100644 --- a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent.java +++ b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent.java @@ -69,8 +69,8 @@ public class GraphvizComponent extends Composite { } private void workaroundJava7FocusProblem(Frame frame) { - String ver = System.getProperty("java.version"); - if (ver.startsWith("1.7") || ver.startsWith("1.8")) { + String ver = System.getProperty("java.version"); //$NON-NLS-1$ + if (ver.startsWith("1.7") || ver.startsWith("1.8")) { //$NON-NLS-1$ //$NON-NLS-2$ try { frame.addWindowListener(new Java7FocusFixListener(this, frame)); } catch (SecurityException e) { @@ -90,7 +90,7 @@ public class GraphvizComponent extends Composite { Frame frame; public Java7FocusFixListener(Control control, Frame frame) throws NoSuchMethodException, SecurityException { - this.shellSetActiveControl = Shell.class.getDeclaredMethod("setActiveControl", Control.class); + this.shellSetActiveControl = Shell.class.getDeclaredMethod("setActiveControl", Control.class); //$NON-NLS-1$ this.frame = frame; this.control = control; } @@ -137,7 +137,7 @@ public class GraphvizComponent extends Composite { initialized.wait(); } } catch (InterruptedException e) { - throw new Error("GraphvizComponent AWT population interrupted for class " + this, e); + throw new Error("GraphvizComponent AWT population interrupted for class " + this, e); //$NON-NLS-1$ } } @@ -147,7 +147,7 @@ public class GraphvizComponent extends Composite { * @param graph */ public void setGraph(Graph graph) { - setGraph(graph, "dot"); + setGraph(graph, "dot"); //$NON-NLS-1$ } /** @@ -210,7 +210,7 @@ public class GraphvizComponent extends Composite { public void save(File file) throws IOException { if (drawable == null) { - throw new IOException("Nothing to save"); + throw new IOException("Nothing to save"); //$NON-NLS-1$ } Graph graph = drawable.getGraph(); String algo = drawable.getAlgorithm(); @@ -222,16 +222,16 @@ public class GraphvizComponent extends Composite { } public String[] getFileExtensions() { - return new String[]{"*.svg","*.dot","*.eps", "*.jpg", "*.jpeg","*.pdf","*.png","*.ps"}; + return new String[]{"*.svg","*.dot","*.eps", "*.jpg", "*.jpeg","*.pdf","*.png","*.ps"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ } public String[] getFileNames() { - return new String[]{"Scalable Vector Graphics Image", "DOT Image", "Encapsulated PostScript Image","JPG Image","JPG Image","Portable Document Format Image","Portable Network Graphics Image","PostScript Image"}; + return new String[]{"Scalable Vector Graphics Image", "DOT Image", "Encapsulated PostScript Image","JPG Image","JPG Image","Portable Document Format Image","Portable Network Graphics Image","PostScript Image"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ } public static String getExtension(File file) { String filename = file.getName(); - int index = filename.lastIndexOf("."); + int index = filename.lastIndexOf("."); //$NON-NLS-1$ if (index < 0) return null; return filename.substring(index+1).toLowerCase(); diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent2.java b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent2.java index 32988cd40..9d417f28b 100644 --- a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent2.java +++ b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent2.java @@ -65,7 +65,7 @@ public class GraphvizComponent2 extends Composite { initialized.wait(); } } catch (InterruptedException e) { - throw new Error("GraphvizComponent AWT population interrupted for class " + this, e); + throw new Error("GraphvizComponent AWT population interrupted for class " + this, e); //$NON-NLS-1$ } } @@ -75,7 +75,7 @@ public class GraphvizComponent2 extends Composite { * @param graph */ public Computation setGraph(Graph graph) { - return setGraph(graph, "dot"); + return setGraph(graph, "dot"); //$NON-NLS-1$ } /** diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/Messages.java b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/Messages.java new file mode 100644 index 000000000..2930b486a --- /dev/null +++ b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/Messages.java @@ -0,0 +1,15 @@ +package org.simantics.graphviz.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.graphviz.ui.messages"; //$NON-NLS-1$ + public static String AbstractGraphvizEditorPart_LayoutingAGraph; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/messages.properties b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/messages.properties new file mode 100644 index 000000000..73b755bdf --- /dev/null +++ b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/messages.properties @@ -0,0 +1 @@ +AbstractGraphvizEditorPart_LayoutingAGraph=Layouting a graph diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileDocumentProvider.java b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileDocumentProvider.java index a29847455..3ab4d8b0a 100644 --- a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileDocumentProvider.java +++ b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileDocumentProvider.java @@ -40,7 +40,7 @@ public class HelpFileDocumentProvider extends AbstractDocumentProvider { public Document perform(ReadGraph graph) throws DatabaseException { currentText = HelpUtils.readHelpFileContents(graph, resource); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } }); } catch (DatabaseException e) { @@ -59,14 +59,14 @@ public class HelpFileDocumentProvider extends AbstractDocumentProvider { @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog("HelpFileDocumentProvider.doSaveDocument"); + TimeLogger.resetTimeAndLog("HelpFileDocumentProvider.doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); HelpUtils.saveHelpFileContents(graph, resource, currentText); - Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); + Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$ } }); } diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileEditor.java b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileEditor.java index 56e692607..1626a1b59 100644 --- a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileEditor.java +++ b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileEditor.java @@ -22,7 +22,7 @@ import winterwell.markdown.editors.MarkdownEditor; public class HelpFileEditor extends MarkdownEditor { - private static final String EDITOR_ID = "org.simantics.help.ui.HelpFileEditor"; + private static final String EDITOR_ID = "org.simantics.help.ui.HelpFileEditor"; //$NON-NLS-1$ private boolean disposed; @@ -45,7 +45,7 @@ public class HelpFileEditor extends MarkdownEditor { try { getResourceInput().init(null); } catch (DatabaseException e) { - throw new PartInitException("Failed to initialize " + input, e); + throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/Messages.java b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/Messages.java new file mode 100644 index 000000000..2a6c049d1 --- /dev/null +++ b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/Messages.java @@ -0,0 +1,15 @@ +package org.simantics.help.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.help.ui.messages"; //$NON-NLS-1$ + public static String OpenHelpFileAdapter_HelpFileEditor; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/OpenHelpFileAdapter.java b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/OpenHelpFileAdapter.java index 38d33e0a2..33b347aaa 100644 --- a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/OpenHelpFileAdapter.java +++ b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/OpenHelpFileAdapter.java @@ -22,7 +22,7 @@ public class OpenHelpFileAdapter extends AbstractResourceEditorAdapter { private static final Logger LOGGER = LoggerFactory.getLogger(OpenHelpFileAdapter.class); public OpenHelpFileAdapter() { - super("Help File Editor"); + super(Messages.OpenHelpFileAdapter_HelpFileEditor); } protected String getEditorId() { @@ -51,7 +51,7 @@ public class OpenHelpFileAdapter extends AbstractResourceEditorAdapter { String editorId = getEditorId(); WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, input, model, rvi)); } catch (PartInitException e) { - LOGGER.error("Failed to open an editor for help file.", e); + LOGGER.error("Failed to open an editor for help file.", e); //$NON-NLS-1$ } } }); diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/messages.properties b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/messages.properties new file mode 100644 index 000000000..24de2b09d --- /dev/null +++ b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/messages.properties @@ -0,0 +1 @@ +OpenHelpFileAdapter_HelpFileEditor=Help File Editor diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java index f10ada1e1..f602d31d4 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java @@ -37,20 +37,20 @@ public class CreateImage extends WriteRequest { public static Resource getType(ReadGraph graph, ImageSource source) throws DatabaseException { ImageResource IMAGE = ImageResource.getInstance(graph); String name = source.name.toLowerCase(); - if(name.endsWith("svg")) return IMAGE.SvgImage; - else if(name.endsWith("png")) return IMAGE.PngImage; - else if(name.endsWith("jpg") || name.endsWith("jpeg")) return IMAGE.JpegImage; - else if(name.endsWith("gif")) return IMAGE.GifImage; - else throw new DatabaseException("Unsupported image format " + source.name); + if(name.endsWith("svg")) return IMAGE.SvgImage; //$NON-NLS-1$ + else if(name.endsWith("png")) return IMAGE.PngImage; //$NON-NLS-1$ + else if(name.endsWith("jpg") || name.endsWith("jpeg")) return IMAGE.JpegImage; //$NON-NLS-1$ //$NON-NLS-2$ + else if(name.endsWith("gif")) return IMAGE.GifImage; //$NON-NLS-1$ + else throw new DatabaseException("Unsupported image format " + source.name); //$NON-NLS-1$ } public static void claimLiteral(WriteGraph graph, Resource image, ImageSource source) throws DatabaseException { String name = source.name.toLowerCase(); - if (name.endsWith("svg")) + if (name.endsWith("svg")) //$NON-NLS-1$ graph.claimValue(image, new String(source.data), Bindings.STRING); - else if (name.endsWith("png") || name.endsWith("jpg") || name.endsWith("jpeg") || name.endsWith("gif")) + else if (name.endsWith("png") || name.endsWith("jpg") || name.endsWith("jpeg") || name.endsWith("gif")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ graph.claimValue(image, source.data, Bindings.BYTE_ARRAY); - else throw new DatabaseException("Unsupported image format " + source.name); + else throw new DatabaseException("Unsupported image format " + source.name); //$NON-NLS-1$ } @Override @@ -66,7 +66,7 @@ public class CreateImage extends WriteRequest { graph.claimLiteral(image, L0.HasName, source.name, Bindings.STRING); claimLiteral(graph, image, source); graph.claim(parent, L0.ConsistsOf, image); - Layer0Utils.addCommentMetadata(graph, "Imported image " + source.name + " " + image.toString()); + Layer0Utils.addCommentMetadata(graph, "Imported image " + source.name + " " + image.toString()); //$NON-NLS-1$ //$NON-NLS-2$ return image; // if(file.getPath().endsWith("svg")) { diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImages.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImages.java index 2fe579533..45a8487cc 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImages.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImages.java @@ -15,6 +15,7 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import org.eclipse.osgi.util.NLS; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -41,7 +42,7 @@ public class CreateImages extends WriteRequest { ImageSource src = ImportImagesActionFactory.toImageSource(file); new CreateImage(container, src).perform(graph); } catch (IOException e) { - ErrorLogger.defaultLogError("Failed to import image " + file.getName() + ", see exception for details.", e); + ErrorLogger.defaultLogError(NLS.bind(Messages.CreateImages_FailedToImportPage, file.getName()), e); } } } diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java index d9286b004..80e8d5b68 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java @@ -57,9 +57,9 @@ public class ImportImagesActionFactory implements ActionFactory { public static Collection requestImportedImages(Shell parentShell) { FileDialog dialog = new FileDialog(parentShell, SWT.MULTI); - dialog.setText("Choose image to be imported"); - dialog.setFilterExtensions( new String[] {"*.jpg;*.png;*.gif;*.svg", "*.jpg;*.jpeg", "*.png", "*.gif", "*.svg"} ); - dialog.setFilterNames( new String[] {"All Images", "JPEG Image", "PNG Image", "GIF Image", "SVG Image"} ); + dialog.setText(Messages.ImportImagesActionFactory_ChooseImageToBeImported); + dialog.setFilterExtensions( new String[] {"*.jpg;*.png;*.gif;*.svg", "*.jpg;*.jpeg", "*.png", "*.gif", "*.svg"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + dialog.setFilterNames( new String[] {Messages.ImportImagesActionFactory_FilterAllImage, Messages.ImportImagesActionFactory_FilterJPEGImage, Messages.ImportImagesActionFactory_FilterPNGImage, Messages.ImportImagesActionFactory_FilterGIFImages, Messages.ImportImagesActionFactory_FilterSVGImage} ); //dialog.setFilterExtensions( new String[] {"*.jpg", "*.png", "*.gif"} ); final String filename = dialog.open(); if (filename == null) diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/Messages.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/Messages.java new file mode 100644 index 000000000..487691144 --- /dev/null +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/Messages.java @@ -0,0 +1,21 @@ +package org.simantics.image.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.image.ui.messages"; //$NON-NLS-1$ + public static String CreateImages_FailedToImportPage; + public static String ImportImagesActionFactory_ChooseImageToBeImported; + public static String ImportImagesActionFactory_FilterAllImage; + public static String ImportImagesActionFactory_FilterGIFImages; + public static String ImportImagesActionFactory_FilterJPEGImage; + public static String ImportImagesActionFactory_FilterPNGImage; + public static String ImportImagesActionFactory_FilterSVGImage; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/editor/ImageEditor.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/editor/ImageEditor.java index 2539dbd70..a9ab8aef6 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/editor/ImageEditor.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/editor/ImageEditor.java @@ -64,7 +64,7 @@ import com.kitfox.svg.SVGUniverse; */ public class ImageEditor extends ResourceEditorPart { - public static final String EDITOR_ID = "org.simantics.wiki.ui.image.editor"; + public static final String EDITOR_ID = "org.simantics.wiki.ui.image.editor"; //$NON-NLS-1$ protected boolean disposed = false; diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/internal/Activator.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/internal/Activator.java index d4be8900b..8b12f8eae 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/internal/Activator.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/internal/Activator.java @@ -36,9 +36,9 @@ public class Activator extends AbstractUIPlugin { Bundle bundle = context.getBundle(); - IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png")); - IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png")); - ADD_IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/add_image.png")); + IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png")); //$NON-NLS-1$ + IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png")); //$NON-NLS-1$ + ADD_IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/add_image.png")); //$NON-NLS-1$ } /* diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/messages.properties b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/messages.properties new file mode 100644 index 000000000..851ed41fe --- /dev/null +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/messages.properties @@ -0,0 +1,7 @@ +CreateImages_FailedToImportPage=Failed to import image {0}, see exception for details. +ImportImagesActionFactory_ChooseImageToBeImported=Choose image to be imported +ImportImagesActionFactory_FilterAllImage=All Images +ImportImagesActionFactory_FilterGIFImages=GIF Image +ImportImagesActionFactory_FilterJPEGImage=JPEG Image +ImportImagesActionFactory_FilterPNGImage=PNG Image +ImportImagesActionFactory_FilterSVGImage=SVG Image diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Image.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Image.java index ec82fa5be..f656e8141 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Image.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Image.java @@ -45,7 +45,7 @@ public class Image extends ViewpointContributor { @Override public String getViewpointId() { - return "Standard"; + return "Standard"; //$NON-NLS-1$ } protected Read> getChildRequest(ReadGraph graph, ImagesNode lib) throws DatabaseException { diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImageLabeler.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImageLabeler.java index 3c0366d2d..900857339 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImageLabeler.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImageLabeler.java @@ -24,7 +24,7 @@ public class ImageLabeler extends LabelerContributor { Layer0 L0 = Layer0.getInstance(graph); String name = graph.getPossibleRelatedValue(node.data, L0.HasName, Bindings.STRING); if(name == null) - name = "No name"; + name = "No name"; //$NON-NLS-1$ return name; } diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Images.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Images.java index 498b3e0b3..0d9d91ffb 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Images.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Images.java @@ -37,7 +37,7 @@ public class Images extends ViewpointContributor> { @Override public String getViewpointId() { - return "Standard"; + return "Standard"; //$NON-NLS-1$ } } \ No newline at end of file diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImagesLabeler.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImagesLabeler.java index 21dc1df64..74f622e91 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImagesLabeler.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImagesLabeler.java @@ -19,7 +19,7 @@ public class ImagesLabeler extends LabelerContributor { @Override public String getLabel(ReadGraph graph, ImagesNode node) throws DatabaseException { - return "Images"; + return Messages.ImagesLabeler_Images; } } diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Messages.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Messages.java new file mode 100644 index 000000000..f43a5b9c9 --- /dev/null +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Messages.java @@ -0,0 +1,15 @@ +package org.simantics.image.ui.modelBrowser; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.image.ui.modelBrowser.messages"; //$NON-NLS-1$ + public static String ImagesLabeler_Images; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/messages.properties b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/messages.properties new file mode 100644 index 000000000..2c1fd4a01 --- /dev/null +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/messages.properties @@ -0,0 +1 @@ +ImagesLabeler_Images=Images diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java index 9a40b3577..8d73a7d2b 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java @@ -41,7 +41,7 @@ public class All { final Resource issueSource = ResourceAdaptionUtils.toSingleResource(context); try { VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class); - Simantics.getSession().syncRequest(new WriteRequest(support.getWorkspacePersistent("preferences")) { + Simantics.getSession().syncRequest(new WriteRequest(support.getWorkspacePersistent("preferences")) { //$NON-NLS-1$ @Override public void perform(WriteGraph graph) throws DatabaseException { IssueResource ISSUE = IssueResource.getInstance(graph); diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java index 10de114c7..c845ed082 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java @@ -59,7 +59,7 @@ public class IssueImageRule implements ImageRule { @Override public Map getImage(ReadGraph graph, Object content) throws DatabaseException { Variable issue = (Variable) content; - String severity = issue.getPossiblePropertyValue(graph, "severity"); + String severity = issue.getPossiblePropertyValue(graph, "severity"); //$NON-NLS-1$ if (severity == null) return Collections.emptyMap(); boolean resolved = isResolved(graph, issue); @@ -71,17 +71,17 @@ public class IssueImageRule implements ImageRule { if (issueResource != null) return graph.hasStatement(issueResource, IssueResource.getInstance(graph).Resolved); - Boolean resolved = issue.getPossiblePropertyValue(graph, "resolved"); + Boolean resolved = issue.getPossiblePropertyValue(graph, "resolved"); //$NON-NLS-1$ return Boolean.TRUE.equals(resolved); } private ImageDescriptor toImageDescriptor(String severity) { switch (severity) { - case "Fatal": return fatal; - case "Error": return error; - case "Warning": return warning; - case "Info": return info; - case "Note": return note; + case "Fatal": return fatal; //$NON-NLS-1$ + case "Error": return error; //$NON-NLS-1$ + case "Warning": return warning; //$NON-NLS-1$ + case "Info": return info; //$NON-NLS-1$ + case "Note": return note; //$NON-NLS-1$ default: return help; } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java index 1d9b1099c..ada862d86 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java @@ -25,7 +25,7 @@ public class IssueLabelRule implements LabelRule { public static final IssueLabelRule INSTANCE = new IssueLabelRule(); - private static final String[] COLS = new String[] { ColumnKeys.SINGLE, "Resource", "Path" }; + private static final String[] COLS = new String[] { ColumnKeys.SINGLE, Messages.IssueLabelRule_Resource, Messages.IssueLabelRule_Path }; public IssueLabelRule() { } @@ -39,9 +39,9 @@ public class IssueLabelRule implements LabelRule { public Map getLabel(ReadGraph graph, Object content) throws DatabaseException { Variable issue = (Variable)content; - String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); - String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); - String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); + String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); //$NON-NLS-1$ + String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); //$NON-NLS-1$ + String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); //$NON-NLS-1$ String[] result = new String[] { description, resource, path }; return new ArrayMap(COLS, result); diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueView2.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueView2.java index 162eeff87..0ced6dff5 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueView2.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueView2.java @@ -67,13 +67,13 @@ public class IssueView2 extends ModelledView { private String formName(ReadGraph graph, Resource r) throws DatabaseException { String name = NameUtils.getSafeName(graph, r); final Resource project = Simantics.getProjectResource(); - String projectUri = project != null ? graph.getPossibleURI(project) : ""; + String projectUri = project != null ? graph.getPossibleURI(project) : ""; //$NON-NLS-1$ String uri = graph.getPossibleURI(r); if (uri != null) { if (uri.startsWith(projectUri)) uri = uri.substring(projectUri.length()); } - return uri != null ? name + " (" + uri + ")" : name; + return uri != null ? name + " (" + uri + ")" : name; //$NON-NLS-1$ //$NON-NLS-2$ } private Resource getConfiguration(ReadGraph graph, Resource r) throws DatabaseException { @@ -95,7 +95,7 @@ public class IssueView2 extends ModelledView { } setVisible(true); } else { - setContentDescription("Issues not available."); + setContentDescription(Messages.IssueView2_IssuesNotAvailable); setVisible(false); } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/Messages.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/Messages.java new file mode 100644 index 000000000..4371be0d9 --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/Messages.java @@ -0,0 +1,17 @@ +package org.simantics.issues.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.issues.ui.messages"; //$NON-NLS-1$ + public static String IssueLabelRule_Path; + public static String IssueLabelRule_Resource; + public static String IssueView2_IssuesNotAvailable; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SetSeverityAction.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SetSeverityAction.java index b4b27bbf4..0efb4648a 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SetSeverityAction.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SetSeverityAction.java @@ -69,7 +69,7 @@ public class SetSeverityAction implements ActionFactory, ActionFactory2 { IssueResource ISSUE = IssueResource.getInstance(graph); graph.deny(resource, ISSUE.Issue_HasSeverity); graph.claim(resource, ISSUE.Issue_HasSeverity, null, severity); - Layer0Utils.addCommentMetadata(graph, "Changed severity of " + NameUtils.getSafeLabel(graph, resource) + " to " + NameUtils.getSafeName(graph, severity)); + Layer0Utils.addCommentMetadata(graph, "Changed severity of " + NameUtils.getSafeLabel(graph, resource) + " to " + NameUtils.getSafeName(graph, severity)); //$NON-NLS-1$ //$NON-NLS-2$ } }); } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SeverityFolderLabelRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SeverityFolderLabelRule.java index 32e6683dd..dede35358 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SeverityFolderLabelRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SeverityFolderLabelRule.java @@ -52,9 +52,9 @@ public class SeverityFolderLabelRule implements LabelRule { Set issues = graph.syncRequest(new IssuesOfSeverity(project, severity)); if(issues.size() > 1) { - return Collections.singletonMap(DESCRIPTION, severityName + "s (" + issues.size() + " items)"); + return Collections.singletonMap(DESCRIPTION, severityName + "s (" + issues.size() + " items)"); //$NON-NLS-1$ //$NON-NLS-2$ } else { - return Collections.singletonMap(DESCRIPTION, severityName + "s (1 item)"); + return Collections.singletonMap(DESCRIPTION, severityName + "s (1 item)"); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/contribution/IssueLabelDecorationRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/contribution/IssueLabelDecorationRule.java index cee7c8aef..eb78ecc22 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/contribution/IssueLabelDecorationRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/contribution/IssueLabelDecorationRule.java @@ -53,7 +53,7 @@ public enum IssueLabelDecorationRule implements LabelDecorationRule { user = graph.hasStatement(issueR, ISSUE.UserIssue); resolved = graph.hasStatement(issueR, ISSUE.Resolved); } else { - hidden = Boolean.TRUE.equals(issue.getPossiblePropertyValue(graph, "hidden", Bindings.BOOLEAN)); + hidden = Boolean.TRUE.equals(issue.getPossiblePropertyValue(graph, "hidden", Bindings.BOOLEAN)); //$NON-NLS-1$ } int index = (hidden ? 1 : 0) + (user ? 2 : 0) + (resolved ? 4 : 0); diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ConfigureIssueSources.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ConfigureIssueSources.java index e4d09e011..b168583e4 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ConfigureIssueSources.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ConfigureIssueSources.java @@ -99,8 +99,8 @@ public class ConfigureIssueSources extends AbstractHandler { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); ListDialog dialog = new ListDialog( shell, sources, - "Select available issue sources", - "Selected sources will be used and existing deselected sources will be removed.") { + Messages.ConfigureIssueSources_SelectAvailableIssueSources, + Messages.ConfigureIssueSources_SelectedSourcesAddRemoveMsg) { protected CheckboxTableViewer createViewer(Composite composite) { CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList( diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ExportIssuesAsCsv.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ExportIssuesAsCsv.java index 6659a5227..dc7b26a24 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ExportIssuesAsCsv.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ExportIssuesAsCsv.java @@ -58,7 +58,7 @@ import org.simantics.utils.ui.ExceptionUtils; */ public class ExportIssuesAsCsv extends AbstractHandler { - private static final String PROP_LAST_VALIDATION_REPORT_PATH= "validation.report.path"; + private static final String PROP_LAST_VALIDATION_REPORT_PATH= "validation.report.path"; //$NON-NLS-1$ @Override public Object execute(ExecutionEvent event) throws ExecutionException { @@ -81,9 +81,9 @@ public class ExportIssuesAsCsv extends AbstractHandler { Layer0X L0X = Layer0X.getInstance(graph); SimulationResource SIMU = SimulationResource.getInstance(graph); for (Resource model : graph.syncRequest(new ObjectsWithType(Simantics.getProjectResource(), L0X.Activates, SIMU.Model))) { - return NameUtils.getSafeName(graph, model) + ".txt"; + return NameUtils.getSafeName(graph, model) + ".txt"; //$NON-NLS-1$ } - return "issues.txt"; + return "issues.txt"; //$NON-NLS-1$ } }); @@ -105,9 +105,9 @@ public class ExportIssuesAsCsv extends AbstractHandler { final DataContainer externalOutput = new DataContainer(); FileDialog fd = new FileDialog(parentShell, SWT.SAVE); - fd.setText("Select Validation Output"); - fd.setFilterExtensions(new String[] { "*.txt", "*.*" }); - fd.setFilterNames(new String[] { "Comma-Separated Values (*.txt)", "All Files (*.*)" }); + fd.setText(Messages.ExportIssuesAsCsv_SelectValidationOutput); + fd.setFilterExtensions(new String[] { "*.txt", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterNames(new String[] { Messages.ExportIssuesAsCsv_CommaSeparatedValues, Messages.ExportIssuesAsCsv_AllFiles }); if (lastReportPath != null) fd.setFilterPath(lastReportPath); fd.setFileName(fileName); @@ -141,12 +141,12 @@ public class ExportIssuesAsCsv extends AbstractHandler { } private void export(IProgressMonitor monitor, PrintStream out) throws DatabaseException { - SubMonitor progress = SubMonitor.convert(monitor, "Export issues", IProgressMonitor.UNKNOWN); + SubMonitor progress = SubMonitor.convert(monitor, Messages.ExportIssuesAsCsv_ExportIssues, IProgressMonitor.UNKNOWN); Simantics.getSession().syncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { Collection activeIssues = graph.syncRequest(new AllVisibleIssues(Simantics.getProjectResource())); - out.println("# Exported issues (" + activeIssues.size() + ")"); + out.println("# Exported issues (" + activeIssues.size() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ for (Variable issue : activeIssues) { exportIssue(graph, issue, out, 0); progress.worked(1); @@ -156,7 +156,7 @@ public class ExportIssuesAsCsv extends AbstractHandler { graph.syncRequest(new DynamicIssueSources(Simantics.getProjectResource()))); if (!dynamicIssueSources.isEmpty()) { out.println(); - out.println("# Dynamic Issues"); + out.println("# Dynamic Issues"); //$NON-NLS-1$ for (Variable source : dynamicIssueSources.values()) { exportDynamicIssueSource(progress, graph, source, out, 0); } @@ -168,7 +168,7 @@ public class ExportIssuesAsCsv extends AbstractHandler { private Map nameMap(ReadGraph graph, Set sources) throws DatabaseException { TreeMap sorted = new TreeMap<>(); for (Variable v : sources) { - String name = v.getPossiblePropertyValue(graph, "HasDescription", Bindings.STRING); + String name = v.getPossiblePropertyValue(graph, "HasDescription", Bindings.STRING); //$NON-NLS-1$ if (name == null) name = v.getName(graph); sorted.put(name, v); @@ -185,13 +185,13 @@ public class ExportIssuesAsCsv extends AbstractHandler { } private void exportIssue(ReadGraph graph, Variable issue, PrintStream out, int startColumn) throws DatabaseException { - String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); - String severity = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "severity") ); - String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); - String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); + String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); //$NON-NLS-1$ + String severity = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "severity") ); //$NON-NLS-1$ + String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); //$NON-NLS-1$ + String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); //$NON-NLS-1$ for (int i = 0; i < startColumn; ++i) - out.print(";"); - out.println(description + ";" + severity + ";" + resource + ";" + path); + out.print(";"); //$NON-NLS-1$ + out.println(description + ";" + severity + ";" + resource + ";" + path); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } \ No newline at end of file diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/FunctionHandler.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/FunctionHandler.java index 38b2c93e2..50251754f 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/FunctionHandler.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/FunctionHandler.java @@ -63,14 +63,14 @@ class FunctionHandler extends PreferenceHandler { } if (!hiders.isEmpty()) { SCLContext ctx = SCLContext.getCurrent(); - Object oldGraph = ctx.put("graph", graph); + Object oldGraph = ctx.put("graph", graph); //$NON-NLS-1$ try { for (Function f : hiders) f.apply(argument); } catch (Throwable t) { throw new DatabaseException(t); } finally { - ctx.put("graph", oldGraph); + ctx.put("graph", oldGraph); //$NON-NLS-1$ } } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Help.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Help.java index ebdb5a4b2..6f6c427af 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Help.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Help.java @@ -33,7 +33,7 @@ public class Help implements ActionFactory { if (target instanceof Variable) { return () -> { try { - String id = Simantics.sync(new PossibleVariablePropertyValue((Variable) target, "contextualHelpId", Bindings.STRING)); + String id = Simantics.sync(new PossibleVariablePropertyValue((Variable) target, "contextualHelpId", Bindings.STRING)); //$NON-NLS-1$ if (id == null) { PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); return; diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Hide.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Hide.java index 299b71346..b78613010 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Hide.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Hide.java @@ -18,7 +18,7 @@ package org.simantics.issues.ui.handler; public class Hide extends FunctionHandler { public Hide() { - super(null, "hider", Boolean.TRUE); + super(null, "hider", Boolean.TRUE); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/MenuActions.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/MenuActions.java index b607eb7e1..7969b5d02 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/MenuActions.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/MenuActions.java @@ -116,19 +116,19 @@ public class MenuActions extends DynamicMenuContribution { } private IAction unhideAction(List input) { - return tagAction("Unhide", Activator.UNHIDE_ICON, IssueResource.URIs.Hidden, false, input); + return tagAction(Messages.MenuActions_Unhide, Activator.UNHIDE_ICON, IssueResource.URIs.Hidden, false, input); } private IAction hideAction(List input) { - return tagAction("Hide", Activator.HIDE_ICON, IssueResource.URIs.Hidden, true, input); + return tagAction(Messages.MenuActions_Hide, Activator.HIDE_ICON, IssueResource.URIs.Hidden, true, input); } private IAction resolveAction(List input) { - return tagAction("Mark Resolved", Activator.RESOLVE_ICON, IssueResource.URIs.Resolved, true, input); + return tagAction(Messages.MenuActions_MarkResolved, Activator.RESOLVE_ICON, IssueResource.URIs.Resolved, true, input); } private IAction unresolveAction(List input) { - return tagAction("Mark Unresolved", Activator.UNRESOLVE_ICON, IssueResource.URIs.Resolved, false, input); + return tagAction(Messages.MenuActions_MarkUnresolved, Activator.UNRESOLVE_ICON, IssueResource.URIs.Resolved, false, input); } private IAction tagAction(String label, ImageDescriptor image, String tagURI, boolean tag, List input) { @@ -141,7 +141,7 @@ public class MenuActions extends DynamicMenuContribution { @Override public void fill(Menu menu, int index) { MenuItem setSeverityItem = new MenuItem(menu, SWT.CASCADE); - setSeverityItem.setText("Set Severity"); + setSeverityItem.setText(Messages.MenuActions_SetSeverity); Menu setSeverity = new Menu(menu); setSeverityItem.setMenu(setSeverity); for (final Severity sev : Severity.values()) { @@ -150,7 +150,7 @@ public class MenuActions extends DynamicMenuContribution { MenuItem item = new MenuItem(setSeverity, SWT.PUSH); item.setText(sev.toString().toLowerCase()); - item.setImage(Activator.getDefault().getImageRegistry().get(sev.toString() + "-full")); + item.setImage(Activator.getDefault().getImageRegistry().get(sev.toString() + "-full")); //$NON-NLS-1$ item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Messages.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Messages.java new file mode 100644 index 000000000..1d98e759a --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Messages.java @@ -0,0 +1,32 @@ +package org.simantics.issues.ui.handler; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.issues.ui.handler.messages"; //$NON-NLS-1$ + public static String ConfigureIssueSources_SelectAvailableIssueSources; + public static String ConfigureIssueSources_SelectedSourcesAddRemoveMsg; + public static String ExportIssuesAsCsv_AllFiles; + public static String ExportIssuesAsCsv_CommaSeparatedValues; + public static String ExportIssuesAsCsv_ExportIssues; + public static String ExportIssuesAsCsv_SelectValidationOutput; + public static String MenuActions_Hide; + public static String MenuActions_MarkResolved; + public static String MenuActions_MarkUnresolved; + public static String MenuActions_SetSeverity; + public static String MenuActions_Unhide; + public static String PurgeResolvedIssues_MonitorPurgingResolvedIssues; + public static String PurgeResolvedIssues_PurgedResolvedBatchIssues; + public static String PurgeResolvedIssues_PurgingResolvedBatchIssues; + public static String RunActiveValidations_MonitorPreparingResourcesForValidation; + public static String RunActiveValidations_ValidateModel; + public static String RunActiveValidations_Validation; + public static String RunActiveValidations_ValidationPreparation; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/NewUserIssue.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/NewUserIssue.java index 633c8d96d..1890228f4 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/NewUserIssue.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/NewUserIssue.java @@ -41,7 +41,7 @@ public class NewUserIssue extends AbstractHandler { public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); Resource issue = IssueUtils.newUserIssueForModel(graph); - Layer0Utils.addCommentMetadata(graph, "Created new User Issue " + NameUtils.getSafeLabel(graph, issue) + " " + issue.toString()); + Layer0Utils.addCommentMetadata(graph, "Created new User Issue " + NameUtils.getSafeLabel(graph, issue) + " " + issue.toString()); //$NON-NLS-1$ //$NON-NLS-2$ } }); } catch (DatabaseException e) { diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PreferenceHandler.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PreferenceHandler.java index 20a343938..8840406d5 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PreferenceHandler.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PreferenceHandler.java @@ -52,11 +52,11 @@ class PreferenceHandler extends AbstractHandler implements IElementUpdater, Acti private final boolean tag; public PreferenceHandler() { - this("preferences", null, false); + this("preferences", null, false); //$NON-NLS-1$ } public PreferenceHandler(String tagURI, boolean tag) { - this("preferences", tagURI, tag); + this("preferences", tagURI, tag); //$NON-NLS-1$ } public PreferenceHandler(String virtualGraphId) { diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PurgeResolvedIssues.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PurgeResolvedIssues.java index 90eded9ba..862b47573 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PurgeResolvedIssues.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PurgeResolvedIssues.java @@ -22,6 +22,7 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.osgi.util.NLS; import org.eclipse.ui.PlatformUI; import org.simantics.Simantics; import org.simantics.browsing.ui.common.ErrorLogger; @@ -71,15 +72,15 @@ public class PurgeResolvedIssues extends AbstractHandler { if (project == null) return; - final SubMonitor mon = SubMonitor.convert(monitor, "Purging resolved issues...", 100); + final SubMonitor mon = SubMonitor.convert(monitor, Messages.PurgeResolvedIssues_MonitorPurgingResolvedIssues, 100); session.syncRequest(new DelayedWriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); IssueResource ISSUE = IssueResource.getInstance(graph); - Set toBeRemoved = new HashSet(); - Map sourceIsContinuous = new THashMap(); + Set toBeRemoved = new HashSet<>(); + Map sourceIsContinuous = new THashMap<>(); for (Resource activeIssue : graph.syncRequest(new AllActiveIssues(project))) { if (graph.hasStatement(activeIssue, ISSUE.Resolved)) { Resource managedBy = graph.getPossibleObject(activeIssue, ISSUE.IssueSource_Manages_Inverse); @@ -96,12 +97,12 @@ public class PurgeResolvedIssues extends AbstractHandler { } } - mon.setTaskName("Purging " + toBeRemoved.size() + " resolved batch issues..."); + mon.setTaskName(NLS.bind(Messages.PurgeResolvedIssues_PurgingResolvedBatchIssues, toBeRemoved.size())); mon.setWorkRemaining(toBeRemoved.size()); StringBuilder sb = new StringBuilder(); - sb.append("Purged " + toBeRemoved.size() + " resolved batch issue(s)"); + sb.append(NLS.bind(Messages.PurgeResolvedIssues_PurgedResolvedBatchIssues, toBeRemoved.size())); for (Resource remove : toBeRemoved) { - //sb.append(NameUtils.getSafeLabel(graph, remove) + " "); + // sb.append(NameUtils.getSafeLabel(graph, remove) + " "); RemoverUtil.remove(graph, remove); mon.worked(1); } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java index 803324613..e46be60d4 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java @@ -71,7 +71,7 @@ public class RunActiveValidations extends AbstractHandler { final BatchIssueValidationContext context = new BatchIssueValidationContext(); try { - SleepingDatabaseJob dbLock = new SleepingDatabaseJob("Validation Preparation").scheduleAndWaitForRunning(); + SleepingDatabaseJob dbLock = new SleepingDatabaseJob(Messages.RunActiveValidations_ValidationPreparation).scheduleAndWaitForRunning(); try { PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() { @Override @@ -84,7 +84,7 @@ public class RunActiveValidations extends AbstractHandler { session.syncRequest(new SelectedModelBatchIssueSources(model)), validations); - SubMonitor.convert(monitor, "Preparing resources for validation", 100); + SubMonitor.convert(monitor, Messages.RunActiveValidations_MonitorPreparingResourcesForValidation, 100); context.contexts = Collections.singletonList(model); context.domain = ModelTransferableGraphSourceRequest.getDomainOnly(session, monitor, model); @@ -126,7 +126,7 @@ public class RunActiveValidations extends AbstractHandler { public static void run(Runnable postValidation, final Collection validations, final BatchIssueValidationContext context) { // Run the validations for the selected composites - SleepingDatabaseJob dbLock = new SleepingDatabaseJob("Validation"); + SleepingDatabaseJob dbLock = new SleepingDatabaseJob(Messages.RunActiveValidations_Validation); try { dbLock.scheduleAndWaitForRunning(); try { @@ -134,7 +134,7 @@ public class RunActiveValidations extends AbstractHandler { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { - SubMonitor progress = SubMonitor.convert(monitor, "Validate Model", 100); + SubMonitor progress = SubMonitor.convert(monitor, Messages.RunActiveValidations_ValidateModel, 100); int maxWrittenIssues = IssuePreferenceUtil.getPreferences().maxBatchIssuesToWrite; int writtenIssues = 0; for (BatchIssueSource source : validations) { diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Unhide.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Unhide.java index 24918c1fb..1a2457b1c 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Unhide.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Unhide.java @@ -18,7 +18,7 @@ package org.simantics.issues.ui.handler; public class Unhide extends FunctionHandler { public Unhide() { - super(null, "hider", Boolean.FALSE); + super(null, "hider", Boolean.FALSE); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/messages.properties b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/messages.properties new file mode 100644 index 000000000..527e67a64 --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/messages.properties @@ -0,0 +1,18 @@ +ConfigureIssueSources_SelectAvailableIssueSources=Select available issue sources +ConfigureIssueSources_SelectedSourcesAddRemoveMsg=Selected sources will be used and existing deselected sources will be removed. +ExportIssuesAsCsv_AllFiles=All Files (*.*) +ExportIssuesAsCsv_CommaSeparatedValues=Comma-Separated Values (*.txt) +ExportIssuesAsCsv_ExportIssues=Export issues +ExportIssuesAsCsv_SelectValidationOutput=Select Validation Output +MenuActions_Hide=Hide +MenuActions_MarkResolved=Mark Resolved +MenuActions_MarkUnresolved=Mark Unresolved +MenuActions_SetSeverity=Set Severity +MenuActions_Unhide=Unhide +PurgeResolvedIssues_MonitorPurgingResolvedIssues=Purging resolved issues... +PurgeResolvedIssues_PurgedResolvedBatchIssues=Purged {0} resolved batch issue(s) +PurgeResolvedIssues_PurgingResolvedBatchIssues=Purging {0} resolved batch issues... +RunActiveValidations_MonitorPreparingResourcesForValidation=Preparing resources for validation +RunActiveValidations_ValidateModel=Validate Model +RunActiveValidations_Validation=Validation +RunActiveValidations_ValidationPreparation=Validation Preparation diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/internal/Activator.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/internal/Activator.java index 790c00471..17ac9c5c7 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/internal/Activator.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/internal/Activator.java @@ -26,7 +26,7 @@ import org.simantics.utils.ui.gfx.HSVAdjustmentImageDescriptor; public class Activator extends AbstractUIPlugin { - public static final String PLUGIN_ID = "org.simantics.issues.ui"; + public static final String PLUGIN_ID = "org.simantics.issues.ui"; //$NON-NLS-1$ static Activator instance; ServiceTracker messageScheme; @@ -59,29 +59,29 @@ public class Activator extends AbstractUIPlugin { Bundle bundle = context.getBundle(); - HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png")); + HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png")); //$NON-NLS-1$ UNHIDE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust( HIDE_ICON, 0f, 0f, 1f), 96); //RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb.png")); //UNRESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb_off.png")); - RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png")); + RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png")); //$NON-NLS-1$ UNRESOLVE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust( RESOLVE_ICON, 0f, 0f, 1f), 96); - PURGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/purge.gif")); + PURGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/purge.gif")); //$NON-NLS-1$ - FATAL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal.png")); - ERROR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error.png")); - WARNING_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning.png")); - INFO_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information.png")); - NOTE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note.png")); - OK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/noissue.png")); + FATAL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal.png")); //$NON-NLS-1$ + ERROR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error.png")); //$NON-NLS-1$ + WARNING_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning.png")); //$NON-NLS-1$ + INFO_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information.png")); //$NON-NLS-1$ + NOTE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note.png")); //$NON-NLS-1$ + OK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/noissue.png")); //$NON-NLS-1$ - FATAL_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal_decoration.png")); - ERROR_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error_decoration.png")); - WARNING_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning_decoration.png")); - INFO_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information_decoration.png")); - NOTE_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note_decoration.png")); + FATAL_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal_decoration.png")); //$NON-NLS-1$ + ERROR_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error_decoration.png")); //$NON-NLS-1$ + WARNING_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning_decoration.png")); //$NON-NLS-1$ + INFO_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information_decoration.png")); //$NON-NLS-1$ + NOTE_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note_decoration.png")); //$NON-NLS-1$ } @Override @@ -91,11 +91,11 @@ public class Activator extends AbstractUIPlugin { @Override protected void initializeImageRegistry(ImageRegistry reg) { - reg.put(Severity.FATAL.toString()+"-full", FATAL_ICON); - reg.put(Severity.ERROR.toString()+"-full", ERROR_ICON); - reg.put(Severity.WARNING.toString()+"-full", WARNING_ICON); - reg.put(Severity.INFO.toString()+"-full", INFO_ICON); - reg.put(Severity.NOTE.toString()+"-full", NOTE_ICON); + reg.put(Severity.FATAL.toString()+"-full", FATAL_ICON); //$NON-NLS-1$ + reg.put(Severity.ERROR.toString()+"-full", ERROR_ICON); //$NON-NLS-1$ + reg.put(Severity.WARNING.toString()+"-full", WARNING_ICON); //$NON-NLS-1$ + reg.put(Severity.INFO.toString()+"-full", INFO_ICON); //$NON-NLS-1$ + reg.put(Severity.NOTE.toString()+"-full", NOTE_ICON); //$NON-NLS-1$ reg.put(Severity.FATAL.toString(), FATAL_DECORATION_ICON); reg.put(Severity.ERROR.toString(), ERROR_DECORATION_ICON); reg.put(Severity.WARNING.toString(), WARNING_DECORATION_ICON); @@ -125,7 +125,7 @@ public class Activator extends AbstractUIPlugin { public static URL getDefaultResource(String name) { Activator plugin = getDefault(); - if(plugin == null) throw new IllegalStateException("The plugin is not active."); + if(plugin == null) throw new IllegalStateException("The plugin is not active."); //$NON-NLS-1$ Bundle bundle = plugin.getBundle(); return bundle.getResource(name); } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/messages.properties b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/messages.properties new file mode 100644 index 000000000..5028434ce --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/messages.properties @@ -0,0 +1,3 @@ +IssueLabelRule_Path=Path +IssueLabelRule_Resource=Resource +IssueView2_IssuesNotAvailable=Issues not available. diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/IssuePreferencePage.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/IssuePreferencePage.java index 577c06b7b..06345506e 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/IssuePreferencePage.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/IssuePreferencePage.java @@ -32,14 +32,14 @@ public class IssuePreferencePage extends FieldEditorPreferencePage implements IW @Override protected IPreferenceStore doGetPreferenceStore() { - return new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.simantics.issues"); + return new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.simantics.issues"); //$NON-NLS-1$ } @Override protected void createFieldEditors() { //addField(new BooleanFieldEditor(IssuePreferences.P_ISSUES_ENABLED, "Issue searching &enabled (only takes effect after restart)", getFieldEditorParent())); - IntegerFieldEditor f = new IntegerFieldEditor(IssuePreferences.P_MAX_BATCH_ISSUES_TO_WRITE, "Maximum batch validation issues to write", getFieldEditorParent()); - f.getLabelControl(getFieldEditorParent()).setToolTipText("Limit for amount of batch validation issue results to write into the database"); + IntegerFieldEditor f = new IntegerFieldEditor(IssuePreferences.P_MAX_BATCH_ISSUES_TO_WRITE, Messages.IssuePreferencePage_MaximumBatchValidationIssues, getFieldEditorParent()); + f.getLabelControl(getFieldEditorParent()).setToolTipText(Messages.IssuePreferencePage_LimitforAmountOfBatchValidation); addField(f); } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/Messages.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/Messages.java new file mode 100644 index 000000000..aa7597879 --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/Messages.java @@ -0,0 +1,16 @@ +package org.simantics.issues.ui.preferences; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.issues.ui.preferences.messages"; //$NON-NLS-1$ + public static String IssuePreferencePage_LimitforAmountOfBatchValidation; + public static String IssuePreferencePage_MaximumBatchValidationIssues; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/messages.properties b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/messages.properties new file mode 100644 index 000000000..5758b6990 --- /dev/null +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/messages.properties @@ -0,0 +1,2 @@ +IssuePreferencePage_LimitforAmountOfBatchValidation=Limit for amount of batch validation issue results to write into the database +IssuePreferencePage_MaximumBatchValidationIssues=Maximum batch validation issues to write diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/Messages.java b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/Messages.java new file mode 100644 index 000000000..7e3d48878 --- /dev/null +++ b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/Messages.java @@ -0,0 +1,16 @@ +package org.simantics.logging.ui.handlers; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.logging.ui.handlers.messages"; //$NON-NLS-1$ + public static String SaveLogFilesHandler_FilterAllFiles; + public static String SaveLogFilesHandler_FilterZipArchive; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SaveLogFilesHandler.java b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SaveLogFilesHandler.java index dd6280500..8457ca5a8 100644 --- a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SaveLogFilesHandler.java +++ b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SaveLogFilesHandler.java @@ -19,9 +19,9 @@ public class SaveLogFilesHandler { private static final Logger LOGGER = LoggerFactory.getLogger(SaveLogFilesHandler.class); - private static final String[] FILTER_NAMES = { "ZIP-archive", "AllFiles (*.*)" }; - private static final String[] FILTER_EXTENSIONS = { "*.zip", "*.*" }; - private static final String USER_HOME = System.getProperty("user.home"); + private static final String[] FILTER_NAMES = { Messages.SaveLogFilesHandler_FilterZipArchive, Messages.SaveLogFilesHandler_FilterAllFiles }; + private static final String[] FILTER_EXTENSIONS = { "*.zip", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + private static final String USER_HOME = System.getProperty("user.home"); //$NON-NLS-1$ @Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) { @@ -39,16 +39,16 @@ public class SaveLogFilesHandler { String destination = dialog.open(); if (destination != null) { if (LOGGER.isDebugEnabled()) - LOGGER.debug("Destination for saving log files is {}", destination); + LOGGER.debug("Destination for saving log files is {}", destination); //$NON-NLS-1$ try { LogCollector.archiveLogs(destination); } catch (Throwable t) { - LOGGER.error("Could not save log files to ZIP", t); - ExceptionUtils.logAndShowError("Could not save log files to ZIP", t); + LOGGER.error("Could not save log files to ZIP", t); //$NON-NLS-1$ + ExceptionUtils.logAndShowError("Could not save log files to ZIP", t); //$NON-NLS-1$ } } else { if (LOGGER.isDebugEnabled()) { - LOGGER.debug("No destination selected for saving logs"); + LOGGER.debug("No destination selected for saving logs"); //$NON-NLS-1$ } } } diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java index 27473f182..9b350829d 100644 --- a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java +++ b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java @@ -14,7 +14,7 @@ public class SelectLoggingLevelHandler { @Execute public void execute(@Named("org.simantics.logging.ui.commandparameter.selectLoggingLevel") String level) { if (LOGGER.isDebugEnabled()) - LOGGER.debug("Setting logging level to {}", level); + LOGGER.debug("Setting logging level to {}", level); //$NON-NLS-1$ LogConfigurator.setLoggingLevel(level); } diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/messages.properties b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/messages.properties new file mode 100644 index 000000000..bee99a525 --- /dev/null +++ b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/messages.properties @@ -0,0 +1,2 @@ +SaveLogFilesHandler_FilterAllFiles=AllFiles (*.*) +SaveLogFilesHandler_FilterZipArchive=ZIP-archive diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Activator.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Activator.java index 2cc795dd0..a2343cd85 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Activator.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Activator.java @@ -22,7 +22,7 @@ import org.osgi.framework.BundleContext; public class Activator extends AbstractUIPlugin { // The plug-in ID - public static final String PLUGIN_ID = "org.simantics.message.ui"; + public static final String PLUGIN_ID = "org.simantics.message.ui"; //$NON-NLS-1$ // The shared instance private static Activator plugin; diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/EventDetailsDialog.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/EventDetailsDialog.java index 7c3a33067..9319a38d5 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/EventDetailsDialog.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/EventDetailsDialog.java @@ -384,12 +384,12 @@ public class EventDetailsDialog extends TrayDialog { if (stack != null) { stack = filterStack(stack); - detailsText.setText("
" + stack + "
"); + detailsText.setText("
" + stack + "
"); //$NON-NLS-1$ //$NON-NLS-2$ detailsTextDescription.setText(Messages.EventDetailsDialog_exception); } else { - detailsText.setText("
" + Messages.EventDetailsDialog_noDetailedMessage + "
"); - } - } + detailsText.setText("
" + Messages.EventDetailsDialog_noDetailedMessage + "
"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } LogSession logSession = logEntry.getSession(); String session = logSession != null ? logSession.getSessionData() : null; @@ -768,7 +768,7 @@ public class EventDetailsDialog extends TrayDialog { public void changing(LocationEvent event) { //System.out.println("changing: " + event); String location = event.location; - if ("about:blank".equals(location)) { + if ("about:blank".equals(location)) { //$NON-NLS-1$ event.doit = true; } else { event.doit = false; diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogView.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogView.java index b71cb3cde..a9d685be3 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogView.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogView.java @@ -361,7 +361,7 @@ public class LogView extends ViewPart implements ILogListener { */ fMessageDescription = new Browser(sashForm, SWT.NONE); fMessageDescription.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - fMessageDescription.setText("

Select a message to show its description here.

"); + fMessageDescription.setText("

Select a message to show its description here.

"); //$NON-NLS-1$ fMessageDescription.addLocationListener(new LocationListener() { @Override public void changed(LocationEvent event) { @@ -371,7 +371,7 @@ public class LogView extends ViewPart implements ILogListener { public void changing(LocationEvent event) { //System.out.println("changing: " + event); String location = event.location; - if ("about:blank".equals(location)) { + if ("about:blank".equals(location)) { //$NON-NLS-1$ event.doit = true; } else { event.doit = false; @@ -413,7 +413,7 @@ public class LogView extends ViewPart implements ILogListener { IStructuredSelection s = (IStructuredSelection) event.getSelection(); if (s.isEmpty()) { //fMessageDescription.setText("Select a message to show its description here.", false, false); - fMessageDescription.setText("
Select a message to show its description here.
"); + fMessageDescription.setText("
Select a message to show its description here.
"); //$NON-NLS-1$ } else { AbstractEntry entry = (AbstractEntry) s.getFirstElement(); if (entry instanceof LogEntry) { @@ -427,11 +427,7 @@ public class LogView extends ViewPart implements ILogListener { // truncation enables us to show even lengthy messages. if (msg.length() > Short.MAX_VALUE) { StringBuilder truncated = new StringBuilder(); - truncated.append("... [truncated "); - truncated.append(msg.length() - (Short.MAX_VALUE - 100)); - truncated.append(" out of "); - truncated.append(msg.length()); - truncated.append(" characters]"); + truncated.append( NLS.bind(Messages.LogView_Truncated, msg.length() - (Short.MAX_VALUE - 100), msg.length())); msg = msg.substring(0, Short.MAX_VALUE - 100) + truncated; } try { @@ -596,11 +592,11 @@ public class LogView extends ViewPart implements ILogListener { @SuppressWarnings("unused") private Action createTestAction() { - Action action = new Action("Test") { + Action action = new Action("Test") { //$NON-NLS-1$ public void run() { - IStatus s1 = new Status(IStatus.INFO, Activator.PLUGIN_ID, "Test message 1", null); - IStatus s2 = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Test message 2", null); - IStatus s3 = new DetailStatus(IStatus.ERROR, Activator.PLUGIN_ID, "This is the short message.", HtmlUtil.p("A multi-lined message...\n
continuing...

still...
Error occurred, report at " + HtmlUtil.a("http://www.simantics.org", "simantics.org")), null); + IStatus s1 = new Status(IStatus.INFO, Activator.PLUGIN_ID, "Test message 1", null); //$NON-NLS-1$ + IStatus s2 = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Test message 2", null); //$NON-NLS-1$ + IStatus s3 = new DetailStatus(IStatus.ERROR, Activator.PLUGIN_ID, "This is the short message.", HtmlUtil.p("A multi-lined message...\n
continuing...

still...
Error occurred, report at {0}" + HtmlUtil.a("http://www.simantics.org", "simantics.org")), null); //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ MessageService.defaultLog(s1); MessageService.defaultLog(s2); MessageService.defaultLog(s3); @@ -608,16 +604,16 @@ public class LogView extends ViewPart implements ILogListener { // Activator.getDefault().getLog().log(s2); // Activator.getDefault().getLog().log(s3); - MultiStatus s4 = new MultiStatus(Activator.PLUGIN_ID, 0, "Test message 4", new Exception()); - s4.merge(new Status(IStatus.INFO, Activator.PLUGIN_ID, "MultiStatus Test 1", null)); - s4.merge(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "MultiStatus Test 2", null)); - s4.merge(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "MultiStatus Test 3", null)); + MultiStatus s4 = new MultiStatus(Activator.PLUGIN_ID, 0, "Test message 4", new Exception()); //$NON-NLS-1$ + s4.merge(new Status(IStatus.INFO, Activator.PLUGIN_ID, "MultiStatus Test 1", null)); //$NON-NLS-1$ + s4.merge(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "MultiStatus Test 2", null)); //$NON-NLS-1$ + s4.merge(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "MultiStatus Test 3", null)); //$NON-NLS-1$ MessageService.defaultLog(s4); // Activator.getDefault().getLog().log(s4); } }; action.setImageDescriptor(ImageDescriptor.getMissingImageDescriptor()); - action.setToolTipText("Produce test log entries"); + action.setToolTipText("Produce test log entries"); //$NON-NLS-1$ return action; } @@ -1097,7 +1093,7 @@ public class LogView extends ViewPart implements ILogListener { // Remove the content description in this case // to save vertical space from the view. //return Messages.LogView_WorkspaceLogFile; - return ""; + return ""; //$NON-NLS-1$ } Map sources = LogFilesManager.getLogSources(); diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Messages.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Messages.java index f6ab65980..d62492c90 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Messages.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/Messages.java @@ -69,6 +69,7 @@ public class Messages extends NLS { public static String LogView_GroupBySession; public static String LogView_LogFileTitle; public static String LogView_OpenFile; + public static String LogView_Truncated; public static String LogView_WorkspaceLogFile; public static String LogViewLabelProvider_Session; diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/TextColors.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/TextColors.java index bdb9b6bc5..545a20e02 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/TextColors.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/TextColors.java @@ -27,92 +27,92 @@ public class TextColors { } static Mapping[] colors = new Mapping[] { - new Mapping("AliceBlue", new RGB(0xF0, 0xF8, 0xFF)), - new Mapping("AntiqueWhite", new RGB(0xFA, 0xEB, 0xD7)), new Mapping("Aqua", new RGB(0x00, 0xFF, 0xFF)), - new Mapping("Aquamarine", new RGB(0x7F, 0xFF, 0xD4)), new Mapping("Azure", new RGB(0xF0, 0xFF, 0xFF)), - new Mapping("Beige", new RGB(0xF5, 0xF5, 0xDC)), new Mapping("Bisque", new RGB(0xFF, 0xE4, 0xC4)), - new Mapping("Black", new RGB(0x00, 0x00, 0x00)), new Mapping("BlanchedAlmond", new RGB(0xFF, 0xEB, 0xCD)), - new Mapping("Blue", new RGB(0x00, 0x00, 0xFF)), new Mapping("BlueViolet", new RGB(0x8A, 0x2B, 0xE2)), - new Mapping("Brown", new RGB(0xA5, 0x2A, 0x2A)), new Mapping("BurlyWood", new RGB(0xDE, 0xB8, 0x87)), - new Mapping("CadetBlue", new RGB(0x5F, 0x9E, 0xA0)), new Mapping("Chartreuse", new RGB(0x7F, 0xFF, 0x00)), - new Mapping("Chocolate", new RGB(0xD2, 0x69, 0x1E)), new Mapping("Coral", new RGB(0xFF, 0x7F, 0x50)), - new Mapping("CornflowerBlue", new RGB(0x64, 0x95, 0xED)), - new Mapping("Cornsilk", new RGB(0xFF, 0xF8, 0xDC)), new Mapping("Crimson", new RGB(0xDC, 0x14, 0x3C)), - new Mapping("Cyan", new RGB(0x00, 0xFF, 0xFF)), new Mapping("DarkBlue", new RGB(0x00, 0x00, 0x8B)), - new Mapping("DarkCyan", new RGB(0x00, 0x8B, 0x8B)), - new Mapping("DarkGoldenRod", new RGB(0xB8, 0x86, 0x0B)), - new Mapping("DarkGray", new RGB(0xA9, 0xA9, 0xA9)), new Mapping("DarkGreen", new RGB(0x00, 0x64, 0x00)), - new Mapping("DarkKhaki", new RGB(0xBD, 0xB7, 0x6B)), new Mapping("DarkMagenta", new RGB(0x8B, 0x00, 0x8B)), - new Mapping("DarkOliveGreen", new RGB(0x55, 0x6B, 0x2F)), - new Mapping("Darkorange", new RGB(0xFF, 0x8C, 0x00)), new Mapping("DarkOrchid", new RGB(0x99, 0x32, 0xCC)), - new Mapping("DarkRed", new RGB(0x8B, 0x00, 0x00)), new Mapping("DarkSalmon", new RGB(0xE9, 0x96, 0x7A)), - new Mapping("DarkSeaGreen", new RGB(0x8F, 0xBC, 0x8F)), - new Mapping("DarkSlateBlue", new RGB(0x48, 0x3D, 0x8B)), - new Mapping("DarkSlateGray", new RGB(0x2F, 0x4F, 0x4F)), - new Mapping("DarkTurquoise", new RGB(0x00, 0xCE, 0xD1)), - new Mapping("DarkViolet", new RGB(0x94, 0x00, 0xD3)), new Mapping("DeepPink", new RGB(0xFF, 0x14, 0x93)), - new Mapping("DeepSkyBlue", new RGB(0x00, 0xBF, 0xFF)), new Mapping("DimGray", new RGB(0x69, 0x69, 0x69)), - new Mapping("DodgerBlue", new RGB(0x1E, 0x90, 0xFF)), new Mapping("FireBrick", new RGB(0xB2, 0x22, 0x22)), - new Mapping("FloralWhite", new RGB(0xFF, 0xFA, 0xF0)), - new Mapping("ForestGreen", new RGB(0x22, 0x8B, 0x22)), new Mapping("Fuchsia", new RGB(0xFF, 0x00, 0xFF)), - new Mapping("Gainsboro", new RGB(0xDC, 0xDC, 0xDC)), new Mapping("GhostWhite", new RGB(0xF8, 0xF8, 0xFF)), - new Mapping("Gold", new RGB(0xFF, 0xD7, 0x00)), new Mapping("GoldenRod", new RGB(0xDA, 0xA5, 0x20)), - new Mapping("Gray", new RGB(0x80, 0x80, 0x80)), new Mapping("Green", new RGB(0x00, 0x80, 0x00)), - new Mapping("GreenYellow", new RGB(0xAD, 0xFF, 0x2F)), new Mapping("HoneyDew", new RGB(0xF0, 0xFF, 0xF0)), - new Mapping("HotPink", new RGB(0xFF, 0x69, 0xB4)), new Mapping("IndianRed", new RGB(0xCD, 0x5C, 0x5C)), - new Mapping("Indigo", new RGB(0x4B, 0x00, 0x82)), new Mapping("Ivory", new RGB(0xFF, 0xFF, 0xF0)), - new Mapping("Khaki", new RGB(0xF0, 0xE6, 0x8C)), new Mapping("Lavender", new RGB(0xE6, 0xE6, 0xFA)), - new Mapping("LavenderBlush", new RGB(0xFF, 0xF0, 0xF5)), - new Mapping("LawnGreen", new RGB(0x7C, 0xFC, 0x00)), - new Mapping("LemonChiffon", new RGB(0xFF, 0xFA, 0xCD)), - new Mapping("LightBlue", new RGB(0xAD, 0xD8, 0xE6)), new Mapping("LightCoral", new RGB(0xF0, 0x80, 0x80)), - new Mapping("LightCyan", new RGB(0xE0, 0xFF, 0xFF)), - new Mapping("LightGoldenRodYellow", new RGB(0xFA, 0xFA, 0xD2)), - new Mapping("LightGrey", new RGB(0xD3, 0xD3, 0xD3)), new Mapping("LightGreen", new RGB(0x90, 0xEE, 0x90)), - new Mapping("LightPink", new RGB(0xFF, 0xB6, 0xC1)), new Mapping("LightSalmon", new RGB(0xFF, 0xA0, 0x7A)), - new Mapping("LightSeaGreen", new RGB(0x20, 0xB2, 0xAA)), - new Mapping("LightSkyBlue", new RGB(0x87, 0xCE, 0xFA)), - new Mapping("LightSlateGray", new RGB(0x77, 0x88, 0x99)), - new Mapping("LightSteelBlue", new RGB(0xB0, 0xC4, 0xDE)), - new Mapping("LightYellow", new RGB(0xFF, 0xFF, 0xE0)), new Mapping("Lime", new RGB(0x00, 0xFF, 0x00)), - new Mapping("LimeGreen", new RGB(0x32, 0xCD, 0x32)), new Mapping("Linen", new RGB(0xFA, 0xF0, 0xE6)), - new Mapping("Magenta", new RGB(0xFF, 0x00, 0xFF)), new Mapping("Maroon", new RGB(0x80, 0x00, 0x00)), - new Mapping("MediumAquaMarine", new RGB(0x66, 0xCD, 0xAA)), - new Mapping("MediumBlue", new RGB(0x00, 0x00, 0xCD)), - new Mapping("MediumOrchid", new RGB(0xBA, 0x55, 0xD3)), - new Mapping("MediumPurple", new RGB(0x93, 0x70, 0xD8)), - new Mapping("MediumSeaGreen", new RGB(0x3C, 0xB3, 0x71)), - new Mapping("MediumSlateBlue", new RGB(0x7B, 0x68, 0xEE)), - new Mapping("MediumSpringGreen", new RGB(0x00, 0xFA, 0x9A)), - new Mapping("MediumTurquoise", new RGB(0x48, 0xD1, 0xCC)), - new Mapping("MediumVioletRed", new RGB(0xC7, 0x15, 0x85)), - new Mapping("MidnightBlue", new RGB(0x19, 0x19, 0x70)), - new Mapping("MintCream", new RGB(0xF5, 0xFF, 0xFA)), new Mapping("MistyRose", new RGB(0xFF, 0xE4, 0xE1)), - new Mapping("Moccasin", new RGB(0xFF, 0xE4, 0xB5)), new Mapping("NavajoWhite", new RGB(0xFF, 0xDE, 0xAD)), - new Mapping("Navy", new RGB(0x00, 0x00, 0x80)), new Mapping("OldLace", new RGB(0xFD, 0xF5, 0xE6)), - new Mapping("Olive", new RGB(0x80, 0x80, 0x00)), new Mapping("OliveDrab", new RGB(0x6B, 0x8E, 0x23)), - new Mapping("Orange", new RGB(0xFF, 0xA5, 0x00)), new Mapping("OrangeRed", new RGB(0xFF, 0x45, 0x00)), - new Mapping("Orchid", new RGB(0xDA, 0x70, 0xD6)), new Mapping("PaleGoldenRod", new RGB(0xEE, 0xE8, 0xAA)), - new Mapping("PaleGreen", new RGB(0x98, 0xFB, 0x98)), - new Mapping("PaleTurquoise", new RGB(0xAF, 0xEE, 0xEE)), - new Mapping("PaleVioletRed", new RGB(0xD8, 0x70, 0x93)), - new Mapping("PapayaWhip", new RGB(0xFF, 0xEF, 0xD5)), new Mapping("PeachPuff", new RGB(0xFF, 0xDA, 0xB9)), - new Mapping("Peru", new RGB(0xCD, 0x85, 0x3F)), new Mapping("Pink", new RGB(0xFF, 0xC0, 0xCB)), - new Mapping("Plum", new RGB(0xDD, 0xA0, 0xDD)), new Mapping("PowderBlue", new RGB(0xB0, 0xE0, 0xE6)), - new Mapping("Purple", new RGB(0x80, 0x00, 0x80)), new Mapping("Red", new RGB(0xFF, 0x00, 0x00)), - new Mapping("RosyBrown", new RGB(0xBC, 0x8F, 0x8F)), new Mapping("RoyalBlue", new RGB(0x41, 0x69, 0xE1)), - new Mapping("SaddleBrown", new RGB(0x8B, 0x45, 0x13)), new Mapping("Salmon", new RGB(0xFA, 0x80, 0x72)), - new Mapping("SandyBrown", new RGB(0xF4, 0xA4, 0x60)), new Mapping("SeaGreen", new RGB(0x2E, 0x8B, 0x57)), - new Mapping("SeaShell", new RGB(0xFF, 0xF5, 0xEE)), new Mapping("Sienna", new RGB(0xA0, 0x52, 0x2D)), - new Mapping("Silver", new RGB(0xC0, 0xC0, 0xC0)), new Mapping("SkyBlue", new RGB(0x87, 0xCE, 0xEB)), - new Mapping("SlateBlue", new RGB(0x6A, 0x5A, 0xCD)), new Mapping("SlateGray", new RGB(0x70, 0x80, 0x90)), - new Mapping("Snow", new RGB(0xFF, 0xFA, 0xFA)), new Mapping("SpringGreen", new RGB(0x00, 0xFF, 0x7F)), - new Mapping("SteelBlue", new RGB(0x46, 0x82, 0xB4)), new Mapping("Tan", new RGB(0xD2, 0xB4, 0x8C)), - new Mapping("Teal", new RGB(0x00, 0x80, 0x80)), new Mapping("Thistle", new RGB(0xD8, 0xBF, 0xD8)), - new Mapping("Tomato", new RGB(0xFF, 0x63, 0x47)), new Mapping("Turquoise", new RGB(0x40, 0xE0, 0xD0)), - new Mapping("Violet", new RGB(0xEE, 0x82, 0xEE)), new Mapping("Wheat", new RGB(0xF5, 0xDE, 0xB3)), - new Mapping("White", new RGB(0xFF, 0xFF, 0xFF)), new Mapping("WhiteSmoke", new RGB(0xF5, 0xF5, 0xF5)), - new Mapping("Yellow", new RGB(0xFF, 0xFF, 0x00)), new Mapping("YellowGreen", new RGB(0x9A, 0xCD, 0x32)) + new Mapping("AliceBlue", new RGB(0xF0, 0xF8, 0xFF)), //$NON-NLS-1$ + new Mapping("AntiqueWhite", new RGB(0xFA, 0xEB, 0xD7)), new Mapping("Aqua", new RGB(0x00, 0xFF, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Aquamarine", new RGB(0x7F, 0xFF, 0xD4)), new Mapping("Azure", new RGB(0xF0, 0xFF, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Beige", new RGB(0xF5, 0xF5, 0xDC)), new Mapping("Bisque", new RGB(0xFF, 0xE4, 0xC4)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Black", new RGB(0x00, 0x00, 0x00)), new Mapping("BlanchedAlmond", new RGB(0xFF, 0xEB, 0xCD)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Blue", new RGB(0x00, 0x00, 0xFF)), new Mapping("BlueViolet", new RGB(0x8A, 0x2B, 0xE2)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Brown", new RGB(0xA5, 0x2A, 0x2A)), new Mapping("BurlyWood", new RGB(0xDE, 0xB8, 0x87)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("CadetBlue", new RGB(0x5F, 0x9E, 0xA0)), new Mapping("Chartreuse", new RGB(0x7F, 0xFF, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Chocolate", new RGB(0xD2, 0x69, 0x1E)), new Mapping("Coral", new RGB(0xFF, 0x7F, 0x50)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("CornflowerBlue", new RGB(0x64, 0x95, 0xED)), //$NON-NLS-1$ + new Mapping("Cornsilk", new RGB(0xFF, 0xF8, 0xDC)), new Mapping("Crimson", new RGB(0xDC, 0x14, 0x3C)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Cyan", new RGB(0x00, 0xFF, 0xFF)), new Mapping("DarkBlue", new RGB(0x00, 0x00, 0x8B)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DarkCyan", new RGB(0x00, 0x8B, 0x8B)), //$NON-NLS-1$ + new Mapping("DarkGoldenRod", new RGB(0xB8, 0x86, 0x0B)), //$NON-NLS-1$ + new Mapping("DarkGray", new RGB(0xA9, 0xA9, 0xA9)), new Mapping("DarkGreen", new RGB(0x00, 0x64, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DarkKhaki", new RGB(0xBD, 0xB7, 0x6B)), new Mapping("DarkMagenta", new RGB(0x8B, 0x00, 0x8B)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DarkOliveGreen", new RGB(0x55, 0x6B, 0x2F)), //$NON-NLS-1$ + new Mapping("Darkorange", new RGB(0xFF, 0x8C, 0x00)), new Mapping("DarkOrchid", new RGB(0x99, 0x32, 0xCC)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DarkRed", new RGB(0x8B, 0x00, 0x00)), new Mapping("DarkSalmon", new RGB(0xE9, 0x96, 0x7A)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DarkSeaGreen", new RGB(0x8F, 0xBC, 0x8F)), //$NON-NLS-1$ + new Mapping("DarkSlateBlue", new RGB(0x48, 0x3D, 0x8B)), //$NON-NLS-1$ + new Mapping("DarkSlateGray", new RGB(0x2F, 0x4F, 0x4F)), //$NON-NLS-1$ + new Mapping("DarkTurquoise", new RGB(0x00, 0xCE, 0xD1)), //$NON-NLS-1$ + new Mapping("DarkViolet", new RGB(0x94, 0x00, 0xD3)), new Mapping("DeepPink", new RGB(0xFF, 0x14, 0x93)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DeepSkyBlue", new RGB(0x00, 0xBF, 0xFF)), new Mapping("DimGray", new RGB(0x69, 0x69, 0x69)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("DodgerBlue", new RGB(0x1E, 0x90, 0xFF)), new Mapping("FireBrick", new RGB(0xB2, 0x22, 0x22)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("FloralWhite", new RGB(0xFF, 0xFA, 0xF0)), //$NON-NLS-1$ + new Mapping("ForestGreen", new RGB(0x22, 0x8B, 0x22)), new Mapping("Fuchsia", new RGB(0xFF, 0x00, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Gainsboro", new RGB(0xDC, 0xDC, 0xDC)), new Mapping("GhostWhite", new RGB(0xF8, 0xF8, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Gold", new RGB(0xFF, 0xD7, 0x00)), new Mapping("GoldenRod", new RGB(0xDA, 0xA5, 0x20)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Gray", new RGB(0x80, 0x80, 0x80)), new Mapping("Green", new RGB(0x00, 0x80, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("GreenYellow", new RGB(0xAD, 0xFF, 0x2F)), new Mapping("HoneyDew", new RGB(0xF0, 0xFF, 0xF0)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("HotPink", new RGB(0xFF, 0x69, 0xB4)), new Mapping("IndianRed", new RGB(0xCD, 0x5C, 0x5C)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Indigo", new RGB(0x4B, 0x00, 0x82)), new Mapping("Ivory", new RGB(0xFF, 0xFF, 0xF0)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Khaki", new RGB(0xF0, 0xE6, 0x8C)), new Mapping("Lavender", new RGB(0xE6, 0xE6, 0xFA)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("LavenderBlush", new RGB(0xFF, 0xF0, 0xF5)), //$NON-NLS-1$ + new Mapping("LawnGreen", new RGB(0x7C, 0xFC, 0x00)), //$NON-NLS-1$ + new Mapping("LemonChiffon", new RGB(0xFF, 0xFA, 0xCD)), //$NON-NLS-1$ + new Mapping("LightBlue", new RGB(0xAD, 0xD8, 0xE6)), new Mapping("LightCoral", new RGB(0xF0, 0x80, 0x80)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("LightCyan", new RGB(0xE0, 0xFF, 0xFF)), //$NON-NLS-1$ + new Mapping("LightGoldenRodYellow", new RGB(0xFA, 0xFA, 0xD2)), //$NON-NLS-1$ + new Mapping("LightGrey", new RGB(0xD3, 0xD3, 0xD3)), new Mapping("LightGreen", new RGB(0x90, 0xEE, 0x90)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("LightPink", new RGB(0xFF, 0xB6, 0xC1)), new Mapping("LightSalmon", new RGB(0xFF, 0xA0, 0x7A)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("LightSeaGreen", new RGB(0x20, 0xB2, 0xAA)), //$NON-NLS-1$ + new Mapping("LightSkyBlue", new RGB(0x87, 0xCE, 0xFA)), //$NON-NLS-1$ + new Mapping("LightSlateGray", new RGB(0x77, 0x88, 0x99)), //$NON-NLS-1$ + new Mapping("LightSteelBlue", new RGB(0xB0, 0xC4, 0xDE)), //$NON-NLS-1$ + new Mapping("LightYellow", new RGB(0xFF, 0xFF, 0xE0)), new Mapping("Lime", new RGB(0x00, 0xFF, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("LimeGreen", new RGB(0x32, 0xCD, 0x32)), new Mapping("Linen", new RGB(0xFA, 0xF0, 0xE6)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Magenta", new RGB(0xFF, 0x00, 0xFF)), new Mapping("Maroon", new RGB(0x80, 0x00, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("MediumAquaMarine", new RGB(0x66, 0xCD, 0xAA)), //$NON-NLS-1$ + new Mapping("MediumBlue", new RGB(0x00, 0x00, 0xCD)), //$NON-NLS-1$ + new Mapping("MediumOrchid", new RGB(0xBA, 0x55, 0xD3)), //$NON-NLS-1$ + new Mapping("MediumPurple", new RGB(0x93, 0x70, 0xD8)), //$NON-NLS-1$ + new Mapping("MediumSeaGreen", new RGB(0x3C, 0xB3, 0x71)), //$NON-NLS-1$ + new Mapping("MediumSlateBlue", new RGB(0x7B, 0x68, 0xEE)), //$NON-NLS-1$ + new Mapping("MediumSpringGreen", new RGB(0x00, 0xFA, 0x9A)), //$NON-NLS-1$ + new Mapping("MediumTurquoise", new RGB(0x48, 0xD1, 0xCC)), //$NON-NLS-1$ + new Mapping("MediumVioletRed", new RGB(0xC7, 0x15, 0x85)), //$NON-NLS-1$ + new Mapping("MidnightBlue", new RGB(0x19, 0x19, 0x70)), //$NON-NLS-1$ + new Mapping("MintCream", new RGB(0xF5, 0xFF, 0xFA)), new Mapping("MistyRose", new RGB(0xFF, 0xE4, 0xE1)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Moccasin", new RGB(0xFF, 0xE4, 0xB5)), new Mapping("NavajoWhite", new RGB(0xFF, 0xDE, 0xAD)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Navy", new RGB(0x00, 0x00, 0x80)), new Mapping("OldLace", new RGB(0xFD, 0xF5, 0xE6)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Olive", new RGB(0x80, 0x80, 0x00)), new Mapping("OliveDrab", new RGB(0x6B, 0x8E, 0x23)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Orange", new RGB(0xFF, 0xA5, 0x00)), new Mapping("OrangeRed", new RGB(0xFF, 0x45, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Orchid", new RGB(0xDA, 0x70, 0xD6)), new Mapping("PaleGoldenRod", new RGB(0xEE, 0xE8, 0xAA)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("PaleGreen", new RGB(0x98, 0xFB, 0x98)), //$NON-NLS-1$ + new Mapping("PaleTurquoise", new RGB(0xAF, 0xEE, 0xEE)), //$NON-NLS-1$ + new Mapping("PaleVioletRed", new RGB(0xD8, 0x70, 0x93)), //$NON-NLS-1$ + new Mapping("PapayaWhip", new RGB(0xFF, 0xEF, 0xD5)), new Mapping("PeachPuff", new RGB(0xFF, 0xDA, 0xB9)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Peru", new RGB(0xCD, 0x85, 0x3F)), new Mapping("Pink", new RGB(0xFF, 0xC0, 0xCB)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Plum", new RGB(0xDD, 0xA0, 0xDD)), new Mapping("PowderBlue", new RGB(0xB0, 0xE0, 0xE6)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Purple", new RGB(0x80, 0x00, 0x80)), new Mapping("Red", new RGB(0xFF, 0x00, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("RosyBrown", new RGB(0xBC, 0x8F, 0x8F)), new Mapping("RoyalBlue", new RGB(0x41, 0x69, 0xE1)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("SaddleBrown", new RGB(0x8B, 0x45, 0x13)), new Mapping("Salmon", new RGB(0xFA, 0x80, 0x72)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("SandyBrown", new RGB(0xF4, 0xA4, 0x60)), new Mapping("SeaGreen", new RGB(0x2E, 0x8B, 0x57)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("SeaShell", new RGB(0xFF, 0xF5, 0xEE)), new Mapping("Sienna", new RGB(0xA0, 0x52, 0x2D)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Silver", new RGB(0xC0, 0xC0, 0xC0)), new Mapping("SkyBlue", new RGB(0x87, 0xCE, 0xEB)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("SlateBlue", new RGB(0x6A, 0x5A, 0xCD)), new Mapping("SlateGray", new RGB(0x70, 0x80, 0x90)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Snow", new RGB(0xFF, 0xFA, 0xFA)), new Mapping("SpringGreen", new RGB(0x00, 0xFF, 0x7F)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("SteelBlue", new RGB(0x46, 0x82, 0xB4)), new Mapping("Tan", new RGB(0xD2, 0xB4, 0x8C)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Teal", new RGB(0x00, 0x80, 0x80)), new Mapping("Thistle", new RGB(0xD8, 0xBF, 0xD8)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Tomato", new RGB(0xFF, 0x63, 0x47)), new Mapping("Turquoise", new RGB(0x40, 0xE0, 0xD0)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Violet", new RGB(0xEE, 0x82, 0xEE)), new Mapping("Wheat", new RGB(0xF5, 0xDE, 0xB3)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("White", new RGB(0xFF, 0xFF, 0xFF)), new Mapping("WhiteSmoke", new RGB(0xF5, 0xF5, 0xF5)), //$NON-NLS-1$ //$NON-NLS-2$ + new Mapping("Yellow", new RGB(0xFF, 0xFF, 0x00)), new Mapping("YellowGreen", new RGB(0x9A, 0xCD, 0x32)) //$NON-NLS-1$ //$NON-NLS-2$ }; public static void bindTo(ResourceManager manager, FormText text) { diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/messages.properties b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/messages.properties index 8dd361149..0e76f4b69 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/messages.properties +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/messages.properties @@ -63,6 +63,7 @@ LogView_GroupByPlugin=Plug-in LogView_GroupBySession=Session LogView_LogFileTitle={0} [{1}] LogView_OpenFile=Open File +LogView_Truncated=... [truncated {0} out of {1} characters] LogView_WorkspaceLogFile=Workspace Log LogViewLabelProvider_truncatedMessage=... (Open log entry details for full message) LogViewLabelProvider_Session=Session diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/HttpSchemeHandler.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/HttpSchemeHandler.java index 7b3adcdce..1bcd891ed 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/HttpSchemeHandler.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/HttpSchemeHandler.java @@ -24,13 +24,13 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; public class HttpSchemeHandler extends AbstractMessageSchemeHandler { public HttpSchemeHandler() { - super("http", URL.class); + super("http", URL.class); //$NON-NLS-1$ } @Override public void doPerform(URL url) { try { - WorkbenchUtils.openEditor("org.simantics.editors.browser", new BrowserInput(url)); + WorkbenchUtils.openEditor("org.simantics.editors.browser", new BrowserInput(url)); //$NON-NLS-1$ } catch (PartInitException e) { throw new RuntimeException(e); } diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java index 1d400dcfc..0c29189ff 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java @@ -26,7 +26,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; public class ResourceSchemeHandler extends AbstractMessageSchemeHandler { public ResourceSchemeHandler() { - super("resource", Resource.class); + super("resource", Resource.class); //$NON-NLS-1$ } @Override @@ -34,7 +34,7 @@ public class ResourceSchemeHandler extends AbstractMessageSchemeHandlerThis is a detailed message that contains links to related information. Follow {0} to open your favorite editor for the database resource.

", MessageUtil.resource(s, r, "this link")), //$NON-NLS-1$ null)); } } catch (ReferenceSerializationException e) { diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/messages.properties b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/messages.properties deleted file mode 100644 index 34d6c2b7c..000000000 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/messages.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 2010 Association for Decentralized Information Management -# in Industry THTH ry. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# VTT Technical Research Centre of Finland - initial API and implementation -############################################################################### - -Test_message =

This is a detailed message that contains links to related information. Follow {0} to open your favorite editor for the database resource.

diff --git a/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/Messages.java b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/Messages.java new file mode 100644 index 000000000..4b64beb8f --- /dev/null +++ b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/Messages.java @@ -0,0 +1,16 @@ +package org.simantics.migration.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.migration.ui.messages"; //$NON-NLS-1$ + public static String MigrateActionFactory_Migrate; + public static String MigrateActionFactory_MigrateMsg; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/MigrateActionFactory.java b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/MigrateActionFactory.java index c49c15389..bd7ce3845 100644 --- a/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/MigrateActionFactory.java +++ b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/MigrateActionFactory.java @@ -53,8 +53,8 @@ public class MigrateActionFactory implements ActionFactory { private void select(final Resource resource, final ArrayList updates) { ListDialog listDialog = new ListDialog(Display.getCurrent().getActiveShell()); - listDialog.setTitle("Migrate"); - listDialog.setMessage("Choose the version to migrate to"); + listDialog.setTitle(Messages.MigrateActionFactory_Migrate); + listDialog.setMessage(Messages.MigrateActionFactory_MigrateMsg); listDialog.setContentProvider(new IStructuredContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { diff --git a/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/messages.properties b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/messages.properties new file mode 100644 index 000000000..fcb7177f7 --- /dev/null +++ b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/messages.properties @@ -0,0 +1,2 @@ +MigrateActionFactory_Migrate=Migrate +MigrateActionFactory_MigrateMsg=Choose the version to migrate to diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Activator.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Activator.java index 5a4a58f33..565c30895 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Activator.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Activator.java @@ -28,7 +28,7 @@ import org.simantics.utils.ui.BundleUtils; public class Activator extends AbstractUIPlugin { - public static final String PLUGIN_ID = "org.simantics.modeling.ui"; + public static final String PLUGIN_ID = "org.simantics.modeling.ui"; //$NON-NLS-1$ // The shared instance private static Activator plugin; @@ -102,76 +102,76 @@ public class Activator extends AbstractUIPlugin { Bundle bundle = context.getBundle(); - DOCUMENT_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/Gnome-mime-document.svg")); - FATAL_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/fatal.svg")); - ERROR_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/error.svg")); - WARNING_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/warning.svg")); - INFO_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/info.svg")); - NOTE_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/note4.svg")); - - BULLET_GREEN_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_green.png")); - BULLET_YELLOW_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_yellow.png")); - - MODEL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_organisation.png")); - COMPONENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/brick.png")); - COMPONENT_TYPE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/box.png")); - COMPOSITE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bricks.png")); - INTERFACE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/application_view_list.png")); - CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/connection.png")); - CONNECTION_PROPERTY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table_relationship.png")); - OPEN_CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/open_connection.png")); - VARIABLE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/variable.png")); - - ARROW_LEFT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_left.png")); - ARROW_RIGHT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_right.png")); - - SYMBOL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/photo.png")); - - EXPERIMENTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); - ATTACHED_EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time_attach.png")); - EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time.png")); - EXPERIMENT_RESULT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar.png")); - EXPERIMENT_RESULT_TRANSIENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar_light.png")); - - QUERY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/report.png")); - - STATES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_tag_red.png")); - STATE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_red.png")); - - TRENDS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); - TREND_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png")); - - CHARTGROUP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_group2.png")); - CHARTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); - CHART_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png")); - PLOT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png")); - - SPREADSHEET_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table.png")); - SPREADSHEETS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_table.png")); - - SUBSCRIPTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription.png")); - SUBSCRIPTION_DISABLED_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription_disabled.png")); - SUBSCRIPTIONS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscriptions.png")); - SUBSCRIPTION_ITEM_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png")); - - IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png")); - IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png")); - - SEGMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/segment_edit.gif")); - - TICK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png")); - CROSS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/silk/cross.png")); - STOP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/stop_red.png")); - ARROW_IN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_in.png"); - ARROW_UP_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_up.png"); - ARROW_DOWN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_down.png"); - SHOW_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/show-profile-monitors.png")); - HIDE_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide-profile-monitors.png")); - - POINTER_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/pointertool.png")); - CONNECT_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/connecttool.png")); + DOCUMENT_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/Gnome-mime-document.svg")); //$NON-NLS-1$ + FATAL_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/fatal.svg")); //$NON-NLS-1$ + ERROR_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/error.svg")); //$NON-NLS-1$ + WARNING_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/warning.svg")); //$NON-NLS-1$ + INFO_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/info.svg")); //$NON-NLS-1$ + NOTE_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/note4.svg")); //$NON-NLS-1$ + + BULLET_GREEN_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_green.png")); //$NON-NLS-1$ + BULLET_YELLOW_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_yellow.png")); //$NON-NLS-1$ + + MODEL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_organisation.png")); //$NON-NLS-1$ + COMPONENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/brick.png")); //$NON-NLS-1$ + COMPONENT_TYPE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/box.png")); //$NON-NLS-1$ + COMPOSITE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bricks.png")); //$NON-NLS-1$ + INTERFACE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/application_view_list.png")); //$NON-NLS-1$ + CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/connection.png")); //$NON-NLS-1$ + CONNECTION_PROPERTY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table_relationship.png")); //$NON-NLS-1$ + OPEN_CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/open_connection.png")); //$NON-NLS-1$ + VARIABLE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/variable.png")); //$NON-NLS-1$ + + ARROW_LEFT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_left.png")); //$NON-NLS-1$ + ARROW_RIGHT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_right.png")); //$NON-NLS-1$ + + SYMBOL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/photo.png")); //$NON-NLS-1$ + + EXPERIMENTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); //$NON-NLS-1$ + ATTACHED_EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time_attach.png")); //$NON-NLS-1$ + EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time.png")); //$NON-NLS-1$ + EXPERIMENT_RESULT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar.png")); //$NON-NLS-1$ + EXPERIMENT_RESULT_TRANSIENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar_light.png")); //$NON-NLS-1$ + + QUERY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/report.png")); //$NON-NLS-1$ + + STATES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_tag_red.png")); //$NON-NLS-1$ + STATE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_red.png")); //$NON-NLS-1$ + + TRENDS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); //$NON-NLS-1$ + TREND_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png")); //$NON-NLS-1$ + + CHARTGROUP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_group2.png")); //$NON-NLS-1$ + CHARTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); //$NON-NLS-1$ + CHART_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png")); //$NON-NLS-1$ + PLOT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png")); //$NON-NLS-1$ + + SPREADSHEET_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table.png")); //$NON-NLS-1$ + SPREADSHEETS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_table.png")); //$NON-NLS-1$ + + SUBSCRIPTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription.png")); //$NON-NLS-1$ + SUBSCRIPTION_DISABLED_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription_disabled.png")); //$NON-NLS-1$ + SUBSCRIPTIONS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscriptions.png")); //$NON-NLS-1$ + SUBSCRIPTION_ITEM_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png")); //$NON-NLS-1$ + + IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png")); //$NON-NLS-1$ + IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png")); //$NON-NLS-1$ + + SEGMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/segment_edit.gif")); //$NON-NLS-1$ + + TICK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png")); //$NON-NLS-1$ + CROSS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/silk/cross.png")); //$NON-NLS-1$ + STOP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/stop_red.png")); //$NON-NLS-1$ + ARROW_IN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_in.png"); //$NON-NLS-1$ //$NON-NLS-2$ + ARROW_UP_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_up.png"); //$NON-NLS-1$ //$NON-NLS-2$ + ARROW_DOWN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_down.png"); //$NON-NLS-1$ //$NON-NLS-2$ + SHOW_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/show-profile-monitors.png")); //$NON-NLS-1$ + HIDE_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide-profile-monitors.png")); //$NON-NLS-1$ + + POINTER_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/pointertool.png")); //$NON-NLS-1$ + CONNECT_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/connecttool.png")); //$NON-NLS-1$ - ARROW_REFRESH = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_refresh.png")); + ARROW_REFRESH = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_refresh.png")); //$NON-NLS-1$ Hashtable properties = new Hashtable(); context.registerService(SCLConsoleListener.class, @@ -190,15 +190,15 @@ public class Activator extends AbstractUIPlugin { @Override protected void initializeImageRegistry(ImageRegistry reg) { - reg.put("tick", TICK_ICON); - reg.put("cross", CROSS_ICON); - reg.put("stop", STOP_ICON); - reg.put("arrowIn", ARROW_IN_ICON); - reg.put("arrowUp", ARROW_UP_ICON); - reg.put("arrowDown", ARROW_DOWN_ICON); - reg.put("showProfileMonitors", SHOW_PROFILE_MONITOR_ICON); - reg.put("hideProfileMonitors", HIDE_PROFILE_MONITOR_ICON); - reg.put("arrow_refresh", ARROW_REFRESH); + reg.put("tick", TICK_ICON); //$NON-NLS-1$ + reg.put("cross", CROSS_ICON); //$NON-NLS-1$ + reg.put("stop", STOP_ICON); //$NON-NLS-1$ + reg.put("arrowIn", ARROW_IN_ICON); //$NON-NLS-1$ + reg.put("arrowUp", ARROW_UP_ICON); //$NON-NLS-1$ + reg.put("arrowDown", ARROW_DOWN_ICON); //$NON-NLS-1$ + reg.put("showProfileMonitors", SHOW_PROFILE_MONITOR_ICON); //$NON-NLS-1$ + reg.put("hideProfileMonitors", HIDE_PROFILE_MONITOR_ICON); //$NON-NLS-1$ + reg.put("arrow_refresh", ARROW_REFRESH); //$NON-NLS-1$ } /* diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Messages.java new file mode 100644 index 000000000..c5d1d6a5c --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Messages.java @@ -0,0 +1,15 @@ +package org.simantics.modeling.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.messages"; //$NON-NLS-1$ + public static String ModelingUIUtils_SelectQueryType; + 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/ModelingUIUtils.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/ModelingUIUtils.java index fa153e193..2ce2c802b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/ModelingUIUtils.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/ModelingUIUtils.java @@ -79,7 +79,7 @@ public class ModelingUIUtils { String label = graph.getPossibleRelatedValue2(_res, L0.HasLabel, Bindings.STRING); if (label != null && !name.equals(label)) { - name = label + " (" + name + ")"; + name = label + " (" + name + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } Resource parent = graph.getPossibleObject(_res, L0.PartOf); @@ -88,10 +88,10 @@ public class ModelingUIUtils { String parentURI = graph.getURI(parent); if(parentURI.startsWith(modelURI)) { parentURI = parentURI.substring(modelURI.length()); - if(parentURI.startsWith("/")) parentURI = parentURI.substring(1); + if(parentURI.startsWith("/")) parentURI = parentURI.substring(1); //$NON-NLS-1$ } - name = name + " - " + URIStringUtils.unescape(parentURI); + name = name + " - " + URIStringUtils.unescape(parentURI); //$NON-NLS-1$ map.put(_res, new Pair(name, null)); @@ -105,7 +105,7 @@ public class ModelingUIUtils { String label = graph.getPossibleRelatedValue2(res, L0.HasLabel, Bindings.STRING); if (label != null && !name.equals(label)) { - name = label + " (" + name + ")"; + name = label + " (" + name + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } Resource parent = graph.getPossibleObject(_res, L0.PartOf); @@ -114,10 +114,10 @@ public class ModelingUIUtils { String parentURI = graph.getURI(parent); if(parentURI.startsWith(modelURI)) { parentURI = parentURI.substring(modelURI.length()); - if(parentURI.startsWith("/")) parentURI = parentURI.substring(1); + if(parentURI.startsWith("/")) parentURI = parentURI.substring(1); //$NON-NLS-1$ } - name = name + " - " + URIStringUtils.unescape(parentURI); + name = name + " - " + URIStringUtils.unescape(parentURI); //$NON-NLS-1$ map.put(_res, new Pair(name, null)); @@ -135,7 +135,7 @@ public class ModelingUIUtils { @Override public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - ResourceSelectionDialog3 dialog = new ResourceSelectionDialog3(shell, map, "Select query type from list") { + ResourceSelectionDialog3 dialog = new ResourceSelectionDialog3(shell, map, Messages.ModelingUIUtils_SelectQueryType) { @Override protected IDialogSettings getBaseDialogSettings() { return Activator.getDefault().getDialogSettings(); @@ -166,7 +166,7 @@ public class ModelingUIUtils { @Override public void perform(WriteGraph g) throws DatabaseException { g.markUndoPoint(); - Simantics.applySCL("Simantics/Query", "createSCLQueryDefault", g, parent, selected); + Simantics.applySCL("Simantics/Query", "createSCLQueryDefault", g, parent, selected); //$NON-NLS-1$ //$NON-NLS-2$ } }); }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLClipboard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLClipboard.java index 94db9c596..ca2fde521 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLClipboard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLClipboard.java @@ -55,7 +55,7 @@ public class SCLClipboard { if (element != null) { newSelection.add(element); } else { - throw new DatabaseException("Could not find IElement for " + element); + throw new DatabaseException("Could not find IElement for " + element); //$NON-NLS-1$ } } @@ -107,7 +107,7 @@ public class SCLClipboard { if (element != null) { newSelection.add(element); } else { - throw new DatabaseException("Could not find IElement for " + element); + throw new DatabaseException("Could not find IElement for " + element); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLDiagramTemplate.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLDiagramTemplate.java index b9214110b..b6cdcae22 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLDiagramTemplate.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLDiagramTemplate.java @@ -10,17 +10,17 @@ public class SCLDiagramTemplate { public static Variable templateDiagram(ReadGraph graph, Variable self) throws DatabaseException { Variable selection = ScenegraphLoaderUtils.getVariableSelection(graph, self); - return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagram"); + return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagram"); //$NON-NLS-1$ } public static Variable templateComposite(ReadGraph graph, Variable self) throws DatabaseException { Variable selection = ScenegraphLoaderUtils.getVariableSelection(graph, self); - return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagramComposite"); + return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagramComposite"); //$NON-NLS-1$ } public static Variable templateModel(ReadGraph graph, Variable self) throws DatabaseException { Variable selection = ScenegraphLoaderUtils.getVariableSelection(graph, self); - return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "model"); + return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "model"); //$NON-NLS-1$ } } \ No newline at end of file diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java index aada046df..1c5dea754 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java @@ -21,6 +21,7 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; @@ -28,6 +29,7 @@ import org.eclipse.jface.viewers.ICheckStateProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.simantics.Simantics; @@ -124,9 +126,9 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { @Override public String toString() { - return getClass().getSimpleName() + "[name=" + name - + ", originally selected=" + originallySelected - + ", selected=" + selected + "]"; + return getClass().getSimpleName() + "[name=" + name //$NON-NLS-1$ + + ", originally selected=" + originallySelected //$NON-NLS-1$ + + ", selected=" + selected + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -260,19 +262,16 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { final Resource model = getCommonModel(symbols); if (model == null) { - ShowMessage.showInformation("Same Model Required", "All the selected symbols must be from within the same model."); + ShowMessage.showInformation(Messages.AssignSymbolGroup_SameModelRequired, Messages.AssignSymbolGroup_SameModelRequiredMsg); return; } final AtomicReference groups = new AtomicReference( getSymbolGroups(symbols) ); - StringBuilder message = new StringBuilder(); - message.append("Select symbol groups the selected "); - if (symbols.size() > 1) - message.append(symbols.size()).append(" symbols are shown in."); - else - message.append("symbol is shown in."); + String message = symbols.size() > 1 + ? NLS.bind(Messages.AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn, symbols.size()) + : Messages.AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn; AssignSymbolGroupsDialog dialog = new AssignSymbolGroupsDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), @@ -326,7 +325,7 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { } } }; - dialog.setTitle("Symbol Group Assignments"); + dialog.setTitle(Messages.AssignSymbolGroup_SymbolGroupAssignments); dialog.setInitialSelections(selectedElements(groups.get())); if (dialog.open() == Dialog.OK) { final ArrayList added = new ArrayList(); @@ -351,18 +350,18 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { private static SymbolGroup newSymbolGroup(Shell shell, Resource model, final SymbolGroup[] oldGroups) { InputDialog dialog = new InputDialog(shell, - "New Symbol Group", - "Write the name of the new symbol group.", - "NewSymbolGroup", + Messages.AssignSymbolGroup_NewSymbolGroup, + Messages.AssignSymbolGroup_WriteSymbolGroupName, + "NewSymbolGroup", //$NON-NLS-1$ new IInputValidator() { @Override public String isValid(String newText) { newText = newText.trim(); if (newText.isEmpty()) - return "The name must be non-empty."; + return Messages.AssignSymbolGroup_NameMustNotBeEmpty; for (SymbolGroup g : oldGroups) if (newText.equals(g.name)) - return "A symbol group with that name already exists."; + return Messages.AssignSymbolGroup_GroupSymbolAlreadyExists; return null; } } @@ -388,11 +387,11 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { return false; String message; if (groups.length == 1) - message = "Are you sure you want to remove symbol group '" + groups[0].name + "' ?"; + message = NLS.bind(Messages.AssignSymbolGroup_AreYouSureToRemoveSymbolGroup, groups[0].name ); else - message = "Are you sure you want to remove " + groups.length + " symbol groups?"; + message = NLS.bind(Messages.AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1, groups.length ); MessageDialog dialog = - new MessageDialog(shell, "Confirm removal", null, message, MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); + new MessageDialog(shell, Messages.AssignSymbolGroup_ConfirmRemoval, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL , IDialogConstants.CANCEL_LABEL }, 0); if (dialog.open() == Dialog.OK) { Simantics.getSession().asyncRequest(new WriteRequest() { @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsDialog.java index 68ac2a7a0..b768a05ab 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsDialog.java @@ -38,9 +38,9 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog { private static final String DIALOG = "AssignSymbolGroupsDialog"; //$NON-NLS-1$ - static String SELECT_ALL_TITLE = WorkbenchMessages.SelectionDialog_selectLabel; + static String SELECT_ALL_TITLE = ""; //$NON-NLS-1$ - static String DESELECT_ALL_TITLE = WorkbenchMessages.SelectionDialog_deselectLabel; + static String DESELECT_ALL_TITLE = ""; //$NON-NLS-1$ // the root element to populate the viewer with protected Object inputElement; @@ -78,7 +78,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog { ICheckStateProvider checkStateProvider, String message) { super(parentShell); - setTitle(WorkbenchMessages.ListSelection_title); + setTitle(""); //$NON-NLS-1$ inputElement = input; this.contentProvider = contentProvider; this.labelProvider = labelProvider; @@ -86,7 +86,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog { if (message != null) { setMessage(message); } else { - setMessage(WorkbenchMessages.ListSelection_message); + setMessage(""); //$NON-NLS-1$ } IDialogSettings settings = Activator.getDefault().getDialogSettings(); @@ -139,7 +139,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog { Label label = new Label(buttonComposite, SWT.NONE); Button newButton = createButton(buttonComposite, - IDialogConstants.INTERNAL_ID-1, "&New...", false); + IDialogConstants.INTERNAL_ID-1, org.simantics.modeling.ui.actions.WorkbenchMessages.AssignSymbolGroupsDialog_NewDots, false); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { @@ -149,7 +149,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog { newButton.addSelectionListener(listener); Button removeButton = createButton(buttonComposite, - IDialogConstants.INTERNAL_ID-2, "&Remove", false); + IDialogConstants.INTERNAL_ID-2, org.simantics.modeling.ui.actions.WorkbenchMessages.AssignSymbolGroupsDialog_RemoveAnd, false); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CompilePGraphsAction.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CompilePGraphsAction.java index 0c93e6c20..651f4f66b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CompilePGraphsAction.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CompilePGraphsAction.java @@ -33,7 +33,7 @@ public class CompilePGraphsAction implements ActionFactory { if (!(target instanceof Resource)) return null; return () -> { - Job job = new Job("Compile PGraphs") { + Job job = new Job(Messages.CompilePGraphsAction_CompilePGraphs) { @Override protected IStatus run(IProgressMonitor monitor) { try { @@ -59,9 +59,9 @@ public class CompilePGraphsAction implements ActionFactory { class ErrorMessageDialog extends MessageDialog { public ErrorMessageDialog(Shell shell) { super(shell, - "Problems in the Ontology Definition File", null, - "The following issues were found:", - MessageDialog.ERROR, new String[] { "Continue" }, 0); + Messages.CompilePGraphsAction_ProblemsinOntologyDefinitionFile, null, + Messages.CompilePGraphsAction_FollowingIssuesFound, + MessageDialog.ERROR, new String[] { Messages.CompilePGraphsAction_Continue }, 0); } @Override @@ -71,9 +71,9 @@ public class CompilePGraphsAction implements ActionFactory { org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.fillDefaults().grab(true, true).applyTo(list); for (Problem problem : result.getErrors()) - list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); + list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ for (Problem problem : result.getWarnings()) - list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); + list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ return composite; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ConfigureConnectionTypes.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ConfigureConnectionTypes.java index 6f57f86d6..e392419c9 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ConfigureConnectionTypes.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ConfigureConnectionTypes.java @@ -112,9 +112,9 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 { @Override public String toString() { - return getClass().getSimpleName() + "[name=" + name - + ", originally selected=" + originallySelected - + ", selected=" + selected + "]"; + return getClass().getSimpleName() + "[name=" + name //$NON-NLS-1$ + + ", originally selected=" + originallySelected //$NON-NLS-1$ + + ", selected=" + selected + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -249,7 +249,7 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 { final Resource indexRoot = getCommonModel(connectionPoints); if (indexRoot == null) { - ShowMessage.showInformation("Same Model Required", "All the selected connection points must be from within the same index root."); + ShowMessage.showInformation(Messages.ConfigureConnectionTypes_SameModelRequired, Messages.ConfigureConnectionTypes_SameModelRequiredMsg); return; } @@ -258,9 +258,9 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 { StringBuilder message = new StringBuilder(); if (connectionPoints.size() > 1) - message.append("Select connection types for the selected connection points"); + message.append(Messages.ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoints); else - message.append("Select connection types for the selected connection point"); + message.append(Messages.ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoint); ConfigureConnectionTypesDialog dialog = new ConfigureConnectionTypesDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), @@ -281,7 +281,7 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 { } }; - dialog.setTitle("Connection Type Assignments"); + dialog.setTitle(Messages.ConfigureConnectionTypes_ConnectionTypeAssignments); dialog.setInitialSelections(selectedElements(types.get())); if (dialog.open() == Dialog.OK) { final ArrayList added = new ArrayList(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Copy.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Copy.java index 407e1ec69..fc37abbf9 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Copy.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Copy.java @@ -31,7 +31,7 @@ public class Copy implements ActionFactory, ActionFactory2 { resources.add((Resource)o); } return () -> { - Job job = new Job("Copy") { + Job job = new Job(Messages.Copy_Copy) { @Override protected IStatus run(IProgressMonitor monitor) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateEllipse.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateEllipse.java index 6b9431abc..27b55a06b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateEllipse.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateEllipse.java @@ -19,10 +19,10 @@ public class CreateEllipse extends CreateShapeHandler { @Override public String getDefaultElementData() { final String data = - "" + - "" + - ""+ - ""; + "" + //$NON-NLS-1$ + "" + //$NON-NLS-1$ + ""+ //$NON-NLS-1$ + ""; //$NON-NLS-1$ return data; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreatePath.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreatePath.java index 83cada7de..8fbda8dc5 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreatePath.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreatePath.java @@ -19,10 +19,10 @@ public class CreatePath extends CreateShapeHandler { @Override public String getDefaultElementData() { final String data = - "" + - "" + - ""+ - ""; + "" + //$NON-NLS-1$ + "" + //$NON-NLS-1$ + ""+ //$NON-NLS-1$ + ""; //$NON-NLS-1$ return data; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateRectangle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateRectangle.java index fccc8ed80..781e17c7f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateRectangle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateRectangle.java @@ -19,10 +19,10 @@ public class CreateRectangle extends CreateShapeHandler { @Override public String getDefaultElementData() { final String data = - "" + - "" + - ""+ - ""; + "" + //$NON-NLS-1$ + "" + //$NON-NLS-1$ + ""+ //$NON-NLS-1$ + ""; //$NON-NLS-1$ return data; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java index b7803a77b..aeaa212c1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java @@ -87,9 +87,9 @@ public abstract class CreateShapeHandler extends AbstractHandler { } }); - IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); + IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); //$NON-NLS-1$ if (eps.length == 0) { - System.out.println("symbol editor part not found from multi page editor part: " + ap); + System.out.println("symbol editor part not found from multi page editor part: " + ap); //$NON-NLS-1$ return null; } viewer = eps[0]; @@ -104,12 +104,12 @@ public abstract class CreateShapeHandler extends AbstractHandler { } ICanvasContext ctx = (ICanvasContext) viewer.getAdapter(ICanvasContext.class); if (ctx == null) { - System.out.println("No canvas context"); + System.out.println("No canvas context"); //$NON-NLS-1$ return null; } MouseInfo minfo = ctx.getSingleItem(MouseUtil.class).getMousePressedInfo(0); if(minfo == null) { - System.out.println("No mouse info"); + System.out.println("No mouse info"); //$NON-NLS-1$ return null; } final Point2D mpos = minfo.canvasPosition; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateText.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateText.java index 8cd899bb8..ce053c883 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateText.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateText.java @@ -19,10 +19,10 @@ public class CreateText extends CreateShapeHandler { @Override public String getDefaultElementData() { final String data = - "" + - "" + - "Text" + - ""; + "" + //$NON-NLS-1$ + "" + //$NON-NLS-1$ + "Text" + //$NON-NLS-1$ + ""; //$NON-NLS-1$ return data; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/DuplicatePinnedViewHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/DuplicatePinnedViewHandler.java index e50233f39..51aec07c6 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/DuplicatePinnedViewHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/DuplicatePinnedViewHandler.java @@ -32,7 +32,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; */ public class DuplicatePinnedViewHandler extends AbstractHandler { - private static final String PIN_SELECTION_COMMAND = "org.simantics.modeling.ui.pinSelection"; + private static final String PIN_SELECTION_COMMAND = "org.simantics.modeling.ui.pinSelection"; //$NON-NLS-1$ @Override public Object execute(ExecutionEvent event) throws ExecutionException { @@ -48,7 +48,7 @@ public class DuplicatePinnedViewHandler extends AbstractHandler { // with a property page just like the original. ISelection originalSelection = originalPropertyView.getLastSelection(); - final String id = originalPart.getSite().getId() + "Pinned:" + UUID.randomUUID().toString(); + final String id = originalPart.getSite().getId() + "Pinned:" + UUID.randomUUID().toString(); //$NON-NLS-1$ PropertyPageView newPart = (PropertyPageView) WorkbenchUtils.activateView(id); newPart.partActivated(originalPart); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExpandFlagsHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExpandFlagsHandler.java index c5f3daea6..398ef5dc4 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExpandFlagsHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExpandFlagsHandler.java @@ -22,7 +22,7 @@ public class ExpandFlagsHandler extends FlagOperationHandler { @Override protected void perform(IProgressMonitor monitor, WriteGraph graph, List flags, ICanvasContext canvasContext) throws DatabaseException { - monitor.beginTask("Expand Flags", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.ExpandFlagsHandler_MonitorExpandFlags, IProgressMonitor.UNKNOWN); Set newSelection = new HashSet(); for (Resource flag : flags) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExplorerDynamicMenuContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExplorerDynamicMenuContribution.java index 03512a9c4..35e3fb14e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExplorerDynamicMenuContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExplorerDynamicMenuContribution.java @@ -62,7 +62,7 @@ abstract public class ExplorerDynamicMenuContribution extends DynamicMenuCont } protected ImageDescriptor silk(String name) { - return BundleUtils.getImageDescriptorFromBundle(Platform.getBundle("com.famfamfam.silk"), "/icons/" + name); + return BundleUtils.getImageDescriptorFromBundle(Platform.getBundle("com.famfamfam.silk"), "/icons/" + name); //$NON-NLS-1$ //$NON-NLS-2$ } abstract protected T computeInput(ReadGraph graph, Object[] selection) throws DatabaseException; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java index ed41bc132..6f6338f55 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java @@ -70,9 +70,9 @@ public class ImportSVG extends AbstractHandler { } }); - IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); + IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); //$NON-NLS-1$ if (eps.length == 0) { - System.out.println("symbol editor part not found from multi page editor part: " + ap); + System.out.println("symbol editor part not found from multi page editor part: " + ap); //$NON-NLS-1$ return null; } viewer = eps[0]; @@ -85,12 +85,12 @@ public class ImportSVG extends AbstractHandler { } ICanvasContext ctx = (ICanvasContext) viewer.getAdapter(ICanvasContext.class); if (ctx == null) { - System.out.println("No canvas context"); + System.out.println("No canvas context"); //$NON-NLS-1$ return null; } MouseInfo minfo = ctx.getSingleItem(MouseUtil.class).getMousePressedInfo(0); if(minfo == null) { - System.out.println("No mouse info"); + System.out.println("No mouse info"); //$NON-NLS-1$ return null; } final Point2D mpos = minfo.canvasPosition; @@ -105,8 +105,8 @@ public class ImportSVG extends AbstractHandler { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); FileDialog dialog = new FileDialog(shell); - dialog.setText("Choose an image to be imported"); - dialog.setFilterExtensions(new String[] {"*.svg", "*.png"}); + dialog.setText(Messages.ImportSVG_ChooseImportImage); + dialog.setFilterExtensions(new String[] {"*.svg", "*.png"}); //$NON-NLS-1$ //$NON-NLS-2$ final String filename = dialog.open(); if(filename == null) @@ -120,7 +120,7 @@ public class ImportSVG extends AbstractHandler { @Override public void perform(WriteGraph g) throws DatabaseException { - Commands.get(g, "Simantics/Diagram/createSVGElement") + Commands.get(g, "Simantics/Diagram/createSVGElement") //$NON-NLS-1$ .execute(g, g.syncRequest(new IndexRoot(composite)), composite, suffix(filename), data, mposX, mposY); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsAction.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsAction.java index 15d0ed086..ea0a40593 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsAction.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsAction.java @@ -43,7 +43,7 @@ public class MergeFlagsAction implements ActionFactory { IRunnableWithProgress runnable = new IRunnableWithProgress() { @Override public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - final SubMonitor submonitor = SubMonitor.convert(monitor, "Merge Flags", 1000); + final SubMonitor submonitor = SubMonitor.convert(monitor, Messages.MergeFlagsAction_MonitorMergeFlags, 1000); try { Simantics.getSession().sync(new WriteRequest() { @Override @@ -51,14 +51,14 @@ public class MergeFlagsAction implements ActionFactory { graph.markUndoPoint(); SubMonitor expand = submonitor.newChild(10); - expand.subTask("Expand Composite Set"); + expand.subTask(Messages.MergeFlagsAction_ExpandCompositeSet); MergeFlags.expandCompositeSet(graph, composites); if (monitor.isCanceled()) throw new CancelTransactionException(); expand.done(); SubMonitor collect = submonitor.newChild(490); - collect.subTask("Collect flags"); + collect.subTask(Messages.MergeFlagsAction_CollectFlag); collect.setWorkRemaining(composites.size()); ArrayList> groups = new ArrayList>(); for(Resource composite : composites) { @@ -70,7 +70,7 @@ public class MergeFlagsAction implements ActionFactory { collect.done(); SubMonitor merge = submonitor.newChild(500); - merge.subTask("Merge collected flags"); + merge.subTask(Messages.MergeFlagsAction_MonitorMergeCollectedFlags); merge.setWorkRemaining(composites.size()); for(ArrayList group : groups) { MergeFlags.merge(graph, group); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsHandler.java index 9a7b1055c..3671fa9bb 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsHandler.java @@ -22,7 +22,7 @@ public class MergeFlagsHandler extends FlagOperationHandler { private static final Logger LOGGER = LoggerFactory.getLogger(MergeFlagsHandler.class); protected void perform(IProgressMonitor monitor, WriteGraph graph, List flags, ICanvasContext canvasContext) throws DatabaseException { - monitor.beginTask("Merge Selected Flags", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.MergeFlagsHandler_MonitorMergeSelectedFlags, IProgressMonitor.UNKNOWN); performMerge(graph, flags, canvasContext); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeRelatedFlagsHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeRelatedFlagsHandler.java index b3d489626..773a3b0b0 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeRelatedFlagsHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeRelatedFlagsHandler.java @@ -18,7 +18,7 @@ public class MergeRelatedFlagsHandler extends FlagOperationHandler { @Override protected void perform(IProgressMonitor monitor, WriteGraph graph, List flags, ICanvasContext canvasContext) throws DatabaseException { - monitor.beginTask("Merge Related Flags", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.MergeRelatedFlagsHandler_MonitorMergeRelatedFlags, IProgressMonitor.UNKNOWN); MergeFlags.expandFlagSet(graph, flags); MergeFlagsHandler.performMerge(graph, flags, canvasContext); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java new file mode 100644 index 000000000..2039c105b --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java @@ -0,0 +1,55 @@ +package org.simantics.modeling.ui.actions; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.messages"; //$NON-NLS-1$ + public static String AssignSymbolGroup_AreYouSureToRemoveSymbolGroup; + public static String AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1; + public static String AssignSymbolGroup_ConfirmRemoval; + public static String AssignSymbolGroup_GroupSymbolAlreadyExists; + public static String AssignSymbolGroup_NameMustNotBeEmpty; + public static String AssignSymbolGroup_NewSymbolGroup; + public static String AssignSymbolGroup_SameModelRequired; + public static String AssignSymbolGroup_SameModelRequiredMsg; + public static String AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn; + public static String AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn; + public static String AssignSymbolGroup_SymbolGroupAssignments; + public static String AssignSymbolGroup_WriteSymbolGroupName; + public static String CompilePGraphsAction_CompilePGraphs; + public static String CompilePGraphsAction_Continue; + public static String CompilePGraphsAction_FollowingIssuesFound; + public static String CompilePGraphsAction_ProblemsinOntologyDefinitionFile; + public static String ConfigureConnectionTypes_ConnectionTypeAssignments; + public static String ConfigureConnectionTypes_SameModelRequired; + public static String ConfigureConnectionTypes_SameModelRequiredMsg; + public static String ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoint; + public static String ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoints; + public static String Copy_Copy; + public static String ExpandFlagsHandler_MonitorExpandFlags; + public static String ImportSVG_ChooseImportImage; + public static String MergeFlagsAction_CollectFlag; + public static String MergeFlagsAction_ExpandCompositeSet; + public static String MergeFlagsAction_MonitorMergeCollectedFlags; + public static String MergeFlagsAction_MonitorMergeFlags; + public static String MergeFlagsHandler_MonitorMergeSelectedFlags; + public static String MergeRelatedFlagsHandler_MonitorMergeRelatedFlags; + public static String ModeledActions_ActivatorInvalidContributionsEncounteredIn; + public static String NewComponentTypeAction_ActivatorFailedToCreateNewUserComponent; + public static String NewComponentTypeAction_NewUserComponent; + public static String NewConnectionPoint_SelectConnectionPointType; + public static String NewLibrary_Library; + public static String NewProceduralComponentType_ActivatorFailedToCreateNewUserComponent; + public static String NewProceduralComponentType_NewUserComponent; + public static String NewSubscription_Subscription; + public static String RenameDiagramComponents_ActivatorRenameDiaActionFailed; + public static String SetInitialState_SetInitialState; + public static String SwitchComponentTypeContribution_AlternativeTypes; + 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/actions/ModeledActions.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java index 478d8b761..e189d752d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java @@ -33,6 +33,7 @@ import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; +import org.eclipse.osgi.util.NLS; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.common.NodeContextBuilder; import org.simantics.browsing.ui.model.InvalidContribution; @@ -45,7 +46,6 @@ import org.simantics.issues.common.IssueUtils; import org.simantics.modeling.ui.Activator; import org.simantics.project.ontology.ProjectResource; import org.simantics.ui.contribution.DynamicMenuContribution; -import org.simantics.ui.selection.WorkbenchSelectionElement; import org.simantics.ui.selection.WorkbenchSelectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -81,12 +81,12 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { if(data instanceof String) { String str = (String)data; - String[] parms = str.split(";"); + String[] parms = str.split(";"); //$NON-NLS-1$ for(String parm : parms) { - String[] keyValue = parm.split("="); + String[] keyValue = parm.split("="); //$NON-NLS-1$ if(keyValue.length == 2) { String key = keyValue[0].trim(); - if("context".equals(key)) { + if("context".equals(key)) { //$NON-NLS-1$ browseContexts = Collections.singleton(keyValue[1]); } } @@ -126,7 +126,7 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab result.add(NodeContextBuilder.buildWithInput(res)); } } catch (DatabaseException e) { - LOGGER.error("Failed to get node contexts for selection.", e); + LOGGER.error("Failed to get node contexts for selection.", e); //$NON-NLS-1$ } } @@ -160,7 +160,7 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab if (first) first = false; else - items.add(new Separator(category == null ? "" : category.getLabel())); + items.add(new Separator(category == null ? "" : category.getLabel())); //$NON-NLS-1$ for (Action action : actions) items.add(new ActionContributionItem(action)); } @@ -176,10 +176,8 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab } @Override - protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection) - throws DatabaseException - { - List contexts = Arrays.asList( (NodeContext[]) selection ); + protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection) throws DatabaseException { + List contexts = Arrays.asList((NodeContext[]) selection); if (contexts.isEmpty()) return NONE; @@ -200,24 +198,26 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab result = new HashMap<>(); - for(Map.Entry> entry : m.entrySet()) { + for (Map.Entry> entry : m.entrySet()) { List exist = current.get(entry.getKey()); if (exist == null) continue; ArrayList l = new ArrayList(); - for(Action e : exist) { + for (Action e : exist) { String id = e.getId(); boolean found = false; - for(Action a : entry.getValue()) { - if(id.equals(a.getId())) { + for (Action a : entry.getValue()) { + if (id.equals(a.getId())) { found = true; break; } } - if(found) l.add(e); + if (found) + l.add(e); } - if(!l.isEmpty()) result.put(entry.getKey(), l); + if (!l.isEmpty()) + result.put(entry.getKey(), l); } current = result; @@ -228,7 +228,9 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab } catch (InvalidContribution e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Invalid contribution encountered in " + getClass().getSimpleName() + ".", e)); + NLS.bind(Messages.ModeledActions_ActivatorInvalidContributionsEncounteredIn, + getClass().getSimpleName()), + e)); } return NONE; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledDoubleClickActions.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledDoubleClickActions.java index 5f3d55ff0..c420904b4 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledDoubleClickActions.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledDoubleClickActions.java @@ -48,12 +48,12 @@ public class ModeledDoubleClickActions implements IDoubleClickAction, IExecutabl public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { if(data instanceof String) { String str = (String)data; - String[] parms = str.split(";"); + String[] parms = str.split(";"); //$NON-NLS-1$ for(String parm : parms) { - String[] keyValue = parm.split("="); + String[] keyValue = parm.split("="); //$NON-NLS-1$ if(keyValue.length == 2) { String key = keyValue[0].trim(); - if("context".equals(key)) { + if("context".equals(key)) { //$NON-NLS-1$ browseContexts = Collections.singleton(keyValue[1]); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java index fafaa7e51..a07fe933a 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java @@ -35,7 +35,7 @@ public class NewComponentTypeAction implements ActionFactory { return new Runnable() { @Override public void run() { - Job job = new DatabaseJob("New User Component") { + Job job = new DatabaseJob(Messages.NewComponentTypeAction_NewUserComponent) { @Override protected IStatus run(IProgressMonitor monitor) { try { @@ -48,7 +48,7 @@ public class NewComponentTypeAction implements ActionFactory { }); return Status.OK_STATUS; } catch (DatabaseException e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to create new user component.", e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewComponentTypeAction_ActivatorFailedToCreateNewUserComponent, e); } } }; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewConnectionPoint.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewConnectionPoint.java index d73adc421..2d6074ec8 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewConnectionPoint.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewConnectionPoint.java @@ -91,7 +91,7 @@ public class NewConnectionPoint implements ActionFactory { name = sb.toString(); } else { // domains.size() == 1 - name = NameUtils.getSafeName(graph, _res) + " (" + graph.getURI(domains.iterator().next()) + ")"; + name = NameUtils.getSafeName(graph, _res) + " (" + graph.getURI(domains.iterator().next()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } map.put(_res, new Pair(name, null)); @@ -116,12 +116,12 @@ public class NewConnectionPoint implements ActionFactory { } String createConnectionPointComment(ReadGraph graph, Resource target, Resource[] cps) throws DatabaseException { StringBuilder result = new StringBuilder(); - result.append("Created connection point"); + result.append("Created connection point"); //$NON-NLS-1$ if (cps.length > 1) result.append('s'); - result.append(" for ") + result.append(" for ") //$NON-NLS-1$ .append(NameUtils.getSafeName(graph, componentType)) - .append(":\n"); + .append(":\n"); //$NON-NLS-1$ for (int i = 0; i < cps.length; ++i) { result.append('\t'); result.append(NameUtils.getSafeName(graph, cps[i])); @@ -162,7 +162,7 @@ public class NewConnectionPoint implements ActionFactory { private Resource[] queryCps(Map> map) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - ResourceSelectionDialog3 dialog = new ResourceSelectionDialog3(shell, map, "Select connection point type") { + ResourceSelectionDialog3 dialog = new ResourceSelectionDialog3(shell, map, Messages.NewConnectionPoint_SelectConnectionPointType) { @Override protected IDialogSettings getBaseDialogSettings() { return Activator.getDefault().getDialogSettings(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java index 0efcc5b8c..37a733a96 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java @@ -29,7 +29,7 @@ public class NewDocument implements ActionFactory { Layer0 L0 = Layer0.getInstance(graph); DocumentResource DOC = DocumentResource.getInstance(graph); - String name = NameUtils.findFreshEscapedName(graph, "Document", model, L0.ConsistsOf); + String name = NameUtils.findFreshEscapedName(graph, "Document", model, L0.ConsistsOf); //$NON-NLS-1$ // Create DOC.WikiDocument instance Resource wikiDocument = graph.newResource(); @@ -41,13 +41,13 @@ public class NewDocument implements ActionFactory { Resource documentType = graph.getSingleObject(DOC.WikiDocument_WikiDocumentBinding, DOC.DocumentTypeBinding_HasDocumentType); Resource document = graph.newResource(); graph.claim(document, L0.InstanceOf, null, DOC.ScenegraphDocument); - graph.claimLiteral(document, L0.HasName, "Documentation"); + graph.claimLiteral(document, L0.HasName, "Documentation"); //$NON-NLS-1$ graph.claim(wikiDocument, DOC.HasDocumentation, document); graph.claim(document, L0.PartOf, wikiDocument); Resource scenegraph = graph.newResource(); graph.claim(scenegraph, L0.InstanceOf, null, documentType); - graph.claimLiteral(scenegraph, L0.HasName, "Scenegraph"); + graph.claimLiteral(scenegraph, L0.HasName, "Scenegraph"); //$NON-NLS-1$ graph.claim(scenegraph, L0.PartOf, document); graph.claim(document, DOC.ScenegraphDocument_scenegraph, scenegraph); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java index d6205ea5f..c999b98d8 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java @@ -39,12 +39,12 @@ public class NewLibrary implements ActionFactory { Layer0 l0 = Layer0.getInstance(graph); Resource library = graph.newResource(); - String name = NameUtils.findFreshName(graph, "Library", parent, l0.ConsistsOf); + String name = NameUtils.findFreshName(graph, Messages.NewLibrary_Library, parent, l0.ConsistsOf); graph.claim(library, l0.InstanceOf, null, l0.Library); graph.addLiteral(library, l0.HasName, l0.NameOf, l0.String, name, Bindings.STRING); graph.claim(library, l0.PartOf, parent); - Layer0Utils.addCommentMetadata(graph, "Created new Library named " + name + ", resource " + library); + Layer0Utils.addCommentMetadata(graph, "Created new Library named " + name + ", resource " + library); //$NON-NLS-1$ //$NON-NLS-2$ return library; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewProceduralComponentType.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewProceduralComponentType.java index daa21c384..316927549 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewProceduralComponentType.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewProceduralComponentType.java @@ -63,8 +63,8 @@ public class NewProceduralComponentType implements ActionFactory { // Name String defaultName = graph.getRelatedValue(indexRoot, MOD.StructuralModel_HasDefaultComponentTypeName, Bindings.STRING); String name = NameUtils.findFreshName(graph, defaultName, library); - graph.claimLiteral(componentType, L0.HasName, name + "@1"); - graph.claimLiteral(componentType, L0X.HasGeneratedNamePrefix, ""); + graph.claimLiteral(componentType, L0.HasName, name + "@1"); //$NON-NLS-1$ + graph.claimLiteral(componentType, L0X.HasGeneratedNamePrefix, ""); //$NON-NLS-1$ // Substructure // Resource substructureType = graph.getSingleObject(indexRoot, MOD.StructuralModel_HasComponentTypeSubstructureType); @@ -83,13 +83,13 @@ public class NewProceduralComponentType implements ActionFactory { // } graph.addLiteral(componentType, STR.ProceduralComponentType_code, STR.ProceduralComponentType_code_Inverse, - STR.ProceduralComponentTypeCode, "[]", Bindings.STRING); + STR.ProceduralComponentTypeCode, "[]", Bindings.STRING); //$NON-NLS-1$ Resource symbolDiagramType = graph.getPossibleObject(indexRoot, MOD.StructuralModel_HasSymbolDiagramType); if(symbolDiagramType == null) symbolDiagramType = DIA.Composite; // Symbol - Resource symbol = new ModelingUtils(graph).createSymbol2("Symbol", symbolDiagramType); + Resource symbol = new ModelingUtils(graph).createSymbol2("Symbol", symbolDiagramType); //$NON-NLS-1$ graph.claim(componentType, MOD.ComponentTypeToSymbol, symbol); graph.claim(componentType, L0.ConsistsOf, symbol); @@ -107,7 +107,7 @@ public class NewProceduralComponentType implements ActionFactory { return new Runnable() { @Override public void run() { - Job job = new DatabaseJob("New User Component") { + Job job = new DatabaseJob(Messages.NewProceduralComponentType_NewUserComponent) { @Override protected IStatus run(IProgressMonitor monitor) { try { @@ -116,12 +116,12 @@ public class NewProceduralComponentType implements ActionFactory { public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); Resource r = NewProceduralComponentType.create(graph, library); - Layer0Utils.addCommentMetadata(graph, "Created new Procedural Component Type " + graph.getPossibleRelatedValue2(r, Layer0.getInstance(graph).HasName, Bindings.STRING)); + Layer0Utils.addCommentMetadata(graph, "Created new Procedural Component Type " + graph.getPossibleRelatedValue2(r, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$ } }); return Status.OK_STATUS; } catch (DatabaseException e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to create new user component.", e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewProceduralComponentType_ActivatorFailedToCreateNewUserComponent, e); } } }; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java index 2e8a8fcb8..f7bfdf0e2 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java @@ -35,7 +35,7 @@ public class NewSubscription implements ActionFactory { Layer0 l0 = Layer0.getInstance(g); ModelingResources wr = ModelingResources.getInstance(g); - String freshLabel = NameUtils.findFreshLabel(g, "Subscription", model); + String freshLabel = NameUtils.findFreshLabel(g, Messages.NewSubscription_Subscription, model); @SuppressWarnings("unused") Resource subscription = GraphUtils.create2(g, wr.Subscription, l0.HasName, UUID.randomUUID().toString(), @@ -43,7 +43,7 @@ public class NewSubscription implements ActionFactory { l0.PartOf, model); CommentMetadata cm = g.getMetadata(CommentMetadata.class); - g.addMetadata(cm.add("Created subscription folder " + freshLabel)); + g.addMetadata(cm.add("Created subscription folder " + freshLabel)); //$NON-NLS-1$ } }); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java index 75bde3178..0c8b2573e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java @@ -51,7 +51,7 @@ public class RenameDiagramComponents implements ActionFactory { }); } } catch (DatabaseException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "RenameDiagramComponents action failed, see exception for details", e)); + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.RenameDiagramComponents_ActivatorRenameDiaActionFailed, e)); } } }; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SetInitialState.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SetInitialState.java index bc0b5cbe0..93f69e257 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SetInitialState.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SetInitialState.java @@ -121,7 +121,7 @@ public class SetInitialState extends DynamicMenuContribution { @Override public void fill(Menu menu, int index) { MenuItem setInitialState = new MenuItem(menu, SWT.CASCADE, index); - setInitialState.setText("Set Initial State"); + setInitialState.setText(Messages.SetInitialState_SetInitialState); Menu subMenu = new Menu(menu); setInitialState.setMenu(subMenu); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SwitchComponentTypeContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SwitchComponentTypeContribution.java index 193334e0b..d8115f53e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SwitchComponentTypeContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SwitchComponentTypeContribution.java @@ -86,7 +86,7 @@ public class SwitchComponentTypeContribution extends ContributionItem { try { groups = Simantics.getSession().syncRequest(new ComponentSwitchGroupQuery(resource)); } catch (DatabaseException e) { - LOGGER.error("Retrieval of switch groups failed.", e); + LOGGER.error("Retrieval of switch groups failed.", e); //$NON-NLS-1$ return; } @@ -160,7 +160,7 @@ public class SwitchComponentTypeContribution extends ContributionItem { if(label == null) { label = graph.getPossibleRelatedValue(group, L0.HasName); if(label == null) - label = "Alternative types"; + label = Messages.SwitchComponentTypeContribution_AlternativeTypes; } groupObj = new SwitchGroup(label); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java new file mode 100644 index 000000000..36ed5b8fb --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java @@ -0,0 +1,16 @@ +package org.simantics.modeling.ui.actions; + +import org.eclipse.osgi.util.NLS; + +public class WorkbenchMessages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.messages"; //$NON-NLS-1$ + public static String AssignSymbolGroupsDialog_NewDots; + public static String AssignSymbolGroupsDialog_RemoveAnd; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, WorkbenchMessages.class); + } + + private WorkbenchMessages() { + } +} diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/GlobalModeledToolbarActions.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/GlobalModeledToolbarActions.java index f3ed6365f..a19df0e2d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/GlobalModeledToolbarActions.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/GlobalModeledToolbarActions.java @@ -117,7 +117,7 @@ public class GlobalModeledToolbarActions { public void exception(Throwable t) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Global modeled toolbar contribution listener ran into an unexpected exception.", + Messages.GlobalModeledToolbarActions_ActivatorGlobalModeledToolbarException, t)); } @@ -155,7 +155,7 @@ public class GlobalModeledToolbarActions { } catch (InvalidContribution e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Encountered invalid modeled contribution(s) while loading global modeled toolbar contributions.", + Messages.GlobalModeledToolbarActions_ActivatorEncounteredInvalidContributionException, e)); } @@ -185,7 +185,7 @@ public class GlobalModeledToolbarActions { if (first) first = false; else - items.add(new Separator(category == null ? "" : category.getLabel())); + items.add(new Separator(category == null ? "" : category.getLabel())); //$NON-NLS-1$ for (Action action : actions) items.add(new ActionContributionItem(action)); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java index 84eab0eb7..e21e67455 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java @@ -90,9 +90,9 @@ public class ImportSVGPNG { } }); - IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); + IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); //$NON-NLS-1$ if (eps.length == 0) { - System.out.println("symbol editor part not found from multi page editor part: " + ap); + System.out.println("symbol editor part not found from multi page editor part: " + ap); //$NON-NLS-1$ return; } viewer = eps[0]; @@ -105,12 +105,12 @@ public class ImportSVGPNG { } ICanvasContext ctx = (ICanvasContext) viewer.getAdapter(ICanvasContext.class); if (ctx == null) { - System.out.println("No canvas context"); + System.out.println("No canvas context"); //$NON-NLS-1$ return; } MouseInfo minfo = ctx.getSingleItem(MouseUtil.class).getMousePressedInfo(0); if(minfo == null) { - System.out.println("No mouse info"); + System.out.println("No mouse info"); //$NON-NLS-1$ return; } final Point2D mpos = minfo.canvasPosition; @@ -127,8 +127,8 @@ public class ImportSVGPNG { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); FileDialog dialog = new FileDialog(shell); - dialog.setText("Choose an image to be imported"); - dialog.setFilterExtensions(new String[] {"*.svg", "*.png"}); + dialog.setText(Messages.ImportSVGPNG_ChooseImportImage); + dialog.setFilterExtensions(new String[] {"*.svg", "*.png"}); //$NON-NLS-1$ //$NON-NLS-2$ final String filename = dialog.open(); if(filename == null) @@ -142,7 +142,7 @@ public class ImportSVGPNG { @Override public void perform(WriteGraph g) throws DatabaseException { - Object svg = Commands.get(g, "Simantics/Diagram/createSVGElementR") + Object svg = Commands.get(g, "Simantics/Diagram/createSVGElementR") //$NON-NLS-1$ .execute(g, g.syncRequest(new IndexRoot(composite)), composite, suffix(filename), data, mposX, mposY); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/Messages.java new file mode 100644 index 000000000..443c445d7 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/Messages.java @@ -0,0 +1,17 @@ +package org.simantics.modeling.ui.actions.e4; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.e4.messages"; //$NON-NLS-1$ + public static String GlobalModeledToolbarActions_ActivatorEncounteredInvalidContributionException; + public static String GlobalModeledToolbarActions_ActivatorGlobalModeledToolbarException; + public static String ImportSVGPNG_ChooseImportImage; + 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/actions/e4/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/messages.properties new file mode 100644 index 000000000..2dd0baf73 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/messages.properties @@ -0,0 +1,3 @@ +GlobalModeledToolbarActions_ActivatorEncounteredInvalidContributionException=Encountered invalid modeled contribution(s) while loading global modeled toolbar contributions. +GlobalModeledToolbarActions_ActivatorGlobalModeledToolbarException=Global modeled toolbar contribution listener ran into an unexpected exception. +ImportSVGPNG_ChooseImportImage=Choose an image to be imported diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/messages.properties new file mode 100644 index 000000000..57f9e15cb --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/messages.properties @@ -0,0 +1,43 @@ +AssignSymbolGroup_AreYouSureToRemoveSymbolGroup=Are you sure you want to remove symbol group ''{0}'' ? +AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1=Are you sure you want to remove {0} symbol groups? +AssignSymbolGroup_ConfirmRemoval=Confirm removal +AssignSymbolGroup_GroupSymbolAlreadyExists=A symbol group with that name already exists. +AssignSymbolGroup_NameMustNotBeEmpty=The name must be non-empty. +AssignSymbolGroup_NewSymbolGroup=New Symbol Group +AssignSymbolGroup_SameModelRequired=Same Model Required +AssignSymbolGroup_SameModelRequiredMsg=All the selected symbols must be from within the same model. +AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn=Select symbol groups the selected symbol is shown in. +AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn=Select symbol groups the selected {0} symbols are shown in. +AssignSymbolGroup_SymbolGroupAssignments=Symbol Group Assignments +AssignSymbolGroup_WriteSymbolGroupName=Write the name of the new symbol group. +AssignSymbolGroupsDialog_NewDots=&New... +AssignSymbolGroupsDialog_RemoveAnd=&Remove +CompilePGraphsAction_CompilePGraphs=Compile PGraphs +CompilePGraphsAction_Continue=Continue +CompilePGraphsAction_FollowingIssuesFound=The following issues were found: +CompilePGraphsAction_ProblemsinOntologyDefinitionFile=Problems in the Ontology Definition File +ConfigureConnectionTypes_ConnectionTypeAssignments=Connection Type Assignments +ConfigureConnectionTypes_SameModelRequired=Same Model Required +ConfigureConnectionTypes_SameModelRequiredMsg=All the selected connection points must be from within the same index root. +ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoint=Select connection types for the selected connection point +ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoints=Select connection types for the selected connection points +Copy_Copy=Copy +ExpandFlagsHandler_MonitorExpandFlags=Expand Flags +ImportSVG_ChooseImportImage=Choose an image to be imported +MergeFlagsAction_CollectFlag=Collect flags +MergeFlagsAction_ExpandCompositeSet=Expand Composite Set +MergeFlagsAction_MonitorMergeCollectedFlags=Merge collected flags +MergeFlagsAction_MonitorMergeFlags=Merge Flags +MergeFlagsHandler_MonitorMergeSelectedFlags=Merge Selected Flags +MergeRelatedFlagsHandler_MonitorMergeRelatedFlags=Merge Related Flags +ModeledActions_ActivatorInvalidContributionsEncounteredIn=Invalid contribution encountered in {0} +NewComponentTypeAction_ActivatorFailedToCreateNewUserComponent=Failed to create new user component. +NewComponentTypeAction_NewUserComponent=New User Component +NewConnectionPoint_SelectConnectionPointType=Select connection point type +NewLibrary_Library=Library +NewProceduralComponentType_ActivatorFailedToCreateNewUserComponent=Failed to create new user component. +NewProceduralComponentType_NewUserComponent=New User Component +NewSubscription_Subscription=Subscription +RenameDiagramComponents_ActivatorRenameDiaActionFailed=RenameDiagramComponents action failed, see exception for details +SetInitialState_SetInitialState=Set Initial State +SwitchComponentTypeContribution_AlternativeTypes=Alternative types diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java index 524508919..22a61e2a1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java @@ -16,6 +16,7 @@ import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JTabbedPane; +import org.eclipse.jface.dialogs.IDialogConstants; import org.simantics.utils.strings.format.MetricsFormat; public class AWTStyleDialog extends JDialog { @@ -33,7 +34,7 @@ public class AWTStyleDialog extends JDialog { private boolean useFormat = true; public AWTStyleDialog(Frame owner,boolean useFont, boolean useColor, boolean useFormat) { - super(owner,"Style",true); + super(owner,Messages.AWTStyleDialog_Style,true); this.useFont = useFont; this.useColor = useColor; this.useFormat = useFormat; @@ -42,7 +43,7 @@ public class AWTStyleDialog extends JDialog { public AWTStyleDialog(boolean useFont, boolean useColor, boolean useFormat) { super(); - setTitle("Style"); + setTitle(Messages.AWTStyleDialog_Style); setModal(true); this.useFont = useFont; this.useColor = useColor; @@ -52,41 +53,42 @@ public class AWTStyleDialog extends JDialog { public void setStartFont(Font font) { if (!useFont) - throw new RuntimeException("Dialog is not configured with font support"); + throw new RuntimeException("Dialog is not configured with font support"); //$NON-NLS-1$ fontChooser.setCurrentFont(font); } public void setStartColor(Color color) { if (!useColor) - throw new RuntimeException("Dialog is not configured with color support"); + throw new RuntimeException("Dialog is not configured with color support"); //$NON-NLS-1$ colorChooser.setColor(color); } public void setStartFormat(MetricsFormat format) { if (!useFormat) - throw new RuntimeException("Dialog is not configured with format support"); + throw new RuntimeException("Dialog is not configured with format support"); //$NON-NLS-1$ metricsEditor.setMetricsFormat(format); } private void createContents() { - + JTabbedPane tabbedPane = new JTabbedPane(); - getContentPane().add(tabbedPane,BorderLayout.CENTER); + getContentPane().add(tabbedPane, BorderLayout.CENTER); if (useFont) - tabbedPane.addTab("Font", fontChooser = new FontChooser("Sample text")); + tabbedPane.addTab(Messages.AWTStyleDialog_Font, + fontChooser = new FontChooser(Messages.AWTStyleDialog_SampleText)); if (useColor) - tabbedPane.addTab("Color",colorChooser = new JColorChooser(new Color(0, 0, 0))); + tabbedPane.addTab(Messages.AWTStyleDialog_Color, colorChooser = new JColorChooser(new Color(0, 0, 0))); if (useFormat) - tabbedPane.addTab("Metrics",metricsEditor = new MetricsEditor()); - + tabbedPane.addTab(Messages.AWTStyleDialog_Metrics, metricsEditor = new MetricsEditor()); + JPanel controlPanel = new JPanel(); - getContentPane().add(controlPanel,BorderLayout.SOUTH); + getContentPane().add(controlPanel, BorderLayout.SOUTH); controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - - JButton okButton = new JButton("OK"); + + JButton okButton = new JButton(IDialogConstants.OK_LABEL); controlPanel.add(okButton); okButton.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { cancelled = false; @@ -94,42 +96,41 @@ public class AWTStyleDialog extends JDialog { AWTStyleDialog.this.dispose(); } }); - - JButton cancelButton = new JButton("Cancel"); + + JButton cancelButton = new JButton(IDialogConstants.CANCEL_LABEL); controlPanel.add(cancelButton); cancelButton.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { AWTStyleDialog.this.setVisible(false); AWTStyleDialog.this.dispose(); } }); - - + this.addWindowListener(new WindowListener() { - + @Override public void windowOpened(WindowEvent arg0) {} - + @Override public void windowIconified(WindowEvent arg0) {} - + @Override public void windowDeiconified(WindowEvent arg0) {} - + @Override public void windowDeactivated(WindowEvent arg0) {} - + @Override public void windowClosing(WindowEvent arg0) { if (metricsEditor != null) metricsEditor.dispose(); } - + @Override public void windowClosed(WindowEvent arg0) {} - + @Override public void windowActivated(WindowEvent arg0) {} }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java index 9db3a2401..d3b042e5f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java @@ -52,11 +52,11 @@ import org.simantics.utils.ui.ErrorLogger; */ public class EditStyle { - private static final String SECTION_AWT_STYLE_DIALOG = "AWTStyleDialog"; - private static final String SETTING_DIALOG_HEIGHT = "h"; - private static final String SETTING_DIALOG_WIDTH = "w"; - private static final String SETTING_DIALOG_Y = "y"; - private static final String SETTING_DIALOG_X = "x"; + private static final String SECTION_AWT_STYLE_DIALOG = "AWTStyleDialog"; //$NON-NLS-1$ + private static final String SETTING_DIALOG_HEIGHT = "h"; //$NON-NLS-1$ + private static final String SETTING_DIALOG_WIDTH = "w"; //$NON-NLS-1$ + private static final String SETTING_DIALOG_Y = "y"; //$NON-NLS-1$ + private static final String SETTING_DIALOG_X = "x"; //$NON-NLS-1$ public static void openStyleDialog(final Resource[] resources) { if (resources.length == 0) @@ -125,10 +125,10 @@ public class EditStyle { final boolean useColor = hasColor; final boolean useFormat = hasFormat; - Job job = new Job("Open Style Dialog") { + Job job = new Job(Messages.EditStyle_OpenStyleDialog) { @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Open dialog", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.EditStyle_MonitorOpenDialog, IProgressMonitor.UNKNOWN); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/FontChooser.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/FontChooser.java index 85524e2ed..3580b82b6 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/FontChooser.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/FontChooser.java @@ -27,7 +27,7 @@ public class FontChooser extends JPanel { private static final long serialVersionUID = -53650261362110193L; - private static Font DEFAULT_FONT = new Font("Arial", Font.PLAIN, 16); + private static Font DEFAULT_FONT = new Font(Messages.FontChooser_DefaultFont, Font.PLAIN, 16); private String sampleText; private JLabel text; @@ -59,7 +59,7 @@ public class FontChooser extends JPanel { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] ff = ge.getAvailableFontFamilyNames(); fonts = new String[ff.length + 1]; - fonts[0] = "-- keep current font --"; + fonts[0] = Messages.FontChooser_KeepCurrentFont; System.arraycopy(ff, 0, fonts, 1, ff.length); fontList = new JList(fonts); @@ -102,14 +102,14 @@ public class FontChooser extends JPanel { sizeComboBox = new JComboBox(sizes); sizeComboBox.addActionListener(listener); sizeComboBox.setSelectedIndex(7); - controlPanel.add(new JLabel("Size: ")); + controlPanel.add(new JLabel(Messages.FontChooser_Size)); controlPanel.add(sizeComboBox); - boldCheckBox = new JCheckBox("Bold"); + boldCheckBox = new JCheckBox(Messages.FontChooser_Bold); boldCheckBox.addActionListener(listener); controlPanel.add(boldCheckBox); - italicCheckBox = new JCheckBox("Italic"); + italicCheckBox = new JCheckBox(Messages.FontChooser_Italic); italicCheckBox.addActionListener(listener); controlPanel.add(italicCheckBox); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/Messages.java new file mode 100644 index 000000000..5973ddd08 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/Messages.java @@ -0,0 +1,46 @@ +package org.simantics.modeling.ui.actions.style; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.style.messages"; //$NON-NLS-1$ + public static String AWTStyleDialog_Color; + public static String AWTStyleDialog_Font; + public static String AWTStyleDialog_Metrics; + public static String AWTStyleDialog_SampleText; + public static String AWTStyleDialog_Style; + public static String EditStyle_MonitorOpenDialog; + public static String EditStyle_OpenStyleDialog; + public static String FontChooser_DefaultFont; + public static String FontChooser_Bold; + public static String FontChooser_Italic; + public static String FontChooser_KeepCurrentFont; + public static String FontChooser_Size; + public static String MetricsEditor_AddFormatTemplate; + public static String MetricsEditor_AddFormatTemplateTT; + public static String MetricsEditor_Format; + public static String MetricsEditor_FormatError; + public static String MetricsEditor_FormatName; + public static String MetricsEditor_FormatPattern; + public static String MetricsEditor_FormatPatternNotCorrect; + public static String MetricsEditor_Name; + public static String MetricsEditor_NewFormat; + public static String MetricsEditor_NewFormatField; + public static String MetricsEditor_NewFormatTT; + public static String MetricsEditor_Numbers; + public static String MetricsEditor_RemoveTemplate; + public static String MetricsEditor_RemoveTemplateTT; + public static String MetricsEditor_UpdateTemplate; + public static String MetricsEditor_UpdateTemplateTT; + public static String MetricsEditor_Value; + public static String MetricsEditor_ValuePresentation; + public static String MetricsEditor_ValueTest; + public static String MetricsEditor_ValueTestNotANumber; + 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/actions/style/MetricsEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/MetricsEditor.java index ca9ca5fe1..19dae4057 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/MetricsEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/MetricsEditor.java @@ -21,6 +21,7 @@ import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.TableModel; +import org.eclipse.osgi.util.NLS; import org.simantics.utils.strings.format.MetricsFormat; import org.simantics.utils.strings.format.MetricsFormatList; import org.simantics.utils.strings.format.MetricsFormatListListener; @@ -60,13 +61,13 @@ public class MetricsEditor extends JPanel { panel.add(fieldPanel,BorderLayout.CENTER); - labelPanel.add(new JLabel("Value test:")); + labelPanel.add(new JLabel(Messages.MetricsEditor_ValueTest)); fieldPanel.add(valueTestField); - labelPanel.add(new JLabel("Value presentation:")); + labelPanel.add(new JLabel(Messages.MetricsEditor_ValuePresentation)); fieldPanel.add(valuePresentationField); - labelPanel.add(new JLabel("Format name:")); + labelPanel.add(new JLabel(Messages.MetricsEditor_FormatName)); fieldPanel.add(formatNameField); - labelPanel.add(new JLabel("Format pattern:")); + labelPanel.add(new JLabel(Messages.MetricsEditor_FormatPattern)); fieldPanel.add(formatPatternField); add(panel,BorderLayout.NORTH); @@ -85,8 +86,8 @@ public class MetricsEditor extends JPanel { add(controlPanel,BorderLayout.SOUTH); controlPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); - JButton addTemplateButton = new JButton("Add Format Template"); - addTemplateButton.setToolTipText("Add current format to templates"); + JButton addTemplateButton = new JButton(Messages.MetricsEditor_AddFormatTemplate); + addTemplateButton.setToolTipText(Messages.MetricsEditor_AddFormatTemplateTT); controlPanel.add(addTemplateButton); addTemplateButton.addActionListener(new ActionListener() { @@ -96,8 +97,8 @@ public class MetricsEditor extends JPanel { } }); - JButton removeTemplateButton = new JButton("Remove Template"); - removeTemplateButton.setToolTipText("Remove selected template"); + JButton removeTemplateButton = new JButton(Messages.MetricsEditor_RemoveTemplate); + removeTemplateButton.setToolTipText(Messages.MetricsEditor_RemoveTemplateTT); controlPanel.add(removeTemplateButton); removeTemplateButton.addActionListener(new ActionListener() { @@ -107,8 +108,8 @@ public class MetricsEditor extends JPanel { } }); - JButton updateTemplateButton = new JButton("Update Template"); - updateTemplateButton.setToolTipText("Update selected template using current format"); + JButton updateTemplateButton = new JButton(Messages.MetricsEditor_UpdateTemplate); + updateTemplateButton.setToolTipText(Messages.MetricsEditor_UpdateTemplateTT); controlPanel.add(updateTemplateButton); updateTemplateButton.addActionListener(new ActionListener() { @@ -118,8 +119,8 @@ public class MetricsEditor extends JPanel { } }); - JButton newFormatButton = new JButton("New Format"); - newFormatButton.setToolTipText("Create a new Format"); + JButton newFormatButton = new JButton(Messages.MetricsEditor_NewFormat); + newFormatButton.setToolTipText(Messages.MetricsEditor_NewFormatTT); controlPanel.add(newFormatButton); newFormatButton.addActionListener(new ActionListener() { @@ -144,8 +145,8 @@ public class MetricsEditor extends JPanel { valueTestField.addActionListener(l); formatPatternField.addActionListener(l); - valueTestField.setText("123456.789"); - formatPatternField.setText("%s"); + valueTestField.setText(Messages.MetricsEditor_Numbers); + formatPatternField.setText("%s"); //$NON-NLS-1$ updateValues(); } @@ -189,8 +190,8 @@ public class MetricsEditor extends JPanel { private void newFormat() { format = null; - formatNameField.setText("New format"); - formatPatternField.setText("%s"); + formatNameField.setText(Messages.MetricsEditor_NewFormatField); + formatPatternField.setText("%s"); //$NON-NLS-1$ updateValues(); } @@ -227,7 +228,7 @@ public class MetricsEditor extends JPanel { try { d = Double.parseDouble(value); } catch (NumberFormatException e) { - valuePresentationField.setText("Value test is not a number"); + valuePresentationField.setText(Messages.MetricsEditor_ValueTestNotANumber); return; } formatValue = d; @@ -236,7 +237,7 @@ public class MetricsEditor extends JPanel { try { format = createMetricsFormatFromFields(); } catch (Exception e) { - valuePresentationField.setText("Format pattern is not correct " + e.getMessage()); + valuePresentationField.setText(NLS.bind(Messages.MetricsEditor_FormatPatternNotCorrect, e.getMessage())); } if (format == null) return; // TODO : show error @@ -255,7 +256,7 @@ public class MetricsEditor extends JPanel { try { valuePresentationField.setText(format.formatValue(formatValue)); } catch (Exception e) { - valuePresentationField.setText("Format error: " + e.getMessage()); + valuePresentationField.setText(NLS.bind(Messages.MetricsEditor_FormatError, e.getMessage())); } formatNameField.setText(format.getName()); formatPatternField.setText(format.getPattern()); @@ -267,7 +268,7 @@ public class MetricsEditor extends JPanel { private class MetricsTableModel implements TableModel, MetricsFormatListListener { - private String[] columnNames = {"Name","Format","Value"}; + private String[] columnNames = {Messages.MetricsEditor_Name,Messages.MetricsEditor_Format,Messages.MetricsEditor_Value}; private MetricsFormatList formatList; private double formatValue = 0; @@ -301,7 +302,7 @@ public class MetricsEditor extends JPanel { } else if (columnIndex == 2) { return format.formatValue(formatValue); } - throw new IndexOutOfBoundsException("There is no column " + columnIndex); + throw new IndexOutOfBoundsException("There is no column " + columnIndex); //$NON-NLS-1$ } @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/messages.properties new file mode 100644 index 000000000..c15f64f32 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/messages.properties @@ -0,0 +1,32 @@ +AWTStyleDialog_Color=Color +AWTStyleDialog_Font=Font +AWTStyleDialog_Metrics=Metrics +AWTStyleDialog_SampleText=Sample text +AWTStyleDialog_Style=Style +EditStyle_MonitorOpenDialog=Open dialog +EditStyle_OpenStyleDialog=Open Style Dialog +FontChooser_DefaultFont=Arial +FontChooser_Bold=Bold +FontChooser_Italic=Italic +FontChooser_KeepCurrentFont=-- keep current font -- +FontChooser_Size=Size: +MetricsEditor_AddFormatTemplate=Add Format Template +MetricsEditor_AddFormatTemplateTT=Add current format to templates +MetricsEditor_Format=Format +MetricsEditor_FormatError=Format error: {} +MetricsEditor_FormatName=Format name: +MetricsEditor_FormatPattern=Format pattern: +MetricsEditor_FormatPatternNotCorrect=Format pattern is not correct {0} +MetricsEditor_Name=Name +MetricsEditor_NewFormat=New Format +MetricsEditor_NewFormatField=New format +MetricsEditor_NewFormatTT=Create a new Format +MetricsEditor_Numbers=123456.789 +MetricsEditor_RemoveTemplate=Remove Template +MetricsEditor_RemoveTemplateTT=Remove selected template +MetricsEditor_UpdateTemplate=Update Template +MetricsEditor_UpdateTemplateTT=Update selected template using current format +MetricsEditor_Value=Value +MetricsEditor_ValuePresentation=Value presentation: +MetricsEditor_ValueTest=Value test: +MetricsEditor_ValueTestNotANumber=Value test is not a number diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ChartComposite.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ChartComposite.java index c805087d4..9ef7a33e7 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ChartComposite.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ChartComposite.java @@ -60,7 +60,7 @@ public class ChartComposite extends ConfigurationComposite { public String perform(ReadGraph graph) throws DatabaseException { Resource r = ResourceAdaptionUtils.toSingleResource(selection); if (r == null) - return "Selection"; + return "Selection"; //$NON-NLS-1$ return NameLabelUtil.modalName(graph, r); } }; @@ -93,7 +93,7 @@ public class ChartComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(nameText.getWidget()); */ Label autoscrollLabel = new Label(body, support, 0); - autoscrollLabel.setText("Auto-scroll settings:"); + autoscrollLabel.setText(Messages.ChartComposite_AutoScrollSettings); autoscrollLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(autoscrollLabel.getControl()); @@ -103,7 +103,7 @@ public class ChartComposite extends ConfigurationComposite { GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(3).extendedMargins(5,5,5,5).applyTo(templateComposite); Label templateHeader = new Label(templateComposite, support, 0); - templateHeader.setText("Template"); + templateHeader.setText(Messages.ChartComposite_Template); //templateHeader.setFont(smallFont); templateHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(templateHeader.getWidget()); @@ -115,7 +115,7 @@ public class ChartComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(templateCombo.getWidget()); Button resetButton = new Button(templateComposite, support, SWT.NONE | SWT.READ_ONLY); - resetButton.setText("Apply"); + resetButton.setText(Messages.ChartComposite_Apply); resetButton.addSelectionListener(new SelectionListenerImpl(context) { @Override public void apply(WriteGraph graph, Resource monitor) throws DatabaseException { @@ -137,13 +137,13 @@ public class ChartComposite extends ConfigurationComposite { GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).extendedMargins(5,5,5,5).applyTo(buttonComposite); Label startHeader = new Label(buttonComposite, support, 0); - startHeader.setText("Start time"); + startHeader.setText(Messages.ChartComposite_StartTime); //startHeader.setFont(smallFont); startHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(startHeader.getWidget()); TrackedText timeWindowStart = new TrackedText(buttonComposite, support, SWT.BORDER | SWT.FLAT); - timeWindowStart.getWidget().setToolTipText("Chart Window Fixed Start Time in Seconds or Yy Dd HH:mm:ss.ddd"); + timeWindowStart.getWidget().setToolTipText(Messages.ChartComposite_ChartWindowTT); timeWindowStart.setTextFactory(new TimePropertyFactory(ChartResource.URIs.Chart_TimeWindowStart)); timeWindowStart.addModifyListener(new TimePropertyModifier(context, ChartResource.URIs.Chart_TimeWindowStart, START_VALIDATOR)); timeWindowStart.setInputValidator( START_VALIDATOR ); @@ -154,13 +154,13 @@ public class ChartComposite extends ConfigurationComposite { // l1.setText("seconds"); Label sizeHeader = new Label(buttonComposite, support, 0); - sizeHeader.setText("Length"); + sizeHeader.setText(Messages.ChartComposite_Length); //sizeHeader.setFont(smallFont); sizeHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(sizeHeader.getWidget()); TrackedText timeWindowLength = new TrackedText(buttonComposite, support, SWT.BORDER | SWT.FLAT); - timeWindowLength.getWidget().setToolTipText("Chart Window Fixed Time Axis Length in Seconds or Yy Dd HH:mm:ss.ddd"); + timeWindowLength.getWidget().setToolTipText(Messages.ChartComposite_ChartWindowTT2); timeWindowLength.setTextFactory(new TimePropertyFactory(ChartResource.URIs.Chart_TimeWindowLength)); timeWindowLength.addModifyListener(new TimePropertyModifier(context, ChartResource.URIs.Chart_TimeWindowLength, LENGTH_VALIDATOR)); timeWindowLength.setInputValidator( LENGTH_VALIDATOR ); @@ -171,7 +171,7 @@ public class ChartComposite extends ConfigurationComposite { // l2.setText("seconds"); Label incrementHeader = new Label(buttonComposite, support, 0); - incrementHeader.setText("Scroll increment"); + incrementHeader.setText(Messages.ChartComposite_ScrollIncrement); //incrementHeader.setFont(smallFont); incrementHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(incrementHeader.getWidget()); @@ -197,7 +197,7 @@ public class ChartComposite extends ConfigurationComposite { try { Double d = Double.parseDouble(newText); if (d < 1 || d > 100) - return "Increment must be between 1..100"; + return Messages.ChartComposite_ScrollIncrementRange; return null; } catch (NumberFormatException e) { return e.getMessage(); @@ -208,7 +208,7 @@ public class ChartComposite extends ConfigurationComposite { Label l3 = new Label(buttonComposite, support, 0); l3.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - l3.setText("%"); + l3.setText("%"); //$NON-NLS-1$ Composite checkboxComposite = new Composite(buttonComposite, SWT.NONE); checkboxComposite.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); @@ -217,7 +217,7 @@ public class ChartComposite extends ConfigurationComposite { final Button showMilestones = new Button(checkboxComposite, support, SWT.CHECK); showMilestones.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - showMilestones.setText("Show &Milestones"); + showMilestones.setText(Messages.ChartComposite_ShowMileStones); GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(showMilestones.getWidget()); showMilestones.setSelectionFactory(new BooleanPropertyFactory(ChartResource.URIs.Chart_ShowMilestones)); showMilestones.addSelectionListener(new SelectionAdapter() { @@ -238,15 +238,15 @@ public class ChartComposite extends ConfigurationComposite { } catch (DatabaseException e1) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Failed to set Show Milestones", e1)); + Messages.ChartComposite_ActivatorFailedToSetShowMilestones, e1)); } } }); final Button trackExperimentTime = new Button(checkboxComposite, support, SWT.CHECK); trackExperimentTime.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - trackExperimentTime.setText("Hairline &Tracks Experiment Time"); - trackExperimentTime.setTooltipText("Value Tip Hairline Tracks Experiment Time During Simulation"); + trackExperimentTime.setText(Messages.ChartComposite_HairlineAndTracksExperimentTime); + trackExperimentTime.setTooltipText(Messages.ChartComposite_HairlineAndTracksExperimentTimeTT); GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(trackExperimentTime.getWidget()); trackExperimentTime.setSelectionFactory(new BooleanPropertyFactory(ChartResource.URIs.Chart_trackExperimentTime)); trackExperimentTime.addSelectionListener(new SelectionAdapter() { @@ -267,7 +267,7 @@ public class ChartComposite extends ConfigurationComposite { } catch (DatabaseException e1) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Failed to set Track Experiment Time", e1)); + Messages.ChartComposite_ActivatorFailedTrackExperimentTime, e1)); } } }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyFactory.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyFactory.java index bbf30a164..1015c3c6f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyFactory.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyFactory.java @@ -36,7 +36,7 @@ public class DoublePropertyFactory extends ReadFactoryImpl { @Override public String perform(ReadGraph graph, Resource r) throws DatabaseException { Double value = graph.getPossibleRelatedAdapter(r, graph.getResource(propertyURI), Double.class); - return value != null ? value.toString() : ""; + return value != null ? value.toString() : ""; //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/Messages.java new file mode 100644 index 000000000..3fbf12707 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/Messages.java @@ -0,0 +1,29 @@ +package org.simantics.modeling.ui.chart.property; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.chart.property.messages"; //$NON-NLS-1$ + public static String ChartComposite_ActivatorFailedToSetShowMilestones; + public static String ChartComposite_ActivatorFailedTrackExperimentTime; + public static String ChartComposite_Apply; + public static String ChartComposite_AutoScrollSettings; + public static String ChartComposite_ChartWindowTT; + public static String ChartComposite_ChartWindowTT2; + public static String ChartComposite_HairlineAndTracksExperimentTime; + public static String ChartComposite_HairlineAndTracksExperimentTimeTT; + public static String ChartComposite_Length; + public static String ChartComposite_ScrollIncrement; + public static String ChartComposite_ScrollIncrementRange; + public static String ChartComposite_ShowMileStones; + public static String ChartComposite_StartTime; + public static String ChartComposite_Template; + public static String TimeInputValidator_ValueRange; + 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/chart/property/ObtainedDoubleStringAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleStringAdapter.java index 36349f96d..6347d0090 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleStringAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleStringAdapter.java @@ -27,7 +27,7 @@ public class ObtainedDoubleStringAdapter extends SimpleContextualAdapter { @Override public String perform(ReadGraph graph, Resource r) throws DatabaseException { Double value = graph.getPossibleRelatedAdapter(r, graph.getResource(propertyURI), Double.class); - if (value == null) return ""; + if (value == null) return ""; //$NON-NLS-1$ Format timeFormat = new TimeFormat(100, 3); return timeFormat.format(value); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/messages.properties new file mode 100644 index 000000000..d4efd5c8a --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/messages.properties @@ -0,0 +1,15 @@ +ChartComposite_ActivatorFailedToSetShowMilestones=Failed to set Show Milestones +ChartComposite_ActivatorFailedTrackExperimentTime=Failed to set Track Experiment Time +ChartComposite_Apply=Apply +ChartComposite_AutoScrollSettings=Auto-scroll settings: +ChartComposite_ChartWindowTT=Chart Window Fixed Start Time in Seconds or Yy Dd HH:mm:ss.ddd +ChartComposite_ChartWindowTT2=Chart Window Fixed Time Axis Length in Seconds or Yy Dd HH:mm:ss.ddd +ChartComposite_HairlineAndTracksExperimentTime=Hairline &Tracks Experiment Time +ChartComposite_HairlineAndTracksExperimentTimeTT=Value Tip Hairline Tracks Experiment Time During Simulation +ChartComposite_Length=Length +ChartComposite_ScrollIncrement=Scroll increment +ChartComposite_ScrollIncrementRange=Increment must be between 1..100 +ChartComposite_ShowMileStones=Show &Milestones +ChartComposite_StartTime=Start time +ChartComposite_Template=Template +TimeInputValidator_ValueRange=The value must be at least {0} seconds. diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeEditor.java index 74e5e7c67..56b5d895b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeEditor.java @@ -23,16 +23,16 @@ import org.simantics.ui.workbench.ResourceEditorPart; public class ComponentTypeEditor extends ResourceEditorPart implements IExecutableExtension { protected ComponentTypeViewer viewer; - protected String formTitle = "User Component Interface"; + protected String formTitle = Messages.ComponentTypeEditor_UserComponentInterface; @Override public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) { if (data instanceof String) { - String[] params = ((String) data).split(";"); + String[] params = ((String) data).split(";"); //$NON-NLS-1$ for (String param : params) { - String[] keyValue = param.split("="); + String[] keyValue = param.split("="); //$NON-NLS-1$ if (keyValue.length == 2) { - if ("formTitle".equals(keyValue[0])) { + if ("formTitle".equals(keyValue[0])) { //$NON-NLS-1$ formTitle = keyValue[1]; } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java index 0425ac149..57d0aa69a 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java @@ -62,7 +62,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide Resource owner = graph.getPossibleObject(resource, STR.ComponentType_hasScript_Inverse); immutable = owner != null && StructuralUtils.isImmutable(graph, owner); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } }); } catch (DatabaseException e) { @@ -91,7 +91,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide synchronized(annotationModel.getLockObject()) { annotationModel.removeAllAnnotations(); for(CompilationError error : result.getErrors()) { - Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, error.description); + Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, error.description); //$NON-NLS-1$ int begin = Locations.beginOf(error.location); int end = Locations.endOf(error.location); Position position = new Position(begin, end - begin); @@ -115,7 +115,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); + TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptEditor.java index cbad48af4..c3152692d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptEditor.java @@ -91,7 +91,7 @@ public class ComponentTypeScriptEditor extends SCLModuleEditor { String name = graph.getRelatedValue(script, L0.HasName); Resource componentType = graph.getSingleObject(script, STR.ComponentType_hasScript_Inverse); String ctName = graph.getRelatedValue(componentType, L0.HasName); - return ctName + " " + name; + return ctName + " " + name; //$NON-NLS-1$ } }, @@ -103,17 +103,17 @@ public class ComponentTypeScriptEditor extends SCLModuleEditor { } private static final String[] EXECUTION_PHASES = new String[] { - "step", - "analogAutomation", - "binaryAutomation", - "preparation" + "step", //$NON-NLS-1$ + "analogAutomation", //$NON-NLS-1$ + "binaryAutomation", //$NON-NLS-1$ + "preparation" //$NON-NLS-1$ }; private static final String[] EXECUTION_PHASE_LABELS = new String[] { - "Execute at each step", - "Execute together with analog automation", - "Execute together with binary automation", - "Execute during preparation" + Messages.ComponentTypeScriptEditor_ExecuteAtEachStep, + Messages.ComponentTypeScriptEditor_ExecuteAnalogAutomation, + Messages.ComponentTypeScriptEditor_ExecuteBinaryAutomation, + Messages.ComponentTypeScriptEditor_ExecuteDuringPreparation }; @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java index 7d256ba00..75c60d24c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java @@ -185,22 +185,22 @@ public class ComponentTypeViewer { String type = graph.getPossibleRelatedValue(relation, L0.RequiresValueType); String label = graph.getPossibleRelatedValue(relation, L0.HasLabel); if (label == null) - label = ""; + label = ""; //$NON-NLS-1$ String description = graph.getPossibleRelatedValue(relation, L0.HasDescription); if (description == null) - description = ""; + description = ""; //$NON-NLS-1$ NumberType numberType = null; if(type == null) - type = "Double"; + type = "Double"; //$NON-NLS-1$ String unit = graph.getPossibleRelatedValue(relation, L0X.HasUnit, Bindings.STRING); - String defaultValue = "0"; + String defaultValue = "0"; //$NON-NLS-1$ String expression = null; for(Resource assertion : graph.getAssertedObjects(data.componentType, relation)) { try { expression = graph.getPossibleRelatedValue(assertion, L0.SCLValue_expression, Bindings.STRING); if(expression != null) { - defaultValue = "=" + expression; + defaultValue = "=" + expression; //$NON-NLS-1$ } else { Datatype dt = getPossibleDatatype(graph, assertion); if (dt == null) @@ -306,9 +306,9 @@ public class ComponentTypeViewer { section.setReadOnly(readOnly); IMessageManager mm = data.form.getMessageManager(); if (readOnly) - mm.addMessage("readonly", "(Opened in read-only mode)", null, IMessageProvider.INFORMATION); + mm.addMessage("readonly", Messages.ComponentTypeViewer_OpenedInReadOnly, null, IMessageProvider.INFORMATION); //$NON-NLS-1$ else - mm.removeMessage("readonly"); + mm.removeMessage("readonly"); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java index b64380b28..048e0840e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java @@ -6,9 +6,11 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.TableEditor; @@ -52,29 +54,29 @@ public class ComponentTypeViewerData { * Used to validate property names. */ public static final Pattern PROPERTY_NAME_PATTERN = - Pattern.compile("([a-z]|_[0-9a-zA-Z_])[0-9a-zA-Z_]*"); + Pattern.compile("([a-z]|_[0-9a-zA-Z_])[0-9a-zA-Z_]*"); //$NON-NLS-1$ public static final String[] PROPERTY_TYPE_SUGGESTIONS = new String[] { - "Double", - "Integer", - "Float", - "String", - "Boolean", - "Long", - "[Double]", - "[Integer]", - "[Float]", - "[String]", - "[Boolean]", - "[Long]", - "Vector Double", - "Vector Integer", - "Vector Float", - "Vector String", - "Vector Boolean", - "Vector Long" + "Double", //$NON-NLS-1$ + "Integer", //$NON-NLS-1$ + "Float", //$NON-NLS-1$ + "String", //$NON-NLS-1$ + "Boolean", //$NON-NLS-1$ + "Long", //$NON-NLS-1$ + "[Double]", //$NON-NLS-1$ + "[Integer]", //$NON-NLS-1$ + "[Float]", //$NON-NLS-1$ + "[String]", //$NON-NLS-1$ + "[Boolean]", //$NON-NLS-1$ + "[Long]", //$NON-NLS-1$ + "Vector Double", //$NON-NLS-1$ + "Vector Integer", //$NON-NLS-1$ + "Vector Float", //$NON-NLS-1$ + "Vector String", //$NON-NLS-1$ + "Vector Boolean", //$NON-NLS-1$ + "Vector Long" //$NON-NLS-1$ }; - + public Resource componentType; public FormToolkit tk; public Form form; @@ -180,7 +182,7 @@ public class ComponentTypeViewerData { graph.markUndoPoint(); Layer0 L0 = Layer0.getInstance(graph); String prevName = graph.getPossibleRelatedValue2(propertyInfo.resource, L0.HasName); - String oldCamelCasedLabel = prevName != null ? ComponentTypeCommands.camelCaseNameToLabel(prevName) : ""; + String oldCamelCasedLabel = prevName != null ? ComponentTypeCommands.camelCaseNameToLabel(prevName) : ""; //$NON-NLS-1$ String oldLabel = graph.getPossibleRelatedValue(propertyInfo.resource, L0.HasLabel); boolean setLabel = oldLabel == null || oldLabel.isEmpty() @@ -391,7 +393,7 @@ public class ComponentTypeViewerData { private Range parseRange(NumberType numberType, String minStr, String maxStr, boolean lowInclusive, boolean highInclusive) throws RangeException { try { - String rangeStr = (lowInclusive ? "[" : "(") + minStr + ".." + maxStr + (highInclusive ? "]" : ")"); + String rangeStr = (lowInclusive ? "[" : "(") + minStr + ".." + maxStr + (highInclusive ? "]" : ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ return Range.valueOf(rangeStr); } catch (IllegalArgumentException e) { // Limits are invalid @@ -401,8 +403,8 @@ public class ComponentTypeViewerData { private static Combo createRangeInclusionCombo(Composite parent, boolean inclusive) { Combo rng = new Combo(parent, SWT.READ_ONLY); - rng.add("Inclusive"); - rng.add("Exclusive"); + rng.add(Messages.ComponentTypeViewerData_Inclusive); + rng.add(Messages.ComponentTypeViewerData_Exclusive); rng.select(inclusive ? 0 : 1); return rng; } @@ -431,12 +433,12 @@ public class ComponentTypeViewerData { GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite); Label low = new Label(composite, SWT.NONE); - low.setText("Minimum Value:"); + low.setText(Messages.ComponentTypeViewerData_MinimumValue); final Text lowText = new Text(composite, SWT.BORDER | extraTextStyle); GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).applyTo(lowText); final Combo lowSelector = createRangeInclusionCombo(composite, !range.getLower().isExclusive()); Label high = new Label(composite, SWT.NONE); - high.setText("Maximum Value:"); + high.setText(Messages.ComponentTypeViewerData_MaximumValue); final Text highText = new Text(composite, SWT.BORDER | extraTextStyle); GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).applyTo(highText); final Combo highSelector = createRangeInclusionCombo(composite, !range.getUpper().isExclusive()); @@ -446,10 +448,10 @@ public class ComponentTypeViewerData { GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).applyTo(buttonComposite); Button ok = new Button(buttonComposite, SWT.NONE); - ok.setText("&OK"); + ok.setText(IDialogConstants.OK_LABEL); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(ok); Button cancel = new Button(buttonComposite, SWT.NONE); - cancel.setText("&Cancel"); + cancel.setText(IDialogConstants.CANCEL_LABEL); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(ok); if (range.getLower().getValue() != null) @@ -565,10 +567,10 @@ public class ComponentTypeViewerData { } }; - String helpText = propertyInfo.immutable ? "ESC to close." : "Ctrl+Enter to apply changes, ESC to cancel."; + String helpText = propertyInfo.immutable ? Messages.ComponentTypeViewerData_ESCToClose : Messages.ComponentTypeViewerData_CtrlEnterApplyChanges; Label help = tk.createLabel(shell, helpText, SWT.BORDER | SWT.FLAT); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(help); - help.setForeground( tk.getColors().createColor( "fg", tk.getColors().getSystemColor(SWT.COLOR_LIST_SELECTION) ) ); + help.setForeground( tk.getColors().createColor( "fg", tk.getColors().getSystemColor(SWT.COLOR_LIST_SELECTION) ) ); //$NON-NLS-1$ Display display = table.getDisplay(); Rectangle clientArea = display.getClientArea(); @@ -599,16 +601,15 @@ public class ComponentTypeViewerData { return null; for (ComponentTypeViewerPropertyInfo info : properties) { if (propertyName.equals(info.name)) - return "Property name '" + propertyName + "' is already in use."; + return NLS.bind(Messages.ComponentTypeViewerData_PropertyNameInUse, propertyName); } for (NamedResource cp : connectionPoints) { if (propertyName.equals(cp.getName())) - return "Name '" + propertyName + "' is already used for a terminal."; + return NLS.bind(Messages.ComponentTypeViewerData_NameInUse, propertyName ); } Matcher m = namePattern.matcher(propertyName); if (!m.matches()) - return "Property name '" + propertyName + "' contains invalid characters, does not match pattern " - + namePattern.pattern() + "."; + return NLS.bind(Messages.ComponentTypeViewerData_ContainsInvalidCharacters, propertyName, namePattern.pattern()); return null; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java index e919aa71f..34d26e491 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java @@ -68,9 +68,16 @@ import org.slf4j.LoggerFactory; public class ConfigurationPropertiesSection implements ComponentTypeViewerSection { private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationPropertiesSection.class); - - private static final String[] COLUMN_NAMES = - new String[] {"Name", "Type", "Default Value", "Unit", "Range", "Label", "Description"}; + + private static final String[] COLUMN_NAMES = { + Messages.ConfigurationPropertiesSection_Name, + Messages.ConfigurationPropertiesSection_Type, + Messages.ConfigurationPropertiesSection_DefaultValue, + Messages.ConfigurationPropertiesSection_Unit, + Messages.ConfigurationPropertiesSection_Range, + Messages.ConfigurationPropertiesSection_Label, + Messages.ConfigurationPropertiesSection_Description + }; private static final int[] COLUMN_LENGTHS = new int[] { 120, 100, 100, 50, 100, 100, 100 }; private static final int[] COLUMN_WEIGHTS = @@ -83,8 +90,8 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio */ private static final int[] IMMUTABLE_COLUMNS_WITH_IMMUTABLE_RELATION = { 0, 1, 3, 4, 5, 6 }; - ComponentTypeViewerData data; + Table table; TableColumn[] columns; TableEditor editor; @@ -104,7 +111,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio section = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED); section.setLayout(new FillLayout()); - section.setText("Configuration properties"); + section.setText(Messages.ConfigurationPropertiesSection_ConfigurationProperties); Composite sectionBody = tk.createComposite(section); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(sectionBody); @@ -228,18 +235,18 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio GridDataFactory.fillDefaults().applyTo(buttons); GridLayoutFactory.fillDefaults().applyTo(buttons); - newProperty = tk.createButton(buttons, "New property", SWT.PUSH); + newProperty = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_NewProperty, SWT.PUSH); GridDataFactory.fillDefaults().applyTo(newProperty); - removeProperty = tk.createButton(buttons, "Remove property", SWT.PUSH); + removeProperty = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_RemoveProperty, SWT.PUSH); GridDataFactory.fillDefaults().applyTo(removeProperty); - liftProperties = tk.createButton(buttons, "Lift Properties", SWT.PUSH); + liftProperties = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_LiftProperties, SWT.PUSH); GridDataFactory.fillDefaults().applyTo(liftProperties); hasTypes = !getTypes().isEmpty(); if(hasTypes) { - setTypes = tk.createButton(buttons, "Assign Types", SWT.PUSH); + setTypes = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_AssignTypes, SWT.PUSH); GridDataFactory.fillDefaults().applyTo(setTypes); } @@ -287,7 +294,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio if (!info.immutable) propertiesToBeRemoved.add(info.resource); } - System.out.println("remove " + propertiesToBeRemoved.size() + " resources"); + //System.out.println("remove " + propertiesToBeRemoved.size() + " resources"); //$NON-NLS-1$ //$NON-NLS-2$ if(!propertiesToBeRemoved.isEmpty()) Simantics.getSession().async(new WriteRequest() { @Override @@ -355,7 +362,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio String predicateName = NameUtils.getSafeName(graph, predicate); if(existing.contains(predicateName)) continue; - String name = componentName + " " + predicateName; + String name = componentName + " " + predicateName; //$NON-NLS-1$ map.put(new LiftedProperty(component, type, predicate), new Pair(name, null)); } @@ -370,7 +377,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio }); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - LiftPropertiesDialog dialog = new LiftPropertiesDialog(shell, map, "Select properties to lift") { + LiftPropertiesDialog dialog = new LiftPropertiesDialog(shell, map, Messages.ConfigurationPropertiesSection_SelectPropertiesToLift) { @Override protected IDialogSettings getBaseDialogSettings() { return Activator.getDefault().getDialogSettings(); @@ -429,13 +436,13 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio graph.claim(data.componentType, L0.DomainOf, copy); Layer0Utils.assert_(graph, data.componentType, copy, copyAss.iterator().next()); CommentMetadata cm = graph.getMetadata(CommentMetadata.class); - graph.addMetadata(cm.add("Lifted property " + NameUtils.getSafeName(graph, copy) + " into "+ NameUtils.getSafeName(graph, data.componentType))); + graph.addMetadata(cm.add("Lifted property " + NameUtils.getSafeName(graph, copy) + " into "+ NameUtils.getSafeName(graph, data.componentType))); //$NON-NLS-1$ //$NON-NLS-2$ } if(mapProperties) { Variable v = Variables.getVariable(graph, p.getComponent()); Variable property = v.getProperty(graph, p.getPredicate()); Variable displayValue = property.getProperty(graph, Variables.DISPLAY_VALUE); - displayValue.setValue(graph, "=" + NameUtils.getSafeName(graph, p.getPredicate()), Bindings.STRING); + displayValue.setValue(graph, "=" + NameUtils.getSafeName(graph, p.getPredicate()), Bindings.STRING); //$NON-NLS-1$ } index++; } @@ -447,7 +454,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio } catch (DatabaseException e1) { - LOGGER.error("Lifting properties failed", e1); + LOGGER.error("Lifting properties failed", e1); //$NON-NLS-1$ return; } @@ -470,7 +477,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio if(propertiesToSet.size() != 1) return; Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - SetTypesDialog page = new SetTypesDialog(shell, getTypes(), "Select user types for property"); + SetTypesDialog page = new SetTypesDialog(shell, getTypes(), Messages.ConfigurationPropertiesSection_SelectUserTypesForProp); if (page.open() == Window.OK) { final Object[] result = page.getResult(); if (result != null && result.length > 0) { @@ -569,7 +576,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio } }); } catch (DatabaseException e) { - LOGGER.error("Finding UserDefinedProperties failed.", e); + LOGGER.error("Finding UserDefinedProperties failed.", e); //$NON-NLS-1$ return Collections.emptyMap(); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java index 19d9e6f29..869d5e32a 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java @@ -42,8 +42,14 @@ import org.simantics.scl.runtime.function.Function4; import org.simantics.structural.stubs.StructuralResource2; public class DerivedPropertiesSection implements ComponentTypeViewerSection { - private static final String[] COLUMN_NAMES = - new String[] {"Name", "Type", "Expression", "Unit", "Label", "Description"}; + private static final String[] COLUMN_NAMES = { + Messages.DerivedPropertiesSection_Name, + Messages.DerivedPropertiesSection_Type, + Messages.DerivedPropertiesSection_Expression, + Messages.DerivedPropertiesSection_Unit, + Messages.DerivedPropertiesSection_Label, + Messages.DerivedPropertiesSection_Description + }; private static final int[] COLUMN_LENGTHS = new int[] { 120, 100, 100, 70, 100, 100 }; private static final int[] COLUMN_WEIGHTS = @@ -71,7 +77,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection { Form form = data.form; section = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED); section.setLayout(new FillLayout()); - section.setText("Derived properties"); + section.setText(Messages.DerivedPropertiesSection_DerivedProperties); Composite sectionBody = tk.createComposite(section); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(sectionBody); @@ -191,9 +197,9 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection { GridDataFactory.fillDefaults().applyTo(buttons); GridLayoutFactory.fillDefaults().applyTo(buttons); - newProperty = tk.createButton(buttons, "New property", SWT.PUSH); + newProperty = tk.createButton(buttons, Messages.DerivedPropertiesSection_NewProperty, SWT.PUSH); GridDataFactory.fillDefaults().applyTo(newProperty); - removeProperty = tk.createButton(buttons, "Remove property", SWT.PUSH); + removeProperty = tk.createButton(buttons, Messages.DerivedPropertiesSection_RemoveProperty, SWT.PUSH); GridDataFactory.fillDefaults().applyTo(removeProperty); // Actions @@ -247,11 +253,11 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection { public static String validateMonitorExpression(final RequestProcessor processor, final Resource componentType, final Resource relation, final String expression) { if (expression.trim().isEmpty()) { - return "Expression is empty."; + return Messages.DerivedPropertiesSection_ExpressionIsEmpty; } if (expression.trim().isEmpty()) { - return "Expression is empty."; + return Messages.DerivedPropertiesSection_ExpressionIsEmpty; } try { return processor.sync(new UniqueRead() { @@ -282,7 +288,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection { } catch (Exception e) { String msg = e.getMessage(); - int index = msg.indexOf(":"); + int index = msg.indexOf(":"); //$NON-NLS-1$ if(index > 0) msg = msg.substring(index); return msg; } @@ -327,7 +333,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection { TableItem item = new TableItem(table, SWT.NONE); - item.setText(0, info.valid != null ? info.name + " (!)" : info.name); + item.setText(0, info.valid != null ? info.name + " (!)" : info.name); //$NON-NLS-1$ item.setText(1, info.type); item.setText(2, info.expression); item.setText(3, info.unitString()); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java index c924c12d9..656e2486f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java @@ -74,7 +74,7 @@ public class LiftPropertiesDialog extends ResourceSelectionDialog3 proceduralDesc = Functions.getProceduralDesc(graph, context); if(proceduralDesc == null) - return createErrorGraph("Component does not have a procedural substructure."); + return createErrorGraph(Messages.ProceduralComponentInstanceViewer_NoProceduralSubstructure); return createGraph(graph, proceduralDesc); } catch(DatabaseException e) { e.printStackTrace(); @@ -97,7 +97,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart { private static Graph createErrorGraph(String description) { Graph graph = new Graph(); - new Node(graph, description).setShape("rectangle"); + new Node(graph, description).setShape("rectangle"); //$NON-NLS-1$ return graph; } @@ -115,7 +115,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart { Node node = connectionPoints.get(interface_.relation); if(node == null) { node = new Node(graph); - node.setShape("diamond"); + node.setShape("diamond"); //$NON-NLS-1$ node.setLabel(nameOf(g, interface_.relation)); connectionPoints.put(interface_.relation, node); } @@ -125,21 +125,21 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart { private static Graph createGraph(ReadGraph g, List proceduralDesc) throws DatabaseException { Graph graph = new Graph(); - graph.setRankdir("LR"); + graph.setRankdir("LR"); //$NON-NLS-1$ THashMap components = new THashMap(); for(SubstructureElement element : proceduralDesc) if(element instanceof Component) { Component component = (Component)element; Record record = new Record(); - record.add(component.name + " : " + nameOf(g, component.type)); + record.add(component.name + " : " + nameOf(g, component.type)); //$NON-NLS-1$ StringBuilder b = new StringBuilder(); boolean first = true; for(Property property : component.properties) { if(first) first = false; else - b.append("\\n"); - b.append(nameOf(g, property.relation) + " = " + property.value); + b.append("\\n"); //$NON-NLS-1$ + b.append(nameOf(g, property.relation) + " = " + property.value); //$NON-NLS-1$ } record.add(b.toString()); components.put(component.name, record.toNode(graph)); @@ -155,7 +155,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart { Edge edge = new Edge(cp1.first, cp2.first); if(cp1.second != null) { if(cp2.second != null) - edge.setLabel(cp1.second + "-" + cp2.second); + edge.setLabel(cp1.second + "-" + cp2.second); //$NON-NLS-1$ else edge.setLabel(cp1.second); } @@ -166,7 +166,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart { } else { Node p = new Node(graph); - p.setShape("point"); + p.setShape("point"); //$NON-NLS-1$ boolean first = true; for(ConnectionPoint cp : cps) { Pair cp1 = getCp(g, graph, components, connectionPoints, cp); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentInstanceViewerEditorAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentInstanceViewerEditorAdapter.java index 012cd5e9f..55d6178dd 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentInstanceViewerEditorAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentInstanceViewerEditorAdapter.java @@ -18,11 +18,11 @@ public class ProceduralComponentInstanceViewerEditorAdapter extends AbstractResourceEditorAdapter { public static final ImageDescriptor ICON = ImageDescriptor.createFromURL(Activator.getDefault().getBundle() - .getResource("icons/shape_3d_gray.png")); - public static final String EDITOR_ID = "org.simantics.modeling.ui.proceduralComponentInstanceViewer"; + .getResource("icons/shape_3d_gray.png")); //$NON-NLS-1$ + public static final String EDITOR_ID = "org.simantics.modeling.ui.proceduralComponentInstanceViewer"; //$NON-NLS-1$ public ProceduralComponentInstanceViewerEditorAdapter() { - super("Procedural Component Instance Viewer", ICON, -10); + super(Messages.ProceduralComponentInstanceViewerEditorAdapter_ProceduralComponentInstanceViewer, ICON, -10); } private static Resource browseComponent(ReadGraph graph, Resource input) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java index 25663edf2..1a1eb723f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java @@ -56,7 +56,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor public Document perform(ReadGraph graph) throws DatabaseException { currentText = graph.getValue(resource, Bindings.STRING); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } }); } catch (DatabaseException e) { @@ -111,7 +111,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor @Override public void exception(Throwable t) { Activator.getDefault().getLog().log( - new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t)); + new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ProceduralComponentTypeCodeDocumentProvider_ActivatorInternalErrorMsg, t)); } @Override @@ -124,7 +124,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); + TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeEditorNamingService.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeEditorNamingService.java index be448e64b..1366354b8 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeEditorNamingService.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeEditorNamingService.java @@ -3,6 +3,7 @@ package org.simantics.modeling.ui.componentTypeEditor; import java.util.ArrayList; import java.util.List; +import org.eclipse.osgi.util.NLS; import org.eclipse.ui.IEditorInput; import org.simantics.NameLabelMode; import org.simantics.NameLabelUtil; @@ -34,10 +35,10 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ if (input instanceof IResourceEditorInput) { Resource code = ((IResourceEditorInput) input).getResource(); if (code != null) { - return truncated(getPropertyOwnerName(graph, code) + " (Code)", 256); + return truncated(getPropertyOwnerName(graph, code) + " (Code)", 256); //$NON-NLS-1$ } } - return "Unsupported input: " + input; + return NLS.bind(Messages.ProceduralComponentTypeEditorNamingService_UnsupportedInput, input); } @Override @@ -50,7 +51,7 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ return sb.toString(); } } - return "Unsupported input: " + input; + return NLS.bind(Messages.ProceduralComponentTypeEditorNamingService_UnsupportedInput, input); } private StringBuilder getTooltip(ReadGraph graph, String editorId, IResourceEditorInput input, StringBuilder sb) throws DatabaseException { @@ -66,14 +67,14 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ ResourceArray path = getPathInIndexRoot(graph, owner); for (int i = path.size() - 2; i > 0; --i) { String segment = NameLabelUtil.modalName(graph, path.get(i), mode); - if (segment.contains("/")) - segment = "\"" + segment + "\""; + if (segment.contains("/")) //$NON-NLS-1$ + segment = "\"" + segment + "\""; //$NON-NLS-1$ //$NON-NLS-2$ - sb.append(segment).append("/"); + sb.append(segment).append("/"); //$NON-NLS-1$ } sb.append(name); String rootLabel = NameLabelUtil.modalName(graph, root, mode); - sb.append(" (" + rootLabel + ")"); + sb.append(" (" + rootLabel + ")"); //$NON-NLS-1$ //$NON-NLS-2$ return sb; } } @@ -85,7 +86,7 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ Layer0 L0 = Layer0.getInstance(graph); Resource owner = graph.getPossibleObject(property, L0.PropertyOf); if (owner == null) - return "No owner (Code)"; + return "No owner (Code)"; //$NON-NLS-1$ return graph.getPossibleRelatedValue(owner, L0.HasName); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBase.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBase.java index b080c0b1c..e5bfc8f44 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBase.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBase.java @@ -124,7 +124,7 @@ public class SCLEditorBase extends EditorPart implements IExecutableExtension { public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); save(graph, inputResource, originalText); - Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(inputResource, Layer0.getInstance(graph).HasName, Bindings.STRING)); + Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(inputResource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$ } }); } catch (DatabaseException e) { @@ -140,8 +140,8 @@ public class SCLEditorBase extends EditorPart implements IExecutableExtension { Layer0 L0 = Layer0.getInstance(graph); Resource parent = graph.getPossibleObject(inputResource, L0.PropertyOf); if(parent == null) - return "No parent"; - return graph.getPossibleRelatedValue(parent, L0.HasName) + " (Code)"; + return "No parent"; //$NON-NLS-1$ + return graph.getPossibleRelatedValue(parent, L0.HasName) + " (Code)"; //$NON-NLS-1$ } @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java index 62c54d04e..6ac47e9fa 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java @@ -11,7 +11,7 @@ public class SCLEditorBaseUndoHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { String id = event.getCommand().getId(); SCLEditorBase editor = (SCLEditorBase)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if(id.equals("org.eclipse.ui.edit.undo")) { + if(id.equals("org.eclipse.ui.edit.undo")) { //$NON-NLS-1$ editor.editor.getUndoManager().undo(); } else { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditor.java index 7e6426f07..ad36bb34c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditor.java @@ -85,7 +85,7 @@ public class SCLModuleEditor extends TextEditor { try { getResourceInput().init(null); } catch (DatabaseException e) { - throw new PartInitException("Failed to initialize " + input, e); + throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorAdapter.java index 849c5be7c..36120e91f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorAdapter.java @@ -20,7 +20,7 @@ public class SCLModuleEditorAdapter extends AbstractResourceEditorAdapter implements EditorAdapter { public SCLModuleEditorAdapter() { - super("SCL Module Editor", null, 20); + super(Messages.SCLModuleEditorAdapter_SCLModuleEditor, null, 20); } @Override @@ -54,7 +54,7 @@ public class SCLModuleEditorAdapter extends AbstractResourceEditorAdapter @Override public void run() { try { - WorkbenchUtils.openEditor("org.simantics.scl.ui.editor2", + WorkbenchUtils.openEditor("org.simantics.scl.ui.editor2", //$NON-NLS-1$ new StandardSCLModuleEditorInput(uri)); } catch (PartInitException e) { e.printStackTrace(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorDocumentProvider.java index 4a63200a2..220c5ebdf 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorDocumentProvider.java @@ -66,7 +66,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider { currentText = graph.getRelatedValue(resource, L0.SCLModule_definition, Bindings.STRING); immutable = StructuralUtils.isImmutable(graph, resource); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } }); } catch (DatabaseException e) { @@ -94,7 +94,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider { return; String moduleName = graph.getURI(resource); SCLContext context = SCLContext.getCurrent(); - context.put("graph", graph); + context.put("graph", graph); //$NON-NLS-1$ Failable result = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName, listener); if(result instanceof Failure) { @@ -114,7 +114,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider { synchronized(annotationModel.getLockObject()) { annotationModel.removeAllAnnotations(); for(CompilationError error : errors) { - Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, + Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, //$NON-NLS-1$ error.description); int begin = Locations.beginOf(error.location); int end = Locations.endOf(error.location); @@ -139,7 +139,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider { @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); + TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override @@ -147,7 +147,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider { graph.markUndoPoint(); Layer0 L0 = Layer0.getInstance(graph); graph.claimLiteral(resource, L0.SCLModule_definition, currentText, Bindings.STRING); - Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); + Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$ } }); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleViewer.java index 0a5188841..235d89f77 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleViewer.java @@ -73,7 +73,7 @@ public class SCLModuleViewer { Section codeSection = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED); codeSection.setLayout(new FillLayout()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(codeSection); - codeSection.setText("Code"); + codeSection.setText(Messages.SCLModuleViewer_Code); Composite codeSectionBody = tk.createComposite(codeSection); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(codeSectionBody); @@ -83,7 +83,7 @@ public class SCLModuleViewer { GridDataFactory.fillDefaults().applyTo(codeButtons); GridLayoutFactory.fillDefaults().applyTo(codeButtons); - Button applyChanges = tk.createButton(codeButtons, "Apply changes", SWT.PUSH); + Button applyChanges = tk.createButton(codeButtons, Messages.SCLModuleViewer_ApplyChanges, SWT.PUSH); code = new SCLTextEditorNew(codeSectionBody, 0); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditor.java index 44ceec1a6..7cb239164 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditor.java @@ -78,7 +78,7 @@ public class SCLQueryEditor extends TextEditor { try { getResourceInput().init(null); } catch (DatabaseException e) { - throw new PartInitException("Failed to initialize " + input, e); + throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditorDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditorDocumentProvider.java index da8965671..3c5c20763 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditorDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditorDocumentProvider.java @@ -71,16 +71,16 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider { ModelingResources MOD = ModelingResources.getInstance(graph); if(isType(graph)) { Collection assertions = graph.getAssertedObjects(resource, MOD.SCLQuery_values); - if(assertions.size() != 1) throw new DatabaseException("No query text assertion defined in Query Type"); + if(assertions.size() != 1) throw new DatabaseException("No query text assertion defined in Query Type"); //$NON-NLS-1$ Resource value = assertions.iterator().next(); currentText = graph.getRelatedValue(value, L0.SCLValue_expression, Bindings.STRING); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } else { Resource value = graph.getSingleObject(resource, MOD.SCLQuery_values); currentText = graph.getRelatedValue(value, L0.SCLValue_expression, Bindings.STRING); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } } }); @@ -107,7 +107,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider { public void run(ReadGraph graph) throws DatabaseException { String moduleName = graph.getURI(resource); SCLContext context = SCLContext.getCurrent(); - context.put("graph", graph); + context.put("graph", graph); //$NON-NLS-1$ Failable result = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName, listener); if(result instanceof Failure) { @@ -125,7 +125,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider { synchronized(annotationModel.getLockObject()) { annotationModel.removeAllAnnotations(); for(CompilationError error : errors) { - Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, + Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, //$NON-NLS-1$ error.description); int begin = Locations.beginOf(error.location); int end = Locations.endOf(error.location); @@ -150,7 +150,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider { @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); + TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @@ -162,7 +162,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider { if(isType(graph)) { Collection assertions = graph.getAssertedObjects(resource, MOD.SCLQuery_values); - if(assertions.size() > 1) throw new DatabaseException("Invalid query text assertions in Query Type"); + if(assertions.size() > 1) throw new DatabaseException("Invalid query text assertions in Query Type"); //$NON-NLS-1$ if(assertions.size() == 1) return assertions.iterator().next(); Resource value = graph.newResource(); @@ -194,7 +194,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider { Layer0 L0 = Layer0.getInstance(graph); Resource value = getValue(graph); graph.claimLiteral(value, L0.SCLValue_expression, currentText, Bindings.STRING); - Layer0Utils.addCommentMetadata(graph, "Saved SCL Query " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); + Layer0Utils.addCommentMetadata(graph, "Saved SCL Query " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$ } }); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolCodeDocumentProvider2.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolCodeDocumentProvider2.java index 9c9ebfe9e..ddfb3d127 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolCodeDocumentProvider2.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolCodeDocumentProvider2.java @@ -72,7 +72,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider errorHappened = false; return graph.getRelatedValue(text, L0.SCLValue_expression, Bindings.STRING); } - return ""; + return ""; //$NON-NLS-1$ } protected void updateAnnotations() { @@ -103,7 +103,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider @Override public void exception(Throwable t) { Activator.getDefault().getLog().log( - new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t)); + new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SymbolCodeDocumentProvider2_ActivatorInternalErrorInCodeCompilation, t)); } @Override @@ -116,7 +116,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); + TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override @@ -130,7 +130,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider ModelingResources MOD = ModelingResources.getInstance(graph); Resource newValue = graph.newResource(); graph.claim(newValue, L0.InstanceOf, MOD.SCLValue); - graph.claimLiteral(newValue, L0.HasValueType, "[String]", Bindings.STRING); + graph.claimLiteral(newValue, L0.HasValueType, "[String]", Bindings.STRING); //$NON-NLS-1$ graph.claimLiteral(newValue, L0.SCLValue_expression, currentText, Bindings.STRING); Layer0Utils.assert_(graph, resource, DIA.symbolCode, newValue); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolDropHandlerDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolDropHandlerDocumentProvider.java index 48c258d47..ce8cef894 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolDropHandlerDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolDropHandlerDocumentProvider.java @@ -72,7 +72,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr errorHappened = false; return graph.getRelatedValue(text, L0.SCLValue_expression, Bindings.STRING); } - return ""; + return ""; //$NON-NLS-1$ } protected void updateAnnotations() { @@ -103,7 +103,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr @Override public void exception(Throwable t) { Activator.getDefault().getLog().log( - new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t)); + new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SymbolDropHandlerDocumentProvider_ActivatorInternalError, t)); } @Override @@ -116,7 +116,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); + TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override @@ -130,7 +130,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr ModelingResources MOD = ModelingResources.getInstance(graph); Resource newValue = graph.newResource(); graph.claim(newValue, L0.InstanceOf, MOD.SCLValue); - graph.claimLiteral(newValue, L0.HasValueType, "[WorkbenchSelectionElement] -> ()", Bindings.STRING); + graph.claimLiteral(newValue, L0.HasValueType, "[WorkbenchSelectionElement] -> ()", Bindings.STRING); //$NON-NLS-1$ graph.claimLiteral(newValue, L0.SCLValue_expression, currentText, Bindings.STRING); Layer0Utils.assert_(graph, resource, DIA.symbolDropHandler, newValue); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/messages.properties new file mode 100644 index 000000000..72f6b3b56 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/messages.properties @@ -0,0 +1,50 @@ +ComponentTypeEditor_UserComponentInterface=User Component Interface +ComponentTypeScriptEditor_ExecuteAnalogAutomation=Execute together with analog automation +ComponentTypeScriptEditor_ExecuteAtEachStep=Execute at each step +ComponentTypeScriptEditor_ExecuteBinaryAutomation=Execute together with binary automation +ComponentTypeScriptEditor_ExecuteDuringPreparation=Execute during preparation +ComponentTypeViewer_OpenedInReadOnly=(Opened in read-only mode) +ComponentTypeViewerData_ContainsInvalidCharacters=Property name ''{0}'' contains invalid characters, does not match pattern {1}. +ComponentTypeViewerData_CtrlEnterApplyChanges=Ctrl+Enter to apply changes, ESC to cancel. +ComponentTypeViewerData_ESCToClose=ESC to close. +ComponentTypeViewerData_Exclusive=Exclusive +ComponentTypeViewerData_Inclusive=Inclusive +ComponentTypeViewerData_MaximumValue=Maximum Value: +ComponentTypeViewerData_MinimumValue=Minimum Value: +ComponentTypeViewerData_NameInUse=Name ''{0}'' is already used for a terminal. +ComponentTypeViewerData_PropertyNameInUse=Property name ''{0}'' is already in use. +ConfigurationPropertiesSection_AssignTypes=Assign Types +ConfigurationPropertiesSection_ConfigurationProperties=Configuration properties +ConfigurationPropertiesSection_DefaultValue=Default Value +ConfigurationPropertiesSection_Description=Description +ConfigurationPropertiesSection_Label=Label +ConfigurationPropertiesSection_LiftProperties=Lift Properties +ConfigurationPropertiesSection_Name=Name +ConfigurationPropertiesSection_NewProperty=New property +ConfigurationPropertiesSection_Range=Range +ConfigurationPropertiesSection_RemoveProperty=Remove property +ConfigurationPropertiesSection_SelectPropertiesToLift=Select properties to lift +ConfigurationPropertiesSection_SelectUserTypesForProp=Select user types for property +ConfigurationPropertiesSection_Type=Type +ConfigurationPropertiesSection_Unit=Unit +DerivedPropertiesSection_DerivedProperties=Derived properties +DerivedPropertiesSection_Description=Description +DerivedPropertiesSection_Expression=Expression +DerivedPropertiesSection_ExpressionIsEmpty=Expression is empty. +DerivedPropertiesSection_Label=Label +DerivedPropertiesSection_Name=Name +DerivedPropertiesSection_NewProperty=New property +DerivedPropertiesSection_RemoveProperty=Remove property +DerivedPropertiesSection_Type=Type +DerivedPropertiesSection_Unit=Unit +LiftPropertiesDialog_MapLiftedPropertiesIntoInterface=Map lifted properties into interface +ProceduralComponentInstanceViewer_CouldnotCreateVariableForResource=Couldn't create variable for the resource. +ProceduralComponentInstanceViewer_NoProceduralSubstructure=Component does not have a procedural substructure. +ProceduralComponentInstanceViewerEditorAdapter_ProceduralComponentInstanceViewer=Procedural Component Instance Viewer +ProceduralComponentTypeCodeDocumentProvider_ActivatorInternalErrorMsg=Internal error in procedural user component code compilation. +ProceduralComponentTypeEditorNamingService_UnsupportedInput=Unsupported input: {0} +SCLModuleEditorAdapter_SCLModuleEditor=SCL Module Editor +SCLModuleViewer_ApplyChanges=Apply changes +SCLModuleViewer_Code=Code +SymbolCodeDocumentProvider2_ActivatorInternalErrorInCodeCompilation=Internal error in procedural user component code compilation. +SymbolDropHandlerDocumentProvider_ActivatorInternalError=Internal error in procedural user component code compilation. diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/Messages.java new file mode 100644 index 000000000..eb8bec956 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/Messages.java @@ -0,0 +1,26 @@ +package org.simantics.modeling.ui.diagram; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagram.messages"; //$NON-NLS-1$ + public static String PageDescComposite_Landscape; + public static String PageDescComposite_MarginsMM; + public static String PageDescComposite_Orientation; + public static String PageDescComposite_Portrait; + public static String PageDescComposite_Size; + public static String PageSettingsDialog_Display; + public static String PageSettingsDialog_GridSizeMM; + public static String PageSettingsDialog_GridSnapping; + public static String PageSettingsDialog_PageSettings; + public static String PageSettingsDialog_PageSize; + public static String PageSettingsDialog_ShowMargins; + public static String PageSettingsDialog_ShowPageBorders; + 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/diagram/PageDescComposite.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageDescComposite.java index 025dd45a0..b76eb23e0 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageDescComposite.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageDescComposite.java @@ -120,7 +120,7 @@ public class PageDescComposite extends Composite { public void setPageDesc(PageDesc desc) { if (desc == null) - throw new NullPointerException("null page desc"); + throw new NullPointerException("null page desc"); //$NON-NLS-1$ this.desc = desc; applyValuesToWidgets(); } @@ -133,7 +133,7 @@ public class PageDescComposite extends Composite { //parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(parent); Label label = new Label(parent, 0); - label.setText("Size:"); + label.setText(Messages.PageDescComposite_Size); combo = new Combo(parent, 0); combo.addListener(SWT.Selection, new Listener() { @Override @@ -151,7 +151,7 @@ public class PageDescComposite extends Composite { GridDataFactory.fillDefaults().grab(true, true).grab(true, true).align(SWT.CENTER, SWT.CENTER).span(1, 2).applyTo(marginComposite); GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).spacing(3, 3).applyTo(marginComposite); label = new Label(marginComposite, 0); - label.setText("Margins (mm)"); + label.setText(Messages.PageDescComposite_MarginsMM); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.TOP).span(3, 1).applyTo(label); label = new Label(marginComposite, 0); @@ -203,14 +203,14 @@ public class PageDescComposite extends Composite { addMarginListeners(); label = new Label(parent, 0); - label.setText("Orientation:"); + label.setText(Messages.PageDescComposite_Orientation); Composite comp = new Composite(parent, 0); GridDataFactory.fillDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(comp); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(comp); portrait = new Button(comp, SWT.RADIO); landscape = new Button(comp, SWT.RADIO); - portrait.setText("Portrait"); - landscape.setText("Landscape"); + portrait.setText(Messages.PageDescComposite_Portrait); + landscape.setText(Messages.PageDescComposite_Landscape); Listener orientationListener = new Listener() { @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java index 94c03494b..ee7382cb3 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java @@ -73,7 +73,7 @@ public class PageSettingsDialog extends Dialog { @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); - newShell.setText("Page Settings"); + newShell.setText(Messages.PageSettingsDialog_PageSettings); } @Override @@ -81,27 +81,27 @@ public class PageSettingsDialog extends Dialog { Composite composite = (Composite) super.createDialogArea(parent); Group group = new Group(composite, SWT.NONE); - group.setText("Grid Snapping"); + group.setText(Messages.PageSettingsDialog_GridSnapping); GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(group); Label label = new Label(group, SWT.NONE); - label.setText("Grid size (mm)"); + label.setText(Messages.PageSettingsDialog_GridSizeMM); gridSizeText = new Text(group, SWT.SINGLE|SWT.BORDER); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(group); GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(gridSizeText); Group pageGroup = new Group(composite, SWT.NONE); - pageGroup.setText("Page size"); + pageGroup.setText(Messages.PageSettingsDialog_PageSize); pdc = new PageDescComposite(pageGroup, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(pageGroup); GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(pageGroup); GridDataFactory.fillDefaults().grab(true, true).span(1, 1).applyTo(pdc); Group displayGroup = new Group(composite, SWT.NONE); - displayGroup.setText("Display"); + displayGroup.setText(Messages.PageSettingsDialog_Display); showBordersButton = new Button(displayGroup, SWT.CHECK); - showBordersButton.setText("Show page borders"); + showBordersButton.setText(Messages.PageSettingsDialog_ShowPageBorders); showMarginsButton = new Button(displayGroup, SWT.CHECK); - showMarginsButton.setText("Show margins"); + showMarginsButton.setText(Messages.PageSettingsDialog_ShowMargins); GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(displayGroup); GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(displayGroup); @@ -162,13 +162,13 @@ public class PageSettingsDialog extends Dialog { @Override public void perform(WriteGraph graph) throws DatabaseException { Resource model = graph.syncRequest(new IndexRoot(diagramResource)); - Commands.get(graph, "Simantics/PageSettings/setPageDesc") + Commands.get(graph, "Simantics/PageSettings/setPageDesc") //$NON-NLS-1$ .execute(graph, model, diagramResource, pageDesc.toRepr()); - Commands.get(graph, "Simantics/PageSettings/setGridSize") + Commands.get(graph, "Simantics/PageSettings/setGridSize") //$NON-NLS-1$ .execute(graph, model, diagramResource, gridSize); - Commands.get(graph, "Simantics/PageSettings/setPageBordersVisible") + Commands.get(graph, "Simantics/PageSettings/setPageBordersVisible") //$NON-NLS-1$ .execute(graph, model, diagramResource, borders); - Commands.get(graph, "Simantics/PageSettings/setMarginsVisible") + Commands.get(graph, "Simantics/PageSettings/setMarginsVisible") //$NON-NLS-1$ .execute(graph, model, diagramResource, margins); } }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ResetProfileMonitorTransformContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ResetProfileMonitorTransformContribution.java index 19cb9ffa0..30615db96 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ResetProfileMonitorTransformContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ResetProfileMonitorTransformContribution.java @@ -29,7 +29,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils; */ public class ResetProfileMonitorTransformContribution extends DynamicMenuContribution implements IExecutableExtension { - String name = ""; + String name = ""; //$NON-NLS-1$ ImageDescriptor image = null; @Override @@ -38,8 +38,8 @@ public class ResetProfileMonitorTransformContribution extends DynamicMenuContrib if (data instanceof Map) { @SuppressWarnings("unchecked") Map args = (Map) data; - name = args.get("name"); - String imageId = args.get("image"); + name = args.get("name"); //$NON-NLS-1$ + String imageId = args.get("image"); //$NON-NLS-1$ image = Activator.getDefault().getImageRegistry().getDescriptor(imageId); } } @@ -75,7 +75,7 @@ public class ResetProfileMonitorTransformContribution extends DynamicMenuContrib Simantics.async(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { - Command cmd = Commands.get(graph, "Simantics/Profile/resetProfileMonitorPosition"); + Command cmd = Commands.get(graph, "Simantics/Profile/resetProfileMonitorPosition"); //$NON-NLS-1$ Resource model = graph.syncRequest(new IndexRoot((Resource)elements[0])); for(Object element : elements) cmd.execute(graph, model, element); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SetFocusabilityContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SetFocusabilityContribution.java index d6570a68f..6441cdd4c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SetFocusabilityContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SetFocusabilityContribution.java @@ -27,7 +27,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; */ public class SetFocusabilityContribution extends DynamicMenuContribution implements IExecutableExtension { - String name = ""; + String name = ""; //$NON-NLS-1$ ImageDescriptor image = null; boolean allow = true; @@ -37,10 +37,10 @@ public class SetFocusabilityContribution extends DynamicMenuContribution impleme if (data instanceof Map) { @SuppressWarnings("unchecked") Map args = (Map) data; - name = args.get("name"); - String imageId = args.get("image"); + name = args.get("name"); //$NON-NLS-1$ + String imageId = args.get("image"); //$NON-NLS-1$ image = Activator.getDefault().getImageRegistry().getDescriptor(imageId); - allow = Boolean.parseBoolean(args.get("allow")); + allow = Boolean.parseBoolean(args.get("allow")); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SliderClass.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SliderClass.java index 60f28f17b..a7329a979 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SliderClass.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SliderClass.java @@ -68,23 +68,23 @@ import org.simantics.utils.strings.format.MetricsFormatList; * @author J-P Laine */ public class SliderClass { - public static final Key KEY_SLIDER_RESOURCE_PATH = new KeyOf(Collection.class, "SLIDER_RESOURCE_PATH"); - public static final Key KEY_SLIDER_COMPONENT = new KeyOf(Object.class, "SLIDER_COMPONENT"); - public static final Key KEY_SLIDER_SUFFIX = new KeyOf(String.class, "SLIDER_SUFFIX"); - public static final Key KEY_SLIDER_RANGE = new KeyOf(Range.class, "SLIDER_SUBSTITUTIONS"); - public static final Key KEY_SLIDER_GC = new KeyOf(Graphics2D.class, "SLIDER_GC"); - public static final Key KEY_SLIDER_VALUE = new KeyOf(Double.class, "SLIDER_VALUE"); - public static final Key KEY_TOOLTIP_TEXT = new KeyOf(String.class, "TOOLTIP_TEXT"); - public static final Key KEY_NUMBER_FORMAT = new KeyOf(MetricsFormat.class, "NUMBER_FORMAT"); + public static final Key KEY_SLIDER_RESOURCE_PATH = new KeyOf(Collection.class, "SLIDER_RESOURCE_PATH"); //$NON-NLS-1$ + public static final Key KEY_SLIDER_COMPONENT = new KeyOf(Object.class, "SLIDER_COMPONENT"); //$NON-NLS-1$ + public static final Key KEY_SLIDER_SUFFIX = new KeyOf(String.class, "SLIDER_SUFFIX"); //$NON-NLS-1$ + public static final Key KEY_SLIDER_RANGE = new KeyOf(Range.class, "SLIDER_SUBSTITUTIONS"); //$NON-NLS-1$ + public static final Key KEY_SLIDER_GC = new KeyOf(Graphics2D.class, "SLIDER_GC"); //$NON-NLS-1$ + public static final Key KEY_SLIDER_VALUE = new KeyOf(Double.class, "SLIDER_VALUE"); //$NON-NLS-1$ + public static final Key KEY_TOOLTIP_TEXT = new KeyOf(String.class, "TOOLTIP_TEXT"); //$NON-NLS-1$ + public static final Key KEY_NUMBER_FORMAT = new KeyOf(MetricsFormat.class, "NUMBER_FORMAT"); //$NON-NLS-1$ /** * If this hint is defined, the monitor will force its x-axis to match this * angle. If this hint doesn't exist, the monitor will not force x-axis * orientation. */ - public static final Key KEY_DIRECTION = new KeyOf(Double.class, "SLIDER_DIRECTION"); + public static final Key KEY_DIRECTION = new KeyOf(Double.class, "SLIDER_DIRECTION"); //$NON-NLS-1$ - public static final Key KEY_SG_NODE = new SceneGraphNodeKey(Node.class, "SLIDER_SG_NODE"); + public static final Key KEY_SG_NODE = new SceneGraphNodeKey(Node.class, "SLIDER_SG_NODE"); //$NON-NLS-1$ public final static MetricsFormat DEFAULT_NUMBER_FORMAT = MetricsFormatList.METRICS_DECIMAL; public static class Range { @@ -420,7 +420,7 @@ public class SliderClass { @Override public Node init(G2DParentNode parent) { - SliderNode node = parent.getOrCreateNode(""+hashCode(), SliderNode.class); + SliderNode node = parent.getOrCreateNode(""+hashCode(), SliderNode.class); //$NON-NLS-1$ node.setValue(0); node.setBounds(new Rectangle2D.Double(0, 0, 50, 22)); node.setTransform(AffineTransform.getScaleInstance(staticScaleX, staticScaleY)); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ToggleProfileMonitorsContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ToggleProfileMonitorsContribution.java index 81bac0b7d..0cef57cc2 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ToggleProfileMonitorsContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ToggleProfileMonitorsContribution.java @@ -29,7 +29,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils; */ public class ToggleProfileMonitorsContribution extends DynamicMenuContribution implements IExecutableExtension { - String name = ""; + String name = ""; //$NON-NLS-1$ ImageDescriptor image = null; boolean allow = true; @@ -39,10 +39,10 @@ public class ToggleProfileMonitorsContribution extends DynamicMenuContribution i if (data instanceof Map) { @SuppressWarnings("unchecked") Map args = (Map) data; - name = args.get("name"); - String imageId = args.get("image"); + name = args.get("name"); //$NON-NLS-1$ + String imageId = args.get("image"); //$NON-NLS-1$ image = Activator.getDefault().getImageRegistry().getDescriptor(imageId); - allow = Boolean.parseBoolean(args.get("allow")); + allow = Boolean.parseBoolean(args.get("allow")); //$NON-NLS-1$ } } @@ -81,7 +81,7 @@ public class ToggleProfileMonitorsContribution extends DynamicMenuContribution i @Override public void perform(WriteGraph graph) throws DatabaseException { - Command command = Commands.get(graph, "Simantics/Diagram/showProfileMonitors"); + Command command = Commands.get(graph, "Simantics/Diagram/showProfileMonitors"); //$NON-NLS-1$ for(Object object : elements) { Resource element = (Resource)object; command.execute(graph, graph.syncRequest(new IndexRoot(element)), element, allow); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/UpDownProfileMonitorsContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/UpDownProfileMonitorsContribution.java index eda7fc977..a9b1d6b87 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/UpDownProfileMonitorsContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/UpDownProfileMonitorsContribution.java @@ -29,7 +29,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils; */ public class UpDownProfileMonitorsContribution extends DynamicMenuContribution implements IExecutableExtension { - String name = ""; + String name = ""; //$NON-NLS-1$ ImageDescriptor image = null; boolean allow = true; @@ -39,10 +39,10 @@ public class UpDownProfileMonitorsContribution extends DynamicMenuContribution i if (data instanceof Map) { @SuppressWarnings("unchecked") Map args = (Map) data; - name = args.get("name"); - String imageId = args.get("image"); + name = args.get("name"); //$NON-NLS-1$ + String imageId = args.get("image"); //$NON-NLS-1$ image = Activator.getDefault().getImageRegistry().getDescriptor(imageId); - allow = Boolean.parseBoolean(args.get("allow")); + allow = Boolean.parseBoolean(args.get("allow")); //$NON-NLS-1$ } } @@ -81,7 +81,7 @@ public class UpDownProfileMonitorsContribution extends DynamicMenuContribution i @Override public void perform(WriteGraph graph) throws DatabaseException { - Command command = Commands.get(graph, "Simantics/Diagram/setProfileMonitorsDirectionUp"); + Command command = Commands.get(graph, "Simantics/Diagram/setProfileMonitorsDirectionUp"); //$NON-NLS-1$ for(Object object : elements) { Resource element = (Resource)object; command.execute(graph, graph.syncRequest(new IndexRoot(element)), element, allow); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ValueFormatUtil.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ValueFormatUtil.java index 8a541eefc..5b324dd65 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ValueFormatUtil.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ValueFormatUtil.java @@ -20,14 +20,14 @@ public final class ValueFormatUtil { static String valueStr(Object value_) { if (value_ == null) - return ""; + return ""; //$NON-NLS-1$ //return valueStr(value_, "0.0###"); return valueStr(value_, MetricsFormatList.METRICS_GENERIC); } public static String valueStr(Object value_, MetricsFormat decimalFormat) { if (value_ == null) - return ""; + return ""; //$NON-NLS-1$ Class clazz = value_.getClass(); //System.out.println("FOO: " + clazz + ": " + value_); @@ -77,7 +77,7 @@ public final class ValueFormatUtil { boolean first = true; for (double d : ds) { if (!first) - sb.append(", "); + sb.append(", "); //$NON-NLS-1$ else first = false; //sb.append(format.format(d)); @@ -98,7 +98,7 @@ public final class ValueFormatUtil { boolean first = true; for (float d : ds) { if (!first) - sb.append(", "); + sb.append(", "); //$NON-NLS-1$ else first = false; //sb.append(format.format(d)); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/messages.properties new file mode 100644 index 000000000..3bc44d5f6 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/messages.properties @@ -0,0 +1,12 @@ +PageDescComposite_Landscape=Landscape +PageDescComposite_MarginsMM=Margins (mm) +PageDescComposite_Orientation=Orientation: +PageDescComposite_Portrait=Portrait +PageDescComposite_Size=Size: +PageSettingsDialog_Display=Display +PageSettingsDialog_GridSizeMM=Grid size (mm) +PageSettingsDialog_GridSnapping=Grid Snapping +PageSettingsDialog_PageSettings=Page Settings +PageSettingsDialog_PageSize=Page size +PageSettingsDialog_ShowMargins=Show margins +PageSettingsDialog_ShowPageBorders=Show page borders diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/AvailableFormatFactory.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/AvailableFormatFactory.java index 5156f5014..6106a363d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/AvailableFormatFactory.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/AvailableFormatFactory.java @@ -39,7 +39,7 @@ public class AvailableFormatFactory extends ReadFactoryImpl Layer0X L0X = Layer0X.getInstance(graph); String exp = graph.getPossibleRelatedAdapter(monitor, L0X.HasExpression, String.class); - return exp != null ? exp : "value"; + return exp != null ? exp : "value"; //$NON-NLS-1$ } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/Messages.java new file mode 100644 index 000000000..3b079171f --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/Messages.java @@ -0,0 +1,27 @@ +package org.simantics.modeling.ui.diagram.monitor; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagram.monitor.messages"; //$NON-NLS-1$ + public static String MonitorComposite_Alignment; + public static String MonitorComposite_CenterAlignment; + public static String MonitorComposite_Color; + public static String MonitorComposite_FontFamily; + public static String MonitorComposite_FontSize; + public static String MonitorComposite_Formatting; + public static String MonitorComposite_LeftAlignment; + public static String MonitorComposite_ResetLocalChanges; + public static String MonitorComposite_RightAlignment; + public static String MonitorComposite_SetAsDefault; + public static String MonitorComposite_SetAsDefaultForNewlyCreatedMonitors; + public static String MonitorComposite_SetMonitorColor; + public static String MonitorComposite_Template; + 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/diagram/monitor/MonitorClassFactory2.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorClassFactory2.java index 597a125a8..c7a2b6385 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorClassFactory2.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorClassFactory2.java @@ -70,9 +70,9 @@ import org.simantics.utils.datastructures.hints.IHintContext.KeyOf; public class MonitorClassFactory2 extends SyncElementFactory { private static final Key KEY_VARIABLE_LISTENER = new KeyOf(MonitorListener.class, - "MONITOR_VARIABLE_LISTENER"); + "MONITOR_VARIABLE_LISTENER"); //$NON-NLS-1$ - private static final String CLASS_ID = "Monitor"; + private static final String CLASS_ID = "Monitor"; //$NON-NLS-1$ private static final IHintSynchronizer HINT_SYNCHRONIZER = new CompositeHintSynchronizer( MonitorSynchronizer.INSTANCE, @@ -144,7 +144,7 @@ public class MonitorClassFactory2 extends SyncElementFactory { loadParentRelationships(graph, element, e); final Map substitutions = new HashMap(); - substitutions.put("#v1", ""); + substitutions.put("#v1", ""); //$NON-NLS-1$ //$NON-NLS-2$ final Resource diagramRuntime = diagram.getHint(DiagramModelHints.KEY_DIAGRAM_RUNTIME_RESOURCE); if (diagramRuntime != null) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorComposite.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorComposite.java index 7dac7a0b0..a061d5b7a 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorComposite.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorComposite.java @@ -55,7 +55,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; public class MonitorComposite extends ConfigurationComposite { - private static final String DATA_CURRENT_COLOR = "COLOR"; + private static final String DATA_CURRENT_COLOR = "COLOR"; //$NON-NLS-1$ public void create(final Composite body, IWorkbenchSite site, final ISessionContext context, final WidgetSupport support) { final Display display = body.getDisplay(); @@ -71,7 +71,7 @@ public class MonitorComposite extends ConfigurationComposite { support.setParameter(WidgetSupport.RESOURCE_MANAGER, resourceManager); Label templateHeader = new Label(buttonComposite, support, 0); - templateHeader.setText("Template"); + templateHeader.setText(Messages.MonitorComposite_Template); //templateHeader.setFont(smallFont); templateHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(templateHeader.getWidget()); @@ -83,8 +83,8 @@ public class MonitorComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(true, false).applyTo(templateCombo.getWidget()); Button setDefaultButton = new Button(buttonComposite, support, SWT.NONE | SWT.READ_ONLY); - setDefaultButton.setText("Set As Default"); - setDefaultButton.setTooltipText("Set As Default for Newly Created Monitors"); + setDefaultButton.setText(Messages.MonitorComposite_SetAsDefault); + setDefaultButton.setTooltipText(Messages.MonitorComposite_SetAsDefaultForNewlyCreatedMonitors); setDefaultButton.addSelectionListener(new SelectionListenerImpl(context) { @Override public void apply(WriteGraph graph, Resource monitor) throws DatabaseException { @@ -102,7 +102,7 @@ public class MonitorComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(false, false).applyTo(setDefaultButton.getWidget()); Button resetButton = new Button(buttonComposite, support, SWT.NONE | SWT.READ_ONLY); - resetButton.setText("Reset Local Changes"); + resetButton.setText(Messages.MonitorComposite_ResetLocalChanges); resetButton.addSelectionListener(new SelectionListenerImpl(context) { @Override public void apply(WriteGraph graph, Resource monitor) throws DatabaseException { @@ -119,7 +119,7 @@ public class MonitorComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(false, false).applyTo(resetButton.getWidget()); Label fontHeader = new Label(buttonComposite, support, 0); - fontHeader.setText("Font Family"); + fontHeader.setText(Messages.MonitorComposite_FontFamily); //fontHeader.setFont(smallFont); fontHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(fontHeader.getWidget()); @@ -131,7 +131,7 @@ public class MonitorComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(true, false).span(3,1).applyTo(fontCombo.getWidget()); Label sizeHeader = new Label(buttonComposite, support, 0); - sizeHeader.setText("Font Size"); + sizeHeader.setText(Messages.MonitorComposite_FontSize); //sizeHeader.setFont(smallFont); sizeHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(sizeHeader.getWidget()); @@ -143,7 +143,7 @@ public class MonitorComposite extends ConfigurationComposite { GridDataFactory.fillDefaults().grab(false, false).span(3,1).minSize(50, 0).applyTo(sizeCombo.getWidget()); Label formatterHeader = new Label(buttonComposite, support, 0); - formatterHeader.setText("Formatting"); + formatterHeader.setText(Messages.MonitorComposite_Formatting); //formatterHeader.setFont(smallFont); formatterHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(formatterHeader.getWidget()); @@ -160,12 +160,12 @@ public class MonitorComposite extends ConfigurationComposite { GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).extendedMargins(5,5,5,5).applyTo(rowComposite); Label alignHeader = new Label(rowComposite, support, 0); - alignHeader.setText("Alignment"); + alignHeader.setText(Messages.MonitorComposite_Alignment); //alignHeader.setFont(smallFont); alignHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(alignHeader.getWidget()); - Bundle iconBundle = Platform.getBundle("com.famfamfam.silk"); + Bundle iconBundle = Platform.getBundle("com.famfamfam.silk"); //$NON-NLS-1$ Composite alignComposite = new Composite(rowComposite, SWT.NONE); alignComposite.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); @@ -173,25 +173,25 @@ public class MonitorComposite extends ConfigurationComposite { GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).extendedMargins(5,5,5,5).applyTo(alignComposite); Button leadButton = new Button(alignComposite, support, SWT.TOGGLE); - leadButton.setTooltipText("Left Alignment"); - leadButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_left.png"))); + leadButton.setTooltipText(Messages.MonitorComposite_LeftAlignment); + leadButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_left.png"))); //$NON-NLS-1$ leadButton.setSelectionFactory(new AlignmentSelectedFactory(G2DResource.URIs.Alignment_Leading)); leadButton.addSelectionListener(new AlignmentSelectionListener(context, G2DResource.URIs.Alignment_Leading)); Button centerButton = new Button(alignComposite, support, SWT.TOGGLE); - centerButton.setTooltipText("Center Alignment"); - centerButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_center.png"))); + centerButton.setTooltipText(Messages.MonitorComposite_CenterAlignment); + centerButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_center.png"))); //$NON-NLS-1$ centerButton.setSelectionFactory(new AlignmentSelectedFactory(G2DResource.URIs.Alignment_Center)); centerButton.addSelectionListener(new AlignmentSelectionListener(context, G2DResource.URIs.Alignment_Center)); Button trailButton = new Button(alignComposite, support, SWT.TOGGLE); - trailButton.setTooltipText("Right Alignment"); - trailButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_right.png"))); + trailButton.setTooltipText(Messages.MonitorComposite_RightAlignment); + trailButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_right.png"))); //$NON-NLS-1$ trailButton.setSelectionFactory(new AlignmentSelectedFactory(G2DResource.URIs.Alignment_Trailing)); trailButton.addSelectionListener(new AlignmentSelectionListener(context, G2DResource.URIs.Alignment_Trailing)); Label colorHeader = new Label(rowComposite, support, 0); - colorHeader.setText("Color"); + colorHeader.setText(Messages.MonitorComposite_Color); colorHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().indent(20, 0).grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(colorHeader.getWidget()); @@ -217,7 +217,7 @@ public class MonitorComposite extends ConfigurationComposite { final Resource[] resources = ResourceAdaptionUtils.toResources(input); if (resources.length != 0) { ColorDialog dialog = new ColorDialog(WorkbenchUtils.getActiveWorkbenchWindowShell(), SWT.NONE); - dialog.setText("Set Monitor Color"); + dialog.setText(Messages.MonitorComposite_SetMonitorColor); Color oldColor = (Color) control.getData(DATA_CURRENT_COLOR); if (oldColor != null) { RGB oldRgb = Colors.rgb(oldColor); @@ -301,7 +301,7 @@ public class MonitorComposite extends ConfigurationComposite { graph.claimLiteral(realizedColor, DIA.RealizedColor_HasRGB, L0.DoubleArray, color, Bindings.DOUBLE_ARRAY); } CommentMetadata cm = graph.getMetadata(CommentMetadata.class); - graph.addMetadata(cm.add("Set color to " + rgb + " for resources " + Arrays.toString(resources))); + graph.addMetadata(cm.add("Set color to " + rgb + " for resources " + Arrays.toString(resources))); //$NON-NLS-1$ //$NON-NLS-2$ } }); } catch (DatabaseException e) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorExpressionVisitor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorExpressionVisitor.java index f528035e5..3a96e1e7c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorExpressionVisitor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorExpressionVisitor.java @@ -69,32 +69,32 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { } public void outAConstantValue(AConstantValue node) { - if(DEBUG) System.out.println("outAConstantValue " + node); + if(DEBUG) System.out.println("outAConstantValue " + node); //$NON-NLS-1$ stack.push(Double.valueOf(node.toString())); } public void outAStringValue(AStringValue node) { - if(DEBUG) System.out.println("outAStringValue " + node); + if(DEBUG) System.out.println("outAStringValue " + node); //$NON-NLS-1$ String value = node.toString(); stack.push(value.substring(1, value.length() - 2)); } public void outAAddressValue(AAddressValue node) { - if(DEBUG) System.out.println("outAAddressValue " + node); + if(DEBUG) System.out.println("outAAddressValue " + node); //$NON-NLS-1$ stack.push('&' + node.getRange().toString()); } @Override public void outASingleRange(ASingleRange node) { - if(DEBUG) System.out.println("outASingleRange " + node); + if(DEBUG) System.out.println("outASingleRange " + node); //$NON-NLS-1$ } @Override public void outARviValue(ARviValue node) { - if(DEBUG) System.out.println("outARviValue " + node); + if(DEBUG) System.out.println("outARviValue " + node); //$NON-NLS-1$ String rvi = node.toString().trim(); @@ -103,7 +103,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { stack.push(format(var.getValue(graph))); } catch (DatabaseException e) { Logger.defaultLogError(e); - stack.push(""); + stack.push(""); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -111,10 +111,10 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { @Override public void outAVariablePrimary(AVariablePrimary node) { - if(DEBUG) System.out.println("outAVariablePrimary " + node); + if(DEBUG) System.out.println("outAVariablePrimary " + node); //$NON-NLS-1$ String identifier = node.toString().trim(); - if("value".equals(identifier)) { + if("value".equals(identifier)) { //$NON-NLS-1$ try { stack.push(format(variable.getValue(graph))); } catch (DatabaseException e) { @@ -128,7 +128,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { public void outARangeValue(ARangeValue node) { - if(DEBUG) System.out.println("outARangeValue " + node); + if(DEBUG) System.out.println("outARangeValue " + node); //$NON-NLS-1$ String identifier = node.getRange().toString().trim(); stack.push(identifier); @@ -138,7 +138,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { private String format(Object o) { if(formatter != null) return formatter.format(o); - else return o != null ? o.toString() : ""; + else return o != null ? o.toString() : ""; //$NON-NLS-1$ } private double extractValue(Object o) { @@ -170,7 +170,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { public void outAPlusExpression(APlusExpression node) { - if(DEBUG) System.out.println("outAPlusExpression " + node); + if(DEBUG) System.out.println("outAPlusExpression " + node); //$NON-NLS-1$ Object o2 = stack.pop(); Object o1 = stack.pop(); @@ -182,7 +182,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { public void outAMultMultiplicative(AMultMultiplicative node) { - if(DEBUG) System.out.println("outAMultiplicative " + node); + if(DEBUG) System.out.println("outAMultiplicative " + node); //$NON-NLS-1$ Object o1 = stack.pop(); Object o2 = stack.pop(); @@ -203,14 +203,14 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { public void outAFunctionPrimary(AFunctionPrimary node) { - if(DEBUG) System.out.println("outAFunctionPrimary " + node); + if(DEBUG) System.out.println("outAFunctionPrimary " + node); //$NON-NLS-1$ try { - String functionName = node.getFunc().getText().replace("(", ""); + String functionName = node.getFunc().getText().replace("(", ""); //$NON-NLS-1$ //$NON-NLS-2$ if (DEBUG_APPLICATION) - System.out.println("function apply " + functionName); + System.out.println("function apply " + functionName); //$NON-NLS-1$ Function function = builtins.get(functionName); if (function != null) { @@ -261,7 +261,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter { } else { //stack.push(null); - throw new EvaluationException("Function not found in dependencies: '" + functionName + "'"); + throw new EvaluationException("Function not found in dependencies: '" + functionName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorListener.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorListener.java index 076c97f87..21c13a298 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorListener.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorListener.java @@ -42,13 +42,13 @@ public class MonitorListener implements Listener, Runnable public MonitorListener(Resource element, ICanvasContext canvas, IDiagram diagram, Map substitutions) { if (element == null) - throw new NullPointerException("null element"); + throw new NullPointerException("null element"); //$NON-NLS-1$ if (canvas == null) - throw new NullPointerException("null canvas"); + throw new NullPointerException("null canvas"); //$NON-NLS-1$ if (diagram == null) - throw new NullPointerException("null diagram"); + throw new NullPointerException("null diagram"); //$NON-NLS-1$ if (substitutions == null) - throw new NullPointerException("null substitutions"); + throw new NullPointerException("null substitutions"); //$NON-NLS-1$ this.element = element; this.canvas = canvas; this.diagram = diagram; @@ -118,12 +118,12 @@ public class MonitorListener implements Listener, Runnable // finished. MonitorVariableValue result = lastScheduledUpdate.getAndSet(null); - String value = ""; + String value = ""; //$NON-NLS-1$ if (result != null) { if (result.getValue() != null) { value = result.getValue();//ValueFormatUtil.valueStr(result.getValue(), format); } else { - value = ""; + value = ""; //$NON-NLS-1$ } el.setHint(MonitorClass.KEY_MONITOR_COMPONENT, result.getMonitorVariable().getMonitorComponent()); ElementUtils.setOrRemoveHint(el, MonitorClass.KEY_MONITOR_IS_EXTERNAL, result.getMonitorVariable().isExternal()); @@ -132,7 +132,7 @@ public class MonitorListener implements Listener, Runnable el.removeHint(MonitorClass.KEY_MONITOR_IS_EXTERNAL); } - substitutions.put("#v1", value); + substitutions.put("#v1", value); //$NON-NLS-1$ final Map subs = el.getHint(MonitorClass.KEY_MONITOR_SUBSTITUTIONS); if (substitutions != subs) diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorValue.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorValue.java index 92adb5cfa..e7c3236e2 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorValue.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorValue.java @@ -37,7 +37,7 @@ final public class MonitorValue extends TernaryReadgetPossibleRelatedValue(componentType, L0X.HasGeneratedNamePrefix, Bindings.STRING) - : ""; + : ""; //$NON-NLS-1$ entries.add(new NameEntry(component, name, name, componentTypePrefix)); } Collections.sort(entries); @@ -98,7 +98,7 @@ public class ComponentsRenamingModel { } }); } catch (DatabaseException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "validateNewNames failed, see exception for details", e)); + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "validateNewNames failed, see exception for details", e)); //$NON-NLS-1$ } } else { if (reset) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/Messages.java new file mode 100644 index 000000000..0afa0660b --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/Messages.java @@ -0,0 +1,22 @@ +package org.simantics.modeling.ui.diagram.renaming; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagram.renaming.messages"; //$NON-NLS-1$ + public static String ComponentsRenamingDialog_ClearSelectionAnd; + public static String ComponentsRenamingDialog_NewName; + public static String ComponentsRenamingDialog_NewNamePrefixAnd; + public static String ComponentsRenamingDialog_OldName; + public static String ComponentsRenamingDialog_OldNamePrefix; + public static String ComponentsRenamingDialog_RenameDiagramContents; + public static String ComponentsRenamingDialog_ResetNamesAnd; + public static String ComponentsRenamingDialog_SelectAllAnd; + 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/diagram/renaming/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/messages.properties new file mode 100644 index 000000000..1949812a0 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/messages.properties @@ -0,0 +1,8 @@ +ComponentsRenamingDialog_ClearSelectionAnd=&Clear Selection +ComponentsRenamingDialog_NewName=New name +ComponentsRenamingDialog_NewNamePrefixAnd=&New name prefix: +ComponentsRenamingDialog_OldName=Old name +ComponentsRenamingDialog_OldNamePrefix=Old name prefix: +ComponentsRenamingDialog_RenameDiagramContents=Rename diagram contents +ComponentsRenamingDialog_ResetNamesAnd=&Reset names +ComponentsRenamingDialog_SelectAllAnd=Select &All diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/ConnectionPointNameStyle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/ConnectionPointNameStyle.java index d86925e48..57b0bd9b8 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/ConnectionPointNameStyle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/ConnectionPointNameStyle.java @@ -66,10 +66,10 @@ public class ConnectionPointNameStyle extends StyleBase> 1); @@ -171,7 +171,7 @@ public class ConnectionPointNameStyle extends StyleBase { - private static final String DECORATION_NODE_NAME = "documentDecorations"; + private static final String DECORATION_NODE_NAME = "documentDecorations"; //$NON-NLS-1$ private Set getContexts(ReadGraph graph, Resource element) throws DatabaseException { @@ -72,11 +72,11 @@ public class DocumentDecorationStyle extends StyleBase { @Override public void applyStyleForNode(EvaluationContext observer, INode node, DocumentResult result) { if (result == null) { - ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); + ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$ return; } - SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer); + SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer); //$NON-NLS-1$ Rectangle2D bounds = NodeUtil.getLocalBounds(node, Decoration.class); @@ -92,12 +92,12 @@ public class DocumentDecorationStyle extends StyleBase { @Override protected void cleanupStyleForNode(INode node) { - ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); + ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$ } @Override public String toString() { - return "Document decoration"; + return "Document decoration"; //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/IssueDecorationStyle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/IssueDecorationStyle.java index 0200af96e..d473ff46d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/IssueDecorationStyle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/IssueDecorationStyle.java @@ -48,7 +48,7 @@ import org.simantics.utils.datastructures.map.Tuple; */ public class IssueDecorationStyle extends StyleBase { - private static final String DECORATION_NODE_NAME = "issueDecorations"; + private static final String DECORATION_NODE_NAME = "issueDecorations"; //$NON-NLS-1$ private List getContexts(ReadGraph graph, Resource element) throws DatabaseException { @@ -93,11 +93,11 @@ public class IssueDecorationStyle extends StyleBase { @Override public void applyStyleForNode(EvaluationContext observer, INode node, IssueResult result) { if (result == null) { - ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); + ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$ return; } - SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer); + SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer); //$NON-NLS-1$ svgNode.setZIndex( Integer.MAX_VALUE ); svgNode.setTransform(getDecorationPosition(node)); @@ -135,12 +135,12 @@ public class IssueDecorationStyle extends StyleBase { @Override protected void cleanupStyleForNode(INode node) { - ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); + ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$ } @Override public String toString() { - return "Issue decoration"; + return "Issue decoration"; //$NON-NLS-1$ } /** diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/SymbolTerminalNameStyle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/SymbolTerminalNameStyle.java index 57ae0b8c5..002cffab9 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/SymbolTerminalNameStyle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/SymbolTerminalNameStyle.java @@ -41,9 +41,9 @@ import org.simantics.utils.datastructures.map.Tuple; */ public class SymbolTerminalNameStyle extends StyleBase { - static final Font FONT = Font.decode("Arial 6"); + static final Font FONT = Font.decode("Arial 6"); //$NON-NLS-1$ - private static final String NODE_NAME = "terminalName"; + private static final String NODE_NAME = "terminalName"; //$NON-NLS-1$ /** * Must override the StyleBase implementation because terminals do not @@ -88,7 +88,7 @@ public class SymbolTerminalNameStyle extends StyleBase { private AffineTransform getSymbolTransform(INode node, Vec2d offset, double size) { if(node instanceof SingleElementNode) { SingleElementNode s = (SingleElementNode)node; - INode symbol = NodeUtil.findChildByPrefix(s, "composite_image"); + INode symbol = NodeUtil.findChildByPrefix(s, "composite_image"); //$NON-NLS-1$ return translateAndScaleIfNeeded(symbol != null ? ((IG2DNode)symbol).getTransform() : new AffineTransform(), offset, size); } return null; @@ -98,11 +98,11 @@ public class SymbolTerminalNameStyle extends StyleBase { public void applyStyleForNode(EvaluationContext observer, INode _node, SymbolNameResult result) { if (result == null) { - ProfileVariables.denyChild(_node, "", NODE_NAME); + ProfileVariables.denyChild(_node, "", NODE_NAME); //$NON-NLS-1$ return; } - TextNode node = ProfileVariables.claimChild(_node, "", NODE_NAME, TextNode.class, observer); + TextNode node = ProfileVariables.claimChild(_node, "", NODE_NAME, TextNode.class, observer); //$NON-NLS-1$ node.setZIndex( Integer.MAX_VALUE ); node.setTransform( getSymbolTransform(_node, new Vec2d(0, -1), 0.08) ); @@ -115,7 +115,7 @@ public class SymbolTerminalNameStyle extends StyleBase { @Override protected void cleanupStyleForNode(INode node) { - ProfileVariables.denyChild(node, "", NODE_NAME); + ProfileVariables.denyChild(node, "", NODE_NAME); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/TypicalInheritanceStyle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/TypicalInheritanceStyle.java index d93264f46..f29167653 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/TypicalInheritanceStyle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/TypicalInheritanceStyle.java @@ -145,7 +145,7 @@ public class TypicalInheritanceStyle extends StyleBase ShapeNode node = null; if (_node instanceof ParentNode) { - node = ProfileVariables.claimChild(_node, "", "typical", DecorationShapeNode.class, context); + node = ProfileVariables.claimChild(_node, "", "typical", DecorationShapeNode.class, context); //$NON-NLS-1$ //$NON-NLS-2$ } else { // Ignore, cannot create decoration. return; @@ -225,8 +225,8 @@ public class TypicalInheritanceStyle extends StyleBase @Override protected void cleanupStyleForNode(EvaluationContext context, INode node) { - ProfileVariables.denyChild(node, "*", "typical"); - ProfileVariables.denyChild(node, "", "typical"); + ProfileVariables.denyChild(node, "*", "typical"); //$NON-NLS-1$ //$NON-NLS-2$ + ProfileVariables.denyChild(node, "", "typical"); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DefaultTerminalNamingStrategy.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DefaultTerminalNamingStrategy.java index b24970ffd..158a3af54 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DefaultTerminalNamingStrategy.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DefaultTerminalNamingStrategy.java @@ -34,7 +34,7 @@ public final class DefaultTerminalNamingStrategy implements TerminalNamingStrate public String getName(ReadGraph graph, TerminalInfo info) throws DatabaseException { Terminal t = graph.syncRequest(new ResolveTerminal(info)); if (t == null) - return "Could not resolve component terminal"; + return "Could not resolve component terminal"; //$NON-NLS-1$ return graph.syncRequest(new TerminalMessage(t)); } @@ -90,12 +90,12 @@ public final class DefaultTerminalNamingStrategy implements TerminalNamingStrate if (name.equals(label)) { sb.append(name); } else { - sb.append("(").append(name).append(") ").append(label); + sb.append("(").append(name).append(") ").append(label); //$NON-NLS-1$ //$NON-NLS-2$ } - sb.append(" [").append(componentName); + sb.append(" [").append(componentName); //$NON-NLS-1$ if (componentTypeName != null) - sb.append(" : ").append(componentTypeName); - sb.append("]"); + sb.append(" : ").append(componentTypeName); //$NON-NLS-1$ + sb.append("]"); //$NON-NLS-1$ return sb.toString(); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramEditor.java index 60dc7f599..ddba8ebfb 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramEditor.java @@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; @@ -84,7 +85,7 @@ public class DiagramEditor extends EditorPart implements IResourceEditorPart2, I * * @see #setInitializationData(IConfigurationElement, String, Object) */ - public static final String ARG_VIEWER = "viewer"; + public static final String ARG_VIEWER = "viewer"; //$NON-NLS-1$ private Composite parent; @@ -120,16 +121,16 @@ public class DiagramEditor extends EditorPart implements IResourceEditorPart2, I if (data instanceof String) { viewerContributor = cfig.getContributor().getName(); - String[] parameters = ((String) data).split(";"); + String[] parameters = ((String) data).split(";"); //$NON-NLS-1$ for (String parameter : parameters) { - String[] keyValue = parameter.split("="); + String[] keyValue = parameter.split("="); //$NON-NLS-1$ if (keyValue.length > 2) { - ErrorLogger.defaultLogWarning("Invalid parameter '" + parameter + ". Complete view argument: " + data, null); + ErrorLogger.defaultLogWarning(NLS.bind(Messages.DiagramEditor_InvalidParameter, parameter, data), null); continue; } String key = keyValue[0]; - String value = keyValue.length > 1 ? keyValue[1] : ""; + String value = keyValue.length > 1 ? keyValue[1] : ""; //$NON-NLS-1$ if (ARG_VIEWER.equals(key)) { viewerClassName = value; @@ -141,25 +142,25 @@ public class DiagramEditor extends EditorPart implements IResourceEditorPart2, I protected DiagramViewer createViewer() throws PartInitException { if (viewerClassName == null) throw new PartInitException( - "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '" - + viewerContributor + "'"); + "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '" //$NON-NLS-1$ + + viewerContributor + "'"); //$NON-NLS-1$ try { Bundle b = Platform.getBundle(viewerContributor); if (b == null) - throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '" - + viewerContributor + "' was not found in the platform."); + throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + viewerContributor + "' was not found in the platform."); //$NON-NLS-1$ Class clazz = b.loadClass(viewerClassName); if (!DiagramViewer.class.isAssignableFrom(clazz)) - throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to " - + DiagramViewer.class + "."); + throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to " //$NON-NLS-1$ //$NON-NLS-2$ + + DiagramViewer.class + "."); //$NON-NLS-1$ Constructor ctor = clazz.getConstructor(); return (DiagramViewer) ctor.newInstance(); } catch (Exception e) { - throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName - + "' from bundle '" + viewerContributor + "'. See exception for details.", e); + throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName //$NON-NLS-1$ + + "' from bundle '" + viewerContributor + "'. See exception for details.", e); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramLayersPage.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramLayersPage.java index 1632f32ca..895c4bfa2 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramLayersPage.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramLayersPage.java @@ -73,15 +73,15 @@ import org.simantics.utils.ui.ISelectionUtils; public class DiagramLayersPage extends Page implements ILayersViewPage { - private static final String TEXT_APPLY_FOCUS_SETTINGS = "Focus Active"; - private static final String TOOLTIP_APPLY_FOCUS_SETTINGS = "Only Focus Diagram Elements For Active Roles"; - private static final String TEXT_IGNORE_FOCUS_SETTINGS = "Focus All"; - private static final String TOOLTIP_IGNORE_FOCUS_SETTINGS = "Focus All Diagram Elements Regardless Of Active Roles"; + private static final String TEXT_APPLY_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusActive; + private static final String TOOLTIP_APPLY_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusActiveTT; + private static final String TEXT_IGNORE_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusAll; + private static final String TOOLTIP_IGNORE_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusAllTT; - private static final String TEXT_APPLY_VISIBILITY_SETTINGS = "Show Active"; - private static final String TOOLTIP_APPLY_VISIBILITY_SETTINGS = "Only Show Diagram Elements For Active Roles"; - private static final String TEXT_IGNORE_VISIBILITY_SETTINGS = "Show All"; - private static final String TOOLTIP_IGNORE_VISIBILITY_SETTINGS = "Show All Diagram Elements Regardless Of Active Roles"; + private static final String TEXT_APPLY_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowActive; + private static final String TOOLTIP_APPLY_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowActiveTT; + private static final String TEXT_IGNORE_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowAll; + private static final String TOOLTIP_IGNORE_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowAllTT; final private ICanvasContext context; final private IDiagram diagram; @@ -107,7 +107,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { boolean toBoolean() { switch (this) { case Both: - throw new IllegalStateException("cannot convert Tristate Both to boolean"); + throw new IllegalStateException("cannot convert Tristate Both to boolean"); //$NON-NLS-1$ case False: return false; case True: @@ -305,8 +305,8 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { GridLayoutFactory.fillDefaults().numColumns(4).applyTo(composite); Button addButton = new Button(composite, SWT.NONE); - addButton.setText("New"); - addButton.setToolTipText("Create New Diagram Role"); + addButton.setText(Messages.DiagramLayersPage_New); + addButton.setToolTipText(Messages.DiagramLayersPage_NewTT); addButton.addSelectionListener(new SelectionListener() { String findFreshName(ILayers layers, String proposal) { @@ -324,13 +324,13 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { if (!match) return name; ++i; - name = proposal + " " + i; + name = proposal + " " + i; //$NON-NLS-1$ } } @Override public void widgetSelected(SelectionEvent e) { - String name = findFreshName(layers, "New Role"); + String name = findFreshName(layers, Messages.DiagramLayersPage_NewRole); SimpleLayer layer = new SimpleLayer(name); layers.addLayer(layer); layers.activate(layer); @@ -344,8 +344,8 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { }); final Button removeButton = new Button(composite, SWT.NONE); - removeButton.setText("Remove"); - removeButton.setToolTipText("Remove Selected Diagram Role"); + removeButton.setText(Messages.DiagramLayersPage_Remove); + removeButton.setToolTipText(Messages.DiagramLayersPage_RemoveTT); removeButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { @@ -475,19 +475,19 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { viewer = new CheckboxTreeViewer(composite, SWT.BORDER | SWT.FULL_SELECTION ); GridDataFactory.fillDefaults().grab(true, true).span(4, 1).applyTo(viewer.getControl()); - viewer.getControl().setToolTipText("Selects the diagram to include in the exported document."); + viewer.getControl().setToolTipText(Messages.DiagramLayersPage_SelectTT); viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS); viewer.getTree().setHeaderVisible(true); editor = new TreeEditor(viewer.getTree()); final TreeColumn column1 = new TreeColumn(viewer.getTree(), SWT.LEFT); - column1.setText("Role"); + column1.setText(Messages.DiagramLayersPage_Role); column1.setWidth(100); final TreeColumn column2 = new TreeColumn(viewer.getTree(), SWT.LEFT); - column2.setText("Show"); + column2.setText(Messages.DiagramLayersPage_Show); column2.setWidth(50); final TreeColumn column3 = new TreeColumn(viewer.getTree(), SWT.LEFT); - column3.setText("Focus"); + column3.setText(Messages.DiagramLayersPage_Focus); column3.setWidth(50); viewer.getTree().addListener(SWT.Resize, new Listener() { @Override @@ -551,7 +551,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { // FIXME: Eclipse currently eats F2 presses. This should be // implemented as a command handler or find some way to // force these listeners to have priority... - System.out.println("startediting"); + System.out.println("startediting"); //$NON-NLS-1$ TreeItem[] items = viewer.getTree().getSelection(); if(items.length != 1) @@ -685,7 +685,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { ILayer layer = (ILayer)cell.getElement(); cell.setText(layer.getName()); } else { - cell.setText(""); + cell.setText(""); //$NON-NLS-1$ } } }); @@ -761,7 +761,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage { if(layer instanceof IEditableLayer) { IEditableLayer l = (IEditableLayer)layer; l.setName(text.getText()); - System.out.println("renamed layer to " + text.getText()); + System.out.println("renamed layer to " + text.getText()); //$NON-NLS-1$ viewer.refresh(); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramOutlinePage.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramOutlinePage.java index 289df6b88..8e6776956 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramOutlinePage.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramOutlinePage.java @@ -97,7 +97,7 @@ public class DiagramOutlinePage extends Page implements IContentOutlinePage, IPo this.explorer = GraphExplorerFactory.getInstance().selectionDataResolver(new DefaultSelectionDataResolver()).create(composite); Control control = explorer.getControl(); ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class); - new ContextMenuInitializer("#GraphExplorerPopup").createContextMenu(control, selectionProvider, getSite()); + new ContextMenuInitializer("#GraphExplorerPopup").createContextMenu(control, selectionProvider, getSite()); //$NON-NLS-1$ GridDataFactory.fillDefaults().grab(true, true).applyTo(control); // Consider ENTER presses to simulate mouse left button double clicks @@ -223,7 +223,7 @@ public class DiagramOutlinePage extends Page implements IContentOutlinePage, IPo static class LinkWithEditor extends LinkWithEditorContribution { public LinkWithEditor() { - super("DiagramOutlinePage.linkWithEditor", Activator.getDefault().getPreferenceStore()); + super("DiagramOutlinePage.linkWithEditor", Activator.getDefault().getPreferenceStore()); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java index 92d46e160..e773a7a63 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java @@ -184,8 +184,8 @@ public class DiagramViewer void doSetTitleToolTip(String name); } - public static final String DIAGRAMMING_CONTEXT = "org.simantics.modeling.ui.diagramming"; - private static final String PREFERENCE_VIRTUAL_GRAPH = "preferences"; + public static final String DIAGRAMMING_CONTEXT = "org.simantics.modeling.ui.diagramming"; //$NON-NLS-1$ + private static final String PREFERENCE_VIRTUAL_GRAPH = "preferences"; //$NON-NLS-1$ private static final boolean PROFILE = false; @@ -348,7 +348,7 @@ public class DiagramViewer try { return BrowseContext.getBrowseContextClosure(Simantics.getSession(), defaultPropertyBrowseContexts); } catch (DatabaseException e) { - ExceptionUtils.logAndShowError("Failed to load modeled browse contexts for property page, see exception for details.", e); + ExceptionUtils.logAndShowError(Messages.DiagramViewer_FailedtoLoadModeled, e); return defaultPropertyBrowseContexts; } } @@ -358,7 +358,7 @@ public class DiagramViewer } protected String getPopupId() { - return "#ModelingDiagramPopup"; + return "#ModelingDiagramPopup"; //$NON-NLS-1$ } protected void getPreferences() { @@ -422,7 +422,7 @@ public class DiagramViewer resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent); c = new SWTChassis(parent, 0); - Object task = BEGIN("DV.precreateParticipants"); + Object task = BEGIN("DV.precreateParticipants"); //$NON-NLS-1$ createCustomParticipants(); END(task); @@ -464,7 +464,7 @@ public class DiagramViewer swt = SWTThread.getThreadAccess(display); statusLineManager = getEditorSite().getActionBars().getStatusLineManager(); - Object task = BEGIN("DV.initSession"); + Object task = BEGIN("DV.initSession"); //$NON-NLS-1$ initSession(); END(task); @@ -483,7 +483,7 @@ public class DiagramViewer this.canvasContext = new CanvasContext(thread); this.canvasContext.setLocked(true); - task = BEGIN("DV.createChassis"); + task = BEGIN("DV.createChassis"); //$NON-NLS-1$ createChassis(parent); END(task); } catch (DatabaseException e) { @@ -513,9 +513,9 @@ public class DiagramViewer * Invoke this only from the AWT thread. */ protected void initializeCanvas() { - Object canvasInit = BEGIN("DV.canvasInitialization"); + Object canvasInit = BEGIN("DV.canvasInitialization"); //$NON-NLS-1$ - Object task = BEGIN("DV.createViewerCanvas"); + Object task = BEGIN("DV.createViewerCanvas"); //$NON-NLS-1$ initializeCanvasContext(canvasContext); END(task); @@ -532,7 +532,7 @@ public class DiagramViewer canvasContext.getHintStack().addKeyHintListener(GridPainter.KEY_GRID_ENABLED, canvasHintListener); canvasContext.getHintStack().addKeyHintListener(RulerPainter.KEY_RULER_ENABLED, canvasHintListener); - task = BEGIN("DV.setCanvasContext"); + task = BEGIN("DV.setCanvasContext"); //$NON-NLS-1$ setCanvasContext(canvasContext); END(task); @@ -557,7 +557,7 @@ public class DiagramViewer * cancelled. */ protected void performActivation(IProgressMonitor monitor) { - SubMonitor progress = SubMonitor.convert(monitor, "Activate Mapping", 100); + SubMonitor progress = SubMonitor.convert(monitor, Messages.DiagramViewer_MonitorActivateMapping, 100); IActivationManager activationManager = sessionContext.getSession().peekService(IActivationManager.class); if (activationManager != null) { activation = activationManager.activate(diagramResource); @@ -573,7 +573,7 @@ public class DiagramViewer */ protected void scheduleZoomToFit(IDiagram diagram) { if (diagram == null) - throw new IllegalStateException("diagram is null"); + throw new IllegalStateException("diagram is null"); //$NON-NLS-1$ CanvasUtils.scheduleZoomToFit(swt, () -> disposed, canvasContext, diagram); } @@ -664,7 +664,7 @@ public class DiagramViewer } }); } catch (DatabaseException e) { - throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); + throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$ } } @@ -691,7 +691,7 @@ public class DiagramViewer // unnecessary visual glitches. h.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE); - Object task = BEGIN("createSynchronizer"); + Object task = BEGIN("createSynchronizer"); //$NON-NLS-1$ this.synchronizer = createSynchronizer(ctx, sessionContext); END(task); @@ -807,7 +807,7 @@ public class DiagramViewer } }, parameter -> { if (parameter != null) - ErrorLogger.defaultLogError("Failed to write default diagram page description to database, see exception for details", parameter); + ErrorLogger.defaultLogError("Failed to write default diagram page description to database, see exception for details", parameter); //$NON-NLS-1$ }); } @@ -833,7 +833,7 @@ public class DiagramViewer protected void setDiagramDesc(ICanvasContext ctx, DiagramDesc diagramDesc) { if (diagramDesc == null) - throw new NullPointerException("null diagram desc"); + throw new NullPointerException("null diagram desc"); //$NON-NLS-1$ if (diagramDesc.equals(this.diagramDesc)) return; @@ -949,7 +949,7 @@ public class DiagramViewer public void init(DiagramViewerHost _host, IEditorSite site, IEditorInput input, DataContainer diagramContainer, WorkbenchSelectionProvider selectionProvider) { if (!(input instanceof IResourceEditorInput)) - throw new RuntimeException("Invalid input: must be IResourceEditorInput"); + throw new RuntimeException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$ setHost(_host); setSite(site); @@ -991,7 +991,7 @@ public class DiagramViewer try { return (T) DiagramTypeUtils.readSymbolProviderFactory(sessionContext.getSession(), diagramResource); } catch (DatabaseException e) { - ErrorLogger.defaultLogError(getClass() + " failed to adapt to SymbolProviderFactory, see exception for details.", e); + ErrorLogger.defaultLogError(getClass() + " failed to adapt to SymbolProviderFactory, see exception for details.", e); //$NON-NLS-1$ return null; } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerActionContributor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerActionContributor.java index 62783b655..8cb4f52c1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerActionContributor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerActionContributor.java @@ -84,24 +84,24 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor { @Override public void contributeToCoolBar(ICoolBarManager coolBarManager) { - IContributionItem item = coolBarManager.find("org.simantics.modeling.ui.diagramtoolbar"); + IContributionItem item = coolBarManager.find("org.simantics.modeling.ui.diagramtoolbar"); //$NON-NLS-1$ if (item instanceof ToolBarContributionItem) mgr = ((ToolBarContributionItem) item).getToolBarManager(); if (mgr == null) return; - pointerAction = new ModeAction("org.simantics.modeling.ui.pointerMode", Hints.POINTERTOOL); - pointerAction.setText("Pointer Mode"); + pointerAction = new ModeAction("org.simantics.modeling.ui.pointerMode", Hints.POINTERTOOL); //$NON-NLS-1$ + pointerAction.setText(Messages.DiagramViewerActionContributor_PointerMode); pointerAction.setImageDescriptor(Activator.POINTER_MODE); - connectAction = new ModeAction("org.simantics.modeling.ui.connectMode", Hints.CONNECTTOOL); - connectAction.setText("Connect Mode"); + connectAction = new ModeAction("org.simantics.modeling.ui.connectMode", Hints.CONNECTTOOL); //$NON-NLS-1$ + connectAction.setText(Messages.DiagramViewerActionContributor_ConnectMode); connectAction.setImageDescriptor(Activator.CONNECT_MODE); pointerItem = new ActionContributionItem(pointerAction); connectItem = new ActionContributionItem(connectAction); - mgr.appendToGroup("tool.additions", pointerItem); - mgr.appendToGroup("tool.additions", connectItem); + mgr.appendToGroup("tool.additions", pointerItem); //$NON-NLS-1$ + mgr.appendToGroup("tool.additions", connectItem); //$NON-NLS-1$ mgr.markDirty(); getPage().addPartListener(partListener); @@ -131,7 +131,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor { public void setActiveEditor(IEditorPart part) { if (DEBUG) - System.out.println("setActiveEditor: " + part); + System.out.println("setActiveEditor: " + part); //$NON-NLS-1$ if (part == activePart) return; @@ -146,7 +146,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor { private void setContext(IEditorPart part, ICanvasContext context) { if (DEBUG) - System.out.println("setContext: " + part + "\nNEW CONTEXT: " + context + "\nPREVIOUS CONTEXT: " + currentContext); + System.out.println("setContext: " + part + "\nNEW CONTEXT: " + context + "\nPREVIOUS CONTEXT: " + currentContext); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ICanvasContext previous = currentContext; currentContext = context; @@ -165,7 +165,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor { private void updateActionBars(IEditorPart part, IToolMode toolMode) { if (DEBUG) - System.out.println("updateActionBars: " + part + ", " + toolMode); + System.out.println("updateActionBars: " + part + ", " + toolMode); //$NON-NLS-1$ //$NON-NLS-2$ updateToolMode(toolMode); if (part != null) part.getEditorSite().getActionBars().updateActionBars(); @@ -173,7 +173,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor { private void updateToolMode(IToolMode toolMode) { if (DEBUG) - System.out.println("updateToolMode: " + toolMode); + System.out.println("updateToolMode: " + toolMode); //$NON-NLS-1$ if (toolMode != null) { pointerAction.setEnabled(true); connectAction.setEnabled(true); @@ -238,7 +238,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor { IToolMode toolMode = context.getHintStack().getHint(Hints.KEY_TOOL); if (!targetMode.equals(toolMode)) { if (DEBUG) - System.out.println("changing tool mode to " + targetMode.getId()); + System.out.println("changing tool mode to " + targetMode.getId()); //$NON-NLS-1$ context.getDefaultHintContext().setHint(Hints.KEY_TOOL, targetMode); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java index 85f0dbbe7..62b1d028f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java @@ -31,17 +31,17 @@ public class DiagramViewerLoadJob extends DatabaseJob { private DiagramViewer viewer; public DiagramViewerLoadJob(DiagramViewer viewer) { - super("Load Diagram"); + super(Messages.DiagramViewerLoadJob_LoadDiagram); setUser(true); this.viewer = viewer; } @Override protected IStatus run(final IProgressMonitor monitor) { - final SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 200); + final SubMonitor mon = SubMonitor.convert(monitor, Messages.DiagramViewerLoadJob_MonitorLoadingDiagram, 200); try { - Object task = BEGIN("DV.loadDiagram"); + Object task = BEGIN("DV.loadDiagram"); //$NON-NLS-1$ final IDiagram diagram = viewer.loadDiagram(mon.newChild(100), viewer.diagramResource); if (diagram == null) return Status.CANCEL_STATUS; @@ -49,7 +49,7 @@ public class DiagramViewerLoadJob extends DatabaseJob { // Start an activation for the input resource. // This will activate mapping if necessary. - task = BEGIN("DV.performActivation"); + task = BEGIN("DV.performActivation"); //$NON-NLS-1$ viewer.performActivation(mon.newChild(50)); END(task); @@ -58,16 +58,16 @@ public class DiagramViewerLoadJob extends DatabaseJob { @Override public void run() { setThread(viewer.canvasContext.getThreadAccess().getThread()); - mon.setTaskName("Finalize Diagram Loading"); + mon.setTaskName(Messages.DiagramViewerLoadJob_MonitorFinalizeDiagramLoading); try { - Object task = BEGIN("DV.beforeSetDiagram"); + Object task = BEGIN("DV.beforeSetDiagram"); //$NON-NLS-1$ viewer.beforeSetDiagram(diagram); mon.worked(10); END(task); - task = BEGIN("DV.setDiagramHint"); - mon.subTask("Set Diagram"); + task = BEGIN("DV.setDiagramHint"); //$NON-NLS-1$ + mon.subTask(Messages.DiagramViewerLoadJob_SetDiagram); DataContainer diagramContainer = viewer.sourceDiagramContainer; if (diagramContainer != null) diagramContainer.set( diagram ); @@ -79,24 +79,24 @@ public class DiagramViewerLoadJob extends DatabaseJob { viewer.selectionProvider.fireSelection(Collections.emptyList()); // Zoom to fit if no previous view transform is available - task = BEGIN("DV.scheduleZoomToFit"); + task = BEGIN("DV.scheduleZoomToFit"); //$NON-NLS-1$ viewer.scheduleZoomToFit(diagram); mon.worked(10); END(task); - task = BEGIN("DV.onCreated"); - mon.subTask(""); + task = BEGIN("DV.onCreated"); //$NON-NLS-1$ + mon.subTask(""); //$NON-NLS-1$ viewer.onCreated(); mon.worked(10); END(task); - task = BEGIN("DV.applyEditorState"); - mon.subTask("Apply editor state"); + task = BEGIN("DV.applyEditorState"); //$NON-NLS-1$ + mon.subTask(Messages.DiagramViewerLoadJob_ApplyEditorState); viewer.applyEditorState(viewer.editorState, viewer.canvasContext); mon.worked(10); END(task); - task = BEGIN("DV.activateUiContexts"); + task = BEGIN("DV.activateUiContexts"); //$NON-NLS-1$ viewer.contextUtil.inContextThread(new Runnable() { @Override public void run() { @@ -116,11 +116,11 @@ public class DiagramViewerLoadJob extends DatabaseJob { } catch (CancelTransactionException e) { monitor.done(); viewer = null; - return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, "Diagram loading was cancelled.", e); + return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, Messages.DiagramViewerLoadJob_ActivatorDiagramLoadingCancelled, e); } catch (Throwable t) { monitor.done(); viewer = null; - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Diagram loading failed, see exception for details.", t); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.DiagramViewerLoadJob_ActivatorDiagramLoadingFailed, t); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java index f1493e4cc..b7ea5ac78 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java @@ -163,7 +163,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { if (resource != null) { objects.add( constructSelectionElement(runtime, resource) ); } else { - System.out.println(" unrecognized selection: " + o.getClass() + ": " + o); + System.out.println(" unrecognized selection: " + o.getClass() + ": " + o); //$NON-NLS-1$ //$NON-NLS-2$ } } if (objects.isEmpty() && runtime != null && dr != null) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DisposingPolicy.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DisposingPolicy.java index b1778a342..db7e2571d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DisposingPolicy.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DisposingPolicy.java @@ -27,7 +27,7 @@ public class DisposingPolicy { currentlyScheduled = null; runnable.run(); if(DEBUG) - System.out.println("Executed disposer " + runnable); + System.out.println("Executed disposer " + runnable); //$NON-NLS-1$ if(!disposerQueue.isEmpty()) scheduleDispose(); } @@ -54,7 +54,7 @@ public class DisposingPolicy { MIN_DELAY); Display.getCurrent().timerExec((int)delay, disposeOne); if(DEBUG) - System.out.println("Scheduled disposer " + currentlyScheduled + " in " + delay + " ms"); + System.out.println("Scheduled disposer " + currentlyScheduled + " in " + delay + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** @@ -65,7 +65,7 @@ public class DisposingPolicy { */ public void addDisposer(Runnable disposer) { if(DEBUG) - System.out.println("Added disposer " + disposer); + System.out.println("Added disposer " + disposer); //$NON-NLS-1$ if(disposeTime.contains(disposer)) return; if(disposerQueue.size() >= maxQueueLength) @@ -82,7 +82,7 @@ public class DisposingPolicy { */ public void removeDisposer(Runnable disposer) { if(DEBUG) - System.out.println("Removed disposer " + disposer); + System.out.println("Removed disposer " + disposer); //$NON-NLS-1$ disposerQueue.remove(disposer); disposeTime.remove(disposer); if(disposer == currentlyScheduled) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/Messages.java index 6a58dac08..970fbc650 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/Messages.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/Messages.java @@ -3,14 +3,52 @@ package org.simantics.modeling.ui.diagramEditor; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagramEditor.messages"; //$NON-NLS-1$ - public static String PopulateElementDropParticipant_PreDropFixesFailed; - public static String PopulateElementDropParticipant_PreDropFixesFailed_Title; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagramEditor.messages"; //$NON-NLS-1$ + public static String DiagramEditor_InvalidParameter; + public static String DiagramLayersPage_FocusActive; + public static String DiagramLayersPage_FocusActiveTT; + public static String DiagramLayersPage_Focus; + public static String DiagramLayersPage_FocusAll; + public static String DiagramLayersPage_FocusAllTT; + public static String DiagramLayersPage_New; + public static String DiagramLayersPage_NewRole; + public static String DiagramLayersPage_NewTT; + public static String DiagramLayersPage_Remove; + public static String DiagramLayersPage_RemoveTT; + public static String DiagramLayersPage_Role; + public static String DiagramLayersPage_SelectTT; + public static String DiagramLayersPage_ShowActive; + public static String DiagramLayersPage_ShowActiveTT; + public static String DiagramLayersPage_Show; + public static String DiagramLayersPage_ShowAll; + public static String DiagramLayersPage_ShowAllTT; + public static String DiagramViewer_FailedtoLoadModeled; + public static String DiagramViewer_MonitorActivateMapping; + public static String DiagramViewerActionContributor_ConnectMode; + public static String DiagramViewerActionContributor_PointerMode; + public static String DiagramViewerLoadJob_ActivatorDiagramLoadingCancelled; + public static String DiagramViewerLoadJob_ActivatorDiagramLoadingFailed; + public static String DiagramViewerLoadJob_ApplyEditorState; + public static String DiagramViewerLoadJob_LoadDiagram; + public static String DiagramViewerLoadJob_MonitorFinalizeDiagramLoading; + public static String DiagramViewerLoadJob_MonitorLoadingDiagram; + public static String DiagramViewerLoadJob_SetDiagram; + public static String OpenDiagramAdapter_DiagramEditor; + public static String OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference; + public static String OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent; + public static String OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList; + public static String OpenDiagramFromConfigurationAdapter_DiagramEditor; + public static String OpenDiagramFromIssue_OpenDiagramRefComponent; + public static String OpenDiagramFromSymbolAdapter_SymbolEditor; + public static String OpenSheetAdapter_SpreadsheetEditor; + public static String PopulateElementDropParticipant_PreDropFixesFailed; + public static String PopulateElementDropParticipant_PreDropFixesFailed_Title; + public static String SheetViewer_MonitorLoadingDiagram; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - } + private Messages() { + } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java index fb3716f98..ab41cca82 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java @@ -32,10 +32,10 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; */ public class OpenDiagramAdapter extends AbstractResourceEditorAdapter { - private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor"; + private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor"; //$NON-NLS-1$ public OpenDiagramAdapter() { - super("Diagram Editor", Activator.COMPOSITE_ICON); + super(Messages.OpenDiagramAdapter_DiagramEditor, Activator.COMPOSITE_ICON); } protected String getEditorId() { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java index e015796c7..d5071303e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java @@ -57,10 +57,10 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt private static final Logger LOGGER = LoggerFactory.getLogger(OpenDiagramFromComponentAdapter.class); - private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; + private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; //$NON-NLS-1$ public OpenDiagramFromComponentAdapter() { - super("Open Diagram Containing This Component", Activator.SYMBOL_ICON); + super(Messages.OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent, Activator.SYMBOL_ICON); } @Override @@ -76,7 +76,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt private Pair tryGetResource(ReadGraph graph, Object input) throws DatabaseException { Resource r = ResourceAdaptionUtils.toSingleResource(input); if (r != null) - return Pair.make(r, ""); + return Pair.make(r, ""); //$NON-NLS-1$ Variable v = AdaptionUtils.adaptToSingle(input, Variable.class); return findResource(graph, v); } @@ -86,20 +86,20 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt while (v != null) { Resource r = v.getPossibleRepresents(graph); if (r != null) { - String rvi = ""; + String rvi = ""; //$NON-NLS-1$ if (path != null) { int pathLength = path.size(); for (int i = 0; i < pathLength; i++) path.set(i, URIStringUtils.escape(path.get(i))); Collections.reverse(path); - rvi = EString.implode(path, "/"); + rvi = EString.implode(path, "/"); //$NON-NLS-1$ } return Pair.make(r, rvi); } if (path == null) path = new ArrayList<>(2); path.add( v.getName(graph) ); - v = v.browsePossible(graph, "."); + v = v.browsePossible(graph, "."); //$NON-NLS-1$ } return null; } @@ -120,9 +120,9 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt Variable v = AdaptionUtils.adaptToSingle(input, Variable.class); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent resource URI: " + NameUtils.getURIOrSafeNameInternal(graph, r.first)); - LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent RVI: " + r.second); - LOGGER.debug(getClass().getSimpleName() + ".openEditor: input variable URI: " + (v != null ? v.getURI(graph) : "null")); + LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent resource URI: " + NameUtils.getURIOrSafeNameInternal(graph, r.first)); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent RVI: " + r.second); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".openEditor: input variable URI: " + (v != null ? v.getURI(graph) : "null")); //$NON-NLS-1$ //$NON-NLS-2$ } final Collection rs = tryFindDiagram(graph, r.first, v, r.second); @@ -154,16 +154,16 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt Resource diagram = ComponentUtils.getPossibleCompositeDiagram(g, composite); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: component: " + NameUtils.getURIOrSafeNameInternal(g, component)); - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: composite: " + NameUtils.getURIOrSafeNameInternal(g, composite)); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: component: " + NameUtils.getURIOrSafeNameInternal(g, component)); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: composite: " + NameUtils.getURIOrSafeNameInternal(g, composite)); //$NON-NLS-1$ } Collection referenceElements = diagram == null ? g.getObjects(component, MOD.HasParentComponent_Inverse) : Collections.emptyList(); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: diagram: " + NameUtils.getURIOrSafeNameInternal(g, diagram)); - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: referenceElements: " + referenceElements.size()); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: diagram: " + NameUtils.getURIOrSafeNameInternal(g, diagram)); //$NON-NLS-1$ + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: referenceElements: " + referenceElements.size()); //$NON-NLS-1$ for (Object object : referenceElements) - LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); + LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); //$NON-NLS-1$ } if (diagram == null && referenceElements.isEmpty()) return Collections.emptyList(); @@ -175,7 +175,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt if (indexRoot == null) return Collections.emptyList(); if (LOGGER.isDebugEnabled()) - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: Model: " + indexRoot); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: Model: " + indexRoot); //$NON-NLS-1$ if (diagram != null) { if(OpenDiagramFromConfigurationAdapter.isLocked(g, diagram)) @@ -192,23 +192,23 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt if (parent != null) { rvi = parent.getPossibleRVI(g); if (LOGGER.isDebugEnabled()) - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI: " + rvi); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI: " + rvi); //$NON-NLS-1$ } } } else { allowNullRvi = true; rvi = compositeVariable.getPossibleRVI(g); if (LOGGER.isDebugEnabled()) - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI from resource path: " + rvi); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI from resource path: " + rvi); //$NON-NLS-1$ } if (rvi == null && !allowNullRvi) return Collections.emptyList(); Collection selectedObjects = findElementObjects(g, component, rviFromComponent); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + selectedObjects.size()); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + selectedObjects.size()); //$NON-NLS-1$ for (Object object : selectedObjects) - LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); + LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); //$NON-NLS-1$ } // Prevent diagram from opening if there's nothing to select // on the diagram based on the received input. @@ -218,11 +218,11 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt final MapSet referencingDiagrams = listReferenceDiagrams(g, referenceElements); final Set diagrams = referencingDiagrams.getKeys(); if (LOGGER.isDebugEnabled()) { - LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + diagrams.size()); + LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + diagrams.size()); //$NON-NLS-1$ for (NamedResource d : diagrams) { - LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, d.getResource()) + ":"); + LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, d.getResource()) + ":"); //$NON-NLS-1$ //$NON-NLS-2$ for (Resource referenceElement : referencingDiagrams.getValues(d)) { - LOGGER.debug("\t\t" + NameUtils.getURIOrSafeNameInternal(g, referenceElement)); + LOGGER.debug("\t\t" + NameUtils.getURIOrSafeNameInternal(g, referenceElement)); //$NON-NLS-1$ } } } @@ -299,7 +299,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt while (v != null) { Resource represents = v.getPossibleRepresents(graph); if (LOGGER.isDebugEnabled()) - LOGGER.debug(v.getURI(graph) + " -> " + NameUtils.getURIOrSafeNameInternal(graph, represents)); + LOGGER.debug(v.getURI(graph) + " -> " + NameUtils.getURIOrSafeNameInternal(graph, represents)); //$NON-NLS-1$ if (represents != null) return v; v = v.getParent(graph); @@ -364,8 +364,8 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt protected NamedResource queryTarget(final Shell parentShell, Collection options) { NavigationTargetChooserDialog dialog = new NavigationTargetChooserDialog( parentShell, options.toArray(new NamedResource[options.size()]), - "Choose Diagram with Component Reference", - "Select single diagram from list"); + Messages.OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference, + Messages.OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList); return dialog.open() != Window.OK ? null : dialog.getSelection(); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java index 1ba559e56..8c052561e 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java @@ -42,10 +42,10 @@ import org.simantics.utils.threads.ThreadUtils; */ public class OpenDiagramFromConfigurationAdapter extends AbstractResourceEditorAdapter { - private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; + private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; //$NON-NLS-1$ public OpenDiagramFromConfigurationAdapter() { - super("Diagram Editor", Activator.COMPOSITE_ICON); + super(Messages.OpenDiagramFromConfigurationAdapter_DiagramEditor, Activator.COMPOSITE_ICON); } protected String getEditorId() { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromIssue.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromIssue.java index 9214082f2..7bb39804c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromIssue.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromIssue.java @@ -45,10 +45,10 @@ import org.simantics.utils.ui.ISelectionUtils; */ public class OpenDiagramFromIssue extends AbstractResourceEditorAdapter { - private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor"; + private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor"; //$NON-NLS-1$ public OpenDiagramFromIssue() { - super("Open Diagram Containing Referenced Component", Activator.COMPOSITE_ICON); + super(Messages.OpenDiagramFromIssue_OpenDiagramRefComponent, Activator.COMPOSITE_ICON); } protected String getEditorId(ReadGraph g, Resource diagram) throws DatabaseException { @@ -157,7 +157,7 @@ public class OpenDiagramFromIssue extends AbstractResourceEditorAdapter { } protected static Collection findElementObjects(ReadGraph g, Resource component) throws DatabaseException { - Collection result = findElementObjects(g, component, ""); + Collection result = findElementObjects(g, component, ""); //$NON-NLS-1$ ModelingResources MOD = ModelingResources.getInstance(g); for (Resource element : g.getObjects(component, MOD.HasParentComponent_Inverse)) result.add(element); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java index 8739f904f..384734436 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java @@ -36,10 +36,10 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils; */ public class OpenDiagramFromSymbolAdapter extends AbstractResourceEditorAdapter { - private static final String EDITOR_ID = "org.simantics.modeling.ui.symbolEditor"; + private static final String EDITOR_ID = "org.simantics.modeling.ui.symbolEditor"; //$NON-NLS-1$ public OpenDiagramFromSymbolAdapter() { - super("Symbol Editor", Activator.SYMBOL_ICON); + super(Messages.OpenDiagramFromSymbolAdapter_SymbolEditor, Activator.SYMBOL_ICON); } protected String getEditorId() { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java index ae88498dc..b7c0584e2 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java @@ -33,10 +33,10 @@ import org.slf4j.LoggerFactory; public class OpenSheetAdapter extends AbstractResourceEditorAdapter { private static final Logger LOGGER = LoggerFactory.getLogger(OpenSheetAdapter.class); - private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2"; + private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2"; //$NON-NLS-1$ public OpenSheetAdapter() { - super("Spreadsheet Editor", Activator.COMPOSITE_ICON); + super(Messages.OpenSheetAdapter_SpreadsheetEditor, Activator.COMPOSITE_ICON); } protected String getEditorId() { @@ -65,7 +65,7 @@ public class OpenSheetAdapter extends AbstractResourceEditorAdapter { String editorId = getEditorId(); WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, r, model, rvi)); } catch (PartInitException e) { - LOGGER.error("Failed to open the spreadsheet editor.", e); + LOGGER.error("Failed to open the spreadsheet editor.", e); //$NON-NLS-1$ } } }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/PopulateElementMonitorDropParticipant.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/PopulateElementMonitorDropParticipant.java index 1c3514793..d12f9def3 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/PopulateElementMonitorDropParticipant.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/PopulateElementMonitorDropParticipant.java @@ -101,13 +101,13 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa try { Object obj = tr.getTransferData(LocalObjectTransferable.FLAVOR); if (DEBUG) - System.out.println("GOT FROM AWT: " + obj); + System.out.println("GOT FROM AWT: " + obj); //$NON-NLS-1$ // Check SWT if (!(obj instanceof IStructuredSelection)) { obj = LocalObjectTransfer.getTransfer().getObject(); if (DEBUG) - System.out.println("GOT FROM SWT: " + obj); + System.out.println("GOT FROM SWT: " + obj); //$NON-NLS-1$ } if (obj instanceof IStructuredSelection) { @@ -132,7 +132,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa } } catch (UnsupportedFlavorException|IOException|DatabaseException e) { - LOGGER.error("dragEnter failed", e); + LOGGER.error("dragEnter failed", e); //$NON-NLS-1$ } } @@ -190,15 +190,15 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa public List resolve(ReadGraph graph, Variable parameter) throws DatabaseException { if (DEBUG) { - System.out.println("PARAM: " + parameter.getURI(graph)); - Variable parent = parameter.browsePossible(graph, ".."); - System.out.println("PARENT: " + parent.getURI(graph)); + System.out.println("PARAM: " + parameter.getURI(graph)); //$NON-NLS-1$ + Variable parent = parameter.browsePossible(graph, ".."); //$NON-NLS-1$ + System.out.println("PARENT: " + parent.getURI(graph)); //$NON-NLS-1$ Resource parentComposite = parent.getPossibleRepresents(graph); - System.out.println("PARENT REPRESENTS: " + NameUtils.getSafeLabel(graph, parentComposite)); + System.out.println("PARENT REPRESENTS: " + NameUtils.getSafeLabel(graph, parentComposite)); //$NON-NLS-1$ String prvi = Variables.getRVI(graph, parent); - System.out.println("PARENT RVI: " + prvi); + System.out.println("PARENT RVI: " + prvi); //$NON-NLS-1$ String parvi = Variables.getRVI(graph, parameter); - System.out.println("PARAM RVI: " + parvi); + System.out.println("PARAM RVI: " + parvi); //$NON-NLS-1$ } Triple match = findElementInDiagram(graph, parameter, false); @@ -216,13 +216,13 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa } if (DEBUG) { - System.out.println("p=" + parameter.getURI(graph)); - System.out.println("c=" + match.first.getURI(graph)); + System.out.println("p=" + parameter.getURI(graph)); //$NON-NLS-1$ + System.out.println("c=" + match.first.getURI(graph)); //$NON-NLS-1$ } String rvi = Variables.getRVI(graph, match.first, parameter); if (DEBUG) - System.out.println("r=" + rvi); + System.out.println("r=" + rvi); //$NON-NLS-1$ Resource type = graph.getResource(typeURI); @@ -246,7 +246,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa return null; if (DEBUG) - System.out.println("findElementInDiagram " + property.getURI(graph) + " " + property); + System.out.println("findElementInDiagram " + property.getURI(graph) + " " + property); //$NON-NLS-1$ //$NON-NLS-2$ DiagramResource DIA = DiagramResource.getInstance(graph); ModelingResources MOD = ModelingResources.getInstance(graph); @@ -260,7 +260,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa Resource represents = property.getPossibleRepresents(graph); if (represents != null) { if (DEBUG) - System.out.println("represents " + NameUtils.getSafeName(graph, represents, true)); + System.out.println("represents " + NameUtils.getSafeName(graph, represents, true)); //$NON-NLS-1$ Resource elementResource = graph.getPossibleObject(represents, MOD.ComponentToElement); // There must have be at least one // PROPERTY role variable in the @@ -290,7 +290,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa } } - return findElementInDiagram(graph, property.browsePossible(graph, "."), propertyRoleFound); + return findElementInDiagram(graph, property.browsePossible(graph, "."), propertyRoleFound); //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java index 2838892c4..22a1b59e4 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java @@ -195,7 +195,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected String getPopupId() { - return "#ModelingDiagramPopup"; + return "#ModelingDiagramPopup"; //$NON-NLS-1$ } protected void getPreferences() { @@ -227,7 +227,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { swt = SWTThread.getThreadAccess(parent.getDisplay()); statusLineManager = getEditorSite().getActionBars().getStatusLineManager(); - Object task = BEGIN("DV.initSession"); + Object task = BEGIN("DV.initSession"); //$NON-NLS-1$ initSession(); END(task); @@ -235,7 +235,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { readNames(); getPreferences(); - task = BEGIN("DV.createChassis"); + task = BEGIN("DV.createChassis"); //$NON-NLS-1$ createChassis(parent); END(task); @@ -246,9 +246,9 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected void initializeCanvas() { - Object canvasInit = BEGIN("DV.canvasInitialization"); + Object canvasInit = BEGIN("DV.canvasInitialization"); //$NON-NLS-1$ - Object task = BEGIN("DV.createViewerCanvas"); + Object task = BEGIN("DV.createViewerCanvas"); //$NON-NLS-1$ // ThreadUtils.syncExec(AWTThread.getThreadAccess(), new Runnable() { // @Override // public void run() { @@ -259,17 +259,17 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { //FullscreenUtils.addFullScreenHandler(canvasContext, s, canvasProvider); - task = BEGIN("DV.setCanvasContext"); + task = BEGIN("DV.setCanvasContext"); //$NON-NLS-1$ setCanvasContext(canvasContext); END(task); try { - task = BEGIN("DV.loadDiagram"); + task = BEGIN("DV.loadDiagram"); //$NON-NLS-1$ sourceDiagram = loadDiagram(diagramResource); END(task); // Zoom to fit - task = BEGIN("DV.scheduleZoomToFit"); + task = BEGIN("DV.scheduleZoomToFit"); //$NON-NLS-1$ // canvasContext.getDefaultHintContext().setHint(Hints.KEY_CANVAS_TRANSFORM, new AffineTransform()); // canvasContext.getContentContext().setDirty(); @@ -279,15 +279,15 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { // Start an activation for the input resource. // This will activate mapping if necessary. - task = BEGIN("DV.performActivation"); + task = BEGIN("DV.performActivation"); //$NON-NLS-1$ performActivation(); END(task); - task = BEGIN("DV.activate context"); + task = BEGIN("DV.activate context"); //$NON-NLS-1$ contextUtil.activate(DiagramViewer.DIAGRAMMING_CONTEXT); END(task); - task = BEGIN("DV.onCreated"); + task = BEGIN("DV.onCreated"); //$NON-NLS-1$ onCreated(); END(task); @@ -313,7 +313,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { protected void scheduleZoomToFit() { if (sourceDiagram == null) - throw new IllegalStateException("source diagram is null"); + throw new IllegalStateException("source diagram is null"); //$NON-NLS-1$ sourceDiagram.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE); sourceDiagram.setHint(DiagramHints.KEY_INITIAL_ZOOM_TO_FIT, Boolean.TRUE); @@ -353,7 +353,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 100); + SubMonitor mon = SubMonitor.convert(monitor, Messages.SheetViewer_MonitorLoadingDiagram, 100); try { dc.set( loadDiagram(mon.newChild(100), r) ); } catch (DatabaseException e) { @@ -375,17 +375,17 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected IDiagram loadDiagram(IProgressMonitor monitor, Resource r) throws DatabaseException { - SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 100); + SubMonitor mon = SubMonitor.convert(monitor, Messages.SheetViewer_MonitorLoadingDiagram, 100); - Object task = BEGIN("DV.DiagramLoadQuery"); + Object task = BEGIN("DV.DiagramLoadQuery"); //$NON-NLS-1$ IDiagram d = sessionContext.getSession().syncRequest(DiagramRequests.loadDiagram(mon.newChild(100), getResourceInput2().getModel(null), r, null, structuralPath, synchronizer, null)); END(task); - task = BEGIN("DV.setDiagramHint"); + task = BEGIN("DV.setDiagramHint"); //$NON-NLS-1$ canvasContext.getDefaultHintContext().setHint(DiagramHints.KEY_DIAGRAM, d); END(task); - task = BEGIN("DV.set other hints"); + task = BEGIN("DV.set other hints"); //$NON-NLS-1$ // Setup a copy advisor for the synchronizer //d.setHint(SynchronizationHints.COPY_ADVISOR, new MappedElementCopyAdvisor(new ComponentCopyAdvisor())); d.setHint(DiagramHints.KEY_USE_CONNECTION_FLAGS, Boolean.FALSE); @@ -407,7 +407,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } }); } catch (DatabaseException e) { - throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); + throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$ } } @@ -428,7 +428,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { CanvasContext ctx = new CanvasContext(thread); IHintContext h = ctx.getDefaultHintContext(); - Object task = BEGIN("createSynchronizer"); + Object task = BEGIN("createSynchronizer"); //$NON-NLS-1$ this.synchronizer = createSynchronizer(ctx, sessionContext); END(task); @@ -619,7 +619,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { if (!(input instanceof IResourceEditorInput)) - throw new PartInitException("Invalid input: must be IResourceEditorInput"); + throw new PartInitException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$ setSite(site); setInput(input); support = new ResourceEditorSupport(this); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java index d067ba344..47913a7e0 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java @@ -157,7 +157,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart IHintContext hints = new HintContext(); hints.setHint(DiagramModelHints.KEY_ACTIVE_EXPERIMENT, experiment); if(layer != null) { - System.out.println("using layer '"+layer+"'"); + System.out.println("using layer '"+layer+"'"); //$NON-NLS-1$ //$NON-NLS-2$ hints.setHint(DiagramHints.KEY_FIXED_LAYERS, new String[] { layer }); } @@ -170,7 +170,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart void scheduleZoomToFit() { if (sourceDiagram == null) - throw new IllegalStateException("source diagram is null"); + throw new IllegalStateException("source diagram is null"); //$NON-NLS-1$ sourceDiagram.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE); sourceDiagram.setHint(DiagramHints.KEY_INITIAL_ZOOM_TO_FIT, Boolean.TRUE); @@ -188,7 +188,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart if(experiment != null) hints.setHint(DiagramModelHints.KEY_ACTIVE_EXPERIMENT, experiment); if(layer != null) { - System.out.println("using layer '"+layer+"'"); + System.out.println("using layer '"+layer+"'"); //$NON-NLS-1$ //$NON-NLS-2$ hints.setHint(DiagramHints.KEY_FIXED_LAYERS, new String[] { layer }); } IDiagram d = sessionContext.getSession().syncRequest(DiagramRequests.loadDiagram(new NullProgressMonitor(), getResourceInput2().getModel(null), structuralPath.resources[0], null, structuralPath.removeFromBeginning(0), synchronizer, hints)); @@ -213,7 +213,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart } }); } catch (DatabaseException e) { - throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); + throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$ } } @@ -311,7 +311,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart @Override public void dispose() { - System.out.println("RemoteDiagramViewer.dispose()"); + System.out.println("RemoteDiagramViewer.dispose()"); //$NON-NLS-1$ if(getSite() != null) { IContextService contextService = (IContextService) getSite().getService(IContextService.class); contextService.deactivateContext(contextActivation); @@ -352,7 +352,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart public void init(IEditorSite site, IEditorInput input) throws PartInitException { if (!(input instanceof IResourceEditorInput)) - throw new PartInitException("Invalid input: must be IResourceEditorInput"); + throw new PartInitException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$ setSite(site); setInput(input); support = new ResourceEditorSupport(this); @@ -376,7 +376,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart try { SerialisationSupport support = session.getService(SerialisationSupport.class); ResourceTransferData data = ResourceTransferUtils.readAwtTransferable(support, tr); - if ("property".equals(data.getPurpose())) + if ("property".equals(data.getPurpose())) //$NON-NLS-1$ return data.toResourceArrayArray(); } catch (UnsupportedFlavorException e) { throw new RuntimeException(e); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramEditor.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramEditor.java index 4ed40f2f8..0560954af 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramEditor.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramEditor.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.workbench.modeling.EPartService; import org.eclipse.e4.ui.workbench.modeling.IPartListener; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.PartInitException; @@ -65,7 +66,7 @@ public class DiagramEditor extends E4ResourceEditorBase implements DiagramViewer * * @see #setInitializationData(IConfigurationElement, String, Object) */ - public static final String ARG_VIEWER = "viewer"; + public static final String ARG_VIEWER = "viewer"; //$NON-NLS-1$ private Composite parent; @@ -84,25 +85,26 @@ public class DiagramEditor extends E4ResourceEditorBase implements DiagramViewer */ @Override public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) { -// super.setInitializationData(cfig, propertyName, data); + // super.setInitializationData(cfig, propertyName, data); if (data instanceof String) { viewerContributor = cfig.getContributor().getName(); - String[] parameters = ((String) data).split(";"); + String[] parameters = ((String) data).split(";"); //$NON-NLS-1$ for (String parameter : parameters) { - String[] keyValue = parameter.split("="); + String[] keyValue = parameter.split("="); //$NON-NLS-1$ if (keyValue.length > 2) { - ErrorLogger.defaultLogWarning("Invalid parameter '" + parameter + ". Complete view argument: " + data, null); + ErrorLogger.defaultLogWarning(NLS.bind(Messages.DiagramEditor_InvalidParameter, parameter, data), + null); continue; } String key = keyValue[0]; - String value = keyValue.length > 1 ? keyValue[1] : ""; + String value = keyValue.length > 1 ? keyValue[1] : ""; //$NON-NLS-1$ if (ARG_VIEWER.equals(key)) { viewerClassName = value; - } + } } } } @@ -110,25 +112,25 @@ public class DiagramEditor extends E4ResourceEditorBase implements DiagramViewer protected DiagramViewer createViewer() throws PartInitException { if (viewerClassName == null) throw new PartInitException( - "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '" - + viewerContributor + "'"); + "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '" //$NON-NLS-1$ + + viewerContributor + "'"); //$NON-NLS-1$ try { Bundle b = Platform.getBundle(viewerContributor); if (b == null) - throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '" - + viewerContributor + "' was not found in the platform."); + throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + + viewerContributor + "' was not found in the platform."); //$NON-NLS-1$ Class clazz = b.loadClass(viewerClassName); if (!DiagramViewer.class.isAssignableFrom(clazz)) - throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to " - + DiagramViewer.class + "."); + throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to " //$NON-NLS-1$ //$NON-NLS-2$ + + DiagramViewer.class + "."); //$NON-NLS-1$ Constructor ctor = clazz.getConstructor(); return (DiagramViewer) ctor.newInstance(); } catch (Exception e) { - throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName - + "' from bundle '" + viewerContributor + "'. See exception for details.", e); + throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName //$NON-NLS-1$ + + "' from bundle '" + viewerContributor + "'. See exception for details.", e); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/Messages.java new file mode 100644 index 000000000..1a8a8b692 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/Messages.java @@ -0,0 +1,19 @@ +package org.simantics.modeling.ui.diagramEditor.e4; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagramEditor.e4.messages"; //$NON-NLS-1$ + public static String DiagramEditor_InvalidParameter; + public static String PopulateElementDropParticipant_ActivatorDiagramContentTrackingFailed; + public static String PopulateElementDropParticipant_CannotCreateElementIntoDiagram; + public static String PopulateElementDropParticipant_CannotInstantiate; + public static String PopulateElementDropParticipant_CannotInstantiateUserComponent; + 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/diagramEditor/e4/PopulateElementDropParticipant.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java index 51f5d8269..ac9413064 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java @@ -30,6 +30,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.osgi.util.NLS; import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.RequestProcessor; @@ -210,32 +211,33 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i return processor.syncRequest(new UniqueRead() { @Override public String perform(ReadGraph graph) throws DatabaseException { -// System.out.println("dragged resource: " + draggedResource); -// System.out.println("drop target resource: " + dropTarget); + // System.out.println("dragged resource: " + draggedResource); + // System.out.println("drop target resource: " + dropTarget); Resource sourceModel = graph.syncRequest(new PossibleIndexRoot(draggedResource)); Resource targetModel = graph.syncRequest(new PossibleIndexRoot(dropTarget)); -// System.out.println("source model: " + sourceModel); -// System.out.println("target model: " + targetModel); + // System.out.println("source model: " + sourceModel); + // System.out.println("target model: " + targetModel); // Prevent dragging data from one source model to another. // If source is not part of any model, everything is okay. if (sourceModel != null && !graph.syncRequest(new IsLinkedTo(targetModel, sourceModel))) { // Prevent a symbol instantiating within its own configuration. // NOTE: this doesn't handle transitive cycles. - return "Cannot instantiate " + NameUtils.getSafeName(graph, draggedResource) + " into model " - + NameUtils.getURIOrSafeNameInternal(graph, targetModel) + ". The source namespace (" - + NameUtils.getURIOrSafeNameInternal(graph, sourceModel) + ") is not linked to the target model."; + return NLS.bind(Messages.PopulateElementDropParticipant_CannotInstantiate, + new Object[] { NameUtils.getSafeName(graph, draggedResource), + NameUtils.getURIOrSafeNameInternal(graph, targetModel), + NameUtils.getURIOrSafeNameInternal(graph, sourceModel) }); } - + // Prevent dragging to published components ModelingResources MOD = ModelingResources.getInstance(graph); StructuralResource2 STR = StructuralResource2.getInstance(graph); Resource configuration = graph.getPossibleObject(dropTarget, MOD.DiagramToComposite); if (configuration != null) { Resource componentTypeFromDiagram = graph.getPossibleObject(configuration, STR.Defines); - if(componentTypeFromDiagram != null) { - if(Layer0Utils.isPublished(graph, componentTypeFromDiagram)) - return "Cannot create elements into a diagram that belongs to a published user component."; + if (componentTypeFromDiagram != null) { + if (Layer0Utils.isPublished(graph, componentTypeFromDiagram)) + return Messages.PopulateElementDropParticipant_CannotCreateElementIntoDiagram; } } @@ -244,8 +246,9 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i if (componentTypeFromSymbol != null) { if (configuration != null) { Resource componentTypeFromDiagram = graph.getPossibleObject(configuration, STR.Defines); - if (componentTypeFromDiagram != null && componentTypeFromSymbol.equals(componentTypeFromDiagram)) { - return "Cannot instantiate user component within its own configuration."; + if (componentTypeFromDiagram != null + && componentTypeFromSymbol.equals(componentTypeFromDiagram)) { + return Messages.PopulateElementDropParticipant_CannotInstantiateUserComponent; } } } @@ -284,7 +287,7 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i @Override public void drop(DropTargetDropEvent dtde, final IDnDContext dp) { - TimeLogger.resetTimeAndLog(getClass(), "drop"); + TimeLogger.resetTimeAndLog(getClass(), "drop"); //$NON-NLS-1$ final IDiagram d = getHint(DiagramHints.KEY_DIAGRAM); if (d == null) @@ -381,7 +384,7 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i } } } catch (DatabaseException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Diagram content change tracking failed.", e)); + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.PopulateElementDropParticipant_ActivatorDiagramContentTrackingFailed, e)); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/messages.properties new file mode 100644 index 000000000..91cbaa2e8 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/messages.properties @@ -0,0 +1,5 @@ +DiagramEditor_InvalidParameter=Invalid parameter ''{0}''. Complete view argument: {1} +PopulateElementDropParticipant_ActivatorDiagramContentTrackingFailed=Diagram content change tracking failed. +PopulateElementDropParticipant_CannotCreateElementIntoDiagram=Cannot create elements into a diagram that belongs to a published user component. +PopulateElementDropParticipant_CannotInstantiate=Cannot instantiate {0} into model {1}. The source namespace ({2}) is not linked to the target model. +PopulateElementDropParticipant_CannotInstantiateUserComponent=Cannot instantiate user component within its own configuration. diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/messages.properties index 7ed685f76..19052dac1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/messages.properties +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/messages.properties @@ -1,2 +1,40 @@ +DiagramEditor_InvalidParameter=Invalid parameter ''{0}''. Complete view argument: {1} +DiagramLayersPage_Focus=Focus +DiagramLayersPage_FocusActive=Focus Active +DiagramLayersPage_FocusActiveTT=Only Focus Diagram Elements For Active Roles +DiagramLayersPage_FocusAll=Focus All +DiagramLayersPage_FocusAllTT=Focus All Diagram Elements Regardless Of Active Roles +DiagramLayersPage_New=New +DiagramLayersPage_NewRole=New Role +DiagramLayersPage_NewTT=Create New Diagram Role +DiagramLayersPage_Remove=Remove +DiagramLayersPage_RemoveTT=Remove Selected Diagram Role +DiagramLayersPage_Role=Role +DiagramLayersPage_SelectTT=Selects the diagram to include in the exported document. +DiagramLayersPage_Show=Show +DiagramLayersPage_ShowActive=Show Active +DiagramLayersPage_ShowActiveTT=Only Show Diagram Elements For Active Roles +DiagramLayersPage_ShowAll=Show All +DiagramLayersPage_ShowAllTT=Show All Diagram Elements Regardless Of Active Roles +DiagramViewer_FailedtoLoadModeled=Failed to load modeled browse contexts for property page, see exception for details. +DiagramViewer_MonitorActivateMapping=Activate Mapping +DiagramViewerActionContributor_ConnectMode=Connect Mode +DiagramViewerActionContributor_PointerMode=Pointer Mode +DiagramViewerLoadJob_ActivatorDiagramLoadingCancelled=Diagram loading was cancelled. +DiagramViewerLoadJob_ActivatorDiagramLoadingFailed=Diagram loading failed, see exception for details. +DiagramViewerLoadJob_ApplyEditorState=Apply editor state +DiagramViewerLoadJob_LoadDiagram=Load Diagram +DiagramViewerLoadJob_MonitorFinalizeDiagramLoading=Finalize Diagram Loading +DiagramViewerLoadJob_MonitorLoadingDiagram=Loading Diagram +DiagramViewerLoadJob_SetDiagram=Set Diagram +OpenDiagramAdapter_DiagramEditor=Diagram Editor +OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference=Choose Diagram with Component Reference +OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent=Open Diagram Containing This Component +OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList=Select single diagram from list +OpenDiagramFromConfigurationAdapter_DiagramEditor=Diagram Editor +OpenDiagramFromIssue_OpenDiagramRefComponent=Open Diagram Containing Referenced Component +OpenDiagramFromSymbolAdapter_SymbolEditor=Symbol Editor +OpenSheetAdapter_SpreadsheetEditor=Spreadsheet Editor PopulateElementDropParticipant_PreDropFixesFailed=Drop failed because the following pre-drop fixes could not be performed:\n\n{0} PopulateElementDropParticipant_PreDropFixesFailed_Title=Drop Failed +SheetViewer_MonitorLoadingDiagram=Loading Diagram diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/messages.properties new file mode 100644 index 000000000..64efb89ac --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/messages.properties @@ -0,0 +1 @@ +ModelingUIUtils_SelectQueryType=Select query type from list diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/Messages.java new file mode 100644 index 000000000..874001b47 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/Messages.java @@ -0,0 +1,40 @@ +package org.simantics.modeling.ui.wizard; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.simantics.modeling.ui.wizard.messages"; //$NON-NLS-1$ + public static String MigrateWizard_ActivatorMigrationFailed; + public static String MigrateWizard_ActivatorMigrationInterrupted; + public static String MigrateWizard_BrowseAnd; + public static String MigrateWizard_BrowseAnd1; + public static String MigrateWizard_Continue; + public static String MigrateWizard_InstanceFoundCannotBeMigrated; + public static String MigrateWizard_InstancesWereFound; + public static String MigrateWizard_LocationAnd; + public static String MigrateWizard_LocationInstance; + public static String MigrateWizard_MigratableInstancesFound; + public static String MigrateWizard_MigrationReport; + public static String MigrateWizard_MonitorCommitingChanges; + public static String MigrateWizard_NoInstancesFound; + public static String MigrateWizard_NoInstancesWereFound; + public static String MigrateWizard_NumberOfInstancesFound; + public static String MigrateWizard_OneMigratableInstanceFound; + public static String MigrateWizard_PerformMigration; + public static String MigrateWizard_RetainSymbolName; + public static String MigrateWizard_SelectAllAnd; + public static String MigrateWizard_SelectInstancesToMigrate; + public static String MigrateWizard_SelectNoneAnd; + public static String MigrateWizard_SelectSourceType; + public static String MigrateWizard_SelectTargetType; + public static String MigrateWizard_SourceAnd; + public static String MigrateWizard_TargetAnd; + public static String MigrateWizard_TargetAndSymbol; + 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/wizard/MigrateWizard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/MigrateWizard.java index 14386190c..751ec023c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/MigrateWizard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/MigrateWizard.java @@ -35,6 +35,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.ModifyEvent; @@ -60,7 +61,6 @@ import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.NamedResource; import org.simantics.db.common.request.ObjectsWithType; -import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.common.request.UniqueRead; import org.simantics.db.common.request.WriteResultRequest; @@ -103,12 +103,12 @@ public class MigrateWizard extends Wizard { this.initial = initial; - setWindowTitle("Perform migration"); + setWindowTitle(Messages.MigrateWizard_PerformMigration); setNeedsProgressMonitor(true); setForcePreviousAndNextButtons(false); setDialogSettings(Activator.getDefault().getDialogSettings()); - prefnode = InstanceScope.INSTANCE.getNode( "org.simantics.modeling.ui.wizard.MigrateWizard" ); + prefnode = InstanceScope.INSTANCE.getNode( "org.simantics.modeling.ui.wizard.MigrateWizard" ); //$NON-NLS-1$ } @@ -158,8 +158,8 @@ public class MigrateWizard extends Wizard { graph.markUndoPoint(); String report = UserComponentMigration.doMigration(mon.newChild(500, SubMonitor.SUPPRESS_NONE), graph, result); UserComponentMigration.doPostMigration(mon.newChild(500, SubMonitor.SUPPRESS_NONE), graph, result); - mon.setTaskName("Committing Changes"); - mon.subTask(""); + mon.setTaskName(Messages.MigrateWizard_MonitorCommitingChanges); + mon.subTask(""); //$NON-NLS-1$ return report; } }); @@ -187,11 +187,11 @@ public class MigrateWizard extends Wizard { Throwable cause = e.getCause(); if (!(cause instanceof CancelTransactionException || cause instanceof OperationCanceledException)) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Migration failed, see Error Log for details.", e.getCause())); + Messages.MigrateWizard_ActivatorMigrationFailed, e.getCause())); } } catch (InterruptedException e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Migration interrupted, see Error Log for details.", e)); + Messages.MigrateWizard_ActivatorMigrationInterrupted, e)); } return false; } @@ -218,9 +218,9 @@ public class MigrateWizard extends Wizard { public ReportDialog(Shell shell, String report, int width, int height) { super(shell, - "Migration report", null, - "", - MessageDialog.INFORMATION, new String[] { "Continue" }, 0); + Messages.MigrateWizard_MigrationReport, null, + "", //$NON-NLS-1$ + MessageDialog.INFORMATION, new String[] { Messages.MigrateWizard_Continue }, 0); this.report = report; this.initialWidth = width; this.initialHeight = height; @@ -282,7 +282,7 @@ public class MigrateWizard extends Wizard { String previouslySelectedLocationId = null; public MigratePage(String initial) { - super("Perform migration", "Perform migration", null); + super(Messages.MigrateWizard_PerformMigration, Messages.MigrateWizard_PerformMigration, null); this.initial = initial; } @@ -297,7 +297,7 @@ public class MigrateWizard extends Wizard { container.setLayout(layout); } - new Label(container, SWT.NONE).setText("&Source:"); + new Label(container, SWT.NONE).setText(Messages.MigrateWizard_SourceAnd); source = new Text(container, SWT.BORDER); source.setText(initial); source.addModifyListener(new ModifyListener() { @@ -310,14 +310,14 @@ public class MigrateWizard extends Wizard { GridDataFactory.fillDefaults().grab(true, false).span(8, 1).applyTo(source); browseSource = new Button(container, SWT.NONE); - browseSource.setText("&Browse"); + browseSource.setText(Messages.MigrateWizard_BrowseAnd); GridDataFactory.fillDefaults().grab(false, false).applyTo(browseSource); browseSource.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e_) { try { Map> map = Simantics.getSession().syncRequest(new BrowseSourceContentRequest(target.getText())); - String uri = queryTargetSelection("Select Source Type", map); + String uri = queryTargetSelection(Messages.MigrateWizard_SelectSourceType, map); if (uri != null) source.setText(uri); } catch (DatabaseException e) { @@ -326,7 +326,7 @@ public class MigrateWizard extends Wizard { } }); - new Label(container, SWT.NONE).setText("&Target:"); + new Label(container, SWT.NONE).setText(Messages.MigrateWizard_TargetAnd); target = new Text(container, SWT.BORDER); target.setText(initial); target.addModifyListener(new ModifyListener() { @@ -340,14 +340,14 @@ public class MigrateWizard extends Wizard { GridDataFactory.fillDefaults().grab(true, false).span(8, 1).applyTo(target); browseTarget = new Button(container, SWT.NONE); - browseTarget.setText("B&rowse"); + browseTarget.setText(Messages.MigrateWizard_BrowseAnd1); GridDataFactory.fillDefaults().grab(false, false).applyTo(browseTarget); browseTarget.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e_) { try { Map> map = Simantics.getSession().syncRequest(new BrowseTargetContentRequest(source.getText())); - String uri = queryTargetSelection("Select Target Type", map); + String uri = queryTargetSelection(Messages.MigrateWizard_SelectTargetType, map); if (uri != null) target.setText(uri); } catch (DatabaseException e) { @@ -357,7 +357,7 @@ public class MigrateWizard extends Wizard { }); symbolsLabel = new Label(container, SWT.NONE); - symbolsLabel.setText("Target &symbol:"); + symbolsLabel.setText(Messages.MigrateWizard_TargetAndSymbol); GridDataFactory.fillDefaults().applyTo(symbolsLabel); symbols = new CCombo(container, SWT.BORDER | SWT.READ_ONLY); @@ -373,10 +373,10 @@ public class MigrateWizard extends Wizard { instanceLabel = new Label(container, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(instanceLabel); - instanceLabel.setText(""); + instanceLabel.setText(""); //$NON-NLS-1$ locationsLabel = new Label(container, SWT.NONE); - locationsLabel.setText("&Locations:"); + locationsLabel.setText(Messages.MigrateWizard_LocationAnd); locations = new CCombo(container, SWT.BORDER | SWT.READ_ONLY); locations.setVisibleItemCount(25); locations.addSelectionListener(new SelectionAdapter() { @@ -392,16 +392,16 @@ public class MigrateWizard extends Wizard { GridDataFactory.fillDefaults().grab(true, false).span(9, 1).applyTo(locations); instancesLabel = new Label(container, SWT.NONE); - instancesLabel.setText("&Select instances to migrate:"); + instancesLabel.setText(Messages.MigrateWizard_SelectInstancesToMigrate); GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(instancesLabel); buttonBar = new Composite(container, SWT.NONE); RowLayoutFactory.fillDefaults().type(SWT.HORIZONTAL).applyTo(buttonBar); GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(buttonBar); Button selectAll = new Button(buttonBar, SWT.PUSH); - selectAll.setText("Select &All"); + selectAll.setText(Messages.MigrateWizard_SelectAllAnd); Button selectNone = new Button(buttonBar, SWT.PUSH); - selectNone.setText("Select &None"); + selectNone.setText(Messages.MigrateWizard_SelectNoneAnd); selectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -475,7 +475,7 @@ public class MigrateWizard extends Wizard { }); symbols.removeAll(); - symbols.add(""); + symbols.add(Messages.MigrateWizard_RetainSymbolName); for(NamedResource nr : syms) { symbols.add(nr.getName()); } @@ -546,7 +546,7 @@ public class MigrateWizard extends Wizard { int preSelect = -1, i = 0; for (Triple> r : model.instances) { - locations.add(r.second.getName() + " (" + r.third.size() + " instances)"); + locations.add(NLS.bind(Messages.MigrateWizard_LocationInstance, r.second.getName(), r.third.size())); if (r.first.equals(previouslySelectedLocationId)) preSelect = i; if (preSelect < 0 && model.activeModels.contains(r.second.getResource())) @@ -554,7 +554,7 @@ public class MigrateWizard extends Wizard { ++i; } if (locations.getItemCount() == 0) { - locations.add(""); + locations.add(Messages.MigrateWizard_NoInstancesFound); locations.select(0); } else { locations.select(preSelect > -1 ? preSelect : 0); @@ -564,27 +564,30 @@ public class MigrateWizard extends Wizard { void refreshInstances() { int toMigrate = 0; - for(Triple> pair : model.instances) { + for (Triple> pair : model.instances) { toMigrate += pair.third.size(); } - if(model.instanceCount == 0) - instanceLabel.setText("No instances were found."); - else if(model.instanceCount == 1) { - if(toMigrate == 1) { - instanceLabel.setText("1 migratable instance found."); + if (model.instanceCount == 0) + instanceLabel.setText(Messages.MigrateWizard_NoInstancesWereFound); + else if (model.instanceCount == 1) { + if (toMigrate == 1) { + instanceLabel.setText(Messages.MigrateWizard_OneMigratableInstanceFound); } else { - instanceLabel.setText("1 instance found, but it cannot be migrated with current settings."); + instanceLabel.setText(Messages.MigrateWizard_InstanceFoundCannotBeMigrated); } } else { - if(toMigrate < model.instanceCount) { - if(toMigrate == 0) { - instanceLabel.setText(model.instanceCount + " instances were found. None of them can be migrated with current settings."); + if (toMigrate < model.instanceCount) { + if (toMigrate == 0) { + instanceLabel + .setText(NLS.bind(Messages.MigrateWizard_NumberOfInstancesFound, model.instanceCount)); } else { - instanceLabel.setText(model.instanceCount + " instances were found. " + (model.instanceCount-toMigrate) + " of them cannot be migrated with current settings."); + instanceLabel.setText(NLS.bind(Messages.MigrateWizard_InstancesWereFound, model.instanceCount, + (model.instanceCount - toMigrate))); } } else { - instanceLabel.setText(model.instanceCount + " migratable instances found. "); + instanceLabel + .setText(NLS.bind(Messages.MigrateWizard_MigratableInstancesFound, model.instanceCount)); } } @@ -593,7 +596,7 @@ public class MigrateWizard extends Wizard { if (model == null) return; - if(toMigrate == 0) { + if (toMigrate == 0) { locationsLabel.setVisible(false); locations.setVisible(false); GridDataFactory.fillDefaults().exclude(true).applyTo(locationsLabel); @@ -605,25 +608,26 @@ public class MigrateWizard extends Wizard { GridDataFactory.fillDefaults().grab(true, false).span(9, 1).applyTo(locations); } - if(!model.instances.isEmpty()) { + if (!model.instances.isEmpty()) { int locationIndex = locations.getSelectionIndex(); - if(locationIndex == -1) return; + if (locationIndex == -1) + return; model.sortedShownInstances = new ArrayList<>(); - for(MigrationOperation o : model.instances.get(locationIndex).third) + for (MigrationOperation o : model.instances.get(locationIndex).third) model.sortedShownInstances.add(o); Collections.sort(model.sortedShownInstances, MIGRATION_OP_COMPARATOR); - for(MigrationOperation o : model.sortedShownInstances) { + for (MigrationOperation o : model.sortedShownInstances) { String uri = o.toString(); - uri = uri.replace("http://Projects/Development%20Project/", ""); + uri = uri.replace("http://Projects/Development%20Project/", ""); //$NON-NLS-1$ //$NON-NLS-2$ uri = URIStringUtils.unescape(uri); instances.add(uri); } } - if(model.sortedShownInstances.isEmpty()) { + if (model.sortedShownInstances.isEmpty()) { instancesLabel.setVisible(false); instances.setVisible(false); buttonBar.setVisible(false); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/messages.properties new file mode 100644 index 000000000..64d3063c4 --- /dev/null +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/messages.properties @@ -0,0 +1,26 @@ +MigrateWizard_ActivatorMigrationFailed=Migration failed, see Error Log for details. +MigrateWizard_ActivatorMigrationInterrupted=Migration interrupted, see Error Log for details. +MigrateWizard_BrowseAnd=&Browse +MigrateWizard_BrowseAnd1=B&rowse +MigrateWizard_Continue=Continue +MigrateWizard_InstanceFoundCannotBeMigrated=1 instance found, but it cannot be migrated with current settings. +MigrateWizard_InstancesWereFound={0} instances were found. {1} of them cannot be migrated with current settings. +MigrateWizard_LocationAnd=&Locations: +MigrateWizard_LocationInstance={0} ({1} instances) +MigrateWizard_MigratableInstancesFound={0} migratable instances found. +MigrateWizard_MigrationReport=Migration report +MigrateWizard_MonitorCommitingChanges=Committing Changes +MigrateWizard_NoInstancesFound= +MigrateWizard_NoInstancesWereFound=No instances were found. +MigrateWizard_NumberOfInstancesFound={0} instances were found. None of them can be migrated with current settings. +MigrateWizard_OneMigratableInstanceFound=1 migratable instance found. +MigrateWizard_PerformMigration=Perform migration +MigrateWizard_RetainSymbolName= +MigrateWizard_SelectAllAnd=Select &All +MigrateWizard_SelectInstancesToMigrate=&Select instances to migrate: +MigrateWizard_SelectNoneAnd=Select &None +MigrateWizard_SelectSourceType=Select Source Type +MigrateWizard_SelectTargetType=Select Target Type +MigrateWizard_SourceAnd=&Source: +MigrateWizard_TargetAnd=&Target: +MigrateWizard_TargetAndSymbol=Target &symbol: diff --git a/i18n.md b/i18n.md index a2444e88a..780f6579e 100644 --- a/i18n.md +++ b/i18n.md @@ -8,32 +8,33 @@ * [x] org.simantics.document.ui * [x] org.simantics.document.ui.ontology * [x] org.simantics.export.ui +* [x] org.simantics.fileimport.ui +* [x] org.simantics.graphviz.ui +* [x] org.simantics.help.ui +* [x] org.simantics.image.ui +* [x] org.simantics.issues.ui +* [x] org.simantics.logging.ui +* [x] org.simantics.message.ui +* [x] org.simantics.migration.ui * ... ## TODO ## * /org.simantics.browsing.ui * /org.simantics.browsing.ui.common (All can be ignored) -* /org.simantics.browsing.ui.graph (Nothing to Exeternalize or all can be ignored) -* /org.simantics.browsing.ui.graph (Nothing to Exeternalize or all can be ignored) -* /org.simantics.browsing.ui.graph.impl (Nothing to Exeternalize or all can be ignored) +* /org.simantics.browsing.ui.graph (Nothing to externalize or all can be ignored) +* /org.simantics.browsing.ui.graph (Nothing to externalize or all can be ignored) +* /org.simantics.browsing.ui.graph.impl (Nothing to externalize or all can be ignored) * /org.simantics.browsing.ui.model * /org.simantics.browsing.ui.nattable -* /org.simantics.browsing.ui.ontology (Nothing to Exeternalize or all can be ignored) -* /org.simantics.browsing.ui.platform (Nothing to Exeternalize or all can be ignored) -* /org.simantics.browsing.ui.swt (Nothing to Exeternalize or all can be ignored) -* /org.simantics.debug.browser.ui (Nothing to Exeternalize or all can be ignored) +* /org.simantics.browsing.ui.ontology (Nothing to externalize or all can be ignored) +* /org.simantics.browsing.ui.platform (Nothing to externalize or all can be ignored) +* /org.simantics.browsing.ui.swt (Nothing to externalize or all can be ignored) +* /org.simantics.debug.browser.ui (Nothing to externalize or all can be ignored) * /org.simantics.desktop.ui.ontology (No strings to externalize) +* /org.simantics.issues.ui.ontology (Nothing to externalize) -* /org.simantics.fileimport.ui -* /org.simantics.graphviz.ui -* /org.simantics.help.ui -* /org.simantics.image.ui -* /org.simantics.issues.ui -* /org.simantics.issues.ui.ontology -* /org.simantics.logging.ui -* /org.simantics.message.ui -* /org.simantics.migration.ui -* /org.simantics.modeling.ui + +* /org.simantics.modeling.ui (In progress) * /org.simantics.modeling.ui.workbench * /org.simantics.platform.ui.ontology * /org.simantics.scenegraph.ui @@ -49,5 +50,5 @@ * /org.simantics.wiki.ui * -* +* * ...