Externalize org.simantics.document.linking.ui 05/2505/4
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 29 Nov 2018 14:01:59 +0000 (16:01 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 7 Dec 2018 16:38:17 +0000 (16:38 +0000)
gitlab #210

Change-Id: I5518a1c41c87a606ce68b69c9462750a49add088

73 files changed:
bundles/org.simantics.document.linking.ui/.settings/org.eclipse.core.resources.prefs
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/Activator.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/UpdateReferencesAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Constants.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/FixAllReferencesAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/VariableLabelRule.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Document.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/DocumentTitlePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/AlignmentHint.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/And.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Constant.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/DBUtil.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Date.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/EvaluatorRoot.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Lines.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Or.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Path.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/TextSizeHint.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Variable.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLDocument.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLStreamElement.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTable.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTocElement.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLURLItemImpl.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFDocument.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFPage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTable.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTitlePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTocElement.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/CompleteStructureWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWithDependenciesWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentStructureWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/EvaluatorCustomizableContent.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/SCLCustomizableContent.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/SourceLinkUtil.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/EvaluatorConfigurationWidget.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportCustomizationPage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportGeneratePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportWizard.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties [new file with mode: 0644]
i18n.md

index a975f2f9315b38407254899e45c4ba41d27fb404..fbd586c98d41e3d2666c847fdbd760e7a1fadddd 100644 (file)
@@ -1,4 +1,11 @@
 eclipse.preferences.version=1
+encoding//src/org/simantics/document/linking/actions/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/ge/messages.properties=ISO-8859-1
 encoding//src/org/simantics/document/linking/report/ExportToPDF.java=UTF-8
+encoding//src/org/simantics/document/linking/report/messages.properties=ISO-8859-1
 encoding//src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java=UTF-8
 encoding//src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java=UTF-8
+encoding//src/org/simantics/document/linking/report/templates/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/utils/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/views/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/wizard/messages.properties=ISO-8859-1
index 722796a74b60104bc32642347d94102ee1d50700..ef6e06a59d2c50127a193e89a423299554b48f04 100644 (file)
@@ -31,8 +31,8 @@ public class Activator extends AbstractUIPlugin {
        public void start(BundleContext context) throws Exception {
                super.start(context);
                plugin = this;
-               cross = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/cross.png");
-               clock_red = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/clock_red.png");
+               cross = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/cross.png"); //$NON-NLS-1$
+               clock_red = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/clock_red.png"); //$NON-NLS-1$
        }
 
        /*
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java
new file mode 100644 (file)
index 0000000..cab319b
--- /dev/null
@@ -0,0 +1,19 @@
+package org.simantics.document.linking.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.actions.messages"; //$NON-NLS-1$
+       public static String SearchLinksAction_CannotPerformSearch;
+       public static String UpdateReferencesAction_CannotUpdateReferences;
+       public static String UpdateReferencesAction_FixOldReferences;
+       public static String UpdateReferencesAction_FixReferences;
+       public static String UpdateReferencesAction_NothingToFix;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ff7a3e14e014d30b03b38703d79ec4979c3918e0..5fec36f7c1cb45aa789ba5ec26bc583f8c8f8208 100644 (file)
@@ -35,20 +35,19 @@ public class SearchLinksAction implements ActionFactory {
                                                        Layer0 l0 = Layer0.getInstance(graph);
                                                        String s = graph.getPossibleRelatedValue(resource, l0.HasLabel, Bindings.STRING);
                                                        if (s == null)
-                                                               s = graph.getRelatedValue(resource, l0.HasName, Bindings.STRING); 
+                                                               s = graph.getRelatedValue(resource, l0.HasName, Bindings.STRING);
                                                        return s;
                                                }
                                        });
-                                       ISearchService searchService = (ISearchService)PlatformUI.getWorkbench().getService(ISearchService.class);
+                                       ISearchService searchService = (ISearchService) PlatformUI.getWorkbench().getService(ISearchService.class);
                                        SearchQuery query = new SearchQuery(name);
-                                       query.setSearchFlag("Name", "on");
-                                       query.setSearchFlag(DocumentLink.URIs.SearchFunction, "on");
+                                       query.setSearchFlag("Name", "on"); //$NON-NLS-1$ //$NON-NLS-2$
+                                       query.setSearchFlag(DocumentLink.URIs.SearchFunction, "on"); //$NON-NLS-1$
                                        searchService.performQuery(query, ISearchService.ResultBrowser.VIEW, true);
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot perform search",e);
+                                       ExceptionUtils.logAndShowError(Messages.SearchLinksAction_CannotPerformSearch, e);
                                }
-                               
-                               
+
                        }
                };
        }
index a05d11241297456a56eeab4613174ac3eb3aa74e..a3cb78734e704b016edcdd84aab5aaa9808f6081 100644 (file)
@@ -3,7 +3,9 @@ package org.simantics.document.linking.actions;
 import java.util.Collection;
 import java.util.Collections;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
@@ -36,34 +38,36 @@ public class UpdateReferencesAction implements ActionFactory {
                                                @Override
                                                public Collection<Resource> perform(ReadGraph graph)
                                                                throws DatabaseException {
-                                                   return findDocumentReferences(graph, document);
+                                                       return findDocumentReferences(graph, document);
                                                }
                                        });
-                                       
+
                                        if (coll == null)
                                                return;
-                                       
-                                       String dialogTitle = "Fix References";
-                                       String dialogMessage = "Fix " + coll.size() + " old references?";
-                                       String dialogButtonLabels[] = new String[]{"Ok","Cancel"};
+
+                                       String dialogTitle = Messages.UpdateReferencesAction_FixReferences;
+                                       String dialogMessage = NLS.bind(Messages.UpdateReferencesAction_FixOldReferences, coll.size());
+                                       String dialogButtonLabels[] = new String[] { IDialogConstants.OK_LABEL,
+                                                       IDialogConstants.CANCEL_LABEL };
                                        int defaultIndex = 0;
                                        if (coll.size() == 0) {
-                                               dialogMessage = "Nothing to fix.";
-                                               dialogButtonLabels = new String[]{"OK"};
-                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                               dialogMessage = Messages.UpdateReferencesAction_NothingToFix;
+                                               dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
+                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle,
+                                                               null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                                dialog.open();
                                                return;
                                        }
-                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null,
+                                                       dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                        if (dialog.open() != 0)
                                                return;
                                        Simantics.getSession().markUndoPoint();
                                        fixDocumentReferences(coll);
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot update references",e);
+                                       ExceptionUtils.logAndShowError(Messages.UpdateReferencesAction_CannotUpdateReferences, e);
                                }
-                               
-                               
+
                        }
                };
        }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties
new file mode 100644 (file)
index 0000000..cb2bd9e
--- /dev/null
@@ -0,0 +1,5 @@
+SearchLinksAction_CannotPerformSearch=Cannot perform search\r
+UpdateReferencesAction_CannotUpdateReferences=Cannot update references\r
+UpdateReferencesAction_FixOldReferences=Fix {0} old references?\r
+UpdateReferencesAction_FixReferences=Fix References\r
+UpdateReferencesAction_NothingToFix=Nothing to fix.\r
index eb4b02591a62a9c584cac5cbce9f1842b9539dbe..c04a1f417c3bf5a33cf064876a97853b4097ea51 100644 (file)
@@ -30,9 +30,9 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
        
        static {
                columns = new ArrayList<SearchResultColumn>();
-               columns.add(new SearchResultColumn("Name"));
-               columns.add(new SearchResultColumn("Comment"));
-               columns.add(new SearchResultColumn("Part Of"));
+               columns.add(new SearchResultColumn("Name")); //$NON-NLS-1$
+               columns.add(new SearchResultColumn("Comment")); //$NON-NLS-1$
+               columns.add(new SearchResultColumn("Part Of")); //$NON-NLS-1$
        }
        
        @Override
@@ -54,9 +54,9 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
                int type = 0;
                
                public NameComparator(String query) {
-               String parts[] = query.split(" OR ");
+               String parts[] = query.split(" OR "); //$NON-NLS-1$
                for (String s : parts) {
-                       if (s.startsWith("Name:")) {
+                       if (s.startsWith("Name:")) { //$NON-NLS-1$
                                 name = s.substring(5);
                        }
                }
@@ -65,11 +65,11 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
                name = name.trim();
                boolean freeStart = false;
                boolean freeEnd = false;
-               if (name.endsWith("*")) {
+               if (name.endsWith("*")) { //$NON-NLS-1$
                        name = name.substring(0,name.length()-1);
                        freeEnd = true;
                }
-               if (name.startsWith("*")) {
+               if (name.startsWith("*")) { //$NON-NLS-1$
                        name = name.substring(1,name.length());
                        freeStart = true;
                }
@@ -104,7 +104,7 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
         SearchResult result = new SearchResult(columns);
         Set<Resource> processed = new HashSet<Resource>();
 
-       NameComparator c = new NameComparator(query.getQuery("Name"));
+       NameComparator c = new NameComparator(query.getQuery("Name")); //$NON-NLS-1$
         
         for (Resource source : results) {
                  // Prevent index corruption from producing duplicate results.
@@ -134,7 +134,7 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
                String relationName = NameUtils.getSafeLabel(graph, relation);
                if (relationName.length() == 0)
                        relationName = NameUtils.getSafeName(graph, relation);
-               parentName = parentName +"#"+relationName;
+               parentName = parentName +"#"+relationName; //$NON-NLS-1$
             }
             
             DocumentLinkRow rst = new DocumentLinkRow();
@@ -169,17 +169,17 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
        public String getContent(int column) {
                switch (column) {
                case 0:
-                       return "<a class=\"small\" href=\"resource:"+ resource.getResource() +"\"" + (resource.getUri() == null ? "" : " title=\""+resource.getUri()+"\">")+StringUtil.escape(resource.getName())+"</a>";
+                       return "<a class=\"small\" href=\"resource:"+ resource.getResource() +"\"" + (resource.getUri() == null ? "" : " title=\""+resource.getUri()+"\">")+StringUtil.escape(resource.getName())+"</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
                case 1:
                        if (comment != null)
                                return comment;
-                       return "";
+                       return ""; //$NON-NLS-1$
                case 2:
                        if (parent != null)
-                               return "<a class=\"small\" href=\"resource:"+ parent.getResource() +"\"" + (parent.getUri() == null ? "" : " title=\""+parent.getUri()+"\">")+StringUtil.escape(parent.getName())+"</a>";
-                       return "";
+                               return "<a class=\"small\" href=\"resource:"+ parent.getResource() +"\"" + (parent.getUri() == null ? "" : " title=\""+parent.getUri()+"\">")+StringUtil.escape(parent.getName())+"</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+                       return ""; //$NON-NLS-1$
                default:
-                       return "";
+                       return ""; //$NON-NLS-1$
                }
        }
     }
index 84b0ab54888d3f6634b9ff08ad908c0f3bda056b..11d8fe11f25f63274679bd0a0f2126e4a7d5e36a 100644 (file)
@@ -5,23 +5,23 @@ import org.simantics.browsing.ui.Column.Align;
 
 public class Constants {
        
-       public static String NAME = "Name";
-       public static String VALUE = "Value";
-       public static String REFERENCE = "Reference";
-       public static String COMMENT = "Comment";
+       public static String NAME = "Name"; //$NON-NLS-1$
+       public static String VALUE = "Value"; //$NON-NLS-1$
+       public static String REFERENCE = "Reference"; //$NON-NLS-1$
+       public static String COMMENT = "Comment"; //$NON-NLS-1$
        
        public static String[] SOURCE_COLUMN_KEYS = {NAME,VALUE,REFERENCE,COMMENT};
        public static Column[] SOURCE_COLUMNS = new Column[] {
-               new Column(NAME,Align.LEFT,200,"Name",false),
-               new Column(VALUE,Align.LEFT,100,"Value",false),
-               new Column(REFERENCE,Align.LEFT,150,"Reference Document",false),
-               new Column(COMMENT,Align.LEFT,200,"Comment",true)
+               new Column(NAME,Align.LEFT,200,Messages.Constants_Name,false),
+               new Column(VALUE,Align.LEFT,100,Messages.Constants_Value,false),
+               new Column(REFERENCE,Align.LEFT,150,Messages.Constants_ReferenceDocument,false),
+               new Column(COMMENT,Align.LEFT,200,Messages.Constants_Comment,true)
        };
        
        public static String[] SOURCE_OBJECT_COLUMN_KEYS = {NAME,REFERENCE,COMMENT};
        public static Column[] SOURCE_OBJECT_COLUMNS = new Column[] {
-               new Column(NAME,Align.LEFT,200,"Name",false),
-               new Column(REFERENCE,Align.LEFT,150,"Reference Document",false),
-               new Column(COMMENT,Align.LEFT,200,"Comment",true)
+               new Column(NAME,Align.LEFT,200,Messages.Constants_Name,false),
+               new Column(REFERENCE,Align.LEFT,150,Messages.Constants_RefernceDocument,false),
+               new Column(COMMENT,Align.LEFT,200,Messages.Constants_Comment,true)
        };
 }
index 3a19d21294a5e525f463ab7de21e72d8bd8ad1c0..0a075a3e70f1fca8823aa5b42c9e2505c3486d8d 100644 (file)
@@ -5,7 +5,9 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Stack;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
@@ -31,25 +33,29 @@ public class FixAllReferencesAction implements ActionFactory {
                        public void run() {
                                System.out.println(target);
                                try {
-                                       Pair<Collection<Resource>, Collection<Resource>> refs = Simantics.getSession().syncRequest(new FindFixable(target));
-                                       String dialogTitle = "Fix References";
-                                       String dialogMessage = "Fix " + refs.first.size() + " old references and " + refs.second.size() + " removed references?";
-                                       String dialogButtonLabels[] = new String[]{"Ok","Cancel"};
+                                       Pair<Collection<Resource>, Collection<Resource>> refs = Simantics.getSession()
+                                                       .syncRequest(new FindFixable(target));
+                                       String dialogTitle = Messages.FixAllReferencesAction_FixReferences;
+                                       String dialogMessage = NLS.bind(Messages.FixAllReferencesAction_FixOldReferences,
+                                                       new Object[] { refs.first.size(), refs.second.size() });
+                                       String dialogButtonLabels[] = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
                                        int defaultIndex = 0;
                                        if (refs.first.size() == 0 && refs.second.size() == 0) {
-                                               dialogMessage = "Nothing to fix.";
-                                               dialogButtonLabels = new String[]{"OK"};
-                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                               dialogMessage = Messages.FixAllReferencesAction_NothingToFix;
+                                               dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
+                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle,
+                                                               null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                                dialog.open();
                                                return;
                                        }
-                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null,
+                                                       dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                        if (dialog.open() != 0)
                                                return;
                                        Simantics.getSession().markUndoPoint();
                                        Simantics.getSession().syncRequest(new FixAll(refs));
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot fix references", e);
+                                       ExceptionUtils.logAndShowError(Messages.FixAllReferencesAction_CannotFixReferences, e);
                                }
                        }
                };
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java
new file mode 100644 (file)
index 0000000..964411d
--- /dev/null
@@ -0,0 +1,33 @@
+package org.simantics.document.linking.ge;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.ge.messages"; //$NON-NLS-1$
+       public static String Constants_Comment;
+       public static String Constants_Name;
+       public static String Constants_ReferenceDocument;
+       public static String Constants_RefernceDocument;
+       public static String Constants_Value;
+       public static String FixAllReferencesAction_CannotFixReferences;
+       public static String FixAllReferencesAction_FixOldReferences;
+       public static String FixAllReferencesAction_FixReferences;
+       public static String FixAllReferencesAction_NothingToFix;
+       public static String ShowDocumentAction_CannotOpenEditor;
+       public static String ShowDocumentWithAction_CannotOpenEditor;
+       public static String ShowDocumentWithAction_OpenWith;
+       public static String SourceObjectDropAction_CannotCreateDocumentLink;
+       public static String SourceObjectDropAction_DocumentLink;
+       public static String VariableLabelRule_DeletedReference;
+       public static String VariableLabelRule_LabelDefault;
+       public static String VariableLabelRule_NoValue;
+       public static String VariableLabelRule_ReferencesDoesNotExists;
+       public static String VariableLabelRule_ReferencesHasNotBeenSet;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 47d59bc604d3df5871edeac4def7bfe41e0d0746..394a3167ff75165c1d1ce464205bd47a55be0565 100644 (file)
@@ -59,7 +59,7 @@ public class ShowDocumentAction implements ActionFactory{
                                                                try {
                                                                        adapter.openEditor(reference);
                                                                } catch (Exception e) {
-                                                                       ExceptionUtils.logAndShowError("Cannot open editor", e);
+                                                                       ExceptionUtils.logAndShowError(Messages.ShowDocumentAction_CannotOpenEditor, e);
                                                                }
                                                        }
                                                });
index be2d5e33ead0bd51d851f8a938f6f4f063277f9c..631f3127ae863b8b698463fa03e4bb4d18680636 100644 (file)
@@ -69,14 +69,14 @@ public class ShowDocumentWithAction implements ActionFactory{
                                                                        dialog.setContentProvider(new ArrayContentProvider());
                                                                        dialog.setLabelProvider(new EditorAdapterLabelProvider());
                                                                        dialog.setInput(adapters);
-                                                                       dialog.setTitle("Open with");
+                                                                       dialog.setTitle(Messages.ShowDocumentWithAction_OpenWith);
                                                                        if (dialog.open() != ListDialog.OK)
                                                                                return;
                                                                        EditorAdapter adapter = (EditorAdapter)dialog.getResult()[0];
                                                                        
                                                                        adapter.openEditor(reference);
                                                                } catch (Exception e) {
-                                                                       ExceptionUtils.logAndShowError("Cannot open editor", e);
+                                                                       ExceptionUtils.logAndShowError(Messages.ShowDocumentWithAction_CannotOpenEditor, e);
                                                                }
                                                        }
                                                });
index ec2da54a10f97597396a23747aecb1133d801f66..3811c8959a628ea5b55ab0fd23dee163a2a213c0 100644 (file)
@@ -1,6 +1,8 @@
 package org.simantics.document.linking.ge;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
@@ -71,8 +73,8 @@ public class SourceObjectDropAction implements DropActionFactory {
                                                                
                                                                @Override
                                                                public void run() {
-                                                                       String dialogMessage = "Cannot create document link to \"" + label +"\":" + e.getMessage();
-                                                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "Document Link", null, dialogMessage, MessageDialog.INFORMATION, new String[]{"OK"}, 0); 
+                                                                       String dialogMessage = NLS.bind(Messages.SourceObjectDropAction_CannotCreateDocumentLink , new Object[] { label , e.getMessage() }); 
+                                                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.SourceObjectDropAction_DocumentLink, null, dialogMessage, MessageDialog.INFORMATION, new String[]{ IDialogConstants.OK_LABEL }, 0); 
                                                                        dialog.open();
                                                                }
                                                        });
index cf9d88c28cf02f3b179d07eb0e7613f0e7041b84..dc3e360804f79bf3a601560c70c9db1d6a07b680 100644 (file)
@@ -2,6 +2,7 @@ package org.simantics.document.linking.ge;
 
 import java.util.Map;
 
+import org.eclipse.osgi.util.NLS;
 import org.simantics.browsing.ui.model.labels.LabelRule;
 import org.simantics.databoard.Bindings;
 import org.simantics.db.ReadGraph;
@@ -41,22 +42,22 @@ public class VariableLabelRule implements LabelRule {
                 if (graph.isInstanceOf(node, sl.Source)) {
                        Resource reference = SourceLinkUtil.getReferredDocument(graph, node);
                        String comment = graph.getPossibleRelatedValue(node, sl.hasSourceComment);
-                       labels[0] = "";
-                       labels[1] = "";
-                       labels[3] = comment != null ? comment : "";
+                       labels[0] = ""; //$NON-NLS-1$
+                       labels[1] = ""; //$NON-NLS-1$
+                       labels[3] = comment != null ? comment : ""; //$NON-NLS-1$
                        
                        if (reference != null) {
                                if (SourceLinkUtil.isValidReference(graph, reference)) {
                                        labels[2] = NameUtils.getSafeLabel(graph, reference);
                                } else {
-                                       labels[2] = "Deleted reference";
+                                       labels[2] = Messages.VariableLabelRule_DeletedReference;
                                }
                                
                        } else {
                                if (graph.getPossibleRelatedValue(node, sl.hasSourceReferenceURI, Bindings.STRING) != null) {
-                                       labels[2] = "Reference does not exist";
+                                       labels[2] = Messages.VariableLabelRule_ReferencesDoesNotExists;
                                } else {
-                                       labels[2] = "Reference has not been set";
+                                       labels[2] = Messages.VariableLabelRule_ReferencesHasNotBeenSet;
                                }
                        }
                        
@@ -83,32 +84,32 @@ public class VariableLabelRule implements LabelRule {
                                        
                                        
                                } else {
-                                       labels[0] = "";
+                                       labels[0] = ""; //$NON-NLS-1$
                                }
                                
                                if (graph.hasValue(node)) {
                                        Object value = graph.getValue(node);
                                        labels[1] = SourceLinkUtil.getValueString(value);
                                } else if (!graph.isInstanceOf(node, l0.SCLValue)){
-                                       labels[1] = "No Value";
+                                       labels[1] = Messages.VariableLabelRule_NoValue;
                                } else {
-                                       labels[1] = "";
+                                       labels[1] = ""; //$NON-NLS-1$
                                }
                                
                                if (defaultValue) {
-                                       labels[1] +=" (default)";
+                                       NLS.bind(Messages.VariableLabelRule_LabelDefault,labels[1] );
                                }
-                               labels[2] = "";
-                               labels[3] = "";
+                               labels[2] = ""; //$NON-NLS-1$
+                               labels[3] = ""; //$NON-NLS-1$
                                
                 } else {
 
                                labels[0] = NameUtils.getSafeLabel(graph, node);//graph.getRelatedValue(node, l0.HasName);
                                if (labels[0].length() == 0)
                                        labels[0] = NameUtils.getSafeName(graph, node);//graph.getRelatedValue(node, l0.HasName);
-                               labels[1] = "";
-                               labels[2] = "";
-                               labels[3] = "";
+                               labels[1] = ""; //$NON-NLS-1$
+                               labels[2] = ""; //$NON-NLS-1$
+                               labels[3] = ""; //$NON-NLS-1$
                                
                                
                 }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties
new file mode 100644 (file)
index 0000000..e539c4e
--- /dev/null
@@ -0,0 +1,19 @@
+Constants_Comment=Comment\r
+Constants_Name=Name\r
+Constants_ReferenceDocument=Reference Document\r
+Constants_RefernceDocument=Reference Document\r
+Constants_Value=Value\r
+FixAllReferencesAction_CannotFixReferences=Cannot fix references\r
+FixAllReferencesAction_FixOldReferences=Fix {0} old references and \r
+FixAllReferencesAction_FixReferences=Fix References\r
+FixAllReferencesAction_NothingToFix=Nothing to fix.\r
+ShowDocumentAction_CannotOpenEditor=Cannot open editor\r
+ShowDocumentWithAction_CannotOpenEditor=Cannot open editor\r
+ShowDocumentWithAction_OpenWith=Open with\r
+SourceObjectDropAction_CannotCreateDocumentLink=Cannot create document link to "{0}":{1}\r
+SourceObjectDropAction_DocumentLink=Document Link\r
+VariableLabelRule_DeletedReference=Deleted reference\r
+VariableLabelRule_LabelDefault={0} (default)\r
+VariableLabelRule_NoValue=No Value\r
+VariableLabelRule_ReferencesDoesNotExists=Reference does not exist\r
+VariableLabelRule_ReferencesHasNotBeenSet=Reference has not been set\r
index 8e39773cad62f02ed4d86ef3cceb7a5d5ec805b6..553dcecddb6caf92172e6c55975e5dd20205f3e3 100644 (file)
@@ -8,7 +8,7 @@ package org.simantics.document.linking.report;
  */
 public interface Document {
        
-       public static String TOC = "toc";
+       public static String TOC = "toc"; //$NON-NLS-1$
        
        public enum TextSize {TINY,SMALL,MEDIUM,LARGE,HUGE};
 
index d6a3b37b2317255fa210861ef8c20027e25e08e4..af2517718ceae72bac1ea8c5ec2e6ca9a1425888 100644 (file)
@@ -23,13 +23,13 @@ public abstract class DocumentTitlePage implements DocumentElement{
                ReportWriter<?> reportWriter = (ReportWriter<?>)context.get(ReportWriter.class);
                CustomizableContent content = null;
                if (reportWriter instanceof CustomizableContentProvider) {
-                       content = ((CustomizableContentProvider)reportWriter).getContent("Title");
+                       content = ((CustomizableContentProvider)reportWriter).getContent("Title"); //$NON-NLS-1$
                }
                if (content == null)
-                       writeTitle(getDefaultLines(graph, (Resource)context.get("model"), (String)context.get("DocumentName")));
+                       writeTitle(getDefaultLines(graph, (Resource)context.get("model"), (String)context.get("DocumentName"))); //$NON-NLS-1$ //$NON-NLS-2$
                else {
                        
-                       List<DocumentLine> lines = content.getLines(graph, (Resource)context.get("model"), context);
+                       List<DocumentLine> lines = content.getLines(graph, (Resource)context.get("model"), context); //$NON-NLS-1$
                        writeTitle(lines);
                }
        }
index 2bfdf79c0a0f850308fd03423eb24a62fee830cf..f9645042bbc2b8b5fc97f85b4f041d2286f8cd2c 100644 (file)
@@ -84,18 +84,18 @@ public class ExportToPDF {
                
                Document lineWriter = null;
                try {
-                       if (filename.toLowerCase().endsWith(".pdf"))
-                               lineWriter = new PDFDocument(filename, new Font("Arial", Font.PLAIN, 10),new Font("Arial", Font.BOLD, 10));
-                       else if (filename.toLowerCase().endsWith(".html") ||
-                                       filename.toLowerCase().endsWith(".htm"))
+                       if (filename.toLowerCase().endsWith(".pdf")) //$NON-NLS-1$
+                               lineWriter = new PDFDocument(filename, new Font("Arial", Font.PLAIN, 10),new Font("Arial", Font.BOLD, 10)); //$NON-NLS-1$ //$NON-NLS-2$
+                       else if (filename.toLowerCase().endsWith(".html") || //$NON-NLS-1$
+                                       filename.toLowerCase().endsWith(".htm")) //$NON-NLS-1$
                                lineWriter = new HTMLDocument(new File(filename));
                        else {
-                               throw new Exception("File has unknow extension " + filename);
+                               throw new Exception("File has unknow extension " + filename); //$NON-NLS-1$
                        }
                        export(lineWriter, reportWriter, monitor);
                        
                } catch (Exception e) {
-                       return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not generate report", e);
+                       return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportToPDF_ActivatorCouldNotGenerateReport, e);
                } finally {
                        if (lineWriter != null) {
                                try {
@@ -106,7 +106,7 @@ public class ExportToPDF {
                        }
                        
                }
-               String status  = "Report generated.";
+               String status  = Messages.ExportToPDF_ReportGenerated;
 //             if (lineWriter instanceof PDFTableWriter) {
 //                     status += " Report size " + ((PDFTableWriter)lineWriter).getCurrentPageIndex() + " pages.";
 //             }
@@ -124,16 +124,16 @@ public class ExportToPDF {
                                
                                try {
                                        Map<Object, Object> context = new HashMap<Object, Object>();
-                                       context.put("model", model);
+                                       context.put("model", model); //$NON-NLS-1$
                                        context.put(Document.class, document);
                                        context.put(ReportWriter.class, reportWriter);
-                                       context.put("DocumentName", reportWriter.getName());
+                                       context.put("DocumentName", reportWriter.getName()); //$NON-NLS-1$
                                        
                                        reportWriter.start(graph, model, document, context);
                                        
                                        List<T> list = reportWriter.getReportItems(graph);
                                        
-                               monitor.beginTask("Write Report", list.size());
+                               monitor.beginTask(Messages.ExportToPDF_MonitorWriteReport, list.size());
        
                                T previous = null;
                                T current = null;
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java
new file mode 100644 (file)
index 0000000..1665104
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.document.linking.report;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.report.messages"; //$NON-NLS-1$
+       public static String ExportToPDF_ActivatorCouldNotGenerateReport;
+       public static String ExportToPDF_MonitorWriteReport;
+       public static String ExportToPDF_ReportGenerated;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 8876960a22b704714529817fd4dde42fb595855d..a56900d486e3381ccb7aaad47212b43c6104ae00 100644 (file)
@@ -72,11 +72,11 @@ public class AlignmentHint extends HintNode implements EnumEditableNode{
        @Override
        public ImageDescriptor getImage() {
                if (alignment == Alignment.LEFT) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_left.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_left.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (alignment == Alignment.CENTER) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_center.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_center.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_right.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_right.png"); //$NON-NLS-1$ //$NON-NLS-2$
                }
        }
        
index e2a264069d296560a5d188847443bea224e0472e..17aeb3cae159e4bbc1757a6d22125ba959675a9d 100644 (file)
@@ -31,7 +31,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
        
        
        public And() {
-               separator = " ";
+               separator = " "; //$NON-NLS-1$
        }
        
        public And(String separator) {
@@ -49,7 +49,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
-               String s = "";
+               String s = ""; //$NON-NLS-1$
                for (int i = 0 ; i < children.size(); i++) {
                        String s2 = children.get(i).getValue(graph, variable, context);
                        if (s2 != null) {
@@ -89,7 +89,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
 
        @Override
        public String toString() {
-               return "and " + "(" + separator +")" ;
+               return "and " + "(" + separator +")" ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        
        @RelatedGetValue(DocumentLink.URIs.EvaluatorTree_HasValue)
@@ -118,7 +118,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_columns.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_columns.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index e33fa92fb62d8d145f454e8b25f11631a4ca0258..31cbe49b9f7d68f48304a243a85621b5dc2026c8 100644 (file)
@@ -20,12 +20,12 @@ public class Constant extends EvaluatorLeaf implements StringEditableNode{
        
        
        public Constant() {
-               string = "text";
+               string = "text"; //$NON-NLS-1$
        }
        
        public Constant(String text) {
                if (text == null)
-                       throw new NullPointerException("Text is null");
+                       throw new NullPointerException("Text is null"); //$NON-NLS-1$
                string = text;
        }
        
@@ -36,7 +36,7 @@ public class Constant extends EvaluatorLeaf implements StringEditableNode{
        
        @Override
        public String toString() {
-               return "\"" + string + "\"";
+               return "\"" + string + "\""; //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        @RelatedGetValue(DocumentLink.URIs.EvaluatorTree_HasValue)
@@ -64,7 +64,7 @@ public class Constant extends EvaluatorLeaf implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/textfield.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/textfield.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index d41a0616601392bfa676c313b25eaad1d9d71cb9..93efeffd9db75e12e13e7cb232b1efc7cc84a0d7 100644 (file)
@@ -161,7 +161,7 @@ public class DBUtil {
        
        public static List<NamedResource> getTemplates(final Resource library) throws DatabaseException{
                if (library == null)
-                       throw new IllegalArgumentException("Library cannot be null");
+                       throw new IllegalArgumentException("Library cannot be null"); //$NON-NLS-1$
                List<NamedResource> templates = Simantics.getSession().syncRequest(new Read<List<NamedResource>>() {
                @Override
                public List<NamedResource> perform(ReadGraph graph) throws DatabaseException{
index d1fa4486747011948c27f4058bef47c17eba05b4..8b9ed2b985ec4c27fde4525367549b23fbe2ce7d 100644 (file)
@@ -40,7 +40,7 @@ public class Date extends EvaluatorLeaf {
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/date.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/date.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index 2c0f0e766a74f40190217ddab4aba227f80e0a88..ab7eb1cb8a80ae65588dac0c90a9dd5d94d0b777 100644 (file)
@@ -63,7 +63,7 @@ public class EvaluatorRoot extends EvaluatorNode{
        
        @Override
        public String toString() {
-               return "root";
+               return "root"; //$NON-NLS-1$
        }
        
        @Override
index e0e7839391ca9fefc508d8dc32bf818db8a3c8af..4dc9219807cf17aa8c56be868aef56eac8b56845 100644 (file)
@@ -26,7 +26,7 @@ public class If extends EvaluatorNode{
        @Override
        public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
                if (children.size() > 3)
-                       throw new DatabaseException("If node has more than 3 children.");
+                       throw new DatabaseException("If node has more than 3 children."); //$NON-NLS-1$
                
                String ifVal = children.get(0).getValue(graph, variable, context);
                if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {
@@ -40,7 +40,7 @@ public class If extends EvaluatorNode{
        @Override
        public List<DocumentLine> getLines(ReadGraph graph,     Variable variable, Map<Object, Object> context) throws DatabaseException {
                if (children.size() > 3)
-                       throw new DatabaseException("If node has more than 3 children.");
+                       throw new DatabaseException("If node has more than 3 children."); //$NON-NLS-1$
                String ifVal = children.get(0).getValue(graph, variable, context);
                if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {
                        return children.get(1).getLines(graph, variable, context);
@@ -53,7 +53,7 @@ public class If extends EvaluatorNode{
 
        @Override
        public String toString() {
-               return "if";
+               return "if"; //$NON-NLS-1$
        }
        
        @Override
@@ -73,7 +73,7 @@ public class If extends EvaluatorNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/help.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/help.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        @Override
index 7d7abde42beeac330150348491c3336e4a1d7519..9b9c05182245c1937ae9daa1f14603fc8e126803 100644 (file)
@@ -27,13 +27,13 @@ public class Lines extends EvaluatorNode {
        
        @Override
        public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
-               String s = "";
+               String s = ""; //$NON-NLS-1$
                for (int i = 0 ; i < children.size(); i++) {
                        String s2 = children.get(i).getValue(graph, variable, context);
                        if (s2 != null) {
                                s+= s2;
                                if (i < children.size()-1)
-                                       s+=System.getProperty("line.separator");
+                                       s+=System.getProperty("line.separator"); //$NON-NLS-1$
                        }
                }
                if (s.length() == 0)
@@ -44,7 +44,7 @@ public class Lines extends EvaluatorNode {
 
        @Override
        public String toString() {
-               return "Lines" ;
+               return "Lines" ; //$NON-NLS-1$
        }
        
        
@@ -67,7 +67,7 @@ public class Lines extends EvaluatorNode {
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_linespacing.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_linespacing.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index c18a1b6e41c96cdcb5a82e77abaa6339fe86aa00..73bece892c0d8e5a9db91ba639fa920cedfd0121 100644 (file)
@@ -50,7 +50,7 @@ public class Or extends EvaluatorNode{
        
        @Override
        public String toString() {
-               return "or";
+               return "or"; //$NON-NLS-1$
        }
        
        @Override
@@ -62,7 +62,7 @@ public class Or extends EvaluatorNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_list_numbers.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_list_numbers.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        
index f3d67e69f03b887f0f60fdb48760cdd95063abc9..0860b8f686863bfc811ffb0af3035d32dc5e03c2 100644 (file)
@@ -24,7 +24,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        String separator;
        
        public Path() {
-               separator = "/";
+               separator = "/"; //$NON-NLS-1$
        }
        
        public Path(String separator) {
@@ -33,7 +33,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public String toString() {
-               return "path " + "(" + separator +")" ;
+               return "path " + "(" + separator +")" ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        
        @Override
@@ -56,8 +56,8 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        @Override
        public String getValue(ReadGraph graph, Variable variable,
                        Map<Object, Object> context) throws DatabaseException {
-               Resource model = (Resource)context.get("model");
-               String text = "";
+               Resource model = (Resource)context.get("model"); //$NON-NLS-1$
+               String text = ""; //$NON-NLS-1$
                Variable parent = variable.getParent(graph);
                while (parent != null) {
                        text = children.get(0).getValue(graph, parent, context) + separator + text;
@@ -74,7 +74,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        public List<DocumentLine> getLines(ReadGraph graph, Variable variable,
                        Map<Object, Object> context) throws DatabaseException {
                List<DocumentLine> result = new ArrayList<DocumentLine>();
-               Resource model = (Resource)context.get("model");
+               Resource model = (Resource)context.get("model"); //$NON-NLS-1$
                for (int i = 0 ; i < children.size(); i++) {
                        Variable parent = variable.getParent(graph);
                        while (parent != null) {
@@ -103,7 +103,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/folder.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        @Override
index 86afc31b8c30990d1c3d8294e82b698b4f19e62a..c901784012796c805f247dee5c7710df75469dcc 100644 (file)
@@ -19,11 +19,11 @@ import org.simantics.layer0.Layer0;
  *
  */
 public class PredefinedVariables {
-       public static final String root = "root";
-       public static final String project = "project";
-       public static final String model = "model";
-       public static final String template = "template";
-       public static final String current = ".";
+       public static final String root = "root"; //$NON-NLS-1$
+       public static final String project = "project"; //$NON-NLS-1$
+       public static final String model = "model"; //$NON-NLS-1$
+       public static final String template = "template"; //$NON-NLS-1$
+       public static final String current = "."; //$NON-NLS-1$
 
 
        private static PredefinedVariables factory = new PredefinedVariables();
@@ -119,7 +119,7 @@ public class PredefinedVariables {
         if (colonInx != -1 && firstFlashInx != -1 && colonInx+1 == firstFlashInx && path.length() > firstFlashInx+1){
             String scheme = path.substring(0, colonInx);
             String absPath = path.substring(firstFlashInx+1);
-            if (scheme.equals("pre")){
+            if (scheme.equals("pre")){ //$NON-NLS-1$
                 int endOfPredefined1 = absPath.indexOf('/');
                 int endOfPredefined2 = absPath.indexOf('#');
                 if (endOfPredefined1 == -1 && endOfPredefined2 == -1)
@@ -150,7 +150,7 @@ public class PredefinedVariables {
 
         Variable property = null;
         if (relativePath != null){
-               if (relativePath.startsWith("/."))
+               if (relativePath.startsWith("/.")) //$NON-NLS-1$
                        relativePath = relativePath.substring(1);
             property = v.browsePossible(graph, relativePath);
         }
index df2ae2d8e2c4989142bdf43f49b96fb6029e70da..739c6e430d1d77c56a013ad4e96a440854131513 100644 (file)
@@ -74,15 +74,15 @@ public class TextSizeHint extends HintNode implements EnumEditableNode{
        @Override
        public ImageDescriptor getImage() {
                if (textSize == TextSize.TINY) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_5.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_5.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.SMALL) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_4.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_4.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.MEDIUM) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_3.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_3.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.LARGE) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_2.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_2.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.HUGE) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_1.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_1.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else {
                        return null;
                }
index a55d73865e6b508f747ee8900a254ce34037c8f9..fdf92297e40532478aa717e28425e94b7a7bc445 100644 (file)
@@ -16,7 +16,7 @@ import org.simantics.objmap.graph.annotations.RelatedSetValue;
 @GraphType(DocumentLink.URIs.EvaluatorTree_Variable)
 public class Variable extends EvaluatorLeaf implements StringEditableNode{
        
-       String variableRef = "#HasName";
+       String variableRef = "#HasName"; //$NON-NLS-1$
        
        public Variable() {
                
@@ -66,7 +66,7 @@ public class Variable extends EvaluatorLeaf implements StringEditableNode{
        @Override
        public String setValue(String value) {
                if (value.length() == 0)
-                       return "Variable reference cannot be empty";
+                       return "Variable reference cannot be empty"; //$NON-NLS-1$
                variableRef = value;
                return null;
        }
@@ -84,7 +84,7 @@ public class Variable extends EvaluatorLeaf implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/database_go.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
 
index 79fb2653f4b4622f2446cae6e3d1e29200b3a61e..cd62f25ad0820410a474ff438da9426cddffa27d 100644 (file)
@@ -62,7 +62,7 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
                        index = index + 1;
                uniqueIndex.put(cls,index);
                
-               return cls.getSimpleName() +"_"+index;
+               return cls.getSimpleName() +"_"+index; //$NON-NLS-1$
        }
        String getUniqueId(HTMLElement element) {
                Class<? extends HTMLElement> cls = element.getClass();
@@ -71,35 +71,35 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
        
        private static String getDataUrl() throws IOException {
                 Bundle b = Platform.getBundle(Activator.PLUGIN_ID);
-                URL dataUrl = FileLocator.find(b, new Path("report"), null);
+                URL dataUrl = FileLocator.find(b, new Path("report"), null); //$NON-NLS-1$
                 URL fileUrl = FileLocator.toFileURL(dataUrl);
-                return URLDecoder.decode(fileUrl.getPath(), "UTF-8"); 
+                return URLDecoder.decode(fileUrl.getPath(), "UTF-8");  //$NON-NLS-1$
        }
        
        private void copyBaseCSS(String cssUrl) throws Exception {
-               File f = new File(URLDecoder.decode(cssUrl, "UTF-8")).getAbsoluteFile();
+               File f = new File(URLDecoder.decode(cssUrl, "UTF-8")).getAbsoluteFile(); //$NON-NLS-1$
                copyData(f, os);
        }
 
        
        private void header() throws Exception {
                PrintStream resultOs = os;
-               String cssUrl = getDataUrl() +"/report.css";
-               resultOs.println("<!DOCTYPE html>");
-               resultOs.println("<html lang=\"en\">");
-               resultOs.println("<head>");
-               resultOs.println("  <meta charset=\"utf-8\">");
-               resultOs.println("  <title>Report</title>");
+               String cssUrl = getDataUrl() +"/report.css"; //$NON-NLS-1$
+               resultOs.println("<!DOCTYPE html>"); //$NON-NLS-1$
+               resultOs.println("<html lang=\"en\">"); //$NON-NLS-1$
+               resultOs.println("<head>"); //$NON-NLS-1$
+               resultOs.println("  <meta charset=\"utf-8\">"); //$NON-NLS-1$
+               resultOs.println("  <title>Report</title>"); //$NON-NLS-1$
                if (referCSS)
-                       resultOs.println("  <link rel=\"stylesheet\" href=\"" + cssUrl + "\" type=\"text/css\">");
-               resultOs.println("  <style>");
+                       resultOs.println("  <link rel=\"stylesheet\" href=\"" + cssUrl + "\" type=\"text/css\">"); //$NON-NLS-1$ //$NON-NLS-2$
+               resultOs.println("  <style>"); //$NON-NLS-1$
                if (!referCSS) {
                        copyBaseCSS(cssUrl);
                }
                
-               resultOs.println("  </style>");
-               resultOs.println("</head>");
-               resultOs.println("<body>");
+               resultOs.println("  </style>"); //$NON-NLS-1$
+               resultOs.println("</head>"); //$NON-NLS-1$
+               resultOs.println("<body>"); //$NON-NLS-1$
        }
 
        private void footer() throws Exception{
@@ -109,8 +109,8 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
                        toc.close();
                content.close();
                PrintStream resultOs = os;
-               resultOs.println("</body>");
-               resultOs.println("</html>");
+               resultOs.println("</body>"); //$NON-NLS-1$
+               resultOs.println("</html>"); //$NON-NLS-1$
        }
        
        @Override
@@ -147,7 +147,7 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
                        return (T)getOrCreateToc();
                } else if (cls == DocumentTitlePage.class) {
                        if (titlePage != null)
-                               throw new Exception("Document many have only one title page");
+                               throw new Exception("Document many have only one title page"); //$NON-NLS-1$
                        titlePage = new HTMLTitlePage(this);
                        return (T)titlePage;
                }
index 20f3dcd124a17c22d0eff6292c93a38e6dc14c48..34d435ac706774d8bf1462a393476d142d40f6b6 100644 (file)
@@ -22,7 +22,7 @@ public class HTMLStreamElement implements HTMLElement{
        public HTMLStreamElement(File file) throws Exception{
                parent = null;
                this.file = file;
-               os = new PrintStream(file,"UTF-8");
+               os = new PrintStream(file,"UTF-8"); //$NON-NLS-1$
        }
        
        public HTMLStreamElement(HTMLStreamElement parent) throws Exception{
@@ -31,8 +31,8 @@ public class HTMLStreamElement implements HTMLElement{
        }
        
        private void openStream() throws IOException {
-               file = File.createTempFile("report_content", ".html");
-               os = new PrintStream(file,"UTF-8");
+               file = File.createTempFile("report_content", ".html"); //$NON-NLS-1$ //$NON-NLS-2$
+               os = new PrintStream(file,"UTF-8"); //$NON-NLS-1$
        }
        
 
index 2137dbb54a1f622e907a7961e603409dcc5bf198..86afa3e3dcda0511140fb0ca37d85639cc355a75 100644 (file)
@@ -115,35 +115,35 @@ public class HTMLTable extends HTMLTextElement implements Table {
        public TableRow writeRowRaw(List<String> line) throws Exception {
                if (currentLine == 0)
                        startTable();
-               String clz = "\"";
-               clz += currentLine % 2 == 0 ? "even" : "odd";
-               clz += " "+currentTextSize;
-               clz += "\"";
-               os.println("    <tr class=" + clz+ ">");
+               String clz = "\""; //$NON-NLS-1$
+               clz += currentLine % 2 == 0 ? "even" : "odd"; //$NON-NLS-1$ //$NON-NLS-2$
+               clz += " "+currentTextSize; //$NON-NLS-1$
+               clz += "\""; //$NON-NLS-1$
+               os.println("    <tr class=" + clz+ ">"); //$NON-NLS-1$ //$NON-NLS-2$
                if (line.size() > 1) {
                        for (int i = 0; i < line.size(); i++) {
                                String s = line.get(i);
                                Alignment a = columns.get(i).getAlignment();
-                               String tdClass = "class=\"" +a.toString()+"\"";
+                               String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                                
                                if (s != null)
-                                       os.println("      <td "+tdClass+">" + s + "</td>");
+                                       os.println("      <td "+tdClass+">" + s + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                else
-                                       os.println("      <td> </td>");
+                                       os.println("      <td> </td>"); //$NON-NLS-1$
                        }
                } else if (line.size() == 1){
                        String s = line.get(0);
                        Alignment a = columns.get(0).getAlignment();
-                       String tdClass = "class=\"" +a.toString()+"\"";
+                       String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                        if (s != null)
-                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>");
+                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                        else
-                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                        
                } else {
-                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                }
-               os.println("    </tr>");
+               os.println("    </tr>"); //$NON-NLS-1$
                currentLine++;
                writer.currentLine++;
                return new HTMLTableRow(null);
@@ -152,35 +152,35 @@ public class HTMLTable extends HTMLTextElement implements Table {
        public TableRow writeRowRaw2(List<TextItem> line) throws Exception {
                if (currentLine == 0)
                        startTable();
-               String clz = "\"";
-               clz += currentLine % 2 == 0 ? "even" : "odd";
-               clz += " "+currentTextSize;
-               clz += "\"";
-               os.println("    <tr class=" + clz+ ">");
+               String clz = "\""; //$NON-NLS-1$
+               clz += currentLine % 2 == 0 ? "even" : "odd"; //$NON-NLS-1$ //$NON-NLS-2$
+               clz += " "+currentTextSize; //$NON-NLS-1$
+               clz += "\""; //$NON-NLS-1$
+               os.println("    <tr class=" + clz+ ">"); //$NON-NLS-1$ //$NON-NLS-2$
                if (line.size() > 1) {
                        for (int i = 0; i < line.size(); i++) {
                                TextItem item = line.get(i);
                                Alignment a = columns.get(i).getAlignment();
-                               String tdClass = "class=\"" +a.toString()+"\"";
+                               String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                                
                                if (item != null && item.getText() != null)
-                                       os.println("      <td "+tdClass+">" + item.toString() + "</td>");
+                                       os.println("      <td "+tdClass+">" + item.toString() + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                else
-                                       os.println("      <td> </td>");
+                                       os.println("      <td> </td>"); //$NON-NLS-1$
                        }
                } else if (line.size() == 1){
                        String s = line.get(0).toString();
                        Alignment a = columns.get(0).getAlignment();
-                       String tdClass = "class=\"" +a.toString()+"\"";
+                       String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                        if (s != null)
-                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>");
+                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                        else
-                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                        
                } else {
-                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                }
-               os.println("    </tr>");
+               os.println("    </tr>"); //$NON-NLS-1$
                currentLine++;
                writer.currentLine++;
                return new HTMLTableRow(null);
@@ -208,45 +208,45 @@ public class HTMLTable extends HTMLTextElement implements Table {
        
        void style() {
                for (int i = 0; i < columns.size(); i++) {
-                       os.println("table."+classID+" th.column"+i+" {");
-                       os.println("  width: " + ((int)(columns.get(i).getWidth()*100.0)) + "%;");
-                       os.println("}");
+                       os.println("table."+classID+" th.column"+i+" {"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                       os.println("  width: " + ((int)(columns.get(i).getWidth()*100.0)) + "%;"); //$NON-NLS-1$ //$NON-NLS-2$
+                       os.println("}"); //$NON-NLS-1$
                }
        }
        
        void startTable() {
                
                if (id != null) {
-                       os.println("<a id=\"" + id + "\"></a>");
+                       os.println("<a id=\"" + id + "\"></a>"); //$NON-NLS-1$ //$NON-NLS-2$
                }       
-               String clz = classID + " " + (linesVisible ? "lines" : "nolines");
-               os.println("<table class=\"" + clz +"\" >");
+               String clz = classID + " " + (linesVisible ? "lines" : "nolines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+               os.println("<table class=\"" + clz +"\" >"); //$NON-NLS-1$ //$NON-NLS-2$
                
                if (headerVisible) {
                        if (title != null)
-                               os.println("  <caption>"+title+"</caption>");
-                       os.println("  <thead>");
-                       os.println("    <tr class=MEDIUM>");
+                               os.println("  <caption>"+title+"</caption>"); //$NON-NLS-1$ //$NON-NLS-2$
+                       os.println("  <thead>"); //$NON-NLS-1$
+                       os.println("    <tr class=MEDIUM>"); //$NON-NLS-1$
                        int ci = 0;
                        for (TableColumn c : columns) {
-                          os.println("      <th class=\"column" + ci +"\">" + escape(c.getName()) + "</th>");
+                          os.println("      <th class=\"column" + ci +"\">" + escape(c.getName()) + "</th>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                           ci++;
                        }
-                       os.println("    </tr>");
-                       os.println("  </thead>");
+                       os.println("    </tr>"); //$NON-NLS-1$
+                       os.println("  </thead>"); //$NON-NLS-1$
                }
-               os.println("  <tbody>");
+               os.println("  <tbody>"); //$NON-NLS-1$
        }
        
        void endTable() throws Exception{
                if (currentLine > 0) {
-                       os.println("  </tbody>");
-                       os.println("</table>");
-                       os.println("<br>");
+                       os.println("  </tbody>"); //$NON-NLS-1$
+                       os.println("</table>"); //$NON-NLS-1$
+                       os.println("<br>"); //$NON-NLS-1$
                        if (!copyStyle) {
-                               os.println("<style>");
+                               os.println("<style>"); //$NON-NLS-1$
                                style();
-                               os.println("</style>");
+                               os.println("</style>"); //$NON-NLS-1$
                        }
                }
        }
index 08e4232ce7adc815fd4806b14500421680ecd683..747b5a4a4f89deba49ce8f1289b69f799ea6faeb 100644 (file)
@@ -18,30 +18,30 @@ public class HTMLTitlePage extends DocumentTitlePage implements HTMLElement{
        public void writeTitle(List<DocumentLine> lines) throws Exception {
                writer.nextPage();
                for (DocumentLine line : lines) {
-                       String hTag = "h4";
+                       String hTag = "h4"; //$NON-NLS-1$
                        if (line.getHints().containsKey(TextSize.class)) {
                                TextSize size = (TextSize)line.getHints().get(TextSize.class);
                                switch (size) {
                                case HUGE:
-                                       hTag = "h1";
+                                       hTag = "h1"; //$NON-NLS-1$
                                        break;
                                case LARGE:
-                                       hTag = "h2";
+                                       hTag = "h2"; //$NON-NLS-1$
                                        break;
                                case MEDIUM:
-                                       hTag = "h3";
+                                       hTag = "h3"; //$NON-NLS-1$
                                        break;
                                case SMALL:
-                                       hTag = "h4";
+                                       hTag = "h4"; //$NON-NLS-1$
                                        break;
                                case TINY:
-                                       hTag = "h5";
+                                       hTag = "h5"; //$NON-NLS-1$
                                        break;
                                default:
                                        break;
                                }
                        }
-                       writer.os.println("<"+hTag +">" + line.getLine() + "</"+hTag+">");
+                       writer.os.println("<"+hTag +">" + line.getLine() + "</"+hTag+">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                }
                writer.nextPage();
                
index a2613c061908e7c06c530088cb0b6b8601cdc802..eada4913b015ebec16eeaa278e58b71ccc61e0e2 100644 (file)
@@ -12,31 +12,31 @@ public class HTMLTocElement extends HTMLStreamElement implements TableOfContents
        
        public HTMLTocElement(HTMLDocument writer) throws Exception{
                super(writer);
-               this.os.println("<h2>Table of Contents</h2>");
+               this.os.println(Messages.HTMLTocElement_TocHeading);
                tocTable = new HTMLTable(writer, os, false);
                tocTable.setHeaderVisible(false);
                tocTable.setLinesVisible(false);
-               tocTable.addColumn("Name", 1.0);
+               tocTable.addColumn("Name", 1.0); //$NON-NLS-1$
        }
        
        @Override
        public void addTocElement(String label, DocumentElement element) throws Exception{
                HTMLElement e = (HTMLElement)element;
                if (e.getId() == null)
-                       throw new IllegalArgumentException("Element has no id " + element);
+                       throw new IllegalArgumentException("Element has no id " + element); //$NON-NLS-1$
                //os.println("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
-               tocTable.writeRow("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
+               tocTable.writeRow("<a href=\"#" + e.getId() + "\">" + label + "</a><br>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        
        public void close() throws Exception{
                tocTable.endTable();
-               os.print("<br>");
+               os.print("<br>"); //$NON-NLS-1$
                super.close();
        }
        
        @Override
        public String getId() {
-               return "toc";
+               return "toc"; //$NON-NLS-1$
        }
 
 }
index d1314350b4abbec5c8fabe94678db068a40e6ced..071043e72fd0d18bb6545589c1932fb2402373b6 100644 (file)
@@ -8,7 +8,7 @@ public class HTMLURLItemImpl extends URLItemImpl{
        @Override
        public String toString() {
                if (getURL() != null)
-                       return "<a href=\"" + getURL().toString() + "\">" + getText() + "</a>";
+                       return "<a href=\"" + getURL().toString() + "\">" + getText() + "</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                return super.toString();
        }
 
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java
new file mode 100644 (file)
index 0000000..42c59e6
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.document.linking.report.html;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.simantics.document.linking.report.html.messages"; //$NON-NLS-1$
+    public static String        HTMLTocElement_TocHeading;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties
new file mode 100644 (file)
index 0000000..ab00f27
--- /dev/null
@@ -0,0 +1 @@
+HTMLTocElement_TocHeading=<h2>Table of Contents</h2>
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties
new file mode 100644 (file)
index 0000000..f7cc917
--- /dev/null
@@ -0,0 +1,3 @@
+ExportToPDF_ActivatorCouldNotGenerateReport=Could not generate report\r
+ExportToPDF_MonitorWriteReport=Write Report\r
+ExportToPDF_ReportGenerated=Report generated.\r
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java
new file mode 100644 (file)
index 0000000..3560e83
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.document.linking.report.pdf;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.simantics.document.linking.report.pdf.messages"; //$NON-NLS-1$
+    public static String        PDFTocElement_TocHeading;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
index ce0c423e26ede5f1dfaeb7f9d3bdc18a1f768a7f..dd1315bf5daba20255991a32d0d8d91680e4bf0a 100644 (file)
@@ -56,11 +56,11 @@ public class PDFDocument implements Document {
        }
        
        private void defaultFonts() {
-               fonts.put(TextSize.TINY, new Font("Arial", Font.PLAIN, 6));
-               fonts.put(TextSize.SMALL, new Font("Arial", Font.PLAIN, 8));
-               fonts.put(TextSize.MEDIUM, new Font("Arial", Font.PLAIN, 10));
-               fonts.put(TextSize.LARGE, new Font("Arial", Font.PLAIN, 16));
-               fonts.put(TextSize.HUGE, new Font("Arial", Font.BOLD, 24));
+               fonts.put(TextSize.TINY, new Font("Arial", Font.PLAIN, 6)); //$NON-NLS-1$
+               fonts.put(TextSize.SMALL, new Font("Arial", Font.PLAIN, 8)); //$NON-NLS-1$
+               fonts.put(TextSize.MEDIUM, new Font("Arial", Font.PLAIN, 10)); //$NON-NLS-1$
+               fonts.put(TextSize.LARGE, new Font("Arial", Font.PLAIN, 16)); //$NON-NLS-1$
+               fonts.put(TextSize.HUGE, new Font("Arial", Font.BOLD, 24)); //$NON-NLS-1$
                contentStream.setDefaultFont(fonts.get(TextSize.SMALL));
        }
        
@@ -103,7 +103,7 @@ public class PDFDocument implements Document {
                        return (T)getOrCreateToc();
                } else if (cls == DocumentTitlePage.class) {
                        if (titlePage != null)
-                               throw new Exception("Report may contain only one title page");
+                               throw new Exception("Report may contain only one title page"); //$NON-NLS-1$
                        titlePage =  new PDFTitlePage(this);
                        return (T)titlePage;
                }
@@ -160,7 +160,7 @@ public class PDFDocument implements Document {
                if (currentTable != null && currentTable.currentLine > 0) {
                        currentTable.setLinesVisible(false);
                        currentTable.setHeaderVisible(false);
-                       currentTable.writeLine("");
+                       currentTable.writeLine(""); //$NON-NLS-1$
                }
        }
        
index f4f376a415da820abe9121256d7713b2e83f0216..fc0d4a0d18be7875d247311f8c9fa65cd0053523 100644 (file)
@@ -35,7 +35,7 @@ public class PDFPage {
                this.stream = stream;
                Rectangle pageSize = stream.getPageSize();
                document = new Document(pageSize);
-               tempFile = File.createTempFile("ReportGenerator", ".pdf");
+               tempFile = File.createTempFile("ReportGenerator", ".pdf"); //$NON-NLS-1$ //$NON-NLS-2$
                writer = PdfWriter.getInstance(document, new FileOutputStream(tempFile));
                document.open();
                this.cb = writer.getDirectContent();
index 902d27159d219ac79c098cbe868b9605d4821b8a..69f782f145815b3d764dafeb6ddcca5fd0c2e8a0 100644 (file)
@@ -595,7 +595,7 @@ public class PDFTable implements Table, PDFElement {
             // Find possible line break and set it as a limit to the next layout
             next = lineMeasurer.nextOffset(cellWidth);
             limit = next;
-            charat = text.indexOf(System.getProperty("line.separator"),position+1);
+            charat = text.indexOf(System.getProperty("line.separator"),position+1); //$NON-NLS-1$
             if(charat < next && charat != -1){
                limit = charat;
             }
index d724b088543dffc41a11d6892a452f30ab33d061..7b49ca990bb2e204b030bfc49f0682e11d1f6bfb 100644 (file)
@@ -34,13 +34,13 @@ public class PDFTitlePage extends DocumentTitlePage implements PDFElement {
                document.nextPage();
                this.page = document.contentStream.getCurrentPage();
                Table table = document.newElement(Table.class);
-               table.addColumn("Names", 1.0).setAlignment(alignment);
+               table.addColumn("Names", 1.0).setAlignment(alignment); //$NON-NLS-1$
                table.setLinesVisible(false);
                table.setHeaderVisible(false);
                table.setTextSize(textSize);
                int lines = (document.contentStream.getAvailableLines()-3)/2;
                for (int i = 0; i < lines; i++)
-                       table.writeRow("");
+                       table.writeRow(""); //$NON-NLS-1$
                for (DocumentLine line : titleLines) {
                        TextSize s = (TextSize)line.getHints().get(TextSize.class);
                        if (s != null)
index c6fc5330eecddcd0612a924d468d5c90d1aab9da..03c77cdcc74f956446f237b51cbf03a18b508e9c 100644 (file)
@@ -37,9 +37,9 @@ public class PDFTocElement implements TableOfContents {
                //linesPerPage = stream.getAvailableLines();
                PDFPage page = stream.getCurrentPage();
                page.setFont(titleFont);
-               page.writeLine("Table of Contents");
+               page.writeLine(Messages.PDFTocElement_TocHeading);
                page.setFont(itemFont);
-               page.writeLine("");
+               page.writeLine(""); //$NON-NLS-1$
                linesOnFirstPage = tocTable.getAvailableLines();
                //linesOnFirstPage = page.availableLines;
        }
@@ -55,8 +55,8 @@ public class PDFTocElement implements TableOfContents {
                List<PDFPage> pages = destStream.getPages();
                int tocIndex = pages.indexOf(after)+1;
                
-               tocTable.addColumn("Document", 0.9);
-               tocTable.addColumn("Page", 0.1).setAlignment(Alignment.RIGHT);
+               tocTable.addColumn("Document", 0.9); //$NON-NLS-1$
+               tocTable.addColumn("Page", 0.1).setAlignment(Alignment.RIGHT); //$NON-NLS-1$
                tocTable.setHeaderVisible(false);
                tocTable.setLinesVisible(false);
                for (Pair<String, PDFElement> item : toc) {
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties
new file mode 100644 (file)
index 0000000..3c8f29c
--- /dev/null
@@ -0,0 +1 @@
+PDFTocElement_TocHeading=Table of Contents
index dd4de82204f125e6cd02b36e2bf7407cffe2f663..ccfc9ea4414739c07011399773696efaa6055899 100644 (file)
@@ -50,7 +50,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                
                @Override
                public String getName() {
-                       return "Complete Structure";
+                       return "Complete Structure"; //$NON-NLS-1$
                }
                
                @Override
@@ -67,11 +67,11 @@ public class CompleteStructureWriter extends IndexQueryReport {
                        writer.newElement(TableOfContents.class);
                        Table table = writer.newElement(Table.class,Document.TOC);
                        
-                       table.addColumn("Name", 0.2);
-                       table.addColumn("Attribute", 0.2);
-                       table.addColumn("Value", 0.15);
-                       table.addColumn("Document", 0.2);
-                       table.addColumn("Comment", 0.25);
+                       table.addColumn("Name", 0.2); //$NON-NLS-1$
+                       table.addColumn("Attribute", 0.2); //$NON-NLS-1$
+                       table.addColumn("Value", 0.15); //$NON-NLS-1$
+                       table.addColumn("Document", 0.2); //$NON-NLS-1$
+                       table.addColumn("Comment", 0.25); //$NON-NLS-1$
                        
                        //lineWriter.nextPage();
                        
@@ -112,7 +112,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                        }
                                        
                                        if (obj != null) {
-                                               String text = "";
+                                               String text = ""; //$NON-NLS-1$
                                                List<Resource> path = SourceLinkUtil.getDiagramPath(graph, model, obj);
                                                
                                                if (path == null) {
@@ -121,14 +121,14 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                                                Resource r = path.get(i);
                                                                text += parentComparator.getText(r);
                                                                if (i < path.size()-2)
-                                                                       text += "/";
+                                                                       text += "/"; //$NON-NLS-1$
                                                        }
                                                } else {
                                                        for (int i = 0 ; i < path.size(); i++) {
                                                                Resource r = path.get(i);
                                                                text += parentComparator.getText(r);
                                                                if (i < path.size()-1)
-                                                                       text += "/";
+                                                                       text += "/"; //$NON-NLS-1$
                                                        }
                                                }
                                                //row[0] = text;
@@ -138,7 +138,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                                toc.addTocElement(text, table);
                                        } else {
                                                //row[0] =  "Hierarchy missing";
-                                               table.setTitle("Hierarchy missing");
+                                               table.setTitle("Hierarchy missing"); //$NON-NLS-1$
                                        }
                                }
                        }
@@ -170,7 +170,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                                        text[2].setText(SourceLinkUtil.getValueString(value));
                                                }
                                        } else {
-                                               text[1].setText("Error in property reference");
+                                               text[1].setText(Messages.CompleteStructureWriter_ErrorInPropertyRefrence);
                                        }
                                }
                                Resource document = SourceLinkUtil.getReferredDocument(graph, source);
index 806cc47fb336d952faa7bbb14dc3f46658d14860..854863e27f91b70a35048db9fce910947ce11ef6 100644 (file)
@@ -16,7 +16,7 @@ public class DiagramStructureWithDependenciesWriter extends DiagramStructureWrit
        
        @Override
        public String getName() {
-               return "Diagram structure with dependencies";
+               return "Diagram structure with dependencies"; //$NON-NLS-1$
        }
        
        @Override
index c7fa811e43fc27a89e97f312daec0317b5aab526..79714ac6337f491ba8d1dd0c815e4f4cadc03494 100644 (file)
@@ -31,7 +31,7 @@ public class DiagramStructureWriter extends DocumentWriter<Resource>{
        
        @Override
        public String getName() {
-               return "Diagram structure";
+               return "Diagram structure"; //$NON-NLS-1$
        }
        
        @Override
@@ -43,8 +43,8 @@ public class DiagramStructureWriter extends DocumentWriter<Resource>{
                titlePage.writeTitle(graph, context);
                
                Table table = lineWriter.newElement(Table.class);
-               table.addColumn("Name", 0.4);
-               table.addColumn("Document", 0.6);
+               table.addColumn("Name", 0.4); //$NON-NLS-1$
+               table.addColumn("Document", 0.6); //$NON-NLS-1$
                
                //lineWriter.nextPage();
                
@@ -100,16 +100,16 @@ public class DiagramStructureWriter extends DocumentWriter<Resource>{
                                        List<Resource> path = SourceLinkUtil.getDiagramPath(graph, model, obj);
                                        if (writer.getAvailableLines() < 2)
                                                writer.nextPage();
-                                       String text = "";
+                                       String text = ""; //$NON-NLS-1$
                                        for (int i = 0 ; i < path.size(); i++) {
                                                Resource r = path.get(i);
                                                text += diagramComparator.getText(r);
                                                if (i < path.size()-1)
-                                                       text += "/";
+                                                       text += "/"; //$NON-NLS-1$
                                        }
                                        row[0].setText(text);
                                } else {
-                                       row[0].setText("Hierarchy missing");
+                                       row[0].setText(Messages.DiagramStructureWriter_Hierarchymissing);
                                }
                        }
                        
index 6b8ae70a221ff387ad8591423ceaf757932731d5..fffc16b23ebefe49ba2cbac2ed8d51eea0d6a157 100644 (file)
@@ -52,7 +52,7 @@ public class DocumentStructureWriter extends IndexQueryReport {
        
        @Override
        public String getName() {
-               return "Document Structure";
+               return "Document Structure"; //$NON-NLS-1$
        }
        
        @Override
@@ -63,10 +63,10 @@ public class DocumentStructureWriter extends IndexQueryReport {
                titlePage.writeTitle(graph, context);
                writer.newElement(TableOfContents.class);
                Table table = writer.newElement(Table.class,Document.TOC);
-               table.addColumn("Name", 0.2);
-               table.addColumn("Attribute", 0.35);
-               table.addColumn("Value", 0.15);
-               table.addColumn("Comment", 0.3);
+               table.addColumn("Name", 0.2); //$NON-NLS-1$
+               table.addColumn("Attribute", 0.35); //$NON-NLS-1$
+               table.addColumn("Value", 0.15); //$NON-NLS-1$
+               table.addColumn("Comment", 0.3); //$NON-NLS-1$
                
                //lineWriter.nextPage();
                this.graph = graph;
@@ -159,7 +159,7 @@ public class DocumentStructureWriter extends IndexQueryReport {
                                if (path != null) {
                                        TextSize size = table.getTextSize();
                                        table.setTextSize(TextSize.MEDIUM);
-                                       table.writeRow("  " + diagramComparator.getText(path.get(path.size()-1)));
+                                       table.writeRow("  " + diagramComparator.getText(path.get(path.size()-1))); //$NON-NLS-1$
                                        table.setTextSize(size);
                                }
                        }
@@ -198,7 +198,7 @@ public class DocumentStructureWriter extends IndexQueryReport {
                                                text[2].setText(SourceLinkUtil.getValueString(value));
                                        }
                                } else {
-                                       text[1].setText("Error in property reference ");
+                                       text[1].setText(Messages.DocumentStructureWriter_ErrorInPropertyReference);
                                }
                        }
                        
index 1f47964376f6540f380fbd4f29c77eb6a85be1ed..485e18efc4d29c02e0269cc527fb3709c996ec5d 100644 (file)
@@ -58,29 +58,29 @@ public abstract  class DocumentWriter<T> extends TableReportWriter<T> implements
        
        @Override
        public void setDefaultContent(String id) {
-               if ("Document".equals(id) || id == null) {
-                       EvaluatorCustomizableContent c = new EvaluatorCustomizableContent("Document format");
+               if ("Document".equals(id) || id == null) { //$NON-NLS-1$
+                       EvaluatorCustomizableContent c = new EvaluatorCustomizableContent("Document format"); //$NON-NLS-1$
                        Or item = new Or();
-                       item.addChild(new Variable("#HasLabel"));
-                       item.addChild(new Variable("#HasName"));
+                       item.addChild(new Variable("#HasLabel")); //$NON-NLS-1$
+                       item.addChild(new Variable("#HasName")); //$NON-NLS-1$
                        c.setItem(item);
                        c.setSupportStyles(false);
                        c.setSupportMultiline(true);
-                       content.put("Document", c);
+                       content.put("Document", c); //$NON-NLS-1$
                } 
-               if ("Title".equals(id) || id == null) {
-                       EvaluatorCustomizableContent e = new EvaluatorCustomizableContent("Document Title");
+               if ("Title".equals(id) || id == null) { //$NON-NLS-1$
+                       EvaluatorCustomizableContent e = new EvaluatorCustomizableContent("Document Title"); //$NON-NLS-1$
                        EvaluatorNode lines = new Lines();
                        Or nameOr = new Or();
-                       nameOr.createChild(Variable.class).setVariableRef("#HasLabel");
-                       nameOr.createChild(Variable.class).setVariableRef("#HasName");
+                       nameOr.createChild(Variable.class).setVariableRef("#HasLabel"); //$NON-NLS-1$
+                       nameOr.createChild(Variable.class).setVariableRef("#HasName"); //$NON-NLS-1$
                        lines.createChild(TextSizeHint.class).setTextSize(TextSize.HUGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).addChild(nameOr.copy());
-                       lines.createChild(TextSizeHint.class).setTextSize(TextSize.HUGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).createChild(Variable.class).setVariableRef("DocumentName");
+                       lines.createChild(TextSizeHint.class).setTextSize(TextSize.HUGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).createChild(Variable.class).setVariableRef("DocumentName"); //$NON-NLS-1$
                        lines.createChild(TextSizeHint.class).setTextSize(TextSize.LARGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).createChild(Date.class);
                        e.setItem(lines);
                        e.setSupportStyles(true);
                        e.setSupportMultiline(true);
-                       content.put("Title", e);
+                       content.put("Title", e); //$NON-NLS-1$
                }
        }
        
@@ -97,13 +97,13 @@ public abstract  class DocumentWriter<T> extends TableReportWriter<T> implements
                } else {
                        item = this.document.newItem(TextItem.class);
                }
-               item.setText(getContent("Document").getContent(graph, document,context));
+               item.setText(getContent("Document").getContent(graph, document,context)); //$NON-NLS-1$
                return item;
        }
        
        protected TextItem getNonExistingDocumentItem() throws Exception{
                TextItem item = this.document.newItem(TextItem.class);
-               item.setText("[DOCUMENT DOES NOT EXIST]");
+               item.setText(Messages.DocumentWriter_DocumentDoesNotExist);
                return item;
        }
 
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java
new file mode 100644 (file)
index 0000000..b01b531
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.document.linking.report.templates;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.report.templates.messages"; //$NON-NLS-1$
+       public static String CompleteStructureWriter_ErrorInPropertyRefrence;
+       public static String DiagramStructureWriter_Hierarchymissing;
+       public static String DocumentStructureWriter_ErrorInPropertyReference;
+       public static String DocumentWriter_DocumentDoesNotExist;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index b0f94261a9e283b0a38b05243b56119b87fa24c5..0ac9417a7d93385311bc86c1951a13e5f8d78d76 100644 (file)
@@ -53,7 +53,7 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
        
        @Override
        public String getName() {
-               return "Model Internal Documents";
+               return "Model Internal Documents"; //$NON-NLS-1$
        }
        
        @Override
@@ -64,8 +64,8 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
                DocumentTitlePage titlePage = lineWriter.newElement(DocumentTitlePage.class);
                titlePage.writeTitle(graph, context);
                Table table = lineWriter.newElement(Table.class);
-               table.addColumn("Folder", 0.4);
-               table.addColumn("Document", 0.6);
+               table.addColumn("Folder", 0.4); //$NON-NLS-1$
+               table.addColumn("Document", 0.6); //$NON-NLS-1$
                
                //lineWriter.nextPage();
                this.graph = graph;
@@ -119,10 +119,10 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
        
        
        private String getText(List<Resource> current, boolean indent) throws DatabaseException {
-               String text = "";
+               String text = ""; //$NON-NLS-1$
                if (indent)
                        for (int i = 0; i < current.size()-1; i++) {
-                               text += "  ";
+                               text += "  "; //$NON-NLS-1$
                        }
                
                text += NameUtils.getSafeLabel(graph, current.get(current.size()-1));
@@ -195,12 +195,12 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
        
        private class DocumentContentProvider implements RowContentProvider<List<Resource>> {
                public void setText(Document writer, java.util.List<Resource> previous, java.util.List<Resource> current, java.util.List<Resource> next, TextItem[] row) throws Exception {
-                       String s = "";
+                       String s = ""; //$NON-NLS-1$
                        
                        Resource document = current.get(current.size()-1);
                        int rev = revisionIndex(document);
                        for (int i = 0; i < rev; i++)
-                               s += "  ";
+                               s += "  "; //$NON-NLS-1$
                        row[1] = getDocumentItem(document);
                        row[1].setText(s + row[1].getText());
                };
index 5891ccb268e1d69ef4c3e1eaed6cfccdafed62cc..a3da49b10332fcb4af92062b08a962134b83609f 100644 (file)
@@ -40,7 +40,7 @@ public class ReferredDocumentWriter extends ModelDocumentWriter{
 
        @Override
        public String getName() {
-               return "Referred Documents";
+               return "Referred Documents"; //$NON-NLS-1$
        }
        
 
index 7394154662ae18e7a0538b6acef0d39564e4d999..dbc02e72ce9cc9e82de9da85934fc8fa7673b4a1 100644 (file)
@@ -34,7 +34,7 @@ public class EvaluatorCustomizableContent implements CustomizableContent{
        public String getContent(ReadGraph graph, Resource resource, Map<Object, Object> context)
                        throws DatabaseException {
                if (!SourceLinkUtil.isValidReference(graph, resource))
-                       return "Deleted reference";
+                       return "Deleted reference"; //$NON-NLS-1$
                Variable variable = graph.adapt(resource, Variable.class);
                return item.getValue(graph, variable,context);
        }
@@ -43,7 +43,7 @@ public class EvaluatorCustomizableContent implements CustomizableContent{
        public List<DocumentLine> getLines(ReadGraph graph, Resource resource, Map<Object, Object> context)
                        throws DatabaseException {
                if (!SourceLinkUtil.isValidReference(graph, resource))
-                       return Collections.singletonList(new DocumentLine("Deleted reference"));
+                       return Collections.singletonList(new DocumentLine("Deleted reference")); //$NON-NLS-1$
                Variable variable = graph.adapt(resource, Variable.class);
                return item.getLines(graph, variable,context);
        }
index 09fb371948deb5e592b2b1dc5ed5a47f4c08a3fc..126591a5344140b0509f24678f61e3d9af31ab21 100644 (file)
@@ -32,11 +32,11 @@ public class SCLCustomizableContent implements CustomizableContent {
        public SCLCustomizableContent(String label) {
                session = new CommandSession(SCLOsgi.MODULE_REPOSITORY, null);
                
-               sclCode = new String[]{"import \"Simantics/Ontologies\"",
-                                      "nameOfResource r = match possibleRelatedValue r L0.HasName with\n"+
-                               "    Just name -> name\n"+
-                               "    Nothing -> \"no name\"",
-                               "nameOfResource res"};                          
+               sclCode = new String[]{"import \"Simantics/Ontologies\"", //$NON-NLS-1$
+                                      "nameOfResource r = match possibleRelatedValue r L0.HasName with\n"+ //$NON-NLS-1$
+                               "    Just name -> name\n"+ //$NON-NLS-1$
+                               "    Nothing -> \"no name\"", //$NON-NLS-1$
+                               "nameOfResource res"};                           //$NON-NLS-1$
        }
        
        @Override
@@ -48,7 +48,7 @@ public class SCLCustomizableContent implements CustomizableContent {
        public String getContent(ReadGraph graph, Resource resource, Map<Object, Object> context)
                        throws DatabaseException {
                
-               session.setVariable("res", Types.con("Simantics/DB", "Resource"), resource);
+               session.setVariable("res", Types.con("Simantics/DB", "Resource"), resource); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                final StringBuilder responseBuilder = new StringBuilder();
                final StringBuilder errorBuilder = new StringBuilder();
                for (String code : sclCode) {
@@ -69,7 +69,7 @@ public class SCLCustomizableContent implements CustomizableContent {
                 }
             });
                        if(errorBuilder.length() > 0)
-                           throw new DatabaseException("Error executing SCL \"" + code + "\" " + errorBuilder.toString().trim());
+                           throw new DatabaseException("Error executing SCL \"" + code + "\" " + errorBuilder.toString().trim()); //$NON-NLS-1$ //$NON-NLS-2$
                }
                return responseBuilder.toString().trim();
        }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties
new file mode 100644 (file)
index 0000000..aadad1c
--- /dev/null
@@ -0,0 +1,4 @@
+CompleteStructureWriter_ErrorInPropertyRefrence=Error in property reference\r
+DiagramStructureWriter_Hierarchymissing=Hierarchy missing\r
+DocumentStructureWriter_ErrorInPropertyReference=Error in property reference \r
+DocumentWriter_DocumentDoesNotExist=[DOCUMENT DOES NOT EXIST]\r
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java
new file mode 100644 (file)
index 0000000..5fdf7ce
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.document.linking.utils;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.utils.messages"; //$NON-NLS-1$
+       public static String SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel;
+       public static String SourceLinkUtil_DatabaseExceptionLocNotModelPart;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 12c2b5b998aa0fb105f0ce3d879612634dffc9dc..c652f69fa678b834b9809989a3741347d7c27bda 100644 (file)
@@ -45,9 +45,9 @@ public class SourceLinkUtil {
                Resource link = null;
                DependencyCheckResult result = checkDependecies(graph, document, instance);
                if (result == DependencyCheckResult.NoLocationModel)
-                       throw new DatabaseException("Location of document link is not part of a model.");
+                       throw new DatabaseException(Messages.SourceLinkUtil_DatabaseExceptionLocNotModelPart);
                if (result == DependencyCheckResult.DifferentModel) {
-                       throw new DatabaseException("Location of document link and document are in different models, document link cannot be created.");
+                       throw new DatabaseException(Messages.SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel);
                }
                if (result == DependencyCheckResult.NoReferenceModel) {
                        //referred document and location are not in the same model, create an URI reference.
@@ -76,7 +76,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createInstanceSource(WriteGraph graph, Resource reference, Resource location) throws DatabaseException {
-               return createInstanceSource(graph, reference, location, "");
+               return createInstanceSource(graph, reference, location, ""); //$NON-NLS-1$
        }
 
        public static Resource createInstanceSource(WriteGraph graph, Resource reference, Resource location, String comment) throws DatabaseException {
@@ -107,7 +107,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createInstanceSource(WriteGraph graph, String reference, Resource location) throws DatabaseException {
-               return createInstanceSource(graph, reference, location, "");
+               return createInstanceSource(graph, reference, location, ""); //$NON-NLS-1$
        }
 
        public static Resource createInstanceSource(WriteGraph graph, String reference, Resource location, String comment) throws DatabaseException {
@@ -138,7 +138,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createFunctionalSource(WriteGraph graph, Resource reference, Resource location, Resource relation) throws DatabaseException {
-               return createFunctionalSource(graph, reference, location, relation, "");
+               return createFunctionalSource(graph, reference, location, relation, ""); //$NON-NLS-1$
        }
 
        
@@ -173,7 +173,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createFunctionalSource(WriteGraph graph, String reference, Resource location, Resource relation) throws DatabaseException {
-               return createFunctionalSource(graph, reference, location, relation, "");
+               return createFunctionalSource(graph, reference, location, relation, ""); //$NON-NLS-1$
        }
 
        
@@ -407,7 +407,7 @@ public class SourceLinkUtil {
                        } else if (value instanceof Object[]) {
                                return Arrays.toString((Object[])value);
                        } else {
-                               return "TODO: Array " + value.getClass().getSimpleName();
+                               return "TODO: Array " + value.getClass().getSimpleName(); //$NON-NLS-1$
                        }
                } else {
                        return value.toString();
@@ -436,15 +436,15 @@ public class SourceLinkUtil {
        }
        
        public static String getCustomizedString(ReadGraph graph, Resource document, List<String> annotationContent) throws DatabaseException{
-               String label = "";
+               String label = ""; //$NON-NLS-1$
                Variable doc = graph.adapt(document, Variable.class);
                for (String path : annotationContent) {
-                       if (path.startsWith("\"") && path.endsWith("\"")) {
-                               label += path.substring(1,path.length()-1)+ " ";
+                       if (path.startsWith("\"") && path.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
+                               label += path.substring(1,path.length()-1)+ " "; //$NON-NLS-1$
                        } else {
                                Variable v = PredefinedVariables.getInstance().getVariable(graph, path, null, doc);
                                if (v != null) {
-                                       label += v.getValue(graph) + " ";
+                                       label += v.getValue(graph) + " "; //$NON-NLS-1$
                                }
                        }
                }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties
new file mode 100644 (file)
index 0000000..b801eb4
--- /dev/null
@@ -0,0 +1,2 @@
+SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel=Location of document link and document are in different models, document link cannot be created.\r
+SourceLinkUtil_DatabaseExceptionLocNotModelPart=Location of document link is not part of a model.\r
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java
new file mode 100644 (file)
index 0000000..d9745ed
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.document.linking.views;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.views.messages"; //$NON-NLS-1$
+       public static String SourceView_All;
+       public static String SourceView_Browsing;
+       public static String SourceView_LinkAll;
+       public static String SourceView_LinkDocuments;
+       public static String SourceView_Linking;
+       public static String SourceView_OldRemoved;
+       public static String SourceView_PinSelection;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index e3b1c55d3ab4f0961f02383ad6a018b2a2bde025..86dfe67edc3bdb90783ff258200a7b5a9e007ac9 100644 (file)
@@ -65,7 +65,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        /**
         * The ID of the view as specified by the extension.
         */
-       public static final String ID = "org.simantics.document.linking.views.SourceView";
+       public static final String ID = "org.simantics.document.linking.views.SourceView"; //$NON-NLS-1$
 
        private Composite composite;
 
@@ -110,10 +110,10 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                composite.setLayout(new FillLayout());
                tabFolder = new TabFolder(composite, SWT.NONE);
                TabItem link = new TabItem(tabFolder, SWT.NONE);
-               link.setText("Linking");
+               link.setText(Messages.SourceView_Linking);
                
                TabItem browse = new TabItem(tabFolder, SWT.NONE);
-               browse.setText("Browsing");
+               browse.setText(Messages.SourceView_Browsing);
                
                linkComposite = new Composite(tabFolder, SWT.NONE);
                link.setControl(linkComposite);
@@ -163,7 +163,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                        }
                });
                Button checkingButton = new Button(browseComposite, SWT.TOGGLE);
-               checkingButton.setText("All");
+               checkingButton.setText(Messages.SourceView_All);
                checkingButton.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
@@ -171,7 +171,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                                boolean checked = button.getSelection();
                                browseExplorer.dispose();
                                createModelExplorer(checked,support,browseComposite);
-                               button.setText(checked ? "Old/Removed" : "All");
+                               button.setText(checked ? Messages.SourceView_OldRemoved : Messages.SourceView_All);
                                if (currentModel != null)
                                        setModel(currentModel, true);
                                browseComposite.getParent().layout(true, true);
@@ -198,7 +198,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        }
        
        private void createModelExplorer(boolean onlyCheckable,WidgetSupport support,Composite browseComposite) {
-               browseExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false, true), selectionProvider,getSite(), browseComposite, support,false, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+               browseExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false, true), selectionProvider,getSite(), browseComposite, support,false, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                if(!onlyCheckable)
                        browseExplorer.setBrowseContexts(DocumentLink.URIs.ModelViewpointBrowseContext, DocumentLink.URIs.ModelViewpointActionContext);
                else
@@ -207,7 +207,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                browseExplorer.setInputSource(new SingleSelectionInputSource(Resource.class));
                browseExplorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning
                browseExplorer.setColumnsVisible(true);
-               browseExplorer.setContextMenuId("#SourceModelViewPopup");
+               browseExplorer.setContextMenuId("#SourceModelViewPopup"); //$NON-NLS-1$
                browseExplorer.finish();
         ((Tree)browseExplorer.getExplorer().getControl()).setLinesVisible(true);
         
@@ -215,25 +215,25 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        }
        
        private void createLinkTab(final Composite linkComposite) {
-               objectExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+               objectExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                objectExplorer.setBrowseContexts(DocumentLink.URIs.SourceObjectViewpointBrowseContext, DocumentLink.URIs.SourceObjectViewpointActionContext);
                objectExplorer.setColumns(Constants.SOURCE_OBJECT_COLUMNS);
                objectExplorer.setInputSource(new SingleSelectionInputSource(Resource.class));
                objectExplorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning
                objectExplorer.setColumnsVisible(true);
-               objectExplorer.setContextMenuId("#SourceObjectViewPopup");
+               objectExplorer.setContextMenuId("#SourceObjectViewPopup"); //$NON-NLS-1$
                objectExplorer.finish();
         ((Tree)objectExplorer.getExplorer().getControl()).setLinesVisible(true);
         
         final Sash sash = new Sash (linkComposite, SWT.HORIZONTAL);
         
-               propertyExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+               propertyExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                propertyExplorer.setBrowseContexts(DocumentLink.URIs.SourcePropertyViewpointBrowseContext, DocumentLink.URIs.SourcePropertyViewpointActionContext);
                propertyExplorer.setColumns(Constants.SOURCE_COLUMNS);
                propertyExplorer.setInputSource(new SingleSelectionInputSource(Resource.class));
                propertyExplorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning
                propertyExplorer.setColumnsVisible(true);
-               propertyExplorer.setContextMenuId("#SourcePropertyViewPopup");
+               propertyExplorer.setContextMenuId("#SourcePropertyViewPopup"); //$NON-NLS-1$
         propertyExplorer.finish();
         ((Tree)propertyExplorer.getExplorer().getControl()).setLinesVisible(true);
         
@@ -390,16 +390,16 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        }
 
        private void makeActions() {
-               pinSelectionAction = new Action("Pin selection", Action.AS_CHECK_BOX) {
+               pinSelectionAction = new Action(Messages.SourceView_PinSelection, Action.AS_CHECK_BOX) {
                        public void run() {
                                pinSelection = isChecked();
                        }
                };
 //             action1.setToolTipText("Action 1 tooltip");
-               pinSelectionAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/lock.png"));
+               pinSelectionAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/lock.png")); //$NON-NLS-1$ //$NON-NLS-2$
                
                
-               linkAllAction = new Action("Link All", Action.AS_RADIO_BUTTON) {
+               linkAllAction = new Action(Messages.SourceView_LinkAll, Action.AS_RADIO_BUTTON) {
                        @Override
                        public void run() {
                                setAcceptedObject(AcceptedObject.ALL);
@@ -407,7 +407,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                        }
                };
                
-               linkDocumentsAction = new Action("Link Documents", Action.AS_RADIO_BUTTON) {
+               linkDocumentsAction = new Action(Messages.SourceView_LinkDocuments, Action.AS_RADIO_BUTTON) {
                        @Override
                        public void run() {
                                setAcceptedObject(AcceptedObject.DOCUMENT);
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties
new file mode 100644 (file)
index 0000000..84c9964
--- /dev/null
@@ -0,0 +1,7 @@
+SourceView_All=All\r
+SourceView_Browsing=Browsing\r
+SourceView_LinkAll=Link All\r
+SourceView_LinkDocuments=Link Documents\r
+SourceView_Linking=Linking\r
+SourceView_OldRemoved=Old/Removed\r
+SourceView_PinSelection=Pin selection\r
index 0996e6ef8be7364dcbfc51f144a5ff0ccbfeda78..6f53d1f3580992ae787f127111e4473aac82b0c2 100644 (file)
@@ -83,7 +83,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                viewer.setLabelProvider(new EvaluatorLabelProvider());
                viewer.setCellEditors(new CellEditor[]{new EvaluatorNodeCellEditor(viewer.getTree())});
                viewer.setCellModifier(new EvaluatorNodeCellModifier());
-               viewer.setColumnProperties(new String[]{"value"});
+               viewer.setColumnProperties(new String[]{"value"}); //$NON-NLS-1$
                viewer.setInput(root);
                viewer.getTree().addMenuDetectListener(new MenuDetectListener() {
                        
@@ -267,16 +267,16 @@ public class EvaluatorConfigurationWidget extends Composite {
                final EvaluatorItem item = i;
                Menu menu = new Menu(viewer.getControl());
                MenuItem add = new MenuItem(menu, SWT.CASCADE);
-               add.setText("Add");
+               add.setText(Messages.EvaluatorConfigurationWidget_Add);
                Menu addMenu = new Menu(menu);
                add.setMenu(addMenu);
-               add.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_right.png")));
+               add.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_right.png"))); //$NON-NLS-1$ //$NON-NLS-2$
                
                MenuItem insert = new MenuItem(menu, SWT.CASCADE);
-               insert.setText("Insert");
+               insert.setText("Insert"); //$NON-NLS-1$
                Menu insertMenu = new Menu(menu);
                insert.setMenu(insertMenu);
-               insert.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_left.png")));
+               insert.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_left.png"))); //$NON-NLS-1$ //$NON-NLS-2$
                
                // add menu
                if (item instanceof EvaluatorNode) {
@@ -321,7 +321,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                        insert.setEnabled(false);
                
                MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
-               menuItem.setText("Remove");
+               menuItem.setText(Messages.EvaluatorConfigurationWidget_Remove);
                menuItem.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                EvaluatorNode parent = item.getParent();
@@ -332,7 +332,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                        };
                });
                menuItem.setEnabled(item != root);
-               menuItem.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/delete.png")));
+               menuItem.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/delete.png"))); //$NON-NLS-1$ //$NON-NLS-2$
                menu.setLocation(event.x,event.y);
                menu.setVisible(true);
                
@@ -506,7 +506,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                                }
                                return 0;
                        }
-                       return "";
+                       return ""; //$NON-NLS-1$
                }
                @Override
                public void modify(Object element, String property, Object value) {
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java
new file mode 100644 (file)
index 0000000..cc9d1e1
--- /dev/null
@@ -0,0 +1,44 @@
+package org.simantics.document.linking.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.wizard.messages"; //$NON-NLS-1$
+       public static String EvaluatorConfigurationWidget_Add;
+       public static String EvaluatorConfigurationWidget_Remove;
+       public static String ReportCustomizationPage_Defaults;
+       public static String ReportCustomizationPage_GiveTemplateName;
+       public static String ReportCustomizationPage_Library;
+       public static String ReportCustomizationPage_Load;
+       public static String ReportCustomizationPage_Name;
+       public static String ReportCustomizationPage_NameCannotBeEmpty;
+       public static String ReportCustomizationPage_Save;
+       public static String ReportCustomizationPage_SaveReportCustomizations;
+       public static String ReportGeneratePage_File;
+       public static String ReportGeneratePage_FileNotSelected;
+       public static String ReportGeneratePage_GenerateReport;
+       public static String ReportGeneratePage_GeneratingReport;
+       public static String ReportGeneratePage_Report;
+       public static String ReportGeneratePage_ReportFail;
+       public static String ReportGeneratePage_ReportFailed;
+       public static String ReportGeneratePage_ReportNotGenerated;
+       public static String ReportGeneratePage_ReportWriterNotSelected;
+       public static String ReportGeneratePage_ShowReport;
+       public static String ReportGeneratePage_Status;
+       public static String ReportSelectionPage_Browse;
+       public static String ReportSelectionPage_File;
+       public static String ReportSelectionPage_FilterHTMLDocument;
+       public static String ReportSelectionPage_FilterPDFDocument;
+       public static String ReportSelectionPage_Model;
+       public static String ReportSelectionPage_ReportTemplates;
+       public static String ReportWizard_CustomizeReport;
+       public static String ReportWizard_RunReport;
+       public static String ReportWizard_SelectReportParameters;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 37f76332f6ad3e7de787f5263b390fee327e2d3e..8be04962633a3347deec1f70267233f27cb3f1da 100644 (file)
@@ -80,9 +80,9 @@ public class ReportCustomizationPage extends WizardPage{
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(loadButton);
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(saveButton);
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(resetButton);
-               loadButton.setText("Load");
-               saveButton.setText("Save");
-               resetButton.setText("Defaults");
+               loadButton.setText(Messages.ReportCustomizationPage_Load);
+               saveButton.setText(Messages.ReportCustomizationPage_Save);
+               resetButton.setText(Messages.ReportCustomizationPage_Defaults);
                
                loadButton.addSelectionListener(new SelectionAdapter() {
                        @Override
@@ -122,7 +122,7 @@ public class ReportCustomizationPage extends WizardPage{
                                @Override
                                public Resource perform(ReadGraph graph) throws DatabaseException {
                                        Layer0 l0 = Layer0.getInstance(graph);
-                                       Resource lib =  graph.syncRequest(new PossibleObjectWithName(model, l0.ConsistsOf,"Library"));
+                                       Resource lib =  graph.syncRequest(new PossibleObjectWithName(model, l0.ConsistsOf,Messages.ReportCustomizationPage_Library));
                                        if (lib != null)
                                                return lib;
                                        
@@ -239,7 +239,7 @@ public class ReportCustomizationPage extends WizardPage{
        private void save() {
                try {
                        
-                       InputDialog dialog = new InputDialog(getShell(), "Save report customization", "Give template name", "Name", new NotNullValidator("Name cannot be empty"));
+                       InputDialog dialog = new InputDialog(getShell(), Messages.ReportCustomizationPage_SaveReportCustomizations, Messages.ReportCustomizationPage_GiveTemplateName, Messages.ReportCustomizationPage_Name, new NotNullValidator(Messages.ReportCustomizationPage_NameCannotBeEmpty));
                        if (dialog.open() != InputDialog.OK)
                                return;
                        final String name = dialog.getValue();
index 4db863f2af714f72c31f5c6ab96d960509208348..39fb639836c9b2a994a4b90705e794a862431804 100644 (file)
@@ -7,6 +7,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -70,17 +71,17 @@ public class ReportGeneratePage extends WizardPage {
                Composite composite = new Composite(parent, SWT.NONE);
                composite.setLayout(new GridLayout(2,false));
                Label label = new Label(composite, SWT.NONE);
-               label.setText("File:");
+               label.setText(Messages.ReportGeneratePage_File);
                fileLabel = new Label(composite, SWT.NONE);
                label = new Label(composite, SWT.NONE);
-               label.setText("Report:");
+               label.setText(Messages.ReportGeneratePage_Report);
                reportLabel = new Label(composite, SWT.NONE);
                label = new Label(composite, SWT.NONE);
-               label.setText("Status:");
+               label.setText(Messages.ReportGeneratePage_Status);
                this.statusLabel = new Label(composite, SWT.NONE);
-               this.statusLabel.setText("Report has not been generated");
+               this.statusLabel.setText(Messages.ReportGeneratePage_ReportNotGenerated);
                generateButton = new Button(composite, SWT.PUSH);
-               generateButton.setText("Generate report");
+               generateButton.setText(Messages.ReportGeneratePage_GenerateReport);
                generateButton.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
@@ -88,7 +89,7 @@ public class ReportGeneratePage extends WizardPage {
                        }
                });
                showButton = new Button(composite, SWT.PUSH);
-               showButton.setText("Show Report");
+               showButton.setText(Messages.ReportGeneratePage_ShowReport);
                showButton.addSelectionListener(new SelectionAdapter() {
                        
                        @Override
@@ -109,13 +110,13 @@ public class ReportGeneratePage extends WizardPage {
        }
        
        private void updateContent() {
-               fileLabel.setText(filename == null ? "File has not been selected" : filename);
-               reportLabel.setText(reportWriter == null ? "Report Writer has not been selected" : reportWriter.getName());
+               fileLabel.setText(filename == null ? Messages.ReportGeneratePage_FileNotSelected : filename);
+               reportLabel.setText(reportWriter == null ? Messages.ReportGeneratePage_ReportWriterNotSelected : reportWriter.getName());
                generateButton.setEnabled(filename != null && reportWriter != null && model != null);
                showButton.setEnabled(generated);
                generateButton.setEnabled(!generated);
                if (!generated)
-                       statusLabel.setText("Report has not been generated");
+                       statusLabel.setText(Messages.ReportGeneratePage_ReportNotGenerated);
        }
        
        public void setGenerated(boolean b) {
@@ -125,7 +126,7 @@ public class ReportGeneratePage extends WizardPage {
        
        private void generate() {
                generateButton.setEnabled(false);
-               statusLabel.setText("Generating report");
+               statusLabel.setText(Messages.ReportGeneratePage_GeneratingReport);
                try {
                        getWizard().getContainer().run(true, false, new IRunnableWithProgress() {
                                
@@ -154,14 +155,14 @@ public class ReportGeneratePage extends WizardPage {
                                }
                        });
                }  catch (InterruptedException err) {
-                       setErrorMessage("Report failed: " + err.getMessage());
-                       ErrorLogger.defaultLogError("Report failed.",err);
-                       statusLabel.setText("Report failed.");
+                       setErrorMessage(NLS.bind(Messages.ReportGeneratePage_ReportFailed , err.getMessage()));
+                       ErrorLogger.defaultLogError(Messages.ReportGeneratePage_ReportFail,err);
+                       statusLabel.setText(Messages.ReportGeneratePage_ReportFail);
                } catch (InvocationTargetException e) {
                    Throwable err = e.getCause();
-                       setErrorMessage("Report failed: " + err.getMessage());
-                       ErrorLogger.defaultLogError("Report failed.",err);
-                       statusLabel.setText("Report failed.");
+                       setErrorMessage(NLS.bind(Messages.ReportGeneratePage_ReportFailed , err.getMessage()));
+                       ErrorLogger.defaultLogError(Messages.ReportGeneratePage_ReportFail,err);
+                       statusLabel.setText(Messages.ReportGeneratePage_ReportFail);
                }
                setGenerated(true);
                
index 93423fc4182b3f50eed9ef9b30fd07ed46b9992a..abc017609c21607e8b82dcb00e7aef3e7e3de253 100644 (file)
@@ -69,14 +69,14 @@ public class ReportSelectionPage extends WizardPage{
                Composite composite = new Composite(parent, SWT.NONE);
                composite.setLayout(new GridLayout(3,false));
                Label label = new Label(composite, SWT.NONE);
-               label.setText("Model:");
+               label.setText(Messages.ReportSelectionPage_Model);
                modelCombo = new CCombo(composite, SWT.BORDER|SWT.READ_ONLY);
                
                label = new Label(composite, SWT.NONE);
-               label.setText("File:");
+               label.setText(Messages.ReportSelectionPage_File);
                filenameText = new Text(composite, SWT.BORDER|SWT.SINGLE);
                browseButton = new Button(composite, SWT.PUSH);
-               browseButton.setText("Browse");
+               browseButton.setText(Messages.ReportSelectionPage_Browse);
                
                reportWriters.add(new ModelDocumentWriter());
                reportWriters.add(new ReferredDocumentWriter());
@@ -86,7 +86,7 @@ public class ReportSelectionPage extends WizardPage{
                reportWriters.add(new CompleteStructureWriter());
                
                Group group = new Group(composite, SWT.NONE);
-               group.setText("Report templates");
+               group.setText(Messages.ReportSelectionPage_ReportTemplates);
                group.setLayout(new FillLayout(SWT.VERTICAL));
                
                GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(filenameText);
@@ -98,11 +98,11 @@ public class ReportSelectionPage extends WizardPage{
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(),SWT.SAVE);
-                               dialog.setFilterExtensions(new String[]{"*.pdf","*.html"});
-                               dialog.setFilterNames(new String[]{"PDF Document","HTML Document"});
+                               dialog.setFilterExtensions(new String[]{"*.pdf","*.html"}); //$NON-NLS-1$ //$NON-NLS-2$
+                               dialog.setFilterNames(new String[]{Messages.ReportSelectionPage_FilterPDFDocument,Messages.ReportSelectionPage_FilterHTMLDocument});
                                String filename = dialog.open();
                                if (filename == null)
-                                       filenameText.setText("");
+                                       filenameText.setText(""); //$NON-NLS-1$
                                else
                                        filenameText.setText(filename);
                                validate();
index 2ead523bd7bb983361030fd6311941984fc1b2cc..7c4dadd658dc85d92cfa85213ec41cda964a138c 100644 (file)
@@ -31,9 +31,9 @@ public class ReportWizard extends Wizard implements IExportWizard{
        
        @Override
        public void addPages() {
-               reportSelectionPage = new ReportSelectionPage("Select report parameters");
-               reportCustomizationPage = new ReportCustomizationPage("Customize report");
-               reportGeneratePage = new ReportGeneratePage("Run Report");
+               reportSelectionPage = new ReportSelectionPage(Messages.ReportWizard_SelectReportParameters);
+               reportCustomizationPage = new ReportCustomizationPage(Messages.ReportWizard_CustomizeReport);
+               reportGeneratePage = new ReportGeneratePage(Messages.ReportWizard_RunReport);
                addPage(reportSelectionPage);
                addPage(reportCustomizationPage);
                addPage(reportGeneratePage);
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties
new file mode 100644 (file)
index 0000000..6427d2a
--- /dev/null
@@ -0,0 +1,30 @@
+EvaluatorConfigurationWidget_Add=Add\r
+EvaluatorConfigurationWidget_Remove=Remove\r
+ReportCustomizationPage_Defaults=Defaults\r
+ReportCustomizationPage_GiveTemplateName=Give template name\r
+ReportCustomizationPage_Library=Library\r
+ReportCustomizationPage_Load=Load\r
+ReportCustomizationPage_Name=Name\r
+ReportCustomizationPage_NameCannotBeEmpty=Name cannot be empty\r
+ReportCustomizationPage_Save=Save\r
+ReportCustomizationPage_SaveReportCustomizations=Save report customization\r
+ReportGeneratePage_File=File:\r
+ReportGeneratePage_FileNotSelected=File has not been selected\r
+ReportGeneratePage_GenerateReport=Generate report\r
+ReportGeneratePage_GeneratingReport=Generating report\r
+ReportGeneratePage_Report=Report:\r
+ReportGeneratePage_ReportFail=Report failed.\r
+ReportGeneratePage_ReportFailed=Report failed: {0}\r
+ReportGeneratePage_ReportNotGenerated=Report has not been generated\r
+ReportGeneratePage_ReportWriterNotSelected=Report Writer has not been selected\r
+ReportGeneratePage_ShowReport=Show Report\r
+ReportGeneratePage_Status=Status:\r
+ReportSelectionPage_Browse=Browse\r
+ReportSelectionPage_File=File:\r
+ReportSelectionPage_FilterHTMLDocument=HTML Document\r
+ReportSelectionPage_FilterPDFDocument=PDF Document\r
+ReportSelectionPage_Model=Model:\r
+ReportSelectionPage_ReportTemplates=Report templates\r
+ReportWizard_CustomizeReport=Customize report\r
+ReportWizard_RunReport=Run Report\r
+ReportWizard_SelectReportParameters=Select report parameters\r
diff --git a/i18n.md b/i18n.md
index cfa0c38a6a056e1f94262f884b72aace9428ac80..f59af84237837ddd6ba3ade0854c5978cb0bb058 100644 (file)
--- a/i18n.md
+++ b/i18n.md
@@ -4,9 +4,9 @@
 * [x] org.simantics.db.procore.ui
 * [x] org.simantics.debug.ui 
 * [x] org.simantics.desktop.ui
+* [x] org.simantics.document.linking.ui
 * ...
 
-
 ## TODO ##
 * /org.simantics.browsing.ui 
 * /org.simantics.browsing.ui.common (All can be ignored)
@@ -19,7 +19,7 @@
 * /org.simantics.browsing.ui.platform (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.browsing.ui.swt (Nothing to Exeternalize or all can be ignored) 
 * /org.simantics.debug.browser.ui (Nothing to Exeternalize or all can be ignored) 
-* /org.simantics.desktop.ui.ontology
+* /org.simantics.desktop.ui.ontology (No strings to externalize)
 * /org.simantics.document.ui
 * /org.simantics.document.ui.ontology
 * /org.simantics.export.ui