]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Externalize strings in org.simantics.document.ui 10/2510/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 30 Nov 2018 14:34:35 +0000 (16:34 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 7 Dec 2018 16:52:41 +0000 (18:52 +0200)
gitlab #210

Change-Id: Ibf869b4b7a0c8efcc6705f887cfb0ed1f3fac260

42 files changed:
bundles/org.simantics.document.ui/src/org/simantics/document/ui/Activator.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSCompletionAssistProcessor.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSCompletionProposal.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSEditor.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSModuleEditorDocumentProvider.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSSourceViewerConfiguration.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/OpenEntityDocumentAdapter.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/AddUrlDocument.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/AddUrlDocumentWithDetail.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFile.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFolder.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ImportDocument.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ImportDocumentFolder.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ImportDocumentWithDetail.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewDocumentFolder.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/DocumentTabContribution.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/NameInputValidator.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/AnnotationConfigurator.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/FileDetailDialog.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/UrlDetailDialog.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/SearchFunction.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/DocumentVersionUtils.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/ExternalEditorAdapter.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/FileDocumentUtil.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/UrlEditorAdapter.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/FileDocumentImportWizard.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/FileSelectionPage.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/messages.properties [new file with mode: 0644]
i18n.md

index 5a25c5b6b7f8708d0c7865ff20ad0ee8150ca68a..82e1588549d0327815284b0c73072049fa3bd5c6 100644 (file)
@@ -58,9 +58,9 @@ public class Activator extends AbstractUIPlugin {
 
                Bundle bundle = context.getBundle();
                
-               DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png"));
-               cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png"));
-               clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png"));
+               DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png")); //$NON-NLS-1$
+               cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png")); //$NON-NLS-1$
+               clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png")); //$NON-NLS-1$
                
                IPath ipath = Platform.getStateLocation(bundle);
                location = Paths.get(ipath.toOSString());
index fe909fabda887e9e7e15f13b9fe0773efe210e66..0507fa5ef32af3874f25a019f56129bcaf5ff1fb 100644 (file)
@@ -11,7 +11,7 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 
 public class CSSCompletionAssistProcessor implements IContentAssistProcessor {
     
-    private String lastError = "";
+    private String lastError = ""; //$NON-NLS-1$
     private CSSTextEditorEnvironment environment;
     
     public CSSCompletionAssistProcessor(CSSTextEditorEnvironment environment) {
@@ -26,7 +26,7 @@ public class CSSCompletionAssistProcessor implements IContentAssistProcessor {
             tmpOffset = selection.getOffset() + selection.getLength();
         final int offset = tmpOffset;
         IDocument document = viewer.getDocument();
-        String tmpPrefix = "";
+        String tmpPrefix = ""; //$NON-NLS-1$
         try {
             tmpPrefix = getPrefix(document, offset);
         } catch (BadLocationException e) {
@@ -38,7 +38,7 @@ public class CSSCompletionAssistProcessor implements IContentAssistProcessor {
     
     private static String getPrefix(IDocument doc, int offset) throws BadLocationException {
         if (doc == null || offset >= doc.getLength())
-            return "";
+            return ""; //$NON-NLS-1$
 
         int length= 0;
         while (--offset >= 0 && Character.isJavaIdentifierPart(doc.getChar(offset)) || doc.getChar(offset) == '.')
index 8c86de8cae83822dde3a945e33019ce3793250ba..aa0d23f0c2f6d889537d490751b7f52252acc8b0 100644 (file)
@@ -22,10 +22,10 @@ import org.simantics.scl.compiler.elaboration.modules.SCLValue;
 
 public class CSSCompletionProposal implements ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2, ICompletionProposalExtension3, ICompletionProposalExtension4, ICompletionProposalExtension5 {
     
-    private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage();
-    private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage();
-    private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage();
-    private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage();
+    private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
     
     private final String content;
     private final String name;
@@ -39,7 +39,7 @@ public class CSSCompletionProposal implements ICompletionProposal, ICompletionPr
         this.name = value.getName().name;
         this.module = value.getName().module;
         this.documentation = value.getDocumentation();
-        this.content = name + " :: " + value.getType() + "  (" + module + ")";
+        this.content = name + " :: " + value.getType() + "  (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         this.replacementOffset = replacementOffset;
         this.prefix = prefix;
 //        System.out.println(prefix);
@@ -52,7 +52,7 @@ public class CSSCompletionProposal implements ICompletionProposal, ICompletionPr
     public CSSCompletionProposal(String name, String module, CSSCompletionType completionType, int replacementOffset, String prefix) {
         this.name = name;
         this.module = module;
-        this.content = name + " (" + module + ")";
+        this.content = name + " (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$
         this.documentation = null;
         this.replacementOffset = replacementOffset;
         this.prefix = prefix;
@@ -133,13 +133,13 @@ public class CSSCompletionProposal implements ICompletionProposal, ICompletionPr
 //            String sadd = doc.get(start, end);
 //            System.out.println("toReplace : " + sadd);
             if (p.y > 0) {
-                doc.replace(p.x, p.y, "");
+                doc.replace(p.x, p.y, ""); //$NON-NLS-1$
                 doc.replace(offset, 0, getName());
             } else {
                 String currentText = doc.get(offset - prefix.length(), prefix.length());
                 if (currentText.equals(getName()))
                     return;
-                doc.replace(offset - prefix.length(), prefix.length(), "");
+                doc.replace(offset - prefix.length(), prefix.length(), ""); //$NON-NLS-1$
                 doc.replace(offset - prefix.length(), 0, getName());
             }
         } catch (BadLocationException x) {
index aafd46a854af8628daad2e3429b15e9746b27e57..d3070a0f95e2bea85e2144360977a09c539b1d0d 100644 (file)
@@ -40,7 +40,7 @@ import org.simantics.ui.workbench.editor.input.InputValidationCombinators;
  */
 public class CSSEditor extends TextEditor {
 
-       public static final String EDITOR_ID = "org.simantics.document.ui.csseditor";
+       public static final String EDITOR_ID = "org.simantics.document.ui.csseditor"; //$NON-NLS-1$
        
     private boolean disposed = false;
 
@@ -84,7 +84,7 @@ public class CSSEditor 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$
         }
     }
 
index 23553b117096599cfa242f5ebc5c29332b255b0f..b2cf914052a7de54613e1060b92b3f440905395b 100644 (file)
@@ -56,7 +56,7 @@ public class CSSModuleEditorDocumentProvider extends AbstractDocumentProvider {
                        DocumentResource DOC = DocumentResource.getInstance(graph);
                     currentText = graph.getPossibleRelatedValue(resource, DOC.cssDocument, Bindings.STRING);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -83,7 +83,7 @@ public class CSSModuleEditorDocumentProvider 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);
@@ -108,7 +108,7 @@ public class CSSModuleEditorDocumentProvider 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
index 3894faa86756d3cc0da230c4679633e24434434d..44f0694f56a1849ce59a86b536e6d5c59fe95576 100644 (file)
@@ -97,8 +97,8 @@ public class CSSSourceViewerConfiguration extends SourceViewerConfiguration {
     ITokenScanner getSclTokenScanner() {
         RuleBasedScanner scanner = new RuleBasedScanner();
         
-        Font font = new Font(device, "Courier New", 10, SWT.NORMAL);
-        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD);
+        Font font = new Font(device, "Courier New", 10, SWT.NORMAL); //$NON-NLS-1$
+        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD); //$NON-NLS-1$
 
         Token defaultToken = new Token(
                 new TextAttribute(
@@ -139,20 +139,20 @@ public class CSSSourceViewerConfiguration extends SourceViewerConfiguration {
             }
         });
 
-        reservedWord.addWord("if", reserved);
-        reservedWord.addWord("then", reserved);
-        reservedWord.addWord("else", reserved);
-        reservedWord.addWord("match", reserved);
-        reservedWord.addWord("with", reserved);
-        reservedWord.addWord("data", reserved);
-        reservedWord.addWord("type", reserved);
-        reservedWord.addWord("class", reserved);
+        reservedWord.addWord("if", reserved); //$NON-NLS-1$
+        reservedWord.addWord("then", reserved); //$NON-NLS-1$
+        reservedWord.addWord("else", reserved); //$NON-NLS-1$
+        reservedWord.addWord("match", reserved); //$NON-NLS-1$
+        reservedWord.addWord("with", reserved); //$NON-NLS-1$
+        reservedWord.addWord("data", reserved); //$NON-NLS-1$
+        reservedWord.addWord("type", reserved); //$NON-NLS-1$
+        reservedWord.addWord("class", reserved); //$NON-NLS-1$
         
         IRule[] rules = new IRule[] {
             //new MultiLineRule("\"\"\"", "\"\"\"", string),
-            new PatternRule("\"", "\"", string, '\\', true),
-            new MultiLineRule("/*", "*/", comment),
-            new EndOfLineRule("//", comment),
+            new PatternRule("\"", "\"", string, '\\', true), //$NON-NLS-1$ //$NON-NLS-2$
+            new MultiLineRule("/*", "*/", comment), //$NON-NLS-1$ //$NON-NLS-2$
+            new EndOfLineRule("//", comment), //$NON-NLS-1$
             reservedWord
         };
         scanner.setRules(rules);
index 0d7973f6af728ddf0fa02096e6d08a91ecd8fd03..2083c3b4afbb6a590fbd21a78434a5597a5b304d 100644 (file)
@@ -51,11 +51,11 @@ public class DocumentView extends ModelledView {
 
     private class PinSelection extends Action {
         public PinSelection() {
-            super("Pin Selection", IAction.AS_CHECK_BOX);
+            super(Messages.DocumentView_PinSelection, IAction.AS_CHECK_BOX);
             setImageDescriptor(
                     BundleUtils.getImageDescriptorFromPlugin(
-                            "org.eclipse.ui",
-                            "icons/full/etool16/pin_editor.png"));
+                            "org.eclipse.ui", //$NON-NLS-1$
+                            "icons/full/etool16/pin_editor.png")); //$NON-NLS-1$
         }
 
         @Override
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/Messages.java
new file mode 100644 (file)
index 0000000..6105026
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.document.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.messages"; //$NON-NLS-1$
+       public static String DocumentView_PinSelection;
+       public static String OpenEntityDocumentAdapter_DocumentEditor;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index bd44a50b15bff7c693588571d86000b098f91258..2226a2413313ac6392cd23271f05f83c2f7c5b58 100644 (file)
@@ -32,11 +32,11 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 
 public class OpenEntityDocumentAdapter extends AbstractResourceEditorAdapter {
 
-    private static final String EDITOR_ID = "org.simantics.document.ui.editor";
+    private static final String EDITOR_ID = "org.simantics.document.ui.editor"; //$NON-NLS-1$
 
     public OpenEntityDocumentAdapter() throws MalformedURLException {
-        super("Document Editor", ImageDescriptor.createFromURL(new URL(
-                "platform:/plugin/com.famfamfam.silk/icons/table.png")));
+        super(Messages.OpenEntityDocumentAdapter_DocumentEditor, ImageDescriptor.createFromURL(new URL(
+                "platform:/plugin/com.famfamfam.silk/icons/table.png"))); //$NON-NLS-1$
     }
 
     protected String getEditorId() {
index 6e312cb37897081638c77d9b49ce4584d53b26b6..738c3c6bc8313a50304a624e6630fa21275eab39 100644 (file)
@@ -48,7 +48,7 @@ public class AddUrlDocument extends AddDocumentAction {
                        
                        @Override
                        public void run() {
-                               InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Add URL", "Input URL", "", new URLValidator());
+                               InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.AddUrlDocument_AddURL, Messages.AddUrlDocument_InputURL, "", new URLValidator()); //$NON-NLS-3$
                                if (dialog.open() != InputDialog.OK)
                                        return;
                                final String uriString = dialog.getValue();
@@ -69,7 +69,7 @@ public class AddUrlDocument extends AddDocumentAction {
                                        }
                                }, e -> {
                                        if (e != null)
-                                               ExceptionUtils.logAndShowError("Cannot add URL link.", e);
+                                               ExceptionUtils.logAndShowError(Messages.AddUrlDocument_CannotAddURLLink, e);
                                });
                        }
                };
index 61210a222b4f64dce3b2ea9dc3091b5d9efb0e2b..829b2aa324790d7c56cfed15e3f0d122ba47c418 100644 (file)
@@ -69,7 +69,7 @@ public class AddUrlDocumentWithDetail extends AddDocumentAction {
                                }, e -> {
                                        dialog.getAnnotationConfigurator().dispose();
                                        if (e != null)
-                                               ExceptionUtils.logAndShowError("Cannot add URL link.", e);
+                                               ExceptionUtils.logAndShowError("Cannot add URL link.", e); //$NON-NLS-1$
                                });
                        }
                };
@@ -86,7 +86,7 @@ public class AddUrlDocumentWithDetail extends AddDocumentAction {
        }
        
        public static Resource addUrlDocumentWithDetailSCL(WriteGraph graph, Resource target, String name, String uriString) throws DatabaseException {
-           AddUrlDocumentWithDetail urlDocument = new AddUrlDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf");
+           AddUrlDocumentWithDetail urlDocument = new AddUrlDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf"); //$NON-NLS-1$
            Resource urlResource = urlDocument.doAddUrl(graph, name, uriString);
            urlDocument.linkDocument(graph, target, urlResource);
            return urlResource;
index 652476d907058187e8593ea407587a108fa6d002..53777608f5795b084f80b4d65b56418289ebc0ad 100644 (file)
@@ -72,7 +72,7 @@ public class ExportDocumentFile implements ActionFactory {
                                                return;
                                        exportDocument(resource, filename);
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot export document.", e);
+                                       ExceptionUtils.logAndShowError(Messages.ExportDocumentFile_CannotExportDocument, e);
                                }
 
                        }
index 3956a5923bdd7b377c71ac5d14562ee2c4758d93..a7f9a9704554e07b2340165dd9e5e55257be7cd0 100644 (file)
@@ -16,7 +16,9 @@ import java.io.File;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Display;
@@ -47,7 +49,7 @@ public class ExportDocumentFolder implements ActionFactory {
 
        public ExportDocumentFolder(ReadGraph graph, String relationUri, String useResourceNames) throws DatabaseException {
                relation = graph.getResource(relationUri);
-               this.useResourceNames = useResourceNames.equals("true");
+               this.useResourceNames = useResourceNames.equals("true"); //$NON-NLS-1$
        }
        
        @Override
@@ -70,7 +72,7 @@ public class ExportDocumentFolder implements ActionFactory {
                                File folder = new File(folderName);
                                int choice = -1;
                                if (folder.list().length > 0) {
-                                       MessageDialog messageDialog = new MessageDialog(shell, "Folder export", null, "Selected folder \"" + folderName + "\" is not empty.", MessageDialog.QUESTION, new String[]{"Delete and export","Overwrite","Cancel"}, 2);
+                                       MessageDialog messageDialog = new MessageDialog(shell, Messages.ExportDocumentFolder_FolderExport, null, NLS.bind(Messages.ExportDocumentFolder_SelectedFolder, folderName), MessageDialog.QUESTION, new String[]{Messages.ExportDocumentFolder_DeleteAndExport,Messages.ExportDocumentFolder_Overwrite, IDialogConstants.CANCEL_LABEL }, 2); //$NON-NLS-3$
                                        choice = messageDialog.open();
                                        if (choice == 2)
                                                return;
@@ -89,7 +91,7 @@ public class ExportDocumentFolder implements ActionFactory {
                File folder;
                boolean clear = false;
                public ExportJob(Resource resource,File folder, boolean clear) {
-                       super("Export folder");
+                       super(Messages.ExportDocumentFolder_ExportFolder);
                        this.resource = resource;
                        this.folder = folder;
                        this.clear = clear;
@@ -97,17 +99,17 @@ public class ExportDocumentFolder implements ActionFactory {
                @Override
                protected IStatus run(IProgressMonitor monitor) {
                        try {
-                               monitor.beginTask("Export folder", IProgressMonitor.UNKNOWN);
+                               monitor.beginTask(Messages.ExportDocumentFolder_ExportFolder, IProgressMonitor.UNKNOWN);
                                if (clear) {
                                        GraphFileUtil.clearDirectoryStructure(folder);
                                        monitor.worked(1);
                                }
                                FileDocumentUtil.exportDocumentFolder(resource, folder, relation, useResourceNames, monitor);
                                monitor.done();
-                               return new Status(IStatus.OK, Activator.PLUGIN_ID, "Folder exported.");
+                               return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ExportDocumentFolder_ActivatorFolderExported);
                        } catch (Exception e) {
                                monitor.done();
-                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot export document folder.", e);
+                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportDocumentFolder_AcivatorCannotExport, e);
                        }
                }
        }
index 52eb042ac7e6e27e01176996bb7175bdc37c0dfc..923f3d7bf56c9afe4e9834320a0c1ef29ec06ca2 100644 (file)
@@ -56,13 +56,13 @@ public class ImportDocument extends AddDocumentAction {
                                //        if is, use those extensions to filter this list.
                                //        note: in windows using "reg query ..." to read bindings form registry would work.
                                // Note : If the above mentioned filtering is implemented it should be made optional / configurable.
-                               dialog.setFilterExtensions(new String[]{"*.*"});
+                               dialog.setFilterExtensions(new String[]{"*.*"}); //$NON-NLS-1$
                                if (dialog.open() == null) return;
 
                                String filterPath = dialog.getFilterPath();
                                String[] filenames = dialog.getFileNames();
                                
-                               ImportJob job = new ImportJob(filenames.length > 1 ? "Import files" : "Import file", resource, filterPath, filenames);
+                               ImportJob job = new ImportJob(filenames.length > 1 ? Messages.ImportDocument_JobImportFiles : Messages.ImportDocument_ImportFile, resource, filterPath, filenames);
                                job.setUser(true);
                                job.schedule();
                        }
@@ -84,7 +84,7 @@ public class ImportDocument extends AddDocumentAction {
 
                @Override
                protected IStatus run(final IProgressMonitor monitor) {
-                       monitor.beginTask("Importing...", filenames.length);
+                       monitor.beginTask(Messages.ImportDocument_ImportingDots, filenames.length);
                        try {
                                Simantics.getSession().syncRequest(new WriteRequest() {
                                        @Override
@@ -102,9 +102,9 @@ public class ImportDocument extends AddDocumentAction {
                                                }
                                        }
                                });
-                               return new Status(IStatus.OK, Activator.PLUGIN_ID, "Import succesful.");
+                               return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ImportDocument_ActivatorImportSucessful);
                        } catch (DatabaseException e) {
-                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import failed.", e);
+                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ImportDocument_ImportFailed, e);
                        } finally {
                                monitor.done();
                        }
index 88eb503f5a56e28b0f65c2381a1dae3618138a43..ab66fdab3d23ea6c0f92ce099d72c7bd08d3399b 100644 (file)
@@ -58,7 +58,7 @@ public class ImportDocumentFolder implements ActionFactory {
                                        return;
                                }
 
-                               ImportJob job = new ImportJob("Import folder", resource, filename);
+                               ImportJob job = new ImportJob(Messages.ImportDocumentFolder_ImportFolder, resource, filename);
                                job.setUser(true);
                                job.schedule();
                        }
@@ -91,9 +91,9 @@ public class ImportDocumentFolder implements ActionFactory {
                                                }
                                        }
                                });
-                               return new Status(IStatus.OK, Activator.PLUGIN_ID, "Folder imported.");
+                               return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ImportDocumentFolder_ActivatorFolderImported);
                        } catch (DatabaseException e) {
-                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot import document folder.", e);
+                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ImportDocumentFolder_ActivatorCannotImportDocumentFolder, e);
                        }
                }
        }
index 091f33e7d931acc87257f5eb1a33821298b4731f..be504594417a65b900c5172aeaade7d9da4cc686 100644 (file)
@@ -74,7 +74,7 @@ public class ImportDocumentWithDetail extends AddDocumentAction {
                                }, e -> {
                                        dialog.getAnnotationConfigurator().dispose();
                                        if (e != null)
-                                               ExceptionUtils.logAndShowError("Cannot import document.", e);
+                                               ExceptionUtils.logAndShowError(Messages.ImportDocumentWithDetail_CannotImportDocument, e);
                                });
                        }
                };
@@ -91,8 +91,8 @@ public class ImportDocumentWithDetail extends AddDocumentAction {
        public static Resource importDocumentWithDetailSCL(WriteGraph graph, Resource target, String filename) throws FileNotFoundException, DatabaseException {
            File file = new File(filename);
            if (!file.exists())
-               throw new FileNotFoundException("File not found - " + file.getAbsolutePath());
-           ImportDocumentWithDetail document = new ImportDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf");
+               throw new FileNotFoundException("File not found - " + file.getAbsolutePath()); //$NON-NLS-1$
+           ImportDocumentWithDetail document = new ImportDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf"); //$NON-NLS-1$
            return document.doDocumentImport(graph, target, filename, file.getName());
        }
 
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/Messages.java
new file mode 100644 (file)
index 0000000..7e402e4
--- /dev/null
@@ -0,0 +1,35 @@
+package org.simantics.document.ui.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.actions.messages"; //$NON-NLS-1$
+       public static String AddUrlDocument_AddURL;
+       public static String AddUrlDocument_CannotAddURLLink;
+       public static String AddUrlDocument_InputURL;
+       public static String ExportDocumentFile_CannotExportDocument;
+       public static String ExportDocumentFolder_AcivatorCannotExport;
+       public static String ExportDocumentFolder_ActivatorFolderExported;
+       public static String ExportDocumentFolder_DeleteAndExport;
+       public static String ExportDocumentFolder_ExportFolder;
+       public static String ExportDocumentFolder_FolderExport;
+       public static String ExportDocumentFolder_Overwrite;
+       public static String ExportDocumentFolder_SelectedFolder;
+       public static String ImportDocument_ActivatorImportSucessful;
+       public static String ImportDocument_ImportFailed;
+       public static String ImportDocument_ImportFile;
+       public static String ImportDocument_ImportingDots;
+       public static String ImportDocument_JobImportFiles;
+       public static String ImportDocumentFolder_ActivatorCannotImportDocumentFolder;
+       public static String ImportDocumentFolder_ActivatorFolderImported;
+       public static String ImportDocumentFolder_ImportFolder;
+       public static String ImportDocumentWithDetail_CannotImportDocument;
+       public static String NewDocumentFolder_Folder;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 2feadfdcb10c634c4f9d70e2c9dd2785453be03f..674ead9b2911de09a5723036971c4e3d30426718 100644 (file)
@@ -38,7 +38,7 @@ public class NewDocumentFolder implements ActionFactory {
                                            
                                                Layer0 l0 = Layer0.getInstance(graph);
 
-                           String name = NameUtils.findFreshName(graph, "Folder", resource, relation);
+                           String name = NameUtils.findFreshName(graph, Messages.NewDocumentFolder_Folder, resource, relation);
                            Resource folder = graph.newResource();
                            graph.claim(folder, l0.InstanceOf, folderType);
                            graph.claimLiteral(folder, l0.HasName, name);
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/messages.properties
new file mode 100644 (file)
index 0000000..7297932
--- /dev/null
@@ -0,0 +1,21 @@
+AddUrlDocument_AddURL=Add URL\r
+AddUrlDocument_CannotAddURLLink=Cannot add URL link.\r
+AddUrlDocument_InputURL=Input URL\r
+ExportDocumentFile_CannotExportDocument=Cannot export document.\r
+ExportDocumentFolder_AcivatorCannotExport=Cannot export document folder.\r
+ExportDocumentFolder_ActivatorFolderExported=Folder exported.\r
+ExportDocumentFolder_DeleteAndExport=Delete and export\r
+ExportDocumentFolder_ExportFolder=Export folder\r
+ExportDocumentFolder_FolderExport=Folder export\r
+ExportDocumentFolder_Overwrite=Overwrite\r
+ExportDocumentFolder_SelectedFolder=Selected folder "{0}" is not empty.\r
+ImportDocument_ActivatorImportSucessful=Import successful.\r
+ImportDocument_ImportFailed=Import failed.\r
+ImportDocument_ImportFile=Import file\r
+ImportDocument_ImportingDots=Importing...\r
+ImportDocument_JobImportFiles=Import files\r
+ImportDocumentFolder_ActivatorCannotImportDocumentFolder=Cannot import document folder.\r
+ImportDocumentFolder_ActivatorFolderImported=Folder imported.\r
+ImportDocumentFolder_ImportFolder=Import folder\r
+ImportDocumentWithDetail_CannotImportDocument=Cannot import document.\r
+NewDocumentFolder_Folder=Folder\r
index 005cb9e457ae9d40b989f843904d9ce2f0f53b8d..f4f38a8ab74f1a243da6bb05d46f9b366730a4ed 100644 (file)
@@ -77,7 +77,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                DocumentResource doc = DocumentResource.getInstance(graph);
                if (!graph.isInstanceOf(resource, doc.Document))
                        return;
-               result.add(new ComparableTabContributor(new DocumentPropertyTabContributor(), 1, resource, "Document"));
+               result.add(new ComparableTabContributor(new DocumentPropertyTabContributor(), 1, resource, Messages.DocumentTabContribution_Document));
        }
        
        private class DocumentPropertyTabContributor extends PropertyTabContributorImpl {
@@ -90,7 +90,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        GridLayoutFactory.fillDefaults().margins(3,3).spacing(1, 1).numColumns(4).applyTo(composite);
 
                        Label label = new Label(composite, SWT.NONE);
-                       label.setText("Name");
+                       label.setText(Messages.DocumentTabContribution_Name);
 
                        TrackedText name = new TrackedText(composite, support, SWT.BORDER);
                        name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));
@@ -100,7 +100,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        support.register(validator);
                        
                        Button showButton = new Button(composite, SWT.PUSH);
-                       showButton.setText("Show");
+                       showButton.setText(Messages.DocumentTabContribution_Show);
                        showButton.addSelectionListener(new SelectionAdapter() {
                                @Override
                                public void widgetSelected(SelectionEvent e) {
@@ -110,10 +110,10 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        DocumentResource doc;
                        try {
                                doc = DocumentResource.getInstance(context.getSession());
-                               new DocumentRevisionWidget(composite, support, doc.HasOlderVersion, "Old");
-                               new DocumentRevisionWidget(composite, support, doc.HasNewerVersion, "New");
+                               new DocumentRevisionWidget(composite, support, doc.HasOlderVersion, Messages.DocumentTabContribution_Old);
+                               new DocumentRevisionWidget(composite, support, doc.HasNewerVersion, Messages.DocumentTabContribution_New);
                        } catch (DatabaseException e1) {
-                               ExceptionUtils.logAndShowError("Cannot create documen version UI", e1);
+                               ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_CannotCreateDocumentVersionUI, e1);
                        }
                        
 
@@ -129,7 +129,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                public String perform(ReadGraph graph) throws DatabaseException {
                                        Resource res = AdaptionUtils.adaptToSingle(forSelection, Resource.class);
                                        if (res == null)
-                                               return "N/A";
+                                               return Messages.DocumentTabContribution_6;
                                        Layer0 l0 = Layer0.getInstance(graph);
                                        return graph.getPossibleRelatedValue(res, l0.HasName);
                                }
@@ -169,7 +169,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                try {
                                        adapter.openEditor(resource);
                                } catch (Exception e) {
-                                       ExceptionUtils.logAndShowError("Cannot open editor", e);
+                                       ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_7, e);
                                }
                        }
                });
@@ -194,7 +194,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        label.setText(name);
                        text = new Text(parent, SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);
                        showButton = new Button(parent, SWT.PUSH);
-                       showButton.setText("Show");
+                       showButton.setText(Messages.DocumentTabContribution_8);
                        showButton.addSelectionListener(new SelectionAdapter() {
                                @Override
                                public void widgetSelected(SelectionEvent e) {
@@ -203,7 +203,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                }
                        });
                        removeButton = new Button(parent, SWT.PUSH);
-                       removeButton.setText("Unset");
+                       removeButton.setText(Messages.DocumentTabContribution_9);
                        removeButton.addSelectionListener(new SelectionAdapter() {
                                @Override
                                public void widgetSelected(SelectionEvent e) {
@@ -219,7 +219,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                                });
                                                revisionDoc = null;
                                        } catch (DatabaseException e1) {
-                                               ExceptionUtils.logAndShowError("Cannot remove document revision", e1);
+                                               ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_10, e1);
                                        }
                                        updateUI();
                                }
@@ -297,7 +297,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                
                                @Override
                                public void exception(AsyncReadGraph graph, Throwable t) {
-                                       ExceptionUtils.logAndShowError("Cannot show document revision", t);
+                                       ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_11, t);
                                }
                                
                                @Override
@@ -318,7 +318,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        if (revisionDoc != null)
                                text.setText(revisionDoc.getName());
                        else
-                               text.setText("");
+                               text.setText(""); //$NON-NLS-1$
                }
                
                private void setRevisionDoc(final Resource toSet) {
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/Messages.java
new file mode 100644 (file)
index 0000000..8263dd2
--- /dev/null
@@ -0,0 +1,28 @@
+package org.simantics.document.ui.contribution;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.contribution.messages"; //$NON-NLS-1$
+       public static String DocumentTabContribution_10;
+       public static String DocumentTabContribution_11;
+       public static String DocumentTabContribution_6;
+       public static String DocumentTabContribution_7;
+       public static String DocumentTabContribution_8;
+       public static String DocumentTabContribution_9;
+       public static String DocumentTabContribution_CannotCreateDocumentVersionUI;
+       public static String DocumentTabContribution_Document;
+       public static String DocumentTabContribution_Name;
+       public static String DocumentTabContribution_New;
+       public static String DocumentTabContribution_Old;
+       public static String DocumentTabContribution_Show;
+       public static String NameInputValidator_CannotHaveDuplicateName;
+       public static String NameInputValidator_EmptyNameNotAllowed;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 14ff5f60d62e7a4f49cb238fcb2431dd0d38400f..009d803f8a218d9397ff6646b956f975484b1d4f 100644 (file)
@@ -3,6 +3,7 @@ package org.simantics.document.ui.contribution;
 import java.util.Collection;
 
 import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.Simantics;
 import org.simantics.browsing.ui.swt.widgets.impl.Widget;
 import org.simantics.db.ReadGraph;
@@ -20,7 +21,7 @@ public class NameInputValidator implements IInputValidator, Widget {
        @Override
        public String isValid(final String newText) {
                if (newText == null || newText.length() == 0)
-                       return "Empty name is not allowed";
+                       return Messages.NameInputValidator_EmptyNameNotAllowed;
                if (selection != null) {
                        try {
                                return Simantics.getSession().syncRequest(new Read<String>() {
@@ -36,7 +37,7 @@ public class NameInputValidator implements IInputValidator, Widget {
                                                                continue;
                                                        String n = graph.getPossibleRelatedValue(resource, l0.HasName);
                                                        if (newText.equals(n))
-                                                               return "Cannot have duplicate name " + newText;
+                                                               return NLS.bind(Messages.NameInputValidator_CannotHaveDuplicateName, newText);
                                                }
                                                return null;
                                        }
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/messages.properties
new file mode 100644 (file)
index 0000000..a2278ac
--- /dev/null
@@ -0,0 +1,14 @@
+DocumentTabContribution_10=Cannot remove document revision
+DocumentTabContribution_11=Cannot show document revision
+DocumentTabContribution_6=N/A
+DocumentTabContribution_7=Cannot open editor
+DocumentTabContribution_8=Show
+DocumentTabContribution_9=Unset
+DocumentTabContribution_CannotCreateDocumentVersionUI=Cannot create document version UI
+DocumentTabContribution_Document=Document
+DocumentTabContribution_Name=Name
+DocumentTabContribution_New=New
+DocumentTabContribution_Old=Old
+DocumentTabContribution_Show=Show
+NameInputValidator_CannotHaveDuplicateName=Cannot have duplicate name {0}
+NameInputValidator_EmptyNameNotAllowed=Empty name is not allowed
index 2c63d61577dd9e10c6dfaa1f4a2c39ff888c937e..23253242392a8178b1f10d6534df28e00e33c261 100644 (file)
@@ -92,7 +92,7 @@ public class AnnotationConfigurator {
                VirtualGraph vg = null;
                if (useVG) {
                        VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
-                       vg = support.getMemoryPersistent("document_annotation");
+                       vg = support.getMemoryPersistent("document_annotation"); //$NON-NLS-1$
                }
                Variable annotationHolder = null;
                try {
@@ -101,7 +101,7 @@ public class AnnotationConfigurator {
                                        Layer0 l0 = Layer0.getInstance(graph);
                                        Resource annotationHolderDoc = graph.newResource();
                                        graph.claim(annotationHolderDoc, l0.InstanceOf, type);
-                                       graph.claimLiteral(annotationHolderDoc, l0.HasName, "Template");
+                                       graph.claimLiteral(annotationHolderDoc, l0.HasName, "Template"); //$NON-NLS-1$
                                        graph.claim(lib, l0.ConsistsOf, annotationHolderDoc);
                                        if (graph.isInstanceOf(lib, type)) {
                                                copyAnnotations(graph, lib, annotationHolderDoc);
@@ -187,7 +187,7 @@ public class AnnotationConfigurator {
                
                if (useVG) {
                        VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
-                       VirtualGraph vg = support.getMemoryPersistent("document_annotation");
+                       VirtualGraph vg = support.getMemoryPersistent("document_annotation"); //$NON-NLS-1$
                        support.discard(vg);
                } else {
                        
index a8ae3c19510d452226864c35232c3b8d39ff8421..c8ac4ca31ffccb12b302e3d22c4047ee9518d543 100644 (file)
@@ -86,16 +86,16 @@ public class FileDetailDialog extends TextInputDialog{
                GridDataFactory.fillDefaults().hint(500, 500).applyTo(composite);
                
                Label label = new Label(composite, SWT.NONE);
-               label.setText("File:");
+               label.setText(Messages.FileDetailDialog_File);
                fileText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                Button browseButton = new Button(composite, SWT.PUSH);
-               browseButton.setText("Browse");
+               browseButton.setText(Messages.FileDetailDialog_Browse);
                label = new Label(composite, SWT.NONE);
-               label.setText("Name:");
+               label.setText(Messages.FileDetailDialog_Name);
                nameText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                label = new Label(composite, SWT.NONE);
                label = new Label(composite, SWT.NONE);
-               label.setText("Annotations:");
+               label.setText(Messages.FileDetailDialog_Annotations);
                annotationComposite = new Composite(composite, SWT.NONE);
                annotationComposite.setLayout(new FillLayout());
                
@@ -130,7 +130,7 @@ public class FileDetailDialog extends TextInputDialog{
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                FileDialog dialog = new FileDialog(e.display.getActiveShell(),SWT.OPEN);
-                               dialog.setFilterExtensions(new String[]{"*.*"});
+                               dialog.setFilterExtensions(new String[]{"*.*"}); //$NON-NLS-1$
                                String s = dialog.open();
                                if (s != null) {
                                        name = null;
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/Messages.java
new file mode 100644 (file)
index 0000000..be49534
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.document.ui.dialogs;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.dialogs.messages"; //$NON-NLS-1$
+       public static String FileDetailDialog_Annotations;
+       public static String FileDetailDialog_Browse;
+       public static String FileDetailDialog_File;
+       public static String FileDetailDialog_Name;
+       public static String UrlDetailDialog_Annotations;
+       public static String UrlDetailDialog_Name;
+       public static String UrlDetailDialog_URL;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ef3739e1adefaaadd413bee197c1df704ccf8b4c..1c0efc6da6a01a7f63ca80e5177ec78e38f6f61c 100644 (file)
@@ -86,13 +86,13 @@ public class UrlDetailDialog extends TextInputDialog{
                GridDataFactory.fillDefaults().hint(500, 500).applyTo(composite);
                
                Label label = new Label(composite, SWT.NONE);
-               label.setText("URL:");
+               label.setText(Messages.UrlDetailDialog_URL);
                urlText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                label = new Label(composite, SWT.NONE);
-               label.setText("Name:");
+               label.setText(Messages.UrlDetailDialog_Name);
                nameText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                label = new Label(composite, SWT.NONE);
-               label.setText("Annotations:");
+               label.setText(Messages.UrlDetailDialog_Annotations);
                annotationComposite = new Composite(composite, SWT.BORDER);
                annotationComposite.setLayout(new FillLayout());
 //             
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/messages.properties
new file mode 100644 (file)
index 0000000..5d07228
--- /dev/null
@@ -0,0 +1,7 @@
+FileDetailDialog_Annotations=Annotations:\r
+FileDetailDialog_Browse=Browse\r
+FileDetailDialog_File=File:\r
+FileDetailDialog_Name=Name:\r
+UrlDetailDialog_Annotations=Annotations:\r
+UrlDetailDialog_Name=Name:\r
+UrlDetailDialog_URL=URL:\r
index effe30cd9b51c0ead4d1b7e97105d48c93fd0838..a500aa12c93a040fb867ab74fab7bd9677ddb395 100644 (file)
@@ -101,13 +101,13 @@ public class All {
                Resource documentType = graph.getSingleObject(binding, 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(resource, DOC.HasDocumentation, document);
                graph.claim(document, L0.PartOf, resource);
 
                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);
 
@@ -286,7 +286,7 @@ public class All {
 
        Variable result = ScenegraphLoaderProcess.getVariable(graph, null, scenegraph, ScenegraphLoaderUtils.getRuntime(graph, context), root);
        if(result != null) {
-               Variable userDoc = result.getPossibleProperty(graph, "UserDocumentation");
+               Variable userDoc = result.getPossibleProperty(graph, "UserDocumentation"); //$NON-NLS-1$
                if(userDoc != null) return userDoc;
        }
        
@@ -309,7 +309,7 @@ public class All {
     @SCLValue(type = "ReadGraph -> Resource -> Variable -> a")
     public static Object wikitextModifier(ReadGraph graph, final Resource resource, final Variable context) throws DatabaseException {
        
-               final ScenegraphPropertyReference<String> textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text");
+               final ScenegraphPropertyReference<String> textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text"); //$NON-NLS-1$
        
        return new FunctionImpl1<Object, Object>() {
 
@@ -323,12 +323,12 @@ public class All {
 
                                                @Override
                                                public void perform(WriteGraph graph) throws DatabaseException {
-                                                       Variable selection = resolveEditSelection(graph, context, "..../Scroll/Browser#edited");
+                                                       Variable selection = resolveEditSelection(graph, context, "..../Scroll/Browser#edited"); //$NON-NLS-1$
                                                        if (selection != null) {
                                                            selection.setValue(graph, (String)value, Bindings.STRING);
                                                                graph.markUndoPoint();
                                                        } else {
-                                                               LOGGER.error("No selection for resource : " + resource + ", Variable context : " + context + ", value : " + value);
+                                                               LOGGER.error("No selection for resource : " + resource + ", Variable context : " + context + ", value : " + value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                                        }
                                                }
                                                
@@ -351,7 +351,7 @@ public class All {
     @SCLValue(type = "ReadGraph -> Resource -> Variable -> String")
     public static String selectedDocumentPart(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
 
-               Variable selection = resolveEditSelection(graph, context, ".../Scroll/Browser#edited");
+               Variable selection = resolveEditSelection(graph, context, ".../Scroll/Browser#edited"); //$NON-NLS-1$
                if(selection == null) return null;
 
        return selection.getValue(graph);
@@ -389,8 +389,8 @@ public class All {
                final ScenegraphPropertyReference<Point> selectionReference;
 
        public WikiButtonModifier(ReadGraph graph, Variable context) throws DatabaseException {
-               textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text");
-               selectionReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#selection");
+               textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text"); //$NON-NLS-1$
+               selectionReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#selection"); //$NON-NLS-1$
        }
        
        abstract void perform(String before, String selected, String after, Point selection);
@@ -417,9 +417,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "'''bold text'''" + after);
+                                       textReference.setValue(before + "'''bold text'''" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "'''" + selected + "'''" + after);      
+                                       textReference.setValue(before + "'''" + selected + "'''" + after);       //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -437,9 +437,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "''italic text''" + after);
+                                       textReference.setValue(before + "''italic text''" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "''" + selected + "''" + after);        
+                                       textReference.setValue(before + "''" + selected + "''" + after);         //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -457,9 +457,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">strikethrough text</span>" + after);
+                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">strikethrough text</span>" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">" + selected + "</span>" + after);       
+                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">" + selected + "</span>" + after);        //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -477,9 +477,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">strikethrough text</span>" + after);
+                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">strikethrough text</span>" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">" + selected + "</span>" + after);  
+                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">" + selected + "</span>" + after);   //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -496,7 +496,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n<hr/>\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n<hr/>\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -512,7 +512,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + ":" + selected + after);
+                               textReference.setValue(before + ":" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -527,7 +527,7 @@ public class All {
                        
                private String hex2(int value) {
                        String result = Integer.toHexString(value);
-                       if(result.length() == 1) result = "0" + result;
+                       if(result.length() == 1) result = "0" + result; //$NON-NLS-1$
                        return result;
                }
                
@@ -545,9 +545,9 @@ public class All {
                                String hex = hex2(rgb.red) + hex2(rgb.green) + hex2(rgb.blue);
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >formatted text</font>" + selected + after);
+                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >formatted text</font>" + selected + after); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                                } else {
-                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >" + selected + "</font>" + after);
+                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >" + selected + "</font>" + after); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                                }
                                
                        }
@@ -564,7 +564,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "[[Image:root://Library/image.png|100px]]" + "\r\n" + selected + after);
+                               textReference.setValue(before + "[[Image:root://Library/image.png|100px]]" + "\r\n" + selected + after); //$NON-NLS-1$ //$NON-NLS-2$
                                
                        }
                        
@@ -580,7 +580,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n= Header 1 =\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n= Header 1 =\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -596,7 +596,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n== Header 2 ==\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n== Header 2 ==\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -612,7 +612,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n=== Header 3 ===\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n=== Header 3 ===\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -628,7 +628,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n==== Header 4 ====\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n==== Header 4 ====\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -644,11 +644,11 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n" +
-                                               "# Item1\r\n" + 
-                                               "# Item2\r\n" + 
-                                               "## Item2.1\r\n" + 
-                                               "# Item3\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n" + //$NON-NLS-1$
+                                               "# Item1\r\n" +  //$NON-NLS-1$
+                                               "# Item2\r\n" +  //$NON-NLS-1$
+                                               "## Item2.1\r\n" +  //$NON-NLS-1$
+                                               "# Item3\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -664,11 +664,11 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n" +
-                                               "* Item1\r\n" + 
-                                               "* Item2\r\n" + 
-                                               "** Item2.1\r\n" + 
-                                               "* Item3\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n" + //$NON-NLS-1$
+                                               "* Item1\r\n" +  //$NON-NLS-1$
+                                               "* Item2\r\n" +  //$NON-NLS-1$
+                                               "** Item2.1\r\n" +  //$NON-NLS-1$
+                                               "* Item3\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -684,16 +684,16 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n" +
-                                               "{| border=\"1\"\r\n" + 
-                                               "! header\r\n" +
-                                               "! header2 \r\n" +
-                                               "|-\r\n" +
-                                               "| cell || cell2\r\n" + 
-                                               "|-\r\n" +
-                                               "| cell3\r\n" + 
-                                               "| cell4\r\n" + 
-                                               "|}\r\n"  + selected + after);
+                               textReference.setValue(before + "\r\n" + //$NON-NLS-1$
+                                               "{| border=\"1\"\r\n" +  //$NON-NLS-1$
+                                               "! header\r\n" + //$NON-NLS-1$
+                                               "! header2 \r\n" + //$NON-NLS-1$
+                                               "|-\r\n" + //$NON-NLS-1$
+                                               "| cell || cell2\r\n" +  //$NON-NLS-1$
+                                               "|-\r\n" + //$NON-NLS-1$
+                                               "| cell3\r\n" +  //$NON-NLS-1$
+                                               "| cell4\r\n" +  //$NON-NLS-1$
+                                               "|}\r\n"  + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -707,7 +707,7 @@ public class All {
             @Override
             void perform(String before, String selected, String after, Point selection) {
                 textReference.setValue(before +
-                        "[[Media:root://Documents/Document.pdf|Link to a file within the model]]\r\n" + selected + after);
+                        "[[Media:root://Documents/Document.pdf|Link to a file within the model]]\r\n" + selected + after); //$NON-NLS-1$
                 
             }
         };
@@ -722,7 +722,7 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                textReference.setValue(before +
-                                               "[http://www.simantics.org External Website Link]\r\n" + selected + after);
+                                               "[http://www.simantics.org External Website Link]\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -752,7 +752,7 @@ public class All {
                                    try {
                                        WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, root, root, rvi));
                                    } catch (PartInitException e) {
-                                       LOGGER.error("Failed to open CSS editor for root " + root, e);
+                                       LOGGER.error("Failed to open CSS editor for root " + root, e); //$NON-NLS-1$
                                    }
                                });
 
@@ -812,17 +812,17 @@ public class All {
     public static String noDocumentText(ReadGraph graph, final Resource resource, final Variable context) throws DatabaseException {
                
        Variable selection = ScenegraphLoaderUtils.getPossibleVariableSelection(graph, context);
-       if(selection == null) return "<no input>";
+       if(selection == null) return "<no input>"; //$NON-NLS-1$
        
                Resource input = selection.getRepresents(graph);
-       if(input == null) return "<no input>";
+       if(input == null) return "<no input>"; //$NON-NLS-1$
        
        String path = DocumentUtils.indexRootPath(graph, selection);
        if(!path.isEmpty()) {
-               return "for " + path + selection.getName(graph);
+               return "for " + path + selection.getName(graph); //$NON-NLS-1$
        }
        
-               return "for " + NameUtils.getSafeLabel(graph, input);
+               return "for " + NameUtils.getSafeLabel(graph, input); //$NON-NLS-1$
        
     }
 
@@ -873,7 +873,7 @@ public class All {
                         DefaultActions.asyncPerformDefaultAction(s, input, false, false, false);
                     }
                 } catch (DatabaseException | InterruptedException e) {
-                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to resolve URI to a database resource or variable: " + uri, e));
+                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to resolve URI to a database resource or variable: " + uri, e)); //$NON-NLS-1$
                 }
             }
             return true;
index 3fc15364dab39f937dddca1b9f10ad7c7241564e..39ae0731b3352c2b92e3b22517602e5ced3556b0 100644 (file)
@@ -27,7 +27,7 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
        public SearchResult apply(IProgressMonitor monitor, ReadGraph graph, Resource model, SearchQuery query, Integer maxResults) {
                 try {
                         Collection<Map<String, Object>> results = Searching.performSearch(graph, Layer0X.getInstance(graph).Dependencies, model,
-                           query.escaped(false).getQuery("Name","Types"), maxResults);
+                           query.escaped(false).getQuery("Name","Types"), maxResults); //$NON-NLS-1$ //$NON-NLS-2$
                        return generateSearchResults(graph, results);
                } catch (DatabaseException e) {
                    Logger.defaultLogError(e);
index 82372f1264a568c21a06927a59c147f7583b6f24..c53fd1ab37038a1791a1603102aad54035065b7d 100644 (file)
@@ -43,7 +43,7 @@ public class DocumentVersionUtils {
        public static void createNewVersion(WriteGraph graph, Resource oldDocument, Resource newDocument, Resource relation) throws DatabaseException{
                DocumentResource doc = DocumentResource.getInstance(graph);
                if (graph.hasStatement(oldDocument, doc.HasNewerVersion))
-                       throw new DatabaseException("Document " + NameUtils.getSafeName(graph, oldDocument) +" has already new version");
+                       throw new DatabaseException("Document " + NameUtils.getSafeName(graph, oldDocument) +" has already new version"); //$NON-NLS-1$ //$NON-NLS-2$
                
                Resource inverse = graph.getInverse(relation);
                Resource lib = graph.getSingleObject(oldDocument, inverse);
@@ -81,7 +81,7 @@ public class DocumentVersionUtils {
                if (!graph.getSingleType(document2, doc.Document).equals(graph.getSingleType(document1, doc.Document)))
                        return;
                if (!versionRel.equals(doc.HasNewerVersion) && !(versionRel.equals(doc.HasOlderVersion)))
-                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel));
+                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel)); //$NON-NLS-1$
                
                Resource versionRelInv = graph.getInverse(versionRel);
                // toSet must not be part of the document's version history
@@ -112,7 +112,7 @@ public class DocumentVersionUtils {
                if (lib != null) {
                        Resource relation = graph.getPossibleObject(lib, doc.HasLibraryRelation);
                        String type= graph.getPossibleRelatedValue(lib, doc.HasVersionType);
-                       if ("TREE".equals(type) && relation != null) {
+                       if ("TREE".equals(type) && relation != null) { //$NON-NLS-1$
                                if (versionRel.equals(doc.HasOlderVersion)) {
                                        graph.deny(document2, graph.getInverse(relation));
                                        graph.claim(document1,relation,document2);
@@ -136,14 +136,14 @@ public class DocumentVersionUtils {
        public static void unsetVersion(WriteGraph graph, Resource document1, Resource document2, Resource versionRel) throws DatabaseException {
                DocumentResource doc = DocumentResource.getInstance(graph);
                if (!versionRel.equals(doc.HasNewerVersion) && !(versionRel.equals(doc.HasOlderVersion)))
-                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel));
+                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel)); //$NON-NLS-1$
                
                graph.deny(document1, versionRel,document2);
                Resource lib = getLib(graph, document1);
                if (lib != null) {
                        Resource relation = graph.getPossibleObject(lib, doc.HasLibraryRelation);
                        String type= graph.getPossibleRelatedValue(lib, doc.HasVersionType);
-                       if ("TREE".equals(type) && relation != null) {
+                       if ("TREE".equals(type) && relation != null) { //$NON-NLS-1$
                                if (versionRel.equals(doc.HasOlderVersion)) {
                                        graph.deny(document1, relation);
                                        graph.claim(lib,relation,document2);
index 42190d87829283cf165d4ede9a49422abf645fae..07ed6432771cced743a3a1ac5e17f3c7478c913c 100644 (file)
@@ -47,7 +47,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
     private static ExternalFileWatcher fileWatcher;
 
        public ExternalEditorAdapter() {
-               super("External Editor", Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/page.png"));
+               super(Messages.ExternalEditorAdapter_ExternalEditor, Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/page.png")); //$NON-NLS-2$ //$NON-NLS-3$
        }
 
        @Override
@@ -78,7 +78,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                     StringBuilder sb = new StringBuilder();
                     String uri = graph.getPossibleURI(input);
                     if (uri != null) {
-                        sb.append(generateSHA1(uri)).append("_");
+                        sb.append(generateSHA1(uri)).append("_"); //$NON-NLS-1$
                     }
                     sb.append(graph.getRelatedValue(input, Layer0.getInstance(graph).HasName).toString());
                     Path filePath = Activator.getInstanceLocation().resolve(sb.toString());
@@ -86,11 +86,11 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                         try {
                             GraphFileUtil.writeDataToFile(graph, input, filePath.toFile());
                         } catch (IOException | DatabaseException e) {
-                            LOGGER.error("Could not write data to file ", e);
+                            LOGGER.error("Could not write data to file ", e); //$NON-NLS-1$
                         }
                         return input;
                     });
-                    LOGGER.info("Adding tempFile {} with resource {}", filePath, input);
+                    LOGGER.info("Adding tempFile {} with resource {}", filePath, input); //$NON-NLS-1$
                     return filePath;
                 }
             });
@@ -103,20 +103,20 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
     }
 
     public static String generateSHA1(String message) {
-        return hashString(message, "SHA-1");
+        return hashString(message, "SHA-1"); //$NON-NLS-1$
     }
 
     private static String hashString(String message, String algorithm) {
         try {
             MessageDigest digest = MessageDigest.getInstance(algorithm);
-            byte[] hashedBytes = digest.digest(message.getBytes("UTF-8"));
+            byte[] hashedBytes = digest.digest(message.getBytes("UTF-8")); //$NON-NLS-1$
      
             return convertByteArrayToHexString(hashedBytes);
         } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
             // Should not happen
-            LOGGER.error("Could not generate hash", ex);
+            LOGGER.error("Could not generate hash", ex); //$NON-NLS-1$
         }
-        return "";
+        return ""; //$NON-NLS-1$
     }
 
     private static String convertByteArrayToHexString(byte[] arrayBytes) {
@@ -171,15 +171,15 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                             Path parent = keys.get(key);
                             Path newPath = parent.resolve(pathEvent.context());
                             if (ENTRY_MODIFY == kind) {
-                                LOGGER.info("New path modified: " + newPath);
+                                LOGGER.info("New path modified: " + newPath); //$NON-NLS-1$
                                 Resource resource = tempFiles.get(newPath);
                                 if (resource != null) {
                                     GraphFileUtil.writeDataToGraph(newPath.toFile(), resource);
                                 } else {
-                                    LOGGER.warn("No resource found for {}", newPath.toAbsolutePath());
+                                    LOGGER.warn("No resource found for {}", newPath.toAbsolutePath()); //$NON-NLS-1$
                                 }
                             } else if (ENTRY_DELETE == kind) {
-                                System.out.println("New path deleted: " + newPath);
+                                System.out.println("New path deleted: " + newPath); //$NON-NLS-1$
                             }
                         }
                         if (!key.reset()) {
@@ -188,9 +188,9 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                         }
                     } catch (InterruptedException e) {
                         if (!stopped.get())
-                            LOGGER.error("Could not stop", e);
+                            LOGGER.error("Could not stop", e); //$NON-NLS-1$
                     } catch (Throwable t) {
-                        LOGGER.error("An error occured", t);
+                        LOGGER.error("An error occured", t); //$NON-NLS-1$
                     }
                 }
             });
@@ -202,7 +202,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
         
         private void register(Path path) throws IOException {
             if (Files.isDirectory(path)) {
-                LOGGER.info("Registering path {}", path);
+                LOGGER.info("Registering path {}", path); //$NON-NLS-1$
                 WatchKey key = path.toAbsolutePath().register(ws, ENTRY_DELETE, ENTRY_MODIFY);
                 keys.put(key, path);
             }
index 9a9e3f8f10723ddb925f13ae6795df53f1ad36b2..836a822b70603ff07e5195d82cfa976c1f470536 100644 (file)
@@ -11,6 +11,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
@@ -63,7 +64,7 @@ public class FileDocumentUtil {
                        }
                }, e -> {
                        if (e != null)
-                               ExceptionUtils.logAndShowError("Cannot import file " + fileName, e);
+                               ExceptionUtils.logAndShowError(NLS.bind(Messages.FileDocumentUtil_CannotImportFile, fileName), e);
                });
                        
                
@@ -148,7 +149,7 @@ public class FileDocumentUtil {
        public static void importFolder(WriteGraph graph, File folder, Resource folderResource, Resource relation, IProgressMonitor monitor) throws Exception{
                if (monitor != null) {
                        int count = _countFiles(folder);
-                       monitor.beginTask("Import files", count);
+                       monitor.beginTask(Messages.FileDocumentUtil_MonitorImportFiles, count);
                }
                _importFolder(graph, folder, folderResource, relation, monitor);
                if (monitor != null)
@@ -215,7 +216,7 @@ public class FileDocumentUtil {
                        return;
                int i = 1;
                while (true) {
-                       String proposal = name +" (" + i +")";
+                       String proposal = name +" (" + i +")"; //$NON-NLS-1$ //$NON-NLS-2$
                        if (!names.contains(proposal)) {
                                graph.claimLiteral(res, l0.HasName, proposal);
                                return;
@@ -295,12 +296,12 @@ public class FileDocumentUtil {
                                        name = graph.getRelatedValue(r, useResourceNames ? gf.HasResourceName : l0.HasName);
                                        canExport = true;
                                } else if (graph.isInstanceOf(r, doc.UrlDocument)) {
-                                       name = graph.getRelatedValue(r, l0.HasName) +".url";
+                                       name = graph.getRelatedValue(r, l0.HasName) +".url"; //$NON-NLS-1$
                                        canExport = true;
                                }
                                if (canExport) {
                                        name = resolveName(folder, name, names, true);
-                                       File file = new File(folder.getAbsolutePath()+"/"+name);
+                                       File file = new File(folder.getAbsolutePath()+"/"+name); //$NON-NLS-1$
                                        if (graph.isInstanceOf(r, doc.FileDocument)) {
                                                GraphFileUtil.writeDataToFile(graph,r, file);
                                        } else if (graph.isInstanceOf(r, doc.UrlDocument)) {
@@ -317,7 +318,7 @@ public class FileDocumentUtil {
                                if (type.size() == folderType.size() && folderType.containsAll(type)) {
                                        String name = graph.getRelatedValue(r, l0.HasName);
                                        name = resolveName(folder, name, names, false);
-                                       File subFolder = new File(folder.getAbsolutePath()+"/"+name);
+                                       File subFolder = new File(folder.getAbsolutePath()+"/"+name); //$NON-NLS-1$
                                        if (!subFolder.exists()) {
                                                if (!subFolder.mkdir()) {
                                                        // TODO : error.
@@ -337,10 +338,10 @@ public class FileDocumentUtil {
         * @throws DatabaseException
         */
        private static void exportUrl(File toFile, String name, String url) throws Exception{
-               PrintStream os = new PrintStream(toFile,"UTF-8");
-               os.println("[InternetShortcut]");
-               os.println("URL="+url);
-               os.println("name="+name);
+               PrintStream os = new PrintStream(toFile,"UTF-8"); //$NON-NLS-1$
+               os.println("[InternetShortcut]"); //$NON-NLS-1$
+               os.println("URL="+url); //$NON-NLS-1$
+               os.println("name="+name); //$NON-NLS-1$
                os.flush();
                os.close();
        }
@@ -351,11 +352,11 @@ public class FileDocumentUtil {
                String name = null;
                BufferedReader is = null;
                try {
-               is = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
+               is = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); //$NON-NLS-1$
                while ((s = is.readLine()) != null) {
-                       if (s.startsWith("URL=")) {
+                       if (s.startsWith("URL=")) { //$NON-NLS-1$
                                url = s.substring(4);
-                       } else if (s.startsWith("name=")) {
+                       } else if (s.startsWith("name=")) { //$NON-NLS-1$
                                name = s.substring(5);
                        }
                }
@@ -383,7 +384,7 @@ public class FileDocumentUtil {
        }
        
        private static boolean isUrl(File file) throws Exception{
-               return (file.getAbsolutePath().endsWith(".url"));
+               return (file.getAbsolutePath().endsWith(".url")); //$NON-NLS-1$
        }
        
        private static final char ESCAPE = '%';
@@ -413,7 +414,7 @@ public class FileDocumentUtil {
                for (int i = 0; i < len; i++) {
                    char ch = s.charAt(i);
                    if (ch == ESCAPE) {
-                       String num = "0x";
+                       String num = "0x"; //$NON-NLS-1$
                        num += s.charAt(++i);
                        num += s.charAt(++i);
                        ch = (char)Integer.decode(num).intValue();
@@ -433,7 +434,7 @@ public class FileDocumentUtil {
                                if (used.contains(current)) {
                                        current = createFileName(proposal, i);
                                } else {
-                                       File subFile = new File(parentFolder.getAbsolutePath()+"/"+current);
+                                       File subFile = new File(parentFolder.getAbsolutePath()+"/"+current); //$NON-NLS-1$
                                        if (!subFile.exists())
                                                break;
                                        if (subFile.exists() && subFile.isFile() && subFile.canWrite()) {
@@ -447,7 +448,7 @@ public class FileDocumentUtil {
                                if (used.contains(current)) {
                                        current = proposal+i;
                                } else {
-                                       File subFolder = new File(parentFolder.getAbsolutePath()+"/"+current);
+                                       File subFolder = new File(parentFolder.getAbsolutePath()+"/"+current); //$NON-NLS-1$
                                        if (!subFolder.exists())
                                                break;
                                        if (subFolder.exists() && subFolder.isDirectory()) {
@@ -461,7 +462,7 @@ public class FileDocumentUtil {
        }
        
        private static String createFileName(String original, int i) {
-               int extIndex = original.lastIndexOf(".");
+               int extIndex = original.lastIndexOf("."); //$NON-NLS-1$
                if (extIndex == -1)
                        return original+i;
                return original.substring(0,extIndex) + i + original.substring(extIndex);
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/Messages.java
new file mode 100644 (file)
index 0000000..24f39d7
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.document.ui.graphfile;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.graphfile.messages"; //$NON-NLS-1$
+       public static String ExternalEditorAdapter_ExternalEditor;
+       public static String FileDocumentUtil_CannotImportFile;
+       public static String FileDocumentUtil_MonitorImportFiles;
+       public static String UrlEditorAdapter_Browser;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 15e4d6e74f456c507e239334a76e9b7840e82d08..f5c7956d8e97bdafefd7abffabe0413dc2d058b5 100644 (file)
@@ -22,7 +22,7 @@ import org.simantics.utils.ui.ExceptionUtils;
 public class UrlEditorAdapter extends AbstractResourceEditorAdapter implements EditorAdapter {
        
        public UrlEditorAdapter() {
-               super("Browser",Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/world.png"));
+               super(Messages.UrlEditorAdapter_Browser,Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/world.png")); //$NON-NLS-2$ //$NON-NLS-3$
        }
 
        
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/messages.properties
new file mode 100644 (file)
index 0000000..7b56701
--- /dev/null
@@ -0,0 +1,4 @@
+ExternalEditorAdapter_ExternalEditor=External Editor
+FileDocumentUtil_CannotImportFile=Cannot import file {0}
+FileDocumentUtil_MonitorImportFiles=Import files
+UrlEditorAdapter_Browser=Browser
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/messages.properties
new file mode 100644 (file)
index 0000000..23da786
--- /dev/null
@@ -0,0 +1,2 @@
+DocumentView_PinSelection=Pin Selection
+OpenEntityDocumentAdapter_DocumentEditor=Document Editor
index 0959ae9f854b9ba3aa900acc84143f8c26b1466a..67ef4ae0de4b58df895de8912d828448adfaf0f7 100644 (file)
@@ -12,7 +12,7 @@ public abstract  class FileDocumentImportWizard extends Wizard{
        FileSelectionPage fileSelectionPage;
        
        public FileDocumentImportWizard(Resource lib) {
-               setWindowTitle("Document File import");
+               setWindowTitle(Messages.FileDocumentImportWizard_DocumentFileImport);
                setNeedsProgressMonitor(false);
        }
        
index eb43ee79471af3d0da638e45bb426fdcb5a131b7..188d6c46c1529024bf99a70d660c7f02178639f6 100644 (file)
@@ -22,7 +22,7 @@ public class FileSelectionPage extends WizardPage {
        String fileName;
 
        public FileSelectionPage() {
-               super("FileSelction","Select a file",null);
+               super(Messages.FileSelectionPage_FileSelection,Messages.FileSelectionPage_SelectAFile,null);
        }
 
        @Override
@@ -30,7 +30,7 @@ public class FileSelectionPage extends WizardPage {
                parent.setLayout(new GridLayout(3,false));
                fileText = new Text(parent,SWT.BORDER|SWT.SINGLE);
                browseButton = new Button(parent, SWT.PUSH);
-               browseButton.setText("Browse");
+               browseButton.setText(Messages.FileSelectionPage_Browse);
                
                GridData data;
                data = new GridData();
@@ -50,7 +50,7 @@ public class FileSelectionPage extends WizardPage {
                                // TODO : is there any way to read file/executable bindings from OS?
                                //        if is, use those extensions to filter this list.
                                //        note: in windows using "reg query ..." to read bindings form registry would work.
-                               dialog.setFilterExtensions(new String[]{"*.*"});
+                               dialog.setFilterExtensions(new String[]{"*.*"}); //$NON-NLS-1$
                                String name = dialog.open();
                                if (name != null) {
                                        fileText.setText(name);
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/Messages.java
new file mode 100644 (file)
index 0000000..7e9a4fb
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.document.ui.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.wizard.messages"; //$NON-NLS-1$
+       public static String FileDocumentImportWizard_DocumentFileImport;
+       public static String FileSelectionPage_Browse;
+       public static String FileSelectionPage_FileSelection;
+       public static String FileSelectionPage_SelectAFile;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/messages.properties
new file mode 100644 (file)
index 0000000..6700a28
--- /dev/null
@@ -0,0 +1,4 @@
+FileDocumentImportWizard_DocumentFileImport=Document File import\r
+FileSelectionPage_Browse=Browse\r
+FileSelectionPage_FileSelection=FileSelction\r
+FileSelectionPage_SelectAFile=Select a file\r
diff --git a/i18n.md b/i18n.md
index f59af84237837ddd6ba3ade0854c5978cb0bb058..9119c8b197aca51a5892342b8b8fae33df59e654 100644 (file)
--- a/i18n.md
+++ b/i18n.md
@@ -5,6 +5,7 @@
 * [x] org.simantics.debug.ui 
 * [x] org.simantics.desktop.ui
 * [x] org.simantics.document.linking.ui
+* [x] org.simantics.document.ui
 * ...
 
 ## TODO ##