]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java
Externalize strings in org.simantics.document.ui
[simantics/platform.git] / bundles / org.simantics.document.ui / src / org / simantics / document / ui / function / All.java
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;