From 8783f9ee2b67f83160d88f43a7aef02a6b25f955 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 29 Nov 2018 16:01:59 +0200 Subject: [PATCH] Externalize org.simantics.document.linking.ui gitlab #210 Change-Id: I5518a1c41c87a606ce68b69c9462750a49add088 --- .../org.eclipse.core.resources.prefs | 7 ++ .../simantics/document/linking/Activator.java | 4 +- .../document/linking/actions/Messages.java | 19 ++++ .../linking/actions/SearchLinksAction.java | 13 ++- .../actions/UpdateReferencesAction.java | 30 ++++--- .../linking/actions/messages.properties | 5 ++ .../linking/function/SearchFunction.java | 28 +++--- .../document/linking/ge/Constants.java | 22 ++--- .../linking/ge/FixAllReferencesAction.java | 24 +++-- .../document/linking/ge/Messages.java | 33 +++++++ .../linking/ge/ShowDocumentAction.java | 2 +- .../linking/ge/ShowDocumentWithAction.java | 4 +- .../linking/ge/SourceObjectDropAction.java | 6 +- .../linking/ge/VariableLabelRule.java | 31 +++---- .../document/linking/ge/messages.properties | 19 ++++ .../document/linking/report/Document.java | 2 +- .../linking/report/DocumentTitlePage.java | 6 +- .../document/linking/report/ExportToPDF.java | 20 ++--- .../document/linking/report/Messages.java | 17 ++++ .../report/evaluator/AlignmentHint.java | 6 +- .../linking/report/evaluator/And.java | 8 +- .../linking/report/evaluator/Constant.java | 8 +- .../linking/report/evaluator/DBUtil.java | 2 +- .../linking/report/evaluator/Date.java | 2 +- .../report/evaluator/EvaluatorRoot.java | 2 +- .../document/linking/report/evaluator/If.java | 8 +- .../linking/report/evaluator/Lines.java | 8 +- .../document/linking/report/evaluator/Or.java | 4 +- .../linking/report/evaluator/Path.java | 12 +-- .../report/evaluator/PredefinedVariables.java | 14 +-- .../report/evaluator/TextSizeHint.java | 10 +-- .../linking/report/evaluator/Variable.java | 6 +- .../linking/report/html/HTMLDocument.java | 36 ++++---- .../report/html/HTMLStreamElement.java | 6 +- .../linking/report/html/HTMLTable.java | 88 +++++++++---------- .../linking/report/html/HTMLTitlePage.java | 14 +-- .../linking/report/html/HTMLTocElement.java | 12 +-- .../linking/report/html/HTMLURLItemImpl.java | 2 +- .../linking/report/html/Messages.java | 15 ++++ .../linking/report/html/messages.properties | 1 + .../linking/report/messages.properties | 3 + .../document/linking/report/pdf/Messages.java | 15 ++++ .../linking/report/pdf/PDFDocument.java | 14 +-- .../document/linking/report/pdf/PDFPage.java | 2 +- .../document/linking/report/pdf/PDFTable.java | 2 +- .../linking/report/pdf/PDFTitlePage.java | 4 +- .../linking/report/pdf/PDFTocElement.java | 8 +- .../linking/report/pdf/messages.properties | 1 + .../templates/CompleteStructureWriter.java | 22 ++--- ...iagramStructureWithDependenciesWriter.java | 2 +- .../templates/DiagramStructureWriter.java | 12 +-- .../templates/DocumentStructureWriter.java | 14 +-- .../report/templates/DocumentWriter.java | 26 +++--- .../linking/report/templates/Messages.java | 18 ++++ .../report/templates/ModelDocumentWriter.java | 14 +-- .../templates/ReferredDocumentWriter.java | 2 +- .../custom/EvaluatorCustomizableContent.java | 4 +- .../custom/SCLCustomizableContent.java | 14 +-- .../report/templates/messages.properties | 4 + .../document/linking/utils/Messages.java | 16 ++++ .../linking/utils/SourceLinkUtil.java | 22 ++--- .../linking/utils/messages.properties | 2 + .../document/linking/views/Messages.java | 21 +++++ .../document/linking/views/SourceView.java | 30 +++---- .../linking/views/messages.properties | 7 ++ .../wizard/EvaluatorConfigurationWidget.java | 16 ++-- .../document/linking/wizard/Messages.java | 44 ++++++++++ .../wizard/ReportCustomizationPage.java | 10 +-- .../linking/wizard/ReportGeneratePage.java | 33 +++---- .../linking/wizard/ReportSelectionPage.java | 14 +-- .../document/linking/wizard/ReportWizard.java | 6 +- .../linking/wizard/messages.properties | 30 +++++++ i18n.md | 4 +- 73 files changed, 641 insertions(+), 351 deletions(-) create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java create mode 100644 bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties diff --git a/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.core.resources.prefs b/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.core.resources.prefs index a975f2f93..fbd586c98 100644 --- a/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.core.resources.prefs +++ b/bundles/org.simantics.document.linking.ui/.settings/org.eclipse.core.resources.prefs @@ -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 diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/Activator.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/Activator.java index 722796a74..ef6e06a59 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/Activator.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/Activator.java @@ -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 index 000000000..cab319b77 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java index ff7a3e14e..5fec36f7c 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java @@ -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); } - - + } }; } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/UpdateReferencesAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/UpdateReferencesAction.java index a05d11241..a3cb78734 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/UpdateReferencesAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/UpdateReferencesAction.java @@ -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 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 index 000000000..cb2bd9e7b --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties @@ -0,0 +1,5 @@ +SearchLinksAction_CannotPerformSearch=Cannot perform search +UpdateReferencesAction_CannotUpdateReferences=Cannot update references +UpdateReferencesAction_FixOldReferences=Fix {0} old references? +UpdateReferencesAction_FixReferences=Fix References +UpdateReferencesAction_NothingToFix=Nothing to fix. diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java index eb4b02591..c04a1f417 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java @@ -30,9 +30,9 @@ public class SearchFunction extends FunctionImpl5(); - 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 processed = new HashSet(); - 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")+StringUtil.escape(resource.getName())+""; + return "")+StringUtil.escape(resource.getName())+""; //$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 "")+StringUtil.escape(parent.getName())+""; - return ""; + return "")+StringUtil.escape(parent.getName())+""; //$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$ } } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Constants.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Constants.java index 84b0ab548..11d8fe11f 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Constants.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Constants.java @@ -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) }; } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/FixAllReferencesAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/FixAllReferencesAction.java index 3a19d2129..0a075a3e7 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/FixAllReferencesAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/FixAllReferencesAction.java @@ -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> 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> 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 index 000000000..964411d78 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java index 47d59bc60..394a3167f 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java @@ -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); } } }); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java index be2d5e33e..631f3127a 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java @@ -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); } } }); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java index ec2da54a1..3811c8959 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java @@ -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(); } }); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/VariableLabelRule.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/VariableLabelRule.java index cf9d88c28..dc3e36080 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/VariableLabelRule.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/VariableLabelRule.java @@ -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 index 000000000..e539c4eec --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties @@ -0,0 +1,19 @@ +Constants_Comment=Comment +Constants_Name=Name +Constants_ReferenceDocument=Reference Document +Constants_RefernceDocument=Reference Document +Constants_Value=Value +FixAllReferencesAction_CannotFixReferences=Cannot fix references +FixAllReferencesAction_FixOldReferences=Fix {0} old references and +FixAllReferencesAction_FixReferences=Fix References +FixAllReferencesAction_NothingToFix=Nothing to fix. +ShowDocumentAction_CannotOpenEditor=Cannot open editor +ShowDocumentWithAction_CannotOpenEditor=Cannot open editor +ShowDocumentWithAction_OpenWith=Open with +SourceObjectDropAction_CannotCreateDocumentLink=Cannot create document link to "{0}":{1} +SourceObjectDropAction_DocumentLink=Document Link +VariableLabelRule_DeletedReference=Deleted reference +VariableLabelRule_LabelDefault={0} (default) +VariableLabelRule_NoValue=No Value +VariableLabelRule_ReferencesDoesNotExists=Reference does not exist +VariableLabelRule_ReferencesHasNotBeenSet=Reference has not been set diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Document.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Document.java index 8e39773ca..553dcecdd 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Document.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Document.java @@ -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}; diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/DocumentTitlePage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/DocumentTitlePage.java index d6a3b37b2..af2517718 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/DocumentTitlePage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/DocumentTitlePage.java @@ -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 lines = content.getLines(graph, (Resource)context.get("model"), context); + List lines = content.getLines(graph, (Resource)context.get("model"), context); //$NON-NLS-1$ writeTitle(lines); } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java index 2bfdf79c0..f9645042b 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java @@ -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 context = new HashMap(); - 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 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 index 000000000..1665104db --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/AlignmentHint.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/AlignmentHint.java index 8876960a2..a56900d48 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/AlignmentHint.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/AlignmentHint.java @@ -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$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/And.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/And.java index e2a264069..17aeb3cae 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/And.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/And.java @@ -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 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$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Constant.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Constant.java index e33fa92fb..31cbe49b9 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Constant.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Constant.java @@ -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$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/DBUtil.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/DBUtil.java index d41a06166..93efeffd9 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/DBUtil.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/DBUtil.java @@ -161,7 +161,7 @@ public class DBUtil { public static List 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 templates = Simantics.getSession().syncRequest(new Read>() { @Override public List perform(ReadGraph graph) throws DatabaseException{ diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Date.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Date.java index d1fa44867..8b9ed2b98 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Date.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Date.java @@ -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$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/EvaluatorRoot.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/EvaluatorRoot.java index 2c0f0e766..ab7eb1cb8 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/EvaluatorRoot.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/EvaluatorRoot.java @@ -63,7 +63,7 @@ public class EvaluatorRoot extends EvaluatorNode{ @Override public String toString() { - return "root"; + return "root"; //$NON-NLS-1$ } @Override diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java index e0e783939..4dc921980 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java @@ -26,7 +26,7 @@ public class If extends EvaluatorNode{ @Override public String getValue(ReadGraph graph, Variable variable, Map 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 getLines(ReadGraph graph, Variable variable, Map 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 diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Lines.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Lines.java index 7d7abde42..9b9c05182 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Lines.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Lines.java @@ -27,13 +27,13 @@ public class Lines extends EvaluatorNode { @Override public String getValue(ReadGraph graph, Variable variable, Map 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$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Or.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Or.java index c18a1b6e4..73bece892 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Or.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Or.java @@ -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$ } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Path.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Path.java index f3d67e69f..0860b8f68 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Path.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Path.java @@ -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 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 getLines(ReadGraph graph, Variable variable, Map context) throws DatabaseException { List result = new ArrayList(); - 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 diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java index 86afc31b8..c90178401 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java @@ -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); } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/TextSizeHint.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/TextSizeHint.java index df2ae2d8e..739c6e430 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/TextSizeHint.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/TextSizeHint.java @@ -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; } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Variable.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Variable.java index a55d73865..fdf92297e 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Variable.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Variable.java @@ -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$ } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLDocument.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLDocument.java index 79fb2653f..cd62f25ad 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLDocument.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLDocument.java @@ -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 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(""); - resultOs.println(""); - resultOs.println(""); - resultOs.println(" "); - resultOs.println(" Report"); + String cssUrl = getDataUrl() +"/report.css"; //$NON-NLS-1$ + resultOs.println(""); //$NON-NLS-1$ + resultOs.println(""); //$NON-NLS-1$ + resultOs.println(""); //$NON-NLS-1$ + resultOs.println(" "); //$NON-NLS-1$ + resultOs.println(" Report"); //$NON-NLS-1$ if (referCSS) - resultOs.println(" "); - resultOs.println(" "); - resultOs.println(""); - resultOs.println(""); + resultOs.println(" "); //$NON-NLS-1$ + resultOs.println(""); //$NON-NLS-1$ + resultOs.println(""); //$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(""); - resultOs.println(""); + resultOs.println(""); //$NON-NLS-1$ + resultOs.println(""); //$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; } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLStreamElement.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLStreamElement.java index 20f3dcd12..34d435ac7 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLStreamElement.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLStreamElement.java @@ -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$ } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTable.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTable.java index 2137dbb54..86afa3e3d 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTable.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTable.java @@ -115,35 +115,35 @@ public class HTMLTable extends HTMLTextElement implements Table { public TableRow writeRowRaw(List line) throws Exception { if (currentLine == 0) startTable(); - String clz = "\""; - clz += currentLine % 2 == 0 ? "even" : "odd"; - clz += " "+currentTextSize; - clz += "\""; - os.println(" "); + 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(" "); //$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(" " + s + ""); + os.println(" " + s + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ else - os.println(" "); + os.println(" "); //$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(" " + s + ""); + os.println(" " + s + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ else - os.println(" "); + os.println(" "); //$NON-NLS-1$ //$NON-NLS-2$ } else { - os.println(" "); + os.println(" "); //$NON-NLS-1$ //$NON-NLS-2$ } - os.println(" "); + os.println(" "); //$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 line) throws Exception { if (currentLine == 0) startTable(); - String clz = "\""; - clz += currentLine % 2 == 0 ? "even" : "odd"; - clz += " "+currentTextSize; - clz += "\""; - os.println(" "); + 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(" "); //$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(" " + item.toString() + ""); + os.println(" " + item.toString() + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ else - os.println(" "); + os.println(" "); //$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(" " + s + ""); + os.println(" " + s + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ else - os.println(" "); + os.println(" "); //$NON-NLS-1$ //$NON-NLS-2$ } else { - os.println(" "); + os.println(" "); //$NON-NLS-1$ //$NON-NLS-2$ } - os.println(" "); + os.println(" "); //$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(""); + os.println(""); //$NON-NLS-1$ //$NON-NLS-2$ } - String clz = classID + " " + (linesVisible ? "lines" : "nolines"); - os.println(""); + String clz = classID + " " + (linesVisible ? "lines" : "nolines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + os.println("
"); //$NON-NLS-1$ //$NON-NLS-2$ if (headerVisible) { if (title != null) - os.println(" "); - os.println(" "); - os.println(" "); + os.println(" "); //$NON-NLS-1$ //$NON-NLS-2$ + os.println(" "); //$NON-NLS-1$ + os.println(" "); //$NON-NLS-1$ int ci = 0; for (TableColumn c : columns) { - os.println(" "); + os.println(" "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ci++; } - os.println(" "); - os.println(" "); + os.println(" "); //$NON-NLS-1$ + os.println(" "); //$NON-NLS-1$ } - os.println(" "); + os.println(" "); //$NON-NLS-1$ } void endTable() throws Exception{ if (currentLine > 0) { - os.println(" "); - os.println("
"+title+"
"+title+"
" + escape(c.getName()) + "" + escape(c.getName()) + "
"); - os.println("
"); + os.println(" "); //$NON-NLS-1$ + os.println(""); //$NON-NLS-1$ + os.println("
"); //$NON-NLS-1$ if (!copyStyle) { - os.println(""); + os.println(""); //$NON-NLS-1$ } } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java index 08e4232ce..747b5a4a4 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java @@ -18,30 +18,30 @@ public class HTMLTitlePage extends DocumentTitlePage implements HTMLElement{ public void writeTitle(List 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() + ""); + writer.os.println("<"+hTag +">" + line.getLine() + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } writer.nextPage(); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTocElement.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTocElement.java index a2613c061..eada4913b 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTocElement.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTocElement.java @@ -12,31 +12,31 @@ public class HTMLTocElement extends HTMLStreamElement implements TableOfContents public HTMLTocElement(HTMLDocument writer) throws Exception{ super(writer); - this.os.println("

Table of Contents

"); + 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("" + label + "
"); - tocTable.writeRow("" + label + "
"); + tocTable.writeRow("" + label + "
"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } public void close() throws Exception{ tocTable.endTable(); - os.print("
"); + os.print("
"); //$NON-NLS-1$ super.close(); } @Override public String getId() { - return "toc"; + return "toc"; //$NON-NLS-1$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLURLItemImpl.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLURLItemImpl.java index d1314350b..071043e72 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLURLItemImpl.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLURLItemImpl.java @@ -8,7 +8,7 @@ public class HTMLURLItemImpl extends URLItemImpl{ @Override public String toString() { if (getURL() != null) - return "" + getText() + ""; + return "" + getText() + ""; //$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 index 000000000..42c59e695 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java @@ -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 index 000000000..ab00f270c --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties @@ -0,0 +1 @@ +HTMLTocElement_TocHeading=

Table of Contents

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 index 000000000..f7cc91744 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties @@ -0,0 +1,3 @@ +ExportToPDF_ActivatorCouldNotGenerateReport=Could not generate report +ExportToPDF_MonitorWriteReport=Write Report +ExportToPDF_ReportGenerated=Report generated. 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 index 000000000..3560e83c6 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFDocument.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFDocument.java index ce0c423e2..dd1315bf5 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFDocument.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFDocument.java @@ -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$ } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFPage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFPage.java index f4f376a41..fc0d4a0d1 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFPage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFPage.java @@ -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(); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTable.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTable.java index 902d27159..69f782f14 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTable.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTable.java @@ -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; } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTitlePage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTitlePage.java index d724b0885..7b49ca990 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTitlePage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTitlePage.java @@ -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) diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTocElement.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTocElement.java index c6fc5330e..03c77cdcc 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTocElement.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTocElement.java @@ -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 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 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 index 000000000..3c8f29cf2 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties @@ -0,0 +1 @@ +PDFTocElement_TocHeading=Table of Contents diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/CompleteStructureWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/CompleteStructureWriter.java index dd4de8220..ccfc9ea44 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/CompleteStructureWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/CompleteStructureWriter.java @@ -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 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); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWithDependenciesWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWithDependenciesWriter.java index 806cc47fb..854863e27 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWithDependenciesWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWithDependenciesWriter.java @@ -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 diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWriter.java index c7fa811e4..79714ac63 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWriter.java @@ -31,7 +31,7 @@ public class DiagramStructureWriter extends DocumentWriter{ @Override public String getName() { - return "Diagram structure"; + return "Diagram structure"; //$NON-NLS-1$ } @Override @@ -43,8 +43,8 @@ public class DiagramStructureWriter extends DocumentWriter{ 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{ List 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); } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentStructureWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentStructureWriter.java index 6b8ae70a2..fffc16b23 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentStructureWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentStructureWriter.java @@ -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); } } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentWriter.java index 1f4796437..485e18efc 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentWriter.java @@ -58,29 +58,29 @@ public abstract class DocumentWriter extends TableReportWriter 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 extends TableReportWriter 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 index 000000000..b01b5314c --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java index b0f94261a..0ac9417a7 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java @@ -53,7 +53,7 @@ public class ModelDocumentWriter extends DocumentWriter> { @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> { 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> { private String getText(List 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> { private class DocumentContentProvider implements RowContentProvider> { public void setText(Document writer, java.util.List previous, java.util.List current, java.util.List 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()); }; diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java index 5891ccb26..a3da49b10 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java @@ -40,7 +40,7 @@ public class ReferredDocumentWriter extends ModelDocumentWriter{ @Override public String getName() { - return "Referred Documents"; + return "Referred Documents"; //$NON-NLS-1$ } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/EvaluatorCustomizableContent.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/EvaluatorCustomizableContent.java index 739415466..dbc02e72c 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/EvaluatorCustomizableContent.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/EvaluatorCustomizableContent.java @@ -34,7 +34,7 @@ public class EvaluatorCustomizableContent implements CustomizableContent{ public String getContent(ReadGraph graph, Resource resource, Map 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 getLines(ReadGraph graph, Resource resource, Map 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); } diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/SCLCustomizableContent.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/SCLCustomizableContent.java index 09fb37194..126591a53 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/SCLCustomizableContent.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/SCLCustomizableContent.java @@ -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 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 index 000000000..aadad1c69 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties @@ -0,0 +1,4 @@ +CompleteStructureWriter_ErrorInPropertyRefrence=Error in property reference +DiagramStructureWriter_Hierarchymissing=Hierarchy missing +DocumentStructureWriter_ErrorInPropertyReference=Error in property reference +DocumentWriter_DocumentDoesNotExist=[DOCUMENT DOES NOT EXIST] 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 index 000000000..5fdf7ce21 --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/SourceLinkUtil.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/SourceLinkUtil.java index 12c2b5b99..c652f69fa 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/SourceLinkUtil.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/SourceLinkUtil.java @@ -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 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 index 000000000..b801eb43a --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties @@ -0,0 +1,2 @@ +SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel=Location of document link and document are in different models, document link cannot be created. +SourceLinkUtil_DatabaseExceptionLocNotModelPart=Location of document link is not part of a model. 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 index 000000000..d9745ed3c --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java index e3b1c55d3..86dfe67ed 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java @@ -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 index 000000000..84c99646c --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties @@ -0,0 +1,7 @@ +SourceView_All=All +SourceView_Browsing=Browsing +SourceView_LinkAll=Link All +SourceView_LinkDocuments=Link Documents +SourceView_Linking=Linking +SourceView_OldRemoved=Old/Removed +SourceView_PinSelection=Pin selection diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/EvaluatorConfigurationWidget.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/EvaluatorConfigurationWidget.java index 0996e6ef8..6f53d1f35 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/EvaluatorConfigurationWidget.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/EvaluatorConfigurationWidget.java @@ -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 index 000000000..cc9d1e1cc --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java @@ -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() { + } +} diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportCustomizationPage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportCustomizationPage.java index 37f76332f..8be049626 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportCustomizationPage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportCustomizationPage.java @@ -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(); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportGeneratePage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportGeneratePage.java index 4db863f2a..39fb63983 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportGeneratePage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportGeneratePage.java @@ -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); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java index 93423fc41..abc017609 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java @@ -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(); diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportWizard.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportWizard.java index 2ead523bd..7c4dadd65 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportWizard.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportWizard.java @@ -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 index 000000000..6427d2a4e --- /dev/null +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties @@ -0,0 +1,30 @@ +EvaluatorConfigurationWidget_Add=Add +EvaluatorConfigurationWidget_Remove=Remove +ReportCustomizationPage_Defaults=Defaults +ReportCustomizationPage_GiveTemplateName=Give template name +ReportCustomizationPage_Library=Library +ReportCustomizationPage_Load=Load +ReportCustomizationPage_Name=Name +ReportCustomizationPage_NameCannotBeEmpty=Name cannot be empty +ReportCustomizationPage_Save=Save +ReportCustomizationPage_SaveReportCustomizations=Save report customization +ReportGeneratePage_File=File: +ReportGeneratePage_FileNotSelected=File has not been selected +ReportGeneratePage_GenerateReport=Generate report +ReportGeneratePage_GeneratingReport=Generating report +ReportGeneratePage_Report=Report: +ReportGeneratePage_ReportFail=Report failed. +ReportGeneratePage_ReportFailed=Report failed: {0} +ReportGeneratePage_ReportNotGenerated=Report has not been generated +ReportGeneratePage_ReportWriterNotSelected=Report Writer has not been selected +ReportGeneratePage_ShowReport=Show Report +ReportGeneratePage_Status=Status: +ReportSelectionPage_Browse=Browse +ReportSelectionPage_File=File: +ReportSelectionPage_FilterHTMLDocument=HTML Document +ReportSelectionPage_FilterPDFDocument=PDF Document +ReportSelectionPage_Model=Model: +ReportSelectionPage_ReportTemplates=Report templates +ReportWizard_CustomizeReport=Customize report +ReportWizard_RunReport=Run Report +ReportWizard_SelectReportParameters=Select report parameters diff --git a/i18n.md b/i18n.md index cfa0c38a6..f59af8423 100644 --- 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 -- 2.47.1