]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Implement ImageDescriptor.getImageData(int zoom)"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 14 Dec 2018 21:04:54 +0000 (21:04 +0000)
committerGerrit Code Review <gerrit2@simantics>
Fri, 14 Dec 2018 21:04:54 +0000 (21:04 +0000)
394 files changed:
bundles/org.simantics.browsing.ui.platform/META-INF/MANIFEST.MF
bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/PropertyPageView.java
bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java
bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/UpdateRunner.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/BuiltinKeys.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/Column.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/ExplorerState.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/GraphExplorer.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/Labeler.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/PrunedChildrenResult.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/exception/NoDataSourceException.java
bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/exception/NoQueryProcessorException.java
bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java
bundles/org.simantics.db.procore.ui/META-INF/MANIFEST.MF
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/Auxiliary.java
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Handler.java
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Messages.java [new file with mode: 0644]
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/UI.java
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Util.java
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/messages.properties [new file with mode: 0644]
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterChange.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerEditor.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/Messages.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/ResourceSearch.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebugger.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebugger.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerEditor.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/Messages.java [new file with mode: 0644]
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/messages.properties [new file with mode: 0644]
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Activator.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/DebugUtils.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerAdapter.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphDebuggerEditorAdapter.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/GraphicalDebuggerEditorAdapter.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Messages.java [new file with mode: 0644]
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/SearchResourceHandler.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/TGEditorAdapter.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/messages.properties [new file with mode: 0644]
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/messages.properties
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/DesktopProjectFeature.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportModel.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ExportSharedLibrary.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportSharedLibrary.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java [new file with mode: 0644]
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/NewModel.java
bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/.settings/org.eclipse.core.resources.prefs
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/Activator.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/SearchLinksAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/UpdateReferencesAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/function/SearchFunction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Constants.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/FixAllReferencesAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/VariableLabelRule.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Document.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/DocumentTitlePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/AlignmentHint.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/And.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Constant.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/DBUtil.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Date.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/EvaluatorRoot.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Lines.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Or.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Path.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/TextSizeHint.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/Variable.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLDocument.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLStreamElement.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTable.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTitlePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLTocElement.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/HTMLURLItemImpl.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFDocument.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFPage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTable.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTitlePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/PDFTocElement.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/CompleteStructureWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWithDependenciesWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DiagramStructureWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentStructureWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/DocumentWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/EvaluatorCustomizableContent.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/custom/SCLCustomizableContent.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/SourceLinkUtil.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/EvaluatorConfigurationWidget.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportCustomizationPage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportGeneratePage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportWizard.java
bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/Activator.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSCompletionAssistProcessor.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSCompletionProposal.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSEditor.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSModuleEditorDocumentProvider.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/CSSSourceViewerConfiguration.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/DocumentView.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/OpenEntityDocumentAdapter.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/AddUrlDocument.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/AddUrlDocumentWithDetail.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFile.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFolder.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ImportDocument.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ImportDocumentFolder.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ImportDocumentWithDetail.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewDocumentFolder.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/DocumentTabContribution.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/NameInputValidator.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/AnnotationConfigurator.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/FileDetailDialog.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/UrlDetailDialog.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/SearchFunction.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/DocumentVersionUtils.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/ExternalEditorAdapter.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/FileDocumentUtil.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/UrlEditorAdapter.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/FileDocumentImportWizard.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/FileSelectionPage.java
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/Messages.java [new file with mode: 0644]
bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/messages.properties [new file with mode: 0644]
bundles/org.simantics.export.ui/src/org/simantics/export/ui/ContentSelectionPage.java
bundles/org.simantics.export.ui/src/org/simantics/export/ui/ExportCoreWizard.java
bundles/org.simantics.export.ui/src/org/simantics/export/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.export.ui/src/org/simantics/export/ui/OptionsPage.java
bundles/org.simantics.export.ui/src/org/simantics/export/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/ImportFileHandler.java
bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.graphviz.ui/examples/org/simantics/graphviz/ui/examples/GraphvizComponentExample.java
bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/AbstractGraphvizEditorPart.java
bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent.java
bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/GraphvizComponent2.java
bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileDocumentProvider.java
bundles/org.simantics.help.ui/src/org/simantics/help/ui/HelpFileEditor.java
bundles/org.simantics.help.ui/src/org/simantics/help/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.help.ui/src/org/simantics/help/ui/OpenHelpFileAdapter.java
bundles/org.simantics.help.ui/src/org/simantics/help/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImages.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.image.ui/src/org/simantics/image/ui/editor/ImageEditor.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/internal/Activator.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Image.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImageLabeler.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Images.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/ImagesLabeler.java
bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Messages.java [new file with mode: 0644]
bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/messages.properties [new file with mode: 0644]
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueView2.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SetSeverityAction.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SeverityFolderLabelRule.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/contribution/IssueLabelDecorationRule.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ConfigureIssueSources.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/ExportIssuesAsCsv.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/FunctionHandler.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Help.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Hide.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/MenuActions.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Messages.java [new file with mode: 0644]
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/NewUserIssue.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PreferenceHandler.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/PurgeResolvedIssues.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/RunActiveValidations.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Unhide.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/messages.properties [new file with mode: 0644]
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/internal/Activator.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/IssuePreferencePage.java
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/Messages.java [new file with mode: 0644]
bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/messages.properties [new file with mode: 0644]
bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/Messages.java [new file with mode: 0644]
bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SaveLogFilesHandler.java
bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java
bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/messages.properties [new file with mode: 0644]
bundles/org.simantics.message.ui/src/org/simantics/message/ui/Activator.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/EventDetailsDialog.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogView.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/Messages.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/TextColors.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/messages.properties
bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/HttpSchemeHandler.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/Messages.java [deleted file]
bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/TestResourceStatusHandler.java
bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/messages.properties [deleted file]
bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/MigrateActionFactory.java
bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Activator.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/ModelingUIUtils.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLClipboard.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/SCLDiagramTemplate.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CompilePGraphsAction.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ConfigureConnectionTypes.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Copy.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateEllipse.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreatePath.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateRectangle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateText.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/DuplicatePinnedViewHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExpandFlagsHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ExplorerDynamicMenuContribution.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsAction.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeFlagsHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/MergeRelatedFlagsHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledDoubleClickActions.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewConnectionPoint.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewProceduralComponentType.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/RenameDiagramComponents.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SetInitialState.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/SwitchComponentTypeContribution.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/GlobalModeledToolbarActions.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/FontChooser.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/MetricsEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ChartComposite.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyFactory.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/ObtainedDoubleStringAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/TimeInputValidator.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/TimePropertyFactory.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/LiftPropertiesDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditorDocumentProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphSourceViewerConfigurationNew.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentInstanceViewer.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentInstanceViewerEditorAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeEditorNamingService.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBase.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleEditorDocumentProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLModuleViewer.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLQueryEditorDocumentProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolCodeDocumentProvider2.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SymbolDropHandlerDocumentProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageDescComposite.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ResetProfileMonitorTransformContribution.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SetFocusabilityContribution.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/SliderClass.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ToggleProfileMonitorsContribution.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/UpDownProfileMonitorsContribution.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/ValueFormatUtil.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/AvailableFormatFactory.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/CurrentExpressionFactory.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorClassFactory2.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorComposite.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorExpressionVisitor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorListener.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorValue.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorVariableWrite.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/MonitorWriter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/RealizedFormatterAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/ResolveMonitorVariable.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/ComponentsRenamingDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/ComponentsRenamingModel.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/ConnectionPointNameStyle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/DocumentDecorationStyle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/IssueDecorationStyle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/SymbolTerminalNameStyle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/TypicalInheritanceStyle.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DefaultTerminalNamingStrategy.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramLayersPage.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramOutlinePage.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerActionContributor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerLoadJob.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DisposingPolicy.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/Messages.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromComponentAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromIssue.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/PopulateElementMonitorDropParticipant.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramEditor.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/PopulateElementDropParticipant.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/messages.properties
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/Messages.java [new file with mode: 0644]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/MigrateWizard.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/messages.properties [new file with mode: 0644]
bundles/org.simantics.modeling/src/org/simantics/modeling/SCLTypeUtils.java
bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/jface/BasePostSelectionProvider.java
bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/jface/BaseSelectionProvider.java
bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/impl/SWTExplorer.java
bundles/org.simantics.views.swt/META-INF/MANIFEST.MF
bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java
i18n.md
releng/org.simantics.sdk.build.p2.site/pom.xml
releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target
releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.tpd
releng/org.simantics.sdk.build.targetdefinition/simantics.target

index d95fd417dab2173f8d444553a30cdbb7c98d2c40..f70303d53f4c338d7565f18bfcdde8782c19897a 100644 (file)
@@ -13,8 +13,7 @@ Require-Bundle: org.eclipse.ui,
  org.simantics.views.swt;bundle-version="1.0.0",
  org.simantics.selectionview;bundle-version="1.0.0",
  org.simantics.utils.thread.swt;bundle-version="1.1.0",
- org.eclipse.e4.core.contexts;bundle-version="1.1.0",
- org.slf4j.api;bundle-version="1.7.25"
+ org.eclipse.e4.core.contexts;bundle-version="1.1.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Export-Package: org.simantics.browsing.ui.platform
index ed78ebc339004e7743a533c748801ea86d2461ac..0d4fc055b6ed2e7a8846052faba1e55ff3d3c310 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  *******************************************************************************/
 package org.simantics.browsing.ui.platform;
 
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.WeakHashMap;
 import java.util.function.Consumer;
 
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.RegistryFactory;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.resource.LocalResourceManager;
@@ -31,6 +38,7 @@ import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchPart3;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.contexts.IContextService;
 import org.eclipse.ui.part.IContributedContentsView;
 import org.eclipse.ui.part.IPage;
@@ -41,10 +49,10 @@ import org.simantics.db.management.ISessionContextProvider;
 import org.simantics.selectionview.PropertyPage;
 import org.simantics.ui.workbench.IPropertyPage;
 import org.simantics.ui.workbench.ResourceInput;
+import org.simantics.utils.threads.SWTThread;
+import org.simantics.utils.threads.Throttler;
 import org.simantics.utils.ui.BundleUtils;
 import org.simantics.utils.ui.SWTUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * This is a version of the standard eclipse <code>PropertySheet</code> view a
@@ -83,14 +91,19 @@ import org.slf4j.LoggerFactory;
  * @see IPropertyPage
  * @see PropertyPage
  */
-public class PropertyPageView extends PageBookView implements IContributedContentsView {
+public class PropertyPageView extends PageBookView implements ISelectionListener, IContributedContentsView {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(PropertyPageView.class);
+    /**
+     * Extension point used to modify behavior of the view
+     */
+    private static final String                   EXT_POINT                  = "org.eclipse.ui.propertiesView";              //$NON-NLS-1$
 
     private static final String                   PROPERTY_VIEW_CONTEXT      = "org.simantics.modeling.ui.properties";
 
     private static final String                   PROP_PINNED                = "pinned";
 
+    protected static final long                   SELECTION_CHANGE_THRESHOLD = 500;
+
     private ISessionContextProvider               contextProvider;
 
     /**
@@ -111,7 +124,7 @@ public class PropertyPageView extends PageBookView implements IContributedConten
 
     private IWorkbenchPart                        lastPart;
     private ISelection                            lastSelection;
-    private final Map<IWorkbenchPart, ISelection> lastSelections             = new WeakHashMap<>();
+    private final Map<IWorkbenchPart, ISelection> lastSelections             = new WeakHashMap<IWorkbenchPart, ISelection>();
 
     private ResourceManager                       resourceManager;
 
@@ -119,10 +132,9 @@ public class PropertyPageView extends PageBookView implements IContributedConten
     private ImageDescriptor                       pinned;
 
     /**
-     * The workbench post-selection listener for this view that changes the
-     * input of the pagebook page for the part which changed its selection. 
+     * Set of workbench parts, which should not be used as a source for PropertySheet
      */
-    private ISelectionListener                    selectionListener = this::doSelectionChanged;
+    private Set<String>                           ignoredViews;
 
     @Override
     public void createPartControl(Composite parent) {
@@ -196,10 +208,16 @@ public class PropertyPageView extends PageBookView implements IContributedConten
         //System.out.println("PPV init: " + this);
         super.init(site);
 
+        // This prevents the Properties view from providing a selection to other
+        // workbench parts, thus making them lose their selections which is not
+        // desirable.
+//        site.setSelectionProvider(null);
+
         contextProvider = Simantics.getSessionContextProvider();
 
         if (!bootstrapOnly) {
-            site.getPage().addPostSelectionListener(selectionListener);
+            site.getPage().addSelectionListener(immediateSelectionListener);
+            site.getPage().addPostSelectionListener(this);
         }
     }
 
@@ -228,7 +246,8 @@ public class PropertyPageView extends PageBookView implements IContributedConten
 
         // Remove ourselves as a workbench selection listener.
         if (!bootstrapOnly) {
-            getSite().getPage().removePostSelectionListener(selectionListener);
+            getSite().getPage().removePostSelectionListener(this);
+            getSite().getPage().removeSelectionListener(immediateSelectionListener);
         }
 
         if (resourceManager != null) {
@@ -245,7 +264,7 @@ public class PropertyPageView extends PageBookView implements IContributedConten
         page.createControl(book);
         page.setMessage(Messages.PropertyPageView_noPropertiesAvailable);
         return page;
-        */
+         */
 
         PropertyPage page = new PropertyPage(getSite());
         initPage(page);
@@ -257,6 +276,7 @@ public class PropertyPageView extends PageBookView implements IContributedConten
 
     @Override
     protected PageRec doCreatePage(IWorkbenchPart part) {
+
         // NOTE: If the default page should be shown, this method must return null.
         if (part == null)
             return null;
@@ -314,10 +334,37 @@ public class PropertyPageView extends PageBookView implements IContributedConten
         return this == part || ignore;
     }
 
+    private Set<String> getIgnoredViews() {
+        if (ignoredViews == null) {
+            ignoredViews = new HashSet<String>();
+            IExtensionRegistry registry = RegistryFactory.getRegistry();
+            IExtensionPoint ep = registry.getExtensionPoint(EXT_POINT);
+            if (ep != null) {
+                IExtension[] extensions = ep.getExtensions();
+                for (int i = 0; i < extensions.length; i++) {
+                    IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+                    for (int j = 0; j < elements.length; j++) {
+                        if ("excludeSources".equalsIgnoreCase(elements[j].getName())) { //$NON-NLS-1$
+                            String id = elements[j].getAttribute("id"); //$NON-NLS-1$
+                            if (id != null)
+                                ignoredViews.add(id);
+                        }
+                    }
+                }
+            }
+        }
+        return ignoredViews;
+    }
+
+    private boolean isViewIgnored(String partID) {
+        return getIgnoredViews().contains(partID);
+    }
+
     @Override
     protected boolean isImportant(IWorkbenchPart part) {
-        //System.out.println("isImportant(" + part.getSite().getId() + ")");
-        return !isWorkbenchSelectionPinned() && !isPropertyView(part);
+        String partID = part.getSite().getId();
+        //System.out.println("isImportant(" + partID + ")");
+        return !isWorkbenchSelectionPinned() && !isPropertyView(part) && !isViewIgnored(partID);
     }
 
     /**
@@ -370,10 +417,39 @@ public class PropertyPageView extends PageBookView implements IContributedConten
 //            super.partHidden(part);
     }
 
+    ISelectionListener immediateSelectionListener = new ISelectionListener() {
+       
+       private Throttler throttler = new Throttler(SWTThread.getThreadAccess(PlatformUI.getWorkbench().getDisplay()), 500, 3);
+       
+        @Override
+        public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
+               
+               // Do not process selections from self
+               if(PropertyPageView.this == part) return;
+               
+            throttler.schedule(new Runnable() {
+
+                               @Override
+                               public void run() {
+                                       PropertyPageView.this.doSelectionChanged(part, selection);                              
+                               }
+               
+            });
+            
+        }
+    };
+
     public ISelection getLastSelection() {
         return lastSelection;
     }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    @Override
     public void selectionChanged(IWorkbenchPart part, ISelection sel) {
         doSelectionChanged(part, sel);
     }
@@ -385,8 +461,7 @@ public class PropertyPageView extends PageBookView implements IContributedConten
      *         <code>false</code> otherwise
      */
     boolean doSelectionChanged(IWorkbenchPart part, ISelection sel) {
-        LOGGER.trace("doSelectionChanged({}): incoming selection {}", part, sel);
-
+       
         // we ignore our own selection or null selection
         if (isPropertyView(part) || sel == null) {
             return false;
@@ -424,9 +499,8 @@ public class PropertyPageView extends PageBookView implements IContributedConten
                 lastPart.addPropertyListener(partPropertyListener);
             }
 
+            updatePartName(ppage, sel);
             if (!sameSelection) {
-                LOGGER.trace("doSelectionChanged({}): updating page input selection to {}", part, sel);
-                updatePartName(ppage, sel);
                 ppage.selectionChanged(part, sel);
                 return true;
             }
@@ -442,11 +516,14 @@ public class PropertyPageView extends PageBookView implements IContributedConten
         // This check is not safe - there might be a burst of changes incoming
         //if (getPartName().equals(parameter)) return;
         //System.out.println("partNameUpdateCallback : " + parameter);
-        SWTUtils.asyncExec(getPageBook(), () -> {
-            if (!getPageBook().isDisposed()) {
-                if (getPartName().equals(parameter)) return;
-                //System.out.println("doSetParameterName : " + parameter);
-                doSetPartName(parameter);
+        SWTUtils.asyncExec(getPageBook(), new Runnable() {
+            @Override
+            public void run() {
+                if (!getPageBook().isDisposed()) {
+                    if (getPartName().equals(parameter)) return;
+                    //System.out.println("doSetParameterName : " + parameter);
+                    doSetPartName(parameter);
+                }
             }
         });
     };
index e90ae5eeecf78dee9d9bd0f6a74084e116d83af9..df736c1e6dc2603315bea23f47b46a2170a52f55 100644 (file)
@@ -50,7 +50,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.resource.LocalResourceManager;
 import org.eclipse.jface.resource.ResourceManager;
-import org.eclipse.jface.util.OpenStrategy;
 import org.eclipse.jface.viewers.IPostSelectionProvider;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -69,6 +68,7 @@ import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.KeyListener;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;
@@ -173,8 +173,6 @@ import org.simantics.utils.ui.SWTUtils;
 import org.simantics.utils.ui.jface.BasePostSelectionProvider;
 import org.simantics.utils.ui.widgets.VetoingEventHandler;
 import org.simantics.utils.ui.workbench.WorkbenchUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import gnu.trove.map.hash.THashMap;
 import gnu.trove.procedure.TObjectProcedure;
@@ -187,8 +185,6 @@ import gnu.trove.set.hash.THashSet;
  */
 class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, GraphExplorer /*, IPostSelectionProvider*/ {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(GraphExplorerImpl.class);
-
        private static class GraphExplorerPostSelectionProvider implements IPostSelectionProvider {
                
                private GraphExplorerImpl ge;
@@ -293,6 +289,24 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
 
     public static final int                        DEFAULT_MAX_CHILDREN                    = 1000;
 
+    private static final long                      POST_SELECTION_DELAY                    = 300;
+
+    /**
+     * The time in milliseconds that must elapse between consecutive
+     * {@link Tree} {@link SelectionListener#widgetSelected(SelectionEvent)}
+     * invocations in order for this class to construct a new selection.
+     * 
+     * <p>
+     * This is done because selection construction can be very expensive as the
+     * selected set grows larger when the user is pressing shift+arrow keys.
+     * GraphExplorerImpl will naturally listen to all changes in the tree
+     * selection, but as an optimization will not construct new
+     * StructuredSelection instances for every selection change event. A new
+     * selection will be constructed and set only if the selection hasn't
+     * changed for the amount of milliseconds specified by this constant.
+     */
+    private static final long                      SELECTION_CHANGE_QUIET_TIME             = 150;
+
     private final IThreadWorkQueue                 thread;
 
     /**
@@ -314,11 +328,11 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
     Tree                                           tree;
 
     @SuppressWarnings({ "rawtypes" })
-    final HashMap<CacheKey<?>, NodeQueryProcessor> processors            = new HashMap<>();
+    final HashMap<CacheKey<?>, NodeQueryProcessor> processors            = new HashMap<CacheKey<?>, NodeQueryProcessor>();
     @SuppressWarnings({ "rawtypes" })
-    final HashMap<Object, PrimitiveQueryProcessor> primitiveProcessors   = new HashMap<>();
+    final HashMap<Object, PrimitiveQueryProcessor> primitiveProcessors   = new HashMap<Object, PrimitiveQueryProcessor>();
     @SuppressWarnings({ "rawtypes" })
-    final HashMap<Class, DataSource>               dataSources           = new HashMap<>();
+    final HashMap<Class, DataSource>               dataSources           = new HashMap<Class, DataSource>();
     
     class GraphExplorerContext extends AbstractDisposable implements IGraphExplorerContext {
         // This is for query debugging only.
@@ -337,7 +351,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
          * <code>null</code> there's nothing scheduled yet in which case
          * scheduling can commence. Otherwise the update should be skipped.
          */
-        AtomicReference<Runnable> currentQueryUpdater = new AtomicReference<>();
+        AtomicReference<Runnable> currentQueryUpdater = new AtomicReference<Runnable>();
 
         /**
          * Keeps track of nodes that have already been auto-expanded. After
@@ -345,7 +359,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
          * expanded state after that. This makes it possible for the user to
          * close auto-expanded nodes.
          */
-        Map<NodeContext, Boolean>     autoExpanded  = new WeakHashMap<>();
+        Map<NodeContext, Boolean>     autoExpanded  = new WeakHashMap<NodeContext, Boolean>();
 
         
         @Override
@@ -468,7 +482,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
 
     GraphExplorerContext                         explorerContext     = new GraphExplorerContext();
 
-    HashSet<TreeItem>                            pendingItems        = new HashSet<>();
+    HashSet<TreeItem>                            pendingItems        = new HashSet<TreeItem>();
     boolean                                      updating            = false;
     boolean                                      pendingRoot         = false;
 
@@ -489,14 +503,14 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
      * Access this map only in the SWT thread to keep it thread-safe.
      * </p>
      */
-    BijectionMap<NodeContext, TreeItem>         contextToItem     = new BijectionMap<>();
+    BijectionMap<NodeContext, TreeItem>         contextToItem     = new BijectionMap<NodeContext, TreeItem>();
 
     /**
      * Columns of the UI viewer. Use {@link #setColumns(Column[])} to
      * initialize.
      */
     Column[]                                     columns           = new Column[0];
-    Map<String, Integer>                         columnKeyToIndex  = new HashMap<>();
+    Map<String, Integer>                         columnKeyToIndex  = new HashMap<String, Integer>();
     boolean                                      refreshingColumnSizes = false;
     boolean                                      columnsAreVisible = true;
 
@@ -523,12 +537,12 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
 
     /** Set to true when the Tree widget is disposed. */
     private boolean                              disposed                 = false;
-    private final CopyOnWriteArrayList<FocusListener>  focusListeners     = new CopyOnWriteArrayList<>();
-    private final CopyOnWriteArrayList<MouseListener>  mouseListeners     = new CopyOnWriteArrayList<>();
-    private final CopyOnWriteArrayList<KeyListener>    keyListeners       = new CopyOnWriteArrayList<>();
+    private final CopyOnWriteArrayList<FocusListener>  focusListeners           = new CopyOnWriteArrayList<FocusListener>();
+    private final CopyOnWriteArrayList<MouseListener>  mouseListeners           = new CopyOnWriteArrayList<MouseListener>();
+    private final CopyOnWriteArrayList<KeyListener>    keyListeners             = new CopyOnWriteArrayList<KeyListener>();
 
     /** Selection provider */
-    private   GraphExplorerPostSelectionProvider postSelectionProvider    = new GraphExplorerPostSelectionProvider(this);
+    private   GraphExplorerPostSelectionProvider postSelectionProvider = new GraphExplorerPostSelectionProvider(this);
     protected BasePostSelectionProvider          selectionProvider        = new BasePostSelectionProvider();
     protected SelectionDataResolver              selectionDataResolver;
     protected SelectionFilter                    selectionFilter;
@@ -556,12 +570,12 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
      * item was a part of the current selection in which case the selection must
      * be updated.
      */
-    private final Map<TreeItem, NodeContext>     selectedItems            = new HashMap<>();
+    private final Map<TreeItem, NodeContext>     selectedItems            = new HashMap<TreeItem, NodeContext>();
 
     /**
      * TODO: specify what this is for
      */
-    private final Set<NodeContext>               selectionRefreshContexts = new HashSet<>();
+    private final Set<NodeContext>               selectionRefreshContexts = new HashSet<NodeContext>();
 
     /**
      * If this field is non-null, it means that if {@link #setData(Event)}
@@ -635,7 +649,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
      * 
      * @see #setPendingImages(IProgressMonitor)
      */
-    Map<TreeItem, ImageTask> imageTasks     = new THashMap<>();
+    Map<TreeItem, ImageTask> imageTasks     = new THashMap<TreeItem, ImageTask>();
 
     /**
      * A state flag indicating whether the vertical scroll bar was visible for
@@ -699,7 +713,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
                        updateCounter = 0;
                        uiUpdateScheduler.schedule(this, 50, TimeUnit.MILLISECONDS);
                     } else {
-                       tree.getDisplay().asyncExec(new UpdateRunner(GraphExplorerImpl.this));
+                       tree.getDisplay().asyncExec(new UpdateRunner(GraphExplorerImpl.this, GraphExplorerImpl.this.explorerContext));
                     }
                     
                 }
@@ -774,7 +788,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
      * modified. These are used internally to prevent duplicate edits from being
      * initiated which should always be a sensible thing to do.
      */
-    private Set<NodeContext> currentlyModifiedNodes   = new THashSet<>();
+    private Set<NodeContext> currentlyModifiedNodes   = new THashSet<NodeContext>();
 
     private final TreeEditor editor;
     private Color            invalidModificationColor = null;
@@ -1367,14 +1381,17 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
         // Keep track of the previous single selection to help
         // decide whether to start editing a tree node on mouse
         // downs or not.
-        tree.addListener(SWT.Selection, event -> {
-            TreeItem[] selection = tree.getSelection();
-            if (selection.length == 1) {
-                //for (TreeItem item : selection)
-                //    System.out.println("selection: " + item);
-                previousSingleSelection = selection[0];
-            } else {
-                previousSingleSelection = null;
+        tree.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                TreeItem[] selection = tree.getSelection();
+                if (selection.length == 1) {
+                    //for (TreeItem item : selection)
+                    //    System.out.println("selection: " + item);
+                    previousSingleSelection = selection[0];
+                } else {
+                    previousSingleSelection = null;
+                }
             }
         });
 
@@ -1476,33 +1493,39 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
         };
         tree.addListener(SWT.MouseDown, mouseEditListener);
         tree.addListener(SWT.DragDetect, mouseEditListener);
-        tree.addListener(SWT.DragDetect, event -> {
-            Point test = new Point(event.x, event.y);
-            TreeItem item = tree.getItem(test);
-            if(item != null) {
-                for(int i=0;i<tree.getColumnCount();i++) {
-                    Rectangle rect = item.getBounds(i);
-                    if(rect.contains(test)) {
-                        tree.setData(KEY_DRAG_COLUMN, i);
-                        return;
+        tree.addListener(SWT.DragDetect, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                Point test = new Point(event.x, event.y);
+                TreeItem item = tree.getItem(test);
+                if(item != null) {
+                    for(int i=0;i<tree.getColumnCount();i++) {
+                        Rectangle rect = item.getBounds(i);
+                        if(rect.contains(test)) {
+                            tree.setData(KEY_DRAG_COLUMN, i);
+                            return;
+                        }
                     }
                 }
+                tree.setData(KEY_DRAG_COLUMN, -1);
             }
-            tree.setData(KEY_DRAG_COLUMN, -1);
         });
-        tree.addListener(SWT.MouseMove, event -> {
-            Point test = new Point(event.x, event.y);
-            TreeItem item = tree.getItem(test);
-            if(item != null) {
-                for(int i=0;i<tree.getColumnCount();i++) {
-                    Rectangle rect = item.getBounds(i);
-                    if(rect.contains(test)) {
-                        transientState.setActiveColumn(i);
-                        return;
+        tree.addListener(SWT.MouseMove, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                Point test = new Point(event.x, event.y);
+                TreeItem item = tree.getItem(test);
+                if(item != null) {
+                    for(int i=0;i<tree.getColumnCount();i++) {
+                        Rectangle rect = item.getBounds(i);
+                        if(rect.contains(test)) {
+                               transientState.setActiveColumn(i);
+                            return;
+                        }
                     }
                 }
+               transientState.setActiveColumn(null);
             }
-            transientState.setActiveColumn(null);
         });
 
         // Add focus/mouse/key listeners for supporting the respective
@@ -1555,18 +1578,18 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
             }
         });
 
-        OpenStrategy os = new OpenStrategy(tree);
-        os.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
-            ISelection s = resetSelectionFromWidget();
-            if (s != null) {
-                LOGGER.trace("Fire selection change: {}", s);
-                selectionProvider.fireSelection(s);
+               // Add a tree selection listener for keeping the selection of
+               // GraphExplorer's ISelectionProvider up-to-date.
+        tree.addSelectionListener(new SelectionListener() {
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                widgetSelected(e);
+            }
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+               widgetSelectionChanged(false);
             }
-        }));
-        os.addPostSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
-            LOGGER.trace("Fire post-selection change: {}", selectionProvider.getSelection());
-            resetSelectionFromWidgetAndFirePostSelection(true);
-        }));
+        });
 
         // This listener takes care of updating the set of currently selected
         // TreeItem instances. This set is needed because we need to know in
@@ -1589,33 +1612,107 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
     }
 
     /**
-     * @return the new selection if it was different from the old selection in
-     *         {@link #selectionProvider}
+     * Mod count for delaying post selection changed events.
      */
-    private ISelection resetSelectionFromWidget() {
-        ISelection widgetSelection = getWidgetSelection();
-//        System.out.println("resetSelection()");
-//        System.out.println("    provider selection: " + selectionProvider.getSelection());
-//        System.out.println("    widget selection:   " + widgetSelection);
-        boolean equals = selectionProvider.selectionEquals(widgetSelection);
-        selectionProvider.setSelectionWithoutFiring(widgetSelection);
-        return equals ? null : widgetSelection;
-    }
+    int postSelectionModCount = 0;
+
+    /**
+     * Last tree selection modification time for implementing a quiet
+     * time for selection changes.
+     */
+    long lastSelectionModTime = System.currentTimeMillis() - 10000;
 
     /**
-     * @return the new selection if it was different from the old selection in
-     *         {@link #selectionProvider}
+     * Current target time for the selection to be set. Calculated
+     * according to the set quiet time and last selection modification
+     * time.
      */
-    private boolean resetSelectionFromWidgetAndFirePostSelection(boolean force) {
-        ISelection s = resetSelectionFromWidget();
-        boolean fire = s != null || force;
-        if (fire) {
-            //System.out.println("FIRING POST-SELECTION: " + selectionProvider.getSelection());
-            selectionProvider.firePostSelection(selectionProvider.getSelection());
+    long selectionSetTargetTime = 0;
+
+    /**
+     * <code>true</code> if delayed selection runnable is current scheduled or
+     * running.
+     */
+    boolean delayedSelectionScheduled = false;
+
+    Runnable SELECTION_DELAY = new Runnable() {
+        @Override
+        public void run() {
+            if (tree.isDisposed())
+                return;
+            long now = System.currentTimeMillis();
+            long waitTimeLeft = selectionSetTargetTime - now;
+            if (waitTimeLeft > 0) {
+                // Not enough quiet time, reschedule.
+                delayedSelectionScheduled = true;
+                tree.getDisplay().timerExec((int) waitTimeLeft, this);
+            } else {
+                // Time to perform selection, stop rescheduling.
+                delayedSelectionScheduled = false;
+                resetSelection();
+            }
+        }
+    };
+
+    private void widgetSelectionChanged(boolean forceSelectionChange) {
+        long modTime = System.currentTimeMillis();
+        long delta = modTime - lastSelectionModTime;
+        lastSelectionModTime = modTime;
+        if (!forceSelectionChange && delta < SELECTION_CHANGE_QUIET_TIME) {
+            long msToWait = SELECTION_CHANGE_QUIET_TIME - delta;
+            selectionSetTargetTime = modTime + msToWait;
+            if (!delayedSelectionScheduled) {
+                delayedSelectionScheduled = true;
+                tree.getDisplay().timerExec((int) msToWait, SELECTION_DELAY);
+            }
+            // Make sure that post selection change events do not fire.
+            ++postSelectionModCount;
+            return;
         }
-        return fire;
+
+        // Immediate selection reconstruction.
+        resetSelection();
     }
 
+    private void resetSelection() {
+        final ISelection selection = getWidgetSelection();
+
+        //System.out.println("resetSelection(" + postSelectionModCount + ")");
+        //System.out.println("    provider selection: " + selectionProvider.getSelection());
+        //System.out.println("    widget selection:   " + selection);
+
+        selectionProvider.setAndFireNonEqualSelection(selection);
+
+        // Implement deferred firing of post selection events
+        final int count = ++postSelectionModCount;
+        //System.out.println("[" + System.currentTimeMillis() + "] scheduling postSelectionChanged " + count + ": " + selection);
+        ThreadUtils.getNonBlockingWorkExecutor().schedule(new Runnable() {
+            @Override
+            public void run() {
+                int newCount = postSelectionModCount;
+                // Don't publish selection yet, there's another change incoming.
+                //System.out.println("[" + System.currentTimeMillis() + "] checking post selection publish: " + count + " vs. " + newCount + ": " + selection);
+                if (newCount != count)
+                    return;
+                //System.out.println("[" + System.currentTimeMillis() + "] " + count + " count equals, firing post selection listeners: " + selection);
+
+                if (tree.isDisposed())
+                    return;
+
+                //System.out.println("scheduling fire post selection changed: " + selection);
+                tree.getDisplay().asyncExec(new Runnable() {
+                    @Override
+                    public void run() {
+                        if (tree.isDisposed() || selectionProvider == null)
+                            return;
+                        //System.out.println("firing post selection changed: " + selection);
+                        selectionProvider.firePostSelection(selection);
+                    }
+                });
+            }
+        }, POST_SELECTION_DELAY, TimeUnit.MILLISECONDS);
+    }
+    
     protected void setDefaultProcessors() {
         // Add a simple IMAGER query processor that always returns null.
         // With this processor no images will ever be shown.
@@ -2330,7 +2427,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
 //                    System.out.println("MODCOUNT: " + modCount + " vs. " + count);
                     if (modCount != count)
                         return;
-                    resetSelectionFromWidgetAndFirePostSelection(false);
+                    widgetSelectionChanged(true);
                 }
             });
         }
index 80ef2bf3919ee245be32db9bf4249d288c2d8370..72c17ed747fe5f8d41f1e670cc5358993324a12d 100644 (file)
@@ -21,9 +21,8 @@ import org.simantics.browsing.ui.CheckedState;
 import org.simantics.browsing.ui.NodeContext;
 import org.simantics.browsing.ui.NodeQueryManager;
 import org.simantics.browsing.ui.common.internal.GENodeQueryManager;
+import org.simantics.browsing.ui.common.internal.IGraphExplorerContext;
 import org.simantics.browsing.ui.content.PrunedChildrenResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * This class is responsible for updating the {@link TreeItem}s contained by the
@@ -37,20 +36,21 @@ import org.slf4j.LoggerFactory;
  */
 class UpdateRunner implements Runnable {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(UpdateRunner.class);
-
     final GraphExplorerImpl ge;
+    //final IGraphExplorerContext geContext;
 
-    UpdateRunner(GraphExplorerImpl ge) {
+    UpdateRunner(GraphExplorerImpl ge, IGraphExplorerContext geContext) {
         this.ge = ge;
+      //  this.geContext = geContext;
     }
 
     public void run() {
        try {
                doRun();
        } catch (Throwable t) {
-               LOGGER.error("", t);
+               t.printStackTrace();
        }
+       
     }
 
     public void doRun() {
index 4c219defb6a59750c7b27e4ca02fe059e245a16a..be283bd84845f322ef1a5c4ce6bb900e56c2faff 100644 (file)
@@ -58,7 +58,7 @@ public interface BuiltinKeys {
         private InputKey() {}
         @Override
         public String toString() {
-            return "INPUT";
+            return "INPUT"; //$NON-NLS-1$
         }
     };
 
@@ -77,7 +77,7 @@ public interface BuiltinKeys {
         private UIContextKey() {}
         @Override
         public String toString() {
-            return "UI_CONTEXT";
+            return "UI_CONTEXT"; //$NON-NLS-1$
         }
     };
 
@@ -96,7 +96,7 @@ public interface BuiltinKeys {
         private BrowseContextKey() {}
         @Override
         public String toString() {
-            return "BROWSE_CONTEXT";
+            return "BROWSE_CONTEXT"; //$NON-NLS-1$
         }
     };
 
@@ -115,7 +115,7 @@ public interface BuiltinKeys {
         private ActionBrowseContextKey() {}
         @Override
         public String toString() {
-            return "ACTION_BROWSE_CONTEXT";
+            return "ACTION_BROWSE_CONTEXT"; //$NON-NLS-1$
         }
     };
 
@@ -134,7 +134,7 @@ public interface BuiltinKeys {
         private FilterKey() {}
         @Override
         public String toString() {
-            return "FILTER";
+            return "FILTER"; //$NON-NLS-1$
         }
     };
 
@@ -153,21 +153,21 @@ public interface BuiltinKeys {
     public static final QueryKey<Viewpoint> SELECTED_VIEWPOINT = new QueryKey<Viewpoint>() {
         @Override
         public String toString() {
-            return "SELECTED_VIEWPOINT";
+            return "SELECTED_VIEWPOINT"; //$NON-NLS-1$
         }
     };
 
     public static final QueryKey<String> ACTIVE_FILTER = new QueryKey<String>() {
         @Override
         public String toString() {
-            return "ACTIVE_FILTER";
+            return "ACTIVE_FILTER"; //$NON-NLS-1$
         }
     };
 
     public static final QueryKey<Collection<ViewpointContribution>> VIEWPOINT_CONTRIBUTIONS = new QueryKey<Collection<ViewpointContribution>>() {
         @Override
         public String toString() {
-            return "VIEWPOINT_CONTRIBUTIONS";
+            return "VIEWPOINT_CONTRIBUTIONS"; //$NON-NLS-1$
         }
     };
 
@@ -181,7 +181,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<ViewpointFactory>> VIEWPOINT_FACTORIES = new QueryKey<Collection<ViewpointFactory>>() {
         @Override
         public String toString() {
-            return "VIEWPOINT_FACTORIES";
+            return "VIEWPOINT_FACTORIES"; //$NON-NLS-1$
         }
     };
 
@@ -192,7 +192,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "SELECTED_VIEWPOINT_FACTORY";
+            return "SELECTED_VIEWPOINT_FACTORY"; //$NON-NLS-1$
         }
     };
 
@@ -203,7 +203,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "VIEWPOINT";
+            return "VIEWPOINT"; //$NON-NLS-1$
         }
     };
 
@@ -214,7 +214,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "VIEWPOINT_CONTRIBUTION";
+            return "VIEWPOINT_CONTRIBUTION"; //$NON-NLS-1$
         }
     };
 
@@ -224,7 +224,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<LabelDecoratorFactory>> LABEL_DECORATOR_FACTORIES = new QueryKey<Collection<LabelDecoratorFactory>>() {
         @Override
         public String toString() {
-            return "LABEL_DECORATOR_FACTORIES";
+            return "LABEL_DECORATOR_FACTORIES"; //$NON-NLS-1$
         }
     };
     /**
@@ -233,7 +233,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<LabelDecorator>> LABEL_DECORATORS = new QueryKey<Collection<LabelDecorator>>() {
         @Override
         public String toString() {
-            return "LABEL_DECORATORS";
+            return "LABEL_DECORATORS"; //$NON-NLS-1$
         }
     };
     /**
@@ -242,7 +242,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<ImageDecoratorFactory>> IMAGE_DECORATOR_FACTORIES = new QueryKey<Collection<ImageDecoratorFactory>>() {
         @Override
         public String toString() {
-            return "IMAGE_DECORATOR_FACTORIES";
+            return "IMAGE_DECORATOR_FACTORIES"; //$NON-NLS-1$
         }
     };
     /**
@@ -251,35 +251,35 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<ImageDecorator>> IMAGE_DECORATORS = new QueryKey<Collection<ImageDecorator>>() {
         @Override
         public String toString() {
-            return "IMAGE_DECORATORS";
+            return "IMAGE_DECORATORS"; //$NON-NLS-1$
         }
     };
 
     public static final QueryKey<Labeler> SELECTED_LABELER = new QueryKey<Labeler>() {
         @Override
         public String toString() {
-            return "SELECTED_LABELER";
+            return "SELECTED_LABELER"; //$NON-NLS-1$
         }
     };
 
     public static final QueryKey<Imager> SELECTED_IMAGER = new QueryKey<Imager>() {
         @Override
         public String toString() {
-            return "SELECTED_IMAGER";
+            return "SELECTED_IMAGER"; //$NON-NLS-1$
         }
     };
 
     public static final QueryKey<Collection<LabelDecoratorFactory>> SELECTED_LABEL_DECORATOR_FACTORIES = new QueryKey<Collection<LabelDecoratorFactory>>() {
         @Override
         public String toString() {
-            return "SELECTED_LABEL_DECORATOR_FACTORIES";
+            return "SELECTED_LABEL_DECORATOR_FACTORIES"; //$NON-NLS-1$
         }
     };
 
     public static final QueryKey<Collection<ImageDecoratorFactory>> SELECTED_IMAGE_DECORATOR_FACTORIES = new QueryKey<Collection<ImageDecoratorFactory>>() {
         @Override
         public String toString() {
-            return "SELECTED_IMAGE_DECORATOR_FACTORIES";
+            return "SELECTED_IMAGE_DECORATOR_FACTORIES"; //$NON-NLS-1$
         }
     };
 
@@ -293,7 +293,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<LabelerFactory>> LABELER_FACTORIES = new QueryKey<Collection<LabelerFactory>>() {
         @Override
         public String toString() {
-            return "LABELER_FACTORIES";
+            return "LABELER_FACTORIES"; //$NON-NLS-1$
         }
     };
 
@@ -307,7 +307,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<ImagerFactory>> IMAGER_FACTORIES = new QueryKey<Collection<ImagerFactory>>() {
         @Override
         public String toString() {
-            return "IMAGER_FACTORIES";
+            return "IMAGER_FACTORIES"; //$NON-NLS-1$
         }
     };
 
@@ -318,7 +318,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "LABELER";
+            return "LABELER"; //$NON-NLS-1$
         }
     };
 
@@ -329,7 +329,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "CHECK_STATE";
+            return "CHECK_STATE"; //$NON-NLS-1$
         }
     };
 
@@ -340,7 +340,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "LABEL_DECORATOR";
+            return "LABEL_DECORATOR"; //$NON-NLS-1$
         }
     };
 
@@ -351,7 +351,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "IMAGER";
+            return "IMAGER"; //$NON-NLS-1$
         }
     };
 
@@ -362,7 +362,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "IMAGE_DECORATOR";
+            return "IMAGE_DECORATOR"; //$NON-NLS-1$
         }
     };
 
@@ -380,7 +380,7 @@ public interface BuiltinKeys {
     public static final PrimitiveQueryKey<Collection<SelectionRequest>> SELECTION_REQUESTS = new PrimitiveQueryKey<Collection<SelectionRequest>>() {
         @Override
         public String toString() {
-            return "SELECTION_REQUEST";
+            return "SELECTION_REQUEST"; //$NON-NLS-1$
         }
     };
 
@@ -400,7 +400,7 @@ public interface BuiltinKeys {
     public static final QueryKey<PrunedChildrenResult> PRUNED_CHILDREN = new QueryKey<PrunedChildrenResult>() {
         @Override
         public String toString() {
-            return "PRUNED_CHILDREN";
+            return "PRUNED_CHILDREN"; //$NON-NLS-1$
         }
     };
 
@@ -417,7 +417,7 @@ public interface BuiltinKeys {
     public static final QueryKey<ComparableContext[]> COMPARABLE_CHILDREN = new QueryKey<ComparableContext[]>() {
         @Override
         public String toString() {
-            return "COMPARABLE_CHILDREN";
+            return "COMPARABLE_CHILDREN"; //$NON-NLS-1$
         }
     };
 
@@ -431,7 +431,7 @@ public interface BuiltinKeys {
     public static final QueryKey<Collection<ComparableContextFactory>> COMPARABLE_FACTORIES = new QueryKey<Collection<ComparableContextFactory>>() {
         @Override
         public String toString() {
-            return "COMPARABLE_FACTORIES";
+            return "COMPARABLE_FACTORIES"; //$NON-NLS-1$
         }
     };
 
@@ -442,7 +442,7 @@ public interface BuiltinKeys {
         }
         @Override
         public String getKeyName() {
-            return "SELECTED_COMPARABLE_FACTORY";
+            return "SELECTED_COMPARABLE_FACTORY"; //$NON-NLS-1$
         }
     }
 
@@ -460,7 +460,7 @@ public interface BuiltinKeys {
     public static final QueryKey<NodeContext[]> FINAL_CHILDREN = new QueryKey<NodeContext[]>() {
         @Override
         public String toString() {
-            return "FINAL_CHILDREN";
+            return "FINAL_CHILDREN"; //$NON-NLS-1$
         }
     };
 
@@ -472,7 +472,7 @@ public interface BuiltinKeys {
     public static final PrimitiveQueryKey<Boolean> IS_EXPANDED = new PrimitiveQueryKey<Boolean>() {
         @Override
         public String toString() {
-            return "IS_EXPANDED";
+            return "IS_EXPANDED"; //$NON-NLS-1$
         }
     };
 
@@ -486,7 +486,7 @@ public interface BuiltinKeys {
     public static final QueryKey<CheckedState> IS_CHECKED = new QueryKey<CheckedState>() {
         @Override
         public String toString() {
-            return "IS_CHECKED";
+            return "IS_CHECKED"; //$NON-NLS-1$
         }
     };
 
@@ -506,7 +506,7 @@ public interface BuiltinKeys {
     public static final PrimitiveQueryKey<Integer> SHOW_MAX_CHILDREN = new PrimitiveQueryKey<Integer>() {
         @Override
         public String toString() {
-            return "SHOW_MAX_CHILDREN";
+            return "SHOW_MAX_CHILDREN"; //$NON-NLS-1$
         }
     };
 
@@ -514,7 +514,7 @@ public interface BuiltinKeys {
         private IsRootKey() {}
         @Override
         public String toString() {
-            return "IS_ROOT";
+            return "IS_ROOT"; //$NON-NLS-1$
         }
     };
 
index 08262ce841466375f40ae708b2d229be6ce62788..380d48230fa2c98a6d08fd5f25551635d7ff4e62 100644 (file)
@@ -123,9 +123,9 @@ public final class Column {
 
     public Column(String key, String label, Align alignment, int width, String tooltip, boolean grab, int weight) {
         if (alignment == null)
-            throw new IllegalArgumentException("null alignment");
+            throw new IllegalArgumentException("null alignment"); //$NON-NLS-1$
         if (key == null)
-            throw new IllegalArgumentException("null key");
+            throw new IllegalArgumentException("null key"); //$NON-NLS-1$
 
         this.key = key;
         this.label = label;
@@ -244,24 +244,24 @@ public final class Column {
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        sb.append("Column[key=");
+        sb.append("Column[key="); //$NON-NLS-1$
         sb.append(key);
         if (!key.equals(label))
-            sb.append(", label=");
+            sb.append(", label="); //$NON-NLS-1$
         sb.append(label);
-        sb.append(", align=");
+        sb.append(", align="); //$NON-NLS-1$
         sb.append(alignment);
-        sb.append(", width=");
+        sb.append(", width="); //$NON-NLS-1$
         sb.append(width);
         if (!label.equals(tooltip)) {
-            sb.append(", tooltip=");
+            sb.append(", tooltip="); //$NON-NLS-1$
             sb.append(tooltip);
         }
-        sb.append(", grab=");
+        sb.append(", grab="); //$NON-NLS-1$
         sb.append(grab);
-        sb.append(", weight=");
+        sb.append(", weight="); //$NON-NLS-1$
         sb.append(weight);
-        sb.append("]");
+        sb.append("]"); //$NON-NLS-1$
         return sb.toString();
     }
 
index b7d152c99ce30b2a99e25d849d2f1ca75727089c..1e02fe034eee88b8b4a7ee8c186f9e0d0f3f915f 100644 (file)
@@ -64,7 +64,7 @@ public class ExplorerState {
         */
        public ExplorerState(NodeContext[] topNodePath, int[] topNodePathChildIndex, Collection<NodeContext> expandedNodes, Map<String, Integer> columnWidths) {
                if (expandedNodes == null)
-                       throw new IllegalArgumentException("null expanded nodes");
+                       throw new IllegalArgumentException("null expanded nodes"); //$NON-NLS-1$
                this.topNodePath = topNodePath;
                this.topNodePathChildIndex = topNodePathChildIndex;
                this.expandedNodes = expandedNodes;
@@ -73,10 +73,10 @@ public class ExplorerState {
 
        @Override
        public String toString() {
-               return getClass().getSimpleName() + "[topNodePath="
-                               + Arrays.toString(topNodePath) + ", topNodePathChildIndex="
-                               + Arrays.toString(topNodePathChildIndex) + ", expandedNodes="
-                               + expandedNodes + ", " + columnWidths + "]";
+               return getClass().getSimpleName() + "[topNodePath=" //$NON-NLS-1$
+                               + Arrays.toString(topNodePath) + ", topNodePathChildIndex=" //$NON-NLS-1$
+                               + Arrays.toString(topNodePathChildIndex) + ", expandedNodes=" //$NON-NLS-1$
+                               + expandedNodes + ", " + columnWidths + "]"; //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index 0745d1d81cae3e2cd866cab0aa4210c85b9e0fe2..4136cec0425295cde7010cd50b4bed1ff72fb60a 100644 (file)
@@ -34,7 +34,7 @@ public interface GraphExplorer extends IAdaptable {
      * A key that can be used to associate GraphExplorer instances with other
      * objects in, e.g. SWT widgets using Widget.setData(String, Object).
      */
-    public static final String KEY_GRAPH_EXPLORER = "GraphExplorer";
+    public static final String KEY_GRAPH_EXPLORER = "GraphExplorer"; //$NON-NLS-1$
 
     /**
      * @see #setAutoExpandLevel(int)
@@ -44,7 +44,7 @@ public interface GraphExplorer extends IAdaptable {
     public static final Object EMPTY_INPUT = new Object() {
 
         @Override
-        public String toString() { return "GraphExplorer.EMPTY_INPUT"; };
+        public String toString() { return "GraphExplorer.EMPTY_INPUT"; }; //$NON-NLS-1$
 
     };
 
index 63e96e89002678aec23926a2b660f223ca21a666..587947488390fd1ad69b334d18ab6608cf860c9e 100644 (file)
@@ -180,7 +180,7 @@ public interface Labeler {
                 Consumer<String> applyCallback);
     }
 
-    String              NO_LABEL  = "<no label>";
+    String              NO_LABEL  = "<no label>"; //$NON-NLS-1$
 
     /**
      * Use this map as a return value of {@link #getLabels()} to indicate no
index 53f2e816842c96a5ca736e066dd4a821c164133b..2c603ba8a0284a039bb872ae2cf630613aee0bc4 100644 (file)
@@ -42,7 +42,7 @@ public final class PrunedChildrenResult {
 
     @Override
     public String toString() {
-        return "PrunedChildrenResult [original count=" + originalChildCount + ", pruned children=" + prunedChildren.length + "]";
+        return "PrunedChildrenResult [original count=" + originalChildCount + ", pruned children=" + prunedChildren.length + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
 }
index edb43013091bb9d940ba2164574418d7cab74c07..28f4cdf3d561acdb46b04c970c868274adb1a771 100644 (file)
@@ -24,7 +24,7 @@ public class NoDataSourceException extends RuntimeException {
     private static final long serialVersionUID = -2394930587477837261L;
 
     public NoDataSourceException(Class<?> clazz) {
-        super("No DataSource available for class " + clazz);
+        super("No DataSource available for class " + clazz); //$NON-NLS-1$
     }
 
 }
index ce26f81b25d5072ddc66b30d64c61741f9651c2f..d60967d7f7e91f463201172d28fcf11b53afae7f 100644 (file)
@@ -18,7 +18,7 @@ public class NoQueryProcessorException extends RuntimeException {
     private static final long serialVersionUID = -5612824339530755041L;
 
     public NoQueryProcessorException(CacheKey<?> key) {
-        super("No Query Processor found for key " + key);
+        super("No Query Processor found for key " + key); //$NON-NLS-1$
     }
 
 }
index 2ef40c29459d4be20009b30a73f54bd85b6fb08f..79fe974642d2a71e66054fe6de5d00a60424b7bf 100644 (file)
@@ -5914,6 +5914,8 @@ public class ReadGraphImpl implements AsyncReadGraph {
             }
             Serializer serializer = binding.serializer();
             byte[] bytes = serializer.serialize(initialValue);
+            // In case the file has been previously accessed and was larger we set the correct size now
+            rd.binaryFile.setLength(bytes.length);
             rd.binaryFile.write(bytes);
             ravs.put(resource, rd);
             return rd;
index a8974d653b3214d5eec943d06a034108ab42e841..bab8294d860e86c28369f2e804b6d1ba51b6e7c6 100644 (file)
@@ -12,6 +12,7 @@ Import-Package:
  org.eclipse.core.runtime,
  org.eclipse.jface.dialogs,
  org.eclipse.jface.operation,
+ org.eclipse.osgi.util;version="1.1.0",
  org.eclipse.swt.widgets,
  org.osgi.framework;version="1.3.0",
  org.simantics.db,
index b05ff95d26071755a3ce6de610ef93074671ff7f..36d8966735d01b31b0d79e96d60ed03a12f4482e 100644 (file)
@@ -13,7 +13,7 @@ public class Auxiliary {
      * @return true if server can be started.
      */
     public static boolean beforeStart(Shell shell, File folder) throws InternalException {
-        boolean skipPurge = "true".equals(System.getProperty("org.simantics.db.procore.ui.skipPurge"));
+        boolean skipPurge = "true".equals(System.getProperty("org.simantics.db.procore.ui.skipPurge")); //$NON-NLS-1$ //$NON-NLS-2$
         if (skipPurge)
             return true;
         return UI.purge(shell, folder);
index 252bf2370d711fd0fdd408a19874861656f0fd39..3dd9e4d73fbe65fd8d81ec342be7ff29b18d8434 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.simantics.db.common.utils.Logger;
@@ -17,11 +18,11 @@ import org.simantics.db.server.Auxiliary;
 import org.simantics.db.server.ProCoreException;
 
 abstract class Handler {
-    protected final String title = "Database Server";
+    protected final String title = Messages.Handler_DatabaseServer;
     abstract boolean start(Shell shell, ProCoreException e) throws ProCoreException;
     protected void checkFolderGiven(Shell shell, ProCoreException e) throws ProCoreException {
         if (null == e.getDbFolder()) {
-            String msg = "No database folder given.";
+            String msg = Messages.Handler_NoDatabaseFolderGiven;
             MessageDialog.openWarning(shell, title, msg);
             throw new ProCoreException(msg);
         }
@@ -82,18 +83,18 @@ final class DatabaseVersionHandler extends Handler {
     }
 }
 class HandlerUtil {
-    private static String NL = System.getProperty("line.separator");
+    private static String NL = System.getProperty("line.separator"); //$NON-NLS-1$
     private static boolean isFolder(final Shell shell, final File dbFolder, String title) {
         if (dbFolder.isDirectory())
             return true;
-        MessageDialog.openWarning(shell, title, "Database folder does not exist. folder=" + dbFolder);
+        MessageDialog.openWarning(shell, title, Messages.Handler_WarningMsgDatabaseFolderNotExists + dbFolder);
         return false;
     }
     public static boolean saveWithQuestion(final Shell shell, final File dbFolder, String title, String msg) {
         if (!isFolder(shell, dbFolder, title))
             return false; // Save not possible.
-        String question = ((null != msg) ? (msg + NL) : "")
-        + "Do you want to save database?" + NL + "folder=" + dbFolder;
+        String question = NLS.bind(Messages.Handler_SaveDatabase,new Object[] {((null != msg) ? (msg + NL) : ""),  //$NON-NLS-1$
+        NL , dbFolder}); 
         boolean yes = MessageDialog.openQuestion(shell, title, question);
         if (!yes)
             return true;
@@ -101,20 +102,20 @@ class HandlerUtil {
             Path saveFolder;
             SaveDatabase(File dbFolder) {
                 super(dbFolder);
-                beginMessage = "Saving database.";
-                okMessage = "Database has been saved.";
-                failMessage = "Failed to save database.";
-                cancelMessage = "Save cancelled.";
+                beginMessage = Messages.Handler_SavingDatabaseBeginMsg;
+                okMessage = Messages.Handler_SavingDatabaseOkMsg;
+                failMessage = Messages.Handler_SavingDatabaseFailMsg;
+                cancelMessage = Messages.Handler_SavingDatabaseCancelledMsg;
             }
             @Override
             public void execute() throws Throwable {
                 saveFolder = Auxiliary.saveDatabase(dbFolder);
                 if (null == saveFolder || !Files.isDirectory(saveFolder))
-                    throw new ProCoreException("Save folder not ok.");
+                    throw new ProCoreException("Save folder not ok."); //$NON-NLS-1$
             }
             @Override
             public String getMessage() {
-                return NL + "folder=" + saveFolder;
+                return NLS.bind( Messages.Handler_FolderEquals ,new Object[] { NL , saveFolder});
             }
         }
         SaveDatabase save = new SaveDatabase(dbFolder);
@@ -126,15 +127,14 @@ class HandlerUtil {
         boolean ok = saveWithQuestion(shell, dbFolder, title, msg);
         if (ok)
             return true;
-        String question = "Save failed. Do you want me to contine?";
+        String question = Messages.Handler_SaveContinue;
         return Util.confirm(shell, title, question);
     }
 
     public static boolean delete(final Shell shell, final File dbFolder, String title, String msg) {
         if (!isFolder(shell, dbFolder, title))
             return false; // Delete not possible.
-        String question = ((null != msg) ? (msg + NL) : "")
-        + "Do you want to delete database?" + NL + "folder=" + dbFolder;
+        String question = NLS.bind(Messages.Handler_DeleteDatabase, new Object[] {((null != msg) ? (msg + NL) : ""), NL , dbFolder}); //$NON-NLS-1$
         boolean yes = MessageDialog.openQuestion(shell, title, question);
         if (!yes)
             return false;
@@ -142,10 +142,10 @@ class HandlerUtil {
         final class DeleteDatabase extends ExecutorDatabase {
             DeleteDatabase(File dbFolder) {
                 super(dbFolder);
-                beginMessage = "Deleting database.";
-                okMessage = "Database has been deleted.";
-                failMessage = "Failed to delete database.";
-                cancelMessage = "Delete cancelled.";
+                beginMessage = Messages.Handler_DeletingDatabase;
+                okMessage = Messages.Handler_DatabaseHasBeenDeleted;
+                failMessage = Messages.Handler_FailedDeleteDatabase;
+                cancelMessage = Messages.Handler_DeleteCancelled;
             }
             @Override
             public void execute() throws Throwable {
@@ -162,14 +162,14 @@ class HandlerUtil {
             return false; // Purge not possible.
         try {
             if (Auxiliary.purgeDatabaseDone(dbFolder)) {
-                MessageDialog.openInformation(shell, title, "Database already purged." + NL + "folder=" + dbFolder);
+                MessageDialog.openInformation(shell, title, NLS.bind(Messages.Handler_DatabaseAlreadyPurged, new Object[] { NL, dbFolder}));
                 return true; // Already clean.
             }
         } catch (ProCoreException e) {
-            Logger.defaultLogError("Failed to query database purge state.", e);
+            Logger.defaultLogError("Failed to query database purge state.", e); //$NON-NLS-1$
         }
-        String question = ((null != msg) ? (msg + NL) : "")
-        + "Do you want to purge database?";
+        String question = ((null != msg) ? (msg + NL) : "") //$NON-NLS-1$
+        + Messages.Handler_PurgeDatabaseQuestion;
         boolean yes = MessageDialog.openQuestion(shell, title, question);
         if (!yes)
             return false;
@@ -182,10 +182,10 @@ class HandlerUtil {
         final class PurgeDatabase extends ExecutorDatabase {
             PurgeDatabase(File dbFolder) {
                 super(dbFolder);
-                beginMessage = "Purging database.";
-                okMessage = "Database has been purged.";
-                failMessage = "Failed to purge database.";
-                cancelMessage = "Purge cancelled.";
+                beginMessage = Messages.Handler_PurgingDatabase;
+                okMessage = Messages.Handler_DatabaseHasBeenPurged;
+                failMessage = Messages.Handler_FailedToPurgeDatabase;
+                cancelMessage = Messages.Handler_PurgeCancelled;
             }
             @Override
             public void execute() throws Throwable {
@@ -199,20 +199,19 @@ class HandlerUtil {
     }
     public static boolean recoverFromGuardFileVersion(final Shell shell, final File dbFolder, String title, String msg)
     throws ProCoreException {
-        String question = ((null != msg) ? msg : "")
-        + NL + "Guard file version mismatch indicates that the database was made with different server version."
-        + "It would be best to open the database with the same version it was made.";
+        String question = NLS.bind(Messages.Handler_GuardFileMisMatchQuestion, new Object[] { ((null != msg) ? msg : ""),  //$NON-NLS-1$
+        NL}); 
         MessageDialog.openWarning(shell, title, question);
         return false;
     }
     public static boolean recoverFromDatabaseLastExit(final Shell shell, final File dbFolder, String title, String msg)
     throws ProCoreException {
-        String message = ((null != msg) ? msg : "") + NL + "What should I try to do?";
+        String message = NLS.bind(Messages.Handler_MessageWhatToDo, new Object[] {((null != msg) ? msg : "") , NL }) ;  //$NON-NLS-1$
         ArrayList<Util.Choice> choices = new ArrayList<Util.Choice>();
-        choices.add(new Util.Choice("Cancel", "Cancel i.e. do nothing. Choose this if you want to manually analyze and correct the situation. This is the safest choice."));
-        choices.add(new Util.Choice("Ignore", "Ignore the exit status. Choose this if you do not know what you are doing. This is fast way to recover and is the safest choice except for cancel."));
-        choices.add(new Util.Choice("Remove", "Remove history. Choose this you know what you are doing. This is fast way to recover but can leave tricky semantic errors in the database. Furhermore, depending on the reason for the non clean exit status, this can fail and corrupt data. However, depending on how the client and/or server died, this could be the right choice."));
-        choices.add(new Util.Choice("Recover", "Recover using journal. Choose this if you are willing to wait and know that the other choices won't work."));
+        choices.add(new Util.Choice(Messages.Handler_Cancel, Messages.Handler_CancelDescription));
+        choices.add(new Util.Choice(Messages.Handler_Ignore, Messages.Handler_IgnoreDescription));
+        choices.add(new Util.Choice(Messages.Handler_Remove, Messages.Handler_RemoveDescription));
+        choices.add(new Util.Choice(Messages.Handler_Recover, Messages.Handler_RecoverDescription));
         Util.Choice[] t = new Util.Choice[choices.size()];
         int choice = Util.select(shell, title, message, choices.toArray(t), 0);
         switch (choice) {
@@ -229,10 +228,10 @@ class HandlerUtil {
         final class IgnoreExitDatabase extends ExecutorDatabase {
             IgnoreExitDatabase(File dbFolder) {
                 super(dbFolder);
-                beginMessage = "Ignoring last exit status.";
-                okMessage = "Ignore done.";
-                failMessage = "Failed to start.";
-                cancelMessage = "Ignore cancelled.";
+                beginMessage = Messages.Handler_IgnoreExitDatabaseBeginMsg;
+                okMessage = Messages.Handler_IgnoreExitDatabaseOkMsg;
+                failMessage = Messages.Handler_IgnoreExitDatabaseBeginFailMsg;
+                cancelMessage = Messages.Handler_IgnoreExitDatabaseCancelMsg;
             }
             @Override
             public void execute() throws Throwable {
@@ -251,10 +250,10 @@ class HandlerUtil {
         final class IgnoreProtocolDatabase extends ExecutorDatabase {
             IgnoreProtocolDatabase(File dbFolder) {
                 super(dbFolder);
-                beginMessage = "Ignoring protocol version mismatch.";
-                okMessage = "Ignore done.";
-                failMessage = "Failed to start.";
-                cancelMessage = "Ignore cancelled.";
+                beginMessage = Messages.Handler_IgnoreProtocolDatabaseBeginMsg;
+                okMessage = Messages.Handler_IgnoreProtocolDatabaseOkMsg;
+                failMessage = Messages.Handler_IgnoreProtocolDatabaseFailMsg;
+                cancelMessage = Messages.Handler_IgnoreProtocolDatabaseCancelMsg;
             }
             @Override
             public void execute() throws Throwable {
@@ -268,13 +267,7 @@ class HandlerUtil {
     }
     public static boolean recoverFromProtocol(final Shell shell, final File dbFolder, String title, String msg)
     throws ProCoreException {
-        String question = ((null != msg) ? msg : "")
-        + NL + "Protocol version mismatch indicates that server and client versions differ."
-        + " It would be best to open the database using the same server and client version."
-        + " But if you insist I can ignore the mismatch and try to muddle along."
-        + " If this works then you should export the data and get matching client and server versions."
-        + " Otherwise there could later be strange errors caused by this version mismatch."
-        + " Shoud I try?";
+        String question = ((null != msg) ? msg : "") + NL + Messages.Handler_ProCoreExceptionQuestion; //$NON-NLS-1$
         boolean yes = Util.openDefaultNo(shell, title, question, MessageDialog.QUESTION);
         if (!yes)
             return false;
@@ -288,10 +281,7 @@ class HandlerUtil {
 //    }
     public static boolean recoverFromDatabaseVersion(final Shell shell, final File dbFolder, String title, String msg)
     throws ProCoreException {
-        String question = ((null != msg) ? msg : "")
-        + NL + "Database version mismatch indicates that the database was made with different server version."
-        + " It would be best to open the database with the same version it was made."
-        + " But if you insist I can try to recover database from journal.";
+        String question = ((null != msg) ? msg : "") + NL + Messages.Handler_ProCoreException2; //$NON-NLS-1$
         boolean yes = Util.openDefaultNo(shell, title, question, MessageDialog.QUESTION);
         if (!yes)
             return false;
@@ -302,11 +292,11 @@ class HandlerUtil {
         if (!isFolder(shell, dbFolder, title))
             return false; // Recovery not possible.
         if (!Auxiliary.canReadJournal(dbFolder)) {
-            MessageDialog.openWarning(shell, title, "Journal file does not exist or isn't readable." + NL + "folder=" + dbFolder);
+            MessageDialog.openWarning(shell, title, NLS.bind(Messages.Handler_JournalFileNotExists ,new Object[] { NL , dbFolder})); 
             return false; // Recovery not possible.
         }
-        String question = ((null != msg) ? msg : "")
-        + NL + "Do you want me to try to recreate the database from journal?";
+        String question = ((null != msg) ? msg : "") //$NON-NLS-1$
+        + NL + Messages.Handler_RecreateDatabaseFromJournalQuestion;
         boolean yes = MessageDialog.openQuestion(shell, title, question);
         if (!yes)
             return false;
@@ -319,10 +309,10 @@ class HandlerUtil {
         final class RecoverDatabase extends ExecutorDatabase {
             RecoverDatabase(File dbFolder) {
                 super(dbFolder);
-                beginMessage = "Recovering database.";
-                okMessage = "Database has been recovered.";
-                failMessage = "Failed to recover database.";
-                cancelMessage = "Recovery cancelled.";
+                beginMessage = Messages.Handler_RecoveringDatabaseBeginMsg;
+                okMessage = Messages.Handler_RecoveringDatabaseRecoverdMsg;
+                failMessage = Messages.Handler_RecoveringDatabaseFailedMsg;
+                cancelMessage = Messages.Handler_RecoveringDatabaseCancelledMsg;
             }
             @Override
             public void execute() throws Throwable {
@@ -359,10 +349,10 @@ class HandlerUtil {
         public void showDone(Shell shell);
     }
     static abstract class ExecutorBase implements Executor {
-        protected String beginMessage = "Task begin.";
-        protected String okMessage = "Task ok.";
-        protected String failMessage = "Task failed.";
-        protected String cancelMessage = "Task cancelled.";
+        protected String beginMessage = Messages.Handler_ExecutorBaseBeginMsg;
+        protected String okMessage = Messages.Handler_ExecutorBaseOkMsg;
+        protected String failMessage = Messages.Handler_ExecutorBaseFailedMsg;
+        protected String cancelMessage = Messages.Handler_ExecutorBaseCancelledMsg;
         protected boolean done = false;
         protected boolean ok = false;
         protected boolean cancelled = false;
@@ -437,7 +427,7 @@ class HandlerUtil {
             this.dbFolder = dbFolder;
         }
         String getMessage() {
-            return NL + "folder=" + dbFolder;
+            return NLS.bind( Messages.Handler_FolderEquals ,new Object[] { NL , dbFolder});
         }
         @Override
         public String getMessageBegin() {
@@ -472,7 +462,7 @@ class HandlerUtil {
                         return;
                     executor.setCancelled();
                     thread.interrupt();
-                    monitor.subTask("Waiting for cancellation to finish.");
+                    monitor.subTask(Messages.Handler_MonitorWaitingForCancellationToFinish);
                     while (!executor.isDone())
                         sleep(100);
                 } finally {
diff --git a/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Messages.java b/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Messages.java
new file mode 100644 (file)
index 0000000..498d3be
--- /dev/null
@@ -0,0 +1,73 @@
+package org.simantics.db.procore.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.db.procore.ui.internal.messages"; //$NON-NLS-1$
+       public static String Handler_Cancel;
+       public static String Handler_CancelDescription;
+       public static String Handler_DatabaseAlreadyPurged;
+       public static String Handler_DatabaseHasBeenDeleted;
+       public static String Handler_DatabaseHasBeenPurged;
+       public static String Handler_DatabaseServer;
+       public static String Handler_DeleteCancelled;
+       public static String Handler_DeleteDatabase;
+       public static String Handler_DeletingDatabase;
+       public static String Handler_ExecutorBaseBeginMsg;
+       public static String Handler_ExecutorBaseCancelledMsg;
+       public static String Handler_ExecutorBaseFailedMsg;
+       public static String Handler_ExecutorBaseOkMsg;
+       public static String Handler_FailedDeleteDatabase;
+       public static String Handler_FailedToPurgeDatabase;
+       public static String Handler_FolderEquals;
+       public static String Handler_GuardFileMisMatchQuestion;
+       public static String Handler_Ignore;
+       public static String Handler_IgnoreDescription;
+       public static String Handler_IgnoreExitDatabaseBeginFailMsg;
+       public static String Handler_IgnoreExitDatabaseBeginMsg;
+       public static String Handler_IgnoreExitDatabaseCancelMsg;
+       public static String Handler_IgnoreExitDatabaseOkMsg;
+       public static String Handler_IgnoreProtocolDatabaseBeginMsg;
+       public static String Handler_IgnoreProtocolDatabaseCancelMsg;
+       public static String Handler_IgnoreProtocolDatabaseFailMsg;
+       public static String Handler_IgnoreProtocolDatabaseOkMsg;
+       public static String Handler_JournalFileNotExists;
+       public static String Handler_MessageWhatToDo;
+       public static String Handler_MonitorWaitingForCancellationToFinish;
+       public static String Handler_NoDatabaseFolderGiven;
+       public static String Handler_ProCoreException2;
+       public static String Handler_ProCoreExceptionQuestion;
+       public static String Handler_PurgeCancelled;
+       public static String Handler_PurgeDatabaseQuestion;
+       public static String Handler_PurgingDatabase;
+       public static String Handler_Recover;
+       public static String Handler_RecoverDescription;
+       public static String Handler_RecoveringDatabaseBeginMsg;
+       public static String Handler_RecoveringDatabaseCancelledMsg;
+       public static String Handler_RecoveringDatabaseFailedMsg;
+       public static String Handler_RecoveringDatabaseRecoverdMsg;
+       public static String Handler_RecreateDatabaseFromJournalQuestion;
+       public static String Handler_Remove;
+       public static String Handler_RemoveDescription;
+       public static String Handler_SaveContinue;
+       public static String Handler_SaveDatabase;
+       public static String Handler_SavingDatabaseBeginMsg;
+       public static String Handler_SavingDatabaseCancelledMsg;
+       public static String Handler_SavingDatabaseFailMsg;
+       public static String Handler_SavingDatabaseOkMsg;
+       public static String Handler_WarningMsgDatabaseFolderNotExists;
+       public static String UI_DatabaseDelete;
+       public static String UI_DatabasePurge;
+       public static String Util_Error;
+       public static String Util_Information;
+       public static String Util_No;
+       public static String Util_Warning;
+       public static String Util_Yes;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 00cca9311329ff43eaf8afe4ae0835d69139a0d4..a36c6a20dc246e810b0404f739985050be4d9c1f 100644 (file)
@@ -19,10 +19,10 @@ import org.simantics.db.server.ProCoreException;
 
 public class UI {
     public static boolean delete(Shell shell, File folder) {
-        return HandlerUtil.delete(shell, folder, "Database Delete", null);
+        return HandlerUtil.delete(shell, folder, Messages.UI_DatabaseDelete, null);
     }
     public static boolean purge(Shell shell, File folder) {
-        return HandlerUtil.purge(shell, folder, "Database Purge", null);
+        return HandlerUtil.purge(shell, folder, Messages.UI_DatabasePurge, null);
     }
     public static boolean handleStart(Shell shell, InternalException e) throws ProCoreException {
         if (!(e instanceof ProCoreException))
@@ -50,7 +50,7 @@ public class UI {
     private static <E extends ProCoreException> long getId(E pe) {
         long id = 0;
         try {
-            Method m = pe.getClass().getMethod("getHandlerId");
+            Method m = pe.getClass().getMethod("getHandlerId"); //$NON-NLS-1$
             Object value = m.invoke(null);
             id = (long)value;
         } catch (RuntimeException e) {
index cc6c54bd2b9a1991b83fea1b8032a43602c47bd7..9c4a5e42302a71261fd878e129784616ca7370ca 100644 (file)
@@ -7,10 +7,10 @@ import org.simantics.db.common.utils.Logger;
 
 public class Util {
     static void showInfo(Shell shell, String message) {
-        MessageDialog.openInformation(shell, "Information", message);
+        MessageDialog.openInformation(shell, Messages.Util_Information, message);
     }
     static void showWarning(Shell shell, String message) {
-        MessageDialog.openWarning(shell, "Warning", message);
+        MessageDialog.openWarning(shell, Messages.Util_Warning, message);
     }
     public static void showError(Shell shell, String message) {
         Util.showError(shell, message, null);
@@ -18,8 +18,8 @@ public class Util {
     static void showError(Shell shell, String message, Throwable t) {
         Logger.defaultLogError(message, t);
         if (null != t)
-            message += "\n" + t.getMessage();
-        MessageDialog.openError(shell, "Error", message);
+            message += "\n" + t.getMessage(); //$NON-NLS-1$
+        MessageDialog.openError(shell, Messages.Util_Error, message);
     }
     public static void logError(String message) {
         Util.logError(message, null);
@@ -34,14 +34,14 @@ public class Util {
         trace(null, message);
     }
     public static void trace(Class<?> clazz, String message) {
-        String s = "";
+        String s = ""; //$NON-NLS-1$
         if (null != clazz)
-            s += clazz.getSimpleName() + " called.\n";
+            s += clazz.getSimpleName() + " called.\n"; //$NON-NLS-1$
         if (null != message)
             s += message;
         Logger.defaultLogInfo(s);
     }
-    private static String NL = System.getProperty("line.separator");
+    private static String NL = System.getProperty("line.separator"); //$NON-NLS-1$
     static class Choice {
         public Choice(String button, String text) {
             this.button = button;
@@ -86,16 +86,16 @@ public class Util {
     }
     public static boolean confirm(Shell shell, String title, String message) {
         String[] labels = new String[2];
-        labels[0] =  "Yes";
-        labels[1] = "No";
+        labels[0] =  Messages.Util_Yes;
+        labels[1] = Messages.Util_No;
         MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, labels, 1);
         int answer = dialog.open();
         return answer == 0;
     }
     public static boolean openDefaultNo(Shell shell, String title, String message, int style) {
         String[] labels = new String[2];
-        labels[0] =  "Yes";
-        labels[1] = "No";
+        labels[0] =  Messages.Util_Yes;
+        labels[1] = Messages.Util_No;
         MessageDialog dialog = new MessageDialog(shell, title, null, message, style, labels, 1);
         int answer = dialog.open();
         return answer == 0;
@@ -105,7 +105,7 @@ public class Util {
         final int LIMIT = 10;
         int i = 0;
         for (Throwable c = t.getCause(); null != c && i < LIMIT; ++i, c = c.getCause())
-            s.append(NL + "cause: " + c.getMessage());
+            s.append(NL + "cause: " + c.getMessage()); //$NON-NLS-1$
         return s.toString();
     }
 }
diff --git a/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/messages.properties b/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/messages.properties
new file mode 100644 (file)
index 0000000..4f0950f
--- /dev/null
@@ -0,0 +1,59 @@
+Handler_Cancel=Cancel\r
+Handler_CancelDescription=Cancel i.e. do nothing. Choose this if you want to manually analyze and correct the situation. This is the safest choice.\r
+Handler_DatabaseAlreadyPurged=Database already purged.{0}folder={1}\r
+Handler_DatabaseHasBeenDeleted=Database has been deleted.\r
+Handler_DatabaseHasBeenPurged=Database has been purged.\r
+Handler_DatabaseServer=Database Server\r
+Handler_DeleteCancelled=Delete cancelled.\r
+Handler_DeleteDatabase={0}Do you want to delete database?{1}folder={2}\r
+Handler_DeletingDatabase=Deleting database.\r
+Handler_ExecutorBaseBeginMsg=Task begin.\r
+Handler_ExecutorBaseCancelledMsg=Task cancelled.\r
+Handler_ExecutorBaseFailedMsg=Task failed.\r
+Handler_ExecutorBaseOkMsg=Task ok.\r
+Handler_FailedDeleteDatabase=Failed to delete database.\r
+Handler_FailedToPurgeDatabase=Failed to purge database.\r
+Handler_FolderEquals={0}folder={1}\r
+Handler_GuardFileMisMatchQuestion={0}{1}Guard file version mismatch indicates that the database was made with different server version.It would be best to open the database with the same version it was made.\r
+Handler_Ignore=Ignore\r
+Handler_IgnoreDescription=Ignore the exit status. Choose this if you do not know what you are doing. This is fast way to recover and is the safest choice except for cancel.\r
+Handler_IgnoreExitDatabaseBeginFailMsg=Failed to start.\r
+Handler_IgnoreExitDatabaseBeginMsg=Ignoring last exit status.\r
+Handler_IgnoreExitDatabaseCancelMsg=Ignore cancelled.\r
+Handler_IgnoreExitDatabaseOkMsg=Ignore done.\r
+Handler_IgnoreProtocolDatabaseBeginMsg=Ignoring protocol version mismatch.\r
+Handler_IgnoreProtocolDatabaseCancelMsg=Ignore cancelled.\r
+Handler_IgnoreProtocolDatabaseFailMsg=Failed to start.\r
+Handler_IgnoreProtocolDatabaseOkMsg=Ignore done.\r
+Handler_JournalFileNotExists=Journal file does not exist or isn't readable.{0}folder={1}\r
+Handler_MessageWhatToDo={0}{1}What should I try to do?\r
+Handler_MonitorWaitingForCancellationToFinish=Waiting for cancellation to finish.\r
+Handler_NoDatabaseFolderGiven=No database folder given.\r
+Handler_ProCoreExceptionQuestion=Protocol version mismatch indicates that server and client versions differ. It would be best to open the database using the same server and client version. But if you insist I can ignore the mismatch and try to muddle along. If this works then you should export the data and get matching client and server versions. Otherwise there could later be strange errors caused by this version mismatch. Shoud I try?\r
+Handler_ProCoreException2=Database version mismatch indicates that the database was made with different server version. It would be best to open the database with the same version it was made. But if you insist I can try to recover database from journal.Journal file does not exist or isn't readable.\r
+Handler_PurgeCancelled=Purge cancelled.\r
+Handler_PurgeDatabaseQuestion=Do you want to purge database?\r
+Handler_PurgingDatabase=Purging database.\r
+Handler_Recover=Recover\r
+Handler_RecoverDescription=Recover using journal. Choose this if you are willing to wait and know that the other choices won't work.\r
+Handler_RecoveringDatabaseBeginMsg=Recovering database.\r
+Handler_RecoveringDatabaseCancelledMsg=Recovery cancelled.\r
+Handler_RecoveringDatabaseFailedMsg=Failed to recover database.\r
+Handler_RecoveringDatabaseRecoverdMsg=Database has been recovered.\r
+Handler_RecreateDatabaseFromJournalQuestion=Do you want me to try to recreate the database from journal?\r
+Handler_Remove=Remove\r
+Handler_RemoveDescription=Remove history. Choose this you know what you are doing. This is fast way to recover but can leave tricky semantic errors in the database. Furhermore, depending on the reason for the non clean exit status, this can fail and corrupt data. However, depending on how the client and/or server died, this could be the right choice.\r
+Handler_SaveContinue=Save failed. Do you want me to contine?\r
+Handler_SaveDatabase={0}Do you want to save database?{1}folder={2}\r
+Handler_SavingDatabaseBeginMsg=Saving database.\r
+Handler_SavingDatabaseCancelledMsg=Save cancelled.\r
+Handler_SavingDatabaseFailMsg=Failed to save database.\r
+Handler_SavingDatabaseOkMsg=Database has been saved.\r
+Handler_WarningMsgDatabaseFolderNotExists=Database folder does not exist. folder=\r
+UI_DatabaseDelete=Database Delete\r
+UI_DatabasePurge=Database Purge\r
+Util_Error=Error\r
+Util_Information=Information\r
+Util_No=No\r
+Util_Warning=Warning\r
+Util_Yes=Yes\r
index 880bfd00d3e88a225ae10130978cde4f43b5bf76..0b17631341b275059d1241ff3ac28413575527b4 100644 (file)
@@ -493,6 +493,8 @@ public final class ClusterChange {
             left -= written;
             checkBufferSpace(12);
         }
+        // Possibly truncate file
+        modiValue(ri, length_, new byte[0], 0, 0);
         return sum;
     }
 
index c3b3ab8b94792ea4dc12942eae7455ed26568d91..46d31fabe50516ba107b7d38a7f78460119aab8b 100644 (file)
@@ -44,6 +44,7 @@ import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.resource.ColorDescriptor;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTError;
 import org.eclipse.swt.browser.Browser;
@@ -138,9 +139,9 @@ public class GraphDebugger extends Composite {
         void historyChanged();
     }
 
-    private static final String                         STATEMENT_PART_SEPARATOR  = ",";
-    private final static String                         DEFAULT_DEBUGGER_CSS_FILE = "debugger.css";
-    private final static String                         DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE;
+    private static final String                         STATEMENT_PART_SEPARATOR  = ","; //$NON-NLS-1$
+    private final static String                         DEFAULT_DEBUGGER_CSS_FILE = "debugger.css"; //$NON-NLS-1$
+    private final static String                         DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE; //$NON-NLS-1$
 
     private static int                                  RESOURCE_NAME_MAX_LENGTH  = 1000;
     private static int                                  RESOURCE_VALUE_MAX_SIZE = 16384;
@@ -213,7 +214,7 @@ public class GraphDebugger extends Composite {
      */
     public GraphDebugger(Composite parent, int style, final Session session, Resource resource) {
         super(parent, style);
-        Assert.isNotNull(session, "session is null");
+        Assert.isNotNull(session, "session is null"); //$NON-NLS-1$
         this.session = session;
         this.currentElement = resource;
         this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
@@ -235,7 +236,7 @@ public class GraphDebugger extends Composite {
      * When given to setStatus, indicates that the message shouldn't be touched
      * since <code>null</code> has a different meaning.
      */
-    private static final String DONT_TOUCH = "DONT_TOUCH";
+    private static final String DONT_TOUCH = "DONT_TOUCH"; //$NON-NLS-1$
 
     protected void setStatus(String message, String error) {
         IStatusLineManager status = WorkbenchUtils.getStatusLine(site);
@@ -269,7 +270,7 @@ public class GraphDebugger extends Composite {
                 if (!css.exists()) {
                     URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path(DEFAULT_DEBUGGER_CSS_PATH), null);
                     if (url == null)
-                        throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'");
+                        throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                     cssPath = FileUtils.copyResource(url, css, true).toURI().toString();
                 } else {
                     cssPath = css.toURI().toString();
@@ -281,7 +282,7 @@ public class GraphDebugger extends Composite {
         }
     }
 
-    private static final String PROMPT_TEXT = "Enter resource ID (RID) or URI";
+    private static final String PROMPT_TEXT = Messages.GraphDebugger_EnterResourceIDorURI;
 
     public void createResourceText(final Composite parent) {
         final Text text = new Text(parent, SWT.BORDER);
@@ -292,7 +293,7 @@ public class GraphDebugger extends Composite {
         text.addFocusListener(new FocusListener() {    
             @Override
             public void focusLost(FocusEvent e) {
-                if (text.getText().trim().equals("")) {
+                if (text.getText().trim().equals("")) { //$NON-NLS-1$
                     text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
                     text.setText(PROMPT_TEXT);
                 }
@@ -301,7 +302,7 @@ public class GraphDebugger extends Composite {
             public void focusGained(FocusEvent e) {
                 if (text.getText().trim().equals(PROMPT_TEXT)) {
                     text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK));
-                    text.setText("");
+                    text.setText(""); //$NON-NLS-1$
                 }
                 text.selectAll();
             }
@@ -317,7 +318,7 @@ public class GraphDebugger extends Composite {
         });
 
         final Button button = new Button(parent, SWT.FLAT);
-        button.setText("&Lookup");
+        button.setText(Messages.GraphDebugger_Lookup);
         button.setEnabled(false);
         GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(button);
 
@@ -349,7 +350,7 @@ public class GraphDebugger extends Composite {
             @Override
             public void modifyText(ModifyEvent e) {
                 String input = text.getText().trim();
-                if (!input.equals(PROMPT_TEXT) && !input.equals(""))
+                if (!input.equals(PROMPT_TEXT) && !input.equals("")) //$NON-NLS-1$
                     button.setEnabled(true);
                 else
                     button.setEnabled(false);
@@ -362,21 +363,21 @@ public class GraphDebugger extends Composite {
         input = input.trim();
 
         SerialisationSupport support = session.getService(SerialisationSupport.class);
-        if (input.startsWith("$")) {
+        if (input.startsWith("$")) { //$NON-NLS-1$
             try {
                 Resource r = support.getResource(Long.parseLong(input.substring(1)));
                 changeLocation(r);
             } catch (NumberFormatException e1) {
                 // Ignore, may happen for crap input
-                setStatus(DONT_TOUCH, "Invalid '$'-prefixed input, expected resource ID");
+                setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidPrefixedInput);
             } catch (Exception e1) {
                 ErrorLogger.defaultLogError(e1);
-                setStatus(DONT_TOUCH, "Resource ID lookup failed. See Error Log.");
+                setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusResourceIDFailed);
             }
             return;
         }
 
-        String[] parts = input.split("-");
+        String[] parts = input.split("-"); //$NON-NLS-1$
 
         if (parts.length == 1) {
             try {
@@ -390,10 +391,10 @@ public class GraphDebugger extends Composite {
                 }
             } catch (NumberFormatException e1) {
                 // Ignore, may happen for crap input
-                setStatus(DONT_TOUCH, "Invalid input, expected transient resource ID");
+                setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidInput);
             } catch (Exception e1) {
                 ErrorLogger.defaultLogError(e1);
-                setStatus(DONT_TOUCH, "Transient resource ID lookup failed. See Error Log.");
+                setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusTransientResourceID);
             }
         } else if (parts.length == 2) {
             try {
@@ -404,10 +405,10 @@ public class GraphDebugger extends Composite {
                 changeLocation(r);
             } catch (NumberFormatException e1) {
                 // Ignore, may happen for crap input
-                setStatus(DONT_TOUCH, "Invalid input, expected index & cluster IDs");
+                setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidInputExpectIdxClusterIds);
             } catch (Exception e1) {
                 ErrorLogger.defaultLogError(e1);
-                setStatus(DONT_TOUCH, "Index & cluster -based lookup failed. See Error Log.");
+                setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusIndexLookpuFailed);
             }
         }
 
@@ -415,7 +416,7 @@ public class GraphDebugger extends Composite {
         try {
             // First check that the input really is a proper URI.
             String uri = input;
-            if (!input.equals("http:/") && input.endsWith("/"))
+            if (!input.equals("http:/") && input.endsWith("/")) //$NON-NLS-1$ //$NON-NLS-2$
                 uri = input.substring(0, input.length() - 1);
             new URI(uri);
             Resource r = session.syncRequest( Queries.resource( uri ) );
@@ -425,20 +426,20 @@ public class GraphDebugger extends Composite {
             // Ignore, this is not a proper URI at all.
         } catch (ResourceNotFoundException e1) {
             // Ok, this was an URI, but no resource was found.
-            setStatus(DONT_TOUCH, "Resource for URI '" + input + "' not found");
+            setStatus(DONT_TOUCH, NLS.bind( Messages.GraphDebugger_StatusResourceforURI , input )); 
             return;
         } catch (DatabaseException e1) {
-            setStatus(DONT_TOUCH, "URI lookup failed. See Error Log.");
+            setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusURIlookupFailed);
             ErrorLogger.defaultLogError(e1);
         }
 
-        setStatus(DONT_TOUCH, "Invalid input, resource ID or URI expected");
+        setStatus(DONT_TOUCH, Messages.GraphDebugger_StatusInvalidInputResIdORURIExpected);
     }
 
     public Label createDropLabel(Composite parent) {
         final Label label = new Label(parent, SWT.BORDER);
         label.setAlignment(SWT.CENTER);
-        label.setText("Drag a resource here to examine it in this debugger!");
+        label.setText(Messages.GraphDebugger_LabelDragResource);
         label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
         GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, 20).span(2, 1).grab(true, false).applyTo(label);
 
@@ -537,29 +538,29 @@ public class GraphDebugger extends Composite {
             @Override
             public void changing(LocationEvent event) {
                 String location = event.location;
-                if (location.startsWith("simantics:browser"))
-                    location = "about:" + location.substring(17);
+                if (location.startsWith("simantics:browser")) //$NON-NLS-1$
+                    location = "about:" + location.substring(17); //$NON-NLS-1$
                 //System.out.println("changing: location=" + location);
 
                 // Do not follow links that are meant as actions that are
                 // handled below.
                 event.doit = false;
-                if ("about:blank".equals(location)) {
+                if ("about:blank".equals(location)) { //$NON-NLS-1$
                     // Just changing to the same old blank url is ok since it
                     // allows the browser to refresh itself.
                     event.doit = true;
                 }
 
-                if (location.startsWith("about:-link")) {
-                    String target = location.replace("about:-link", "");
+                if (location.startsWith("about:-link")) { //$NON-NLS-1$
+                    String target = location.replace("about:-link", ""); //$NON-NLS-1$ //$NON-NLS-2$
                     Resource element = links.getRight(target);
                     if (element == currentElement) {
                         event.doit = false;
                         return;
                     }
                     changeLocation(element);
-                } else if (location.startsWith("about:-remove")) {
-                    String target = location.replace("about:-remove", "");
+                } else if (location.startsWith("about:-remove")) { //$NON-NLS-1$
+                    String target = location.replace("about:-remove", ""); //$NON-NLS-1$ //$NON-NLS-2$
                     String n[] = target.split(STATEMENT_PART_SEPARATOR);
                     if (n.length != 3)
                         return;
@@ -571,10 +572,10 @@ public class GraphDebugger extends Composite {
                     // Make sure this is what the use wants.
                     MessageDialog md = new MessageDialog(
                             getShell(),
-                            "Confirm action...",
+                            Messages.GraphDebugger_ConfirmActionsDots,
                             null,
-                            "This action will remove the selected statement.\nAre you sure you want to proceed with this action?",
-                            MessageDialog.QUESTION, new String[] { "Cancel", "Continue" }, 0);
+                            Messages.GraphDebugger_ConfirmActionsDotsMsg,
+                            MessageDialog.QUESTION, new String[] { Messages.GraphDebugger_Cancel, Messages.GraphDebugger_Continue }, 0);
                     if (md.open() != 1) {
                         return;
                     }
@@ -602,8 +603,8 @@ public class GraphDebugger extends Composite {
 
                     }, parameter -> refreshBrowser()
                     );
-                } else if (location.startsWith("about:-edit-value")) {
-                    String target = location.replace("about:-edit-value", "");
+                } else if (location.startsWith("about:-edit-value")) { //$NON-NLS-1$
+                    String target = location.replace("about:-edit-value", ""); //$NON-NLS-1$ //$NON-NLS-2$
                     final Resource o = links.getRight(target);
 
                     session.asyncRequest(new ReadRequest() {
@@ -620,7 +621,7 @@ public class GraphDebugger extends Composite {
                                 public void run() {
                                     InputDialog dialog = new InputDialog(
                                             getShell(),
-                                            "Edit Value",
+                                            Messages.GraphDebugger_EditValue,
                                             null,
                                             previousValue,
                                             new IInputValidator() {
@@ -660,7 +661,7 @@ public class GraphDebugger extends Composite {
                                             {
                                                 Label label = new Label(composite, SWT.NONE);
                                                 label.moveAbove(getText());
-                                                label.setText("Input new property value. For numeric vector values, separate numbers with comma (',').");
+                                                label.setText(Messages.GraphDebugger_InputNewPropertyValue);
                                                 GridData data = new GridData(GridData.GRAB_HORIZONTAL
                                                         | GridData.HORIZONTAL_ALIGN_FILL
                                                         | GridData.VERTICAL_ALIGN_CENTER);
@@ -797,48 +798,48 @@ public class GraphDebugger extends Composite {
                 if (o instanceof byte[]) {
                     byte[] arr = (byte[]) o;
                     byte[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("byte", Arrays.toString(arr2), arr.length);
+                    return truncated("byte", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof int[]) {
                     int[] arr = (int[]) o;
                     int[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("int", Arrays.toString(arr2), arr.length);
+                    return truncated("int", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof long[]) {
                     long[] arr = (long[]) o;
                     long[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("long", Arrays.toString(arr2), arr.length);
+                    return truncated("long", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof float[]) {
                     float[] arr = (float[]) o;
                     float[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("float", Arrays.toString(arr2), arr.length);
+                    return truncated("float", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof double[]) {
                     double[] arr = (double[]) o;
                     double[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("double", Arrays.toString(arr2), arr.length);
+                    return truncated("double", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof boolean[]) {
                     boolean[] arr = (boolean[]) o;
                     boolean[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("boolean", Arrays.toString(arr2), arr.length);
+                    return truncated("boolean", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof Object[]) {
                     Object[] arr = (Object[]) o;
                     Object[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("Object", Arrays.toString(arr2), arr.length);
+                    return truncated("Object", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else {
-                    return "Unknown big array " + o.getClass();
+                    return "Unknown big array " + o.getClass(); //$NON-NLS-1$
                 }
             } else {
-                return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o);
+                return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o); //$NON-NLS-1$ //$NON-NLS-2$
             }
         }
         return null;
     }
 
     protected String truncated(String type, String string, int originalLength) {
-        return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string;
+        return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
     
     public static String htmlEscape(String s)
     {
-        return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\n", "<br/>");
+        return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\n", "<br/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
     }
 
     /**
@@ -876,7 +877,7 @@ public class GraphDebugger extends Composite {
 //                                     Object v = graph.getValue(r, b);
 //                                     Serializer s = Bindings.getSerializerUnchecked(b);
 //                                     int size = s.getSize(v);
-                                   name = "Approx. " + valueSize + " byte literal of type " + type.toSingleLineString();
+                                   name = "Approx. " + valueSize + " byte literal of type " + type.toSingleLineString(); //$NON-NLS-1$ //$NON-NLS-2$
                                } else {                                        
                                        Binding b = Bindings.getBinding(type);
                                        Object v = graph.getValue(r, b);
@@ -896,7 +897,7 @@ public class GraphDebugger extends Composite {
                 }
                 
                 if(name.isEmpty()) {
-                       name = "<empty value>";
+                       name = "<empty value>"; //$NON-NLS-1$
                 }
                 
             }
@@ -914,7 +915,7 @@ public class GraphDebugger extends Composite {
                 //if(name.isEmpty())
                 name = DebugUtils.getSafeLabel(graph, r);
                 if (name.isEmpty())
-                    name = "<empty name>";
+                    name = "<empty name>"; //$NON-NLS-1$
             }
 //            ClusteringSupport support = graph.getSession().getService(ClusteringSupport.class);
 //            if(name == null)
@@ -956,36 +957,36 @@ public class GraphDebugger extends Composite {
                 // Don't know how I encountered this but it seems to be possible in some cases..
                 // Resource obj = graph.getSingleObject(r, L0.HasObject);
                 Resource obj = graph.getPossibleObject(r, L0.HasObject);
-                String tmp = htmlEscape( (pred == null ? "No predicate ?" : getResourceName(graph, pred)) + " -> " + (obj == null ? "No object ?" : getResourceName(graph, obj)) + " (Assertion)" );
+                String tmp = htmlEscape( (pred == null ? "No predicate ?" : getResourceName(graph, pred)) + " -> " + (obj == null ? "No object ?" : getResourceName(graph, obj)) + " (Assertion)" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                 name = tmp.substring(0, Math.min(80, tmp.length()));
             } else {
                 String resourceName = getResourceName(graph, r);
-                if(resourceName.equals("Inverse")) {
+                if(resourceName.equals("Inverse")) { //$NON-NLS-1$
                     Resource inverse = graph.getPossibleInverse(r);
                     if(inverse != null && graph.hasStatement(inverse, L0.ConsistsOf, r))
-                        resourceName = getResourceName(graph, inverse) + "/Inverse";
+                        resourceName = getResourceName(graph, inverse) + "/Inverse"; //$NON-NLS-1$
                 }
                 String tmp = htmlEscape( resourceName );
                 name = tmp.substring(0, Math.min(80, tmp.length()));
             }
             
         } catch (OutOfMemoryError e) {
-            name = "OutOfMemoryError";
+            name = "OutOfMemoryError"; //$NON-NLS-1$
         }
-        String ret = "<a href=\"simantics:browser-link" + getLinkString(r) + "\">"
+        String ret = "<a href=\"simantics:browser-link" + getLinkString(r) + "\">" //$NON-NLS-1$ //$NON-NLS-2$
         + name
-        + "</a>";
+        + "</a>"; //$NON-NLS-1$
         if (graph.isInstanceOf(r, L0.Literal)) {
-            ret += "&nbsp;<a class=\"edit-link\" href=\"simantics:browser-edit-value" + getLinkString(r) + "\">"
-            + "(edit)"
-            + "</a>";
+            ret += "&nbsp;<a class=\"edit-link\" href=\"simantics:browser-edit-value" + getLinkString(r) + "\">" //$NON-NLS-1$ //$NON-NLS-2$
+            + "(edit)" //$NON-NLS-1$
+            + "</a>"; //$NON-NLS-1$
         }
         return ret;
     }
 
     private String getStatementRemoveRef(Resource s, Resource p, Resource o) {
-        return "<a href=\"simantics:browser-remove" + getStatementString(s, p, o)
-        + "\" title=\"Remove this statement\">X</a>";
+        return "<a href=\"simantics:browser-remove" + getStatementString(s, p, o) //$NON-NLS-1$
+        + "\" title=\"Remove this statement\">X</a>"; //$NON-NLS-1$
     }
 
     private void updatePred(StringBuffer content, ReadGraph graph, Resource subj, Resource pred, List<Resource[]> stats) throws DatabaseException {
@@ -1002,7 +1003,7 @@ public class GraphDebugger extends Composite {
 
             // Make a note if the statement was acquired.
             if(!stmSubject.equals(subj)) {
-                objects[i][3] = " (in " + getResourceRef(graph, stmSubject) + ")";
+                objects[i][3] = " (in " + getResourceRef(graph, stmSubject) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
             }
         }
 
@@ -1016,39 +1017,39 @@ public class GraphDebugger extends Composite {
 
         // Output table rows
         for (int i = 0; i < objects.length; ++i) {
-            content.append("<tr>");
+            content.append("<tr>"); //$NON-NLS-1$
             // Predicate column
             if (i == 0)
-                content.append("<td rowspan=\"").append(objects.length).append("\" valign=\"top\">").append(getResourceRef(graph, pred)).append("</td>");
+                content.append("<td rowspan=\"").append(objects.length).append("\" valign=\"top\">").append(getResourceRef(graph, pred)).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
             // Object column
-            if (objects[i][3] == null) content.append("<td>");
-            else content.append("<td class=\"acquired\">");
+            if (objects[i][3] == null) content.append("<td>"); //$NON-NLS-1$
+            else content.append("<td class=\"acquired\">"); //$NON-NLS-1$
 
             content.append(objects[i][2]);
             if (objects[i][3] != null)
                 content.append(objects[i][3]);
 
-            content.append("</td>");
+            content.append("</td>"); //$NON-NLS-1$
             
             VirtualGraphSupport vgs = graph.getService(VirtualGraphSupport.class);
             VirtualGraph vg = vgs.getGraph(graph, subj, pred, links.getRight(objects[i][0]));
             
             if(vg != null) {
-                content.append("<td>").append(vg.toString()).append("</td>");
+                content.append("<td>").append(vg.toString()).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
             } else {
-                content.append("<td>DB</td>");
+                content.append("<td>DB</td>"); //$NON-NLS-1$
             }
             
 
             // Statement remove -link column
             // Only allowed for non-acquired statements.
             if (objects[i][3] == null) {
-                content.append("<td class=\"remove\">");
+                content.append("<td class=\"remove\">"); //$NON-NLS-1$
                 content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0])));
-                content.append("</td>");
+                content.append("</td>"); //$NON-NLS-1$
             }
-            content.append("</tr>");
+            content.append("</tr>"); //$NON-NLS-1$
         }
     }
 
@@ -1057,13 +1058,13 @@ public class GraphDebugger extends Composite {
         // Generate output content from statements
         String ref = getResourceRef(graph, tag);
 
-        content.append("<tr>");
-        content.append("<td rowspan=\"1\" colspan=\"3\" valign=\"top\">").append(ref).append("</td>");
+        content.append("<tr>"); //$NON-NLS-1$
+        content.append("<td rowspan=\"1\" colspan=\"3\" valign=\"top\">").append(ref).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
         //content.append("<td>" + name + "</td>");
-        content.append("<td class=\"remove\">");
+        content.append("<td class=\"remove\">"); //$NON-NLS-1$
         content.append(getStatementRemoveRef(subj, tag, subj));
-        content.append("</td>");
-        content.append("</tr>");
+        content.append("</td>"); //$NON-NLS-1$
+        content.append("</tr>"); //$NON-NLS-1$
 
     }
 
@@ -1101,15 +1102,15 @@ public class GraphDebugger extends Composite {
             try {
                 cur = OrderedSetUtils.next(graph, subj, cur);
             } catch(DatabaseException e) {
-                list.add("<span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">" + e.getMessage() + "</span>");
+                list.add("<span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">" + e.getMessage() + "</span>"); //$NON-NLS-1$ //$NON-NLS-2$
                 Resource inv = graph.getPossibleInverse(subj);
                 for(Statement stat : graph.getStatements(cur, L0.IsRelatedTo)) {
                     if(stat.getSubject().equals(cur)) {
                         if(stat.getPredicate().equals(subj)) {
-                            list.add("next " + getResourceRef(graph, stat.getObject()));
+                            list.add("next " + getResourceRef(graph, stat.getObject())); //$NON-NLS-1$
                         }
                         else if(stat.getPredicate().equals(inv)) {
-                            list.add("prev " + getResourceRef(graph, stat.getObject()));
+                            list.add("prev " + getResourceRef(graph, stat.getObject())); //$NON-NLS-1$
                         }
                     }
                 }
@@ -1122,15 +1123,15 @@ public class GraphDebugger extends Composite {
 
         // Output table rows
         for (int i = 0; i < list.size() ; ++i) {
-            content.append("<tr>");
+            content.append("<tr>"); //$NON-NLS-1$
             // Predicate column
             if (i == 0)
-                content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Ordered Set Elements</td>");
+                content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Ordered Set Elements</td>"); //$NON-NLS-1$ //$NON-NLS-2$
 
             // Object column
-            content.append("<td>");
+            content.append("<td>"); //$NON-NLS-1$
             content.append(list.get(i));
-            content.append("</td>");
+            content.append("</td>"); //$NON-NLS-1$
 
             // Statement remove -link column
             // Only allowed for non-acquired statements.
@@ -1139,7 +1140,7 @@ public class GraphDebugger extends Composite {
                 content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0])));
                 content.append("</td>");
             }*/
-            content.append("</tr>");
+            content.append("</tr>"); //$NON-NLS-1$
         }
     }
 
@@ -1158,15 +1159,15 @@ public class GraphDebugger extends Composite {
 
         // Output table rows
         for (int i = 0; i < list.size() ; ++i) {
-            content.append("<tr>");
+            content.append("<tr>"); //$NON-NLS-1$
             // Predicate column
             if (i == 0)
-                content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Linked List Elements</td>");
+                content.append("<td rowspan=\"").append(list.size()).append("\" valign=\"top\">Linked List Elements</td>"); //$NON-NLS-1$ //$NON-NLS-2$
 
             // Object column
-            content.append("<td>");
+            content.append("<td>"); //$NON-NLS-1$
             content.append(list.get(i));
-            content.append("</td><td>DB</td>");
+            content.append("</td><td>DB</td>"); //$NON-NLS-1$
 
             // Statement remove -link column
             // Only allowed for non-acquired statements.
@@ -1175,7 +1176,7 @@ public class GraphDebugger extends Composite {
                 content.append(getStatementRemoveRef(subj, pred, links.getRight(objects[i][0])));
                 content.append("</td>");
             }*/
-            content.append("</tr>");
+            content.append("</tr>"); //$NON-NLS-1$
         }
     }
 
@@ -1186,11 +1187,11 @@ public class GraphDebugger extends Composite {
         StringBuffer content = new StringBuffer();
 
         // Generate HTML -page
-        content.append("<html>\n<head>\n")
+        content.append("<html>\n<head>\n") //$NON-NLS-1$
         .append(getHead())
-        .append("\n</head>\n")
-        .append("<body>\n")
-        .append("<div id=\"mainContent\">\n\n");
+        .append("\n</head>\n") //$NON-NLS-1$
+        .append("<body>\n") //$NON-NLS-1$
+        .append("<div id=\"mainContent\">\n\n"); //$NON-NLS-1$
 
         for (Resource r : resources) {
             if (r == null)
@@ -1201,14 +1202,14 @@ public class GraphDebugger extends Composite {
                 uri = graph.syncRequest(new ResourceToPossibleURI(r));
             } catch (Exception e) {
                 ErrorLogger.defaultLogError(e);
-                uri = "Cannot get URI: " + e.getMessage();
+                uri = "Cannot get URI: " + e.getMessage(); //$NON-NLS-1$
             }
 
             // Top DIV
-            content.append("<div id=\"top\">\n");
-            content.append("<table class=\"top\">\n");
+            content.append("<div id=\"top\">\n"); //$NON-NLS-1$
+            content.append("<table class=\"top\">\n"); //$NON-NLS-1$
             if (uri != null) {
-                content.append("<tr><td class=\"top_key\">URI</td><td class=\"top_value\"><span id=\"uri\">").append(uri).append("</span></td></tr>\n");
+                content.append("<tr><td class=\"top_key\">URI</td><td class=\"top_value\"><span id=\"uri\">").append(uri).append("</span></td></tr>\n"); //$NON-NLS-1$ //$NON-NLS-2$
             }
 
             XSupport xs = graph.getService(XSupport.class);
@@ -1226,57 +1227,57 @@ public class GraphDebugger extends Composite {
                     obj = statement.getObject();
                     map.add(predicate, new Resource[] {subject, obj});
                 } catch (Throwable e) {
-                    ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e);
+                    ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                 }
             }
             SerialisationSupport ss = graph.getSession().getService(SerialisationSupport.class);
             ClusteringSupport support = graph.getSession().getService(ClusteringSupport.class);
-            content.append("<tr><td class=\"top_key\">Identifiers</td><td class=\"top_value\">");
-            content.append("<span id=\"resource_id\">")
-            .append(" RID = $").append(r.getResourceId())
-            .append(" Resource Key = ").append(ss.getTransientId(r))
-            .append(" CID = ").append(support.getCluster(r));
-            content.append("</span></td>");
+            content.append("<tr><td class=\"top_key\">Identifiers</td><td class=\"top_value\">"); //$NON-NLS-1$
+            content.append("<span id=\"resource_id\">") //$NON-NLS-1$
+            .append(" RID = $").append(r.getResourceId()) //$NON-NLS-1$
+            .append(" Resource Key = ").append(ss.getTransientId(r)) //$NON-NLS-1$
+            .append(" CID = ").append(support.getCluster(r)); //$NON-NLS-1$
+            content.append("</span></td>"); //$NON-NLS-1$
             if (immutable)
-                content.append("<td class=\"remove\">[IMMUTABLE]</td>");
-            content.append("</tr>\n");
+                content.append("<td class=\"remove\">[IMMUTABLE]</td>"); //$NON-NLS-1$
+            content.append("</tr>\n"); //$NON-NLS-1$
  
             boolean isClusterSet = support.isClusterSet(r);
             Resource parentSet = support.getClusterSetOfCluster(r);
             String parentSetURI = parentSet != null ? graph.getPossibleURI(parentSet) : null;
             
-            content.append("<tr><td class=\"top_key\">Clustering</td><td class=\"top_value\">");
-            content.append("<span id=\"resource_id\">");
+            content.append("<tr><td class=\"top_key\">Clustering</td><td class=\"top_value\">"); //$NON-NLS-1$
+            content.append("<span id=\"resource_id\">"); //$NON-NLS-1$
             
             if(parentSetURI != null)
-                content.append(" Containing cluster set = ").append(parentSetURI);
+                content.append(" Containing cluster set = ").append(parentSetURI); //$NON-NLS-1$
             else if (parentSet != null)
-               content.append(" Containing cluster set = ").append(parentSet.toString());
+               content.append(" Containing cluster set = ").append(parentSet.toString()); //$NON-NLS-1$
             else 
-                content.append(" Not in any cluster set ");
+                content.append(" Not in any cluster set "); //$NON-NLS-1$
             
-            content.append("</span></td>");
+            content.append("</span></td>"); //$NON-NLS-1$
             if (isClusterSet)
-                content.append("<td class=\"remove\">[CLUSTER SET]</td>");
-            content.append("</tr>\n");
+                content.append("<td class=\"remove\">[CLUSTER SET]</td>"); //$NON-NLS-1$
+            content.append("</tr>\n"); //$NON-NLS-1$
             
             // If the resource has a value, show it.
             String resourceValue = getResourceValue(graph, r);
             if (resourceValue != null) {
                 content
-                .append("<tr><td class=\"top_key\">Attached value</td><td class=\"top_value\">")
+                .append("<tr><td class=\"top_key\">Attached value</td><td class=\"top_value\">") //$NON-NLS-1$
                 .append(htmlEscape(resourceValue))
-                .append("</td></tr>\n");
+                .append("</td></tr>\n"); //$NON-NLS-1$
             }
 
             // Close #top
-            content.append("</table>\n");
-            content.append("</div>\n");
+            content.append("</table>\n"); //$NON-NLS-1$
+            content.append("</div>\n"); //$NON-NLS-1$
 
-            content.append("\n<div id=\"data\">\n");
-            content.append("<table>\n")
-            .append("<tr><th>Predicate</th><th>Object</th><th>Graph</th></tr>")
-            .append("<tr><td class=\"subtitle\" colspan=\"3\">Basic information</td></tr>");
+            content.append("\n<div id=\"data\">\n"); //$NON-NLS-1$
+            content.append("<table>\n") //$NON-NLS-1$
+            .append("<tr><th>Predicate</th><th>Object</th><th>Graph</th></tr>") //$NON-NLS-1$
+            .append("<tr><td class=\"subtitle\" colspan=\"3\">Basic information</td></tr>"); //$NON-NLS-1$
 
             boolean isOrderedSet = graph.isInstanceOf(r, L0.OrderedSet);
             boolean isLinkedList = graph.isInstanceOf(r, L0.List);
@@ -1291,7 +1292,7 @@ public class GraphDebugger extends Composite {
                     updatePred(content, graph, r, pred, map.remove(pred));
 
             // TAGS
-            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Tags</td></tr>");
+            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Tags</td></tr>"); //$NON-NLS-1$
             for(Statement stm : statements) {
                 if(stm.getSubject().equals(stm.getObject())) {
                     updateTag(content, graph, r, stm.getPredicate());
@@ -1300,7 +1301,7 @@ public class GraphDebugger extends Composite {
             }
 
             // ORDERED SETS
-            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Ordered Sets</td></tr>");
+            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Ordered Sets</td></tr>"); //$NON-NLS-1$
             for(Statement stm : statements) {
                 Resource predicate = stm.getPredicate();
                 if(graph.isInstanceOf(stm.getPredicate(), L0.OrderedSet)) {
@@ -1320,7 +1321,7 @@ public class GraphDebugger extends Composite {
             }
 
             // IS RELATED TO
-            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Is Related To</td></tr>");
+            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Is Related To</td></tr>"); //$NON-NLS-1$
 
             // ELEMENTS OF ORDERED SET
             if(isOrderedSet) {
@@ -1328,7 +1329,7 @@ public class GraphDebugger extends Composite {
                 try {
                     updateOrderedSet(content, graph, r);
                 } catch (ValidationException e) {
-                    content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>");
+                    content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>"); //$NON-NLS-1$ //$NON-NLS-2$
                 }
             }
 
@@ -1338,7 +1339,7 @@ public class GraphDebugger extends Composite {
                 try {
                     updateLinkedList(content, graph, r);
                 } catch (ValidationException e) {
-                    content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN LINKED LIST:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>");
+                    content.append("<td colspan=\"3\"><span style=\"color:red;font-weight:bold\">BROKEN LINKED LIST:<br/></span><span style=\"color:red\">").append(e.getMessage()).append("</span></td>"); //$NON-NLS-1$ //$NON-NLS-2$
                 }
             }
 
@@ -1348,7 +1349,7 @@ public class GraphDebugger extends Composite {
             for(Resource pred : preds) {
                 String str = htmlEscape( getResourceName(graph, pred) );
                 if(str == null)
-                    str = "<null>";
+                    str = "<null>"; //$NON-NLS-1$
                 strmap.put(pred, str);
             }
             Arrays.sort(preds, new Comparator<Resource>() {
@@ -1362,17 +1363,17 @@ public class GraphDebugger extends Composite {
                     updatePred(content, graph, r, pred, map.get(pred));
 
             // OTHER STATEMENTS
-            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Other statements</td></tr>");
+            content.append("<tr><td class=\"subtitle\" colspan=\"3\">Other statements</td></tr>"); //$NON-NLS-1$
             for(Resource pred : preds)
                 if(!graph.isSubrelationOf(pred, L0.IsRelatedTo))
                     updatePred(content, graph, r, pred, map.get(pred));
-            content.append("</table>\n");
+            content.append("</table>\n"); //$NON-NLS-1$
         }
         // Close #data
-        content.append("</div>\n\n");
+        content.append("</div>\n\n"); //$NON-NLS-1$
         // Close #mainContent
-        content.append("</div>\n");
-        content.append("</body>\n</html>\n");
+        content.append("</div>\n"); //$NON-NLS-1$
+        content.append("</body>\n</html>\n"); //$NON-NLS-1$
 
         // Update content
         final String finalContent = content.toString();
@@ -1409,7 +1410,7 @@ public class GraphDebugger extends Composite {
                         Serializer s = Bindings.getSerializerUnchecked(b);
                         int size = s.getSize(v);
                         if (size > RESOURCE_VALUE_MAX_SIZE) {
-                            return "Approx. " + size + " byte literal of type " + type.toSingleLineString();
+                            return "Approx. " + size + " byte literal of type " + type.toSingleLineString(); //$NON-NLS-1$ //$NON-NLS-2$
                         } else {
                             return b.toString(v, false);
                         }
@@ -1434,7 +1435,7 @@ public class GraphDebugger extends Composite {
             return NameUtils.getSafeName(g, r);
         } catch(Throwable throwable) {
             ErrorLogger.defaultLogError(throwable);
-            return "<font color=\"red\"><i>"+throwable.getClass().getName()+"</i> "+throwable.getMessage()+"</font>";
+            return "<font color=\"red\"><i>"+throwable.getClass().getName()+"</i> "+throwable.getMessage()+"</font>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         }
     }
 
@@ -1531,9 +1532,9 @@ public class GraphDebugger extends Composite {
 //    }
 
     private String getHead() {
-        String result = "";
+        String result = ""; //$NON-NLS-1$
         if (cssPath != null) {
-            result = "<link href=\"" + cssPath + "\" rel=\"stylesheet\" type=\"text/css\">";
+            result = "<link href=\"" + cssPath + "\" rel=\"stylesheet\" type=\"text/css\">"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         return result;
     }
index 8cabe294812cbc30bb2b51237516cac3e68dab96..890036afcb623fbeeba3dc03367a06ed7eb5b45c 100644 (file)
@@ -38,7 +38,7 @@ import org.simantics.utils.ui.LayoutUtils;
 
 public class GraphDebuggerEditor extends ResourceEditorPart {
 
-    public static final String EDITOR_ID = "org.simantics.debug.graphDebuggerEditor";
+    public static final String EDITOR_ID = "org.simantics.debug.graphDebuggerEditor"; //$NON-NLS-1$
 
     private GraphDebugger      debugger;
     private IAction            backAction;
@@ -120,8 +120,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart {
 
     class RefreshAction extends Action {
         public RefreshAction() {
-            super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif"));
-            setToolTipText("Refresh");
+            super(Messages.GraphDebuggerEditor_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerEditor_RefreshTT);
         }
         @Override
         public void run() {
@@ -131,8 +131,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart {
 
     class FindAction extends Action {
         public FindAction() {
-            super("Find", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png"));
-            setToolTipText("Find Resource");
+            super(Messages.GraphDebuggerEditor_Find, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerEditor_FindTT);
         }
         @Override
         public void run() {
@@ -142,8 +142,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart {
 
     class AddStatementAction extends Action {
         public AddStatementAction() {
-            super("AddStatement", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png"));
-            setToolTipText("Add Statement Between Existing Resources");
+            super(Messages.GraphDebuggerEditor_AddStatement, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerEditor_AddStatementTT);
         }
         @Override
         public void run() {
@@ -157,8 +157,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart {
 
     class AddResourceAction extends Action {
         public AddResourceAction() {
-            super("AddResource", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png"));
-            setToolTipText("Add New Related Resource");
+            super(Messages.GraphDebuggerEditor_AddResource, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerEditor_AddResourceTT);
         }
         @Override
         public void run() {
@@ -172,8 +172,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart {
 
     class BackAction extends Action {
         public BackAction() {
-            super("Back", Action.AS_PUSH_BUTTON);
-            setToolTipText("Back");
+            super(Messages.GraphDebuggerEditor_Back, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphDebuggerEditor_BackTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -186,8 +186,8 @@ public class GraphDebuggerEditor extends ResourceEditorPart {
 
     class ForwardAction extends Action {
         public ForwardAction() {
-            super("Forward", Action.AS_PUSH_BUTTON);
-            setToolTipText("Forward");
+            super(Messages.GraphDebuggerEditor_Forward, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphDebuggerEditor_ForwardTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
index 7d9d67b2ad3161506e584e139d6cf75afe79e266..b7b71da99c76640856575938384851e1de50b763 100644 (file)
@@ -38,7 +38,7 @@ import org.simantics.utils.ui.LayoutUtils;
 
 public class GraphDebuggerView extends ViewPart {
 
-    public static final String VIEW_ID              = "org.simantics.debug.graphDebugger";
+    public static final String VIEW_ID              = "org.simantics.debug.graphDebugger"; //$NON-NLS-1$
 
 //    private final boolean      DEFAULT_RECYCLE_VIEW = true;
 
@@ -139,8 +139,8 @@ public class GraphDebuggerView extends ViewPart {
 //
     class RefreshAction extends Action {
         public RefreshAction() {
-            super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif"));
-            setToolTipText("Refresh");
+            super(Messages.GraphDebuggerView_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerView_Refresh);
         }
         @Override
         public void run() {
@@ -150,8 +150,8 @@ public class GraphDebuggerView extends ViewPart {
 
     class BackAction extends Action {
         public BackAction() {
-            super("Back", Action.AS_PUSH_BUTTON);
-            setToolTipText("Back");
+            super(Messages.GraphDebuggerView_Back, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphDebuggerView_BackTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -163,8 +163,8 @@ public class GraphDebuggerView extends ViewPart {
 
     class ForwardAction extends Action {
         public ForwardAction() {
-            super("Forward", Action.AS_PUSH_BUTTON);
-            setToolTipText("Forward");
+            super(Messages.GraphDebuggerView_Forward, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphDebuggerView_ForwardTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
@@ -176,8 +176,8 @@ public class GraphDebuggerView extends ViewPart {
 
     class HomeAction extends Action {
         public HomeAction() {
-            super("Home", Action.AS_PUSH_BUTTON);
-            setToolTipText("Navigate to root library");
+            super(Messages.GraphDebuggerView_Home, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphDebuggerView_HomeTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV_DISABLED));
         }
@@ -189,8 +189,8 @@ public class GraphDebuggerView extends ViewPart {
 
     class FindAction extends Action {
         public FindAction() {
-            super("Find", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png"));
-            setToolTipText("Find Resource");
+            super(Messages.GraphDebuggerView_Find, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerView_FindTT);
         }
         @Override
         public void run() {
@@ -200,8 +200,8 @@ public class GraphDebuggerView extends ViewPart {
 
     class AddStatementAction extends Action {
         public AddStatementAction() {
-            super("AddStatement", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png"));
-            setToolTipText("Add Statement Between Existing Resources");
+            super(Messages.GraphDebuggerView_AddStatement, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerView_AddStatementTT);
         }
         @Override
         public void run() {
@@ -215,8 +215,8 @@ public class GraphDebuggerView extends ViewPart {
 
     class AddResourceAction extends Action {
         public AddResourceAction() {
-            super("AddResource", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png"));
-            setToolTipText("Add New Related Resource");
+            super(Messages.GraphDebuggerView_AddResource, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphDebuggerView_AddResourceTT);
         }
         @Override
         public void run() {
index dbf553d6701e158681ce69141d6e995b30073d41..a3e100b01e19195e738244eb99cbdc0097078070 100644 (file)
@@ -24,9 +24,66 @@ import org.eclipse.osgi.util.NLS;
 
 public class Messages extends NLS {
 
-       public static String Name_adaption_problem;
-       public static String Name_formulation_problem;
+       public static String GraphDebugger_Cancel;
+       public static String GraphDebugger_ConfirmActionsDots;
+       public static String GraphDebugger_ConfirmActionsDotsMsg;
+       public static String GraphDebugger_Continue;
+       public static String GraphDebugger_EditValue;
+       public static String GraphDebugger_EnterResourceIDorURI;
+       public static String GraphDebugger_InputNewPropertyValue;
+       public static String GraphDebugger_LabelDragResource;
+       public static String GraphDebugger_Lookup;
+       public static String GraphDebugger_StatusIndexLookpuFailed;
+       public static String GraphDebugger_StatusInvalidInput;
+       public static String GraphDebugger_StatusInvalidInputExpectIdxClusterIds;
+       public static String GraphDebugger_StatusInvalidInputResIdORURIExpected;
+       public static String GraphDebugger_StatusInvalidPrefixedInput;
+       public static String GraphDebugger_StatusResourceforURI;
+       public static String GraphDebugger_StatusResourceIDFailed;
+       public static String GraphDebugger_StatusTransientResourceID;
+       public static String GraphDebugger_StatusURIlookupFailed;
+       public static String GraphDebuggerEditor_AddResource;
+       public static String GraphDebuggerEditor_AddResourceTT;
+       public static String GraphDebuggerEditor_AddStatement;
+       public static String GraphDebuggerEditor_AddStatementTT;
+       public static String GraphDebuggerEditor_Back;
+       public static String GraphDebuggerEditor_BackTT;
+       public static String GraphDebuggerEditor_Find;
+       public static String GraphDebuggerEditor_FindTT;
+       public static String GraphDebuggerEditor_Forward;
+       public static String GraphDebuggerEditor_ForwardTT;
+       public static String GraphDebuggerEditor_Refresh;
+       public static String GraphDebuggerEditor_RefreshTT;
+       public static String GraphDebuggerView_AddResource;
+       public static String GraphDebuggerView_AddResourceTT;
+       public static String GraphDebuggerView_AddStatement;
+       public static String GraphDebuggerView_AddStatementTT;
+       public static String GraphDebuggerView_Back;
+       public static String GraphDebuggerView_BackTT;
+       public static String GraphDebuggerView_Find;
+       public static String GraphDebuggerView_FindTT;
+       public static String GraphDebuggerView_Forward;
+       public static String GraphDebuggerView_ForwardTT;
+       public static String GraphDebuggerView_Home;
+       public static String GraphDebuggerView_HomeTT;
+       public static String GraphDebuggerView_Refresh;
 
+       public static String SearchResourceDialog_ActivatorResourceLabelProviderFailed;
+       public static String SearchResourceDialog_EnterNameResURIOrId;
+       public static String SearchResourceDialog_SeperatorLblPreviouslySelected;
+       public static String SearchResourceDialog_ShowInBrowser;
+       public static String SessionDebuggerView_ActivatorUnexpectedException;
+       public static String SessionDebuggerView_ActivatorUnexpectedIOException;
+       public static String SessionDebuggerView_Shell;
+       public static String SessionDebuggerView_WroteCommand;
+       public static String VariableDebugger_DragResourceToDebugger;
+       public static String VariableDebugger_Lookup;
+       public static String VariableDebugger_TextToolTip;
+       public static String VariableDebuggerView_Back;
+       public static String VariableDebuggerView_Forward;
+       public static String VariableDebuggerView_Home;
+       public static String VariableDebuggerView_HomeTT;
+       public static String VariableDebuggerView_Refresh;
        private static final String BUNDLE_NAME = "org.simantics.debug.ui.messages"; //$NON-NLS-1$
 
        static {
index 743cf4b6a26cce05c664897da974d8e5c2c71acd..0032a98fbf4290004d87d9fca91fc007dbe73515 100644 (file)
@@ -167,7 +167,7 @@ public class ResourceSearch extends ReadRequest {
     public void run(ReadGraph g) {
         try {
             if (!asyncListening && resFoundQueue!=null) resFoundQueue.g = g;
-            Resource root = g.getResource("http:/");
+            Resource root = g.getResource("http:/"); //$NON-NLS-1$
             Layer0 L0 = Layer0.getInstance(g);
             LinkedList<Resource> queue = new LinkedList<Resource>();
             queue.add(root);
index 4eca4e550638513f0d65d00ecf45ab57540a32a4..8532be1ae28a6cce6b97a280d399d399a2040897 100644 (file)
@@ -85,13 +85,13 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
      */
     private static final int DEFAULT_MAX_INDEX_HITS = 1000;
 
-    private static final Pattern ID_PATTERN = Pattern.compile("\\$([0-9]+)");
+    private static final Pattern ID_PATTERN = Pattern.compile("\\$([0-9]+)"); //$NON-NLS-1$
 
     private static final String SEARCH_RESOURCE_DIALOG = "SearchResourceDialog"; //$NON-NLS-1$
 
     private static final int SHOW_IN_BROWSER_ID = IDialogConstants.CLIENT_ID + 1;
 
-    private static final String SHOW_IN_BROWSER_LABEL = "Show In Browser";
+    private static final String SHOW_IN_BROWSER_LABEL = Messages.SearchResourceDialog_ShowInBrowser;
 
     private Session session;
     @SuppressWarnings("unused")
@@ -103,7 +103,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
         @Override
         public String getText(Object element) {
             if (element == null)
-                return "null";
+                return "null"; //$NON-NLS-1$
             // This may happen if multiple choice is enabled
             if (element instanceof String)
                 return (String) element;
@@ -117,15 +117,15 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
                         String name = NameUtils.getSafeName(g, r);
                         String uri = DebugUtils.getPossibleRootRelativePath(g, r);
                         return
-                                "[" + r.getResourceId() + "] - "
+                                "[" + r.getResourceId() + "] - " //$NON-NLS-1$ //$NON-NLS-2$
                                 + name
-                                + (uri != null ? " - " : "")
-                                + (uri != null ? uri : "");
+                                + (uri != null ? " - " : "") //$NON-NLS-1$ //$NON-NLS-2$
+                                + (uri != null ? uri : ""); //$NON-NLS-1$
                     }
                 });
             } catch (DatabaseException e) {
-                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Resource label provider failed unexpectedly.", e));
-                return "";
+                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SearchResourceDialog_ActivatorResourceLabelProviderFailed, e));
+                return ""; //$NON-NLS-1$
             }
         }
     };
@@ -137,7 +137,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
         @Override
         public String getText(Object element) {
             if (element==null)
-                return "null";
+                return "null"; //$NON-NLS-1$
             return element.toString();
         }
         @Override
@@ -162,19 +162,19 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
         this.session = s;
         this.selection = selection;
         this.labelProvider = new ElementLabelProvider(shell.getDisplay());
-        setMessage("Enter name, resource URI or ID");
+        setMessage(Messages.SearchResourceDialog_EnterNameResURIOrId);
         setListLabelProvider(labelProvider);
         setDetailsLabelProvider(detailsLabelProvider);
         setTitle(title);
         //setInitialPattern("*", FilteredItemsSelectionDialog.FULL_SELECTION);
         setSelectionHistory(new ResourceSelectionHistory());
-        setSeparatorLabel("Previously selected above, others below");
+        setSeparatorLabel(Messages.SearchResourceDialog_SeperatorLblPreviouslySelected);
     }
 
     @Override
     protected void configureShell(Shell shell) {
         this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), shell);
-        setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")));
+        setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png"))); //$NON-NLS-1$
         super.configureShell(shell);
     }
 
@@ -221,16 +221,16 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
                             try {
                                 return DebugUtils.getSafeLabel(g, r);
                             } catch (Exception ex) {
-                                System.out.println("Exception thrown from restoreItemFromMemento");
+                                System.out.println("Exception thrown from restoreItemFromMemento"); //$NON-NLS-1$
                             }
                         } catch (Throwable t) {}
-                        return "" + r.getResourceId();
+                        return "" + r.getResourceId(); //$NON-NLS-1$
                     }
                 });
                 if (name==null) return null;
                 return new LabeledResource(name, r);
             } catch (NumberFormatException | DatabaseException e) {
-                LOGGER.info("Search memento restoration failed.", e);
+                LOGGER.info("Search memento restoration failed.", e); //$NON-NLS-1$
                 return null;
             }
         }
@@ -266,7 +266,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
         public ItemsFilterWithSearchResults() {
             
             final String pattern = getPattern();
-            final boolean findUris = pattern.trim().startsWith("http:/");
+            final boolean findUris = pattern.trim().startsWith("http:/"); //$NON-NLS-1$
             final long referencedResourceId = referencedResourceId(pattern);
             final boolean findIds = referencedResourceId != 0;
 
@@ -307,8 +307,8 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
                                 IResourceFilter rf = resourceFilter;
                                 String filter = getFilterForResourceFilter(rf);
                                 if (!filter.isEmpty())
-                                    filter += " AND ";
-                                filter += "Name:" + pattern + "*";
+                                    filter += " AND "; //$NON-NLS-1$
+                                filter += "Name:" + pattern + "*"; //$NON-NLS-1$ //$NON-NLS-2$
 
                                 Layer0 L0 = Layer0.getInstance(graph);
 
@@ -438,7 +438,7 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
     @SuppressWarnings("unchecked")
     @Override
     public String getElementName(Object item) {
-        return ((Container<Resource>)item).get().getResourceId()+"";
+        return ((Container<Resource>)item).get().getResourceId()+""; //$NON-NLS-1$
         //return item.toString();
     }
 
@@ -464,12 +464,12 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog {
 
     private String getFilterForResourceFilter(IResourceFilter filter) {
         if (filter == null || filter == ResourceSearch.FILTER_ALL)
-            return "";
+            return ""; //$NON-NLS-1$
         if (filter == ResourceSearch.FILTER_RELATIONS)
-            return "Types:Relation"; 
+            return "Types:Relation";  //$NON-NLS-1$
         if (filter == ResourceSearch.FILTER_TYPES)
-            return "Types:Type"; 
-        return "";
+            return "Types:Type";  //$NON-NLS-1$
+        return ""; //$NON-NLS-1$
     }
 
 }
index 820f5d6029937f530e4af2a5cb0ea9fb193d3dd7..fcbc93234ab1fd5a917699c13220faa308d3245a 100644 (file)
@@ -65,7 +65,7 @@ public class SessionDebugger extends Composite {
      */
     public SessionDebugger(Composite parent, int style, final Session session) {
         super(parent, style);
-        Assert.isNotNull(session, "session is null");
+        Assert.isNotNull(session, "session is null"); //$NON-NLS-1$
         this.session = session;
         updater = new MergingGraphRequestProcessor(session, 100);
         
index 0e0363fa87ec842b59a65d9119db15cc2a4a4135..1426afa6dc08af020fbabbf9cf619c4987265b7c 100644 (file)
@@ -22,6 +22,7 @@ import java.util.Set;
 
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.browser.Browser;
 import org.eclipse.swt.custom.CTabFolder;
@@ -51,7 +52,7 @@ import org.simantics.views.swt.SimanticsView;
 @SuppressWarnings("deprecation")
 public class SessionDebuggerView extends SimanticsView {
 
-    public static final String VIEW_ID = "org.simantics.debug.sessionDebugger";
+    public static final String VIEW_ID = "org.simantics.debug.sessionDebugger"; //$NON-NLS-1$
 
     private CTabFolder folder;
     private Text commandLine;
@@ -63,7 +64,7 @@ public class SessionDebuggerView extends SimanticsView {
 
     @Override
     protected Set<String> getBrowseContexts() {
-        return Collections.singleton("");
+        return Collections.singleton(""); //$NON-NLS-1$
     }
 
     private CTabItem createItem(int index, CTabFolder folder, Control control) {
@@ -101,14 +102,14 @@ public class SessionDebuggerView extends SimanticsView {
                     if (historyPosition < 0) {
                         return;
                     } else if (historyPosition == 0) {
-                        commandLine.setText("");
+                        commandLine.setText(""); //$NON-NLS-1$
                         historyPosition = -1;
                     } else {
                         commandLine.setText(history.get(--historyPosition));
                     }
                 } else if (e.keyCode == SWT.ESC) {
                     historyPosition = -1;
-                    commandLine.setText("");
+                    commandLine.setText(""); //$NON-NLS-1$
                 } else if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
                     applyCommand(commandLine.getText());
                 }
@@ -116,7 +117,7 @@ public class SessionDebuggerView extends SimanticsView {
         });
 
         CTabItem shellItem = createItem(0, folder, shell);
-        shellItem.setText("Shell");
+        shellItem.setText(Messages.SessionDebuggerView_Shell);
 
 //        SessionDebugger deprecated = new SessionDebugger(folder, SWT.NONE, Simantics.getSession());
 //        deprecated.initializeUI();
@@ -140,7 +141,7 @@ public class SessionDebuggerView extends SimanticsView {
         } catch (DatabaseException e) {
             Activator.getDefault().getLog().log(
                     new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                            "Unexpected exception while applying command " + command, e));
+                            Messages.SessionDebuggerView_ActivatorUnexpectedException + command, e));
         }
     }
 
@@ -152,16 +153,16 @@ public class SessionDebuggerView extends SimanticsView {
                 Path p = (Path) output;
                 long size = Files.size(p);
                 if (size < (1L << 16)) {
-                    terminal.addFirst(new String(Files.readAllBytes(p), "UTF-8"));
+                    terminal.addFirst(new String(Files.readAllBytes(p), "UTF-8")); //$NON-NLS-1$
                 }
-                terminal.addFirst("Wrote command '" + command + "' output to file " + p);
+                terminal.addFirst(NLS.bind(Messages.SessionDebuggerView_WroteCommand ,new Object[] { command  , p})); 
             } catch (IOException e) {
                 Activator.getDefault().getLog().log(
                         new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                                "Unexpected I/O exception while applying command " + command, e));
+                                NLS.bind(Messages.SessionDebuggerView_ActivatorUnexpectedIOException , new Object[]{ command, e})));
             }
         } else {
-            throw new IllegalArgumentException("Unsupported output argument type " + output);
+            throw new IllegalArgumentException("Unsupported output argument type " + output); //$NON-NLS-1$
         }
         if (terminal.size() > 10)
             terminal.removeLast();
@@ -176,7 +177,7 @@ public class SessionDebuggerView extends SimanticsView {
     private void apply(String command, Object data) {
         if (data instanceof String) {
             SWTUtils.asyncExec(commandLine, () -> {
-                commandLine.setText("");
+                commandLine.setText(""); //$NON-NLS-1$
                 addHistory(command, data);
                 console.setText(formatTerminal());
             });
@@ -184,33 +185,33 @@ public class SessionDebuggerView extends SimanticsView {
             SWTUtils.asyncExec(commandLine, () -> {
                 try {
                     addHistory(command, dumpListenerReport((ListenerReport) data));
-                    commandLine.setText("");
+                    commandLine.setText(""); //$NON-NLS-1$
                     console.setText(formatTerminal());
                 } catch (IOException e) {
                     Activator.getDefault().getLog().log(
                             new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                                    "Unexpected I/O exception while applying command " + command, e));
+                                    Messages.SessionDebuggerView_ActivatorUnexpectedIOException + command, e));
                 }
             });
         }
     }
 
     private Path dumpListenerReport(ListenerReport data) throws IOException {
-        File f = Simantics.getTempfile("debug", "listenerReport");
-        try (PrintStream out = new PrintStream(f, "UTF-8")) {
-            out.print("<pre>");
+        File f = Simantics.getTempfile("debug", "listenerReport"); //$NON-NLS-1$ //$NON-NLS-2$
+        try (PrintStream out = new PrintStream(f, "UTF-8")) { //$NON-NLS-1$
+            out.print("<pre>"); //$NON-NLS-1$
             data.print(out);
-            out.print("</pre>");
+            out.print("</pre>"); //$NON-NLS-1$
         }
         return f.toPath();
     }
 
     private String formatTerminal() {
         StringBuilder b = new StringBuilder();
-        b.append("<html><head/><body>\n");
+        b.append("<html><head/><body>\n"); //$NON-NLS-1$
         for (String s : terminal)
-            b.append(s).append("<br/>\n");
-        b.append("</body></html>");
+            b.append(s).append("<br/>\n"); //$NON-NLS-1$
+        b.append("</body></html>"); //$NON-NLS-1$
         return b.toString();
     }
 
index 9c02bbe2a70806dfb8833e9b7a23a12310e7a015..697a589395dae9eab29af679020ee53780d6b444 100644 (file)
@@ -102,12 +102,12 @@ public class VariableDebugger extends Composite {
         void historyChanged();
     }
 
-    private final static String                         DEFAULT_DEBUGGER_CSS_FILE = "debugger.css";
-    private final static String                         DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE;
+    private final static String                         DEFAULT_DEBUGGER_CSS_FILE = "debugger.css"; //$NON-NLS-1$
+    private final static String                         DEFAULT_DEBUGGER_CSS_PATH = "css/" + DEFAULT_DEBUGGER_CSS_FILE; //$NON-NLS-1$
 
     private static int                                  RESOURCE_NAME_MAX_LENGTH  = 1000;
 
-       private final Charset                               utf8 = Charset.forName("UTF-8");
+       private final Charset                               utf8 = Charset.forName("UTF-8"); //$NON-NLS-1$
 
     private final LocalResourceManager                  resourceManager;
 
@@ -157,7 +157,7 @@ public class VariableDebugger extends Composite {
                             if (!browser.isDisposed())
                                 browser.setText(content);
                             if (!updateTriggerCounter.isDisposed())
-                                updateTriggerCounter.setText(updateCount + "/" + triggerCounter);
+                                updateTriggerCounter.setText(updateCount + "/" + triggerCounter); //$NON-NLS-1$
                         }
                     });
                 }
@@ -181,7 +181,7 @@ public class VariableDebugger extends Composite {
      */
     public VariableDebugger(Composite parent, int style, final Session session, String initialURI) {
         super(parent, style);
-        Assert.isNotNull(session, "session is null");
+        Assert.isNotNull(session, "session is null"); //$NON-NLS-1$
         this.session = session;
         this.currentElement = initialURI;
         this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
@@ -222,7 +222,7 @@ public class VariableDebugger extends Composite {
                 if (!css.exists()) {
                     URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path(DEFAULT_DEBUGGER_CSS_PATH), null);
                     if (url == null)
-                        throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'");
+                        throw new FileNotFoundException("Could not find '" + DEFAULT_DEBUGGER_CSS_PATH + "' in bundle '" + Activator.PLUGIN_ID + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                     cssPath = FileUtils.copyResource(url, css, true).toURI().toString();
                 } else {
                     cssPath = css.toURI().toString();
@@ -238,7 +238,7 @@ public class VariableDebugger extends Composite {
     public Label createDropLabel(Composite parent) {
         final Label label = new Label(parent, SWT.BORDER | SWT.FLAT);
         label.setAlignment(SWT.CENTER);
-        label.setText("  Drag a resource or a variable here to examine it in this debugger!  ");
+        label.setText(Messages.VariableDebugger_DragResourceToDebugger);
         label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
         GridData data = new GridData(SWT.LEFT, SWT.FILL, false, false);
         label.setLayoutData(data);
@@ -316,7 +316,7 @@ public class VariableDebugger extends Composite {
         text.setLayoutData(data);
 
         Button button = new Button(parent, SWT.NONE);
-        button.setText("Lookup");
+        button.setText(Messages.VariableDebugger_Lookup);
         GridData data2 = new GridData(SWT.FILL, SWT.FILL, false, false);
         button.setLayoutData(data2);
 
@@ -347,7 +347,7 @@ public class VariableDebugger extends Composite {
     protected Text createUpdateTriggerCounter(Composite parent) {
         Text label = new Text(parent, SWT.BORDER | SWT.FLAT);
         label.setEditable(false);
-        label.setToolTipText("Amount of Screen/Listener Updates Received for Shown Variable");
+        label.setToolTipText(Messages.VariableDebugger_TextToolTip);
         GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
         .grab(false, false).hint(32, SWT.DEFAULT).applyTo(label);
         updateTriggerCounter = label;
@@ -385,21 +385,21 @@ public class VariableDebugger extends Composite {
             @Override
             public void changing(LocationEvent event) {
                 String location = event.location;
-                if (location.startsWith("simantics:browser"))
-                    location = "about:" + location.substring(17);
+                if (location.startsWith("simantics:browser")) //$NON-NLS-1$
+                    location = "about:" + location.substring(17); //$NON-NLS-1$
                 //System.out.println("changing: location=" + location);
 
                 // Do not follow links that are meant as actions that are
                 // handled below.
                 event.doit = false;
-                if ("about:blank".equals(location)) {
+                if ("about:blank".equals(location)) { //$NON-NLS-1$
                     // Just changing to the same old blank url is ok since it
                     // allows the browser to refresh itself.
                     event.doit = true;
                 }
 
-                if (location.startsWith("about:-link")) {
-                    String target = location.replace("about:-link", "");
+                if (location.startsWith("about:-link")) { //$NON-NLS-1$
+                    String target = location.replace("about:-link", ""); //$NON-NLS-1$ //$NON-NLS-2$
                     try {
                         byte[] bytes = Base64.decode(target);
                         String url = new String(bytes, utf8);
@@ -411,8 +411,8 @@ public class VariableDebugger extends Composite {
                     } catch (IOException e) {
                         ErrorLogger.defaultLogError(e);
                     }
-                } else if (location.startsWith("about:-remove")) {
-                } else if (location.startsWith("about:-edit-value")) {
+                } else if (location.startsWith("about:-remove")) { //$NON-NLS-1$
+                } else if (location.startsWith("about:-edit-value")) { //$NON-NLS-1$
                 }
             }
         });
@@ -508,43 +508,43 @@ public class VariableDebugger extends Composite {
                 if (o instanceof byte[]) {
                     byte[] arr = (byte[]) o;
                     byte[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("byte", Arrays.toString(arr2), arr.length);
+                    return truncated("byte", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof int[]) {
                     int[] arr = (int[]) o;
                     int[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("int", Arrays.toString(arr2), arr.length);
+                    return truncated("int", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof long[]) {
                     long[] arr = (long[]) o;
                     long[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("long", Arrays.toString(arr2), arr.length);
+                    return truncated("long", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof float[]) {
                     float[] arr = (float[]) o;
                     float[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("float", Arrays.toString(arr2), arr.length);
+                    return truncated("float", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof double[]) {
                     double[] arr = (double[]) o;
                     double[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("double", Arrays.toString(arr2), arr.length);
+                    return truncated("double", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof boolean[]) {
                     boolean[] arr = (boolean[]) o;
                     boolean[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("boolean", Arrays.toString(arr2), arr.length);
+                    return truncated("boolean", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else if (o instanceof Object[]) {
                     Object[] arr = (Object[]) o;
                     Object[] arr2 = Arrays.copyOf(arr, RESOURCE_NAME_MAX_LENGTH);
-                    return truncated("Object", Arrays.toString(arr2), arr.length);
+                    return truncated("Object", Arrays.toString(arr2), arr.length); //$NON-NLS-1$
                 } else {
-                    return "Unknown big array " + o.getClass();
+                    return "Unknown big array " + o.getClass(); //$NON-NLS-1$
                 }
             } else {
-                return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o);
+                return o.getClass().getComponentType() + "[" + length + "] = " + ObjectUtils.toString(o); //$NON-NLS-1$ //$NON-NLS-2$
             }
         }
         return null;
     }
 
     protected String truncated(String type, String string, int originalLength) {
-        return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string;
+        return type + "[" + RESOURCE_NAME_MAX_LENGTH + "/" + originalLength + "] = " + string; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
     protected String getVariableName(ReadGraph graph, Variable r) {
@@ -563,7 +563,7 @@ public class VariableDebugger extends Composite {
             for(VariableConnectionPointDescriptor v : c.getConnectionPointDescriptors(graph, null)) {
                 result.add(v.getRelativeRVI(graph, base));
             }
-            return "c " + result.toString();
+            return "c " + result.toString(); //$NON-NLS-1$
         } else if (clazz.isArray()) {
             if(int[].class == clazz) {
                 return Arrays.toString((int[])o);
@@ -591,10 +591,10 @@ public class VariableDebugger extends Composite {
             Object value = r.getValue(graph);
             if(value instanceof Resource) return getResourceRef(graph, (Resource)value);
             else if (value instanceof Variable) return getVariableRef(graph, (Variable)value);
-            else return value != null ? getValue(graph, r, value) : "null";
+            else return value != null ? getValue(graph, r, value) : "null"; //$NON-NLS-1$
         } catch (Throwable e) {
             try {
-                Logger.defaultLogError("getValue " + r.getURI(graph), e);
+                Logger.defaultLogError("getValue " + r.getURI(graph), e); //$NON-NLS-1$
             } catch (DatabaseException e1) {
                 Logger.defaultLogError(e1);
             }
@@ -605,7 +605,7 @@ public class VariableDebugger extends Composite {
     protected String getDatatype(ReadGraph graph, Variable r) {
         try {
             Datatype dt = r.getPossibleDatatype(graph);
-            return dt != null ? dt.toSingleLineString() : "undefined";
+            return dt != null ? dt.toSingleLineString() : "undefined"; //$NON-NLS-1$
         } catch (Exception e) {
             return e.getMessage();
         }
@@ -616,9 +616,9 @@ public class VariableDebugger extends Composite {
     }
 
     private String getVariableRef(ReadGraph graph, Variable r) throws DatabaseException {
-        String ret = "<a href=\"simantics:browser-link" + getLinkString(graph, r) + "\">"
+        String ret = "<a href=\"simantics:browser-link" + getLinkString(graph, r) + "\">" //$NON-NLS-1$ //$NON-NLS-2$
         + getVariableName(graph, r)
-        + "</a>";
+        + "</a>"; //$NON-NLS-1$
 //        if (graph.isInstanceOf(r, L0.Literal)) {
 //            ret += "&nbsp;<a class=\"edit-link\" href=\"simantics:browser-edit-value" + getLinkString(r) + "\">"
 //            + "(edit value)"
@@ -645,11 +645,11 @@ public class VariableDebugger extends Composite {
 //        } catch (Exception e) {
 //            e.printStackTrace();
 //        }
-        content.append("<tr>");
-        content.append("<td>").append(getVariableRef(graph, property)).append("</td>");
-        content.append("<td>").append(getValue(graph, property)).append("</td>");
-        content.append("<td>").append(getDatatype(graph, property)).append("</td>");
-        content.append("</tr>");
+        content.append("<tr>"); //$NON-NLS-1$
+        content.append("<td>").append(getVariableRef(graph, property)).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
+        content.append("<td>").append(getValue(graph, property)).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
+        content.append("<td>").append(getDatatype(graph, property)).append("</td>"); //$NON-NLS-1$ //$NON-NLS-2$
+        content.append("</tr>"); //$NON-NLS-1$
     }
 
     protected String getRVIString(ReadGraph graph, Variable var) throws DatabaseException {
@@ -657,7 +657,7 @@ public class VariableDebugger extends Composite {
         try {
             return var.getRVI(graph).toString(graph);
         } catch (Throwable e) {
-            return "No RVI";
+            return "No RVI"; //$NON-NLS-1$
         }
         
     }
@@ -669,9 +669,9 @@ public class VariableDebugger extends Composite {
         StringBuilder content = new StringBuilder();
 
         // Generate HTML -page
-        content.append("<html><head>").append(getHead()).append("</head>\n");
-        content.append("<body>\n");
-        content.append("<div id=\"mainContent\">\n");
+        content.append("<html><head>").append(getHead()).append("</head>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+        content.append("<body>\n"); //$NON-NLS-1$
+        content.append("<div id=\"mainContent\">\n"); //$NON-NLS-1$
         for (String uri : uris) {
             //System.out.println("URI: " + uri);
             Variable var = Variables.getPossibleVariable(graph, uri);
@@ -690,14 +690,14 @@ public class VariableDebugger extends Composite {
             }
             
             // Begin #top DIV
-            content.append("<div id=\"top\">\n");
-            content.append("<table class=\"top\">\n");
-            content.append("<tr><td class=\"top_key\">URI</td><td class=\"top_value\"><span id=\"uri\">").append(uri).append("</span></td></tr>\n");
-            content.append("<tr><td class=\"top_key\">RVI</td><td class=\"top_value\"><span id=\"uri\">").append(rviString).append("</span></td></tr>\n");
-            content.append("<tr><td class=\"top_key\">Class</td><td class=\"top_value\"><span id=\"class\">").append(var.getClass().getCanonicalName()).append("</span></td></tr>\n");
-            content.append("<tr><td class=\"top_key\">Solver node</td><td class=\"top_value\"><span id=\"class\">").append(node).append("</span></td></tr>\n");
-            content.append("</table>\n");
-            content.append("</div>\n");
+            content.append("<div id=\"top\">\n"); //$NON-NLS-1$
+            content.append("<table class=\"top\">\n"); //$NON-NLS-1$
+            content.append("<tr><td class=\"top_key\">URI</td><td class=\"top_value\"><span id=\"uri\">").append(uri).append("</span></td></tr>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+            content.append("<tr><td class=\"top_key\">RVI</td><td class=\"top_value\"><span id=\"uri\">").append(rviString).append("</span></td></tr>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+            content.append("<tr><td class=\"top_key\">Class</td><td class=\"top_value\"><span id=\"class\">").append(var.getClass().getCanonicalName()).append("</span></td></tr>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+            content.append("<tr><td class=\"top_key\">Solver node</td><td class=\"top_value\"><span id=\"class\">").append(node).append("</span></td></tr>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+            content.append("</table>\n"); //$NON-NLS-1$
+            content.append("</div>\n"); //$NON-NLS-1$
             // Close #top DIV
 
             // Content
@@ -709,7 +709,7 @@ public class VariableDebugger extends Composite {
                 }
             } catch (DatabaseException e) {
                 // This may happen if the Variable implementation is broken
-                ErrorLogger.defaultLogError("Broken variable child retrieval implementation or serious modelling error encountered. See exception for details.", e);
+                ErrorLogger.defaultLogError("Broken variable child retrieval implementation or serious modelling error encountered. See exception for details.", e); //$NON-NLS-1$
             }
 
             TreeMap<String, Variable> map2 = new TreeMap<String, Variable>();
@@ -720,37 +720,37 @@ public class VariableDebugger extends Composite {
                 }
             } catch (DatabaseException e) {
                 // This may happen if the Variable implementation is broken
-                ErrorLogger.defaultLogError("Broken variable property retrieval implementation or serious modelling error encountered. See exception for details.", e);
+                ErrorLogger.defaultLogError("Broken variable property retrieval implementation or serious modelling error encountered. See exception for details.", e); //$NON-NLS-1$
             }
 
-            content.append("\n<div id=\"data\">\n");
-            content.append("<table>\n");
+            content.append("\n<div id=\"data\">\n"); //$NON-NLS-1$
+            content.append("<table>\n"); //$NON-NLS-1$
 
-            content.append("<tr><th>Child</th></tr>");
+            content.append("<tr><th>Child</th></tr>"); //$NON-NLS-1$
             for (Variable child : map.values()) {
-                content.append("<tr><td>").append(getVariableRef(graph, child)).append("</td></tr>");
+                content.append("<tr><td>").append(getVariableRef(graph, child)).append("</td></tr>"); //$NON-NLS-1$ //$NON-NLS-2$
             }
 
-            content.append("<tr><th>Property</th><th>Value</th><th>Datatype</th></tr>");
+            content.append("<tr><th>Property</th><th>Value</th><th>Datatype</th></tr>"); //$NON-NLS-1$
             for (Variable property : map2.values()) {
                 updateProperty(content, graph, property);
             }
             // Close #data
-            content.append("</div>\n\n");
+            content.append("</div>\n\n"); //$NON-NLS-1$
         }
 
         // Close #mainContent
-        content.append("</div>\n");
-        content.append("</body></html>\n");
+        content.append("</div>\n"); //$NON-NLS-1$
+        content.append("</body></html>\n"); //$NON-NLS-1$
 
         // Update content
         return content.toString();
     }
 
     private String getHead() {
-        String result = "";
+        String result = ""; //$NON-NLS-1$
         if (cssPath != null) {
-            result = "<link href=\"" + cssPath + "\" rel=\"stylesheet\" type=\"text/css\">";
+            result = "<link href=\"" + cssPath + "\" rel=\"stylesheet\" type=\"text/css\">"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         return result;
     }
index 6edd79ad299d87a10bfaf9719f06f77ba87e72ee..48234434e213ae04b37e4754e71037bc7aa721f2 100644 (file)
@@ -35,7 +35,7 @@ import org.simantics.utils.ui.LayoutUtils;
 
 public class VariableDebuggerView extends ViewPart {
 
-    public static final String VIEW_ID              = "org.simantics.debug.variableDebugger";
+    public static final String VIEW_ID              = "org.simantics.debug.variableDebugger"; //$NON-NLS-1$
 
     private ResourceInput      input;
 
@@ -115,7 +115,7 @@ public class VariableDebuggerView extends ViewPart {
 //
     class RefreshAction extends Action {
         public RefreshAction() {
-            super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif"));
+            super(Messages.VariableDebuggerView_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$
         }
         @Override
         public void run() {
@@ -125,7 +125,7 @@ public class VariableDebuggerView extends ViewPart {
 
     class BackAction extends Action {
         public BackAction() {
-            super("Back", Action.AS_PUSH_BUTTON);
+            super(Messages.VariableDebuggerView_Back, Action.AS_PUSH_BUTTON);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -137,7 +137,7 @@ public class VariableDebuggerView extends ViewPart {
 
     class ForwardAction extends Action {
         public ForwardAction() {
-            super("Forward", Action.AS_PUSH_BUTTON);
+            super(Messages.VariableDebuggerView_Forward, Action.AS_PUSH_BUTTON);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
@@ -149,8 +149,8 @@ public class VariableDebuggerView extends ViewPart {
 
     class HomeAction extends Action {
         public HomeAction() {
-            super("Home", Action.AS_PUSH_BUTTON);
-            setToolTipText("Navigate to root library");
+            super(Messages.VariableDebuggerView_Home, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.VariableDebuggerView_HomeTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV_DISABLED));
         }
index fef011b8d4efdcc754d314d23f8df5003ce53b59..c8a89fa9e619327ce221c7465f8161e4b8675b96 100644 (file)
@@ -19,6 +19,7 @@ import java.util.Set;
 import javax.swing.SwingUtilities;
 
 import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.browser.Browser;
 import org.eclipse.swt.layout.GridData;
@@ -114,7 +115,7 @@ public class GraphicalDebugger extends GraphDebugger {
        
        public GraphvizComponent2 createGraph(Composite parent) {
                graph = new Graph();
-               graph.setRankdir("LR");
+               graph.setRankdir("LR"); //$NON-NLS-1$
                graphVizComponent = new GraphvizComponent2(parent, SWT.NONE);
                SwingUtilities.invokeLater(new Runnable() {
                        
@@ -195,8 +196,8 @@ public class GraphicalDebugger extends GraphDebugger {
                if (n == null) {
                        n = new Node(graph);
                        if (!r.isPersistent()) {
-                               n.setShape("box");
-                               n.setFontColor("blue");
+                               n.setShape("box"); //$NON-NLS-1$
+                               n.setFontColor("blue"); //$NON-NLS-1$
                        }
                        nodeMap.map(r, n);
                }
@@ -205,20 +206,20 @@ public class GraphicalDebugger extends GraphDebugger {
        
        @SuppressWarnings("unused")
        protected void appendLabel(Node node, String text) {
-               String label = node.get("label");
+               String label = node.get("label"); //$NON-NLS-1$
                if (true) {
                        if (label == null || label.length() == 0)
                                label = text;//escape(text);
                        else {
                                label = label.substring(1,label.length()-1);
-                               label += "<br/>"+text;
+                               label += "<br/>"+text; //$NON-NLS-1$
                        }
-                       label = "<" + label + ">";
+                       label = "<" + label + ">"; //$NON-NLS-1$ //$NON-NLS-2$
                } else {
                        if (label == null || label.length() == 0)
                                label = text;
                        else {
-                               label += " "+text;
+                               label += " "+text; //$NON-NLS-1$
                        }
                        
                }
@@ -232,7 +233,7 @@ public class GraphicalDebugger extends GraphDebugger {
                L0 = Layer0.getInstance(g);
                
                graph = new Graph();
-               graph.setRankdir("LR");
+               graph.setRankdir("LR"); //$NON-NLS-1$
                
                nodeMap.clear();
                edgeMap.clear();
@@ -266,8 +267,8 @@ public class GraphicalDebugger extends GraphDebugger {
                continue;
             Node node = getResourceRef(g, r);
             if (r.equals(getDebuggerLocation())) {
-               node.setFillColor("#aaffaa");
-                               node.setStyle("filled");
+               node.setFillColor("#aaffaa"); //$NON-NLS-1$
+                               node.setStyle("filled"); //$NON-NLS-1$
             }
           //Node node = getOrCreate(r);
             processed.add(r);
@@ -279,10 +280,10 @@ public class GraphicalDebugger extends GraphDebugger {
                 uri = g.syncRequest(new ResourceToPossibleURI(r));
             } catch (Exception e) {
                 e.printStackTrace();
-                uri = "Cannot get URI: " + e.getMessage();
+                uri = "Cannot get URI: " + e.getMessage(); //$NON-NLS-1$
             }
             if (uri != null)
-               appendLabel(node, "URI: " + uri);
+               appendLabel(node, "URI: " + uri); //$NON-NLS-1$
                 //content.append("\t\t<div class=\"monospaced\">" + uri + "</div><br/>");
 
             Collection<Statement> statements = g.getStatements(r, L0.IsWeaklyRelatedTo);
@@ -298,12 +299,12 @@ public class GraphicalDebugger extends GraphDebugger {
                     map.add(predicate, new Resource[] {subject, obj});
                 } catch (Throwable e) {
                     e.printStackTrace();
-                    ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e);
+                    ErrorLogger.defaultLogError("Cannot find statement " + subject + " " + predicate + " " + obj, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                 }
             }
             ClusteringSupport support = g.getSession().getService(ClusteringSupport.class);
             //content.append("<h3>" + " ["+ r.getResourceId() + "-" + support.getCluster(r) + "] " + "</h3>\n");
-            appendLabel(node,  " ["+ r.getResourceId() + "-" + support.getCluster(r) + "]");
+            appendLabel(node,  " ["+ r.getResourceId() + "-" + support.getCluster(r) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             
             //content.append("<table>\n");
             //content.append("<tr><th>Predicate</th><th>Object</th></tr>");
@@ -324,7 +325,7 @@ public class GraphicalDebugger extends GraphDebugger {
             //content.append("<tr><td class=\"subtitle\" colspan=\"2\">Tags</td></tr>");
             for(Statement stm : statements) {
                 if(stm.getSubject().equals(stm.getObject())) {
-                    updateTag(node, g, r, stm.getPredicate(), "Tag");
+                    updateTag(node, g, r, stm.getPredicate(), "Tag"); //$NON-NLS-1$
                     map.remove(stm.getPredicate());
                 }
             }
@@ -334,7 +335,7 @@ public class GraphicalDebugger extends GraphDebugger {
             for(Statement stm : statements) {
                 Resource predicate = stm.getPredicate();
                 if(g.isInstanceOf(stm.getPredicate(), L0.OrderedSet)) {
-                    updateTag(node, g, r, stm.getPredicate(), "Ordered Set");
+                    updateTag(node, g, r, stm.getPredicate(), "Ordered Set"); //$NON-NLS-1$
                     map.remove(stm.getPredicate());
                 }
                 Resource inverse = g.getPossibleInverse(predicate);
@@ -366,7 +367,7 @@ public class GraphicalDebugger extends GraphDebugger {
             for(Resource pred : preds) {
                 String str = htmlEscape(getResourceName(g, pred));
                 if(str == null)
-                    str = "<null>";
+                    str = "<null>"; //$NON-NLS-1$
                 strmap.put(pred, str);
             }
             Arrays.sort(preds, new Comparator<Resource>() {
@@ -429,10 +430,10 @@ public class GraphicalDebugger extends GraphDebugger {
             if(!stmSubject.equals(subj)) {
                 Node asserted = getResourceRef(graph, stmSubject);
                 Edge e = new Edge(this.graph, objects[i].node, asserted);
-                e.setLabel("Asserted in");
+                e.setLabel(Messages.GraphicalDebugger_AssertedIn);
                 
-                objects[i].node.setFillColor("#ffaaaa");
-                objects[i].node.setStyle("filled");
+                objects[i].node.setFillColor("#ffaaaa"); //$NON-NLS-1$
+                objects[i].node.setStyle("filled"); //$NON-NLS-1$
             }
         }
 
@@ -506,7 +507,7 @@ public class GraphicalDebugger extends GraphDebugger {
                 cur = OrderedSetUtils.next(graph, subj, cur);
             } catch(DatabaseException e) {
                Edge edge = new Edge(this.graph, node, node);
-               edge.setLabel("Broken Ordered Set");
+               edge.setLabel(Messages.GraphicalDebugger_BrockenOrderedSet);
                 //list.add("<span style=\"color:red;font-weight:bold\">BROKEN ORDERED SET:<br/></span><span style=\"color:red\">" + e.getMessage() + "</span>");
 //                Resource inv = graph.getPossibleInverse(subj);
 //                for(Statement stat : graph.getStatements(cur, L0.IsRelatedTo)) {
@@ -528,7 +529,7 @@ public class GraphicalDebugger extends GraphDebugger {
         }
         for (int i = 0; i < list.size() ; ++i) {
                 Edge e = new Edge(this.graph, node, list.get(i));
-                e.setLabel("Oredered set item " + i);
+                e.setLabel(NLS.bind(Messages.GraphicalDebugger_OrderedSetItem , i));
         }
 
         // Output table rows
index 4c87b8a6d887a9c40e57d6f0aeb2447967ba1686..9e89ef3287b53825932bf72bb08203e4fa8e2721 100644 (file)
@@ -38,7 +38,7 @@ import org.simantics.utils.ui.LayoutUtils;
 
 public class GraphicalDebuggerEditor extends ResourceEditorPart {
 
-    public static final String EDITOR_ID = "org.simantics.debug.graphicalDebuggerEditor";
+    public static final String EDITOR_ID = "org.simantics.debug.graphicalDebuggerEditor"; //$NON-NLS-1$
 
     private GraphicalDebugger      debugger;
     private IAction            backAction;
@@ -135,7 +135,7 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
 
     class RefreshAction extends Action {
         public RefreshAction() {
-            super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif"));
+            super(Messages.GraphicalDebuggerEditor_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$
         }
         @Override
         public void run() {
@@ -145,8 +145,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
 
     class FindAction extends Action {
         public FindAction() {
-            super("Find", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png"));
-            setToolTipText("Find Resource");
+            super(Messages.GraphicalDebuggerEditor_Find, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_blue.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphicalDebuggerEditor_FindTT);
         }
         @Override
         public void run() {
@@ -156,8 +156,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
 
     class AddStatementAction extends Action {
         public AddStatementAction() {
-            super("AddStatement", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png"));
-            setToolTipText("Add Statement Between Existing Resources");
+            super(Messages.GraphicalDebuggerEditor_AddStatement, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphicalDebuggerEditor_AddStatementTT);
         }
         @Override
         public void run() {
@@ -170,8 +170,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
     }
     class AddResourceAction extends Action {
         public AddResourceAction() {
-            super("AddResource", BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png"));
-            setToolTipText("Add New Related Resource");
+            super(Messages.GraphicalDebuggerEditor_AddResource, BundleUtils.getImageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/cog_add.png")); //$NON-NLS-2$
+            setToolTipText(Messages.GraphicalDebuggerEditor_AddResourceTT);
         }
         @Override
         public void run() {
@@ -184,8 +184,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
     }
     class BackAction extends Action {
         public BackAction() {
-            super("Back", Action.AS_PUSH_BUTTON);
-            setToolTipText("Back");
+            super(Messages.GraphicalDebuggerEditor_Back, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphicalDebuggerEditor_BackTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -198,8 +198,8 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
 
     class ForwardAction extends Action {
         public ForwardAction() {
-            super("Forward", Action.AS_PUSH_BUTTON);
-            setToolTipText("Forward");
+            super(Messages.GraphicalDebuggerEditor_Forward, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphicalDebuggerEditor_ForwardTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
@@ -212,7 +212,7 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
     
     class DecreaseDepthAction extends Action {
         public DecreaseDepthAction() {
-            super("Decrease", Action.AS_PUSH_BUTTON);
+            super(Messages.GraphicalDebuggerEditor_Decrease, Action.AS_PUSH_BUTTON);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -224,7 +224,7 @@ public class GraphicalDebuggerEditor extends ResourceEditorPart {
 
     class IncreaseDepthAction extends Action {
         public IncreaseDepthAction() {
-            super("Increase", Action.AS_PUSH_BUTTON);
+            super(Messages.GraphicalDebuggerEditor_Increase, Action.AS_PUSH_BUTTON);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
index 1c17001f012e6ff26f6b6901b0fce70cd492f43c..a47f48e23eaad757a509ad3295ebe1e326f04878 100644 (file)
@@ -32,7 +32,7 @@ import org.simantics.utils.ui.LayoutUtils;
 
 public class GraphicalDebuggerView extends ViewPart {
 
-    public static final String VIEW_ID              = "org.simantics.debug.graphicalDebugger";
+    public static final String VIEW_ID              = "org.simantics.debug.graphicalDebugger"; //$NON-NLS-1$
 
 //    private final boolean      DEFAULT_RECYCLE_VIEW = true;
 
@@ -128,7 +128,7 @@ public class GraphicalDebuggerView extends ViewPart {
 //
     class RefreshAction extends Action {
         public RefreshAction() {
-            super("Refresh", BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif"));
+            super(Messages.GraphicalDebuggerView_Refresh, BundleUtils.getImageDescriptorFromPlugin(SimanticsUI.PLUGIN_ID, "icons/refresh.gif")); //$NON-NLS-2$
         }
         @Override
         public void run() {
@@ -138,7 +138,7 @@ public class GraphicalDebuggerView extends ViewPart {
 
     class BackAction extends Action {
         public BackAction() {
-            super("Back", Action.AS_PUSH_BUTTON);
+            super(Messages.GraphicalDebuggerView_Back, Action.AS_PUSH_BUTTON);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -150,7 +150,7 @@ public class GraphicalDebuggerView extends ViewPart {
 
     class ForwardAction extends Action {
         public ForwardAction() {
-            super("Forward", Action.AS_PUSH_BUTTON);
+            super(Messages.GraphicalDebuggerView_Forward, Action.AS_PUSH_BUTTON);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
@@ -162,8 +162,8 @@ public class GraphicalDebuggerView extends ViewPart {
 
     class HomeAction extends Action {
         public HomeAction() {
-            super("Home", Action.AS_PUSH_BUTTON);
-            setToolTipText("Navigate to root library");
+            super(Messages.GraphicalDebuggerView_Home, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphicalDebuggerView_HomeTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV_DISABLED));
         }
@@ -175,8 +175,8 @@ public class GraphicalDebuggerView extends ViewPart {
     
     class DecreaseDepthAction extends Action {
         public DecreaseDepthAction() {
-            super("Decrease", Action.AS_PUSH_BUTTON);
-            setToolTipText("Decrease Depth");
+            super(Messages.GraphicalDebuggerView_Decrease, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphicalDebuggerView_DecreaseTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
         }
@@ -188,8 +188,8 @@ public class GraphicalDebuggerView extends ViewPart {
 
     class IncreaseDepthAction extends Action {
         public IncreaseDepthAction() {
-            super("Increase", Action.AS_PUSH_BUTTON);
-            setToolTipText("Increase Depth");
+            super(Messages.GraphicalDebuggerView_Increase, Action.AS_PUSH_BUTTON);
+            setToolTipText(Messages.GraphicalDebuggerView_IncreaseTT);
             setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
             setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
         }
diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/Messages.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/Messages.java
new file mode 100644 (file)
index 0000000..12721b4
--- /dev/null
@@ -0,0 +1,39 @@
+package org.simantics.debug.ui.graph;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.debug.ui.graph.messages"; //$NON-NLS-1$
+       public static String GraphicalDebugger_AssertedIn;
+       public static String GraphicalDebugger_BrockenOrderedSet;
+       public static String GraphicalDebugger_OrderedSetItem;
+       public static String GraphicalDebuggerEditor_AddResource;
+       public static String GraphicalDebuggerEditor_AddResourceTT;
+       public static String GraphicalDebuggerEditor_AddStatement;
+       public static String GraphicalDebuggerEditor_AddStatementTT;
+       public static String GraphicalDebuggerEditor_Back;
+       public static String GraphicalDebuggerEditor_BackTT;
+       public static String GraphicalDebuggerEditor_Decrease;
+       public static String GraphicalDebuggerEditor_Find;
+       public static String GraphicalDebuggerEditor_FindTT;
+       public static String GraphicalDebuggerEditor_Forward;
+       public static String GraphicalDebuggerEditor_ForwardTT;
+       public static String GraphicalDebuggerEditor_Increase;
+       public static String GraphicalDebuggerEditor_Refresh;
+       public static String GraphicalDebuggerView_Back;
+       public static String GraphicalDebuggerView_Decrease;
+       public static String GraphicalDebuggerView_DecreaseTT;
+       public static String GraphicalDebuggerView_Forward;
+       public static String GraphicalDebuggerView_Home;
+       public static String GraphicalDebuggerView_HomeTT;
+       public static String GraphicalDebuggerView_Increase;
+       public static String GraphicalDebuggerView_IncreaseTT;
+       public static String GraphicalDebuggerView_Refresh;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/messages.properties b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/messages.properties
new file mode 100644 (file)
index 0000000..9565a60
--- /dev/null
@@ -0,0 +1,25 @@
+GraphicalDebugger_AssertedIn=Asserted in\r
+GraphicalDebugger_BrockenOrderedSet=Broken Ordered Set\r
+GraphicalDebugger_OrderedSetItem=Ordered set item {0}\r
+GraphicalDebuggerEditor_AddResource=AddResource\r
+GraphicalDebuggerEditor_AddResourceTT=Add New Related Resource\r
+GraphicalDebuggerEditor_AddStatement=AddStatement\r
+GraphicalDebuggerEditor_AddStatementTT=Add Statement Between Existing Resources\r
+GraphicalDebuggerEditor_Back=Back\r
+GraphicalDebuggerEditor_BackTT=Back\r
+GraphicalDebuggerEditor_Decrease=Decrease\r
+GraphicalDebuggerEditor_Find=Find\r
+GraphicalDebuggerEditor_FindTT=Find Resource\r
+GraphicalDebuggerEditor_Forward=Forward\r
+GraphicalDebuggerEditor_ForwardTT=Forward\r
+GraphicalDebuggerEditor_Increase=Increase\r
+GraphicalDebuggerEditor_Refresh=Refresh\r
+GraphicalDebuggerView_Back=Back\r
+GraphicalDebuggerView_Decrease=Decrease\r
+GraphicalDebuggerView_DecreaseTT=Decrease Depth\r
+GraphicalDebuggerView_Forward=Forward\r
+GraphicalDebuggerView_Home=Home\r
+GraphicalDebuggerView_HomeTT=Navigate to root library\r
+GraphicalDebuggerView_Increase=Increase\r
+GraphicalDebuggerView_IncreaseTT=Increase Depth\r
+GraphicalDebuggerView_Refresh=Refresh\r
index c69746d923308ff5453d0ff6c8a4fbdf8b815bfe..70aa098039d007976ff911f936ccf0edcb276eae 100644 (file)
@@ -20,7 +20,7 @@ import org.osgi.framework.BundleContext;
 public class Activator extends AbstractUIPlugin {
 
        // The plug-in ID
-       public static final String PLUGIN_ID = "org.simantics.debug.ui";
+       public static final String PLUGIN_ID = "org.simantics.debug.ui"; //$NON-NLS-1$
 
        // The shared instance
        private static Activator plugin;
index 306f7f9613c6d4a9f593c565524f546d14f46275..67ebb19ee46e6de414c38bb9e595d6a12b1dcd78 100644 (file)
@@ -44,7 +44,7 @@ public class DebugUtils {
         if (stm != null) {
             String label = NameUtils.getSafeLabel(graph, r);
             if (!label.isEmpty() && !stm.isAsserted(r))
-                name += " (" + label + ")";
+                name += " (" + label + ")"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         return name;
     }
@@ -80,14 +80,14 @@ public class DebugUtils {
     public static void addResource(Session s, GraphDebugger debugger) throws DatabaseException {
         Shell shell = debugger.getShell();
 
-        SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, "Create New Resource");
+        SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, Messages.DebugUtils_CreateNewResource);
         rld.setBlockOnOpen(true);
         rld.setResourceFilter(ResourceSearch.FILTER_TYPES);
 
         Resource subject_ = debugger.getDebuggerLocation();
         if (subject_ == null) {
             rld.setBlockOnOpen(true);
-            rld.setMessage("Select Subject");
+            rld.setMessage(Messages.DebugUtils_SelectSubject);
             rld.setInitialSelections(new Object[] {});
             if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
             if (rld.getResult()==null) return;
@@ -97,13 +97,13 @@ public class DebugUtils {
 
         rld.setBlockOnOpen(true);
         rld.setResourceFilter(ResourceSearch.FILTER_RELATIONS);
-        rld.setMessage("Select Predicate");
+        rld.setMessage(Messages.DebugUtils_SelectPredicate);
         rld.setInitialSelections(new Object[] {});
         if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
         if (rld.getResult()==null) return;
         final Resource predicate = ((Container<Resource>)rld.getResult()[0]).get();
 
-        rld.setMessage("Select Type of New Object Instance");
+        rld.setMessage(Messages.DebugUtils_SelectTypeOfNewObjectInstance);
         rld.setResourceFilter(ResourceSearch.FILTER_TYPES);
         rld.setInitialSelections(new Object[] {});
         if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
@@ -127,12 +127,12 @@ public class DebugUtils {
     @SuppressWarnings("unchecked")
     public static void addStatement(Session s, GraphDebugger debugger) throws DatabaseException {
         Shell shell = debugger.getShell();
-        SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, "Create New Statement");
+        SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, Messages.DebugUtils_CreateNewStatement);
 
         Resource subject_ = debugger.getDebuggerLocation();
         if (subject_ == null) {
             rld.setBlockOnOpen(true);
-            rld.setMessage("Select Subject");
+            rld.setMessage(Messages.DebugUtils_SelectSubject);
             rld.setInitialSelections(new Object[] {});
             if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
             if (rld.getResult()==null) return;
@@ -142,14 +142,14 @@ public class DebugUtils {
 
         rld.setBlockOnOpen(true);
         rld.setResourceFilter(ResourceSearch.FILTER_RELATIONS);
-        rld.setMessage("Select Predicate");
+        rld.setMessage(Messages.DebugUtils_SelectPredicate);
         rld.setInitialSelections(new Object[] {});
         if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
         if (rld.getResult()==null) return;
         final Resource predicate = ((Container<Resource>)rld.getResult()[0]).get();
 
         rld.setResourceFilter(ResourceSearch.FILTER_ALL);
-        rld.setMessage("Select Object");
+        rld.setMessage(Messages.DebugUtils_SelectObject);
         rld.setInitialSelections(new Object[] {});
         if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
         if (rld.getResult()==null) return;
@@ -165,7 +165,7 @@ public class DebugUtils {
 
     public static void find(Session s, GraphDebugger debugger) {
         Shell shell = debugger.getShell();
-        SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, "Select Resource to View");
+        SearchResourceDialog rld = new SearchResourceDialog(s, false, shell, Messages.DebugUtils_SelectResourceToView);
         rld.setBlockOnOpen(true);
         if (rld.open()!=org.eclipse.jface.window.Window.OK) return;
         if (rld.getResult()==null) return;
index e61a955fb51bab18ef2d7c92da04709a0a805192..71ae91414afdae4728f8f3b670c1c381861f5a9c 100644 (file)
@@ -24,7 +24,7 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;
 public class GraphDebuggerAdapter extends AbstractResourceEditorAdapter {
 
     public GraphDebuggerAdapter() {
-        super("Graph Debugger View", SimanticsUI.getImageDescriptor("icons/etool16/bug.png"));
+        super(Messages.GraphDebuggerAdapter_GraphDebuggerView, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-1$
     }
 
     @Override
index 1ef8a2543368fcc2dc1a6138447bd9df8295006c..6039f82875b75f2daa837c08b203e86f143c1cb4 100644 (file)
@@ -25,7 +25,7 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;
 public class GraphDebuggerEditorAdapter extends AbstractResourceEditorAdapter {
 
     public GraphDebuggerEditorAdapter() {
-        super("Graph Debugger", SimanticsUI.getImageDescriptor("icons/etool16/bug.png"));
+        super(Messages.GraphDebuggerEditorAdapter_GraphDebugger, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-2$
     }
 
     @Override
index 600520a23517d2fc154f431b29e2a13a87027911..d98edc4c4bcf32a0fb27cdeb97bc5dba08b90a78 100644 (file)
@@ -23,7 +23,7 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;
 public class GraphicalDebuggerEditorAdapter extends AbstractResourceEditorAdapter {
 
     public GraphicalDebuggerEditorAdapter() {
-        super("Graphical Debugger", SimanticsUI.getImageDescriptor("icons/etool16/bug.png"));
+        super(Messages.GraphicalDebuggerEditorAdapter_GraphicalDebugger, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-1$
     }
 
     @Override
diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Messages.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/Messages.java
new file mode 100644 (file)
index 0000000..35479a8
--- /dev/null
@@ -0,0 +1,26 @@
+package org.simantics.debug.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.debug.ui.internal.messages"; //$NON-NLS-1$
+       public static String DebugUtils_CreateNewResource;
+       public static String DebugUtils_CreateNewStatement;
+       public static String DebugUtils_SelectObject;
+       public static String DebugUtils_SelectPredicate;
+       public static String DebugUtils_SelectResourceToView;
+       public static String DebugUtils_SelectSubject;
+       public static String DebugUtils_SelectTypeOfNewObjectInstance;
+       public static String GraphDebuggerAdapter_GraphDebuggerView;
+       public static String GraphDebuggerEditorAdapter_GraphDebugger;
+       public static String GraphicalDebuggerEditorAdapter_GraphicalDebugger;
+       public static String SearchResourceHandler_OpenResource;
+       public static String TGEditorAdapter_OntologyViewer;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index bf36166452ff9de727d8fa5fdb4b11f00cb1f68f..49917f909af776db185225a8405e12c46ec2977c 100644 (file)
@@ -41,7 +41,7 @@ public class SearchResourceHandler extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         Shell shell = HandlerUtil.getActiveShellChecked(event);
         Session session = Simantics.getSession();
-        SearchResourceDialog rld = new SearchResourceDialog(session, false, shell, "Open Resource");
+        SearchResourceDialog rld = new SearchResourceDialog(session, false, shell, Messages.SearchResourceHandler_OpenResource);
         rld.setResourceFilter(ResourceSearch.FILTER_ALL);
         rld.setBlockOnOpen(true);
         rld.open();
index a941ecbc39b920435c1869368e6baf336443003c..84d50b88e0bf7fec6b1f53babfce78829e7ebe48 100644 (file)
@@ -25,10 +25,10 @@ import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;
  */
 public class TGEditorAdapter extends AbstractResourceEditorAdapter {
 
-       public static final String EDITOR_ID = "org.simantics.modeling.ui.pgraphEditor";
+       public static final String EDITOR_ID = "org.simantics.modeling.ui.pgraphEditor"; //$NON-NLS-1$
        
     public TGEditorAdapter() {
-        super("Ontology Viewer", SimanticsUI.getImageDescriptor("icons/etool16/bug.png"));
+        super(Messages.TGEditorAdapter_OntologyViewer, SimanticsUI.getImageDescriptor("icons/etool16/bug.png")); //$NON-NLS-1$
     }
 
     @Override
diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/messages.properties b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/messages.properties
new file mode 100644 (file)
index 0000000..9240ce0
--- /dev/null
@@ -0,0 +1,12 @@
+DebugUtils_CreateNewResource=Create New Resource\r
+DebugUtils_CreateNewStatement=Create New Statement\r
+DebugUtils_SelectObject=Select Object\r
+DebugUtils_SelectPredicate=Select Predicate\r
+DebugUtils_SelectResourceToView=Select Resource to View\r
+DebugUtils_SelectSubject=Select Subject\r
+DebugUtils_SelectTypeOfNewObjectInstance=Select Type of New Object Instance\r
+GraphDebuggerAdapter_GraphDebuggerView=Graph Debugger View\r
+GraphDebuggerEditorAdapter_GraphDebugger=Graph Debugger\r
+GraphicalDebuggerEditorAdapter_GraphicalDebugger=Graphical Debugger\r
+SearchResourceHandler_OpenResource=Open Resource\r
+TGEditorAdapter_OntologyViewer=Ontology Viewer\r
index dbdce7c4f6e94e745938886170f85631150ac3f9..a37e47dc43b57756f8b4c8d82cde26dd71f938bf 100644 (file)
@@ -9,6 +9,64 @@
 # Contributors:
 #     VTT Technical Research Centre of Finland - initial API and implementation
 ###############################################################################
+GraphDebugger_Cancel=Cancel
+GraphDebugger_ConfirmActionsDots=Confirm action...
+GraphDebugger_ConfirmActionsDotsMsg=This action will remove the selected statement.\nAre you sure you want to proceed with this action?
+GraphDebugger_Continue=Continue
+GraphDebugger_EditValue=Edit Value
+GraphDebugger_EnterResourceIDorURI=Enter resource ID (RID) or URI
+GraphDebugger_InputNewPropertyValue=Input new property value. For numeric vector values, separate numbers with comma (',').
+GraphDebugger_LabelDragResource=Drag a resource here to examine it in this debugger\!
+GraphDebugger_Lookup=&Lookup
+GraphDebugger_StatusIndexLookpuFailed=Index & cluster -based lookup failed. See Error Log.
+GraphDebugger_StatusInvalidInput=Invalid input, expected transient resource ID
+GraphDebugger_StatusInvalidInputExpectIdxClusterIds=Invalid input, expected index & cluster IDs
+GraphDebugger_StatusInvalidInputResIdORURIExpected=Invalid input, resource ID or URI expected
+GraphDebugger_StatusInvalidPrefixedInput=Invalid '$'-prefixed input, expected resource ID
+GraphDebugger_StatusResourceforURI=Resource for URI ''{0}'' not found
+GraphDebugger_StatusResourceIDFailed=Resource ID lookup failed. See Error Log.
+GraphDebugger_StatusTransientResourceID=Transient resource ID lookup failed. See Error Log.
+GraphDebugger_StatusURIlookupFailed=URI lookup failed. See Error Log.
+GraphDebuggerEditor_AddResourceTT=Add New Related Resource
+GraphDebuggerEditor_AddStatement=AddStatement
+GraphDebuggerEditor_AddStatementTT=Add Statement Between Existing Resources
+GraphDebuggerEditor_Back=Back
+GraphDebuggerEditor_BackTT=Back
+GraphDebuggerEditor_Find=Find
+GraphDebuggerEditor_FindTT=Find Resource
+GraphDebuggerEditor_Forward=Forward
+GraphDebuggerEditor_ForwardTT=Forward
+GraphDebuggerEditor_Refresh=Refresh
+GraphDebuggerEditor_RefreshTT=Refresh
 
-Name_adaption_problem = <p>GraphDebugger: name adaption problem in {0}</p>
-Name_formulation_problem = <p>GraphDebugger: unknown name formulation problem in {0}</p>
\ No newline at end of file
+
+GraphDebuggerEditor_AddResource=AddResource
+GraphDebuggerView_AddResource=AddResource
+GraphDebuggerView_AddResourceTT=Add New Related Resource
+GraphDebuggerView_AddStatement=AddStatement
+GraphDebuggerView_AddStatementTT=Add Statement Between Existing Resources
+GraphDebuggerView_Back=Back
+GraphDebuggerView_BackTT=Back
+GraphDebuggerView_Find=Find
+GraphDebuggerView_FindTT=Find Resource
+GraphDebuggerView_Forward=Forward
+GraphDebuggerView_ForwardTT=Forward
+GraphDebuggerView_Home=Home
+GraphDebuggerView_HomeTT=Navigate to root library
+GraphDebuggerView_Refresh=Refresh
+SearchResourceDialog_ActivatorResourceLabelProviderFailed=Resource label provider failed unexpectedly.
+SearchResourceDialog_EnterNameResURIOrId=Enter name, resource URI or ID
+SearchResourceDialog_SeperatorLblPreviouslySelected=Previously selected above, others below
+SearchResourceDialog_ShowInBrowser=Show In Browser
+SessionDebuggerView_ActivatorUnexpectedException=Unexpected exception while applying command 
+SessionDebuggerView_ActivatorUnexpectedIOException=Unexpected I/O exception while applying command {0}{1}
+SessionDebuggerView_Shell=Shell
+SessionDebuggerView_WroteCommand=Wrote command ''{0}'' output to file {1}
+VariableDebugger_DragResourceToDebugger=\ \ Drag a resource or a variable here to examine it in this debugger\!  
+VariableDebugger_Lookup=Lookup
+VariableDebugger_TextToolTip=Amount of Screen/Listener Updates Received for Shown Variable
+VariableDebuggerView_Back=Back
+VariableDebuggerView_Forward=Forward
+VariableDebuggerView_Home=Home
+VariableDebuggerView_HomeTT=Navigate to root library
+VariableDebuggerView_Refresh=Refresh
index c3b3b6f18b08e97ddc64d925b914729defb8a5d6..01526a56f5f7d4df3703a01a0f058c84271d8c26 100644 (file)
@@ -16,7 +16,7 @@ import org.simantics.project.features.AbstractProjectFeature;
 
 public class DesktopProjectFeature extends AbstractProjectFeature {
 
-    private static final String DEFAULT_PERSPECTIVE = "org.simantics.desktop.modelling.perspective";
+    private static final String DEFAULT_PERSPECTIVE = "org.simantics.desktop.modelling.perspective"; //$NON-NLS-1$
 
     @Override
     public void configure() throws ProjectException {
index 81bcc0357ba8cc07b920c130ea2a983b171ee2e2..b75c0bd442a3ddd8e43bd4374de460eb5ed87191 100644 (file)
@@ -53,7 +53,7 @@ public class ExportModel extends AbstractHandler {
             context.setHint(SelectionHints.KEY_MAIN, lib);
 
                        IStructuredSelection sel = new StructuredSelection(context);
-               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.modelExportWizard");
+               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.modelExportWizard"); //$NON-NLS-1$
                } catch (DatabaseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
index 96f7da83094e142d9ee1998b12943cbf5f2d995c..be11bcccca857ae26f66e5f75db375ed5a4a63d3 100644 (file)
@@ -40,7 +40,7 @@ public class ExportSharedLibrary extends AbstractHandler {
 
                                @Override
                                public Resource perform(ReadGraph graph) throws DatabaseException {
-                                       List<Resource> ontologies =  Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
+                                       List<Resource> ontologies =  Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE); //$NON-NLS-1$ //$NON-NLS-2$
                                        if(ontologies.size() == 1) return ontologies.iterator().next();
                                        return null;
                                }
@@ -52,7 +52,7 @@ public class ExportSharedLibrary extends AbstractHandler {
             context.setHint(SelectionHints.KEY_MAIN, lib);
 
                        IStructuredSelection sel = new StructuredSelection(context);
-               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyExportWizard");
+               ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyExportWizard"); //$NON-NLS-1$
                } catch (DatabaseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
index 25d7d3a1715922fc1a79010b633b01fb8458e9a0..8bb0783f317f861c345d76ca9be64732556861b0 100644 (file)
@@ -35,20 +35,20 @@ public class ImportModel extends AbstractHandler {
         // Get imported transferable graph file using FileDialog
         Shell shell = HandlerUtil.getActiveShellChecked(event);
         FileDialog fd = new FileDialog(shell, SWT.OPEN);
-        fd.setText("Import Model");
+        fd.setText(Messages.ImportModel_ImportModel);
 
-        String path = Activator.getDefault().getPreferenceStore().getString("IMPORT_MODEL_PATH");
+        String path = Activator.getDefault().getPreferenceStore().getString("IMPORT_MODEL_PATH"); //$NON-NLS-1$
         if(path.isEmpty() || !(new File(path).exists())){
-               path = System.getProperty("user.dir");
+               path = System.getProperty("user.dir"); //$NON-NLS-1$
         }
         
         fd.setFilterPath(path);
-        String[] filterExt = {"*.tg", "*.*"};
+        String[] filterExt = {"*.tg", "*.*"}; //$NON-NLS-1$ //$NON-NLS-2$
         fd.setFilterExtensions(filterExt);
         final String selected = fd.open();
         if(selected == null) return null;
 
-        Job job = new DatabaseJob("Import model") {
+        Job job = new DatabaseJob(Messages.ImportModel_DatabaseImportModel) { 
 
             @Override
             protected IStatus run(IProgressMonitor monitor) {
index 113c11926cbe69e068dc8b6efe827041ef2491f9..0bc9852f9997dbefb076e207fb80117c22b81996 100644 (file)
@@ -25,7 +25,7 @@ public class ImportSharedLibrary extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         
                IStructuredSelection sel = new StructuredSelection();
-       ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyImportWizard");
+       ModelingUtils.openWizard(Display.getCurrent(), sel, "org.simantics.modeling.ui.sharedOntologyImportWizard"); //$NON-NLS-1$
        return null;
         
     }
diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/Messages.java
new file mode 100644 (file)
index 0000000..805f90d
--- /dev/null
@@ -0,0 +1,23 @@
+package org.simantics.desktop.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.desktop.ui.internal.messages"; //$NON-NLS-1$
+       public static String ImportModel_DatabaseImportModel;
+       public static String ImportModel_ImportModel;
+       public static String NewModel_0_Failed;
+       public static String NewModel_Book1;
+       public static String NewModel_Library;
+       public static String NewModel_NewModel;
+       public static String NewModel_Sheet1;
+       public static String NewModel_Sheet2;
+       public static String NewModel_Sheet3;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ffa408e3cfaf2a7f9b561dbd34a6de8ad14edc69..ad759314c68d11962981df7801d486d745cd6e73 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.DatabaseJob;
 import org.simantics.Simantics;
 import org.simantics.db.Resource;
@@ -39,7 +40,7 @@ public class NewModel extends AbstractHandler {
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        Job job = new DatabaseJob("Creating Model") {
+        Job job = new DatabaseJob(Messages.NewModel_NewModel) {  
             @Override
             protected IStatus run(IProgressMonitor monitor) {
                 try {
@@ -51,7 +52,7 @@ public class NewModel extends AbstractHandler {
                     });
                     return Status.OK_STATUS;
                 } catch (DatabaseException e) {
-                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, getName() + " failed.", e);
+                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.NewModel_0_Failed, getName()), e);
                 }
             }
         };
@@ -64,13 +65,13 @@ public class NewModel extends AbstractHandler {
         Resource model = ModelingUtils.createModel(graph, type, name);
         Resource conf = graph.syncRequest(new Configuration(model));
 
-        ModelingUtils.addSCLMainToModel(graph, model, "SCLMain", "");
-        ModelingUtils.createLocalLibrary(graph, model, "Library");
+        ModelingUtils.addSCLMainToModel(graph, model, "SCLMain", ""); //$NON-NLS-1$ //$NON-NLS-2$
+        ModelingUtils.createLocalLibrary(graph, model, Messages.NewModel_Library);
 
-        Resource book = SpreadsheetGraphUtils.createBook(graph, conf, "Book1");
-        SpreadsheetUtils.createSheet(graph, book, "Sheet1", new String[] { }, new int[] { 50 });
-        SpreadsheetUtils.createSheet(graph, book, "Sheet2", new String[] { }, new int[] { 50 });
-        SpreadsheetUtils.createSheet(graph, book, "Sheet3", new String[] { }, new int[] { 50 });
+        Resource book = SpreadsheetGraphUtils.createBook(graph, conf, Messages.NewModel_Book1);
+        SpreadsheetUtils.createSheet(graph, book, Messages.NewModel_Sheet1, new String[] { }, new int[] { 50 });
+        SpreadsheetUtils.createSheet(graph, book, Messages.NewModel_Sheet2, new String[] { }, new int[] { 50 });
+        SpreadsheetUtils.createSheet(graph, book, Messages.NewModel_Sheet3, new String[] { }, new int[] { 50 });
 
         return model;
     }
diff --git a/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties b/bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/messages.properties
new file mode 100644 (file)
index 0000000..53d837f
--- /dev/null
@@ -0,0 +1,9 @@
+ImportModel_DatabaseImportModel=Import model\r
+ImportModel_ImportModel=Import Model\r
+NewModel_0_Failed={0} failed.\r
+NewModel_Book1=Book1\r
+NewModel_Library=Library\r
+NewModel_NewModel=Creating Model\r
+NewModel_Sheet1=Sheet1\r
+NewModel_Sheet2=Sheet2\r
+NewModel_Sheet3=Sheet3\r
index a975f2f9315b38407254899e45c4ba41d27fb404..fbd586c98d41e3d2666c847fdbd760e7a1fadddd 100644 (file)
@@ -1,4 +1,11 @@
 eclipse.preferences.version=1
+encoding//src/org/simantics/document/linking/actions/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/ge/messages.properties=ISO-8859-1
 encoding//src/org/simantics/document/linking/report/ExportToPDF.java=UTF-8
+encoding//src/org/simantics/document/linking/report/messages.properties=ISO-8859-1
 encoding//src/org/simantics/document/linking/report/templates/ModelDocumentWriter.java=UTF-8
 encoding//src/org/simantics/document/linking/report/templates/ReferredDocumentWriter.java=UTF-8
+encoding//src/org/simantics/document/linking/report/templates/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/utils/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/views/messages.properties=ISO-8859-1
+encoding//src/org/simantics/document/linking/wizard/messages.properties=ISO-8859-1
index 722796a74b60104bc32642347d94102ee1d50700..ef6e06a59d2c50127a193e89a423299554b48f04 100644 (file)
@@ -31,8 +31,8 @@ public class Activator extends AbstractUIPlugin {
        public void start(BundleContext context) throws Exception {
                super.start(context);
                plugin = this;
-               cross = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/cross.png");
-               clock_red = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/clock_red.png");
+               cross = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/cross.png"); //$NON-NLS-1$
+               clock_red = imageDescriptorFromPlugin(PLUGIN_ID, "icons/silk_small/clock_red.png"); //$NON-NLS-1$
        }
 
        /*
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/Messages.java
new file mode 100644 (file)
index 0000000..cab319b
--- /dev/null
@@ -0,0 +1,19 @@
+package org.simantics.document.linking.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.actions.messages"; //$NON-NLS-1$
+       public static String SearchLinksAction_CannotPerformSearch;
+       public static String UpdateReferencesAction_CannotUpdateReferences;
+       public static String UpdateReferencesAction_FixOldReferences;
+       public static String UpdateReferencesAction_FixReferences;
+       public static String UpdateReferencesAction_NothingToFix;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ff7a3e14e014d30b03b38703d79ec4979c3918e0..5fec36f7c1cb45aa789ba5ec26bc583f8c8f8208 100644 (file)
@@ -35,20 +35,19 @@ public class SearchLinksAction implements ActionFactory {
                                                        Layer0 l0 = Layer0.getInstance(graph);
                                                        String s = graph.getPossibleRelatedValue(resource, l0.HasLabel, Bindings.STRING);
                                                        if (s == null)
-                                                               s = graph.getRelatedValue(resource, l0.HasName, Bindings.STRING); 
+                                                               s = graph.getRelatedValue(resource, l0.HasName, Bindings.STRING);
                                                        return s;
                                                }
                                        });
-                                       ISearchService searchService = (ISearchService)PlatformUI.getWorkbench().getService(ISearchService.class);
+                                       ISearchService searchService = (ISearchService) PlatformUI.getWorkbench().getService(ISearchService.class);
                                        SearchQuery query = new SearchQuery(name);
-                                       query.setSearchFlag("Name", "on");
-                                       query.setSearchFlag(DocumentLink.URIs.SearchFunction, "on");
+                                       query.setSearchFlag("Name", "on"); //$NON-NLS-1$ //$NON-NLS-2$
+                                       query.setSearchFlag(DocumentLink.URIs.SearchFunction, "on"); //$NON-NLS-1$
                                        searchService.performQuery(query, ISearchService.ResultBrowser.VIEW, true);
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot perform search",e);
+                                       ExceptionUtils.logAndShowError(Messages.SearchLinksAction_CannotPerformSearch, e);
                                }
-                               
-                               
+
                        }
                };
        }
index a05d11241297456a56eeab4613174ac3eb3aa74e..a3cb78734e704b016edcdd84aab5aaa9808f6081 100644 (file)
@@ -3,7 +3,9 @@ package org.simantics.document.linking.actions;
 import java.util.Collection;
 import java.util.Collections;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
@@ -36,34 +38,36 @@ public class UpdateReferencesAction implements ActionFactory {
                                                @Override
                                                public Collection<Resource> perform(ReadGraph graph)
                                                                throws DatabaseException {
-                                                   return findDocumentReferences(graph, document);
+                                                       return findDocumentReferences(graph, document);
                                                }
                                        });
-                                       
+
                                        if (coll == null)
                                                return;
-                                       
-                                       String dialogTitle = "Fix References";
-                                       String dialogMessage = "Fix " + coll.size() + " old references?";
-                                       String dialogButtonLabels[] = new String[]{"Ok","Cancel"};
+
+                                       String dialogTitle = Messages.UpdateReferencesAction_FixReferences;
+                                       String dialogMessage = NLS.bind(Messages.UpdateReferencesAction_FixOldReferences, coll.size());
+                                       String dialogButtonLabels[] = new String[] { IDialogConstants.OK_LABEL,
+                                                       IDialogConstants.CANCEL_LABEL };
                                        int defaultIndex = 0;
                                        if (coll.size() == 0) {
-                                               dialogMessage = "Nothing to fix.";
-                                               dialogButtonLabels = new String[]{"OK"};
-                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                               dialogMessage = Messages.UpdateReferencesAction_NothingToFix;
+                                               dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
+                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle,
+                                                               null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                                dialog.open();
                                                return;
                                        }
-                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null,
+                                                       dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                        if (dialog.open() != 0)
                                                return;
                                        Simantics.getSession().markUndoPoint();
                                        fixDocumentReferences(coll);
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot update references",e);
+                                       ExceptionUtils.logAndShowError(Messages.UpdateReferencesAction_CannotUpdateReferences, e);
                                }
-                               
-                               
+
                        }
                };
        }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/actions/messages.properties
new file mode 100644 (file)
index 0000000..cb2bd9e
--- /dev/null
@@ -0,0 +1,5 @@
+SearchLinksAction_CannotPerformSearch=Cannot perform search\r
+UpdateReferencesAction_CannotUpdateReferences=Cannot update references\r
+UpdateReferencesAction_FixOldReferences=Fix {0} old references?\r
+UpdateReferencesAction_FixReferences=Fix References\r
+UpdateReferencesAction_NothingToFix=Nothing to fix.\r
index eb4b02591a62a9c584cac5cbce9f1842b9539dbe..c04a1f417c3bf5a33cf064876a97853b4097ea51 100644 (file)
@@ -30,9 +30,9 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
        
        static {
                columns = new ArrayList<SearchResultColumn>();
-               columns.add(new SearchResultColumn("Name"));
-               columns.add(new SearchResultColumn("Comment"));
-               columns.add(new SearchResultColumn("Part Of"));
+               columns.add(new SearchResultColumn("Name")); //$NON-NLS-1$
+               columns.add(new SearchResultColumn("Comment")); //$NON-NLS-1$
+               columns.add(new SearchResultColumn("Part Of")); //$NON-NLS-1$
        }
        
        @Override
@@ -54,9 +54,9 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
                int type = 0;
                
                public NameComparator(String query) {
-               String parts[] = query.split(" OR ");
+               String parts[] = query.split(" OR "); //$NON-NLS-1$
                for (String s : parts) {
-                       if (s.startsWith("Name:")) {
+                       if (s.startsWith("Name:")) { //$NON-NLS-1$
                                 name = s.substring(5);
                        }
                }
@@ -65,11 +65,11 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
                name = name.trim();
                boolean freeStart = false;
                boolean freeEnd = false;
-               if (name.endsWith("*")) {
+               if (name.endsWith("*")) { //$NON-NLS-1$
                        name = name.substring(0,name.length()-1);
                        freeEnd = true;
                }
-               if (name.startsWith("*")) {
+               if (name.startsWith("*")) { //$NON-NLS-1$
                        name = name.substring(1,name.length());
                        freeStart = true;
                }
@@ -104,7 +104,7 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
         SearchResult result = new SearchResult(columns);
         Set<Resource> processed = new HashSet<Resource>();
 
-       NameComparator c = new NameComparator(query.getQuery("Name"));
+       NameComparator c = new NameComparator(query.getQuery("Name")); //$NON-NLS-1$
         
         for (Resource source : results) {
                  // Prevent index corruption from producing duplicate results.
@@ -134,7 +134,7 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
                String relationName = NameUtils.getSafeLabel(graph, relation);
                if (relationName.length() == 0)
                        relationName = NameUtils.getSafeName(graph, relation);
-               parentName = parentName +"#"+relationName;
+               parentName = parentName +"#"+relationName; //$NON-NLS-1$
             }
             
             DocumentLinkRow rst = new DocumentLinkRow();
@@ -169,17 +169,17 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
        public String getContent(int column) {
                switch (column) {
                case 0:
-                       return "<a class=\"small\" href=\"resource:"+ resource.getResource() +"\"" + (resource.getUri() == null ? "" : " title=\""+resource.getUri()+"\">")+StringUtil.escape(resource.getName())+"</a>";
+                       return "<a class=\"small\" href=\"resource:"+ resource.getResource() +"\"" + (resource.getUri() == null ? "" : " title=\""+resource.getUri()+"\">")+StringUtil.escape(resource.getName())+"</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
                case 1:
                        if (comment != null)
                                return comment;
-                       return "";
+                       return ""; //$NON-NLS-1$
                case 2:
                        if (parent != null)
-                               return "<a class=\"small\" href=\"resource:"+ parent.getResource() +"\"" + (parent.getUri() == null ? "" : " title=\""+parent.getUri()+"\">")+StringUtil.escape(parent.getName())+"</a>";
-                       return "";
+                               return "<a class=\"small\" href=\"resource:"+ parent.getResource() +"\"" + (parent.getUri() == null ? "" : " title=\""+parent.getUri()+"\">")+StringUtil.escape(parent.getName())+"</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+                       return ""; //$NON-NLS-1$
                default:
-                       return "";
+                       return ""; //$NON-NLS-1$
                }
        }
     }
index 84b0ab54888d3f6634b9ff08ad908c0f3bda056b..11d8fe11f25f63274679bd0a0f2126e4a7d5e36a 100644 (file)
@@ -5,23 +5,23 @@ import org.simantics.browsing.ui.Column.Align;
 
 public class Constants {
        
-       public static String NAME = "Name";
-       public static String VALUE = "Value";
-       public static String REFERENCE = "Reference";
-       public static String COMMENT = "Comment";
+       public static String NAME = "Name"; //$NON-NLS-1$
+       public static String VALUE = "Value"; //$NON-NLS-1$
+       public static String REFERENCE = "Reference"; //$NON-NLS-1$
+       public static String COMMENT = "Comment"; //$NON-NLS-1$
        
        public static String[] SOURCE_COLUMN_KEYS = {NAME,VALUE,REFERENCE,COMMENT};
        public static Column[] SOURCE_COLUMNS = new Column[] {
-               new Column(NAME,Align.LEFT,200,"Name",false),
-               new Column(VALUE,Align.LEFT,100,"Value",false),
-               new Column(REFERENCE,Align.LEFT,150,"Reference Document",false),
-               new Column(COMMENT,Align.LEFT,200,"Comment",true)
+               new Column(NAME,Align.LEFT,200,Messages.Constants_Name,false),
+               new Column(VALUE,Align.LEFT,100,Messages.Constants_Value,false),
+               new Column(REFERENCE,Align.LEFT,150,Messages.Constants_ReferenceDocument,false),
+               new Column(COMMENT,Align.LEFT,200,Messages.Constants_Comment,true)
        };
        
        public static String[] SOURCE_OBJECT_COLUMN_KEYS = {NAME,REFERENCE,COMMENT};
        public static Column[] SOURCE_OBJECT_COLUMNS = new Column[] {
-               new Column(NAME,Align.LEFT,200,"Name",false),
-               new Column(REFERENCE,Align.LEFT,150,"Reference Document",false),
-               new Column(COMMENT,Align.LEFT,200,"Comment",true)
+               new Column(NAME,Align.LEFT,200,Messages.Constants_Name,false),
+               new Column(REFERENCE,Align.LEFT,150,Messages.Constants_RefernceDocument,false),
+               new Column(COMMENT,Align.LEFT,200,Messages.Constants_Comment,true)
        };
 }
index 3a19d21294a5e525f463ab7de21e72d8bd8ad1c0..0a075a3e70f1fca8823aa5b42c9e2505c3486d8d 100644 (file)
@@ -5,7 +5,9 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Stack;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
@@ -31,25 +33,29 @@ public class FixAllReferencesAction implements ActionFactory {
                        public void run() {
                                System.out.println(target);
                                try {
-                                       Pair<Collection<Resource>, Collection<Resource>> refs = Simantics.getSession().syncRequest(new FindFixable(target));
-                                       String dialogTitle = "Fix References";
-                                       String dialogMessage = "Fix " + refs.first.size() + " old references and " + refs.second.size() + " removed references?";
-                                       String dialogButtonLabels[] = new String[]{"Ok","Cancel"};
+                                       Pair<Collection<Resource>, Collection<Resource>> refs = Simantics.getSession()
+                                                       .syncRequest(new FindFixable(target));
+                                       String dialogTitle = Messages.FixAllReferencesAction_FixReferences;
+                                       String dialogMessage = NLS.bind(Messages.FixAllReferencesAction_FixOldReferences,
+                                                       new Object[] { refs.first.size(), refs.second.size() });
+                                       String dialogButtonLabels[] = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
                                        int defaultIndex = 0;
                                        if (refs.first.size() == 0 && refs.second.size() == 0) {
-                                               dialogMessage = "Nothing to fix.";
-                                               dialogButtonLabels = new String[]{"OK"};
-                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                               dialogMessage = Messages.FixAllReferencesAction_NothingToFix;
+                                               dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
+                                               MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle,
+                                                               null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                                dialog.open();
                                                return;
                                        }
-                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null,
+                                                       dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
                                        if (dialog.open() != 0)
                                                return;
                                        Simantics.getSession().markUndoPoint();
                                        Simantics.getSession().syncRequest(new FixAll(refs));
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot fix references", e);
+                                       ExceptionUtils.logAndShowError(Messages.FixAllReferencesAction_CannotFixReferences, e);
                                }
                        }
                };
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/Messages.java
new file mode 100644 (file)
index 0000000..964411d
--- /dev/null
@@ -0,0 +1,33 @@
+package org.simantics.document.linking.ge;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.ge.messages"; //$NON-NLS-1$
+       public static String Constants_Comment;
+       public static String Constants_Name;
+       public static String Constants_ReferenceDocument;
+       public static String Constants_RefernceDocument;
+       public static String Constants_Value;
+       public static String FixAllReferencesAction_CannotFixReferences;
+       public static String FixAllReferencesAction_FixOldReferences;
+       public static String FixAllReferencesAction_FixReferences;
+       public static String FixAllReferencesAction_NothingToFix;
+       public static String ShowDocumentAction_CannotOpenEditor;
+       public static String ShowDocumentWithAction_CannotOpenEditor;
+       public static String ShowDocumentWithAction_OpenWith;
+       public static String SourceObjectDropAction_CannotCreateDocumentLink;
+       public static String SourceObjectDropAction_DocumentLink;
+       public static String VariableLabelRule_DeletedReference;
+       public static String VariableLabelRule_LabelDefault;
+       public static String VariableLabelRule_NoValue;
+       public static String VariableLabelRule_ReferencesDoesNotExists;
+       public static String VariableLabelRule_ReferencesHasNotBeenSet;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 47d59bc604d3df5871edeac4def7bfe41e0d0746..394a3167ff75165c1d1ce464205bd47a55be0565 100644 (file)
@@ -59,7 +59,7 @@ public class ShowDocumentAction implements ActionFactory{
                                                                try {
                                                                        adapter.openEditor(reference);
                                                                } catch (Exception e) {
-                                                                       ExceptionUtils.logAndShowError("Cannot open editor", e);
+                                                                       ExceptionUtils.logAndShowError(Messages.ShowDocumentAction_CannotOpenEditor, e);
                                                                }
                                                        }
                                                });
index be2d5e33ead0bd51d851f8a938f6f4f063277f9c..631f3127ae863b8b698463fa03e4bb4d18680636 100644 (file)
@@ -69,14 +69,14 @@ public class ShowDocumentWithAction implements ActionFactory{
                                                                        dialog.setContentProvider(new ArrayContentProvider());
                                                                        dialog.setLabelProvider(new EditorAdapterLabelProvider());
                                                                        dialog.setInput(adapters);
-                                                                       dialog.setTitle("Open with");
+                                                                       dialog.setTitle(Messages.ShowDocumentWithAction_OpenWith);
                                                                        if (dialog.open() != ListDialog.OK)
                                                                                return;
                                                                        EditorAdapter adapter = (EditorAdapter)dialog.getResult()[0];
                                                                        
                                                                        adapter.openEditor(reference);
                                                                } catch (Exception e) {
-                                                                       ExceptionUtils.logAndShowError("Cannot open editor", e);
+                                                                       ExceptionUtils.logAndShowError(Messages.ShowDocumentWithAction_CannotOpenEditor, e);
                                                                }
                                                        }
                                                });
index ec2da54a10f97597396a23747aecb1133d801f66..3811c8959a628ea5b55ab0fd23dee163a2a213c0 100644 (file)
@@ -1,6 +1,8 @@
 package org.simantics.document.linking.ge;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
@@ -71,8 +73,8 @@ public class SourceObjectDropAction implements DropActionFactory {
                                                                
                                                                @Override
                                                                public void run() {
-                                                                       String dialogMessage = "Cannot create document link to \"" + label +"\":" + e.getMessage();
-                                                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "Document Link", null, dialogMessage, MessageDialog.INFORMATION, new String[]{"OK"}, 0); 
+                                                                       String dialogMessage = NLS.bind(Messages.SourceObjectDropAction_CannotCreateDocumentLink , new Object[] { label , e.getMessage() }); 
+                                                                       MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.SourceObjectDropAction_DocumentLink, null, dialogMessage, MessageDialog.INFORMATION, new String[]{ IDialogConstants.OK_LABEL }, 0); 
                                                                        dialog.open();
                                                                }
                                                        });
index cf9d88c28cf02f3b179d07eb0e7613f0e7041b84..dc3e360804f79bf3a601560c70c9db1d6a07b680 100644 (file)
@@ -2,6 +2,7 @@ package org.simantics.document.linking.ge;
 
 import java.util.Map;
 
+import org.eclipse.osgi.util.NLS;
 import org.simantics.browsing.ui.model.labels.LabelRule;
 import org.simantics.databoard.Bindings;
 import org.simantics.db.ReadGraph;
@@ -41,22 +42,22 @@ public class VariableLabelRule implements LabelRule {
                 if (graph.isInstanceOf(node, sl.Source)) {
                        Resource reference = SourceLinkUtil.getReferredDocument(graph, node);
                        String comment = graph.getPossibleRelatedValue(node, sl.hasSourceComment);
-                       labels[0] = "";
-                       labels[1] = "";
-                       labels[3] = comment != null ? comment : "";
+                       labels[0] = ""; //$NON-NLS-1$
+                       labels[1] = ""; //$NON-NLS-1$
+                       labels[3] = comment != null ? comment : ""; //$NON-NLS-1$
                        
                        if (reference != null) {
                                if (SourceLinkUtil.isValidReference(graph, reference)) {
                                        labels[2] = NameUtils.getSafeLabel(graph, reference);
                                } else {
-                                       labels[2] = "Deleted reference";
+                                       labels[2] = Messages.VariableLabelRule_DeletedReference;
                                }
                                
                        } else {
                                if (graph.getPossibleRelatedValue(node, sl.hasSourceReferenceURI, Bindings.STRING) != null) {
-                                       labels[2] = "Reference does not exist";
+                                       labels[2] = Messages.VariableLabelRule_ReferencesDoesNotExists;
                                } else {
-                                       labels[2] = "Reference has not been set";
+                                       labels[2] = Messages.VariableLabelRule_ReferencesHasNotBeenSet;
                                }
                        }
                        
@@ -83,32 +84,32 @@ public class VariableLabelRule implements LabelRule {
                                        
                                        
                                } else {
-                                       labels[0] = "";
+                                       labels[0] = ""; //$NON-NLS-1$
                                }
                                
                                if (graph.hasValue(node)) {
                                        Object value = graph.getValue(node);
                                        labels[1] = SourceLinkUtil.getValueString(value);
                                } else if (!graph.isInstanceOf(node, l0.SCLValue)){
-                                       labels[1] = "No Value";
+                                       labels[1] = Messages.VariableLabelRule_NoValue;
                                } else {
-                                       labels[1] = "";
+                                       labels[1] = ""; //$NON-NLS-1$
                                }
                                
                                if (defaultValue) {
-                                       labels[1] +=" (default)";
+                                       NLS.bind(Messages.VariableLabelRule_LabelDefault,labels[1] );
                                }
-                               labels[2] = "";
-                               labels[3] = "";
+                               labels[2] = ""; //$NON-NLS-1$
+                               labels[3] = ""; //$NON-NLS-1$
                                
                 } else {
 
                                labels[0] = NameUtils.getSafeLabel(graph, node);//graph.getRelatedValue(node, l0.HasName);
                                if (labels[0].length() == 0)
                                        labels[0] = NameUtils.getSafeName(graph, node);//graph.getRelatedValue(node, l0.HasName);
-                               labels[1] = "";
-                               labels[2] = "";
-                               labels[3] = "";
+                               labels[1] = ""; //$NON-NLS-1$
+                               labels[2] = ""; //$NON-NLS-1$
+                               labels[3] = ""; //$NON-NLS-1$
                                
                                
                 }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/messages.properties
new file mode 100644 (file)
index 0000000..e539c4e
--- /dev/null
@@ -0,0 +1,19 @@
+Constants_Comment=Comment\r
+Constants_Name=Name\r
+Constants_ReferenceDocument=Reference Document\r
+Constants_RefernceDocument=Reference Document\r
+Constants_Value=Value\r
+FixAllReferencesAction_CannotFixReferences=Cannot fix references\r
+FixAllReferencesAction_FixOldReferences=Fix {0} old references and \r
+FixAllReferencesAction_FixReferences=Fix References\r
+FixAllReferencesAction_NothingToFix=Nothing to fix.\r
+ShowDocumentAction_CannotOpenEditor=Cannot open editor\r
+ShowDocumentWithAction_CannotOpenEditor=Cannot open editor\r
+ShowDocumentWithAction_OpenWith=Open with\r
+SourceObjectDropAction_CannotCreateDocumentLink=Cannot create document link to "{0}":{1}\r
+SourceObjectDropAction_DocumentLink=Document Link\r
+VariableLabelRule_DeletedReference=Deleted reference\r
+VariableLabelRule_LabelDefault={0} (default)\r
+VariableLabelRule_NoValue=No Value\r
+VariableLabelRule_ReferencesDoesNotExists=Reference does not exist\r
+VariableLabelRule_ReferencesHasNotBeenSet=Reference has not been set\r
index 8e39773cad62f02ed4d86ef3cceb7a5d5ec805b6..553dcecddb6caf92172e6c55975e5dd20205f3e3 100644 (file)
@@ -8,7 +8,7 @@ package org.simantics.document.linking.report;
  */
 public interface Document {
        
-       public static String TOC = "toc";
+       public static String TOC = "toc"; //$NON-NLS-1$
        
        public enum TextSize {TINY,SMALL,MEDIUM,LARGE,HUGE};
 
index d6a3b37b2317255fa210861ef8c20027e25e08e4..af2517718ceae72bac1ea8c5ec2e6ca9a1425888 100644 (file)
@@ -23,13 +23,13 @@ public abstract class DocumentTitlePage implements DocumentElement{
                ReportWriter<?> reportWriter = (ReportWriter<?>)context.get(ReportWriter.class);
                CustomizableContent content = null;
                if (reportWriter instanceof CustomizableContentProvider) {
-                       content = ((CustomizableContentProvider)reportWriter).getContent("Title");
+                       content = ((CustomizableContentProvider)reportWriter).getContent("Title"); //$NON-NLS-1$
                }
                if (content == null)
-                       writeTitle(getDefaultLines(graph, (Resource)context.get("model"), (String)context.get("DocumentName")));
+                       writeTitle(getDefaultLines(graph, (Resource)context.get("model"), (String)context.get("DocumentName"))); //$NON-NLS-1$ //$NON-NLS-2$
                else {
                        
-                       List<DocumentLine> lines = content.getLines(graph, (Resource)context.get("model"), context);
+                       List<DocumentLine> lines = content.getLines(graph, (Resource)context.get("model"), context); //$NON-NLS-1$
                        writeTitle(lines);
                }
        }
index 2bfdf79c0a0f850308fd03423eb24a62fee830cf..f9645042bbc2b8b5fc97f85b4f041d2286f8cd2c 100644 (file)
@@ -84,18 +84,18 @@ public class ExportToPDF {
                
                Document lineWriter = null;
                try {
-                       if (filename.toLowerCase().endsWith(".pdf"))
-                               lineWriter = new PDFDocument(filename, new Font("Arial", Font.PLAIN, 10),new Font("Arial", Font.BOLD, 10));
-                       else if (filename.toLowerCase().endsWith(".html") ||
-                                       filename.toLowerCase().endsWith(".htm"))
+                       if (filename.toLowerCase().endsWith(".pdf")) //$NON-NLS-1$
+                               lineWriter = new PDFDocument(filename, new Font("Arial", Font.PLAIN, 10),new Font("Arial", Font.BOLD, 10)); //$NON-NLS-1$ //$NON-NLS-2$
+                       else if (filename.toLowerCase().endsWith(".html") || //$NON-NLS-1$
+                                       filename.toLowerCase().endsWith(".htm")) //$NON-NLS-1$
                                lineWriter = new HTMLDocument(new File(filename));
                        else {
-                               throw new Exception("File has unknow extension " + filename);
+                               throw new Exception("File has unknow extension " + filename); //$NON-NLS-1$
                        }
                        export(lineWriter, reportWriter, monitor);
                        
                } catch (Exception e) {
-                       return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not generate report", e);
+                       return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportToPDF_ActivatorCouldNotGenerateReport, e);
                } finally {
                        if (lineWriter != null) {
                                try {
@@ -106,7 +106,7 @@ public class ExportToPDF {
                        }
                        
                }
-               String status  = "Report generated.";
+               String status  = Messages.ExportToPDF_ReportGenerated;
 //             if (lineWriter instanceof PDFTableWriter) {
 //                     status += " Report size " + ((PDFTableWriter)lineWriter).getCurrentPageIndex() + " pages.";
 //             }
@@ -124,16 +124,16 @@ public class ExportToPDF {
                                
                                try {
                                        Map<Object, Object> context = new HashMap<Object, Object>();
-                                       context.put("model", model);
+                                       context.put("model", model); //$NON-NLS-1$
                                        context.put(Document.class, document);
                                        context.put(ReportWriter.class, reportWriter);
-                                       context.put("DocumentName", reportWriter.getName());
+                                       context.put("DocumentName", reportWriter.getName()); //$NON-NLS-1$
                                        
                                        reportWriter.start(graph, model, document, context);
                                        
                                        List<T> list = reportWriter.getReportItems(graph);
                                        
-                               monitor.beginTask("Write Report", list.size());
+                               monitor.beginTask(Messages.ExportToPDF_MonitorWriteReport, list.size());
        
                                T previous = null;
                                T current = null;
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/Messages.java
new file mode 100644 (file)
index 0000000..1665104
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.document.linking.report;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.report.messages"; //$NON-NLS-1$
+       public static String ExportToPDF_ActivatorCouldNotGenerateReport;
+       public static String ExportToPDF_MonitorWriteReport;
+       public static String ExportToPDF_ReportGenerated;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 8876960a22b704714529817fd4dde42fb595855d..a56900d486e3381ccb7aaad47212b43c6104ae00 100644 (file)
@@ -72,11 +72,11 @@ public class AlignmentHint extends HintNode implements EnumEditableNode{
        @Override
        public ImageDescriptor getImage() {
                if (alignment == Alignment.LEFT) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_left.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_left.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (alignment == Alignment.CENTER) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_center.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_center.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_right.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_align_right.png"); //$NON-NLS-1$ //$NON-NLS-2$
                }
        }
        
index e2a264069d296560a5d188847443bea224e0472e..17aeb3cae159e4bbc1757a6d22125ba959675a9d 100644 (file)
@@ -31,7 +31,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
        
        
        public And() {
-               separator = " ";
+               separator = " "; //$NON-NLS-1$
        }
        
        public And(String separator) {
@@ -49,7 +49,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
-               String s = "";
+               String s = ""; //$NON-NLS-1$
                for (int i = 0 ; i < children.size(); i++) {
                        String s2 = children.get(i).getValue(graph, variable, context);
                        if (s2 != null) {
@@ -89,7 +89,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
 
        @Override
        public String toString() {
-               return "and " + "(" + separator +")" ;
+               return "and " + "(" + separator +")" ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        
        @RelatedGetValue(DocumentLink.URIs.EvaluatorTree_HasValue)
@@ -118,7 +118,7 @@ public class And extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_columns.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_columns.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index e33fa92fb62d8d145f454e8b25f11631a4ca0258..31cbe49b9f7d68f48304a243a85621b5dc2026c8 100644 (file)
@@ -20,12 +20,12 @@ public class Constant extends EvaluatorLeaf implements StringEditableNode{
        
        
        public Constant() {
-               string = "text";
+               string = "text"; //$NON-NLS-1$
        }
        
        public Constant(String text) {
                if (text == null)
-                       throw new NullPointerException("Text is null");
+                       throw new NullPointerException("Text is null"); //$NON-NLS-1$
                string = text;
        }
        
@@ -36,7 +36,7 @@ public class Constant extends EvaluatorLeaf implements StringEditableNode{
        
        @Override
        public String toString() {
-               return "\"" + string + "\"";
+               return "\"" + string + "\""; //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        @RelatedGetValue(DocumentLink.URIs.EvaluatorTree_HasValue)
@@ -64,7 +64,7 @@ public class Constant extends EvaluatorLeaf implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/textfield.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/textfield.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index d41a0616601392bfa676c313b25eaad1d9d71cb9..93efeffd9db75e12e13e7cb232b1efc7cc84a0d7 100644 (file)
@@ -161,7 +161,7 @@ public class DBUtil {
        
        public static List<NamedResource> getTemplates(final Resource library) throws DatabaseException{
                if (library == null)
-                       throw new IllegalArgumentException("Library cannot be null");
+                       throw new IllegalArgumentException("Library cannot be null"); //$NON-NLS-1$
                List<NamedResource> templates = Simantics.getSession().syncRequest(new Read<List<NamedResource>>() {
                @Override
                public List<NamedResource> perform(ReadGraph graph) throws DatabaseException{
index d1fa4486747011948c27f4058bef47c17eba05b4..8b9ed2b985ec4c27fde4525367549b23fbe2ce7d 100644 (file)
@@ -40,7 +40,7 @@ public class Date extends EvaluatorLeaf {
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/date.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/date.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index 2c0f0e766a74f40190217ddab4aba227f80e0a88..ab7eb1cb8a80ae65588dac0c90a9dd5d94d0b777 100644 (file)
@@ -63,7 +63,7 @@ public class EvaluatorRoot extends EvaluatorNode{
        
        @Override
        public String toString() {
-               return "root";
+               return "root"; //$NON-NLS-1$
        }
        
        @Override
index e0e7839391ca9fefc508d8dc32bf818db8a3c8af..4dc9219807cf17aa8c56be868aef56eac8b56845 100644 (file)
@@ -26,7 +26,7 @@ public class If extends EvaluatorNode{
        @Override
        public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
                if (children.size() > 3)
-                       throw new DatabaseException("If node has more than 3 children.");
+                       throw new DatabaseException("If node has more than 3 children."); //$NON-NLS-1$
                
                String ifVal = children.get(0).getValue(graph, variable, context);
                if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {
@@ -40,7 +40,7 @@ public class If extends EvaluatorNode{
        @Override
        public List<DocumentLine> getLines(ReadGraph graph,     Variable variable, Map<Object, Object> context) throws DatabaseException {
                if (children.size() > 3)
-                       throw new DatabaseException("If node has more than 3 children.");
+                       throw new DatabaseException("If node has more than 3 children."); //$NON-NLS-1$
                String ifVal = children.get(0).getValue(graph, variable, context);
                if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {
                        return children.get(1).getLines(graph, variable, context);
@@ -53,7 +53,7 @@ public class If extends EvaluatorNode{
 
        @Override
        public String toString() {
-               return "if";
+               return "if"; //$NON-NLS-1$
        }
        
        @Override
@@ -73,7 +73,7 @@ public class If extends EvaluatorNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/help.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/help.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        @Override
index 7d7abde42beeac330150348491c3336e4a1d7519..9b9c05182245c1937ae9daa1f14603fc8e126803 100644 (file)
@@ -27,13 +27,13 @@ public class Lines extends EvaluatorNode {
        
        @Override
        public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
-               String s = "";
+               String s = ""; //$NON-NLS-1$
                for (int i = 0 ; i < children.size(); i++) {
                        String s2 = children.get(i).getValue(graph, variable, context);
                        if (s2 != null) {
                                s+= s2;
                                if (i < children.size()-1)
-                                       s+=System.getProperty("line.separator");
+                                       s+=System.getProperty("line.separator"); //$NON-NLS-1$
                        }
                }
                if (s.length() == 0)
@@ -44,7 +44,7 @@ public class Lines extends EvaluatorNode {
 
        @Override
        public String toString() {
-               return "Lines" ;
+               return "Lines" ; //$NON-NLS-1$
        }
        
        
@@ -67,7 +67,7 @@ public class Lines extends EvaluatorNode {
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_linespacing.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_linespacing.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
 }
index c18a1b6e41c96cdcb5a82e77abaa6339fe86aa00..73bece892c0d8e5a9db91ba639fa920cedfd0121 100644 (file)
@@ -50,7 +50,7 @@ public class Or extends EvaluatorNode{
        
        @Override
        public String toString() {
-               return "or";
+               return "or"; //$NON-NLS-1$
        }
        
        @Override
@@ -62,7 +62,7 @@ public class Or extends EvaluatorNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_list_numbers.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_list_numbers.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        
index f3d67e69f03b887f0f60fdb48760cdd95063abc9..0860b8f686863bfc811ffb0af3035d32dc5e03c2 100644 (file)
@@ -24,7 +24,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        String separator;
        
        public Path() {
-               separator = "/";
+               separator = "/"; //$NON-NLS-1$
        }
        
        public Path(String separator) {
@@ -33,7 +33,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public String toString() {
-               return "path " + "(" + separator +")" ;
+               return "path " + "(" + separator +")" ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        
        @Override
@@ -56,8 +56,8 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        @Override
        public String getValue(ReadGraph graph, Variable variable,
                        Map<Object, Object> context) throws DatabaseException {
-               Resource model = (Resource)context.get("model");
-               String text = "";
+               Resource model = (Resource)context.get("model"); //$NON-NLS-1$
+               String text = ""; //$NON-NLS-1$
                Variable parent = variable.getParent(graph);
                while (parent != null) {
                        text = children.get(0).getValue(graph, parent, context) + separator + text;
@@ -74,7 +74,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        public List<DocumentLine> getLines(ReadGraph graph, Variable variable,
                        Map<Object, Object> context) throws DatabaseException {
                List<DocumentLine> result = new ArrayList<DocumentLine>();
-               Resource model = (Resource)context.get("model");
+               Resource model = (Resource)context.get("model"); //$NON-NLS-1$
                for (int i = 0 ; i < children.size(); i++) {
                        Variable parent = variable.getParent(graph);
                        while (parent != null) {
@@ -103,7 +103,7 @@ public class Path extends EvaluatorNode implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/folder.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
        @Override
index 86afc31b8c30990d1c3d8294e82b698b4f19e62a..c901784012796c805f247dee5c7710df75469dcc 100644 (file)
@@ -19,11 +19,11 @@ import org.simantics.layer0.Layer0;
  *
  */
 public class PredefinedVariables {
-       public static final String root = "root";
-       public static final String project = "project";
-       public static final String model = "model";
-       public static final String template = "template";
-       public static final String current = ".";
+       public static final String root = "root"; //$NON-NLS-1$
+       public static final String project = "project"; //$NON-NLS-1$
+       public static final String model = "model"; //$NON-NLS-1$
+       public static final String template = "template"; //$NON-NLS-1$
+       public static final String current = "."; //$NON-NLS-1$
 
 
        private static PredefinedVariables factory = new PredefinedVariables();
@@ -119,7 +119,7 @@ public class PredefinedVariables {
         if (colonInx != -1 && firstFlashInx != -1 && colonInx+1 == firstFlashInx && path.length() > firstFlashInx+1){
             String scheme = path.substring(0, colonInx);
             String absPath = path.substring(firstFlashInx+1);
-            if (scheme.equals("pre")){
+            if (scheme.equals("pre")){ //$NON-NLS-1$
                 int endOfPredefined1 = absPath.indexOf('/');
                 int endOfPredefined2 = absPath.indexOf('#');
                 if (endOfPredefined1 == -1 && endOfPredefined2 == -1)
@@ -150,7 +150,7 @@ public class PredefinedVariables {
 
         Variable property = null;
         if (relativePath != null){
-               if (relativePath.startsWith("/."))
+               if (relativePath.startsWith("/.")) //$NON-NLS-1$
                        relativePath = relativePath.substring(1);
             property = v.browsePossible(graph, relativePath);
         }
index df2ae2d8e2c4989142bdf43f49b96fb6029e70da..739c6e430d1d77c56a013ad4e96a440854131513 100644 (file)
@@ -74,15 +74,15 @@ public class TextSizeHint extends HintNode implements EnumEditableNode{
        @Override
        public ImageDescriptor getImage() {
                if (textSize == TextSize.TINY) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_5.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_5.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.SMALL) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_4.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_4.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.MEDIUM) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_3.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_3.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.LARGE) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_2.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_2.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else if (textSize == TextSize.HUGE) {
-                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_1.png");
+                       return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_heading_1.png"); //$NON-NLS-1$ //$NON-NLS-2$
                } else {
                        return null;
                }
index a55d73865e6b508f747ee8900a254ce34037c8f9..fdf92297e40532478aa717e28425e94b7a7bc445 100644 (file)
@@ -16,7 +16,7 @@ import org.simantics.objmap.graph.annotations.RelatedSetValue;
 @GraphType(DocumentLink.URIs.EvaluatorTree_Variable)
 public class Variable extends EvaluatorLeaf implements StringEditableNode{
        
-       String variableRef = "#HasName";
+       String variableRef = "#HasName"; //$NON-NLS-1$
        
        public Variable() {
                
@@ -66,7 +66,7 @@ public class Variable extends EvaluatorLeaf implements StringEditableNode{
        @Override
        public String setValue(String value) {
                if (value.length() == 0)
-                       return "Variable reference cannot be empty";
+                       return "Variable reference cannot be empty"; //$NON-NLS-1$
                variableRef = value;
                return null;
        }
@@ -84,7 +84,7 @@ public class Variable extends EvaluatorLeaf implements StringEditableNode{
        
        @Override
        public ImageDescriptor getImage() {
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/database_go.png");
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        
 
index 79fb2653f4b4622f2446cae6e3d1e29200b3a61e..cd62f25ad0820410a474ff438da9426cddffa27d 100644 (file)
@@ -62,7 +62,7 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
                        index = index + 1;
                uniqueIndex.put(cls,index);
                
-               return cls.getSimpleName() +"_"+index;
+               return cls.getSimpleName() +"_"+index; //$NON-NLS-1$
        }
        String getUniqueId(HTMLElement element) {
                Class<? extends HTMLElement> cls = element.getClass();
@@ -71,35 +71,35 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
        
        private static String getDataUrl() throws IOException {
                 Bundle b = Platform.getBundle(Activator.PLUGIN_ID);
-                URL dataUrl = FileLocator.find(b, new Path("report"), null);
+                URL dataUrl = FileLocator.find(b, new Path("report"), null); //$NON-NLS-1$
                 URL fileUrl = FileLocator.toFileURL(dataUrl);
-                return URLDecoder.decode(fileUrl.getPath(), "UTF-8"); 
+                return URLDecoder.decode(fileUrl.getPath(), "UTF-8");  //$NON-NLS-1$
        }
        
        private void copyBaseCSS(String cssUrl) throws Exception {
-               File f = new File(URLDecoder.decode(cssUrl, "UTF-8")).getAbsoluteFile();
+               File f = new File(URLDecoder.decode(cssUrl, "UTF-8")).getAbsoluteFile(); //$NON-NLS-1$
                copyData(f, os);
        }
 
        
        private void header() throws Exception {
                PrintStream resultOs = os;
-               String cssUrl = getDataUrl() +"/report.css";
-               resultOs.println("<!DOCTYPE html>");
-               resultOs.println("<html lang=\"en\">");
-               resultOs.println("<head>");
-               resultOs.println("  <meta charset=\"utf-8\">");
-               resultOs.println("  <title>Report</title>");
+               String cssUrl = getDataUrl() +"/report.css"; //$NON-NLS-1$
+               resultOs.println("<!DOCTYPE html>"); //$NON-NLS-1$
+               resultOs.println("<html lang=\"en\">"); //$NON-NLS-1$
+               resultOs.println("<head>"); //$NON-NLS-1$
+               resultOs.println("  <meta charset=\"utf-8\">"); //$NON-NLS-1$
+               resultOs.println("  <title>Report</title>"); //$NON-NLS-1$
                if (referCSS)
-                       resultOs.println("  <link rel=\"stylesheet\" href=\"" + cssUrl + "\" type=\"text/css\">");
-               resultOs.println("  <style>");
+                       resultOs.println("  <link rel=\"stylesheet\" href=\"" + cssUrl + "\" type=\"text/css\">"); //$NON-NLS-1$ //$NON-NLS-2$
+               resultOs.println("  <style>"); //$NON-NLS-1$
                if (!referCSS) {
                        copyBaseCSS(cssUrl);
                }
                
-               resultOs.println("  </style>");
-               resultOs.println("</head>");
-               resultOs.println("<body>");
+               resultOs.println("  </style>"); //$NON-NLS-1$
+               resultOs.println("</head>"); //$NON-NLS-1$
+               resultOs.println("<body>"); //$NON-NLS-1$
        }
 
        private void footer() throws Exception{
@@ -109,8 +109,8 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
                        toc.close();
                content.close();
                PrintStream resultOs = os;
-               resultOs.println("</body>");
-               resultOs.println("</html>");
+               resultOs.println("</body>"); //$NON-NLS-1$
+               resultOs.println("</html>"); //$NON-NLS-1$
        }
        
        @Override
@@ -147,7 +147,7 @@ public class HTMLDocument extends HTMLStreamElement implements Document {
                        return (T)getOrCreateToc();
                } else if (cls == DocumentTitlePage.class) {
                        if (titlePage != null)
-                               throw new Exception("Document many have only one title page");
+                               throw new Exception("Document many have only one title page"); //$NON-NLS-1$
                        titlePage = new HTMLTitlePage(this);
                        return (T)titlePage;
                }
index 20f3dcd124a17c22d0eff6292c93a38e6dc14c48..34d435ac706774d8bf1462a393476d142d40f6b6 100644 (file)
@@ -22,7 +22,7 @@ public class HTMLStreamElement implements HTMLElement{
        public HTMLStreamElement(File file) throws Exception{
                parent = null;
                this.file = file;
-               os = new PrintStream(file,"UTF-8");
+               os = new PrintStream(file,"UTF-8"); //$NON-NLS-1$
        }
        
        public HTMLStreamElement(HTMLStreamElement parent) throws Exception{
@@ -31,8 +31,8 @@ public class HTMLStreamElement implements HTMLElement{
        }
        
        private void openStream() throws IOException {
-               file = File.createTempFile("report_content", ".html");
-               os = new PrintStream(file,"UTF-8");
+               file = File.createTempFile("report_content", ".html"); //$NON-NLS-1$ //$NON-NLS-2$
+               os = new PrintStream(file,"UTF-8"); //$NON-NLS-1$
        }
        
 
index 2137dbb54a1f622e907a7961e603409dcc5bf198..86afa3e3dcda0511140fb0ca37d85639cc355a75 100644 (file)
@@ -115,35 +115,35 @@ public class HTMLTable extends HTMLTextElement implements Table {
        public TableRow writeRowRaw(List<String> line) throws Exception {
                if (currentLine == 0)
                        startTable();
-               String clz = "\"";
-               clz += currentLine % 2 == 0 ? "even" : "odd";
-               clz += " "+currentTextSize;
-               clz += "\"";
-               os.println("    <tr class=" + clz+ ">");
+               String clz = "\""; //$NON-NLS-1$
+               clz += currentLine % 2 == 0 ? "even" : "odd"; //$NON-NLS-1$ //$NON-NLS-2$
+               clz += " "+currentTextSize; //$NON-NLS-1$
+               clz += "\""; //$NON-NLS-1$
+               os.println("    <tr class=" + clz+ ">"); //$NON-NLS-1$ //$NON-NLS-2$
                if (line.size() > 1) {
                        for (int i = 0; i < line.size(); i++) {
                                String s = line.get(i);
                                Alignment a = columns.get(i).getAlignment();
-                               String tdClass = "class=\"" +a.toString()+"\"";
+                               String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                                
                                if (s != null)
-                                       os.println("      <td "+tdClass+">" + s + "</td>");
+                                       os.println("      <td "+tdClass+">" + s + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                else
-                                       os.println("      <td> </td>");
+                                       os.println("      <td> </td>"); //$NON-NLS-1$
                        }
                } else if (line.size() == 1){
                        String s = line.get(0);
                        Alignment a = columns.get(0).getAlignment();
-                       String tdClass = "class=\"" +a.toString()+"\"";
+                       String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                        if (s != null)
-                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>");
+                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                        else
-                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                        
                } else {
-                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                }
-               os.println("    </tr>");
+               os.println("    </tr>"); //$NON-NLS-1$
                currentLine++;
                writer.currentLine++;
                return new HTMLTableRow(null);
@@ -152,35 +152,35 @@ public class HTMLTable extends HTMLTextElement implements Table {
        public TableRow writeRowRaw2(List<TextItem> line) throws Exception {
                if (currentLine == 0)
                        startTable();
-               String clz = "\"";
-               clz += currentLine % 2 == 0 ? "even" : "odd";
-               clz += " "+currentTextSize;
-               clz += "\"";
-               os.println("    <tr class=" + clz+ ">");
+               String clz = "\""; //$NON-NLS-1$
+               clz += currentLine % 2 == 0 ? "even" : "odd"; //$NON-NLS-1$ //$NON-NLS-2$
+               clz += " "+currentTextSize; //$NON-NLS-1$
+               clz += "\""; //$NON-NLS-1$
+               os.println("    <tr class=" + clz+ ">"); //$NON-NLS-1$ //$NON-NLS-2$
                if (line.size() > 1) {
                        for (int i = 0; i < line.size(); i++) {
                                TextItem item = line.get(i);
                                Alignment a = columns.get(i).getAlignment();
-                               String tdClass = "class=\"" +a.toString()+"\"";
+                               String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                                
                                if (item != null && item.getText() != null)
-                                       os.println("      <td "+tdClass+">" + item.toString() + "</td>");
+                                       os.println("      <td "+tdClass+">" + item.toString() + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                else
-                                       os.println("      <td> </td>");
+                                       os.println("      <td> </td>"); //$NON-NLS-1$
                        }
                } else if (line.size() == 1){
                        String s = line.get(0).toString();
                        Alignment a = columns.get(0).getAlignment();
-                       String tdClass = "class=\"" +a.toString()+"\"";
+                       String tdClass = "class=\"" +a.toString()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
                        if (s != null)
-                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>");
+                               os.println("      <td "+tdClass + " colspan=\"" + columns.size()+"\">" + s + "</td>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                        else
-                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                               os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                        
                } else {
-                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>");
+                       os.println("      <td colspan=\"" + columns.size()+"\"> </td>"); //$NON-NLS-1$ //$NON-NLS-2$
                }
-               os.println("    </tr>");
+               os.println("    </tr>"); //$NON-NLS-1$
                currentLine++;
                writer.currentLine++;
                return new HTMLTableRow(null);
@@ -208,45 +208,45 @@ public class HTMLTable extends HTMLTextElement implements Table {
        
        void style() {
                for (int i = 0; i < columns.size(); i++) {
-                       os.println("table."+classID+" th.column"+i+" {");
-                       os.println("  width: " + ((int)(columns.get(i).getWidth()*100.0)) + "%;");
-                       os.println("}");
+                       os.println("table."+classID+" th.column"+i+" {"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                       os.println("  width: " + ((int)(columns.get(i).getWidth()*100.0)) + "%;"); //$NON-NLS-1$ //$NON-NLS-2$
+                       os.println("}"); //$NON-NLS-1$
                }
        }
        
        void startTable() {
                
                if (id != null) {
-                       os.println("<a id=\"" + id + "\"></a>");
+                       os.println("<a id=\"" + id + "\"></a>"); //$NON-NLS-1$ //$NON-NLS-2$
                }       
-               String clz = classID + " " + (linesVisible ? "lines" : "nolines");
-               os.println("<table class=\"" + clz +"\" >");
+               String clz = classID + " " + (linesVisible ? "lines" : "nolines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+               os.println("<table class=\"" + clz +"\" >"); //$NON-NLS-1$ //$NON-NLS-2$
                
                if (headerVisible) {
                        if (title != null)
-                               os.println("  <caption>"+title+"</caption>");
-                       os.println("  <thead>");
-                       os.println("    <tr class=MEDIUM>");
+                               os.println("  <caption>"+title+"</caption>"); //$NON-NLS-1$ //$NON-NLS-2$
+                       os.println("  <thead>"); //$NON-NLS-1$
+                       os.println("    <tr class=MEDIUM>"); //$NON-NLS-1$
                        int ci = 0;
                        for (TableColumn c : columns) {
-                          os.println("      <th class=\"column" + ci +"\">" + escape(c.getName()) + "</th>");
+                          os.println("      <th class=\"column" + ci +"\">" + escape(c.getName()) + "</th>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                           ci++;
                        }
-                       os.println("    </tr>");
-                       os.println("  </thead>");
+                       os.println("    </tr>"); //$NON-NLS-1$
+                       os.println("  </thead>"); //$NON-NLS-1$
                }
-               os.println("  <tbody>");
+               os.println("  <tbody>"); //$NON-NLS-1$
        }
        
        void endTable() throws Exception{
                if (currentLine > 0) {
-                       os.println("  </tbody>");
-                       os.println("</table>");
-                       os.println("<br>");
+                       os.println("  </tbody>"); //$NON-NLS-1$
+                       os.println("</table>"); //$NON-NLS-1$
+                       os.println("<br>"); //$NON-NLS-1$
                        if (!copyStyle) {
-                               os.println("<style>");
+                               os.println("<style>"); //$NON-NLS-1$
                                style();
-                               os.println("</style>");
+                               os.println("</style>"); //$NON-NLS-1$
                        }
                }
        }
index 08e4232ce7adc815fd4806b14500421680ecd683..747b5a4a4f89deba49ce8f1289b69f799ea6faeb 100644 (file)
@@ -18,30 +18,30 @@ public class HTMLTitlePage extends DocumentTitlePage implements HTMLElement{
        public void writeTitle(List<DocumentLine> lines) throws Exception {
                writer.nextPage();
                for (DocumentLine line : lines) {
-                       String hTag = "h4";
+                       String hTag = "h4"; //$NON-NLS-1$
                        if (line.getHints().containsKey(TextSize.class)) {
                                TextSize size = (TextSize)line.getHints().get(TextSize.class);
                                switch (size) {
                                case HUGE:
-                                       hTag = "h1";
+                                       hTag = "h1"; //$NON-NLS-1$
                                        break;
                                case LARGE:
-                                       hTag = "h2";
+                                       hTag = "h2"; //$NON-NLS-1$
                                        break;
                                case MEDIUM:
-                                       hTag = "h3";
+                                       hTag = "h3"; //$NON-NLS-1$
                                        break;
                                case SMALL:
-                                       hTag = "h4";
+                                       hTag = "h4"; //$NON-NLS-1$
                                        break;
                                case TINY:
-                                       hTag = "h5";
+                                       hTag = "h5"; //$NON-NLS-1$
                                        break;
                                default:
                                        break;
                                }
                        }
-                       writer.os.println("<"+hTag +">" + line.getLine() + "</"+hTag+">");
+                       writer.os.println("<"+hTag +">" + line.getLine() + "</"+hTag+">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                }
                writer.nextPage();
                
index a2613c061908e7c06c530088cb0b6b8601cdc802..eada4913b015ebec16eeaa278e58b71ccc61e0e2 100644 (file)
@@ -12,31 +12,31 @@ public class HTMLTocElement extends HTMLStreamElement implements TableOfContents
        
        public HTMLTocElement(HTMLDocument writer) throws Exception{
                super(writer);
-               this.os.println("<h2>Table of Contents</h2>");
+               this.os.println(Messages.HTMLTocElement_TocHeading);
                tocTable = new HTMLTable(writer, os, false);
                tocTable.setHeaderVisible(false);
                tocTable.setLinesVisible(false);
-               tocTable.addColumn("Name", 1.0);
+               tocTable.addColumn("Name", 1.0); //$NON-NLS-1$
        }
        
        @Override
        public void addTocElement(String label, DocumentElement element) throws Exception{
                HTMLElement e = (HTMLElement)element;
                if (e.getId() == null)
-                       throw new IllegalArgumentException("Element has no id " + element);
+                       throw new IllegalArgumentException("Element has no id " + element); //$NON-NLS-1$
                //os.println("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
-               tocTable.writeRow("<a href=\"#" + e.getId() + "\">" + label + "</a><br>");
+               tocTable.writeRow("<a href=\"#" + e.getId() + "\">" + label + "</a><br>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        
        public void close() throws Exception{
                tocTable.endTable();
-               os.print("<br>");
+               os.print("<br>"); //$NON-NLS-1$
                super.close();
        }
        
        @Override
        public String getId() {
-               return "toc";
+               return "toc"; //$NON-NLS-1$
        }
 
 }
index d1314350b4abbec5c8fabe94678db068a40e6ced..071043e72fd0d18bb6545589c1932fb2402373b6 100644 (file)
@@ -8,7 +8,7 @@ public class HTMLURLItemImpl extends URLItemImpl{
        @Override
        public String toString() {
                if (getURL() != null)
-                       return "<a href=\"" + getURL().toString() + "\">" + getText() + "</a>";
+                       return "<a href=\"" + getURL().toString() + "\">" + getText() + "</a>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                return super.toString();
        }
 
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/Messages.java
new file mode 100644 (file)
index 0000000..42c59e6
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.document.linking.report.html;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.simantics.document.linking.report.html.messages"; //$NON-NLS-1$
+    public static String        HTMLTocElement_TocHeading;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/html/messages.properties
new file mode 100644 (file)
index 0000000..ab00f27
--- /dev/null
@@ -0,0 +1 @@
+HTMLTocElement_TocHeading=<h2>Table of Contents</h2>
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/messages.properties
new file mode 100644 (file)
index 0000000..f7cc917
--- /dev/null
@@ -0,0 +1,3 @@
+ExportToPDF_ActivatorCouldNotGenerateReport=Could not generate report\r
+ExportToPDF_MonitorWriteReport=Write Report\r
+ExportToPDF_ReportGenerated=Report generated.\r
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/Messages.java
new file mode 100644 (file)
index 0000000..3560e83
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.document.linking.report.pdf;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.simantics.document.linking.report.pdf.messages"; //$NON-NLS-1$
+    public static String        PDFTocElement_TocHeading;
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
index ce0c423e26ede5f1dfaeb7f9d3bdc18a1f768a7f..dd1315bf5daba20255991a32d0d8d91680e4bf0a 100644 (file)
@@ -56,11 +56,11 @@ public class PDFDocument implements Document {
        }
        
        private void defaultFonts() {
-               fonts.put(TextSize.TINY, new Font("Arial", Font.PLAIN, 6));
-               fonts.put(TextSize.SMALL, new Font("Arial", Font.PLAIN, 8));
-               fonts.put(TextSize.MEDIUM, new Font("Arial", Font.PLAIN, 10));
-               fonts.put(TextSize.LARGE, new Font("Arial", Font.PLAIN, 16));
-               fonts.put(TextSize.HUGE, new Font("Arial", Font.BOLD, 24));
+               fonts.put(TextSize.TINY, new Font("Arial", Font.PLAIN, 6)); //$NON-NLS-1$
+               fonts.put(TextSize.SMALL, new Font("Arial", Font.PLAIN, 8)); //$NON-NLS-1$
+               fonts.put(TextSize.MEDIUM, new Font("Arial", Font.PLAIN, 10)); //$NON-NLS-1$
+               fonts.put(TextSize.LARGE, new Font("Arial", Font.PLAIN, 16)); //$NON-NLS-1$
+               fonts.put(TextSize.HUGE, new Font("Arial", Font.BOLD, 24)); //$NON-NLS-1$
                contentStream.setDefaultFont(fonts.get(TextSize.SMALL));
        }
        
@@ -103,7 +103,7 @@ public class PDFDocument implements Document {
                        return (T)getOrCreateToc();
                } else if (cls == DocumentTitlePage.class) {
                        if (titlePage != null)
-                               throw new Exception("Report may contain only one title page");
+                               throw new Exception("Report may contain only one title page"); //$NON-NLS-1$
                        titlePage =  new PDFTitlePage(this);
                        return (T)titlePage;
                }
@@ -160,7 +160,7 @@ public class PDFDocument implements Document {
                if (currentTable != null && currentTable.currentLine > 0) {
                        currentTable.setLinesVisible(false);
                        currentTable.setHeaderVisible(false);
-                       currentTable.writeLine("");
+                       currentTable.writeLine(""); //$NON-NLS-1$
                }
        }
        
index f4f376a415da820abe9121256d7713b2e83f0216..fc0d4a0d18be7875d247311f8c9fa65cd0053523 100644 (file)
@@ -35,7 +35,7 @@ public class PDFPage {
                this.stream = stream;
                Rectangle pageSize = stream.getPageSize();
                document = new Document(pageSize);
-               tempFile = File.createTempFile("ReportGenerator", ".pdf");
+               tempFile = File.createTempFile("ReportGenerator", ".pdf"); //$NON-NLS-1$ //$NON-NLS-2$
                writer = PdfWriter.getInstance(document, new FileOutputStream(tempFile));
                document.open();
                this.cb = writer.getDirectContent();
index 902d27159d219ac79c098cbe868b9605d4821b8a..69f782f145815b3d764dafeb6ddcca5fd0c2e8a0 100644 (file)
@@ -595,7 +595,7 @@ public class PDFTable implements Table, PDFElement {
             // Find possible line break and set it as a limit to the next layout
             next = lineMeasurer.nextOffset(cellWidth);
             limit = next;
-            charat = text.indexOf(System.getProperty("line.separator"),position+1);
+            charat = text.indexOf(System.getProperty("line.separator"),position+1); //$NON-NLS-1$
             if(charat < next && charat != -1){
                limit = charat;
             }
index d724b088543dffc41a11d6892a452f30ab33d061..7b49ca990bb2e204b030bfc49f0682e11d1f6bfb 100644 (file)
@@ -34,13 +34,13 @@ public class PDFTitlePage extends DocumentTitlePage implements PDFElement {
                document.nextPage();
                this.page = document.contentStream.getCurrentPage();
                Table table = document.newElement(Table.class);
-               table.addColumn("Names", 1.0).setAlignment(alignment);
+               table.addColumn("Names", 1.0).setAlignment(alignment); //$NON-NLS-1$
                table.setLinesVisible(false);
                table.setHeaderVisible(false);
                table.setTextSize(textSize);
                int lines = (document.contentStream.getAvailableLines()-3)/2;
                for (int i = 0; i < lines; i++)
-                       table.writeRow("");
+                       table.writeRow(""); //$NON-NLS-1$
                for (DocumentLine line : titleLines) {
                        TextSize s = (TextSize)line.getHints().get(TextSize.class);
                        if (s != null)
index c6fc5330eecddcd0612a924d468d5c90d1aab9da..03c77cdcc74f956446f237b51cbf03a18b508e9c 100644 (file)
@@ -37,9 +37,9 @@ public class PDFTocElement implements TableOfContents {
                //linesPerPage = stream.getAvailableLines();
                PDFPage page = stream.getCurrentPage();
                page.setFont(titleFont);
-               page.writeLine("Table of Contents");
+               page.writeLine(Messages.PDFTocElement_TocHeading);
                page.setFont(itemFont);
-               page.writeLine("");
+               page.writeLine(""); //$NON-NLS-1$
                linesOnFirstPage = tocTable.getAvailableLines();
                //linesOnFirstPage = page.availableLines;
        }
@@ -55,8 +55,8 @@ public class PDFTocElement implements TableOfContents {
                List<PDFPage> pages = destStream.getPages();
                int tocIndex = pages.indexOf(after)+1;
                
-               tocTable.addColumn("Document", 0.9);
-               tocTable.addColumn("Page", 0.1).setAlignment(Alignment.RIGHT);
+               tocTable.addColumn("Document", 0.9); //$NON-NLS-1$
+               tocTable.addColumn("Page", 0.1).setAlignment(Alignment.RIGHT); //$NON-NLS-1$
                tocTable.setHeaderVisible(false);
                tocTable.setLinesVisible(false);
                for (Pair<String, PDFElement> item : toc) {
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/pdf/messages.properties
new file mode 100644 (file)
index 0000000..3c8f29c
--- /dev/null
@@ -0,0 +1 @@
+PDFTocElement_TocHeading=Table of Contents
index dd4de82204f125e6cd02b36e2bf7407cffe2f663..ccfc9ea4414739c07011399773696efaa6055899 100644 (file)
@@ -50,7 +50,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                
                @Override
                public String getName() {
-                       return "Complete Structure";
+                       return "Complete Structure"; //$NON-NLS-1$
                }
                
                @Override
@@ -67,11 +67,11 @@ public class CompleteStructureWriter extends IndexQueryReport {
                        writer.newElement(TableOfContents.class);
                        Table table = writer.newElement(Table.class,Document.TOC);
                        
-                       table.addColumn("Name", 0.2);
-                       table.addColumn("Attribute", 0.2);
-                       table.addColumn("Value", 0.15);
-                       table.addColumn("Document", 0.2);
-                       table.addColumn("Comment", 0.25);
+                       table.addColumn("Name", 0.2); //$NON-NLS-1$
+                       table.addColumn("Attribute", 0.2); //$NON-NLS-1$
+                       table.addColumn("Value", 0.15); //$NON-NLS-1$
+                       table.addColumn("Document", 0.2); //$NON-NLS-1$
+                       table.addColumn("Comment", 0.25); //$NON-NLS-1$
                        
                        //lineWriter.nextPage();
                        
@@ -112,7 +112,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                        }
                                        
                                        if (obj != null) {
-                                               String text = "";
+                                               String text = ""; //$NON-NLS-1$
                                                List<Resource> path = SourceLinkUtil.getDiagramPath(graph, model, obj);
                                                
                                                if (path == null) {
@@ -121,14 +121,14 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                                                Resource r = path.get(i);
                                                                text += parentComparator.getText(r);
                                                                if (i < path.size()-2)
-                                                                       text += "/";
+                                                                       text += "/"; //$NON-NLS-1$
                                                        }
                                                } else {
                                                        for (int i = 0 ; i < path.size(); i++) {
                                                                Resource r = path.get(i);
                                                                text += parentComparator.getText(r);
                                                                if (i < path.size()-1)
-                                                                       text += "/";
+                                                                       text += "/"; //$NON-NLS-1$
                                                        }
                                                }
                                                //row[0] = text;
@@ -138,7 +138,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                                toc.addTocElement(text, table);
                                        } else {
                                                //row[0] =  "Hierarchy missing";
-                                               table.setTitle("Hierarchy missing");
+                                               table.setTitle("Hierarchy missing"); //$NON-NLS-1$
                                        }
                                }
                        }
@@ -170,7 +170,7 @@ public class CompleteStructureWriter extends IndexQueryReport {
                                                        text[2].setText(SourceLinkUtil.getValueString(value));
                                                }
                                        } else {
-                                               text[1].setText("Error in property reference");
+                                               text[1].setText(Messages.CompleteStructureWriter_ErrorInPropertyRefrence);
                                        }
                                }
                                Resource document = SourceLinkUtil.getReferredDocument(graph, source);
index 806cc47fb336d952faa7bbb14dc3f46658d14860..854863e27f91b70a35048db9fce910947ce11ef6 100644 (file)
@@ -16,7 +16,7 @@ public class DiagramStructureWithDependenciesWriter extends DiagramStructureWrit
        
        @Override
        public String getName() {
-               return "Diagram structure with dependencies";
+               return "Diagram structure with dependencies"; //$NON-NLS-1$
        }
        
        @Override
index c7fa811e43fc27a89e97f312daec0317b5aab526..79714ac6337f491ba8d1dd0c815e4f4cadc03494 100644 (file)
@@ -31,7 +31,7 @@ public class DiagramStructureWriter extends DocumentWriter<Resource>{
        
        @Override
        public String getName() {
-               return "Diagram structure";
+               return "Diagram structure"; //$NON-NLS-1$
        }
        
        @Override
@@ -43,8 +43,8 @@ public class DiagramStructureWriter extends DocumentWriter<Resource>{
                titlePage.writeTitle(graph, context);
                
                Table table = lineWriter.newElement(Table.class);
-               table.addColumn("Name", 0.4);
-               table.addColumn("Document", 0.6);
+               table.addColumn("Name", 0.4); //$NON-NLS-1$
+               table.addColumn("Document", 0.6); //$NON-NLS-1$
                
                //lineWriter.nextPage();
                
@@ -100,16 +100,16 @@ public class DiagramStructureWriter extends DocumentWriter<Resource>{
                                        List<Resource> path = SourceLinkUtil.getDiagramPath(graph, model, obj);
                                        if (writer.getAvailableLines() < 2)
                                                writer.nextPage();
-                                       String text = "";
+                                       String text = ""; //$NON-NLS-1$
                                        for (int i = 0 ; i < path.size(); i++) {
                                                Resource r = path.get(i);
                                                text += diagramComparator.getText(r);
                                                if (i < path.size()-1)
-                                                       text += "/";
+                                                       text += "/"; //$NON-NLS-1$
                                        }
                                        row[0].setText(text);
                                } else {
-                                       row[0].setText("Hierarchy missing");
+                                       row[0].setText(Messages.DiagramStructureWriter_Hierarchymissing);
                                }
                        }
                        
index 6b8ae70a221ff387ad8591423ceaf757932731d5..fffc16b23ebefe49ba2cbac2ed8d51eea0d6a157 100644 (file)
@@ -52,7 +52,7 @@ public class DocumentStructureWriter extends IndexQueryReport {
        
        @Override
        public String getName() {
-               return "Document Structure";
+               return "Document Structure"; //$NON-NLS-1$
        }
        
        @Override
@@ -63,10 +63,10 @@ public class DocumentStructureWriter extends IndexQueryReport {
                titlePage.writeTitle(graph, context);
                writer.newElement(TableOfContents.class);
                Table table = writer.newElement(Table.class,Document.TOC);
-               table.addColumn("Name", 0.2);
-               table.addColumn("Attribute", 0.35);
-               table.addColumn("Value", 0.15);
-               table.addColumn("Comment", 0.3);
+               table.addColumn("Name", 0.2); //$NON-NLS-1$
+               table.addColumn("Attribute", 0.35); //$NON-NLS-1$
+               table.addColumn("Value", 0.15); //$NON-NLS-1$
+               table.addColumn("Comment", 0.3); //$NON-NLS-1$
                
                //lineWriter.nextPage();
                this.graph = graph;
@@ -159,7 +159,7 @@ public class DocumentStructureWriter extends IndexQueryReport {
                                if (path != null) {
                                        TextSize size = table.getTextSize();
                                        table.setTextSize(TextSize.MEDIUM);
-                                       table.writeRow("  " + diagramComparator.getText(path.get(path.size()-1)));
+                                       table.writeRow("  " + diagramComparator.getText(path.get(path.size()-1))); //$NON-NLS-1$
                                        table.setTextSize(size);
                                }
                        }
@@ -198,7 +198,7 @@ public class DocumentStructureWriter extends IndexQueryReport {
                                                text[2].setText(SourceLinkUtil.getValueString(value));
                                        }
                                } else {
-                                       text[1].setText("Error in property reference ");
+                                       text[1].setText(Messages.DocumentStructureWriter_ErrorInPropertyReference);
                                }
                        }
                        
index 1f47964376f6540f380fbd4f29c77eb6a85be1ed..485e18efc4d29c02e0269cc527fb3709c996ec5d 100644 (file)
@@ -58,29 +58,29 @@ public abstract  class DocumentWriter<T> extends TableReportWriter<T> implements
        
        @Override
        public void setDefaultContent(String id) {
-               if ("Document".equals(id) || id == null) {
-                       EvaluatorCustomizableContent c = new EvaluatorCustomizableContent("Document format");
+               if ("Document".equals(id) || id == null) { //$NON-NLS-1$
+                       EvaluatorCustomizableContent c = new EvaluatorCustomizableContent("Document format"); //$NON-NLS-1$
                        Or item = new Or();
-                       item.addChild(new Variable("#HasLabel"));
-                       item.addChild(new Variable("#HasName"));
+                       item.addChild(new Variable("#HasLabel")); //$NON-NLS-1$
+                       item.addChild(new Variable("#HasName")); //$NON-NLS-1$
                        c.setItem(item);
                        c.setSupportStyles(false);
                        c.setSupportMultiline(true);
-                       content.put("Document", c);
+                       content.put("Document", c); //$NON-NLS-1$
                } 
-               if ("Title".equals(id) || id == null) {
-                       EvaluatorCustomizableContent e = new EvaluatorCustomizableContent("Document Title");
+               if ("Title".equals(id) || id == null) { //$NON-NLS-1$
+                       EvaluatorCustomizableContent e = new EvaluatorCustomizableContent("Document Title"); //$NON-NLS-1$
                        EvaluatorNode lines = new Lines();
                        Or nameOr = new Or();
-                       nameOr.createChild(Variable.class).setVariableRef("#HasLabel");
-                       nameOr.createChild(Variable.class).setVariableRef("#HasName");
+                       nameOr.createChild(Variable.class).setVariableRef("#HasLabel"); //$NON-NLS-1$
+                       nameOr.createChild(Variable.class).setVariableRef("#HasName"); //$NON-NLS-1$
                        lines.createChild(TextSizeHint.class).setTextSize(TextSize.HUGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).addChild(nameOr.copy());
-                       lines.createChild(TextSizeHint.class).setTextSize(TextSize.HUGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).createChild(Variable.class).setVariableRef("DocumentName");
+                       lines.createChild(TextSizeHint.class).setTextSize(TextSize.HUGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).createChild(Variable.class).setVariableRef("DocumentName"); //$NON-NLS-1$
                        lines.createChild(TextSizeHint.class).setTextSize(TextSize.LARGE).createChild(AlignmentHint.class).setAlignment(Alignment.CENTER).createChild(Date.class);
                        e.setItem(lines);
                        e.setSupportStyles(true);
                        e.setSupportMultiline(true);
-                       content.put("Title", e);
+                       content.put("Title", e); //$NON-NLS-1$
                }
        }
        
@@ -97,13 +97,13 @@ public abstract  class DocumentWriter<T> extends TableReportWriter<T> implements
                } else {
                        item = this.document.newItem(TextItem.class);
                }
-               item.setText(getContent("Document").getContent(graph, document,context));
+               item.setText(getContent("Document").getContent(graph, document,context)); //$NON-NLS-1$
                return item;
        }
        
        protected TextItem getNonExistingDocumentItem() throws Exception{
                TextItem item = this.document.newItem(TextItem.class);
-               item.setText("[DOCUMENT DOES NOT EXIST]");
+               item.setText(Messages.DocumentWriter_DocumentDoesNotExist);
                return item;
        }
 
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/Messages.java
new file mode 100644 (file)
index 0000000..b01b531
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.document.linking.report.templates;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.report.templates.messages"; //$NON-NLS-1$
+       public static String CompleteStructureWriter_ErrorInPropertyRefrence;
+       public static String DiagramStructureWriter_Hierarchymissing;
+       public static String DocumentStructureWriter_ErrorInPropertyReference;
+       public static String DocumentWriter_DocumentDoesNotExist;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index b0f94261a9e283b0a38b05243b56119b87fa24c5..0ac9417a7d93385311bc86c1951a13e5f8d78d76 100644 (file)
@@ -53,7 +53,7 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
        
        @Override
        public String getName() {
-               return "Model Internal Documents";
+               return "Model Internal Documents"; //$NON-NLS-1$
        }
        
        @Override
@@ -64,8 +64,8 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
                DocumentTitlePage titlePage = lineWriter.newElement(DocumentTitlePage.class);
                titlePage.writeTitle(graph, context);
                Table table = lineWriter.newElement(Table.class);
-               table.addColumn("Folder", 0.4);
-               table.addColumn("Document", 0.6);
+               table.addColumn("Folder", 0.4); //$NON-NLS-1$
+               table.addColumn("Document", 0.6); //$NON-NLS-1$
                
                //lineWriter.nextPage();
                this.graph = graph;
@@ -119,10 +119,10 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
        
        
        private String getText(List<Resource> current, boolean indent) throws DatabaseException {
-               String text = "";
+               String text = ""; //$NON-NLS-1$
                if (indent)
                        for (int i = 0; i < current.size()-1; i++) {
-                               text += "  ";
+                               text += "  "; //$NON-NLS-1$
                        }
                
                text += NameUtils.getSafeLabel(graph, current.get(current.size()-1));
@@ -195,12 +195,12 @@ public class ModelDocumentWriter extends  DocumentWriter<List<Resource>> {
        
        private class DocumentContentProvider implements RowContentProvider<List<Resource>> {
                public void setText(Document writer, java.util.List<Resource> previous, java.util.List<Resource> current, java.util.List<Resource> next, TextItem[] row) throws Exception {
-                       String s = "";
+                       String s = ""; //$NON-NLS-1$
                        
                        Resource document = current.get(current.size()-1);
                        int rev = revisionIndex(document);
                        for (int i = 0; i < rev; i++)
-                               s += "  ";
+                               s += "  "; //$NON-NLS-1$
                        row[1] = getDocumentItem(document);
                        row[1].setText(s + row[1].getText());
                };
index 5891ccb268e1d69ef4c3e1eaed6cfccdafed62cc..a3da49b10332fcb4af92062b08a962134b83609f 100644 (file)
@@ -40,7 +40,7 @@ public class ReferredDocumentWriter extends ModelDocumentWriter{
 
        @Override
        public String getName() {
-               return "Referred Documents";
+               return "Referred Documents"; //$NON-NLS-1$
        }
        
 
index 7394154662ae18e7a0538b6acef0d39564e4d999..dbc02e72ce9cc9e82de9da85934fc8fa7673b4a1 100644 (file)
@@ -34,7 +34,7 @@ public class EvaluatorCustomizableContent implements CustomizableContent{
        public String getContent(ReadGraph graph, Resource resource, Map<Object, Object> context)
                        throws DatabaseException {
                if (!SourceLinkUtil.isValidReference(graph, resource))
-                       return "Deleted reference";
+                       return "Deleted reference"; //$NON-NLS-1$
                Variable variable = graph.adapt(resource, Variable.class);
                return item.getValue(graph, variable,context);
        }
@@ -43,7 +43,7 @@ public class EvaluatorCustomizableContent implements CustomizableContent{
        public List<DocumentLine> getLines(ReadGraph graph, Resource resource, Map<Object, Object> context)
                        throws DatabaseException {
                if (!SourceLinkUtil.isValidReference(graph, resource))
-                       return Collections.singletonList(new DocumentLine("Deleted reference"));
+                       return Collections.singletonList(new DocumentLine("Deleted reference")); //$NON-NLS-1$
                Variable variable = graph.adapt(resource, Variable.class);
                return item.getLines(graph, variable,context);
        }
index 09fb371948deb5e592b2b1dc5ed5a47f4c08a3fc..126591a5344140b0509f24678f61e3d9af31ab21 100644 (file)
@@ -32,11 +32,11 @@ public class SCLCustomizableContent implements CustomizableContent {
        public SCLCustomizableContent(String label) {
                session = new CommandSession(SCLOsgi.MODULE_REPOSITORY, null);
                
-               sclCode = new String[]{"import \"Simantics/Ontologies\"",
-                                      "nameOfResource r = match possibleRelatedValue r L0.HasName with\n"+
-                               "    Just name -> name\n"+
-                               "    Nothing -> \"no name\"",
-                               "nameOfResource res"};                          
+               sclCode = new String[]{"import \"Simantics/Ontologies\"", //$NON-NLS-1$
+                                      "nameOfResource r = match possibleRelatedValue r L0.HasName with\n"+ //$NON-NLS-1$
+                               "    Just name -> name\n"+ //$NON-NLS-1$
+                               "    Nothing -> \"no name\"", //$NON-NLS-1$
+                               "nameOfResource res"};                           //$NON-NLS-1$
        }
        
        @Override
@@ -48,7 +48,7 @@ public class SCLCustomizableContent implements CustomizableContent {
        public String getContent(ReadGraph graph, Resource resource, Map<Object, Object> context)
                        throws DatabaseException {
                
-               session.setVariable("res", Types.con("Simantics/DB", "Resource"), resource);
+               session.setVariable("res", Types.con("Simantics/DB", "Resource"), resource); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                final StringBuilder responseBuilder = new StringBuilder();
                final StringBuilder errorBuilder = new StringBuilder();
                for (String code : sclCode) {
@@ -69,7 +69,7 @@ public class SCLCustomizableContent implements CustomizableContent {
                 }
             });
                        if(errorBuilder.length() > 0)
-                           throw new DatabaseException("Error executing SCL \"" + code + "\" " + errorBuilder.toString().trim());
+                           throw new DatabaseException("Error executing SCL \"" + code + "\" " + errorBuilder.toString().trim()); //$NON-NLS-1$ //$NON-NLS-2$
                }
                return responseBuilder.toString().trim();
        }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/templates/messages.properties
new file mode 100644 (file)
index 0000000..aadad1c
--- /dev/null
@@ -0,0 +1,4 @@
+CompleteStructureWriter_ErrorInPropertyRefrence=Error in property reference\r
+DiagramStructureWriter_Hierarchymissing=Hierarchy missing\r
+DocumentStructureWriter_ErrorInPropertyReference=Error in property reference \r
+DocumentWriter_DocumentDoesNotExist=[DOCUMENT DOES NOT EXIST]\r
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/Messages.java
new file mode 100644 (file)
index 0000000..5fdf7ce
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.document.linking.utils;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.utils.messages"; //$NON-NLS-1$
+       public static String SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel;
+       public static String SourceLinkUtil_DatabaseExceptionLocNotModelPart;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 12c2b5b998aa0fb105f0ce3d879612634dffc9dc..c652f69fa678b834b9809989a3741347d7c27bda 100644 (file)
@@ -45,9 +45,9 @@ public class SourceLinkUtil {
                Resource link = null;
                DependencyCheckResult result = checkDependecies(graph, document, instance);
                if (result == DependencyCheckResult.NoLocationModel)
-                       throw new DatabaseException("Location of document link is not part of a model.");
+                       throw new DatabaseException(Messages.SourceLinkUtil_DatabaseExceptionLocNotModelPart);
                if (result == DependencyCheckResult.DifferentModel) {
-                       throw new DatabaseException("Location of document link and document are in different models, document link cannot be created.");
+                       throw new DatabaseException(Messages.SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel);
                }
                if (result == DependencyCheckResult.NoReferenceModel) {
                        //referred document and location are not in the same model, create an URI reference.
@@ -76,7 +76,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createInstanceSource(WriteGraph graph, Resource reference, Resource location) throws DatabaseException {
-               return createInstanceSource(graph, reference, location, "");
+               return createInstanceSource(graph, reference, location, ""); //$NON-NLS-1$
        }
 
        public static Resource createInstanceSource(WriteGraph graph, Resource reference, Resource location, String comment) throws DatabaseException {
@@ -107,7 +107,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createInstanceSource(WriteGraph graph, String reference, Resource location) throws DatabaseException {
-               return createInstanceSource(graph, reference, location, "");
+               return createInstanceSource(graph, reference, location, ""); //$NON-NLS-1$
        }
 
        public static Resource createInstanceSource(WriteGraph graph, String reference, Resource location, String comment) throws DatabaseException {
@@ -138,7 +138,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createFunctionalSource(WriteGraph graph, Resource reference, Resource location, Resource relation) throws DatabaseException {
-               return createFunctionalSource(graph, reference, location, relation, "");
+               return createFunctionalSource(graph, reference, location, relation, ""); //$NON-NLS-1$
        }
 
        
@@ -173,7 +173,7 @@ public class SourceLinkUtil {
        }
        
        public static Resource createFunctionalSource(WriteGraph graph, String reference, Resource location, Resource relation) throws DatabaseException {
-               return createFunctionalSource(graph, reference, location, relation, "");
+               return createFunctionalSource(graph, reference, location, relation, ""); //$NON-NLS-1$
        }
 
        
@@ -407,7 +407,7 @@ public class SourceLinkUtil {
                        } else if (value instanceof Object[]) {
                                return Arrays.toString((Object[])value);
                        } else {
-                               return "TODO: Array " + value.getClass().getSimpleName();
+                               return "TODO: Array " + value.getClass().getSimpleName(); //$NON-NLS-1$
                        }
                } else {
                        return value.toString();
@@ -436,15 +436,15 @@ public class SourceLinkUtil {
        }
        
        public static String getCustomizedString(ReadGraph graph, Resource document, List<String> annotationContent) throws DatabaseException{
-               String label = "";
+               String label = ""; //$NON-NLS-1$
                Variable doc = graph.adapt(document, Variable.class);
                for (String path : annotationContent) {
-                       if (path.startsWith("\"") && path.endsWith("\"")) {
-                               label += path.substring(1,path.length()-1)+ " ";
+                       if (path.startsWith("\"") && path.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
+                               label += path.substring(1,path.length()-1)+ " "; //$NON-NLS-1$
                        } else {
                                Variable v = PredefinedVariables.getInstance().getVariable(graph, path, null, doc);
                                if (v != null) {
-                                       label += v.getValue(graph) + " ";
+                                       label += v.getValue(graph) + " "; //$NON-NLS-1$
                                }
                        }
                }
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/utils/messages.properties
new file mode 100644 (file)
index 0000000..b801eb4
--- /dev/null
@@ -0,0 +1,2 @@
+SourceLinkUtil_DatabaseExceptionDocumentInDifferentModel=Location of document link and document are in different models, document link cannot be created.\r
+SourceLinkUtil_DatabaseExceptionLocNotModelPart=Location of document link is not part of a model.\r
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/Messages.java
new file mode 100644 (file)
index 0000000..d9745ed
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.document.linking.views;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.views.messages"; //$NON-NLS-1$
+       public static String SourceView_All;
+       public static String SourceView_Browsing;
+       public static String SourceView_LinkAll;
+       public static String SourceView_LinkDocuments;
+       public static String SourceView_Linking;
+       public static String SourceView_OldRemoved;
+       public static String SourceView_PinSelection;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index e3b1c55d3ab4f0961f02383ad6a018b2a2bde025..86dfe67edc3bdb90783ff258200a7b5a9e007ac9 100644 (file)
@@ -65,7 +65,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        /**
         * The ID of the view as specified by the extension.
         */
-       public static final String ID = "org.simantics.document.linking.views.SourceView";
+       public static final String ID = "org.simantics.document.linking.views.SourceView"; //$NON-NLS-1$
 
        private Composite composite;
 
@@ -110,10 +110,10 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                composite.setLayout(new FillLayout());
                tabFolder = new TabFolder(composite, SWT.NONE);
                TabItem link = new TabItem(tabFolder, SWT.NONE);
-               link.setText("Linking");
+               link.setText(Messages.SourceView_Linking);
                
                TabItem browse = new TabItem(tabFolder, SWT.NONE);
-               browse.setText("Browsing");
+               browse.setText(Messages.SourceView_Browsing);
                
                linkComposite = new Composite(tabFolder, SWT.NONE);
                link.setControl(linkComposite);
@@ -163,7 +163,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                        }
                });
                Button checkingButton = new Button(browseComposite, SWT.TOGGLE);
-               checkingButton.setText("All");
+               checkingButton.setText(Messages.SourceView_All);
                checkingButton.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
@@ -171,7 +171,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                                boolean checked = button.getSelection();
                                browseExplorer.dispose();
                                createModelExplorer(checked,support,browseComposite);
-                               button.setText(checked ? "Old/Removed" : "All");
+                               button.setText(checked ? Messages.SourceView_OldRemoved : Messages.SourceView_All);
                                if (currentModel != null)
                                        setModel(currentModel, true);
                                browseComposite.getParent().layout(true, true);
@@ -198,7 +198,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        }
        
        private void createModelExplorer(boolean onlyCheckable,WidgetSupport support,Composite browseComposite) {
-               browseExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false, true), selectionProvider,getSite(), browseComposite, support,false, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+               browseExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false, true), selectionProvider,getSite(), browseComposite, support,false, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                if(!onlyCheckable)
                        browseExplorer.setBrowseContexts(DocumentLink.URIs.ModelViewpointBrowseContext, DocumentLink.URIs.ModelViewpointActionContext);
                else
@@ -207,7 +207,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                browseExplorer.setInputSource(new SingleSelectionInputSource(Resource.class));
                browseExplorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning
                browseExplorer.setColumnsVisible(true);
-               browseExplorer.setContextMenuId("#SourceModelViewPopup");
+               browseExplorer.setContextMenuId("#SourceModelViewPopup"); //$NON-NLS-1$
                browseExplorer.finish();
         ((Tree)browseExplorer.getExplorer().getControl()).setLinesVisible(true);
         
@@ -215,25 +215,25 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        }
        
        private void createLinkTab(final Composite linkComposite) {
-               objectExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+               objectExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                objectExplorer.setBrowseContexts(DocumentLink.URIs.SourceObjectViewpointBrowseContext, DocumentLink.URIs.SourceObjectViewpointActionContext);
                objectExplorer.setColumns(Constants.SOURCE_OBJECT_COLUMNS);
                objectExplorer.setInputSource(new SingleSelectionInputSource(Resource.class));
                objectExplorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning
                objectExplorer.setColumnsVisible(true);
-               objectExplorer.setContextMenuId("#SourceObjectViewPopup");
+               objectExplorer.setContextMenuId("#SourceObjectViewPopup"); //$NON-NLS-1$
                objectExplorer.finish();
         ((Tree)objectExplorer.getExplorer().getControl()).setLinesVisible(true);
         
         final Sash sash = new Sash (linkComposite, SWT.HORIZONTAL);
         
-               propertyExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+               propertyExplorer = new SourceLinkExplorerComposite(ArrayMap.keys("displaySelectors", "displayFilter","treeView").values(false, false,true), selectionProvider,getSite(), linkComposite, support, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                propertyExplorer.setBrowseContexts(DocumentLink.URIs.SourcePropertyViewpointBrowseContext, DocumentLink.URIs.SourcePropertyViewpointActionContext);
                propertyExplorer.setColumns(Constants.SOURCE_COLUMNS);
                propertyExplorer.setInputSource(new SingleSelectionInputSource(Resource.class));
                propertyExplorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning
                propertyExplorer.setColumnsVisible(true);
-               propertyExplorer.setContextMenuId("#SourcePropertyViewPopup");
+               propertyExplorer.setContextMenuId("#SourcePropertyViewPopup"); //$NON-NLS-1$
         propertyExplorer.finish();
         ((Tree)propertyExplorer.getExplorer().getControl()).setLinesVisible(true);
         
@@ -390,16 +390,16 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
        }
 
        private void makeActions() {
-               pinSelectionAction = new Action("Pin selection", Action.AS_CHECK_BOX) {
+               pinSelectionAction = new Action(Messages.SourceView_PinSelection, Action.AS_CHECK_BOX) {
                        public void run() {
                                pinSelection = isChecked();
                        }
                };
 //             action1.setToolTipText("Action 1 tooltip");
-               pinSelectionAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/lock.png"));
+               pinSelectionAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/lock.png")); //$NON-NLS-1$ //$NON-NLS-2$
                
                
-               linkAllAction = new Action("Link All", Action.AS_RADIO_BUTTON) {
+               linkAllAction = new Action(Messages.SourceView_LinkAll, Action.AS_RADIO_BUTTON) {
                        @Override
                        public void run() {
                                setAcceptedObject(AcceptedObject.ALL);
@@ -407,7 +407,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis
                        }
                };
                
-               linkDocumentsAction = new Action("Link Documents", Action.AS_RADIO_BUTTON) {
+               linkDocumentsAction = new Action(Messages.SourceView_LinkDocuments, Action.AS_RADIO_BUTTON) {
                        @Override
                        public void run() {
                                setAcceptedObject(AcceptedObject.DOCUMENT);
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/messages.properties
new file mode 100644 (file)
index 0000000..84c9964
--- /dev/null
@@ -0,0 +1,7 @@
+SourceView_All=All\r
+SourceView_Browsing=Browsing\r
+SourceView_LinkAll=Link All\r
+SourceView_LinkDocuments=Link Documents\r
+SourceView_Linking=Linking\r
+SourceView_OldRemoved=Old/Removed\r
+SourceView_PinSelection=Pin selection\r
index 0996e6ef8be7364dcbfc51f144a5ff0ccbfeda78..6f53d1f3580992ae787f127111e4473aac82b0c2 100644 (file)
@@ -83,7 +83,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                viewer.setLabelProvider(new EvaluatorLabelProvider());
                viewer.setCellEditors(new CellEditor[]{new EvaluatorNodeCellEditor(viewer.getTree())});
                viewer.setCellModifier(new EvaluatorNodeCellModifier());
-               viewer.setColumnProperties(new String[]{"value"});
+               viewer.setColumnProperties(new String[]{"value"}); //$NON-NLS-1$
                viewer.setInput(root);
                viewer.getTree().addMenuDetectListener(new MenuDetectListener() {
                        
@@ -267,16 +267,16 @@ public class EvaluatorConfigurationWidget extends Composite {
                final EvaluatorItem item = i;
                Menu menu = new Menu(viewer.getControl());
                MenuItem add = new MenuItem(menu, SWT.CASCADE);
-               add.setText("Add");
+               add.setText(Messages.EvaluatorConfigurationWidget_Add);
                Menu addMenu = new Menu(menu);
                add.setMenu(addMenu);
-               add.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_right.png")));
+               add.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_right.png"))); //$NON-NLS-1$ //$NON-NLS-2$
                
                MenuItem insert = new MenuItem(menu, SWT.CASCADE);
-               insert.setText("Insert");
+               insert.setText("Insert"); //$NON-NLS-1$
                Menu insertMenu = new Menu(menu);
                insert.setMenu(insertMenu);
-               insert.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_left.png")));
+               insert.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_left.png"))); //$NON-NLS-1$ //$NON-NLS-2$
                
                // add menu
                if (item instanceof EvaluatorNode) {
@@ -321,7 +321,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                        insert.setEnabled(false);
                
                MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
-               menuItem.setText("Remove");
+               menuItem.setText(Messages.EvaluatorConfigurationWidget_Remove);
                menuItem.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                EvaluatorNode parent = item.getParent();
@@ -332,7 +332,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                        };
                });
                menuItem.setEnabled(item != root);
-               menuItem.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/delete.png")));
+               menuItem.setImage(manager.createImage(AbstractUIPlugin.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/delete.png"))); //$NON-NLS-1$ //$NON-NLS-2$
                menu.setLocation(event.x,event.y);
                menu.setVisible(true);
                
@@ -506,7 +506,7 @@ public class EvaluatorConfigurationWidget extends Composite {
                                }
                                return 0;
                        }
-                       return "";
+                       return ""; //$NON-NLS-1$
                }
                @Override
                public void modify(Object element, String property, Object value) {
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/Messages.java
new file mode 100644 (file)
index 0000000..cc9d1e1
--- /dev/null
@@ -0,0 +1,44 @@
+package org.simantics.document.linking.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.linking.wizard.messages"; //$NON-NLS-1$
+       public static String EvaluatorConfigurationWidget_Add;
+       public static String EvaluatorConfigurationWidget_Remove;
+       public static String ReportCustomizationPage_Defaults;
+       public static String ReportCustomizationPage_GiveTemplateName;
+       public static String ReportCustomizationPage_Library;
+       public static String ReportCustomizationPage_Load;
+       public static String ReportCustomizationPage_Name;
+       public static String ReportCustomizationPage_NameCannotBeEmpty;
+       public static String ReportCustomizationPage_Save;
+       public static String ReportCustomizationPage_SaveReportCustomizations;
+       public static String ReportGeneratePage_File;
+       public static String ReportGeneratePage_FileNotSelected;
+       public static String ReportGeneratePage_GenerateReport;
+       public static String ReportGeneratePage_GeneratingReport;
+       public static String ReportGeneratePage_Report;
+       public static String ReportGeneratePage_ReportFail;
+       public static String ReportGeneratePage_ReportFailed;
+       public static String ReportGeneratePage_ReportNotGenerated;
+       public static String ReportGeneratePage_ReportWriterNotSelected;
+       public static String ReportGeneratePage_ShowReport;
+       public static String ReportGeneratePage_Status;
+       public static String ReportSelectionPage_Browse;
+       public static String ReportSelectionPage_File;
+       public static String ReportSelectionPage_FilterHTMLDocument;
+       public static String ReportSelectionPage_FilterPDFDocument;
+       public static String ReportSelectionPage_Model;
+       public static String ReportSelectionPage_ReportTemplates;
+       public static String ReportWizard_CustomizeReport;
+       public static String ReportWizard_RunReport;
+       public static String ReportWizard_SelectReportParameters;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 37f76332f6ad3e7de787f5263b390fee327e2d3e..8be04962633a3347deec1f70267233f27cb3f1da 100644 (file)
@@ -80,9 +80,9 @@ public class ReportCustomizationPage extends WizardPage{
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(loadButton);
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(saveButton);
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(resetButton);
-               loadButton.setText("Load");
-               saveButton.setText("Save");
-               resetButton.setText("Defaults");
+               loadButton.setText(Messages.ReportCustomizationPage_Load);
+               saveButton.setText(Messages.ReportCustomizationPage_Save);
+               resetButton.setText(Messages.ReportCustomizationPage_Defaults);
                
                loadButton.addSelectionListener(new SelectionAdapter() {
                        @Override
@@ -122,7 +122,7 @@ public class ReportCustomizationPage extends WizardPage{
                                @Override
                                public Resource perform(ReadGraph graph) throws DatabaseException {
                                        Layer0 l0 = Layer0.getInstance(graph);
-                                       Resource lib =  graph.syncRequest(new PossibleObjectWithName(model, l0.ConsistsOf,"Library"));
+                                       Resource lib =  graph.syncRequest(new PossibleObjectWithName(model, l0.ConsistsOf,Messages.ReportCustomizationPage_Library));
                                        if (lib != null)
                                                return lib;
                                        
@@ -239,7 +239,7 @@ public class ReportCustomizationPage extends WizardPage{
        private void save() {
                try {
                        
-                       InputDialog dialog = new InputDialog(getShell(), "Save report customization", "Give template name", "Name", new NotNullValidator("Name cannot be empty"));
+                       InputDialog dialog = new InputDialog(getShell(), Messages.ReportCustomizationPage_SaveReportCustomizations, Messages.ReportCustomizationPage_GiveTemplateName, Messages.ReportCustomizationPage_Name, new NotNullValidator(Messages.ReportCustomizationPage_NameCannotBeEmpty));
                        if (dialog.open() != InputDialog.OK)
                                return;
                        final String name = dialog.getValue();
index 4db863f2af714f72c31f5c6ab96d960509208348..39fb639836c9b2a994a4b90705e794a862431804 100644 (file)
@@ -7,6 +7,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -70,17 +71,17 @@ public class ReportGeneratePage extends WizardPage {
                Composite composite = new Composite(parent, SWT.NONE);
                composite.setLayout(new GridLayout(2,false));
                Label label = new Label(composite, SWT.NONE);
-               label.setText("File:");
+               label.setText(Messages.ReportGeneratePage_File);
                fileLabel = new Label(composite, SWT.NONE);
                label = new Label(composite, SWT.NONE);
-               label.setText("Report:");
+               label.setText(Messages.ReportGeneratePage_Report);
                reportLabel = new Label(composite, SWT.NONE);
                label = new Label(composite, SWT.NONE);
-               label.setText("Status:");
+               label.setText(Messages.ReportGeneratePage_Status);
                this.statusLabel = new Label(composite, SWT.NONE);
-               this.statusLabel.setText("Report has not been generated");
+               this.statusLabel.setText(Messages.ReportGeneratePage_ReportNotGenerated);
                generateButton = new Button(composite, SWT.PUSH);
-               generateButton.setText("Generate report");
+               generateButton.setText(Messages.ReportGeneratePage_GenerateReport);
                generateButton.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
@@ -88,7 +89,7 @@ public class ReportGeneratePage extends WizardPage {
                        }
                });
                showButton = new Button(composite, SWT.PUSH);
-               showButton.setText("Show Report");
+               showButton.setText(Messages.ReportGeneratePage_ShowReport);
                showButton.addSelectionListener(new SelectionAdapter() {
                        
                        @Override
@@ -109,13 +110,13 @@ public class ReportGeneratePage extends WizardPage {
        }
        
        private void updateContent() {
-               fileLabel.setText(filename == null ? "File has not been selected" : filename);
-               reportLabel.setText(reportWriter == null ? "Report Writer has not been selected" : reportWriter.getName());
+               fileLabel.setText(filename == null ? Messages.ReportGeneratePage_FileNotSelected : filename);
+               reportLabel.setText(reportWriter == null ? Messages.ReportGeneratePage_ReportWriterNotSelected : reportWriter.getName());
                generateButton.setEnabled(filename != null && reportWriter != null && model != null);
                showButton.setEnabled(generated);
                generateButton.setEnabled(!generated);
                if (!generated)
-                       statusLabel.setText("Report has not been generated");
+                       statusLabel.setText(Messages.ReportGeneratePage_ReportNotGenerated);
        }
        
        public void setGenerated(boolean b) {
@@ -125,7 +126,7 @@ public class ReportGeneratePage extends WizardPage {
        
        private void generate() {
                generateButton.setEnabled(false);
-               statusLabel.setText("Generating report");
+               statusLabel.setText(Messages.ReportGeneratePage_GeneratingReport);
                try {
                        getWizard().getContainer().run(true, false, new IRunnableWithProgress() {
                                
@@ -154,14 +155,14 @@ public class ReportGeneratePage extends WizardPage {
                                }
                        });
                }  catch (InterruptedException err) {
-                       setErrorMessage("Report failed: " + err.getMessage());
-                       ErrorLogger.defaultLogError("Report failed.",err);
-                       statusLabel.setText("Report failed.");
+                       setErrorMessage(NLS.bind(Messages.ReportGeneratePage_ReportFailed , err.getMessage()));
+                       ErrorLogger.defaultLogError(Messages.ReportGeneratePage_ReportFail,err);
+                       statusLabel.setText(Messages.ReportGeneratePage_ReportFail);
                } catch (InvocationTargetException e) {
                    Throwable err = e.getCause();
-                       setErrorMessage("Report failed: " + err.getMessage());
-                       ErrorLogger.defaultLogError("Report failed.",err);
-                       statusLabel.setText("Report failed.");
+                       setErrorMessage(NLS.bind(Messages.ReportGeneratePage_ReportFailed , err.getMessage()));
+                       ErrorLogger.defaultLogError(Messages.ReportGeneratePage_ReportFail,err);
+                       statusLabel.setText(Messages.ReportGeneratePage_ReportFail);
                }
                setGenerated(true);
                
index 93423fc4182b3f50eed9ef9b30fd07ed46b9992a..abc017609c21607e8b82dcb00e7aef3e7e3de253 100644 (file)
@@ -69,14 +69,14 @@ public class ReportSelectionPage extends WizardPage{
                Composite composite = new Composite(parent, SWT.NONE);
                composite.setLayout(new GridLayout(3,false));
                Label label = new Label(composite, SWT.NONE);
-               label.setText("Model:");
+               label.setText(Messages.ReportSelectionPage_Model);
                modelCombo = new CCombo(composite, SWT.BORDER|SWT.READ_ONLY);
                
                label = new Label(composite, SWT.NONE);
-               label.setText("File:");
+               label.setText(Messages.ReportSelectionPage_File);
                filenameText = new Text(composite, SWT.BORDER|SWT.SINGLE);
                browseButton = new Button(composite, SWT.PUSH);
-               browseButton.setText("Browse");
+               browseButton.setText(Messages.ReportSelectionPage_Browse);
                
                reportWriters.add(new ModelDocumentWriter());
                reportWriters.add(new ReferredDocumentWriter());
@@ -86,7 +86,7 @@ public class ReportSelectionPage extends WizardPage{
                reportWriters.add(new CompleteStructureWriter());
                
                Group group = new Group(composite, SWT.NONE);
-               group.setText("Report templates");
+               group.setText(Messages.ReportSelectionPage_ReportTemplates);
                group.setLayout(new FillLayout(SWT.VERTICAL));
                
                GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(filenameText);
@@ -98,11 +98,11 @@ public class ReportSelectionPage extends WizardPage{
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(),SWT.SAVE);
-                               dialog.setFilterExtensions(new String[]{"*.pdf","*.html"});
-                               dialog.setFilterNames(new String[]{"PDF Document","HTML Document"});
+                               dialog.setFilterExtensions(new String[]{"*.pdf","*.html"}); //$NON-NLS-1$ //$NON-NLS-2$
+                               dialog.setFilterNames(new String[]{Messages.ReportSelectionPage_FilterPDFDocument,Messages.ReportSelectionPage_FilterHTMLDocument});
                                String filename = dialog.open();
                                if (filename == null)
-                                       filenameText.setText("");
+                                       filenameText.setText(""); //$NON-NLS-1$
                                else
                                        filenameText.setText(filename);
                                validate();
index 2ead523bd7bb983361030fd6311941984fc1b2cc..7c4dadd658dc85d92cfa85213ec41cda964a138c 100644 (file)
@@ -31,9 +31,9 @@ public class ReportWizard extends Wizard implements IExportWizard{
        
        @Override
        public void addPages() {
-               reportSelectionPage = new ReportSelectionPage("Select report parameters");
-               reportCustomizationPage = new ReportCustomizationPage("Customize report");
-               reportGeneratePage = new ReportGeneratePage("Run Report");
+               reportSelectionPage = new ReportSelectionPage(Messages.ReportWizard_SelectReportParameters);
+               reportCustomizationPage = new ReportCustomizationPage(Messages.ReportWizard_CustomizeReport);
+               reportGeneratePage = new ReportGeneratePage(Messages.ReportWizard_RunReport);
                addPage(reportSelectionPage);
                addPage(reportCustomizationPage);
                addPage(reportGeneratePage);
diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/messages.properties
new file mode 100644 (file)
index 0000000..6427d2a
--- /dev/null
@@ -0,0 +1,30 @@
+EvaluatorConfigurationWidget_Add=Add\r
+EvaluatorConfigurationWidget_Remove=Remove\r
+ReportCustomizationPage_Defaults=Defaults\r
+ReportCustomizationPage_GiveTemplateName=Give template name\r
+ReportCustomizationPage_Library=Library\r
+ReportCustomizationPage_Load=Load\r
+ReportCustomizationPage_Name=Name\r
+ReportCustomizationPage_NameCannotBeEmpty=Name cannot be empty\r
+ReportCustomizationPage_Save=Save\r
+ReportCustomizationPage_SaveReportCustomizations=Save report customization\r
+ReportGeneratePage_File=File:\r
+ReportGeneratePage_FileNotSelected=File has not been selected\r
+ReportGeneratePage_GenerateReport=Generate report\r
+ReportGeneratePage_GeneratingReport=Generating report\r
+ReportGeneratePage_Report=Report:\r
+ReportGeneratePage_ReportFail=Report failed.\r
+ReportGeneratePage_ReportFailed=Report failed: {0}\r
+ReportGeneratePage_ReportNotGenerated=Report has not been generated\r
+ReportGeneratePage_ReportWriterNotSelected=Report Writer has not been selected\r
+ReportGeneratePage_ShowReport=Show Report\r
+ReportGeneratePage_Status=Status:\r
+ReportSelectionPage_Browse=Browse\r
+ReportSelectionPage_File=File:\r
+ReportSelectionPage_FilterHTMLDocument=HTML Document\r
+ReportSelectionPage_FilterPDFDocument=PDF Document\r
+ReportSelectionPage_Model=Model:\r
+ReportSelectionPage_ReportTemplates=Report templates\r
+ReportWizard_CustomizeReport=Customize report\r
+ReportWizard_RunReport=Run Report\r
+ReportWizard_SelectReportParameters=Select report parameters\r
index 5a25c5b6b7f8708d0c7865ff20ad0ee8150ca68a..82e1588549d0327815284b0c73072049fa3bd5c6 100644 (file)
@@ -58,9 +58,9 @@ public class Activator extends AbstractUIPlugin {
 
                Bundle bundle = context.getBundle();
                
-               DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png"));
-               cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png"));
-               clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png"));
+               DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png")); //$NON-NLS-1$
+               cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png")); //$NON-NLS-1$
+               clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png")); //$NON-NLS-1$
                
                IPath ipath = Platform.getStateLocation(bundle);
                location = Paths.get(ipath.toOSString());
index fe909fabda887e9e7e15f13b9fe0773efe210e66..0507fa5ef32af3874f25a019f56129bcaf5ff1fb 100644 (file)
@@ -11,7 +11,7 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 
 public class CSSCompletionAssistProcessor implements IContentAssistProcessor {
     
-    private String lastError = "";
+    private String lastError = ""; //$NON-NLS-1$
     private CSSTextEditorEnvironment environment;
     
     public CSSCompletionAssistProcessor(CSSTextEditorEnvironment environment) {
@@ -26,7 +26,7 @@ public class CSSCompletionAssistProcessor implements IContentAssistProcessor {
             tmpOffset = selection.getOffset() + selection.getLength();
         final int offset = tmpOffset;
         IDocument document = viewer.getDocument();
-        String tmpPrefix = "";
+        String tmpPrefix = ""; //$NON-NLS-1$
         try {
             tmpPrefix = getPrefix(document, offset);
         } catch (BadLocationException e) {
@@ -38,7 +38,7 @@ public class CSSCompletionAssistProcessor implements IContentAssistProcessor {
     
     private static String getPrefix(IDocument doc, int offset) throws BadLocationException {
         if (doc == null || offset >= doc.getLength())
-            return "";
+            return ""; //$NON-NLS-1$
 
         int length= 0;
         while (--offset >= 0 && Character.isJavaIdentifierPart(doc.getChar(offset)) || doc.getChar(offset) == '.')
index 8c86de8cae83822dde3a945e33019ce3793250ba..aa0d23f0c2f6d889537d490751b7f52252acc8b0 100644 (file)
@@ -22,10 +22,10 @@ import org.simantics.scl.compiler.elaboration.modules.SCLValue;
 
 public class CSSCompletionProposal implements ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2, ICompletionProposalExtension3, ICompletionProposalExtension4, ICompletionProposalExtension5 {
     
-    private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage();
-    private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage();
-    private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage();
-    private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage();
+    private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+    private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
     
     private final String content;
     private final String name;
@@ -39,7 +39,7 @@ public class CSSCompletionProposal implements ICompletionProposal, ICompletionPr
         this.name = value.getName().name;
         this.module = value.getName().module;
         this.documentation = value.getDocumentation();
-        this.content = name + " :: " + value.getType() + "  (" + module + ")";
+        this.content = name + " :: " + value.getType() + "  (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         this.replacementOffset = replacementOffset;
         this.prefix = prefix;
 //        System.out.println(prefix);
@@ -52,7 +52,7 @@ public class CSSCompletionProposal implements ICompletionProposal, ICompletionPr
     public CSSCompletionProposal(String name, String module, CSSCompletionType completionType, int replacementOffset, String prefix) {
         this.name = name;
         this.module = module;
-        this.content = name + " (" + module + ")";
+        this.content = name + " (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$
         this.documentation = null;
         this.replacementOffset = replacementOffset;
         this.prefix = prefix;
@@ -133,13 +133,13 @@ public class CSSCompletionProposal implements ICompletionProposal, ICompletionPr
 //            String sadd = doc.get(start, end);
 //            System.out.println("toReplace : " + sadd);
             if (p.y > 0) {
-                doc.replace(p.x, p.y, "");
+                doc.replace(p.x, p.y, ""); //$NON-NLS-1$
                 doc.replace(offset, 0, getName());
             } else {
                 String currentText = doc.get(offset - prefix.length(), prefix.length());
                 if (currentText.equals(getName()))
                     return;
-                doc.replace(offset - prefix.length(), prefix.length(), "");
+                doc.replace(offset - prefix.length(), prefix.length(), ""); //$NON-NLS-1$
                 doc.replace(offset - prefix.length(), 0, getName());
             }
         } catch (BadLocationException x) {
index aafd46a854af8628daad2e3429b15e9746b27e57..d3070a0f95e2bea85e2144360977a09c539b1d0d 100644 (file)
@@ -40,7 +40,7 @@ import org.simantics.ui.workbench.editor.input.InputValidationCombinators;
  */
 public class CSSEditor extends TextEditor {
 
-       public static final String EDITOR_ID = "org.simantics.document.ui.csseditor";
+       public static final String EDITOR_ID = "org.simantics.document.ui.csseditor"; //$NON-NLS-1$
        
     private boolean disposed = false;
 
@@ -84,7 +84,7 @@ public class CSSEditor extends TextEditor {
         try {
             getResourceInput().init(null);
         } catch (DatabaseException e) {
-            throw new PartInitException("Failed to initialize " + input, e);
+            throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$
         }
     }
 
index 23553b117096599cfa242f5ebc5c29332b255b0f..b2cf914052a7de54613e1060b92b3f440905395b 100644 (file)
@@ -56,7 +56,7 @@ public class CSSModuleEditorDocumentProvider extends AbstractDocumentProvider {
                        DocumentResource DOC = DocumentResource.getInstance(graph);
                     currentText = graph.getPossibleRelatedValue(resource, DOC.cssDocument, Bindings.STRING);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -83,7 +83,7 @@ public class CSSModuleEditorDocumentProvider extends AbstractDocumentProvider {
         synchronized(annotationModel.getLockObject()) {
             annotationModel.removeAllAnnotations();
             for(CompilationError error : errors) {
-                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true,
+                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, //$NON-NLS-1$
                         error.description);
                 int begin = Locations.beginOf(error.location);
                 int end = Locations.endOf(error.location);
@@ -108,7 +108,7 @@ public class CSSModuleEditorDocumentProvider extends AbstractDocumentProvider {
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument");
+        TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
index 3894faa86756d3cc0da230c4679633e24434434d..44f0694f56a1849ce59a86b536e6d5c59fe95576 100644 (file)
@@ -97,8 +97,8 @@ public class CSSSourceViewerConfiguration extends SourceViewerConfiguration {
     ITokenScanner getSclTokenScanner() {
         RuleBasedScanner scanner = new RuleBasedScanner();
         
-        Font font = new Font(device, "Courier New", 10, SWT.NORMAL);
-        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD);
+        Font font = new Font(device, "Courier New", 10, SWT.NORMAL); //$NON-NLS-1$
+        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD); //$NON-NLS-1$
 
         Token defaultToken = new Token(
                 new TextAttribute(
@@ -139,20 +139,20 @@ public class CSSSourceViewerConfiguration extends SourceViewerConfiguration {
             }
         });
 
-        reservedWord.addWord("if", reserved);
-        reservedWord.addWord("then", reserved);
-        reservedWord.addWord("else", reserved);
-        reservedWord.addWord("match", reserved);
-        reservedWord.addWord("with", reserved);
-        reservedWord.addWord("data", reserved);
-        reservedWord.addWord("type", reserved);
-        reservedWord.addWord("class", reserved);
+        reservedWord.addWord("if", reserved); //$NON-NLS-1$
+        reservedWord.addWord("then", reserved); //$NON-NLS-1$
+        reservedWord.addWord("else", reserved); //$NON-NLS-1$
+        reservedWord.addWord("match", reserved); //$NON-NLS-1$
+        reservedWord.addWord("with", reserved); //$NON-NLS-1$
+        reservedWord.addWord("data", reserved); //$NON-NLS-1$
+        reservedWord.addWord("type", reserved); //$NON-NLS-1$
+        reservedWord.addWord("class", reserved); //$NON-NLS-1$
         
         IRule[] rules = new IRule[] {
             //new MultiLineRule("\"\"\"", "\"\"\"", string),
-            new PatternRule("\"", "\"", string, '\\', true),
-            new MultiLineRule("/*", "*/", comment),
-            new EndOfLineRule("//", comment),
+            new PatternRule("\"", "\"", string, '\\', true), //$NON-NLS-1$ //$NON-NLS-2$
+            new MultiLineRule("/*", "*/", comment), //$NON-NLS-1$ //$NON-NLS-2$
+            new EndOfLineRule("//", comment), //$NON-NLS-1$
             reservedWord
         };
         scanner.setRules(rules);
index 0d7973f6af728ddf0fa02096e6d08a91ecd8fd03..2083c3b4afbb6a590fbd21a78434a5597a5b304d 100644 (file)
@@ -51,11 +51,11 @@ public class DocumentView extends ModelledView {
 
     private class PinSelection extends Action {
         public PinSelection() {
-            super("Pin Selection", IAction.AS_CHECK_BOX);
+            super(Messages.DocumentView_PinSelection, IAction.AS_CHECK_BOX);
             setImageDescriptor(
                     BundleUtils.getImageDescriptorFromPlugin(
-                            "org.eclipse.ui",
-                            "icons/full/etool16/pin_editor.png"));
+                            "org.eclipse.ui", //$NON-NLS-1$
+                            "icons/full/etool16/pin_editor.png")); //$NON-NLS-1$
         }
 
         @Override
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/Messages.java
new file mode 100644 (file)
index 0000000..6105026
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.document.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.messages"; //$NON-NLS-1$
+       public static String DocumentView_PinSelection;
+       public static String OpenEntityDocumentAdapter_DocumentEditor;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index bd44a50b15bff7c693588571d86000b098f91258..2226a2413313ac6392cd23271f05f83c2f7c5b58 100644 (file)
@@ -32,11 +32,11 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 
 public class OpenEntityDocumentAdapter extends AbstractResourceEditorAdapter {
 
-    private static final String EDITOR_ID = "org.simantics.document.ui.editor";
+    private static final String EDITOR_ID = "org.simantics.document.ui.editor"; //$NON-NLS-1$
 
     public OpenEntityDocumentAdapter() throws MalformedURLException {
-        super("Document Editor", ImageDescriptor.createFromURL(new URL(
-                "platform:/plugin/com.famfamfam.silk/icons/table.png")));
+        super(Messages.OpenEntityDocumentAdapter_DocumentEditor, ImageDescriptor.createFromURL(new URL(
+                "platform:/plugin/com.famfamfam.silk/icons/table.png"))); //$NON-NLS-1$
     }
 
     protected String getEditorId() {
index 6e312cb37897081638c77d9b49ce4584d53b26b6..738c3c6bc8313a50304a624e6630fa21275eab39 100644 (file)
@@ -48,7 +48,7 @@ public class AddUrlDocument extends AddDocumentAction {
                        
                        @Override
                        public void run() {
-                               InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Add URL", "Input URL", "", new URLValidator());
+                               InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.AddUrlDocument_AddURL, Messages.AddUrlDocument_InputURL, "", new URLValidator()); //$NON-NLS-3$
                                if (dialog.open() != InputDialog.OK)
                                        return;
                                final String uriString = dialog.getValue();
@@ -69,7 +69,7 @@ public class AddUrlDocument extends AddDocumentAction {
                                        }
                                }, e -> {
                                        if (e != null)
-                                               ExceptionUtils.logAndShowError("Cannot add URL link.", e);
+                                               ExceptionUtils.logAndShowError(Messages.AddUrlDocument_CannotAddURLLink, e);
                                });
                        }
                };
index 61210a222b4f64dce3b2ea9dc3091b5d9efb0e2b..829b2aa324790d7c56cfed15e3f0d122ba47c418 100644 (file)
@@ -69,7 +69,7 @@ public class AddUrlDocumentWithDetail extends AddDocumentAction {
                                }, e -> {
                                        dialog.getAnnotationConfigurator().dispose();
                                        if (e != null)
-                                               ExceptionUtils.logAndShowError("Cannot add URL link.", e);
+                                               ExceptionUtils.logAndShowError("Cannot add URL link.", e); //$NON-NLS-1$
                                });
                        }
                };
@@ -86,7 +86,7 @@ public class AddUrlDocumentWithDetail extends AddDocumentAction {
        }
        
        public static Resource addUrlDocumentWithDetailSCL(WriteGraph graph, Resource target, String name, String uriString) throws DatabaseException {
-           AddUrlDocumentWithDetail urlDocument = new AddUrlDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf");
+           AddUrlDocumentWithDetail urlDocument = new AddUrlDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf"); //$NON-NLS-1$
            Resource urlResource = urlDocument.doAddUrl(graph, name, uriString);
            urlDocument.linkDocument(graph, target, urlResource);
            return urlResource;
index 652476d907058187e8593ea407587a108fa6d002..53777608f5795b084f80b4d65b56418289ebc0ad 100644 (file)
@@ -72,7 +72,7 @@ public class ExportDocumentFile implements ActionFactory {
                                                return;
                                        exportDocument(resource, filename);
                                } catch (DatabaseException e) {
-                                       ExceptionUtils.logAndShowError("Cannot export document.", e);
+                                       ExceptionUtils.logAndShowError(Messages.ExportDocumentFile_CannotExportDocument, e);
                                }
 
                        }
index 3956a5923bdd7b377c71ac5d14562ee2c4758d93..a7f9a9704554e07b2340165dd9e5e55257be7cd0 100644 (file)
@@ -16,7 +16,9 @@ import java.io.File;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Display;
@@ -47,7 +49,7 @@ public class ExportDocumentFolder implements ActionFactory {
 
        public ExportDocumentFolder(ReadGraph graph, String relationUri, String useResourceNames) throws DatabaseException {
                relation = graph.getResource(relationUri);
-               this.useResourceNames = useResourceNames.equals("true");
+               this.useResourceNames = useResourceNames.equals("true"); //$NON-NLS-1$
        }
        
        @Override
@@ -70,7 +72,7 @@ public class ExportDocumentFolder implements ActionFactory {
                                File folder = new File(folderName);
                                int choice = -1;
                                if (folder.list().length > 0) {
-                                       MessageDialog messageDialog = new MessageDialog(shell, "Folder export", null, "Selected folder \"" + folderName + "\" is not empty.", MessageDialog.QUESTION, new String[]{"Delete and export","Overwrite","Cancel"}, 2);
+                                       MessageDialog messageDialog = new MessageDialog(shell, Messages.ExportDocumentFolder_FolderExport, null, NLS.bind(Messages.ExportDocumentFolder_SelectedFolder, folderName), MessageDialog.QUESTION, new String[]{Messages.ExportDocumentFolder_DeleteAndExport,Messages.ExportDocumentFolder_Overwrite, IDialogConstants.CANCEL_LABEL }, 2); //$NON-NLS-3$
                                        choice = messageDialog.open();
                                        if (choice == 2)
                                                return;
@@ -89,7 +91,7 @@ public class ExportDocumentFolder implements ActionFactory {
                File folder;
                boolean clear = false;
                public ExportJob(Resource resource,File folder, boolean clear) {
-                       super("Export folder");
+                       super(Messages.ExportDocumentFolder_ExportFolder);
                        this.resource = resource;
                        this.folder = folder;
                        this.clear = clear;
@@ -97,17 +99,17 @@ public class ExportDocumentFolder implements ActionFactory {
                @Override
                protected IStatus run(IProgressMonitor monitor) {
                        try {
-                               monitor.beginTask("Export folder", IProgressMonitor.UNKNOWN);
+                               monitor.beginTask(Messages.ExportDocumentFolder_ExportFolder, IProgressMonitor.UNKNOWN);
                                if (clear) {
                                        GraphFileUtil.clearDirectoryStructure(folder);
                                        monitor.worked(1);
                                }
                                FileDocumentUtil.exportDocumentFolder(resource, folder, relation, useResourceNames, monitor);
                                monitor.done();
-                               return new Status(IStatus.OK, Activator.PLUGIN_ID, "Folder exported.");
+                               return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ExportDocumentFolder_ActivatorFolderExported);
                        } catch (Exception e) {
                                monitor.done();
-                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot export document folder.", e);
+                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportDocumentFolder_AcivatorCannotExport, e);
                        }
                }
        }
index 52eb042ac7e6e27e01176996bb7175bdc37c0dfc..923f3d7bf56c9afe4e9834320a0c1ef29ec06ca2 100644 (file)
@@ -56,13 +56,13 @@ public class ImportDocument extends AddDocumentAction {
                                //        if is, use those extensions to filter this list.
                                //        note: in windows using "reg query ..." to read bindings form registry would work.
                                // Note : If the above mentioned filtering is implemented it should be made optional / configurable.
-                               dialog.setFilterExtensions(new String[]{"*.*"});
+                               dialog.setFilterExtensions(new String[]{"*.*"}); //$NON-NLS-1$
                                if (dialog.open() == null) return;
 
                                String filterPath = dialog.getFilterPath();
                                String[] filenames = dialog.getFileNames();
                                
-                               ImportJob job = new ImportJob(filenames.length > 1 ? "Import files" : "Import file", resource, filterPath, filenames);
+                               ImportJob job = new ImportJob(filenames.length > 1 ? Messages.ImportDocument_JobImportFiles : Messages.ImportDocument_ImportFile, resource, filterPath, filenames);
                                job.setUser(true);
                                job.schedule();
                        }
@@ -84,7 +84,7 @@ public class ImportDocument extends AddDocumentAction {
 
                @Override
                protected IStatus run(final IProgressMonitor monitor) {
-                       monitor.beginTask("Importing...", filenames.length);
+                       monitor.beginTask(Messages.ImportDocument_ImportingDots, filenames.length);
                        try {
                                Simantics.getSession().syncRequest(new WriteRequest() {
                                        @Override
@@ -102,9 +102,9 @@ public class ImportDocument extends AddDocumentAction {
                                                }
                                        }
                                });
-                               return new Status(IStatus.OK, Activator.PLUGIN_ID, "Import succesful.");
+                               return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ImportDocument_ActivatorImportSucessful);
                        } catch (DatabaseException e) {
-                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import failed.", e);
+                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ImportDocument_ImportFailed, e);
                        } finally {
                                monitor.done();
                        }
index 88eb503f5a56e28b0f65c2381a1dae3618138a43..ab66fdab3d23ea6c0f92ce099d72c7bd08d3399b 100644 (file)
@@ -58,7 +58,7 @@ public class ImportDocumentFolder implements ActionFactory {
                                        return;
                                }
 
-                               ImportJob job = new ImportJob("Import folder", resource, filename);
+                               ImportJob job = new ImportJob(Messages.ImportDocumentFolder_ImportFolder, resource, filename);
                                job.setUser(true);
                                job.schedule();
                        }
@@ -91,9 +91,9 @@ public class ImportDocumentFolder implements ActionFactory {
                                                }
                                        }
                                });
-                               return new Status(IStatus.OK, Activator.PLUGIN_ID, "Folder imported.");
+                               return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ImportDocumentFolder_ActivatorFolderImported);
                        } catch (DatabaseException e) {
-                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot import document folder.", e);
+                               return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ImportDocumentFolder_ActivatorCannotImportDocumentFolder, e);
                        }
                }
        }
index 091f33e7d931acc87257f5eb1a33821298b4731f..be504594417a65b900c5172aeaade7d9da4cc686 100644 (file)
@@ -74,7 +74,7 @@ public class ImportDocumentWithDetail extends AddDocumentAction {
                                }, e -> {
                                        dialog.getAnnotationConfigurator().dispose();
                                        if (e != null)
-                                               ExceptionUtils.logAndShowError("Cannot import document.", e);
+                                               ExceptionUtils.logAndShowError(Messages.ImportDocumentWithDetail_CannotImportDocument, e);
                                });
                        }
                };
@@ -91,8 +91,8 @@ public class ImportDocumentWithDetail extends AddDocumentAction {
        public static Resource importDocumentWithDetailSCL(WriteGraph graph, Resource target, String filename) throws FileNotFoundException, DatabaseException {
            File file = new File(filename);
            if (!file.exists())
-               throw new FileNotFoundException("File not found - " + file.getAbsolutePath());
-           ImportDocumentWithDetail document = new ImportDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf");
+               throw new FileNotFoundException("File not found - " + file.getAbsolutePath()); //$NON-NLS-1$
+           ImportDocumentWithDetail document = new ImportDocumentWithDetail(graph, "http://www.simantics.org/Layer0-1.1/ConsistsOf"); //$NON-NLS-1$
            return document.doDocumentImport(graph, target, filename, file.getName());
        }
 
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/Messages.java
new file mode 100644 (file)
index 0000000..7e402e4
--- /dev/null
@@ -0,0 +1,35 @@
+package org.simantics.document.ui.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.actions.messages"; //$NON-NLS-1$
+       public static String AddUrlDocument_AddURL;
+       public static String AddUrlDocument_CannotAddURLLink;
+       public static String AddUrlDocument_InputURL;
+       public static String ExportDocumentFile_CannotExportDocument;
+       public static String ExportDocumentFolder_AcivatorCannotExport;
+       public static String ExportDocumentFolder_ActivatorFolderExported;
+       public static String ExportDocumentFolder_DeleteAndExport;
+       public static String ExportDocumentFolder_ExportFolder;
+       public static String ExportDocumentFolder_FolderExport;
+       public static String ExportDocumentFolder_Overwrite;
+       public static String ExportDocumentFolder_SelectedFolder;
+       public static String ImportDocument_ActivatorImportSucessful;
+       public static String ImportDocument_ImportFailed;
+       public static String ImportDocument_ImportFile;
+       public static String ImportDocument_ImportingDots;
+       public static String ImportDocument_JobImportFiles;
+       public static String ImportDocumentFolder_ActivatorCannotImportDocumentFolder;
+       public static String ImportDocumentFolder_ActivatorFolderImported;
+       public static String ImportDocumentFolder_ImportFolder;
+       public static String ImportDocumentWithDetail_CannotImportDocument;
+       public static String NewDocumentFolder_Folder;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 2feadfdcb10c634c4f9d70e2c9dd2785453be03f..674ead9b2911de09a5723036971c4e3d30426718 100644 (file)
@@ -38,7 +38,7 @@ public class NewDocumentFolder implements ActionFactory {
                                            
                                                Layer0 l0 = Layer0.getInstance(graph);
 
-                           String name = NameUtils.findFreshName(graph, "Folder", resource, relation);
+                           String name = NameUtils.findFreshName(graph, Messages.NewDocumentFolder_Folder, resource, relation);
                            Resource folder = graph.newResource();
                            graph.claim(folder, l0.InstanceOf, folderType);
                            graph.claimLiteral(folder, l0.HasName, name);
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/messages.properties
new file mode 100644 (file)
index 0000000..7297932
--- /dev/null
@@ -0,0 +1,21 @@
+AddUrlDocument_AddURL=Add URL\r
+AddUrlDocument_CannotAddURLLink=Cannot add URL link.\r
+AddUrlDocument_InputURL=Input URL\r
+ExportDocumentFile_CannotExportDocument=Cannot export document.\r
+ExportDocumentFolder_AcivatorCannotExport=Cannot export document folder.\r
+ExportDocumentFolder_ActivatorFolderExported=Folder exported.\r
+ExportDocumentFolder_DeleteAndExport=Delete and export\r
+ExportDocumentFolder_ExportFolder=Export folder\r
+ExportDocumentFolder_FolderExport=Folder export\r
+ExportDocumentFolder_Overwrite=Overwrite\r
+ExportDocumentFolder_SelectedFolder=Selected folder "{0}" is not empty.\r
+ImportDocument_ActivatorImportSucessful=Import successful.\r
+ImportDocument_ImportFailed=Import failed.\r
+ImportDocument_ImportFile=Import file\r
+ImportDocument_ImportingDots=Importing...\r
+ImportDocument_JobImportFiles=Import files\r
+ImportDocumentFolder_ActivatorCannotImportDocumentFolder=Cannot import document folder.\r
+ImportDocumentFolder_ActivatorFolderImported=Folder imported.\r
+ImportDocumentFolder_ImportFolder=Import folder\r
+ImportDocumentWithDetail_CannotImportDocument=Cannot import document.\r
+NewDocumentFolder_Folder=Folder\r
index 005cb9e457ae9d40b989f843904d9ce2f0f53b8d..f4f38a8ab74f1a243da6bb05d46f9b366730a4ed 100644 (file)
@@ -77,7 +77,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                DocumentResource doc = DocumentResource.getInstance(graph);
                if (!graph.isInstanceOf(resource, doc.Document))
                        return;
-               result.add(new ComparableTabContributor(new DocumentPropertyTabContributor(), 1, resource, "Document"));
+               result.add(new ComparableTabContributor(new DocumentPropertyTabContributor(), 1, resource, Messages.DocumentTabContribution_Document));
        }
        
        private class DocumentPropertyTabContributor extends PropertyTabContributorImpl {
@@ -90,7 +90,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        GridLayoutFactory.fillDefaults().margins(3,3).spacing(1, 1).numColumns(4).applyTo(composite);
 
                        Label label = new Label(composite, SWT.NONE);
-                       label.setText("Name");
+                       label.setText(Messages.DocumentTabContribution_Name);
 
                        TrackedText name = new TrackedText(composite, support, SWT.BORDER);
                        name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));
@@ -100,7 +100,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        support.register(validator);
                        
                        Button showButton = new Button(composite, SWT.PUSH);
-                       showButton.setText("Show");
+                       showButton.setText(Messages.DocumentTabContribution_Show);
                        showButton.addSelectionListener(new SelectionAdapter() {
                                @Override
                                public void widgetSelected(SelectionEvent e) {
@@ -110,10 +110,10 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        DocumentResource doc;
                        try {
                                doc = DocumentResource.getInstance(context.getSession());
-                               new DocumentRevisionWidget(composite, support, doc.HasOlderVersion, "Old");
-                               new DocumentRevisionWidget(composite, support, doc.HasNewerVersion, "New");
+                               new DocumentRevisionWidget(composite, support, doc.HasOlderVersion, Messages.DocumentTabContribution_Old);
+                               new DocumentRevisionWidget(composite, support, doc.HasNewerVersion, Messages.DocumentTabContribution_New);
                        } catch (DatabaseException e1) {
-                               ExceptionUtils.logAndShowError("Cannot create documen version UI", e1);
+                               ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_CannotCreateDocumentVersionUI, e1);
                        }
                        
 
@@ -129,7 +129,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                public String perform(ReadGraph graph) throws DatabaseException {
                                        Resource res = AdaptionUtils.adaptToSingle(forSelection, Resource.class);
                                        if (res == null)
-                                               return "N/A";
+                                               return Messages.DocumentTabContribution_6;
                                        Layer0 l0 = Layer0.getInstance(graph);
                                        return graph.getPossibleRelatedValue(res, l0.HasName);
                                }
@@ -169,7 +169,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                try {
                                        adapter.openEditor(resource);
                                } catch (Exception e) {
-                                       ExceptionUtils.logAndShowError("Cannot open editor", e);
+                                       ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_7, e);
                                }
                        }
                });
@@ -194,7 +194,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        label.setText(name);
                        text = new Text(parent, SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);
                        showButton = new Button(parent, SWT.PUSH);
-                       showButton.setText("Show");
+                       showButton.setText(Messages.DocumentTabContribution_8);
                        showButton.addSelectionListener(new SelectionAdapter() {
                                @Override
                                public void widgetSelected(SelectionEvent e) {
@@ -203,7 +203,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                }
                        });
                        removeButton = new Button(parent, SWT.PUSH);
-                       removeButton.setText("Unset");
+                       removeButton.setText(Messages.DocumentTabContribution_9);
                        removeButton.addSelectionListener(new SelectionAdapter() {
                                @Override
                                public void widgetSelected(SelectionEvent e) {
@@ -219,7 +219,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                                });
                                                revisionDoc = null;
                                        } catch (DatabaseException e1) {
-                                               ExceptionUtils.logAndShowError("Cannot remove document revision", e1);
+                                               ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_10, e1);
                                        }
                                        updateUI();
                                }
@@ -297,7 +297,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                                
                                @Override
                                public void exception(AsyncReadGraph graph, Throwable t) {
-                                       ExceptionUtils.logAndShowError("Cannot show document revision", t);
+                                       ExceptionUtils.logAndShowError(Messages.DocumentTabContribution_11, t);
                                }
                                
                                @Override
@@ -318,7 +318,7 @@ public class DocumentTabContribution extends AbstractResourceTabContribution{
                        if (revisionDoc != null)
                                text.setText(revisionDoc.getName());
                        else
-                               text.setText("");
+                               text.setText(""); //$NON-NLS-1$
                }
                
                private void setRevisionDoc(final Resource toSet) {
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/Messages.java
new file mode 100644 (file)
index 0000000..8263dd2
--- /dev/null
@@ -0,0 +1,28 @@
+package org.simantics.document.ui.contribution;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.contribution.messages"; //$NON-NLS-1$
+       public static String DocumentTabContribution_10;
+       public static String DocumentTabContribution_11;
+       public static String DocumentTabContribution_6;
+       public static String DocumentTabContribution_7;
+       public static String DocumentTabContribution_8;
+       public static String DocumentTabContribution_9;
+       public static String DocumentTabContribution_CannotCreateDocumentVersionUI;
+       public static String DocumentTabContribution_Document;
+       public static String DocumentTabContribution_Name;
+       public static String DocumentTabContribution_New;
+       public static String DocumentTabContribution_Old;
+       public static String DocumentTabContribution_Show;
+       public static String NameInputValidator_CannotHaveDuplicateName;
+       public static String NameInputValidator_EmptyNameNotAllowed;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 14ff5f60d62e7a4f49cb238fcb2431dd0d38400f..009d803f8a218d9397ff6646b956f975484b1d4f 100644 (file)
@@ -3,6 +3,7 @@ package org.simantics.document.ui.contribution;
 import java.util.Collection;
 
 import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.Simantics;
 import org.simantics.browsing.ui.swt.widgets.impl.Widget;
 import org.simantics.db.ReadGraph;
@@ -20,7 +21,7 @@ public class NameInputValidator implements IInputValidator, Widget {
        @Override
        public String isValid(final String newText) {
                if (newText == null || newText.length() == 0)
-                       return "Empty name is not allowed";
+                       return Messages.NameInputValidator_EmptyNameNotAllowed;
                if (selection != null) {
                        try {
                                return Simantics.getSession().syncRequest(new Read<String>() {
@@ -36,7 +37,7 @@ public class NameInputValidator implements IInputValidator, Widget {
                                                                continue;
                                                        String n = graph.getPossibleRelatedValue(resource, l0.HasName);
                                                        if (newText.equals(n))
-                                                               return "Cannot have duplicate name " + newText;
+                                                               return NLS.bind(Messages.NameInputValidator_CannotHaveDuplicateName, newText);
                                                }
                                                return null;
                                        }
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/messages.properties
new file mode 100644 (file)
index 0000000..a2278ac
--- /dev/null
@@ -0,0 +1,14 @@
+DocumentTabContribution_10=Cannot remove document revision
+DocumentTabContribution_11=Cannot show document revision
+DocumentTabContribution_6=N/A
+DocumentTabContribution_7=Cannot open editor
+DocumentTabContribution_8=Show
+DocumentTabContribution_9=Unset
+DocumentTabContribution_CannotCreateDocumentVersionUI=Cannot create document version UI
+DocumentTabContribution_Document=Document
+DocumentTabContribution_Name=Name
+DocumentTabContribution_New=New
+DocumentTabContribution_Old=Old
+DocumentTabContribution_Show=Show
+NameInputValidator_CannotHaveDuplicateName=Cannot have duplicate name {0}
+NameInputValidator_EmptyNameNotAllowed=Empty name is not allowed
index 2c63d61577dd9e10c6dfaa1f4a2c39ff888c937e..23253242392a8178b1f10d6534df28e00e33c261 100644 (file)
@@ -92,7 +92,7 @@ public class AnnotationConfigurator {
                VirtualGraph vg = null;
                if (useVG) {
                        VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
-                       vg = support.getMemoryPersistent("document_annotation");
+                       vg = support.getMemoryPersistent("document_annotation"); //$NON-NLS-1$
                }
                Variable annotationHolder = null;
                try {
@@ -101,7 +101,7 @@ public class AnnotationConfigurator {
                                        Layer0 l0 = Layer0.getInstance(graph);
                                        Resource annotationHolderDoc = graph.newResource();
                                        graph.claim(annotationHolderDoc, l0.InstanceOf, type);
-                                       graph.claimLiteral(annotationHolderDoc, l0.HasName, "Template");
+                                       graph.claimLiteral(annotationHolderDoc, l0.HasName, "Template"); //$NON-NLS-1$
                                        graph.claim(lib, l0.ConsistsOf, annotationHolderDoc);
                                        if (graph.isInstanceOf(lib, type)) {
                                                copyAnnotations(graph, lib, annotationHolderDoc);
@@ -187,7 +187,7 @@ public class AnnotationConfigurator {
                
                if (useVG) {
                        VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
-                       VirtualGraph vg = support.getMemoryPersistent("document_annotation");
+                       VirtualGraph vg = support.getMemoryPersistent("document_annotation"); //$NON-NLS-1$
                        support.discard(vg);
                } else {
                        
index a8ae3c19510d452226864c35232c3b8d39ff8421..c8ac4ca31ffccb12b302e3d22c4047ee9518d543 100644 (file)
@@ -86,16 +86,16 @@ public class FileDetailDialog extends TextInputDialog{
                GridDataFactory.fillDefaults().hint(500, 500).applyTo(composite);
                
                Label label = new Label(composite, SWT.NONE);
-               label.setText("File:");
+               label.setText(Messages.FileDetailDialog_File);
                fileText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                Button browseButton = new Button(composite, SWT.PUSH);
-               browseButton.setText("Browse");
+               browseButton.setText(Messages.FileDetailDialog_Browse);
                label = new Label(composite, SWT.NONE);
-               label.setText("Name:");
+               label.setText(Messages.FileDetailDialog_Name);
                nameText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                label = new Label(composite, SWT.NONE);
                label = new Label(composite, SWT.NONE);
-               label.setText("Annotations:");
+               label.setText(Messages.FileDetailDialog_Annotations);
                annotationComposite = new Composite(composite, SWT.NONE);
                annotationComposite.setLayout(new FillLayout());
                
@@ -130,7 +130,7 @@ public class FileDetailDialog extends TextInputDialog{
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                FileDialog dialog = new FileDialog(e.display.getActiveShell(),SWT.OPEN);
-                               dialog.setFilterExtensions(new String[]{"*.*"});
+                               dialog.setFilterExtensions(new String[]{"*.*"}); //$NON-NLS-1$
                                String s = dialog.open();
                                if (s != null) {
                                        name = null;
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/Messages.java
new file mode 100644 (file)
index 0000000..be49534
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.document.ui.dialogs;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.dialogs.messages"; //$NON-NLS-1$
+       public static String FileDetailDialog_Annotations;
+       public static String FileDetailDialog_Browse;
+       public static String FileDetailDialog_File;
+       public static String FileDetailDialog_Name;
+       public static String UrlDetailDialog_Annotations;
+       public static String UrlDetailDialog_Name;
+       public static String UrlDetailDialog_URL;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ef3739e1adefaaadd413bee197c1df704ccf8b4c..1c0efc6da6a01a7f63ca80e5177ec78e38f6f61c 100644 (file)
@@ -86,13 +86,13 @@ public class UrlDetailDialog extends TextInputDialog{
                GridDataFactory.fillDefaults().hint(500, 500).applyTo(composite);
                
                Label label = new Label(composite, SWT.NONE);
-               label.setText("URL:");
+               label.setText(Messages.UrlDetailDialog_URL);
                urlText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                label = new Label(composite, SWT.NONE);
-               label.setText("Name:");
+               label.setText(Messages.UrlDetailDialog_Name);
                nameText = new Text(composite, SWT.SINGLE|SWT.BORDER);
                label = new Label(composite, SWT.NONE);
-               label.setText("Annotations:");
+               label.setText(Messages.UrlDetailDialog_Annotations);
                annotationComposite = new Composite(composite, SWT.BORDER);
                annotationComposite.setLayout(new FillLayout());
 //             
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/dialogs/messages.properties
new file mode 100644 (file)
index 0000000..5d07228
--- /dev/null
@@ -0,0 +1,7 @@
+FileDetailDialog_Annotations=Annotations:\r
+FileDetailDialog_Browse=Browse\r
+FileDetailDialog_File=File:\r
+FileDetailDialog_Name=Name:\r
+UrlDetailDialog_Annotations=Annotations:\r
+UrlDetailDialog_Name=Name:\r
+UrlDetailDialog_URL=URL:\r
index effe30cd9b51c0ead4d1b7e97105d48c93fd0838..a500aa12c93a040fb867ab74fab7bd9677ddb395 100644 (file)
@@ -101,13 +101,13 @@ public class All {
                Resource documentType = graph.getSingleObject(binding, DOC.DocumentTypeBinding_HasDocumentType);
                Resource document = graph.newResource();
                graph.claim(document, L0.InstanceOf, null, DOC.ScenegraphDocument);
-               graph.claimLiteral(document, L0.HasName, "Documentation");
+               graph.claimLiteral(document, L0.HasName, "Documentation"); //$NON-NLS-1$
                graph.claim(resource, DOC.HasDocumentation, document);
                graph.claim(document, L0.PartOf, resource);
 
                Resource scenegraph = graph.newResource();
                graph.claim(scenegraph, L0.InstanceOf, null, documentType);
-               graph.claimLiteral(scenegraph, L0.HasName, "Scenegraph");
+               graph.claimLiteral(scenegraph, L0.HasName, "Scenegraph"); //$NON-NLS-1$
                graph.claim(scenegraph, L0.PartOf, document);
                graph.claim(document, DOC.ScenegraphDocument_scenegraph, scenegraph);
 
@@ -286,7 +286,7 @@ public class All {
 
        Variable result = ScenegraphLoaderProcess.getVariable(graph, null, scenegraph, ScenegraphLoaderUtils.getRuntime(graph, context), root);
        if(result != null) {
-               Variable userDoc = result.getPossibleProperty(graph, "UserDocumentation");
+               Variable userDoc = result.getPossibleProperty(graph, "UserDocumentation"); //$NON-NLS-1$
                if(userDoc != null) return userDoc;
        }
        
@@ -309,7 +309,7 @@ public class All {
     @SCLValue(type = "ReadGraph -> Resource -> Variable -> a")
     public static Object wikitextModifier(ReadGraph graph, final Resource resource, final Variable context) throws DatabaseException {
        
-               final ScenegraphPropertyReference<String> textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text");
+               final ScenegraphPropertyReference<String> textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text"); //$NON-NLS-1$
        
        return new FunctionImpl1<Object, Object>() {
 
@@ -323,12 +323,12 @@ public class All {
 
                                                @Override
                                                public void perform(WriteGraph graph) throws DatabaseException {
-                                                       Variable selection = resolveEditSelection(graph, context, "..../Scroll/Browser#edited");
+                                                       Variable selection = resolveEditSelection(graph, context, "..../Scroll/Browser#edited"); //$NON-NLS-1$
                                                        if (selection != null) {
                                                            selection.setValue(graph, (String)value, Bindings.STRING);
                                                                graph.markUndoPoint();
                                                        } else {
-                                                               LOGGER.error("No selection for resource : " + resource + ", Variable context : " + context + ", value : " + value);
+                                                               LOGGER.error("No selection for resource : " + resource + ", Variable context : " + context + ", value : " + value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                                        }
                                                }
                                                
@@ -351,7 +351,7 @@ public class All {
     @SCLValue(type = "ReadGraph -> Resource -> Variable -> String")
     public static String selectedDocumentPart(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
 
-               Variable selection = resolveEditSelection(graph, context, ".../Scroll/Browser#edited");
+               Variable selection = resolveEditSelection(graph, context, ".../Scroll/Browser#edited"); //$NON-NLS-1$
                if(selection == null) return null;
 
        return selection.getValue(graph);
@@ -389,8 +389,8 @@ public class All {
                final ScenegraphPropertyReference<Point> selectionReference;
 
        public WikiButtonModifier(ReadGraph graph, Variable context) throws DatabaseException {
-               textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text");
-               selectionReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#selection");
+               textReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#text"); //$NON-NLS-1$
+               selectionReference = ScenegraphLoaderUtils.getRelativePropertyReference(SWTThread.getThreadAccess(), graph, context, ".../TextContainer/Text#selection"); //$NON-NLS-1$
        }
        
        abstract void perform(String before, String selected, String after, Point selection);
@@ -417,9 +417,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "'''bold text'''" + after);
+                                       textReference.setValue(before + "'''bold text'''" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "'''" + selected + "'''" + after);      
+                                       textReference.setValue(before + "'''" + selected + "'''" + after);       //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -437,9 +437,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "''italic text''" + after);
+                                       textReference.setValue(before + "''italic text''" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "''" + selected + "''" + after);        
+                                       textReference.setValue(before + "''" + selected + "''" + after);         //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -457,9 +457,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">strikethrough text</span>" + after);
+                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">strikethrough text</span>" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">" + selected + "</span>" + after);       
+                                       textReference.setValue(before + "<span style=\"text-decoration:line-through;\">" + selected + "</span>" + after);        //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -477,9 +477,9 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">strikethrough text</span>" + after);
+                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">strikethrough text</span>" + after); //$NON-NLS-1$
                                } else {
-                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">" + selected + "</span>" + after);  
+                                       textReference.setValue(before + "<span style=\"text-decoration:underline;\">" + selected + "</span>" + after);   //$NON-NLS-1$ //$NON-NLS-2$
                                }
                                
                        }
@@ -496,7 +496,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n<hr/>\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n<hr/>\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -512,7 +512,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + ":" + selected + after);
+                               textReference.setValue(before + ":" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -527,7 +527,7 @@ public class All {
                        
                private String hex2(int value) {
                        String result = Integer.toHexString(value);
-                       if(result.length() == 1) result = "0" + result;
+                       if(result.length() == 1) result = "0" + result; //$NON-NLS-1$
                        return result;
                }
                
@@ -545,9 +545,9 @@ public class All {
                                String hex = hex2(rgb.red) + hex2(rgb.green) + hex2(rgb.blue);
 
                                if(selected.isEmpty()) {
-                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >formatted text</font>" + selected + after);
+                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >formatted text</font>" + selected + after); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                                } else {
-                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >" + selected + "</font>" + after);
+                                       textReference.setValue(before + "<font style=\"font-size:" + size + ";color: #" + hex + ";font-family:" + family + ";\" >" + selected + "</font>" + after); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                                }
                                
                        }
@@ -564,7 +564,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "[[Image:root://Library/image.png|100px]]" + "\r\n" + selected + after);
+                               textReference.setValue(before + "[[Image:root://Library/image.png|100px]]" + "\r\n" + selected + after); //$NON-NLS-1$ //$NON-NLS-2$
                                
                        }
                        
@@ -580,7 +580,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n= Header 1 =\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n= Header 1 =\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -596,7 +596,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n== Header 2 ==\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n== Header 2 ==\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -612,7 +612,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n=== Header 3 ===\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n=== Header 3 ===\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -628,7 +628,7 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n==== Header 4 ====\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n==== Header 4 ====\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -644,11 +644,11 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n" +
-                                               "# Item1\r\n" + 
-                                               "# Item2\r\n" + 
-                                               "## Item2.1\r\n" + 
-                                               "# Item3\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n" + //$NON-NLS-1$
+                                               "# Item1\r\n" +  //$NON-NLS-1$
+                                               "# Item2\r\n" +  //$NON-NLS-1$
+                                               "## Item2.1\r\n" +  //$NON-NLS-1$
+                                               "# Item3\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -664,11 +664,11 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n" +
-                                               "* Item1\r\n" + 
-                                               "* Item2\r\n" + 
-                                               "** Item2.1\r\n" + 
-                                               "* Item3\r\n" + selected + after);
+                               textReference.setValue(before + "\r\n" + //$NON-NLS-1$
+                                               "* Item1\r\n" +  //$NON-NLS-1$
+                                               "* Item2\r\n" +  //$NON-NLS-1$
+                                               "** Item2.1\r\n" +  //$NON-NLS-1$
+                                               "* Item3\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -684,16 +684,16 @@ public class All {
                        @Override
                        void perform(String before, String selected, String after, Point selection) {
 
-                               textReference.setValue(before + "\r\n" +
-                                               "{| border=\"1\"\r\n" + 
-                                               "! header\r\n" +
-                                               "! header2 \r\n" +
-                                               "|-\r\n" +
-                                               "| cell || cell2\r\n" + 
-                                               "|-\r\n" +
-                                               "| cell3\r\n" + 
-                                               "| cell4\r\n" + 
-                                               "|}\r\n"  + selected + after);
+                               textReference.setValue(before + "\r\n" + //$NON-NLS-1$
+                                               "{| border=\"1\"\r\n" +  //$NON-NLS-1$
+                                               "! header\r\n" + //$NON-NLS-1$
+                                               "! header2 \r\n" + //$NON-NLS-1$
+                                               "|-\r\n" + //$NON-NLS-1$
+                                               "| cell || cell2\r\n" +  //$NON-NLS-1$
+                                               "|-\r\n" + //$NON-NLS-1$
+                                               "| cell3\r\n" +  //$NON-NLS-1$
+                                               "| cell4\r\n" +  //$NON-NLS-1$
+                                               "|}\r\n"  + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -707,7 +707,7 @@ public class All {
             @Override
             void perform(String before, String selected, String after, Point selection) {
                 textReference.setValue(before +
-                        "[[Media:root://Documents/Document.pdf|Link to a file within the model]]\r\n" + selected + after);
+                        "[[Media:root://Documents/Document.pdf|Link to a file within the model]]\r\n" + selected + after); //$NON-NLS-1$
                 
             }
         };
@@ -722,7 +722,7 @@ public class All {
                        void perform(String before, String selected, String after, Point selection) {
 
                                textReference.setValue(before +
-                                               "[http://www.simantics.org External Website Link]\r\n" + selected + after);
+                                               "[http://www.simantics.org External Website Link]\r\n" + selected + after); //$NON-NLS-1$
                                
                        }
                        
@@ -752,7 +752,7 @@ public class All {
                                    try {
                                        WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, root, root, rvi));
                                    } catch (PartInitException e) {
-                                       LOGGER.error("Failed to open CSS editor for root " + root, e);
+                                       LOGGER.error("Failed to open CSS editor for root " + root, e); //$NON-NLS-1$
                                    }
                                });
 
@@ -812,17 +812,17 @@ public class All {
     public static String noDocumentText(ReadGraph graph, final Resource resource, final Variable context) throws DatabaseException {
                
        Variable selection = ScenegraphLoaderUtils.getPossibleVariableSelection(graph, context);
-       if(selection == null) return "<no input>";
+       if(selection == null) return "<no input>"; //$NON-NLS-1$
        
                Resource input = selection.getRepresents(graph);
-       if(input == null) return "<no input>";
+       if(input == null) return "<no input>"; //$NON-NLS-1$
        
        String path = DocumentUtils.indexRootPath(graph, selection);
        if(!path.isEmpty()) {
-               return "for " + path + selection.getName(graph);
+               return "for " + path + selection.getName(graph); //$NON-NLS-1$
        }
        
-               return "for " + NameUtils.getSafeLabel(graph, input);
+               return "for " + NameUtils.getSafeLabel(graph, input); //$NON-NLS-1$
        
     }
 
@@ -873,7 +873,7 @@ public class All {
                         DefaultActions.asyncPerformDefaultAction(s, input, false, false, false);
                     }
                 } catch (DatabaseException | InterruptedException e) {
-                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to resolve URI to a database resource or variable: " + uri, e));
+                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to resolve URI to a database resource or variable: " + uri, e)); //$NON-NLS-1$
                 }
             }
             return true;
index 3fc15364dab39f937dddca1b9f10ad7c7241564e..39ae0731b3352c2b92e3b22517602e5ced3556b0 100644 (file)
@@ -27,7 +27,7 @@ public class SearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, R
        public SearchResult apply(IProgressMonitor monitor, ReadGraph graph, Resource model, SearchQuery query, Integer maxResults) {
                 try {
                         Collection<Map<String, Object>> results = Searching.performSearch(graph, Layer0X.getInstance(graph).Dependencies, model,
-                           query.escaped(false).getQuery("Name","Types"), maxResults);
+                           query.escaped(false).getQuery("Name","Types"), maxResults); //$NON-NLS-1$ //$NON-NLS-2$
                        return generateSearchResults(graph, results);
                } catch (DatabaseException e) {
                    Logger.defaultLogError(e);
index 82372f1264a568c21a06927a59c147f7583b6f24..c53fd1ab37038a1791a1603102aad54035065b7d 100644 (file)
@@ -43,7 +43,7 @@ public class DocumentVersionUtils {
        public static void createNewVersion(WriteGraph graph, Resource oldDocument, Resource newDocument, Resource relation) throws DatabaseException{
                DocumentResource doc = DocumentResource.getInstance(graph);
                if (graph.hasStatement(oldDocument, doc.HasNewerVersion))
-                       throw new DatabaseException("Document " + NameUtils.getSafeName(graph, oldDocument) +" has already new version");
+                       throw new DatabaseException("Document " + NameUtils.getSafeName(graph, oldDocument) +" has already new version"); //$NON-NLS-1$ //$NON-NLS-2$
                
                Resource inverse = graph.getInverse(relation);
                Resource lib = graph.getSingleObject(oldDocument, inverse);
@@ -81,7 +81,7 @@ public class DocumentVersionUtils {
                if (!graph.getSingleType(document2, doc.Document).equals(graph.getSingleType(document1, doc.Document)))
                        return;
                if (!versionRel.equals(doc.HasNewerVersion) && !(versionRel.equals(doc.HasOlderVersion)))
-                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel));
+                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel)); //$NON-NLS-1$
                
                Resource versionRelInv = graph.getInverse(versionRel);
                // toSet must not be part of the document's version history
@@ -112,7 +112,7 @@ public class DocumentVersionUtils {
                if (lib != null) {
                        Resource relation = graph.getPossibleObject(lib, doc.HasLibraryRelation);
                        String type= graph.getPossibleRelatedValue(lib, doc.HasVersionType);
-                       if ("TREE".equals(type) && relation != null) {
+                       if ("TREE".equals(type) && relation != null) { //$NON-NLS-1$
                                if (versionRel.equals(doc.HasOlderVersion)) {
                                        graph.deny(document2, graph.getInverse(relation));
                                        graph.claim(document1,relation,document2);
@@ -136,14 +136,14 @@ public class DocumentVersionUtils {
        public static void unsetVersion(WriteGraph graph, Resource document1, Resource document2, Resource versionRel) throws DatabaseException {
                DocumentResource doc = DocumentResource.getInstance(graph);
                if (!versionRel.equals(doc.HasNewerVersion) && !(versionRel.equals(doc.HasOlderVersion)))
-                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel));
+                       throw new IllegalArgumentException("Unknow version relation + " + graph.getPossibleURI(versionRel)); //$NON-NLS-1$
                
                graph.deny(document1, versionRel,document2);
                Resource lib = getLib(graph, document1);
                if (lib != null) {
                        Resource relation = graph.getPossibleObject(lib, doc.HasLibraryRelation);
                        String type= graph.getPossibleRelatedValue(lib, doc.HasVersionType);
-                       if ("TREE".equals(type) && relation != null) {
+                       if ("TREE".equals(type) && relation != null) { //$NON-NLS-1$
                                if (versionRel.equals(doc.HasOlderVersion)) {
                                        graph.deny(document1, relation);
                                        graph.claim(lib,relation,document2);
index 42190d87829283cf165d4ede9a49422abf645fae..07ed6432771cced743a3a1ac5e17f3c7478c913c 100644 (file)
@@ -47,7 +47,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
     private static ExternalFileWatcher fileWatcher;
 
        public ExternalEditorAdapter() {
-               super("External Editor", Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/page.png"));
+               super(Messages.ExternalEditorAdapter_ExternalEditor, Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/page.png")); //$NON-NLS-2$ //$NON-NLS-3$
        }
 
        @Override
@@ -78,7 +78,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                     StringBuilder sb = new StringBuilder();
                     String uri = graph.getPossibleURI(input);
                     if (uri != null) {
-                        sb.append(generateSHA1(uri)).append("_");
+                        sb.append(generateSHA1(uri)).append("_"); //$NON-NLS-1$
                     }
                     sb.append(graph.getRelatedValue(input, Layer0.getInstance(graph).HasName).toString());
                     Path filePath = Activator.getInstanceLocation().resolve(sb.toString());
@@ -86,11 +86,11 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                         try {
                             GraphFileUtil.writeDataToFile(graph, input, filePath.toFile());
                         } catch (IOException | DatabaseException e) {
-                            LOGGER.error("Could not write data to file ", e);
+                            LOGGER.error("Could not write data to file ", e); //$NON-NLS-1$
                         }
                         return input;
                     });
-                    LOGGER.info("Adding tempFile {} with resource {}", filePath, input);
+                    LOGGER.info("Adding tempFile {} with resource {}", filePath, input); //$NON-NLS-1$
                     return filePath;
                 }
             });
@@ -103,20 +103,20 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
     }
 
     public static String generateSHA1(String message) {
-        return hashString(message, "SHA-1");
+        return hashString(message, "SHA-1"); //$NON-NLS-1$
     }
 
     private static String hashString(String message, String algorithm) {
         try {
             MessageDigest digest = MessageDigest.getInstance(algorithm);
-            byte[] hashedBytes = digest.digest(message.getBytes("UTF-8"));
+            byte[] hashedBytes = digest.digest(message.getBytes("UTF-8")); //$NON-NLS-1$
      
             return convertByteArrayToHexString(hashedBytes);
         } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
             // Should not happen
-            LOGGER.error("Could not generate hash", ex);
+            LOGGER.error("Could not generate hash", ex); //$NON-NLS-1$
         }
-        return "";
+        return ""; //$NON-NLS-1$
     }
 
     private static String convertByteArrayToHexString(byte[] arrayBytes) {
@@ -171,15 +171,15 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                             Path parent = keys.get(key);
                             Path newPath = parent.resolve(pathEvent.context());
                             if (ENTRY_MODIFY == kind) {
-                                LOGGER.info("New path modified: " + newPath);
+                                LOGGER.info("New path modified: " + newPath); //$NON-NLS-1$
                                 Resource resource = tempFiles.get(newPath);
                                 if (resource != null) {
                                     GraphFileUtil.writeDataToGraph(newPath.toFile(), resource);
                                 } else {
-                                    LOGGER.warn("No resource found for {}", newPath.toAbsolutePath());
+                                    LOGGER.warn("No resource found for {}", newPath.toAbsolutePath()); //$NON-NLS-1$
                                 }
                             } else if (ENTRY_DELETE == kind) {
-                                System.out.println("New path deleted: " + newPath);
+                                System.out.println("New path deleted: " + newPath); //$NON-NLS-1$
                             }
                         }
                         if (!key.reset()) {
@@ -188,9 +188,9 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                         }
                     } catch (InterruptedException e) {
                         if (!stopped.get())
-                            LOGGER.error("Could not stop", e);
+                            LOGGER.error("Could not stop", e); //$NON-NLS-1$
                     } catch (Throwable t) {
-                        LOGGER.error("An error occured", t);
+                        LOGGER.error("An error occured", t); //$NON-NLS-1$
                     }
                 }
             });
@@ -202,7 +202,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
         
         private void register(Path path) throws IOException {
             if (Files.isDirectory(path)) {
-                LOGGER.info("Registering path {}", path);
+                LOGGER.info("Registering path {}", path); //$NON-NLS-1$
                 WatchKey key = path.toAbsolutePath().register(ws, ENTRY_DELETE, ENTRY_MODIFY);
                 keys.put(key, path);
             }
index 9a9e3f8f10723ddb925f13ae6795df53f1ad36b2..836a822b70603ff07e5195d82cfa976c1f470536 100644 (file)
@@ -11,6 +11,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
@@ -63,7 +64,7 @@ public class FileDocumentUtil {
                        }
                }, e -> {
                        if (e != null)
-                               ExceptionUtils.logAndShowError("Cannot import file " + fileName, e);
+                               ExceptionUtils.logAndShowError(NLS.bind(Messages.FileDocumentUtil_CannotImportFile, fileName), e);
                });
                        
                
@@ -148,7 +149,7 @@ public class FileDocumentUtil {
        public static void importFolder(WriteGraph graph, File folder, Resource folderResource, Resource relation, IProgressMonitor monitor) throws Exception{
                if (monitor != null) {
                        int count = _countFiles(folder);
-                       monitor.beginTask("Import files", count);
+                       monitor.beginTask(Messages.FileDocumentUtil_MonitorImportFiles, count);
                }
                _importFolder(graph, folder, folderResource, relation, monitor);
                if (monitor != null)
@@ -215,7 +216,7 @@ public class FileDocumentUtil {
                        return;
                int i = 1;
                while (true) {
-                       String proposal = name +" (" + i +")";
+                       String proposal = name +" (" + i +")"; //$NON-NLS-1$ //$NON-NLS-2$
                        if (!names.contains(proposal)) {
                                graph.claimLiteral(res, l0.HasName, proposal);
                                return;
@@ -295,12 +296,12 @@ public class FileDocumentUtil {
                                        name = graph.getRelatedValue(r, useResourceNames ? gf.HasResourceName : l0.HasName);
                                        canExport = true;
                                } else if (graph.isInstanceOf(r, doc.UrlDocument)) {
-                                       name = graph.getRelatedValue(r, l0.HasName) +".url";
+                                       name = graph.getRelatedValue(r, l0.HasName) +".url"; //$NON-NLS-1$
                                        canExport = true;
                                }
                                if (canExport) {
                                        name = resolveName(folder, name, names, true);
-                                       File file = new File(folder.getAbsolutePath()+"/"+name);
+                                       File file = new File(folder.getAbsolutePath()+"/"+name); //$NON-NLS-1$
                                        if (graph.isInstanceOf(r, doc.FileDocument)) {
                                                GraphFileUtil.writeDataToFile(graph,r, file);
                                        } else if (graph.isInstanceOf(r, doc.UrlDocument)) {
@@ -317,7 +318,7 @@ public class FileDocumentUtil {
                                if (type.size() == folderType.size() && folderType.containsAll(type)) {
                                        String name = graph.getRelatedValue(r, l0.HasName);
                                        name = resolveName(folder, name, names, false);
-                                       File subFolder = new File(folder.getAbsolutePath()+"/"+name);
+                                       File subFolder = new File(folder.getAbsolutePath()+"/"+name); //$NON-NLS-1$
                                        if (!subFolder.exists()) {
                                                if (!subFolder.mkdir()) {
                                                        // TODO : error.
@@ -337,10 +338,10 @@ public class FileDocumentUtil {
         * @throws DatabaseException
         */
        private static void exportUrl(File toFile, String name, String url) throws Exception{
-               PrintStream os = new PrintStream(toFile,"UTF-8");
-               os.println("[InternetShortcut]");
-               os.println("URL="+url);
-               os.println("name="+name);
+               PrintStream os = new PrintStream(toFile,"UTF-8"); //$NON-NLS-1$
+               os.println("[InternetShortcut]"); //$NON-NLS-1$
+               os.println("URL="+url); //$NON-NLS-1$
+               os.println("name="+name); //$NON-NLS-1$
                os.flush();
                os.close();
        }
@@ -351,11 +352,11 @@ public class FileDocumentUtil {
                String name = null;
                BufferedReader is = null;
                try {
-               is = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
+               is = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); //$NON-NLS-1$
                while ((s = is.readLine()) != null) {
-                       if (s.startsWith("URL=")) {
+                       if (s.startsWith("URL=")) { //$NON-NLS-1$
                                url = s.substring(4);
-                       } else if (s.startsWith("name=")) {
+                       } else if (s.startsWith("name=")) { //$NON-NLS-1$
                                name = s.substring(5);
                        }
                }
@@ -383,7 +384,7 @@ public class FileDocumentUtil {
        }
        
        private static boolean isUrl(File file) throws Exception{
-               return (file.getAbsolutePath().endsWith(".url"));
+               return (file.getAbsolutePath().endsWith(".url")); //$NON-NLS-1$
        }
        
        private static final char ESCAPE = '%';
@@ -413,7 +414,7 @@ public class FileDocumentUtil {
                for (int i = 0; i < len; i++) {
                    char ch = s.charAt(i);
                    if (ch == ESCAPE) {
-                       String num = "0x";
+                       String num = "0x"; //$NON-NLS-1$
                        num += s.charAt(++i);
                        num += s.charAt(++i);
                        ch = (char)Integer.decode(num).intValue();
@@ -433,7 +434,7 @@ public class FileDocumentUtil {
                                if (used.contains(current)) {
                                        current = createFileName(proposal, i);
                                } else {
-                                       File subFile = new File(parentFolder.getAbsolutePath()+"/"+current);
+                                       File subFile = new File(parentFolder.getAbsolutePath()+"/"+current); //$NON-NLS-1$
                                        if (!subFile.exists())
                                                break;
                                        if (subFile.exists() && subFile.isFile() && subFile.canWrite()) {
@@ -447,7 +448,7 @@ public class FileDocumentUtil {
                                if (used.contains(current)) {
                                        current = proposal+i;
                                } else {
-                                       File subFolder = new File(parentFolder.getAbsolutePath()+"/"+current);
+                                       File subFolder = new File(parentFolder.getAbsolutePath()+"/"+current); //$NON-NLS-1$
                                        if (!subFolder.exists())
                                                break;
                                        if (subFolder.exists() && subFolder.isDirectory()) {
@@ -461,7 +462,7 @@ public class FileDocumentUtil {
        }
        
        private static String createFileName(String original, int i) {
-               int extIndex = original.lastIndexOf(".");
+               int extIndex = original.lastIndexOf("."); //$NON-NLS-1$
                if (extIndex == -1)
                        return original+i;
                return original.substring(0,extIndex) + i + original.substring(extIndex);
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/Messages.java
new file mode 100644 (file)
index 0000000..24f39d7
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.document.ui.graphfile;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.graphfile.messages"; //$NON-NLS-1$
+       public static String ExternalEditorAdapter_ExternalEditor;
+       public static String FileDocumentUtil_CannotImportFile;
+       public static String FileDocumentUtil_MonitorImportFiles;
+       public static String UrlEditorAdapter_Browser;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 15e4d6e74f456c507e239334a76e9b7840e82d08..f5c7956d8e97bdafefd7abffabe0413dc2d058b5 100644 (file)
@@ -22,7 +22,7 @@ import org.simantics.utils.ui.ExceptionUtils;
 public class UrlEditorAdapter extends AbstractResourceEditorAdapter implements EditorAdapter {
        
        public UrlEditorAdapter() {
-               super("Browser",Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/world.png"));
+               super(Messages.UrlEditorAdapter_Browser,Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/world.png")); //$NON-NLS-2$ //$NON-NLS-3$
        }
 
        
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/messages.properties
new file mode 100644 (file)
index 0000000..7b56701
--- /dev/null
@@ -0,0 +1,4 @@
+ExternalEditorAdapter_ExternalEditor=External Editor
+FileDocumentUtil_CannotImportFile=Cannot import file {0}
+FileDocumentUtil_MonitorImportFiles=Import files
+UrlEditorAdapter_Browser=Browser
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/messages.properties
new file mode 100644 (file)
index 0000000..23da786
--- /dev/null
@@ -0,0 +1,2 @@
+DocumentView_PinSelection=Pin Selection
+OpenEntityDocumentAdapter_DocumentEditor=Document Editor
index 0959ae9f854b9ba3aa900acc84143f8c26b1466a..67ef4ae0de4b58df895de8912d828448adfaf0f7 100644 (file)
@@ -12,7 +12,7 @@ public abstract  class FileDocumentImportWizard extends Wizard{
        FileSelectionPage fileSelectionPage;
        
        public FileDocumentImportWizard(Resource lib) {
-               setWindowTitle("Document File import");
+               setWindowTitle(Messages.FileDocumentImportWizard_DocumentFileImport);
                setNeedsProgressMonitor(false);
        }
        
index eb43ee79471af3d0da638e45bb426fdcb5a131b7..188d6c46c1529024bf99a70d660c7f02178639f6 100644 (file)
@@ -22,7 +22,7 @@ public class FileSelectionPage extends WizardPage {
        String fileName;
 
        public FileSelectionPage() {
-               super("FileSelction","Select a file",null);
+               super(Messages.FileSelectionPage_FileSelection,Messages.FileSelectionPage_SelectAFile,null);
        }
 
        @Override
@@ -30,7 +30,7 @@ public class FileSelectionPage extends WizardPage {
                parent.setLayout(new GridLayout(3,false));
                fileText = new Text(parent,SWT.BORDER|SWT.SINGLE);
                browseButton = new Button(parent, SWT.PUSH);
-               browseButton.setText("Browse");
+               browseButton.setText(Messages.FileSelectionPage_Browse);
                
                GridData data;
                data = new GridData();
@@ -50,7 +50,7 @@ public class FileSelectionPage extends WizardPage {
                                // TODO : is there any way to read file/executable bindings from OS?
                                //        if is, use those extensions to filter this list.
                                //        note: in windows using "reg query ..." to read bindings form registry would work.
-                               dialog.setFilterExtensions(new String[]{"*.*"});
+                               dialog.setFilterExtensions(new String[]{"*.*"}); //$NON-NLS-1$
                                String name = dialog.open();
                                if (name != null) {
                                        fileText.setText(name);
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/Messages.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/Messages.java
new file mode 100644 (file)
index 0000000..7e9a4fb
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.document.ui.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.document.ui.wizard.messages"; //$NON-NLS-1$
+       public static String FileDocumentImportWizard_DocumentFileImport;
+       public static String FileSelectionPage_Browse;
+       public static String FileSelectionPage_FileSelection;
+       public static String FileSelectionPage_SelectAFile;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/messages.properties b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/wizard/messages.properties
new file mode 100644 (file)
index 0000000..6700a28
--- /dev/null
@@ -0,0 +1,4 @@
+FileDocumentImportWizard_DocumentFileImport=Document File import\r
+FileSelectionPage_Browse=Browse\r
+FileSelectionPage_FileSelection=FileSelction\r
+FileSelectionPage_SelectAFile=Select a file\r
index 1473c02026d97dac18ff08c0df9bef522635d334..932d1aa2257aaad4738df9dd6c72187e417835c9 100644 (file)
@@ -53,7 +53,7 @@ import org.simantics.utils.ui.workbench.StringMemento;
 public class ContentSelectionPage extends WizardPage {
        
        /** Key for preference setting that contains sub-mementos for each content URI. */
-       public static final String KEY_FORMAT_SELECTIONS = "org.simantics.modeling.ui.export.wizard.formatSelections";
+       public static final String KEY_FORMAT_SELECTIONS = "org.simantics.modeling.ui.export.wizard.formatSelections"; //$NON-NLS-1$
 
        // UI stuff
        LocalResourceManager resourceManager;
@@ -81,7 +81,7 @@ public class ContentSelectionPage extends WizardPage {
        List<Content> contentSelection = new ArrayList<Content>();
        
        public ContentSelectionPage(ExportContext ctx) throws ExportException {
-               super("Select Content", "Select the PDF Pages and the attachments", null);
+               super(Messages.ContentSelectionPage_SelectContent, Messages.ContentSelectionPage_SelectContentDescription, null);
                this.ctx = ctx;
                
                init();
@@ -89,44 +89,44 @@ public class ContentSelectionPage extends WizardPage {
        
        void init() throws ExportException {
                try {
-                       System.out.println("Found Content Types:");
+                       System.out.println("Found Content Types:"); //$NON-NLS-1$
                        for ( ContentType ct : ctx.eep.contentTypes() ) {
-                               System.out.println("   "+ct);
+                               System.out.println("   "+ct); //$NON-NLS-1$
                        }
                        System.out.println();
                        
-                       System.out.println("Exporters:");
+                       System.out.println("Exporters:"); //$NON-NLS-1$
                        for ( Exporter ex : ctx.eep.exporters() ) {
-                               System.out.println("   "+ex);
+                               System.out.println("   "+ex); //$NON-NLS-1$
                        }
                        System.out.println();
 
-                       System.out.println("Formats:");
+                       System.out.println("Formats:"); //$NON-NLS-1$
                        for ( Format format : ctx.eep.formats() ) {
-                               System.out.println("   "+format);
+                               System.out.println("   "+format); //$NON-NLS-1$
                        }
                        System.out.println();
 
-                       System.out.println("Discoverers:");
+                       System.out.println("Discoverers:"); //$NON-NLS-1$
                        for ( Discoverer discoverer : ctx.eep.discoverers() ) {
-                               System.out.println("   "+discoverer);
+                               System.out.println("   "+discoverer); //$NON-NLS-1$
                        }
                        System.out.println();
                        
-                       System.out.println("Publishers:");
+                       System.out.println("Publishers:"); //$NON-NLS-1$
                        for ( Publisher publisher : ctx.eep.publishers() ) {
-                               System.out.println("   "+publisher.id());
+                               System.out.println("   "+publisher.id()); //$NON-NLS-1$
                        }
                        System.out.println();
                        
                        // Organize formats by content types - Filter out ContentTypes that don't have exporter and format.
-                       System.out.println("Mapped ContentTypes to Exporters:");
+                       System.out.println("Mapped ContentTypes to Exporters:"); //$NON-NLS-1$
                        typeToFormatMap = MapList.use( new TreeMap<ContentType, List<Format>>(toStringComparator) );
                        for ( ContentType ct : ctx.eep.contentTypes() ) {
                                for ( Exporter exp : ctx.eep.getExportersForContentType( ct.id() ) ) {
                                        Format format = ctx.eep.getFormat( exp.formatId() );
                                        if ( format==null ) continue;
-                                       System.out.println("    "+ct.id()+" -> "+format.fileext());
+                                       System.out.println("    "+ct.id()+" -> "+format.fileext()); //$NON-NLS-1$ //$NON-NLS-2$
                                        if (!typeToFormatMap.contains(ct, format)) typeToFormatMap.add(ct, format);
                                }
                        }
@@ -140,7 +140,7 @@ public class ContentSelectionPage extends WizardPage {
                        for ( String content : ctx.selection ) {
                                initialContentHash = 13*initialContentHash + content.hashCode();
                        }
-                       initialSelectionKey = "InitialSelection-"+initialContentHash;
+                       initialSelectionKey = "InitialSelection-"+initialContentHash; //$NON-NLS-1$
                        String sel = ctx.store.get(initialSelectionKey, null);
                        if ( sel != null ) {
                                initialSelection = ExportWizardResult.parse(sel);
@@ -148,7 +148,7 @@ public class ContentSelectionPage extends WizardPage {
                                // First time wizard was called with this selection.
                                // Check in
                                for ( String contentUri : ctx.selection ) {
-                                       initialSelection.add( new Content(contentUri, null, "all", null, null, null) );
+                                       initialSelection.add( new Content(contentUri, null, "all", null, null, null) ); //$NON-NLS-1$
                                }
                        }
                        
@@ -157,10 +157,10 @@ public class ContentSelectionPage extends WizardPage {
                        StringBuilder modelsStr = new StringBuilder(); 
                        for ( String content : ctx.selection ) {
                                for ( String model : allModels ) {
-                                       if ( content.equals(model) || content.startsWith(model + "/") ) {
+                                       if ( content.equals(model) || content.startsWith(model + "/") ) { //$NON-NLS-1$
                                                if ( !selectedModels.contains( model ) ) {
                                                        selectedModels.add( model );
-                                                       if ( modelsStr.length()>0 ) modelsStr.append(", ");
+                                                       if ( modelsStr.length()>0 ) modelsStr.append(", "); //$NON-NLS-1$
                                                        modelsStr.append( model );
                                                }
                                        }
@@ -172,18 +172,18 @@ public class ContentSelectionPage extends WizardPage {
                        if ( selectedModels.isEmpty() ) selectedModels.addAll( allModels );
                        // UI labels
                        labels = new HashMap<String, Map<String, String>>();                    
-                       labels.put( "model", ctx.session.syncRequest( ExportQueries.labels( selectedModels ) ) ); // Should Model CT be used for labeling? 
+                       labels.put( "model", ctx.session.syncRequest( ExportQueries.labels( selectedModels ) ) ); // Should Model CT be used for labeling?  //$NON-NLS-1$
                        
                        // Discover contents
-                       System.out.println("Discovering content: "+modelsStr);
+                       System.out.println("Discovering content: "+modelsStr); //$NON-NLS-1$
                        content = MapList.use( new TreeMap<ContentType, List<String>>(toStringComparator) );
                        contentToTypeMap = MapList.use( new TreeMap<String, List<ContentType>>(toStringComparator) );
                        modelContent = MapList.use( new TreeMap<String, List<String>>() );
                        
                        for ( ContentType ct : typeToFormatMap.getKeys() ) {
-                               System.out.println("    "+ct.label());
+                               System.out.println("    "+ct.label()); //$NON-NLS-1$
                                for ( Discoverer discoverer : ctx.eep.getDiscoverers( ct.id() )) {
-                                       System.out.println("         "+discoverer.toString());
+                                       System.out.println("         "+discoverer.toString()); //$NON-NLS-1$
                                        
                                        // Get content Uris
                                        Collection<String> contents = discoverer.discoverContent(ctx, selectedModels);
@@ -202,7 +202,7 @@ public class ContentSelectionPage extends WizardPage {
                                                content.add( ct, contentId );
                                                contentToTypeMap.add(contentId, ct);
                                                //modelContent.add(key)
-                                               System.out.println("            "+contentId);
+                                               System.out.println("            "+contentId); //$NON-NLS-1$
                                        }
                                        
                                }
@@ -226,18 +226,18 @@ public class ContentSelectionPage extends WizardPage {
            Color contentTypeColor = resourceManager.createColor( new RGB(245, 245, 252) );
            GridColumn column = new GridColumn(grid,SWT.NONE);
            column.setTree(true);
-           column.setText("Name");
+           column.setText(Messages.ContentSelectionPage_Name);
            column.setWidth(200);           
 
            // "Pagees"
            assertColumnIndex(1);
                    
-           Format pdfFormat = ctx.eep.getFormat("pdf");
+           Format pdfFormat = ctx.eep.getFormat("pdf"); //$NON-NLS-1$
            
            
            ImageDescriptor folderID = null;
                try {
-                       URL folderUrl = new URL("platform:/plugin/com.famfamfam.silk/icons/folder.png");
+                       URL folderUrl = new URL("platform:/plugin/com.famfamfam.silk/icons/folder.png"); //$NON-NLS-1$
                    folderID = ImageDescriptor.createFromURL( folderUrl );
                } catch (MalformedURLException e) {
                        e.printStackTrace();
@@ -257,7 +257,7 @@ public class ContentSelectionPage extends WizardPage {
                if (modelContentType==null) continue;
                
                // Create Model Node
-               String modelLabel = labels.get("model").get(modelUri);
+               String modelLabel = labels.get("model").get(modelUri); //$NON-NLS-1$
                        GridItem modelNode = newLine(grid, modelLabel, modelUri, modelContentType.id()); 
                        setIcon(modelNode, 0, modelContentType.icon(modelUri));
                        modelNode.setToolTipText(0, modelUri);
@@ -319,7 +319,7 @@ public class ContentSelectionPage extends WizardPage {
                                                columnNumber++;
                                                assertColumnIndex( columnNumber );
                                                
-                                               contentNode.setText(columnNumber, "  "+pdfFormat.fileext());
+                                               contentNode.setText(columnNumber, "  "+pdfFormat.fileext()); //$NON-NLS-1$
                                                contentNode.setGrayed(columnNumber, false);
                                            contentNode.setCheckable(columnNumber, true);
                                            contentNode.setChecked(columnNumber, hasInitialSelection(contentUri, pdfFormat.id()) );
@@ -342,7 +342,7 @@ public class ContentSelectionPage extends WizardPage {
                                                if ( !contentTypesFormats.contains(format) ) contentTypesFormats.add(format);
                                                columnNumber++;
                                                assertColumnIndex( columnNumber );
-                                               contentNode.setText(columnNumber, "  "+format.fileext());
+                                               contentNode.setText(columnNumber, "  "+format.fileext()); //$NON-NLS-1$
                                                contentNode.setGrayed(columnNumber, false);
                                            contentNode.setCheckable(columnNumber, true);
                                            contentNode.setChecked(columnNumber, hasInitialSelection(contentUri, format.id()) );
@@ -432,7 +432,7 @@ public class ContentSelectionPage extends WizardPage {
                        int cc = grid.getColumnCount();
                        
                    GridColumn column = new GridColumn(grid, SWT.CHECK);
-                   column.setText( cc==1?"Pages":"Attachments");
+                   column.setText( cc==1?Messages.ContentSelectionPage_Pages:Messages.ContentSelectionPage_Attachments);
                    column.setWidth( cc==1?150:200 );
                    
                    for (GridItem gi : grid.getItems()) {
@@ -446,7 +446,7 @@ public class ContentSelectionPage extends WizardPage {
        boolean hasInitialSelection(String uri, String formatId) {
                for (Content c : initialSelection) {
                        if ( !c.url.equals( uri ) ) continue;
-                       if ( c.formatId.equals("all") || c.formatId.equals(formatId) ) return true;
+                       if ( c.formatId.equals("all") || c.formatId.equals(formatId) ) return true; //$NON-NLS-1$
                }
                return false;
        }
index ea2cb05dc9c1bdaaf9755dfcb3176f8d8e567705..cc4b3092d432c2ed28c013372b97a2e9cbf7d0be 100644 (file)
@@ -11,6 +11,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.IExportWizard;
 import org.eclipse.ui.IWorkbench;
 import org.osgi.service.prefs.BackingStoreException;
@@ -36,7 +37,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
        OptionsPage optionsPage;
 
        public ExportCoreWizard() {
-               setWindowTitle("Export PDF files");
+               setWindowTitle(Messages.ExportCoreWizard_ExportPDFFiles);
                setNeedsProgressMonitor(true);
        }
 
@@ -83,7 +84,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
                        if ( !exportProblems.isEmpty() ) {
                                CollectionUtils.unique(exportProblems);
                                WizardPage cp = (WizardPage) getContainer().getCurrentPage();
-                               String str = CollectionUtils.toString(exportProblems, "\n");
+                               String str = CollectionUtils.toString(exportProblems, "\n"); //$NON-NLS-1$
                                cp.setErrorMessage( str );
                                return false;
                        }
@@ -106,7 +107,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
                        try {
                                ctx.store.flush();
                        } catch (BackingStoreException e) {
-                               ErrorLogger.defaultLogError("Failed to persist wizard preferences.", e);
+                               ErrorLogger.defaultLogError(Messages.ExportCoreWizard_FailedToSavePreferences, e);
                                ExceptionUtils.logError(e);
                        }
                } catch (InvocationTargetException e) {
@@ -119,13 +120,13 @@ public class ExportCoreWizard extends Wizard implements IExportWizard {
                        }
 
                        if (canceled[0]) {
-                               cp.setErrorMessage("Export canceled.");
+                               cp.setErrorMessage(Messages.ExportCoreWizard_FailedToPersistWizardPrefs);
                        } else if (t instanceof IOException) {
-                               ErrorLogger.defaultLogError("An I/O problem occurred while exporting the model. See exception for details.", t);
-                               cp.setErrorMessage("An I/O problem occurred while exporting the model.\nMessage: " + t.getMessage());
+                               ErrorLogger.defaultLogError("An I/O problem occurred while exporting the model. See exception for details.", t); //$NON-NLS-1$
+                               cp.setErrorMessage(NLS.bind(Messages.ExportCoreWizard_IOProblem, t.getMessage()));
                        } else {
-                               ErrorLogger.defaultLogError("Unexpected exception while exporting the model. See exception for details.", t);
-                               cp.setErrorMessage("Unexpected exception while exporting the model. See error log for details.\nMessage: " + t.getMessage());
+                               ErrorLogger.defaultLogError("Unexpected exception while exporting the model. See exception for details.", t); //$NON-NLS-1$
+                               cp.setErrorMessage(NLS.bind(Messages.ExportCoreWizard_UnexpectedException, t.getMessage()));
                        }
                        return false;
                } catch (InterruptedException e) {
diff --git a/bundles/org.simantics.export.ui/src/org/simantics/export/ui/Messages.java b/bundles/org.simantics.export.ui/src/org/simantics/export/ui/Messages.java
new file mode 100644 (file)
index 0000000..b7e68f5
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.export.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.export.ui.messages"; //$NON-NLS-1$
+       public static String ContentSelectionPage_Attachments;
+       public static String ContentSelectionPage_Name;
+       public static String ContentSelectionPage_Pages;
+       public static String ContentSelectionPage_SelectContent;
+       public static String ContentSelectionPage_SelectContentDescription;
+       public static String ExportCoreWizard_FailedToSavePreferences;
+       public static String ExportCoreWizard_ExportPDFFiles;
+       public static String ExportCoreWizard_FailedToPersistWizardPrefs;
+       public static String ExportCoreWizard_IOProblem;
+       public static String ExportCoreWizard_UnexpectedException;
+       public static String OptionsPage_ExportAttachmentOf;
+       public static String OptionsPage_IncludeAttachmentTo;
+       public static String OptionsPage_Merge;
+       public static String OptionsPage_OptionsPage;
+       public static String OptionsPage_OutputOptions;
+       public static String OptionsPage_PublishTo;
+       public static String OptionsPage_SelectExportOptions;
+       public static String OptionsPage_UnExpectedError;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 9d2cea02042eb8432d75f52c03c1a08323a57dce..499974cadab747aa1f244d8613856a3ba41bd7fc 100644 (file)
@@ -11,6 +11,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
 import org.eclipse.swt.layout.GridData;
@@ -65,11 +66,11 @@ import org.simantics.utils.ui.dialogs.ShowMessage;
  */
 public class OptionsPage extends WizardPage {
 
-       public static String S_OUTPUT_OPTIONS = "Output Options";
+       public static String S_OUTPUT_OPTIONS = Messages.OptionsPage_OutputOptions;
        public static LabelReference P_OUTPUT_OPTIONS = new LabelReference( S_OUTPUT_OPTIONS );
        
        /** A reference to combo box selection */
-       public static String S_PUBLISH = "Publish to";
+       public static String S_PUBLISH = Messages.OptionsPage_PublishTo;
        public static ChildReference P_PUBLISH = ChildReference.compile(P_OUTPUT_OPTIONS, new LabelReference(S_PUBLISH));
        
        ExportContext ctx; 
@@ -83,7 +84,7 @@ public class OptionsPage extends WizardPage {
        String selectedPublisherId;
        
        public OptionsPage(ExportContext ctx) throws ExportException {
-               super("Options page", "Select export options", null);
+               super(Messages.OptionsPage_OptionsPage, Messages.OptionsPage_SelectExportOptions, null);
                
                this.ctx = ctx;
        }
@@ -100,7 +101,7 @@ public class OptionsPage extends WizardPage {
                public void handleEvent(Event event) {
                        updatingForm = true;
                        try {
-                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash );
+                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash ); //$NON-NLS-1$
                                Preferences workspaceScopePrefs = ctx.store;
                                
                                Composite outputOptions = (Composite) form.getControl(composite, P_OUTPUT_OPTIONS);
@@ -152,16 +153,16 @@ public class OptionsPage extends WizardPage {
                                updatingForm = false;
                                validate();
                        } catch ( BindingException e ) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } catch (AccessorConstructionException e) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } catch (AccessorException e) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } catch (ExportException e) {
-                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+                               setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
                    ExceptionUtils.logError(e);                 
                        } finally {
                                updatingForm = false;
@@ -243,7 +244,7 @@ public class OptionsPage extends WizardPage {
                        
                        for ( Format format : formats ) {
                                if ( format.isGroupFormat() && contentByFormat.getValues(format).size()>1 ) {
-                                       outputOptions.addComponent("Merge "+format.fileext()+" content into one file", Datatypes.BOOLEAN);
+                                       outputOptions.addComponent(NLS.bind(Messages.OptionsPage_Merge, format.fileext()), Datatypes.BOOLEAN); //$NON-NLS-2$
                                }
                                
                                if ( format.isContainerFormat() ) {
@@ -261,8 +262,8 @@ public class OptionsPage extends WizardPage {
                                        }
                                        
                                        if ( attachmentCount > 0 ) { 
-                                               outputOptions.addComponent("Include attachments to "+format.fileext(), Datatypes.BOOLEAN);
-                                               outputOptions.addComponent("Export attachments of "+format.fileext()+" to separate files", Datatypes.BOOLEAN);
+                                               outputOptions.addComponent(NLS.bind(Messages.OptionsPage_IncludeAttachmentTo, format.fileext()), Datatypes.BOOLEAN);
+                                               outputOptions.addComponent(NLS.bind(Messages.OptionsPage_ExportAttachmentOf, format.fileext()), Datatypes.BOOLEAN); 
                                        }
                                }
                        }
@@ -325,8 +326,8 @@ public class OptionsPage extends WizardPage {
                        {
                                selection = contents;
                                Preferences workspaceScopePrefs = ctx.store;
-                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash );
-                               selectedPublisherId = ctx.store.get("publisherId", "");         
+                               Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash ); //$NON-NLS-1$
+                               selectedPublisherId = ctx.store.get("publisherId", "");          //$NON-NLS-1$ //$NON-NLS-2$
                                Publisher publisher = ctx.eep.getPublisher(selectedPublisherId);
                                if ( publisher != null ) {
                                        
@@ -361,17 +362,17 @@ public class OptionsPage extends WizardPage {
                        
                } catch (BindingException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                        throw new RuntimeBindingException(e);
                } catch (ExportException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                } catch (DatatypeConstructionException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                } catch (AccessorConstructionException e) {
             ExceptionUtils.logError(e);                        
-                       ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+                       ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
                } catch (AccessorException e) {
             ExceptionUtils.logError(e);                        
                        // TODO Auto-generated catch block
@@ -491,7 +492,7 @@ public class OptionsPage extends WizardPage {
                        result.accessor = Accessors.getAccessor(result.options);
                        result.contents = selection;
                        result.type = (RecordType) options.type();
-                       result.publisherId = "file";
+                       result.publisherId = "file"; //$NON-NLS-1$
                        
                        List<ExportAction> actions = new ArrayList<ExportAction>();
                        List<Content> manifest = new ArrayList<Content>(); 
@@ -522,7 +523,7 @@ public class OptionsPage extends WizardPage {
                        
                        String publisherLabel = ExporterUtils.getUnionValue(result.accessor, P_PUBLISH);
                        Publisher publisher = ctx.eep.getPublisherByLabel(publisherLabel);
-                       result.publisherId = publisher==null?"":publisher.id();                 
+                       result.publisherId = publisher==null?"":publisher.id();                  //$NON-NLS-1$
                        
                } catch (BindingException e) {
                        throw new ExportException(e);                   
@@ -554,7 +555,7 @@ public class OptionsPage extends WizardPage {
                }
                
 
-               setErrorMessage( errs.isEmpty() ? null : CollectionUtils.toString(errs, ", ") );
+               setErrorMessage( errs.isEmpty() ? null : CollectionUtils.toString(errs, ", ") ); //$NON-NLS-1$
                setPageComplete( errs.isEmpty() );
        }
                
@@ -572,14 +573,14 @@ public class OptionsPage extends WizardPage {
                        RecordAccessor ra = Accessors.getAccessor(options);
                        String publisherId = ExporterUtils.getUnionValue(ra, P_PUBLISH); 
                        Publisher publisher = ctx.eep.getPublisherByLabel(publisherId);
-                       if ( publisher!=null ) workspaceScopePrefs.put("publisherId", publisher.id());
+                       if ( publisher!=null ) workspaceScopePrefs.put("publisherId", publisher.id()); //$NON-NLS-1$
                        
                        if ( ra.type().hasComponent(P_OUTPUT_OPTIONS.label) ) {
                                RecordAccessor rao = ra.getComponent( P_OUTPUT_OPTIONS );
                                                                
-                               Pattern merge_pattern = Pattern.compile("Merge ([^\\s]*) content into one file");
-                               Pattern include_pattern = Pattern.compile("Include attachments to ([^\\s]*)");
-                               Pattern export_pattern = Pattern.compile("Export attachments of ([^\\s]*) to separate files");
+                               Pattern merge_pattern = Pattern.compile("Merge ([^\\s]*) content into one file"); //$NON-NLS-1$
+                               Pattern include_pattern = Pattern.compile("Include attachments to ([^\\s]*)"); //$NON-NLS-1$
+                               Pattern export_pattern = Pattern.compile("Export attachments of ([^\\s]*) to separate files"); //$NON-NLS-1$
                                
                                for (int i=0; i<rao.count(); i++) {
                                        String name = rao.type().getComponent(i).name;
@@ -590,7 +591,7 @@ public class OptionsPage extends WizardPage {
                                                String fileExt = m.group(1);
                                                Format format = ctx.eep.getFormatByExt(fileExt);
                                                Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
-                                               String key = format.id()+"_merge";
+                                               String key = format.id()+"_merge"; //$NON-NLS-1$
                                                contentScopePrefs.putBoolean(key, value);
                                                workspaceScopePrefs.putBoolean(key, value);
                                        }
@@ -600,7 +601,7 @@ public class OptionsPage extends WizardPage {
                                                String fileExt = m.group(1);
                                                Format format = ctx.eep.getFormatByExt(fileExt);
                                                Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
-                                               String key = format.id()+"_include_attachments";
+                                               String key = format.id()+"_include_attachments"; //$NON-NLS-1$
                                                contentScopePrefs.putBoolean(key, value);
                                                workspaceScopePrefs.putBoolean(key, value);
                                        }
@@ -610,7 +611,7 @@ public class OptionsPage extends WizardPage {
                                                String fileExt = m.group(1);
                                                Format format = ctx.eep.getFormatByExt(fileExt);
                                                Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
-                                               String key = format.id()+"_export_attachments";
+                                               String key = format.id()+"_export_attachments"; //$NON-NLS-1$
                                                contentScopePrefs.putBoolean(key, value);
                                                workspaceScopePrefs.putBoolean(key, value);
                                        }
@@ -639,7 +640,7 @@ public class OptionsPage extends WizardPage {
                //Preferences workspaceScopePrefs = ctx.store;
         try {
                        RecordAccessor ra = Accessors.getAccessor(options);             
-                       String publisherId = workspaceScopePrefs.get("publisherId", "");
+                       String publisherId = workspaceScopePrefs.get("publisherId", ""); //$NON-NLS-1$ //$NON-NLS-2$
                        Publisher publisher = ctx.eep.getPublisher(publisherId);
                        if ( publisher != null ) ExporterUtils.setUnionValue(ra, P_PUBLISH, publisher.label());
                        
@@ -648,7 +649,7 @@ public class OptionsPage extends WizardPage {
                                                                
                                for (Format format : ctx.eep.formats()) {
                                        if ( format.isGroupFormat() ) {
-                                               String key = format.id()+"_merge";
+                                               String key = format.id()+"_merge"; //$NON-NLS-1$
                                                Boolean value = null;
                                                if ( containsKey(contentScopePrefs, key) ) {
                                                        value = contentScopePrefs.getBoolean(key, false); 
@@ -657,7 +658,7 @@ public class OptionsPage extends WizardPage {
                                                }
                                                                                        
                                                if ( value != null ) {
-                                                       String key2 = "Merge "+format.fileext()+" content into one file";
+                                                       String key2 = "Merge "+format.fileext()+" content into one file"; //$NON-NLS-1$ //$NON-NLS-2$
                                                        int index = rao.type().getComponentIndex2(key2);
                                                        if ( index>=0 ) {
                                                                rao.setFieldValue(index, Bindings.BOOLEAN, value);
@@ -666,7 +667,7 @@ public class OptionsPage extends WizardPage {
                                        }
                                        
                                        if ( format.isContainerFormat() ) {
-                                               String key = format.id()+"_include_attachments";
+                                               String key = format.id()+"_include_attachments"; //$NON-NLS-1$
                                                Boolean value = null;
                                                if ( containsKey(contentScopePrefs, key) ) {
                                                        value = contentScopePrefs.getBoolean(key, false); 
@@ -675,7 +676,7 @@ public class OptionsPage extends WizardPage {
                                                }
                                                                                        
                                                if ( value != null ) {
-                                                       String key2 = "Include attachments to "+format.fileext();
+                                                       String key2 = "Include attachments to "+format.fileext(); //$NON-NLS-1$
                                                        int index = rao.type().getComponentIndex2(key2);
                                                        if ( index>=0 ) {
                                                                rao.setFieldValue(index, Bindings.BOOLEAN, value);
@@ -684,7 +685,7 @@ public class OptionsPage extends WizardPage {
                                        }
                                        
                                        if ( format.isContainerFormat() ) {
-                                               String key = format.id()+"_export_attachments";
+                                               String key = format.id()+"_export_attachments"; //$NON-NLS-1$
                                                Boolean value = null;
                                                if ( containsKey(contentScopePrefs, key) ) {
                                                        value = contentScopePrefs.getBoolean(key, false); 
@@ -693,7 +694,7 @@ public class OptionsPage extends WizardPage {
                                                }
                                                                                        
                                                if ( value != null ) {
-                                                       String key2 = "Export attachments of "+format.fileext()+" to separate files";
+                                                       String key2 = "Export attachments of"+format.fileext()+" to separate files"; //$NON-NLS-2$
                                                        int index = rao.type().getComponentIndex2(key2);
                                                        if ( index>=0 ) {
                                                                rao.setFieldValue(index, Bindings.BOOLEAN, value);
@@ -717,7 +718,7 @@ public class OptionsPage extends WizardPage {
        public void savePrefs() throws ExportException {
                try {
                        int oldSelectionHash = selectionHash;                   
-                       Preferences contentScopePrefs = ctx.store.node( "Selection-"+oldSelectionHash );
+                       Preferences contentScopePrefs = ctx.store.node( "Selection-"+oldSelectionHash ); //$NON-NLS-1$
                        Preferences workspaceScopePrefs = ctx.store;
                                        
                        RecordBinding binding = ctx.databoard.getMutableBinding( form.type() );
@@ -767,11 +768,11 @@ public class OptionsPage extends WizardPage {
                                
                                for (Format format : ctx.eep.formats()) {
                                        if ( format.isContainerFormat() ) {
-                                               String key = "Include attachments to "+format.fileext();
+                                               String key = "Include attachments to "+format.fileext(); //$NON-NLS-1$
                                                int index = rao.type().getComponentIndex2(key);
                                                if ( index>=0 ) rao.setFieldValue(index, Bindings.BOOLEAN, true);
                                                
-                                               key = "Export attachments of "+format.fileext()+" to separate files";;
+                                               key = "Export attachments of "+format.fileext()+" to separate files";; //$NON-NLS-1$ //$NON-NLS-2$
                                                index = rao.type().getComponentIndex2(key);
                                                if ( index>=0 ) rao.setFieldValue(index, Bindings.BOOLEAN, true);
                                        }                       
diff --git a/bundles/org.simantics.export.ui/src/org/simantics/export/ui/messages.properties b/bundles/org.simantics.export.ui/src/org/simantics/export/ui/messages.properties
new file mode 100644 (file)
index 0000000..1fa88dc
--- /dev/null
@@ -0,0 +1,18 @@
+ContentSelectionPage_Attachments=Attachments
+ContentSelectionPage_Name=Name
+ContentSelectionPage_Pages=Pages
+ContentSelectionPage_SelectContent=Select Content
+ContentSelectionPage_SelectContentDescription=Select the PDF Pages and the attachments
+ExportCoreWizard_FailedToSavePreferences=Failed to persist wizard preferences.
+ExportCoreWizard_ExportPDFFiles=Export PDF files
+ExportCoreWizard_FailedToPersistWizardPrefs=Export canceled.
+ExportCoreWizard_IOProblem=An I/O problem occurred while exporting the model.\nMessage: {0}
+ExportCoreWizard_UnexpectedException=Unexpected exception while exporting the model. See error log for details.\nMessage: {0}
+OptionsPage_ExportAttachmentOf=Export attachments of {0} to separate files
+OptionsPage_IncludeAttachmentTo=Include attachments to {0}
+OptionsPage_Merge=Merge {0} content into one file
+OptionsPage_OptionsPage=Options page
+OptionsPage_OutputOptions=Output Options
+OptionsPage_PublishTo=Publish to
+OptionsPage_SelectExportOptions=Select export options
+OptionsPage_UnExpectedError=Unexpected error
index fbe3ce7240f0ad55455d188cfb6872aa26affdd3..1bdcd15757985cd2ef14366630fc6499414f4aa0 100644 (file)
@@ -40,13 +40,13 @@ public class ImportFileHandler {
         // Sanity check
         for (int i = 0; i < filterExtensions.length; i++) {
             String extension = filterExtensions[i];
-            if (!extension.startsWith("*.")) {
-                System.err.println("Invalid extension filter provied: " + extension);
+            if (!extension.startsWith("*.")) { //$NON-NLS-1$
+                System.err.println("Invalid extension filter provied: " + extension); //$NON-NLS-1$
             }
         }
 
         FileDialog dialog = new FileDialog(shell, SWT.OPEN);
-        dialog.setText("Choose File");
+        dialog.setText(Messages.ImportFileHandler_ChooseFile);
         dialog.setFilterExtensions(filterExtensions);
         dialog.setFilterNames(filterNames);
         final String fileName = dialog.open();
@@ -62,11 +62,11 @@ public class ImportFileHandler {
                        selectedResource = a.getAdapter(Resource.class);
                }
         } catch(NullPointerException | ClassCastException npe) {
-               LOGGER.warn("Failed to find selection, passing null to file importer", npe);
+               LOGGER.warn("Failed to find selection, passing null to file importer", npe); //$NON-NLS-1$
         }
         
         FileImportService.performFileImport(Paths.get(fileName), Optional.of(selectedResource), Optional.of((Consumer<Throwable>) t -> {
-            LOGGER.error("Could not import file " + fileName, t);
+            LOGGER.error("Could not import file " + fileName, t); //$NON-NLS-1$
         }));
     }
 }
\ No newline at end of file
diff --git a/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/Messages.java b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/Messages.java
new file mode 100644 (file)
index 0000000..b6aa8dc
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.fileimport.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.fileimport.ui.messages"; //$NON-NLS-1$
+       public static String ImportFileHandler_ChooseFile;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/messages.properties b/bundles/org.simantics.fileimport.ui/src/org/simantics/fileimport/ui/messages.properties
new file mode 100644 (file)
index 0000000..ef53624
--- /dev/null
@@ -0,0 +1 @@
+ImportFileHandler_ChooseFile=Choose File
index dc9d1ada709eab4bb7bc3f10a94cb2e6ebf15792..f8f775932396c4eac8313d465d544ca4f3240297 100644 (file)
@@ -39,9 +39,9 @@ public class GraphvizComponentExample {
     private static Graph createGraph() {
         Graph graph = new Graph();
 
-        Node node1 = new Node(graph, "A");
-        Node node2 = new Node(graph, "B");
-        new Edge(graph, node1, node2).setLabel("A to B");
+        Node node1 = new Node(graph, "A"); //$NON-NLS-1$
+        Node node2 = new Node(graph, "B"); //$NON-NLS-1$
+        new Edge(graph, node1, node2).setLabel("A to B"); //$NON-NLS-1$
 
         return graph;
     }
index 2c39d32a7c6da4197e9f480437f634f1f440e782..2ee40c530ebb1f2c2dc354dc36a161e6d413877f 100644 (file)
@@ -75,7 +75,7 @@ public abstract class AbstractGraphvizEditorPart extends EditorPart {
         * @param graph
         */
     public void asyncSetGraph(final Graph graph) {
-       Job job = new Job("Layouting a graph") {
+       Job job = new Job(Messages.AbstractGraphvizEditorPart_LayoutingAGraph) {
 
                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
index 6ba556da09d65f1076bb4108e9e2fb35dcca190d..9bcf9433dd47f328ef4b917401bb73ac3add4bbf 100644 (file)
@@ -69,8 +69,8 @@ public class GraphvizComponent extends Composite {
     }
     
     private void workaroundJava7FocusProblem(Frame frame) {
-        String ver = System.getProperty("java.version");
-        if (ver.startsWith("1.7") || ver.startsWith("1.8")) {
+        String ver = System.getProperty("java.version"); //$NON-NLS-1$
+        if (ver.startsWith("1.7") || ver.startsWith("1.8")) { //$NON-NLS-1$ //$NON-NLS-2$
             try {
                 frame.addWindowListener(new Java7FocusFixListener(this, frame));
             } catch (SecurityException e) {
@@ -90,7 +90,7 @@ public class GraphvizComponent extends Composite {
         Frame frame;
 
         public Java7FocusFixListener(Control control, Frame frame) throws NoSuchMethodException, SecurityException {
-            this.shellSetActiveControl = Shell.class.getDeclaredMethod("setActiveControl", Control.class);
+            this.shellSetActiveControl = Shell.class.getDeclaredMethod("setActiveControl", Control.class); //$NON-NLS-1$
             this.frame = frame;
             this.control = control;
         }
@@ -137,7 +137,7 @@ public class GraphvizComponent extends Composite {
                     initialized.wait();
             }
         } catch (InterruptedException e) {
-            throw new Error("GraphvizComponent AWT population interrupted for class " + this, e);
+            throw new Error("GraphvizComponent AWT population interrupted for class " + this, e); //$NON-NLS-1$
         }
     }
 
@@ -147,7 +147,7 @@ public class GraphvizComponent extends Composite {
      * @param graph
      */
     public void setGraph(Graph graph) {
-        setGraph(graph, "dot");
+        setGraph(graph, "dot"); //$NON-NLS-1$
     }
 
     /**
@@ -210,7 +210,7 @@ public class GraphvizComponent extends Composite {
     
     public void save(File file) throws IOException {
        if (drawable == null) {
-                       throw new IOException("Nothing to save");
+                       throw new IOException("Nothing to save"); //$NON-NLS-1$
                }
                Graph graph = drawable.getGraph();
                String algo = drawable.getAlgorithm();
@@ -222,16 +222,16 @@ public class GraphvizComponent extends Composite {
     }
     
     public String[] getFileExtensions() {
-       return new String[]{"*.svg","*.dot","*.eps", "*.jpg", "*.jpeg","*.pdf","*.png","*.ps"};
+       return new String[]{"*.svg","*.dot","*.eps", "*.jpg", "*.jpeg","*.pdf","*.png","*.ps"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
     }
     
     public String[] getFileNames() {
-       return new String[]{"Scalable Vector Graphics Image",  "DOT Image", "Encapsulated PostScript Image","JPG Image","JPG Image","Portable Document Format Image","Portable Network Graphics Image","PostScript Image"};
+       return new String[]{"Scalable Vector Graphics Image",  "DOT Image", "Encapsulated PostScript Image","JPG Image","JPG Image","Portable Document Format Image","Portable Network Graphics Image","PostScript Image"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
     }
     
     public static String getExtension(File file) {
                String filename = file.getName();
-               int index = filename.lastIndexOf(".");
+               int index = filename.lastIndexOf("."); //$NON-NLS-1$
                if (index < 0)
                        return null;
                return filename.substring(index+1).toLowerCase();
index 32988cd40fe440fbc36c664a72825bea5c66fa42..9d417f28b3990535473d1d5201bd15ae00143601 100644 (file)
@@ -65,7 +65,7 @@ public class GraphvizComponent2 extends Composite {
                     initialized.wait();
             }
         } catch (InterruptedException e) {
-            throw new Error("GraphvizComponent AWT population interrupted for class " + this, e);
+            throw new Error("GraphvizComponent AWT population interrupted for class " + this, e); //$NON-NLS-1$
         }
     }
 
@@ -75,7 +75,7 @@ public class GraphvizComponent2 extends Composite {
      * @param graph
      */
     public Computation<Graph> setGraph(Graph graph) {
-        return setGraph(graph, "dot");
+        return setGraph(graph, "dot"); //$NON-NLS-1$
     }
 
     /**
diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/Messages.java b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/Messages.java
new file mode 100644 (file)
index 0000000..2930b48
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.graphviz.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.graphviz.ui.messages"; //$NON-NLS-1$
+       public static String AbstractGraphvizEditorPart_LayoutingAGraph;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/messages.properties b/bundles/org.simantics.graphviz.ui/src/org/simantics/graphviz/ui/messages.properties
new file mode 100644 (file)
index 0000000..73b755b
--- /dev/null
@@ -0,0 +1 @@
+AbstractGraphvizEditorPart_LayoutingAGraph=Layouting a graph\r
index a298474555691434846493ea614aa8be7ab744c1..3ab4d8b0a1c452618b6cee82cfbae7e3522d6c1e 100644 (file)
@@ -40,7 +40,7 @@ public class HelpFileDocumentProvider extends AbstractDocumentProvider {
                 public Document perform(ReadGraph graph) throws DatabaseException {
                     currentText = HelpUtils.readHelpFileContents(graph, resource);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -59,14 +59,14 @@ public class HelpFileDocumentProvider extends AbstractDocumentProvider {
 
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog("HelpFileDocumentProvider.doSaveDocument");
+        TimeLogger.resetTimeAndLog("HelpFileDocumentProvider.doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
             public void perform(WriteGraph graph) throws DatabaseException {
                 graph.markUndoPoint();
                 HelpUtils.saveHelpFileContents(graph, resource, currentText);
-                Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING));
+                Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$
             }
         });
     }
index 56e692607736ab0eec55b01c49d42a7e877e575b..1626a1b590ed7e8ef6f277bd590d1d2913270214 100644 (file)
@@ -22,7 +22,7 @@ import winterwell.markdown.editors.MarkdownEditor;
 
 public class HelpFileEditor extends MarkdownEditor {
 
-    private static final String EDITOR_ID = "org.simantics.help.ui.HelpFileEditor";
+    private static final String EDITOR_ID = "org.simantics.help.ui.HelpFileEditor"; //$NON-NLS-1$
 
     private boolean disposed;
 
@@ -45,7 +45,7 @@ public class HelpFileEditor extends MarkdownEditor {
         try {
             getResourceInput().init(null);
         } catch (DatabaseException e) {
-            throw new PartInitException("Failed to initialize " + input, e);
+            throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$
         }
 
     }
diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/Messages.java b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/Messages.java
new file mode 100644 (file)
index 0000000..2a6c049
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.help.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.help.ui.messages"; //$NON-NLS-1$
+       public static String OpenHelpFileAdapter_HelpFileEditor;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 38d33e0a230fd8a52d9a85829521f8d24f5305bf..33b347aaa0eed8a500c96b4f52630749fc010d40 100644 (file)
@@ -22,7 +22,7 @@ public class OpenHelpFileAdapter extends AbstractResourceEditorAdapter {
     private static final Logger LOGGER = LoggerFactory.getLogger(OpenHelpFileAdapter.class);
 
     public OpenHelpFileAdapter() {
-        super("Help File Editor");
+        super(Messages.OpenHelpFileAdapter_HelpFileEditor);
     }
 
     protected String getEditorId() {
@@ -51,7 +51,7 @@ public class OpenHelpFileAdapter extends AbstractResourceEditorAdapter {
                             String editorId = getEditorId();
                             WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, input, model, rvi));
                         } catch (PartInitException e) {
-                            LOGGER.error("Failed to open an editor for help file.", e);
+                            LOGGER.error("Failed to open an editor for help file.", e); //$NON-NLS-1$
                         }
                     }
                 });
diff --git a/bundles/org.simantics.help.ui/src/org/simantics/help/ui/messages.properties b/bundles/org.simantics.help.ui/src/org/simantics/help/ui/messages.properties
new file mode 100644 (file)
index 0000000..24de2b0
--- /dev/null
@@ -0,0 +1 @@
+OpenHelpFileAdapter_HelpFileEditor=Help File Editor\r
index f10ada1e154fe375e224f7421206c6997f92068f..f602d31d40a86a691bdd5bb899bee12deb08171d 100644 (file)
@@ -37,20 +37,20 @@ public class CreateImage extends WriteRequest {
     public static Resource getType(ReadGraph graph, ImageSource source) throws DatabaseException {
        ImageResource IMAGE = ImageResource.getInstance(graph);
        String name = source.name.toLowerCase();
-       if(name.endsWith("svg")) return IMAGE.SvgImage;
-       else if(name.endsWith("png")) return IMAGE.PngImage;
-       else if(name.endsWith("jpg") || name.endsWith("jpeg")) return IMAGE.JpegImage;
-       else if(name.endsWith("gif")) return IMAGE.GifImage;
-       else throw new DatabaseException("Unsupported image format " + source.name);
+       if(name.endsWith("svg")) return IMAGE.SvgImage; //$NON-NLS-1$
+       else if(name.endsWith("png")) return IMAGE.PngImage; //$NON-NLS-1$
+       else if(name.endsWith("jpg") || name.endsWith("jpeg")) return IMAGE.JpegImage; //$NON-NLS-1$ //$NON-NLS-2$
+       else if(name.endsWith("gif")) return IMAGE.GifImage; //$NON-NLS-1$
+       else throw new DatabaseException("Unsupported image format " + source.name); //$NON-NLS-1$
     }
     
     public static void claimLiteral(WriteGraph graph, Resource image, ImageSource source) throws DatabaseException {
         String name = source.name.toLowerCase();
-        if (name.endsWith("svg"))
+        if (name.endsWith("svg")) //$NON-NLS-1$
             graph.claimValue(image, new String(source.data), Bindings.STRING);
-        else if (name.endsWith("png") || name.endsWith("jpg") || name.endsWith("jpeg") || name.endsWith("gif"))
+        else if (name.endsWith("png") || name.endsWith("jpg") || name.endsWith("jpeg") || name.endsWith("gif")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
             graph.claimValue(image, source.data, Bindings.BYTE_ARRAY);
-       else throw new DatabaseException("Unsupported image format " + source.name);
+       else throw new DatabaseException("Unsupported image format " + source.name); //$NON-NLS-1$
     }
 
     @Override
@@ -66,7 +66,7 @@ public class CreateImage extends WriteRequest {
        graph.claimLiteral(image, L0.HasName, source.name, Bindings.STRING);
        claimLiteral(graph, image, source);
        graph.claim(parent, L0.ConsistsOf, image);
-       Layer0Utils.addCommentMetadata(graph, "Imported image " + source.name + " " + image.toString());
+       Layer0Utils.addCommentMetadata(graph, "Imported image " + source.name + " " + image.toString()); //$NON-NLS-1$ //$NON-NLS-2$
        return image;
        
 //     if(file.getPath().endsWith("svg")) {
index 2fe579533849adef66152b0ba9dfb87d096212c3..45a8487cc5c03bfc34c21d14b8d29b1df0b784a9 100644 (file)
@@ -15,6 +15,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 
+import org.eclipse.osgi.util.NLS;
 import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.common.request.WriteRequest;
@@ -41,7 +42,7 @@ public class CreateImages extends WriteRequest {
                 ImageSource src = ImportImagesActionFactory.toImageSource(file);
                 new CreateImage(container, src).perform(graph);
             } catch (IOException e) {
-                ErrorLogger.defaultLogError("Failed to import image " + file.getName() + ", see exception for details.", e);
+                ErrorLogger.defaultLogError(NLS.bind(Messages.CreateImages_FailedToImportPage, file.getName()), e); 
             }
         }
     }
index d9286b00411355de066600e85be0211c5407da2a..80e8d5b68a7018feee45be4711d333df7ea096ae 100644 (file)
@@ -57,9 +57,9 @@ public class ImportImagesActionFactory implements ActionFactory {
 
     public static Collection<File> requestImportedImages(Shell parentShell) {
         FileDialog dialog = new FileDialog(parentShell, SWT.MULTI);
-        dialog.setText("Choose image to be imported");
-        dialog.setFilterExtensions( new String[] {"*.jpg;*.png;*.gif;*.svg", "*.jpg;*.jpeg", "*.png", "*.gif", "*.svg"} );
-        dialog.setFilterNames( new String[] {"All Images", "JPEG Image", "PNG Image", "GIF Image", "SVG Image"} );
+        dialog.setText(Messages.ImportImagesActionFactory_ChooseImageToBeImported);
+        dialog.setFilterExtensions( new String[] {"*.jpg;*.png;*.gif;*.svg", "*.jpg;*.jpeg", "*.png", "*.gif", "*.svg"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+        dialog.setFilterNames( new String[] {Messages.ImportImagesActionFactory_FilterAllImage, Messages.ImportImagesActionFactory_FilterJPEGImage, Messages.ImportImagesActionFactory_FilterPNGImage, Messages.ImportImagesActionFactory_FilterGIFImages, Messages.ImportImagesActionFactory_FilterSVGImage} );
         //dialog.setFilterExtensions( new String[] {"*.jpg", "*.png", "*.gif"} );
         final String filename = dialog.open();
         if (filename == null)
diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/Messages.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/Messages.java
new file mode 100644 (file)
index 0000000..4876911
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.image.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.image.ui.messages"; //$NON-NLS-1$
+       public static String CreateImages_FailedToImportPage;
+       public static String ImportImagesActionFactory_ChooseImageToBeImported;
+       public static String ImportImagesActionFactory_FilterAllImage;
+       public static String ImportImagesActionFactory_FilterGIFImages;
+       public static String ImportImagesActionFactory_FilterJPEGImage;
+       public static String ImportImagesActionFactory_FilterPNGImage;
+       public static String ImportImagesActionFactory_FilterSVGImage;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 2539dbd70b37d5886a48ef4113c6c6ce9144e039..a9ab8aef6041b8287c468a6656628c5024c46496 100644 (file)
@@ -64,7 +64,7 @@ import com.kitfox.svg.SVGUniverse;
  */
 public class ImageEditor extends ResourceEditorPart {
 
-    public static final String EDITOR_ID   = "org.simantics.wiki.ui.image.editor";
+    public static final String EDITOR_ID   = "org.simantics.wiki.ui.image.editor"; //$NON-NLS-1$
 
     protected boolean          disposed          = false;
 
index d4be8900b6c5baad9b6c2e6400e97e1e9e9d051d..8b12f8eae29bf3091225cb635e6f1e7a00e27fb2 100644 (file)
@@ -36,9 +36,9 @@ public class Activator extends AbstractUIPlugin {
                
         Bundle bundle = context.getBundle();
 
-               IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png"));
-               IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png"));
-               ADD_IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/add_image.png"));
+               IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png")); //$NON-NLS-1$
+               IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png")); //$NON-NLS-1$
+               ADD_IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/add_image.png")); //$NON-NLS-1$
        }
 
        /*
diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/messages.properties b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/messages.properties
new file mode 100644 (file)
index 0000000..851ed41
--- /dev/null
@@ -0,0 +1,7 @@
+CreateImages_FailedToImportPage=Failed to import image {0}, see exception for details.\r
+ImportImagesActionFactory_ChooseImageToBeImported=Choose image to be imported\r
+ImportImagesActionFactory_FilterAllImage=All Images\r
+ImportImagesActionFactory_FilterGIFImages=GIF Image\r
+ImportImagesActionFactory_FilterJPEGImage=JPEG Image\r
+ImportImagesActionFactory_FilterPNGImage=PNG Image\r
+ImportImagesActionFactory_FilterSVGImage=SVG Image\r
index ec82fa5beff3371fa6590b22adacd1bbbd5f5806..f656e81411b3a78e83723413bb0faa948eea0aa3 100644 (file)
@@ -45,7 +45,7 @@ public class Image extends ViewpointContributor<ImagesNode> {
 
     @Override
     public String getViewpointId() {
-        return "Standard";
+        return "Standard"; //$NON-NLS-1$
     }
 
     protected Read<Collection<Resource>> getChildRequest(ReadGraph graph, ImagesNode lib) throws DatabaseException {
index 3c0366d2dfc4682a98b39b17ad99143f53e92791..900857339638c8a90ae51f7bcc252919cf96d70a 100644 (file)
@@ -24,7 +24,7 @@ public class ImageLabeler extends LabelerContributor<ImageNode> {
         Layer0 L0 = Layer0.getInstance(graph);
         String name = graph.getPossibleRelatedValue(node.data, L0.HasName, Bindings.STRING);
         if(name == null)
-            name = "No name";
+            name = "No name"; //$NON-NLS-1$
         return name;    
     }
 
index 498b3e0b3ecba309926a1df1c66bec5024a481e7..0d9d91ffb6b3b1c7d55d465088adc4c5df166a2e 100644 (file)
@@ -37,7 +37,7 @@ public class Images extends ViewpointContributor<AbstractNode<Resource>> {
     
     @Override
     public String getViewpointId() {
-        return "Standard";
+        return "Standard"; //$NON-NLS-1$
     }
 
 }
\ No newline at end of file
index 21dc1df64bfb1d4bff938d9861ed50969db04f4d..74f622e91184d10271661ada1660ecdde260aea1 100644 (file)
@@ -19,7 +19,7 @@ public class ImagesLabeler extends LabelerContributor<ImagesNode> {
 
     @Override
     public String getLabel(ReadGraph graph, ImagesNode node) throws DatabaseException {
-        return "Images";
+        return Messages.ImagesLabeler_Images;
     }
 
 }
diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Messages.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/Messages.java
new file mode 100644 (file)
index 0000000..f43a5b9
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.image.ui.modelBrowser;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.image.ui.modelBrowser.messages"; //$NON-NLS-1$
+       public static String ImagesLabeler_Images;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/messages.properties b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/messages.properties
new file mode 100644 (file)
index 0000000..2c1fd4a
--- /dev/null
@@ -0,0 +1 @@
+ImagesLabeler_Images=Images\r
index 9a40b357770090b0563d80bb0ae42514420c7220..8d73a7d2b551644e5c02b595c791c3067367d9b7 100644 (file)
@@ -41,7 +41,7 @@ public class All {
                 final Resource issueSource = ResourceAdaptionUtils.toSingleResource(context);
                 try {
                     VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
-                    Simantics.getSession().syncRequest(new WriteRequest(support.getWorkspacePersistent("preferences")) {
+                    Simantics.getSession().syncRequest(new WriteRequest(support.getWorkspacePersistent("preferences")) { //$NON-NLS-1$
                         @Override
                         public void perform(WriteGraph graph) throws DatabaseException {
                                IssueResource ISSUE = IssueResource.getInstance(graph);
index 10de114c780b55a6b2cb1162940fc57d6ecc7053..c845ed08235cdafc51909803c72035277907c194 100644 (file)
@@ -59,7 +59,7 @@ public class IssueImageRule implements ImageRule {
     @Override
     public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {
         Variable issue = (Variable) content;
-        String severity = issue.getPossiblePropertyValue(graph, "severity");
+        String severity = issue.getPossiblePropertyValue(graph, "severity"); //$NON-NLS-1$
         if (severity == null)
             return Collections.emptyMap();
         boolean resolved = isResolved(graph, issue);
@@ -71,17 +71,17 @@ public class IssueImageRule implements ImageRule {
         if (issueResource != null)
             return graph.hasStatement(issueResource, IssueResource.getInstance(graph).Resolved);
 
-        Boolean resolved = issue.getPossiblePropertyValue(graph, "resolved");
+        Boolean resolved = issue.getPossiblePropertyValue(graph, "resolved"); //$NON-NLS-1$
         return Boolean.TRUE.equals(resolved);
     }
 
     private ImageDescriptor toImageDescriptor(String severity) {
         switch (severity) {
-        case "Fatal":   return fatal;
-        case "Error":   return error;
-        case "Warning": return warning;
-        case "Info":    return info;
-        case "Note":    return note;
+        case "Fatal":   return fatal; //$NON-NLS-1$
+        case "Error":   return error; //$NON-NLS-1$
+        case "Warning": return warning; //$NON-NLS-1$
+        case "Info":    return info; //$NON-NLS-1$
+        case "Note":    return note; //$NON-NLS-1$
         default:        return help;
         }
     }
index 1d9b1099c5dd84fd9d3139cbd4c6523e9b5499bc..ada862d86b585b5b628847bce8c407bbef986df9 100644 (file)
@@ -25,7 +25,7 @@ public class IssueLabelRule implements LabelRule {
 
     public static final IssueLabelRule INSTANCE = new IssueLabelRule();
 
-    private static final String[] COLS = new String[] { ColumnKeys.SINGLE, "Resource", "Path" };
+    private static final String[] COLS = new String[] { ColumnKeys.SINGLE, Messages.IssueLabelRule_Resource, Messages.IssueLabelRule_Path };
 
     public IssueLabelRule() {
     }
@@ -39,9 +39,9 @@ public class IssueLabelRule implements LabelRule {
     public Map<String,String> getLabel(ReadGraph graph, Object content) throws DatabaseException {
 
         Variable issue = (Variable)content;
-        String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") );
-        String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") );
-        String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") );
+        String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); //$NON-NLS-1$
+        String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); //$NON-NLS-1$
+        String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); //$NON-NLS-1$
 
         String[] result = new String[] { description, resource, path };
         return new ArrayMap<String, String>(COLS, result);
index 162eeff87d5913862e9ff2fa7d5a799c3831dccf..0ced6dff5428708e2447e750c5ad4d3193d6ba4f 100644 (file)
@@ -67,13 +67,13 @@ public class IssueView2 extends ModelledView {
                         private String formName(ReadGraph graph, Resource r) throws DatabaseException {
                             String name = NameUtils.getSafeName(graph, r);
                             final Resource project = Simantics.getProjectResource();
-                            String projectUri = project != null ? graph.getPossibleURI(project) : "";
+                            String projectUri = project != null ? graph.getPossibleURI(project) : ""; //$NON-NLS-1$
                             String uri = graph.getPossibleURI(r);
                             if (uri != null) {
                                 if (uri.startsWith(projectUri))
                                     uri = uri.substring(projectUri.length());
                             }
-                            return uri != null ? name + " (" + uri + ")" : name;
+                            return uri != null ? name + " (" + uri + ")" : name; //$NON-NLS-1$ //$NON-NLS-2$
                         }
 
                         private Resource getConfiguration(ReadGraph graph, Resource r) throws DatabaseException {
@@ -95,7 +95,7 @@ public class IssueView2 extends ModelledView {
             }
             setVisible(true);
         } else {
-            setContentDescription("Issues not available.");
+            setContentDescription(Messages.IssueView2_IssuesNotAvailable);
             setVisible(false);
         }
     }
diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/Messages.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/Messages.java
new file mode 100644 (file)
index 0000000..4371be0
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.issues.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.issues.ui.messages"; //$NON-NLS-1$
+       public static String IssueLabelRule_Path;
+       public static String IssueLabelRule_Resource;
+       public static String IssueView2_IssuesNotAvailable;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index b4b27bbf4aeff5c48d6b35839fe09d427fc417cd..0efb4648af12cf574301e66941e7686b99bea68e 100644 (file)
@@ -69,7 +69,7 @@ public class SetSeverityAction implements ActionFactory, ActionFactory2 {
                                        IssueResource ISSUE = IssueResource.getInstance(graph);
                                        graph.deny(resource, ISSUE.Issue_HasSeverity);
                                        graph.claim(resource, ISSUE.Issue_HasSeverity, null, severity);
-                                       Layer0Utils.addCommentMetadata(graph, "Changed severity of " + NameUtils.getSafeLabel(graph, resource) + " to " + NameUtils.getSafeName(graph, severity));      
+                                       Layer0Utils.addCommentMetadata(graph, "Changed severity of " + NameUtils.getSafeLabel(graph, resource) + " to " + NameUtils.getSafeName(graph, severity));       //$NON-NLS-1$ //$NON-NLS-2$
                                }
                        });
                }
index 32e6683dd871f1013f15d8dd2684157fad66b424..dede35358d63742bb450ab026ef3b3029f34f9a0 100644 (file)
@@ -52,9 +52,9 @@ public class SeverityFolderLabelRule implements LabelRule {
         Set<Variable> issues = graph.syncRequest(new IssuesOfSeverity(project, severity));
         
         if(issues.size() > 1) {
-               return Collections.singletonMap(DESCRIPTION, severityName + "s (" + issues.size() + " items)");
+               return Collections.singletonMap(DESCRIPTION, severityName + "s (" + issues.size() + " items)"); //$NON-NLS-1$ //$NON-NLS-2$
         } else {
-               return Collections.singletonMap(DESCRIPTION, severityName + "s (1 item)");
+               return Collections.singletonMap(DESCRIPTION, severityName + "s (1 item)"); //$NON-NLS-1$
         }
         
     }
index cee7c8aefbb123b7ea8b0326cf0a5de7bd57e423..eb78ecc22f2ecd80910da183c1f93d57fd9e9467 100644 (file)
@@ -53,7 +53,7 @@ public enum IssueLabelDecorationRule implements LabelDecorationRule {
             user = graph.hasStatement(issueR, ISSUE.UserIssue);
             resolved = graph.hasStatement(issueR, ISSUE.Resolved);
         } else {
-            hidden = Boolean.TRUE.equals(issue.getPossiblePropertyValue(graph, "hidden", Bindings.BOOLEAN));
+            hidden = Boolean.TRUE.equals(issue.getPossiblePropertyValue(graph, "hidden", Bindings.BOOLEAN)); //$NON-NLS-1$
         }
 
         int index = (hidden ? 1 : 0) + (user ? 2 : 0) + (resolved ? 4 : 0);
index e4d09e011a304f92d7ee97916977d2132f5e70e4..b168583e4e0fb1cb8bfb9cccfe412e14fb9f1887 100644 (file)
@@ -99,8 +99,8 @@ public class ConfigureIssueSources extends AbstractHandler {
         Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
          ListDialog<IssueSourceEntry> dialog = new ListDialog<IssueSourceEntry>(
                  shell, sources,
-                 "Select available issue sources",
-                 "Selected sources will be used and existing deselected sources will be removed.") {
+                 Messages.ConfigureIssueSources_SelectAvailableIssueSources,
+                 Messages.ConfigureIssueSources_SelectedSourcesAddRemoveMsg) {
                 
                    protected CheckboxTableViewer createViewer(Composite composite) {
                        CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(
index 6659a5227ccff3635b46ee173e2c5087f49c7c44..dc7b26a24ad0f8c25f7d2e60a71d351492960ae2 100644 (file)
@@ -58,7 +58,7 @@ import org.simantics.utils.ui.ExceptionUtils;
  */
 public class ExportIssuesAsCsv extends AbstractHandler {
 
-    private static final String PROP_LAST_VALIDATION_REPORT_PATH= "validation.report.path";
+    private static final String PROP_LAST_VALIDATION_REPORT_PATH= "validation.report.path"; //$NON-NLS-1$
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
@@ -81,9 +81,9 @@ public class ExportIssuesAsCsv extends AbstractHandler {
                 Layer0X L0X = Layer0X.getInstance(graph);
                 SimulationResource SIMU = SimulationResource.getInstance(graph);
                 for (Resource model : graph.syncRequest(new ObjectsWithType(Simantics.getProjectResource(), L0X.Activates, SIMU.Model))) {
-                    return NameUtils.getSafeName(graph, model) + ".txt";
+                    return NameUtils.getSafeName(graph, model) + ".txt"; //$NON-NLS-1$
                 }
-                return "issues.txt";
+                return "issues.txt"; //$NON-NLS-1$
             }
         });
 
@@ -105,9 +105,9 @@ public class ExportIssuesAsCsv extends AbstractHandler {
         final DataContainer<PrintStream> externalOutput = new DataContainer<PrintStream>();
 
         FileDialog fd = new FileDialog(parentShell, SWT.SAVE);
-        fd.setText("Select Validation Output");
-        fd.setFilterExtensions(new String[] { "*.txt", "*.*" });
-        fd.setFilterNames(new String[] { "Comma-Separated Values (*.txt)", "All Files (*.*)" });
+        fd.setText(Messages.ExportIssuesAsCsv_SelectValidationOutput);
+        fd.setFilterExtensions(new String[] { "*.txt", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$
+        fd.setFilterNames(new String[] { Messages.ExportIssuesAsCsv_CommaSeparatedValues, Messages.ExportIssuesAsCsv_AllFiles });
         if (lastReportPath != null)
             fd.setFilterPath(lastReportPath);
         fd.setFileName(fileName);
@@ -141,12 +141,12 @@ public class ExportIssuesAsCsv extends AbstractHandler {
     }
 
     private void export(IProgressMonitor monitor, PrintStream out) throws DatabaseException {
-        SubMonitor progress = SubMonitor.convert(monitor, "Export issues", IProgressMonitor.UNKNOWN);
+        SubMonitor progress = SubMonitor.convert(monitor, Messages.ExportIssuesAsCsv_ExportIssues, IProgressMonitor.UNKNOWN);
         Simantics.getSession().syncRequest(new ReadRequest() {
             @Override
             public void run(ReadGraph graph) throws DatabaseException {
                 Collection<Variable> activeIssues = graph.syncRequest(new AllVisibleIssues(Simantics.getProjectResource()));
-                out.println("# Exported issues (" + activeIssues.size() + ")");
+                out.println("# Exported issues (" + activeIssues.size() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
                 for (Variable issue : activeIssues) {
                     exportIssue(graph, issue, out, 0);
                     progress.worked(1);
@@ -156,7 +156,7 @@ public class ExportIssuesAsCsv extends AbstractHandler {
                         graph.syncRequest(new DynamicIssueSources(Simantics.getProjectResource())));
                 if (!dynamicIssueSources.isEmpty()) {
                     out.println();
-                    out.println("# Dynamic Issues");
+                    out.println("# Dynamic Issues"); //$NON-NLS-1$
                     for (Variable source : dynamicIssueSources.values()) {
                         exportDynamicIssueSource(progress, graph, source, out, 0);
                     }
@@ -168,7 +168,7 @@ public class ExportIssuesAsCsv extends AbstractHandler {
     private Map<String, Variable> nameMap(ReadGraph graph, Set<Variable> sources) throws DatabaseException {
         TreeMap<String, Variable> sorted = new TreeMap<>();
         for (Variable v : sources) {
-            String name = v.getPossiblePropertyValue(graph, "HasDescription", Bindings.STRING);
+            String name = v.getPossiblePropertyValue(graph, "HasDescription", Bindings.STRING); //$NON-NLS-1$
             if (name == null)
                 name = v.getName(graph);
             sorted.put(name, v);
@@ -185,13 +185,13 @@ public class ExportIssuesAsCsv extends AbstractHandler {
     }
 
     private void exportIssue(ReadGraph graph, Variable issue, PrintStream out, int startColumn) throws DatabaseException {
-        String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") );
-        String severity = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "severity") );
-        String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") );
-        String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") );
+        String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); //$NON-NLS-1$
+        String severity = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "severity") ); //$NON-NLS-1$
+        String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); //$NON-NLS-1$
+        String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); //$NON-NLS-1$
         for (int i = 0; i < startColumn; ++i)
-            out.print(";");
-        out.println(description + ";" + severity + ";" + resource + ";" + path);
+            out.print(";"); //$NON-NLS-1$
+        out.println(description + ";" + severity + ";" + resource + ";" + path); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
 }
\ No newline at end of file
index 38b2c93e285ee4abaa5c4348e4e682851bdcf5a0..50251754f3d6d1e33c0b9b6d7626483ec3ea222f 100644 (file)
@@ -63,14 +63,14 @@ class FunctionHandler extends PreferenceHandler {
         }
         if (!hiders.isEmpty()) {
             SCLContext ctx = SCLContext.getCurrent();
-            Object oldGraph = ctx.put("graph", graph);
+            Object oldGraph = ctx.put("graph", graph); //$NON-NLS-1$
             try {
                 for (Function f : hiders)
                     f.apply(argument);
             } catch (Throwable t) {
                 throw new DatabaseException(t);
             } finally {
-                ctx.put("graph", oldGraph);
+                ctx.put("graph", oldGraph); //$NON-NLS-1$
             }
         }
     }
index ebdb5a4b2d3d63a90d9ec8075661b78ba048d346..6f6c427af85441049169263f674f89529d20acf0 100644 (file)
@@ -33,7 +33,7 @@ public class Help implements ActionFactory {
                if (target instanceof Variable) {
                        return () -> {
                                try {
-                                       String id = Simantics.sync(new PossibleVariablePropertyValue<String>((Variable) target, "contextualHelpId", Bindings.STRING));
+                                       String id = Simantics.sync(new PossibleVariablePropertyValue<String>((Variable) target, "contextualHelpId", Bindings.STRING)); //$NON-NLS-1$
                                        if (id == null) {
                                                PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
                                                return;
index 299b71346609bcc74f7f1fd3dfbd094736f24852..b7861301051556d64ba881db354577bd6e7763e1 100644 (file)
@@ -18,7 +18,7 @@ package org.simantics.issues.ui.handler;
 public class Hide extends FunctionHandler {
 
     public Hide() {
-        super(null, "hider", Boolean.TRUE);
+        super(null, "hider", Boolean.TRUE); //$NON-NLS-1$
     }
 
 }
index b607eb7e1b065602aa0c0250599ad940b67445a4..7969b5d026adff7c2d37effe4e368d556a7dbeaa 100644 (file)
@@ -116,19 +116,19 @@ public class MenuActions extends DynamicMenuContribution {
     }
 
     private IAction unhideAction(List<Resource> input) {
-        return tagAction("Unhide", Activator.UNHIDE_ICON, IssueResource.URIs.Hidden, false, input);
+        return tagAction(Messages.MenuActions_Unhide, Activator.UNHIDE_ICON, IssueResource.URIs.Hidden, false, input);
     }
 
     private IAction hideAction(List<Resource> input) {
-        return tagAction("Hide", Activator.HIDE_ICON, IssueResource.URIs.Hidden, true, input);
+        return tagAction(Messages.MenuActions_Hide, Activator.HIDE_ICON, IssueResource.URIs.Hidden, true, input);
     }
 
     private IAction resolveAction(List<Resource> input) {
-        return tagAction("Mark Resolved", Activator.RESOLVE_ICON, IssueResource.URIs.Resolved, true, input);
+        return tagAction(Messages.MenuActions_MarkResolved, Activator.RESOLVE_ICON, IssueResource.URIs.Resolved, true, input);
     }
 
     private IAction unresolveAction(List<Resource> input) {
-        return tagAction("Mark Unresolved", Activator.UNRESOLVE_ICON, IssueResource.URIs.Resolved, false, input);
+        return tagAction(Messages.MenuActions_MarkUnresolved, Activator.UNRESOLVE_ICON, IssueResource.URIs.Resolved, false, input);
     }
 
     private IAction tagAction(String label, ImageDescriptor image, String tagURI, boolean tag, List<Resource> input) {
@@ -141,7 +141,7 @@ public class MenuActions extends DynamicMenuContribution {
             @Override
             public void fill(Menu menu, int index) {
                 MenuItem setSeverityItem = new MenuItem(menu, SWT.CASCADE);
-                setSeverityItem.setText("Set Severity");
+                setSeverityItem.setText(Messages.MenuActions_SetSeverity);
                 Menu setSeverity = new Menu(menu);
                 setSeverityItem.setMenu(setSeverity);
                 for (final Severity sev : Severity.values()) {
@@ -150,7 +150,7 @@ public class MenuActions extends DynamicMenuContribution {
 
                     MenuItem item = new MenuItem(setSeverity, SWT.PUSH);
                     item.setText(sev.toString().toLowerCase());
-                    item.setImage(Activator.getDefault().getImageRegistry().get(sev.toString() + "-full"));
+                    item.setImage(Activator.getDefault().getImageRegistry().get(sev.toString() + "-full")); //$NON-NLS-1$
                     item.addSelectionListener(new SelectionAdapter() {
                         @Override
                         public void widgetSelected(SelectionEvent e) {
diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Messages.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/Messages.java
new file mode 100644 (file)
index 0000000..1d98e75
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.issues.ui.handler;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.issues.ui.handler.messages"; //$NON-NLS-1$
+       public static String ConfigureIssueSources_SelectAvailableIssueSources;
+       public static String ConfigureIssueSources_SelectedSourcesAddRemoveMsg;
+       public static String ExportIssuesAsCsv_AllFiles;
+       public static String ExportIssuesAsCsv_CommaSeparatedValues;
+       public static String ExportIssuesAsCsv_ExportIssues;
+       public static String ExportIssuesAsCsv_SelectValidationOutput;
+       public static String MenuActions_Hide;
+       public static String MenuActions_MarkResolved;
+       public static String MenuActions_MarkUnresolved;
+       public static String MenuActions_SetSeverity;
+       public static String MenuActions_Unhide;
+       public static String PurgeResolvedIssues_MonitorPurgingResolvedIssues;
+       public static String PurgeResolvedIssues_PurgedResolvedBatchIssues;
+       public static String PurgeResolvedIssues_PurgingResolvedBatchIssues;
+       public static String RunActiveValidations_MonitorPreparingResourcesForValidation;
+       public static String RunActiveValidations_ValidateModel;
+       public static String RunActiveValidations_Validation;
+       public static String RunActiveValidations_ValidationPreparation;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 633c8d96dd46b7136634c773146d5a37906da396..1890228f40193324d7538433beadc81dae684f3a 100644 (file)
@@ -41,7 +41,7 @@ public class NewUserIssue extends AbstractHandler {
                 public void perform(WriteGraph graph) throws DatabaseException {
                     graph.markUndoPoint();
                     Resource issue = IssueUtils.newUserIssueForModel(graph);
-                    Layer0Utils.addCommentMetadata(graph, "Created new User Issue " + NameUtils.getSafeLabel(graph, issue) + " " + issue.toString());
+                    Layer0Utils.addCommentMetadata(graph, "Created new User Issue " + NameUtils.getSafeLabel(graph, issue) + " " + issue.toString()); //$NON-NLS-1$ //$NON-NLS-2$
                 }
             });
         } catch (DatabaseException e) {
index 20a343938b804c23691e7c80386c1521584a1080..8840406d5735a9340a5ccb61dcdc2a800c8753ce 100644 (file)
@@ -52,11 +52,11 @@ class PreferenceHandler extends AbstractHandler implements IElementUpdater, Acti
     private final boolean  tag;
 
     public PreferenceHandler() {
-        this("preferences", null, false);
+        this("preferences", null, false); //$NON-NLS-1$
     }
 
     public PreferenceHandler(String tagURI, boolean tag) {
-        this("preferences", tagURI, tag);
+        this("preferences", tagURI, tag); //$NON-NLS-1$
     }
 
     public PreferenceHandler(String virtualGraphId) {
index 90eded9ba876531f7ae3cdf97e712a459d84e584..862b475738050f3a31e76d5cbbd14ee4681c346a 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.PlatformUI;
 import org.simantics.Simantics;
 import org.simantics.browsing.ui.common.ErrorLogger;
@@ -71,15 +72,15 @@ public class PurgeResolvedIssues extends AbstractHandler {
         if (project == null)
             return;
 
-        final SubMonitor mon = SubMonitor.convert(monitor, "Purging resolved issues...", 100);
+        final SubMonitor mon = SubMonitor.convert(monitor, Messages.PurgeResolvedIssues_MonitorPurgingResolvedIssues, 100);
 
         session.syncRequest(new DelayedWriteRequest() {
             @Override
             public void perform(WriteGraph graph) throws DatabaseException {
                 graph.markUndoPoint();
                 IssueResource ISSUE = IssueResource.getInstance(graph);
-                Set<Resource> toBeRemoved = new HashSet<Resource>();
-                Map<Resource, Boolean> sourceIsContinuous = new THashMap<Resource, Boolean>(); 
+                Set<Resource> toBeRemoved = new HashSet<>();
+                Map<Resource, Boolean> sourceIsContinuous = new THashMap<>();
                 for (Resource activeIssue : graph.syncRequest(new AllActiveIssues(project))) {
                     if (graph.hasStatement(activeIssue, ISSUE.Resolved)) {
                         Resource managedBy = graph.getPossibleObject(activeIssue, ISSUE.IssueSource_Manages_Inverse);
@@ -96,12 +97,12 @@ public class PurgeResolvedIssues extends AbstractHandler {
                     }
                 }
 
-                mon.setTaskName("Purging " + toBeRemoved.size() + " resolved batch issues...");
+                mon.setTaskName(NLS.bind(Messages.PurgeResolvedIssues_PurgingResolvedBatchIssues, toBeRemoved.size()));
                 mon.setWorkRemaining(toBeRemoved.size());
                 StringBuilder sb = new StringBuilder();
-                sb.append("Purged " + toBeRemoved.size() + " resolved batch issue(s)");
+                sb.append(NLS.bind(Messages.PurgeResolvedIssues_PurgedResolvedBatchIssues, toBeRemoved.size()));
                 for (Resource remove : toBeRemoved) {
-                    //sb.append(NameUtils.getSafeLabel(graph, remove) + " ");
+                    // sb.append(NameUtils.getSafeLabel(graph, remove) + " ");
                     RemoverUtil.remove(graph, remove);
                     mon.worked(1);
                 }
index 803324613a1501045a4ed7973c9cb70d413df8e5..e46be60d4805e47c5b7c240fc1aa46f5a8e16a08 100644 (file)
@@ -71,7 +71,7 @@ public class RunActiveValidations extends AbstractHandler {
         final BatchIssueValidationContext context = new BatchIssueValidationContext();
 
         try {
-            SleepingDatabaseJob dbLock = new SleepingDatabaseJob("Validation Preparation").scheduleAndWaitForRunning();
+            SleepingDatabaseJob dbLock = new SleepingDatabaseJob(Messages.RunActiveValidations_ValidationPreparation).scheduleAndWaitForRunning();
             try {
                 PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
                     @Override
@@ -84,7 +84,7 @@ public class RunActiveValidations extends AbstractHandler {
                                     session.syncRequest(new SelectedModelBatchIssueSources(model)),
                                     validations);
 
-                            SubMonitor.convert(monitor, "Preparing resources for validation", 100);
+                            SubMonitor.convert(monitor, Messages.RunActiveValidations_MonitorPreparingResourcesForValidation, 100);
                             context.contexts = Collections.singletonList(model);
                             context.domain = ModelTransferableGraphSourceRequest.getDomainOnly(session, monitor, model);
 
@@ -126,7 +126,7 @@ public class RunActiveValidations extends AbstractHandler {
 
     public static void run(Runnable postValidation, final Collection<BatchIssueSource> validations, final BatchIssueValidationContext context) {
         // Run the validations for the selected composites
-        SleepingDatabaseJob dbLock = new SleepingDatabaseJob("Validation");
+        SleepingDatabaseJob dbLock = new SleepingDatabaseJob(Messages.RunActiveValidations_Validation);
         try {
             dbLock.scheduleAndWaitForRunning();
             try {
@@ -134,7 +134,7 @@ public class RunActiveValidations extends AbstractHandler {
                     @Override
                     public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                         try {
-                            SubMonitor progress = SubMonitor.convert(monitor, "Validate Model", 100);
+                            SubMonitor progress = SubMonitor.convert(monitor, Messages.RunActiveValidations_ValidateModel, 100);
                             int maxWrittenIssues = IssuePreferenceUtil.getPreferences().maxBatchIssuesToWrite;
                             int writtenIssues = 0;
                             for (BatchIssueSource source : validations) {
index 24918c1fb1787c30b850b4ca94e7846d1268e9fa..1a2457b1c6c5e2c2ff47e75745f196f743eb9262 100644 (file)
@@ -18,7 +18,7 @@ package org.simantics.issues.ui.handler;
 public class Unhide extends FunctionHandler {
 
     public Unhide() {
-        super(null, "hider", Boolean.FALSE);
+        super(null, "hider", Boolean.FALSE); //$NON-NLS-1$
     }
 
 }
diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/messages.properties b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/handler/messages.properties
new file mode 100644 (file)
index 0000000..527e67a
--- /dev/null
@@ -0,0 +1,18 @@
+ConfigureIssueSources_SelectAvailableIssueSources=Select available issue sources\r
+ConfigureIssueSources_SelectedSourcesAddRemoveMsg=Selected sources will be used and existing deselected sources will be removed.\r
+ExportIssuesAsCsv_AllFiles=All Files (*.*)\r
+ExportIssuesAsCsv_CommaSeparatedValues=Comma-Separated Values (*.txt)\r
+ExportIssuesAsCsv_ExportIssues=Export issues\r
+ExportIssuesAsCsv_SelectValidationOutput=Select Validation Output\r
+MenuActions_Hide=Hide\r
+MenuActions_MarkResolved=Mark Resolved\r
+MenuActions_MarkUnresolved=Mark Unresolved\r
+MenuActions_SetSeverity=Set Severity\r
+MenuActions_Unhide=Unhide\r
+PurgeResolvedIssues_MonitorPurgingResolvedIssues=Purging resolved issues...\r
+PurgeResolvedIssues_PurgedResolvedBatchIssues=Purged {0} resolved batch issue(s)\r
+PurgeResolvedIssues_PurgingResolvedBatchIssues=Purging {0} resolved batch issues...\r
+RunActiveValidations_MonitorPreparingResourcesForValidation=Preparing resources for validation\r
+RunActiveValidations_ValidateModel=Validate Model\r
+RunActiveValidations_Validation=Validation\r
+RunActiveValidations_ValidationPreparation=Validation Preparation\r
index 790c0047198c3e2d66b9d2bd682088855bc6a565..17ac9c5c7da8437f146dd8360e7b76da912ce1d5 100644 (file)
@@ -26,7 +26,7 @@ import org.simantics.utils.ui.gfx.HSVAdjustmentImageDescriptor;
 
 public class Activator extends AbstractUIPlugin {
 
-    public static final String PLUGIN_ID = "org.simantics.issues.ui";
+    public static final String PLUGIN_ID = "org.simantics.issues.ui"; //$NON-NLS-1$
     
     static Activator instance;
     ServiceTracker   messageScheme;
@@ -59,29 +59,29 @@ public class Activator extends AbstractUIPlugin {
 
         Bundle bundle = context.getBundle();
 
-        HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png"));
+        HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png")); //$NON-NLS-1$
         UNHIDE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(
                 HIDE_ICON, 0f, 0f, 1f), 96);
         //RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb.png"));
         //UNRESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb_off.png"));
-        RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png"));
+        RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png")); //$NON-NLS-1$
         UNRESOLVE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(
                 RESOLVE_ICON, 0f, 0f, 1f), 96);
 
-        PURGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/purge.gif"));
+        PURGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/purge.gif")); //$NON-NLS-1$
 
-        FATAL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal.png"));
-        ERROR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error.png"));
-        WARNING_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning.png"));
-        INFO_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information.png"));
-        NOTE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note.png"));
-        OK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/noissue.png"));
+        FATAL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal.png")); //$NON-NLS-1$
+        ERROR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error.png")); //$NON-NLS-1$
+        WARNING_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning.png")); //$NON-NLS-1$
+        INFO_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information.png")); //$NON-NLS-1$
+        NOTE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note.png")); //$NON-NLS-1$
+        OK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/noissue.png")); //$NON-NLS-1$
 
-        FATAL_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal_decoration.png"));
-        ERROR_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error_decoration.png"));
-        WARNING_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning_decoration.png"));
-        INFO_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information_decoration.png"));
-        NOTE_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note_decoration.png"));
+        FATAL_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal_decoration.png")); //$NON-NLS-1$
+        ERROR_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error_decoration.png")); //$NON-NLS-1$
+        WARNING_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning_decoration.png")); //$NON-NLS-1$
+        INFO_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information_decoration.png")); //$NON-NLS-1$
+        NOTE_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note_decoration.png")); //$NON-NLS-1$
     }
 
     @Override
@@ -91,11 +91,11 @@ public class Activator extends AbstractUIPlugin {
 
     @Override
     protected void initializeImageRegistry(ImageRegistry reg) {
-        reg.put(Severity.FATAL.toString()+"-full", FATAL_ICON);
-        reg.put(Severity.ERROR.toString()+"-full", ERROR_ICON);
-        reg.put(Severity.WARNING.toString()+"-full", WARNING_ICON);
-        reg.put(Severity.INFO.toString()+"-full", INFO_ICON);
-        reg.put(Severity.NOTE.toString()+"-full", NOTE_ICON);
+        reg.put(Severity.FATAL.toString()+"-full", FATAL_ICON); //$NON-NLS-1$
+        reg.put(Severity.ERROR.toString()+"-full", ERROR_ICON); //$NON-NLS-1$
+        reg.put(Severity.WARNING.toString()+"-full", WARNING_ICON); //$NON-NLS-1$
+        reg.put(Severity.INFO.toString()+"-full", INFO_ICON); //$NON-NLS-1$
+        reg.put(Severity.NOTE.toString()+"-full", NOTE_ICON); //$NON-NLS-1$
         reg.put(Severity.FATAL.toString(), FATAL_DECORATION_ICON);
         reg.put(Severity.ERROR.toString(), ERROR_DECORATION_ICON);
         reg.put(Severity.WARNING.toString(), WARNING_DECORATION_ICON);
@@ -125,7 +125,7 @@ public class Activator extends AbstractUIPlugin {
 
     public static URL getDefaultResource(String name) {
         Activator plugin = getDefault();
-        if(plugin == null) throw new IllegalStateException("The plugin is not active.");
+        if(plugin == null) throw new IllegalStateException("The plugin is not active."); //$NON-NLS-1$
         Bundle bundle = plugin.getBundle(); 
         return bundle.getResource(name);
     }
diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/messages.properties b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/messages.properties
new file mode 100644 (file)
index 0000000..5028434
--- /dev/null
@@ -0,0 +1,3 @@
+IssueLabelRule_Path=Path\r
+IssueLabelRule_Resource=Resource\r
+IssueView2_IssuesNotAvailable=Issues not available.\r
index 577c06b7b5ac4b5330d5c18c37adba060e95b308..06345506e51e1a33632ab1e7e5f72e24b4d337c2 100644 (file)
@@ -32,14 +32,14 @@ public class IssuePreferencePage extends FieldEditorPreferencePage implements IW
 
     @Override
     protected IPreferenceStore doGetPreferenceStore() {
-        return new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.simantics.issues");
+        return new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.simantics.issues"); //$NON-NLS-1$
     }
 
     @Override
     protected void createFieldEditors() {
         //addField(new BooleanFieldEditor(IssuePreferences.P_ISSUES_ENABLED, "Issue searching &enabled (only takes effect after restart)", getFieldEditorParent()));
-        IntegerFieldEditor f = new IntegerFieldEditor(IssuePreferences.P_MAX_BATCH_ISSUES_TO_WRITE, "Maximum batch validation issues to write", getFieldEditorParent());
-        f.getLabelControl(getFieldEditorParent()).setToolTipText("Limit for amount of batch validation issue results to write into the database");
+        IntegerFieldEditor f = new IntegerFieldEditor(IssuePreferences.P_MAX_BATCH_ISSUES_TO_WRITE, Messages.IssuePreferencePage_MaximumBatchValidationIssues, getFieldEditorParent());
+        f.getLabelControl(getFieldEditorParent()).setToolTipText(Messages.IssuePreferencePage_LimitforAmountOfBatchValidation);
         addField(f);
     }
 
diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/Messages.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/Messages.java
new file mode 100644 (file)
index 0000000..aa75978
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.issues.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.issues.ui.preferences.messages"; //$NON-NLS-1$
+       public static String IssuePreferencePage_LimitforAmountOfBatchValidation;
+       public static String IssuePreferencePage_MaximumBatchValidationIssues;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/messages.properties b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/preferences/messages.properties
new file mode 100644 (file)
index 0000000..5758b69
--- /dev/null
@@ -0,0 +1,2 @@
+IssuePreferencePage_LimitforAmountOfBatchValidation=Limit for amount of batch validation issue results to write into the database\r
+IssuePreferencePage_MaximumBatchValidationIssues=Maximum batch validation issues to write\r
diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/Messages.java b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/Messages.java
new file mode 100644 (file)
index 0000000..7e3d488
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.logging.ui.handlers;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.logging.ui.handlers.messages"; //$NON-NLS-1$
+       public static String SaveLogFilesHandler_FilterAllFiles;
+       public static String SaveLogFilesHandler_FilterZipArchive;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index dd62805009376c1554c95e4a908828b820a7f793..8457ca5a87b2f8936370a2134fefe271f16e5345 100644 (file)
@@ -19,9 +19,9 @@ public class SaveLogFilesHandler {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SaveLogFilesHandler.class);
 
-    private static final String[] FILTER_NAMES = { "ZIP-archive", "AllFiles (*.*)" };
-    private static final String[] FILTER_EXTENSIONS = { "*.zip", "*.*" };
-    private static final String USER_HOME = System.getProperty("user.home");
+    private static final String[] FILTER_NAMES = { Messages.SaveLogFilesHandler_FilterZipArchive, Messages.SaveLogFilesHandler_FilterAllFiles };
+    private static final String[] FILTER_EXTENSIONS = { "*.zip", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+    private static final String USER_HOME = System.getProperty("user.home"); //$NON-NLS-1$
 
     @Execute
     public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
@@ -39,16 +39,16 @@ public class SaveLogFilesHandler {
         String destination = dialog.open();
         if (destination != null) {
             if (LOGGER.isDebugEnabled())
-                LOGGER.debug("Destination for saving log files is {}", destination);
+                LOGGER.debug("Destination for saving log files is {}", destination); //$NON-NLS-1$
             try {
                 LogCollector.archiveLogs(destination);
             } catch (Throwable t) {
-                LOGGER.error("Could not save log files to ZIP", t);
-                ExceptionUtils.logAndShowError("Could not save log files to ZIP", t);
+                LOGGER.error("Could not save log files to ZIP", t); //$NON-NLS-1$
+                ExceptionUtils.logAndShowError("Could not save log files to ZIP", t); //$NON-NLS-1$
             }
         } else {
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("No destination selected for saving logs");
+                LOGGER.debug("No destination selected for saving logs"); //$NON-NLS-1$
             }
         }
     }
index 27473f182736b46a69af479c382257c0957f1cea..9b350829dd5cf92f13706f630d5516263b7791d0 100644 (file)
@@ -14,7 +14,7 @@ public class SelectLoggingLevelHandler {
     @Execute
     public void execute(@Named("org.simantics.logging.ui.commandparameter.selectLoggingLevel") String level) {
         if (LOGGER.isDebugEnabled())
-            LOGGER.debug("Setting logging level to {}", level);
+            LOGGER.debug("Setting logging level to {}", level); //$NON-NLS-1$
         LogConfigurator.setLoggingLevel(level);
     }
 
diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/messages.properties b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/messages.properties
new file mode 100644 (file)
index 0000000..bee99a5
--- /dev/null
@@ -0,0 +1,2 @@
+SaveLogFilesHandler_FilterAllFiles=AllFiles (*.*)\r
+SaveLogFilesHandler_FilterZipArchive=ZIP-archive\r
index 2cc795dd09be2b14d137b8d7380fd918d2c3c2ce..a2343cd8562ff4dd274fb9372a9a57f17baa5372 100644 (file)
@@ -22,7 +22,7 @@ import org.osgi.framework.BundleContext;
 public class Activator extends AbstractUIPlugin {
 
        // The plug-in ID
-       public static final String PLUGIN_ID = "org.simantics.message.ui";
+       public static final String PLUGIN_ID = "org.simantics.message.ui"; //$NON-NLS-1$
 
        // The shared instance
        private static Activator plugin;
index 7c3a330670a2bb1a5fb01881edc36045bc481eb5..9319a38d5dda30e0c1e36394b92adaaae458a0bb 100644 (file)
@@ -384,12 +384,12 @@ public class EventDetailsDialog extends TrayDialog {
 
                                if (stack != null) {
                                        stack = filterStack(stack);
-                                       detailsText.setText("<pre>" + stack + "</pre>");                
+                                       detailsText.setText("<pre>" + stack + "</pre>"); //$NON-NLS-1$ //$NON-NLS-2$
                                        detailsTextDescription.setText(Messages.EventDetailsDialog_exception);
                                } else {
-                                       detailsText.setText("<pre>" + Messages.EventDetailsDialog_noDetailedMessage + "</pre>");
-                               }                               
-                       }               
+                                       detailsText.setText("<pre>" + Messages.EventDetailsDialog_noDetailedMessage + "</pre>"); //$NON-NLS-1$ //$NON-NLS-2$
+                               }
+                       }
 
                        LogSession logSession = logEntry.getSession();
                        String session = logSession != null ? logSession.getSessionData() : null;
@@ -768,7 +768,7 @@ public class EventDetailsDialog extends TrayDialog {
                    public void changing(LocationEvent event) {
                        //System.out.println("changing: " + event);
                        String location = event.location;
-                       if ("about:blank".equals(location)) {
+                       if ("about:blank".equals(location)) { //$NON-NLS-1$
                            event.doit = true;
                        } else {
                            event.doit = false;
index b71cb3cded05f7de514060b789014186e9bb71d7..a9d685be387c9e358ecc861f3a0fe5d095c9a13c 100644 (file)
@@ -361,7 +361,7 @@ public class LogView extends ViewPart implements ILogListener {
                */
                fMessageDescription = new Browser(sashForm, SWT.NONE);
                fMessageDescription.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-               fMessageDescription.setText("<html><head></head><body><p>Select a message to show its description here.</p></body></html>");
+               fMessageDescription.setText("<html><head></head><body><p>Select a message to show its description here.</p></body></html>"); //$NON-NLS-1$
                fMessageDescription.addLocationListener(new LocationListener() {
                    @Override
                    public void changed(LocationEvent event) {
@@ -371,7 +371,7 @@ public class LogView extends ViewPart implements ILogListener {
                    public void changing(LocationEvent event) {
                        //System.out.println("changing: " + event);
                        String location = event.location;
-                       if ("about:blank".equals(location)) {
+                       if ("about:blank".equals(location)) { //$NON-NLS-1$
                            event.doit = true;
                        } else {
                            event.doit = false;
@@ -413,7 +413,7 @@ public class LogView extends ViewPart implements ILogListener {
                 IStructuredSelection s = (IStructuredSelection) event.getSelection();
                 if (s.isEmpty()) {
                     //fMessageDescription.setText("Select a message to show its description here.", false, false);
-                    fMessageDescription.setText("<html><head></head><body><pre>Select a message to show its description here.</pre></body></html>");
+                    fMessageDescription.setText("<html><head></head><body><pre>Select a message to show its description here.</pre></body></html>"); //$NON-NLS-1$
                 } else {
                     AbstractEntry entry = (AbstractEntry) s.getFirstElement();
                     if (entry instanceof LogEntry) {
@@ -427,11 +427,7 @@ public class LogView extends ViewPart implements ILogListener {
                         // truncation enables us to show even lengthy messages.
                         if (msg.length() > Short.MAX_VALUE) {
                             StringBuilder truncated = new StringBuilder();
-                            truncated.append("... [truncated ");
-                            truncated.append(msg.length() - (Short.MAX_VALUE - 100));
-                            truncated.append(" out of ");
-                            truncated.append(msg.length());
-                            truncated.append(" characters]");
+                            truncated.append( NLS.bind(Messages.LogView_Truncated, msg.length() - (Short.MAX_VALUE - 100), msg.length()));                            
                             msg = msg.substring(0, Short.MAX_VALUE - 100) + truncated;
                         }
                         try {
@@ -596,11 +592,11 @@ public class LogView extends ViewPart implements ILogListener {
 
     @SuppressWarnings("unused")
     private Action createTestAction() {
-        Action action = new Action("Test") {
+        Action action = new Action("Test") { //$NON-NLS-1$
             public void run() {
-                IStatus s1 = new Status(IStatus.INFO, Activator.PLUGIN_ID, "Test message 1", null); 
-                IStatus s2 = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Test message 2", null); 
-                IStatus s3 = new DetailStatus(IStatus.ERROR, Activator.PLUGIN_ID, "This is the short message.", HtmlUtil.p("A multi-lined message...\n<br/>continuing...<br/><br/>still...<br/>Error occurred, report at " + HtmlUtil.a("http://www.simantics.org", "simantics.org")), null); 
+                IStatus s1 = new Status(IStatus.INFO, Activator.PLUGIN_ID, "Test message 1", null);  //$NON-NLS-1$
+                IStatus s2 = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Test message 2", null);  //$NON-NLS-1$
+                IStatus s3 = new DetailStatus(IStatus.ERROR, Activator.PLUGIN_ID, "This is the short message.", HtmlUtil.p("A multi-lined message...\n<br/>continuing...<br/><br/>still...<br/>Error occurred, report at {0}" + HtmlUtil.a("http://www.simantics.org", "simantics.org")), null);  //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$
                 MessageService.defaultLog(s1);
                 MessageService.defaultLog(s2);
                 MessageService.defaultLog(s3);
@@ -608,16 +604,16 @@ public class LogView extends ViewPart implements ILogListener {
 //                Activator.getDefault().getLog().log(s2);
 //                Activator.getDefault().getLog().log(s3);
 
-                MultiStatus s4 = new MultiStatus(Activator.PLUGIN_ID, 0, "Test message 4", new Exception());
-                s4.merge(new Status(IStatus.INFO, Activator.PLUGIN_ID, "MultiStatus Test 1", null));
-                s4.merge(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "MultiStatus Test 2", null));
-                s4.merge(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "MultiStatus Test 3", null));
+                MultiStatus s4 = new MultiStatus(Activator.PLUGIN_ID, 0, "Test message 4", new Exception()); //$NON-NLS-1$
+                s4.merge(new Status(IStatus.INFO, Activator.PLUGIN_ID, "MultiStatus Test 1", null)); //$NON-NLS-1$
+                s4.merge(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "MultiStatus Test 2", null)); //$NON-NLS-1$
+                s4.merge(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "MultiStatus Test 3", null)); //$NON-NLS-1$
                 MessageService.defaultLog(s4);
 //                Activator.getDefault().getLog().log(s4);
             }
         };
         action.setImageDescriptor(ImageDescriptor.getMissingImageDescriptor());
-        action.setToolTipText("Produce test log entries");
+        action.setToolTipText("Produce test log entries"); //$NON-NLS-1$
         return action;
     }
 
@@ -1097,7 +1093,7 @@ public class LogView extends ViewPart implements ILogListener {
                    // Remove the content description in this case
                    // to save vertical space from the view.
                        //return Messages.LogView_WorkspaceLogFile;
-                   return "";
+                   return ""; //$NON-NLS-1$
                }
 
                Map<String, File> sources = LogFilesManager.getLogSources();
index f6ab65980d1b40981b3f9da35c90e5cbad1ab506..d62492c9057b404848a41b75dfaee8c83cd5717d 100644 (file)
@@ -69,6 +69,7 @@ public class Messages extends NLS {
        public static String LogView_GroupBySession;
        public static String LogView_LogFileTitle;
        public static String LogView_OpenFile;
+       public static String LogView_Truncated;
        public static String LogView_WorkspaceLogFile;
 
        public static String LogViewLabelProvider_Session;
index bdb9b6bc57a3c514019807c2e59b49330b47691d..545a20e0207f716e3038e5ced46d1093c828cbb4 100644 (file)
@@ -27,92 +27,92 @@ public class TextColors {
     }
 
     static Mapping[] colors = new Mapping[] {
-        new Mapping("AliceBlue", new RGB(0xF0, 0xF8, 0xFF)),
-        new Mapping("AntiqueWhite", new RGB(0xFA, 0xEB, 0xD7)), new Mapping("Aqua", new RGB(0x00, 0xFF, 0xFF)),
-        new Mapping("Aquamarine", new RGB(0x7F, 0xFF, 0xD4)), new Mapping("Azure", new RGB(0xF0, 0xFF, 0xFF)),
-        new Mapping("Beige", new RGB(0xF5, 0xF5, 0xDC)), new Mapping("Bisque", new RGB(0xFF, 0xE4, 0xC4)),
-        new Mapping("Black", new RGB(0x00, 0x00, 0x00)), new Mapping("BlanchedAlmond", new RGB(0xFF, 0xEB, 0xCD)),
-        new Mapping("Blue", new RGB(0x00, 0x00, 0xFF)), new Mapping("BlueViolet", new RGB(0x8A, 0x2B, 0xE2)),
-        new Mapping("Brown", new RGB(0xA5, 0x2A, 0x2A)), new Mapping("BurlyWood", new RGB(0xDE, 0xB8, 0x87)),
-        new Mapping("CadetBlue", new RGB(0x5F, 0x9E, 0xA0)), new Mapping("Chartreuse", new RGB(0x7F, 0xFF, 0x00)),
-        new Mapping("Chocolate", new RGB(0xD2, 0x69, 0x1E)), new Mapping("Coral", new RGB(0xFF, 0x7F, 0x50)),
-        new Mapping("CornflowerBlue", new RGB(0x64, 0x95, 0xED)),
-        new Mapping("Cornsilk", new RGB(0xFF, 0xF8, 0xDC)), new Mapping("Crimson", new RGB(0xDC, 0x14, 0x3C)),
-        new Mapping("Cyan", new RGB(0x00, 0xFF, 0xFF)), new Mapping("DarkBlue", new RGB(0x00, 0x00, 0x8B)),
-        new Mapping("DarkCyan", new RGB(0x00, 0x8B, 0x8B)),
-        new Mapping("DarkGoldenRod", new RGB(0xB8, 0x86, 0x0B)),
-        new Mapping("DarkGray", new RGB(0xA9, 0xA9, 0xA9)), new Mapping("DarkGreen", new RGB(0x00, 0x64, 0x00)),
-        new Mapping("DarkKhaki", new RGB(0xBD, 0xB7, 0x6B)), new Mapping("DarkMagenta", new RGB(0x8B, 0x00, 0x8B)),
-        new Mapping("DarkOliveGreen", new RGB(0x55, 0x6B, 0x2F)),
-        new Mapping("Darkorange", new RGB(0xFF, 0x8C, 0x00)), new Mapping("DarkOrchid", new RGB(0x99, 0x32, 0xCC)),
-        new Mapping("DarkRed", new RGB(0x8B, 0x00, 0x00)), new Mapping("DarkSalmon", new RGB(0xE9, 0x96, 0x7A)),
-        new Mapping("DarkSeaGreen", new RGB(0x8F, 0xBC, 0x8F)),
-        new Mapping("DarkSlateBlue", new RGB(0x48, 0x3D, 0x8B)),
-        new Mapping("DarkSlateGray", new RGB(0x2F, 0x4F, 0x4F)),
-        new Mapping("DarkTurquoise", new RGB(0x00, 0xCE, 0xD1)),
-        new Mapping("DarkViolet", new RGB(0x94, 0x00, 0xD3)), new Mapping("DeepPink", new RGB(0xFF, 0x14, 0x93)),
-        new Mapping("DeepSkyBlue", new RGB(0x00, 0xBF, 0xFF)), new Mapping("DimGray", new RGB(0x69, 0x69, 0x69)),
-        new Mapping("DodgerBlue", new RGB(0x1E, 0x90, 0xFF)), new Mapping("FireBrick", new RGB(0xB2, 0x22, 0x22)),
-        new Mapping("FloralWhite", new RGB(0xFF, 0xFA, 0xF0)),
-        new Mapping("ForestGreen", new RGB(0x22, 0x8B, 0x22)), new Mapping("Fuchsia", new RGB(0xFF, 0x00, 0xFF)),
-        new Mapping("Gainsboro", new RGB(0xDC, 0xDC, 0xDC)), new Mapping("GhostWhite", new RGB(0xF8, 0xF8, 0xFF)),
-        new Mapping("Gold", new RGB(0xFF, 0xD7, 0x00)), new Mapping("GoldenRod", new RGB(0xDA, 0xA5, 0x20)),
-        new Mapping("Gray", new RGB(0x80, 0x80, 0x80)), new Mapping("Green", new RGB(0x00, 0x80, 0x00)),
-        new Mapping("GreenYellow", new RGB(0xAD, 0xFF, 0x2F)), new Mapping("HoneyDew", new RGB(0xF0, 0xFF, 0xF0)),
-        new Mapping("HotPink", new RGB(0xFF, 0x69, 0xB4)), new Mapping("IndianRed", new RGB(0xCD, 0x5C, 0x5C)),
-        new Mapping("Indigo", new RGB(0x4B, 0x00, 0x82)), new Mapping("Ivory", new RGB(0xFF, 0xFF, 0xF0)),
-        new Mapping("Khaki", new RGB(0xF0, 0xE6, 0x8C)), new Mapping("Lavender", new RGB(0xE6, 0xE6, 0xFA)),
-        new Mapping("LavenderBlush", new RGB(0xFF, 0xF0, 0xF5)),
-        new Mapping("LawnGreen", new RGB(0x7C, 0xFC, 0x00)),
-        new Mapping("LemonChiffon", new RGB(0xFF, 0xFA, 0xCD)),
-        new Mapping("LightBlue", new RGB(0xAD, 0xD8, 0xE6)), new Mapping("LightCoral", new RGB(0xF0, 0x80, 0x80)),
-        new Mapping("LightCyan", new RGB(0xE0, 0xFF, 0xFF)),
-        new Mapping("LightGoldenRodYellow", new RGB(0xFA, 0xFA, 0xD2)),
-        new Mapping("LightGrey", new RGB(0xD3, 0xD3, 0xD3)), new Mapping("LightGreen", new RGB(0x90, 0xEE, 0x90)),
-        new Mapping("LightPink", new RGB(0xFF, 0xB6, 0xC1)), new Mapping("LightSalmon", new RGB(0xFF, 0xA0, 0x7A)),
-        new Mapping("LightSeaGreen", new RGB(0x20, 0xB2, 0xAA)),
-        new Mapping("LightSkyBlue", new RGB(0x87, 0xCE, 0xFA)),
-        new Mapping("LightSlateGray", new RGB(0x77, 0x88, 0x99)),
-        new Mapping("LightSteelBlue", new RGB(0xB0, 0xC4, 0xDE)),
-        new Mapping("LightYellow", new RGB(0xFF, 0xFF, 0xE0)), new Mapping("Lime", new RGB(0x00, 0xFF, 0x00)),
-        new Mapping("LimeGreen", new RGB(0x32, 0xCD, 0x32)), new Mapping("Linen", new RGB(0xFA, 0xF0, 0xE6)),
-        new Mapping("Magenta", new RGB(0xFF, 0x00, 0xFF)), new Mapping("Maroon", new RGB(0x80, 0x00, 0x00)),
-        new Mapping("MediumAquaMarine", new RGB(0x66, 0xCD, 0xAA)),
-        new Mapping("MediumBlue", new RGB(0x00, 0x00, 0xCD)),
-        new Mapping("MediumOrchid", new RGB(0xBA, 0x55, 0xD3)),
-        new Mapping("MediumPurple", new RGB(0x93, 0x70, 0xD8)),
-        new Mapping("MediumSeaGreen", new RGB(0x3C, 0xB3, 0x71)),
-        new Mapping("MediumSlateBlue", new RGB(0x7B, 0x68, 0xEE)),
-        new Mapping("MediumSpringGreen", new RGB(0x00, 0xFA, 0x9A)),
-        new Mapping("MediumTurquoise", new RGB(0x48, 0xD1, 0xCC)),
-        new Mapping("MediumVioletRed", new RGB(0xC7, 0x15, 0x85)),
-        new Mapping("MidnightBlue", new RGB(0x19, 0x19, 0x70)),
-        new Mapping("MintCream", new RGB(0xF5, 0xFF, 0xFA)), new Mapping("MistyRose", new RGB(0xFF, 0xE4, 0xE1)),
-        new Mapping("Moccasin", new RGB(0xFF, 0xE4, 0xB5)), new Mapping("NavajoWhite", new RGB(0xFF, 0xDE, 0xAD)),
-        new Mapping("Navy", new RGB(0x00, 0x00, 0x80)), new Mapping("OldLace", new RGB(0xFD, 0xF5, 0xE6)),
-        new Mapping("Olive", new RGB(0x80, 0x80, 0x00)), new Mapping("OliveDrab", new RGB(0x6B, 0x8E, 0x23)),
-        new Mapping("Orange", new RGB(0xFF, 0xA5, 0x00)), new Mapping("OrangeRed", new RGB(0xFF, 0x45, 0x00)),
-        new Mapping("Orchid", new RGB(0xDA, 0x70, 0xD6)), new Mapping("PaleGoldenRod", new RGB(0xEE, 0xE8, 0xAA)),
-        new Mapping("PaleGreen", new RGB(0x98, 0xFB, 0x98)),
-        new Mapping("PaleTurquoise", new RGB(0xAF, 0xEE, 0xEE)),
-        new Mapping("PaleVioletRed", new RGB(0xD8, 0x70, 0x93)),
-        new Mapping("PapayaWhip", new RGB(0xFF, 0xEF, 0xD5)), new Mapping("PeachPuff", new RGB(0xFF, 0xDA, 0xB9)),
-        new Mapping("Peru", new RGB(0xCD, 0x85, 0x3F)), new Mapping("Pink", new RGB(0xFF, 0xC0, 0xCB)),
-        new Mapping("Plum", new RGB(0xDD, 0xA0, 0xDD)), new Mapping("PowderBlue", new RGB(0xB0, 0xE0, 0xE6)),
-        new Mapping("Purple", new RGB(0x80, 0x00, 0x80)), new Mapping("Red", new RGB(0xFF, 0x00, 0x00)),
-        new Mapping("RosyBrown", new RGB(0xBC, 0x8F, 0x8F)), new Mapping("RoyalBlue", new RGB(0x41, 0x69, 0xE1)),
-        new Mapping("SaddleBrown", new RGB(0x8B, 0x45, 0x13)), new Mapping("Salmon", new RGB(0xFA, 0x80, 0x72)),
-        new Mapping("SandyBrown", new RGB(0xF4, 0xA4, 0x60)), new Mapping("SeaGreen", new RGB(0x2E, 0x8B, 0x57)),
-        new Mapping("SeaShell", new RGB(0xFF, 0xF5, 0xEE)), new Mapping("Sienna", new RGB(0xA0, 0x52, 0x2D)),
-        new Mapping("Silver", new RGB(0xC0, 0xC0, 0xC0)), new Mapping("SkyBlue", new RGB(0x87, 0xCE, 0xEB)),
-        new Mapping("SlateBlue", new RGB(0x6A, 0x5A, 0xCD)), new Mapping("SlateGray", new RGB(0x70, 0x80, 0x90)),
-        new Mapping("Snow", new RGB(0xFF, 0xFA, 0xFA)), new Mapping("SpringGreen", new RGB(0x00, 0xFF, 0x7F)),
-        new Mapping("SteelBlue", new RGB(0x46, 0x82, 0xB4)), new Mapping("Tan", new RGB(0xD2, 0xB4, 0x8C)),
-        new Mapping("Teal", new RGB(0x00, 0x80, 0x80)), new Mapping("Thistle", new RGB(0xD8, 0xBF, 0xD8)),
-        new Mapping("Tomato", new RGB(0xFF, 0x63, 0x47)), new Mapping("Turquoise", new RGB(0x40, 0xE0, 0xD0)),
-        new Mapping("Violet", new RGB(0xEE, 0x82, 0xEE)), new Mapping("Wheat", new RGB(0xF5, 0xDE, 0xB3)),
-        new Mapping("White", new RGB(0xFF, 0xFF, 0xFF)), new Mapping("WhiteSmoke", new RGB(0xF5, 0xF5, 0xF5)),
-        new Mapping("Yellow", new RGB(0xFF, 0xFF, 0x00)), new Mapping("YellowGreen", new RGB(0x9A, 0xCD, 0x32))
+        new Mapping("AliceBlue", new RGB(0xF0, 0xF8, 0xFF)), //$NON-NLS-1$
+        new Mapping("AntiqueWhite", new RGB(0xFA, 0xEB, 0xD7)), new Mapping("Aqua", new RGB(0x00, 0xFF, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Aquamarine", new RGB(0x7F, 0xFF, 0xD4)), new Mapping("Azure", new RGB(0xF0, 0xFF, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Beige", new RGB(0xF5, 0xF5, 0xDC)), new Mapping("Bisque", new RGB(0xFF, 0xE4, 0xC4)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Black", new RGB(0x00, 0x00, 0x00)), new Mapping("BlanchedAlmond", new RGB(0xFF, 0xEB, 0xCD)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Blue", new RGB(0x00, 0x00, 0xFF)), new Mapping("BlueViolet", new RGB(0x8A, 0x2B, 0xE2)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Brown", new RGB(0xA5, 0x2A, 0x2A)), new Mapping("BurlyWood", new RGB(0xDE, 0xB8, 0x87)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("CadetBlue", new RGB(0x5F, 0x9E, 0xA0)), new Mapping("Chartreuse", new RGB(0x7F, 0xFF, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Chocolate", new RGB(0xD2, 0x69, 0x1E)), new Mapping("Coral", new RGB(0xFF, 0x7F, 0x50)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("CornflowerBlue", new RGB(0x64, 0x95, 0xED)), //$NON-NLS-1$
+        new Mapping("Cornsilk", new RGB(0xFF, 0xF8, 0xDC)), new Mapping("Crimson", new RGB(0xDC, 0x14, 0x3C)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Cyan", new RGB(0x00, 0xFF, 0xFF)), new Mapping("DarkBlue", new RGB(0x00, 0x00, 0x8B)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DarkCyan", new RGB(0x00, 0x8B, 0x8B)), //$NON-NLS-1$
+        new Mapping("DarkGoldenRod", new RGB(0xB8, 0x86, 0x0B)), //$NON-NLS-1$
+        new Mapping("DarkGray", new RGB(0xA9, 0xA9, 0xA9)), new Mapping("DarkGreen", new RGB(0x00, 0x64, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DarkKhaki", new RGB(0xBD, 0xB7, 0x6B)), new Mapping("DarkMagenta", new RGB(0x8B, 0x00, 0x8B)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DarkOliveGreen", new RGB(0x55, 0x6B, 0x2F)), //$NON-NLS-1$
+        new Mapping("Darkorange", new RGB(0xFF, 0x8C, 0x00)), new Mapping("DarkOrchid", new RGB(0x99, 0x32, 0xCC)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DarkRed", new RGB(0x8B, 0x00, 0x00)), new Mapping("DarkSalmon", new RGB(0xE9, 0x96, 0x7A)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DarkSeaGreen", new RGB(0x8F, 0xBC, 0x8F)), //$NON-NLS-1$
+        new Mapping("DarkSlateBlue", new RGB(0x48, 0x3D, 0x8B)), //$NON-NLS-1$
+        new Mapping("DarkSlateGray", new RGB(0x2F, 0x4F, 0x4F)), //$NON-NLS-1$
+        new Mapping("DarkTurquoise", new RGB(0x00, 0xCE, 0xD1)), //$NON-NLS-1$
+        new Mapping("DarkViolet", new RGB(0x94, 0x00, 0xD3)), new Mapping("DeepPink", new RGB(0xFF, 0x14, 0x93)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DeepSkyBlue", new RGB(0x00, 0xBF, 0xFF)), new Mapping("DimGray", new RGB(0x69, 0x69, 0x69)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("DodgerBlue", new RGB(0x1E, 0x90, 0xFF)), new Mapping("FireBrick", new RGB(0xB2, 0x22, 0x22)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("FloralWhite", new RGB(0xFF, 0xFA, 0xF0)), //$NON-NLS-1$
+        new Mapping("ForestGreen", new RGB(0x22, 0x8B, 0x22)), new Mapping("Fuchsia", new RGB(0xFF, 0x00, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Gainsboro", new RGB(0xDC, 0xDC, 0xDC)), new Mapping("GhostWhite", new RGB(0xF8, 0xF8, 0xFF)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Gold", new RGB(0xFF, 0xD7, 0x00)), new Mapping("GoldenRod", new RGB(0xDA, 0xA5, 0x20)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Gray", new RGB(0x80, 0x80, 0x80)), new Mapping("Green", new RGB(0x00, 0x80, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("GreenYellow", new RGB(0xAD, 0xFF, 0x2F)), new Mapping("HoneyDew", new RGB(0xF0, 0xFF, 0xF0)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("HotPink", new RGB(0xFF, 0x69, 0xB4)), new Mapping("IndianRed", new RGB(0xCD, 0x5C, 0x5C)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Indigo", new RGB(0x4B, 0x00, 0x82)), new Mapping("Ivory", new RGB(0xFF, 0xFF, 0xF0)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Khaki", new RGB(0xF0, 0xE6, 0x8C)), new Mapping("Lavender", new RGB(0xE6, 0xE6, 0xFA)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("LavenderBlush", new RGB(0xFF, 0xF0, 0xF5)), //$NON-NLS-1$
+        new Mapping("LawnGreen", new RGB(0x7C, 0xFC, 0x00)), //$NON-NLS-1$
+        new Mapping("LemonChiffon", new RGB(0xFF, 0xFA, 0xCD)), //$NON-NLS-1$
+        new Mapping("LightBlue", new RGB(0xAD, 0xD8, 0xE6)), new Mapping("LightCoral", new RGB(0xF0, 0x80, 0x80)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("LightCyan", new RGB(0xE0, 0xFF, 0xFF)), //$NON-NLS-1$
+        new Mapping("LightGoldenRodYellow", new RGB(0xFA, 0xFA, 0xD2)), //$NON-NLS-1$
+        new Mapping("LightGrey", new RGB(0xD3, 0xD3, 0xD3)), new Mapping("LightGreen", new RGB(0x90, 0xEE, 0x90)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("LightPink", new RGB(0xFF, 0xB6, 0xC1)), new Mapping("LightSalmon", new RGB(0xFF, 0xA0, 0x7A)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("LightSeaGreen", new RGB(0x20, 0xB2, 0xAA)), //$NON-NLS-1$
+        new Mapping("LightSkyBlue", new RGB(0x87, 0xCE, 0xFA)), //$NON-NLS-1$
+        new Mapping("LightSlateGray", new RGB(0x77, 0x88, 0x99)), //$NON-NLS-1$
+        new Mapping("LightSteelBlue", new RGB(0xB0, 0xC4, 0xDE)), //$NON-NLS-1$
+        new Mapping("LightYellow", new RGB(0xFF, 0xFF, 0xE0)), new Mapping("Lime", new RGB(0x00, 0xFF, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("LimeGreen", new RGB(0x32, 0xCD, 0x32)), new Mapping("Linen", new RGB(0xFA, 0xF0, 0xE6)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Magenta", new RGB(0xFF, 0x00, 0xFF)), new Mapping("Maroon", new RGB(0x80, 0x00, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("MediumAquaMarine", new RGB(0x66, 0xCD, 0xAA)), //$NON-NLS-1$
+        new Mapping("MediumBlue", new RGB(0x00, 0x00, 0xCD)), //$NON-NLS-1$
+        new Mapping("MediumOrchid", new RGB(0xBA, 0x55, 0xD3)), //$NON-NLS-1$
+        new Mapping("MediumPurple", new RGB(0x93, 0x70, 0xD8)), //$NON-NLS-1$
+        new Mapping("MediumSeaGreen", new RGB(0x3C, 0xB3, 0x71)), //$NON-NLS-1$
+        new Mapping("MediumSlateBlue", new RGB(0x7B, 0x68, 0xEE)), //$NON-NLS-1$
+        new Mapping("MediumSpringGreen", new RGB(0x00, 0xFA, 0x9A)), //$NON-NLS-1$
+        new Mapping("MediumTurquoise", new RGB(0x48, 0xD1, 0xCC)), //$NON-NLS-1$
+        new Mapping("MediumVioletRed", new RGB(0xC7, 0x15, 0x85)), //$NON-NLS-1$
+        new Mapping("MidnightBlue", new RGB(0x19, 0x19, 0x70)), //$NON-NLS-1$
+        new Mapping("MintCream", new RGB(0xF5, 0xFF, 0xFA)), new Mapping("MistyRose", new RGB(0xFF, 0xE4, 0xE1)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Moccasin", new RGB(0xFF, 0xE4, 0xB5)), new Mapping("NavajoWhite", new RGB(0xFF, 0xDE, 0xAD)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Navy", new RGB(0x00, 0x00, 0x80)), new Mapping("OldLace", new RGB(0xFD, 0xF5, 0xE6)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Olive", new RGB(0x80, 0x80, 0x00)), new Mapping("OliveDrab", new RGB(0x6B, 0x8E, 0x23)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Orange", new RGB(0xFF, 0xA5, 0x00)), new Mapping("OrangeRed", new RGB(0xFF, 0x45, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Orchid", new RGB(0xDA, 0x70, 0xD6)), new Mapping("PaleGoldenRod", new RGB(0xEE, 0xE8, 0xAA)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("PaleGreen", new RGB(0x98, 0xFB, 0x98)), //$NON-NLS-1$
+        new Mapping("PaleTurquoise", new RGB(0xAF, 0xEE, 0xEE)), //$NON-NLS-1$
+        new Mapping("PaleVioletRed", new RGB(0xD8, 0x70, 0x93)), //$NON-NLS-1$
+        new Mapping("PapayaWhip", new RGB(0xFF, 0xEF, 0xD5)), new Mapping("PeachPuff", new RGB(0xFF, 0xDA, 0xB9)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Peru", new RGB(0xCD, 0x85, 0x3F)), new Mapping("Pink", new RGB(0xFF, 0xC0, 0xCB)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Plum", new RGB(0xDD, 0xA0, 0xDD)), new Mapping("PowderBlue", new RGB(0xB0, 0xE0, 0xE6)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Purple", new RGB(0x80, 0x00, 0x80)), new Mapping("Red", new RGB(0xFF, 0x00, 0x00)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("RosyBrown", new RGB(0xBC, 0x8F, 0x8F)), new Mapping("RoyalBlue", new RGB(0x41, 0x69, 0xE1)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("SaddleBrown", new RGB(0x8B, 0x45, 0x13)), new Mapping("Salmon", new RGB(0xFA, 0x80, 0x72)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("SandyBrown", new RGB(0xF4, 0xA4, 0x60)), new Mapping("SeaGreen", new RGB(0x2E, 0x8B, 0x57)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("SeaShell", new RGB(0xFF, 0xF5, 0xEE)), new Mapping("Sienna", new RGB(0xA0, 0x52, 0x2D)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Silver", new RGB(0xC0, 0xC0, 0xC0)), new Mapping("SkyBlue", new RGB(0x87, 0xCE, 0xEB)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("SlateBlue", new RGB(0x6A, 0x5A, 0xCD)), new Mapping("SlateGray", new RGB(0x70, 0x80, 0x90)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Snow", new RGB(0xFF, 0xFA, 0xFA)), new Mapping("SpringGreen", new RGB(0x00, 0xFF, 0x7F)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("SteelBlue", new RGB(0x46, 0x82, 0xB4)), new Mapping("Tan", new RGB(0xD2, 0xB4, 0x8C)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Teal", new RGB(0x00, 0x80, 0x80)), new Mapping("Thistle", new RGB(0xD8, 0xBF, 0xD8)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Tomato", new RGB(0xFF, 0x63, 0x47)), new Mapping("Turquoise", new RGB(0x40, 0xE0, 0xD0)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Violet", new RGB(0xEE, 0x82, 0xEE)), new Mapping("Wheat", new RGB(0xF5, 0xDE, 0xB3)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("White", new RGB(0xFF, 0xFF, 0xFF)), new Mapping("WhiteSmoke", new RGB(0xF5, 0xF5, 0xF5)), //$NON-NLS-1$ //$NON-NLS-2$
+        new Mapping("Yellow", new RGB(0xFF, 0xFF, 0x00)), new Mapping("YellowGreen", new RGB(0x9A, 0xCD, 0x32)) //$NON-NLS-1$ //$NON-NLS-2$
     };
 
     public static void bindTo(ResourceManager manager, FormText text) {
index 8dd361149fa77db2e7d2f7ee0b286bef9448cda1..0e76f4b6956c40d6c39681f5eb48ac557c2a78da 100644 (file)
@@ -63,6 +63,7 @@ LogView_GroupByPlugin=Plug-in
 LogView_GroupBySession=Session
 LogView_LogFileTitle={0} [{1}]
 LogView_OpenFile=Open File
+LogView_Truncated=... [truncated {0} out of {1} characters]
 LogView_WorkspaceLogFile=Workspace Log
 LogViewLabelProvider_truncatedMessage=... (Open log entry details for full message)
 LogViewLabelProvider_Session=Session
index 7b3adcdce68d0a33370cd78163f6e43c1c2c8100..1bcd891ede4e9e859ec2cc4d228fd73912a1292e 100644 (file)
@@ -24,13 +24,13 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 public class HttpSchemeHandler extends AbstractMessageSchemeHandler<URL> {
 
     public HttpSchemeHandler() {
-        super("http", URL.class);
+        super("http", URL.class); //$NON-NLS-1$
     }
 
     @Override
     public void doPerform(URL url) {
         try {
-            WorkbenchUtils.openEditor("org.simantics.editors.browser", new BrowserInput(url));
+            WorkbenchUtils.openEditor("org.simantics.editors.browser", new BrowserInput(url)); //$NON-NLS-1$
         } catch (PartInitException e) {
             throw new RuntimeException(e);
         }
index 1d400dcfc247e649fe06beb09d4a10cea4c27aae..0c29189ff33fe6e2ae83ec183f3f63ca74f8d487 100644 (file)
@@ -26,7 +26,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 public class ResourceSchemeHandler extends AbstractMessageSchemeHandler<Resource> {
 
     public ResourceSchemeHandler() {
-        super("resource", Resource.class);
+        super("resource", Resource.class); //$NON-NLS-1$
     }
 
     @Override
@@ -34,7 +34,7 @@ public class ResourceSchemeHandler extends AbstractMessageSchemeHandler<Resource
         Session session = Simantics.peekSession();
         if (session == null) {
             // FIXME: not stdout.
-            System.out.println("ResourceSchemeHandler: no session");
+            System.out.println("ResourceSchemeHandler: no session"); //$NON-NLS-1$
             return;
         }
 
diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/Messages.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/Messages.java
deleted file mode 100644 (file)
index 8bea312..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.message.ui.test;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
-       public static String Test_message;
-
-       private static final String BUNDLE_NAME = "org.simantics.message.ui.test.messages"; //$NON-NLS-1$
-
-       static {
-               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-       }
-
-}
index de7468d8e7dd9b06ea3678c565738fc1a5898246..d541944efb4b62be88de7ef0b27658fc681a8197 100644 (file)
@@ -46,8 +46,8 @@ public class TestResourceStatusHandler extends AbstractHandler {
             int code = 0;
             for (Resource r : rs) {
                 log.log(new DetailStatus(IDetailStatus.DEBUG, Activator.PLUGIN_ID, code++,
-                        "Logged reference to selected resource",
-                        NLS.bind(Messages.Test_message, MessageUtil.resource(s, r, "this link")),
+                        "Logged reference to selected resource", //$NON-NLS-1$
+                        NLS.bind("<p>This is a detailed message that contains links to related information. Follow {0} to open your favorite editor for the database resource.</p>", MessageUtil.resource(s, r, "this link")), //$NON-NLS-1$
                         null));
             }
         } catch (ReferenceSerializationException e) {
diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/messages.properties b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/test/messages.properties
deleted file mode 100644 (file)
index 34d6c2b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2010 Association for Decentralized Information Management
-# in Industry THTH ry.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-#     VTT Technical Research Centre of Finland - initial API and implementation
-###############################################################################
-
-Test_message = <p>This is a detailed message that contains links to related information. Follow {0} to open your favorite editor for the database resource.</p>
diff --git a/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/Messages.java b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/Messages.java
new file mode 100644 (file)
index 0000000..4b64beb
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.migration.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.migration.ui.messages"; //$NON-NLS-1$
+       public static String MigrateActionFactory_Migrate;
+       public static String MigrateActionFactory_MigrateMsg;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index c49c15389d984d6dc4f56fa49dd4db193c6e9738..bd7ce3845facecbe3744c17a52a24ae81a0bf951 100644 (file)
@@ -53,8 +53,8 @@ public class MigrateActionFactory implements ActionFactory {
     
     private void select(final Resource resource, final ArrayList<Update> updates) {
         ListDialog listDialog = new ListDialog(Display.getCurrent().getActiveShell());
-        listDialog.setTitle("Migrate");
-        listDialog.setMessage("Choose the version to migrate to");
+        listDialog.setTitle(Messages.MigrateActionFactory_Migrate);
+        listDialog.setMessage(Messages.MigrateActionFactory_MigrateMsg);
         listDialog.setContentProvider(new IStructuredContentProvider() {            
             @Override
             public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {       
diff --git a/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/messages.properties b/bundles/org.simantics.migration.ui/src/org/simantics/migration/ui/messages.properties
new file mode 100644 (file)
index 0000000..fcb7177
--- /dev/null
@@ -0,0 +1,2 @@
+MigrateActionFactory_Migrate=Migrate\r
+MigrateActionFactory_MigrateMsg=Choose the version to migrate to\r
index 5a4a58f33ffbe971cbc4daa8a5caeb975171605f..565c30895da465eec60cfbaf72298d312ee77b4f 100644 (file)
@@ -28,7 +28,7 @@ import org.simantics.utils.ui.BundleUtils;
 
 public class Activator extends AbstractUIPlugin {
 
-    public static final String PLUGIN_ID = "org.simantics.modeling.ui";
+    public static final String PLUGIN_ID = "org.simantics.modeling.ui"; //$NON-NLS-1$
 
     // The shared instance
     private static Activator plugin;
@@ -102,76 +102,76 @@ public class Activator extends AbstractUIPlugin {
 
         Bundle bundle = context.getBundle();
 
-        DOCUMENT_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/Gnome-mime-document.svg"));
-        FATAL_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/fatal.svg"));
-        ERROR_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/error.svg"));
-        WARNING_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/warning.svg"));
-        INFO_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/info.svg"));
-        NOTE_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/note4.svg"));
-
-        BULLET_GREEN_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_green.png"));
-        BULLET_YELLOW_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_yellow.png"));
-
-        MODEL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_organisation.png"));
-        COMPONENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/brick.png"));
-        COMPONENT_TYPE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/box.png"));
-        COMPOSITE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bricks.png"));
-        INTERFACE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/application_view_list.png"));
-        CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/connection.png"));
-        CONNECTION_PROPERTY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table_relationship.png"));
-        OPEN_CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/open_connection.png"));
-        VARIABLE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/variable.png"));
-
-        ARROW_LEFT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_left.png"));
-        ARROW_RIGHT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_right.png"));
-
-        SYMBOL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/photo.png"));
-
-        EXPERIMENTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png"));
-        ATTACHED_EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time_attach.png"));
-        EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time.png"));
-        EXPERIMENT_RESULT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar.png"));
-        EXPERIMENT_RESULT_TRANSIENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar_light.png"));
-
-        QUERY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/report.png"));
-
-        STATES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_tag_red.png"));
-        STATE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_red.png"));
-
-        TRENDS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png"));
-        TREND_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png"));
-
-        CHARTGROUP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_group2.png"));
-        CHARTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png"));
-        CHART_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png"));
-        PLOT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png"));
-
-        SPREADSHEET_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table.png"));
-        SPREADSHEETS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_table.png"));
-
-        SUBSCRIPTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription.png"));
-        SUBSCRIPTION_DISABLED_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription_disabled.png"));
-        SUBSCRIPTIONS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscriptions.png"));
-        SUBSCRIPTION_ITEM_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png"));
-
-        IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png"));
-        IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png"));
-
-        SEGMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/segment_edit.gif"));
-
-        TICK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png"));
-        CROSS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/silk/cross.png"));
-        STOP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/stop_red.png"));
-        ARROW_IN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_in.png");
-        ARROW_UP_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_up.png");
-        ARROW_DOWN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_down.png");
-        SHOW_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/show-profile-monitors.png"));
-        HIDE_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide-profile-monitors.png"));
-
-        POINTER_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/pointertool.png"));
-        CONNECT_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/connecttool.png"));
+        DOCUMENT_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/Gnome-mime-document.svg")); //$NON-NLS-1$
+        FATAL_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/fatal.svg")); //$NON-NLS-1$
+        ERROR_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/error.svg")); //$NON-NLS-1$
+        WARNING_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/warning.svg")); //$NON-NLS-1$
+        INFO_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/info.svg")); //$NON-NLS-1$
+        NOTE_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/note4.svg")); //$NON-NLS-1$
+
+        BULLET_GREEN_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_green.png")); //$NON-NLS-1$
+        BULLET_YELLOW_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_yellow.png")); //$NON-NLS-1$
+
+        MODEL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_organisation.png")); //$NON-NLS-1$
+        COMPONENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/brick.png")); //$NON-NLS-1$
+        COMPONENT_TYPE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/box.png")); //$NON-NLS-1$
+        COMPOSITE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bricks.png")); //$NON-NLS-1$
+        INTERFACE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/application_view_list.png")); //$NON-NLS-1$
+        CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/connection.png")); //$NON-NLS-1$
+        CONNECTION_PROPERTY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table_relationship.png")); //$NON-NLS-1$
+        OPEN_CONNECTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/open_connection.png")); //$NON-NLS-1$
+        VARIABLE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/variable.png")); //$NON-NLS-1$
+
+        ARROW_LEFT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_left.png")); //$NON-NLS-1$
+        ARROW_RIGHT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_right.png")); //$NON-NLS-1$
+
+        SYMBOL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/photo.png")); //$NON-NLS-1$
+
+        EXPERIMENTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); //$NON-NLS-1$
+        ATTACHED_EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time_attach.png")); //$NON-NLS-1$
+        EXPERIMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/time.png")); //$NON-NLS-1$
+        EXPERIMENT_RESULT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar.png")); //$NON-NLS-1$
+        EXPERIMENT_RESULT_TRANSIENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_bar_light.png")); //$NON-NLS-1$
+
+        QUERY_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/report.png")); //$NON-NLS-1$
+
+        STATES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_tag_red.png")); //$NON-NLS-1$
+        STATE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_red.png")); //$NON-NLS-1$
+
+        TRENDS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); //$NON-NLS-1$
+        TREND_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png")); //$NON-NLS-1$
+
+        CHARTGROUP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_group2.png")); //$NON-NLS-1$
+        CHARTS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder.png")); //$NON-NLS-1$
+        CHART_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/chart_line.png")); //$NON-NLS-1$
+        PLOT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png")); //$NON-NLS-1$
+
+        SPREADSHEET_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/table.png")); //$NON-NLS-1$
+        SPREADSHEETS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/folder_table.png")); //$NON-NLS-1$
+
+        SUBSCRIPTION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription.png")); //$NON-NLS-1$
+        SUBSCRIPTION_DISABLED_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscription_disabled.png")); //$NON-NLS-1$
+        SUBSCRIPTIONS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/subscriptions.png")); //$NON-NLS-1$
+        SUBSCRIPTION_ITEM_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_blue.png")); //$NON-NLS-1$
+
+        IMAGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/image.png")); //$NON-NLS-1$
+        IMAGES_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/images.png")); //$NON-NLS-1$
+
+        SEGMENT_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/segment_edit.gif")); //$NON-NLS-1$
+
+        TICK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png")); //$NON-NLS-1$
+        CROSS_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/silk/cross.png")); //$NON-NLS-1$
+        STOP_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/stop_red.png")); //$NON-NLS-1$
+        ARROW_IN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_in.png"); //$NON-NLS-1$ //$NON-NLS-2$
+        ARROW_UP_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_up.png"); //$NON-NLS-1$ //$NON-NLS-2$
+        ARROW_DOWN_ICON = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/bullet_arrow_down.png"); //$NON-NLS-1$ //$NON-NLS-2$
+        SHOW_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/show-profile-monitors.png")); //$NON-NLS-1$
+        HIDE_PROFILE_MONITOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide-profile-monitors.png")); //$NON-NLS-1$
+
+        POINTER_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/pointertool.png")); //$NON-NLS-1$
+        CONNECT_MODE = ImageDescriptor.createFromURL(bundle.getResource("icons/connecttool.png")); //$NON-NLS-1$
         
-        ARROW_REFRESH = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_refresh.png"));
+        ARROW_REFRESH = ImageDescriptor.createFromURL(bundle.getResource("icons/arrow_refresh.png")); //$NON-NLS-1$
         
         Hashtable<String, String> properties = new Hashtable<String, String>();
         context.registerService(SCLConsoleListener.class,
@@ -190,15 +190,15 @@ public class Activator extends AbstractUIPlugin {
 
     @Override
     protected void initializeImageRegistry(ImageRegistry reg) {
-        reg.put("tick", TICK_ICON);
-        reg.put("cross", CROSS_ICON);
-        reg.put("stop", STOP_ICON);
-        reg.put("arrowIn", ARROW_IN_ICON);
-        reg.put("arrowUp", ARROW_UP_ICON);
-        reg.put("arrowDown", ARROW_DOWN_ICON);
-        reg.put("showProfileMonitors", SHOW_PROFILE_MONITOR_ICON);
-        reg.put("hideProfileMonitors", HIDE_PROFILE_MONITOR_ICON);
-        reg.put("arrow_refresh", ARROW_REFRESH);
+        reg.put("tick", TICK_ICON); //$NON-NLS-1$
+        reg.put("cross", CROSS_ICON); //$NON-NLS-1$
+        reg.put("stop", STOP_ICON); //$NON-NLS-1$
+        reg.put("arrowIn", ARROW_IN_ICON); //$NON-NLS-1$
+        reg.put("arrowUp", ARROW_UP_ICON); //$NON-NLS-1$
+        reg.put("arrowDown", ARROW_DOWN_ICON); //$NON-NLS-1$
+        reg.put("showProfileMonitors", SHOW_PROFILE_MONITOR_ICON); //$NON-NLS-1$
+        reg.put("hideProfileMonitors", HIDE_PROFILE_MONITOR_ICON); //$NON-NLS-1$
+        reg.put("arrow_refresh", ARROW_REFRESH); //$NON-NLS-1$
     }
 
     /*
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Messages.java
new file mode 100644 (file)
index 0000000..c5d1d6a
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.modeling.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.messages"; //$NON-NLS-1$
+       public static String ModelingUIUtils_SelectQueryType;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index fa153e193500d4fa29804c5d723e627dc0047896..2ce2c802bd90990a8e682a5c35729800f4aad74f 100644 (file)
@@ -79,7 +79,7 @@ public class ModelingUIUtils {
                                String label = graph.getPossibleRelatedValue2(_res, L0.HasLabel, Bindings.STRING);
 
                                if (label != null && !name.equals(label)) {
-                                       name = label + " (" + name + ")";
+                                       name = label + " (" + name + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                                }
 
                                Resource parent = graph.getPossibleObject(_res, L0.PartOf);
@@ -88,10 +88,10 @@ public class ModelingUIUtils {
                                String parentURI = graph.getURI(parent);
                                if(parentURI.startsWith(modelURI)) {
                                        parentURI = parentURI.substring(modelURI.length());
-                                       if(parentURI.startsWith("/")) parentURI = parentURI.substring(1);
+                                       if(parentURI.startsWith("/")) parentURI = parentURI.substring(1); //$NON-NLS-1$
                                }
 
-                               name = name + " - " + URIStringUtils.unescape(parentURI);
+                               name = name + " - " + URIStringUtils.unescape(parentURI); //$NON-NLS-1$
 
                                map.put(_res, new Pair<String, ImageDescriptor>(name, null));
                                
@@ -105,7 +105,7 @@ public class ModelingUIUtils {
                                String label = graph.getPossibleRelatedValue2(res, L0.HasLabel, Bindings.STRING);
 
                                if (label != null && !name.equals(label)) {
-                                       name = label + " (" + name + ")";
+                                       name = label + " (" + name + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                                }
 
                                Resource parent = graph.getPossibleObject(_res, L0.PartOf);
@@ -114,10 +114,10 @@ public class ModelingUIUtils {
                                String parentURI = graph.getURI(parent);
                                if(parentURI.startsWith(modelURI)) {
                                        parentURI = parentURI.substring(modelURI.length());
-                                       if(parentURI.startsWith("/")) parentURI = parentURI.substring(1);
+                                       if(parentURI.startsWith("/")) parentURI = parentURI.substring(1); //$NON-NLS-1$
                                }
 
-                               name = name + " - " + URIStringUtils.unescape(parentURI);
+                               name = name + " - " + URIStringUtils.unescape(parentURI); //$NON-NLS-1$
 
                                map.put(_res, new Pair<String, ImageDescriptor>(name, null));
                        
@@ -135,7 +135,7 @@ public class ModelingUIUtils {
                        @Override
                        public void run() {
                                Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-                               ResourceSelectionDialog3<Resource> dialog = new ResourceSelectionDialog3<Resource>(shell, map, "Select query type from list") {
+                               ResourceSelectionDialog3<Resource> dialog = new ResourceSelectionDialog3<Resource>(shell, map, Messages.ModelingUIUtils_SelectQueryType) {
                                        @Override
                                        protected IDialogSettings getBaseDialogSettings() {
                                                return Activator.getDefault().getDialogSettings();
@@ -166,7 +166,7 @@ public class ModelingUIUtils {
                         @Override
                         public void perform(WriteGraph g) throws DatabaseException {
                             g.markUndoPoint();
-                            Simantics.applySCL("Simantics/Query", "createSCLQueryDefault", g, parent, selected);
+                            Simantics.applySCL("Simantics/Query", "createSCLQueryDefault", g, parent, selected); //$NON-NLS-1$ //$NON-NLS-2$
                         }
                     });
                 });
index 94db9c596e301975d7e34e28442d0f158d99307b..ca2fde521cd315cd1a4a526bdda3636bb8656784 100644 (file)
@@ -55,7 +55,7 @@ public class SCLClipboard {
                                if (element != null) {
                                        newSelection.add(element);
                                } else {
-                                       throw new DatabaseException("Could not find IElement for " + element);
+                                       throw new DatabaseException("Could not find IElement for " + element); //$NON-NLS-1$
                                }
                        }
                        
@@ -107,7 +107,7 @@ public class SCLClipboard {
                                if (element != null) {
                                        newSelection.add(element);
                                } else {
-                                       throw new DatabaseException("Could not find IElement for " + element);
+                                       throw new DatabaseException("Could not find IElement for " + element); //$NON-NLS-1$
                                }
                        }
                        
index b9214110b3e66f265ae1f6d8a310e83de17250f5..b6cdcae225fcf2c2486e11fce4ecd27739b692bc 100644 (file)
@@ -10,17 +10,17 @@ public class SCLDiagramTemplate {
 
     public static Variable templateDiagram(ReadGraph graph, Variable self) throws DatabaseException {
         Variable selection = ScenegraphLoaderUtils.getVariableSelection(graph, self);
-        return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagram");
+        return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagram"); //$NON-NLS-1$
     }
 
     public static Variable templateComposite(ReadGraph graph, Variable self) throws DatabaseException {
         Variable selection = ScenegraphLoaderUtils.getVariableSelection(graph, self);
-       return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagramComposite");
+       return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "diagramComposite"); //$NON-NLS-1$
     }
 
     public static Variable templateModel(ReadGraph graph, Variable self) throws DatabaseException {
         Variable selection = ScenegraphLoaderUtils.getVariableSelection(graph, self);
-       return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "model");
+       return PredefinedVariables.getInstance().getPredefinedVariable(graph, selection, "model"); //$NON-NLS-1$
     }
 
 }
\ No newline at end of file
index aada046df3ce04cbccac48b553f8cb8948a074fa..1c5dea754acb55454e629926a67fe1e790f3f391 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.IInputValidator;
 import org.eclipse.jface.dialogs.InputDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
@@ -28,6 +29,7 @@ import org.eclipse.jface.viewers.ICheckStateProvider;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PlatformUI;
 import org.simantics.Simantics;
@@ -124,9 +126,9 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 {
 
         @Override
         public String toString() {
-            return getClass().getSimpleName() + "[name=" + name
-                    + ", originally selected=" + originallySelected
-                    + ", selected=" + selected + "]";
+            return getClass().getSimpleName() + "[name=" + name //$NON-NLS-1$
+                    + ", originally selected=" + originallySelected //$NON-NLS-1$
+                    + ", selected=" + selected + "]"; //$NON-NLS-1$ //$NON-NLS-2$
         }
     }
 
@@ -260,19 +262,16 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 {
 
         final Resource model = getCommonModel(symbols);
         if (model == null) {
-            ShowMessage.showInformation("Same Model Required", "All the selected symbols must be from within the same model.");
+            ShowMessage.showInformation(Messages.AssignSymbolGroup_SameModelRequired, Messages.AssignSymbolGroup_SameModelRequiredMsg);
             return;
         }
 
         final AtomicReference<SymbolGroup[]> groups =
                 new AtomicReference<SymbolGroup[]>( getSymbolGroups(symbols) );
 
-        StringBuilder message = new StringBuilder();
-        message.append("Select symbol groups the selected ");
-        if (symbols.size() > 1)
-            message.append(symbols.size()).append(" symbols are shown in.");
-        else
-            message.append("symbol is shown in.");
+        String message = symbols.size() > 1
+                ? NLS.bind(Messages.AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn, symbols.size())
+                :  Messages.AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn;
 
         AssignSymbolGroupsDialog dialog = new AssignSymbolGroupsDialog(
                 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
@@ -326,7 +325,7 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 {
                 }
             }
         };
-        dialog.setTitle("Symbol Group Assignments");
+        dialog.setTitle(Messages.AssignSymbolGroup_SymbolGroupAssignments);
         dialog.setInitialSelections(selectedElements(groups.get()));
         if (dialog.open() == Dialog.OK) {
             final ArrayList<SymbolGroup> added = new ArrayList<SymbolGroup>();
@@ -351,18 +350,18 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 {
 
     private static SymbolGroup newSymbolGroup(Shell shell, Resource model, final SymbolGroup[] oldGroups) {
         InputDialog dialog = new InputDialog(shell,
-                "New Symbol Group",
-                "Write the name of the new symbol group.",
-                "NewSymbolGroup",
+                Messages.AssignSymbolGroup_NewSymbolGroup,
+                Messages.AssignSymbolGroup_WriteSymbolGroupName,
+                "NewSymbolGroup", //$NON-NLS-1$
                 new IInputValidator() {
                     @Override
                     public String isValid(String newText) {
                         newText = newText.trim();
                         if (newText.isEmpty())
-                            return "The name must be non-empty.";
+                            return Messages.AssignSymbolGroup_NameMustNotBeEmpty;
                         for (SymbolGroup g : oldGroups)
                             if (newText.equals(g.name))
-                                return "A symbol group with that name already exists.";
+                                return Messages.AssignSymbolGroup_GroupSymbolAlreadyExists;
                         return null;
                     }
                 }
@@ -388,11 +387,11 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 {
             return false;
         String message;
         if (groups.length == 1)
-            message = "Are you sure you want to remove symbol group '" + groups[0].name + "' ?";
+            message = NLS.bind(Messages.AssignSymbolGroup_AreYouSureToRemoveSymbolGroup, groups[0].name );
         else
-            message = "Are you sure you want to remove " + groups.length + " symbol groups?";
+            message = NLS.bind(Messages.AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1, groups.length );
         MessageDialog dialog = 
-            new MessageDialog(shell, "Confirm removal", null, message, MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0);
+            new MessageDialog(shell, Messages.AssignSymbolGroup_ConfirmRemoval, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL , IDialogConstants.CANCEL_LABEL  }, 0); 
         if (dialog.open() == Dialog.OK) {
             Simantics.getSession().asyncRequest(new WriteRequest() {
                 @Override
index 68ac2a7a05f01a29c7a8b204927699a01efa710e..b768a05ab728068fcc29a819ffaaf92512974752 100644 (file)
@@ -38,9 +38,9 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
 
     private static final String DIALOG = "AssignSymbolGroupsDialog"; //$NON-NLS-1$
 
-    static String SELECT_ALL_TITLE = WorkbenchMessages.SelectionDialog_selectLabel;
+    static String SELECT_ALL_TITLE = ""; //$NON-NLS-1$
 
-    static String DESELECT_ALL_TITLE = WorkbenchMessages.SelectionDialog_deselectLabel;
+    static String DESELECT_ALL_TITLE = ""; //$NON-NLS-1$
 
     // the root element to populate the viewer with
     protected Object inputElement;
@@ -78,7 +78,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
             ICheckStateProvider checkStateProvider,
             String message) {
         super(parentShell);
-        setTitle(WorkbenchMessages.ListSelection_title);
+        setTitle(""); //$NON-NLS-1$
         inputElement = input;
         this.contentProvider = contentProvider;
         this.labelProvider = labelProvider;
@@ -86,7 +86,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
         if (message != null) {
             setMessage(message);
         } else {
-            setMessage(WorkbenchMessages.ListSelection_message);
+            setMessage(""); //$NON-NLS-1$
         }
 
         IDialogSettings settings = Activator.getDefault().getDialogSettings();
@@ -139,7 +139,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
         Label label = new Label(buttonComposite, SWT.NONE);
 
         Button newButton = createButton(buttonComposite,
-                IDialogConstants.INTERNAL_ID-1, "&New...", false);
+                IDialogConstants.INTERNAL_ID-1, org.simantics.modeling.ui.actions.WorkbenchMessages.AssignSymbolGroupsDialog_NewDots, false);
 
         listener = new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
@@ -149,7 +149,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
         newButton.addSelectionListener(listener);
 
         Button removeButton = createButton(buttonComposite,
-                IDialogConstants.INTERNAL_ID-2, "&Remove", false);
+                IDialogConstants.INTERNAL_ID-2, org.simantics.modeling.ui.actions.WorkbenchMessages.AssignSymbolGroupsDialog_RemoveAnd, false);
 
         listener = new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
index 0c93e6c2055652a4ce48e003bd646f22009c8d76..651f4f66b21128892a8bd0b8d595996db0f10bf1 100644 (file)
@@ -33,7 +33,7 @@ public class CompilePGraphsAction implements ActionFactory {
         if (!(target instanceof Resource))
             return null;
         return () -> {
-            Job job = new Job("Compile PGraphs") {
+            Job job = new Job(Messages.CompilePGraphsAction_CompilePGraphs) {
                 @Override
                 protected IStatus run(IProgressMonitor monitor) {
                     try {
@@ -59,9 +59,9 @@ public class CompilePGraphsAction implements ActionFactory {
                        class ErrorMessageDialog extends MessageDialog {
                                public ErrorMessageDialog(Shell shell) {
                                        super(shell, 
-                                                       "Problems in the Ontology Definition File", null, 
-                                                       "The following issues were found:"
-                                                       MessageDialog.ERROR, new String[] { "Continue" }, 0);
+                                                       Messages.CompilePGraphsAction_ProblemsinOntologyDefinitionFile, null, 
+                                                       Messages.CompilePGraphsAction_FollowingIssuesFound
+                                                       MessageDialog.ERROR, new String[] { Messages.CompilePGraphsAction_Continue }, 0);
                                }
 
                                @Override
@@ -71,9 +71,9 @@ public class CompilePGraphsAction implements ActionFactory {
                                        org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.READ_ONLY);
                                        GridDataFactory.fillDefaults().grab(true, true).applyTo(list);
                                        for (Problem problem : result.getErrors())
-                                               list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
+                                               list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
                                        for (Problem problem : result.getWarnings())
-                                               list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
+                                               list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
 
                                        return composite;
                                }
index 6f57f86d61f4d3e6de234b87660f2e183c1a7dd2..e392419c9a5ad71455a50eab51734e0c91f11a5c 100644 (file)
@@ -112,9 +112,9 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 {
 
         @Override
         public String toString() {
-            return getClass().getSimpleName() + "[name=" + name
-                    + ", originally selected=" + originallySelected
-                    + ", selected=" + selected + "]";
+            return getClass().getSimpleName() + "[name=" + name //$NON-NLS-1$
+                    + ", originally selected=" + originallySelected //$NON-NLS-1$
+                    + ", selected=" + selected + "]"; //$NON-NLS-1$ //$NON-NLS-2$
         }
     }
 
@@ -249,7 +249,7 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 {
 
         final Resource indexRoot = getCommonModel(connectionPoints);
         if (indexRoot == null) {
-            ShowMessage.showInformation("Same Model Required", "All the selected connection points must be from within the same index root.");
+            ShowMessage.showInformation(Messages.ConfigureConnectionTypes_SameModelRequired, Messages.ConfigureConnectionTypes_SameModelRequiredMsg);
             return;
         }
 
@@ -258,9 +258,9 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 {
 
         StringBuilder message = new StringBuilder();
         if (connectionPoints.size() > 1)
-            message.append("Select connection types for the selected connection points");
+            message.append(Messages.ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoints);
         else
-            message.append("Select connection types for the selected connection point");
+            message.append(Messages.ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoint);
 
         ConfigureConnectionTypesDialog dialog = new ConfigureConnectionTypesDialog(
                 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
@@ -281,7 +281,7 @@ public class ConfigureConnectionTypes implements ActionFactory, ActionFactory2 {
             }
 
         };
-        dialog.setTitle("Connection Type Assignments");
+        dialog.setTitle(Messages.ConfigureConnectionTypes_ConnectionTypeAssignments);
         dialog.setInitialSelections(selectedElements(types.get()));
         if (dialog.open() == Dialog.OK) {
             final ArrayList<ConnectionType> added = new ArrayList<ConnectionType>();
index 407e1ec694345e0b135a6192f5f60585a59e96fa..fc37abbf9bd2123d9c68c446396216e6a267267a 100644 (file)
@@ -31,7 +31,7 @@ public class Copy implements ActionFactory, ActionFactory2 {
                        resources.add((Resource)o);
                }
         return () -> {
-            Job job = new Job("Copy") {
+            Job job = new Job(Messages.Copy_Copy) {
 
                 @Override
                 protected IStatus run(IProgressMonitor monitor) {
index 6b9431abcfc2afe58071224770b67a467d5b48b2..27b55a06bc06ee588daa8dce711c1e75644e9c15 100644 (file)
@@ -19,10 +19,10 @@ public class CreateEllipse extends CreateShapeHandler {
     @Override
     public String getDefaultElementData() {
         final String data = 
-                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + 
-                "<svg overflow=\"visible\" version=\"1.1\">" + 
-                "<ellipse x=\"0\" y=\"0\" rx=\"5\" ry=\"5\" style=\"fill:none;stroke-width:1;stroke:rgb(0,0,0)\"/>"+
-                "</svg>";
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +  //$NON-NLS-1$
+                "<svg overflow=\"visible\" version=\"1.1\">" +  //$NON-NLS-1$
+                "<ellipse x=\"0\" y=\"0\" rx=\"5\" ry=\"5\" style=\"fill:none;stroke-width:1;stroke:rgb(0,0,0)\"/>"+ //$NON-NLS-1$
+                "</svg>"; //$NON-NLS-1$
         return data;
     }
 
index 83cada7deaf7b34e4cf5f254942403323b50d47c..8fbda8dc5675bae212e02ed1d28a18c7141a22ee 100644 (file)
@@ -19,10 +19,10 @@ public class CreatePath extends CreateShapeHandler {
     @Override
     public String getDefaultElementData() {
         final String data = 
-                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + 
-                "<svg overflow=\"visible\" version=\"1.1\">" + 
-                "<path d=\"M0 0 L10 0\" style=\"fill:none;stroke-width:1;stroke:rgb(0,0,0)\"/>"+
-                "</svg>";
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +  //$NON-NLS-1$
+                "<svg overflow=\"visible\" version=\"1.1\">" +  //$NON-NLS-1$
+                "<path d=\"M0 0 L10 0\" style=\"fill:none;stroke-width:1;stroke:rgb(0,0,0)\"/>"+ //$NON-NLS-1$
+                "</svg>"; //$NON-NLS-1$
         return data;
     }
 
index fccc8ed8003b23ffe4f9d5b0e84a968525a31e9a..781e17c7fc0b3eaa863835123eeeecce07a37b87 100644 (file)
@@ -19,10 +19,10 @@ public class CreateRectangle extends CreateShapeHandler {
     @Override
     public String getDefaultElementData() {
         final String data = 
-                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + 
-                "<svg overflow=\"visible\" version=\"1.1\">" + 
-                "<rect x=\"0\" y=\"0\" width=\"10\" height=\"10\" style=\"fill:none;stroke-width:1;stroke:rgb(0,0,0)\"/>"+
-                "</svg>";
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +  //$NON-NLS-1$
+                "<svg overflow=\"visible\" version=\"1.1\">" +  //$NON-NLS-1$
+                "<rect x=\"0\" y=\"0\" width=\"10\" height=\"10\" style=\"fill:none;stroke-width:1;stroke:rgb(0,0,0)\"/>"+ //$NON-NLS-1$
+                "</svg>"; //$NON-NLS-1$
         return data;
     }
 
index b7803a77b387ece14eab3b813d20e0f6753b6d34..aeaa212c12ce99a2a72c1db219dfd12cb01511f7 100644 (file)
@@ -87,9 +87,9 @@ public abstract class CreateShapeHandler extends AbstractHandler {
                     }
                 });
 
-                IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput));
+                IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); //$NON-NLS-1$
                 if (eps.length == 0) {
-                    System.out.println("symbol editor part not found from multi page editor part: " + ap);
+                    System.out.println("symbol editor part not found from multi page editor part: " + ap); //$NON-NLS-1$
                     return null;
                 }
                 viewer = eps[0];
@@ -104,12 +104,12 @@ public abstract class CreateShapeHandler extends AbstractHandler {
         }
         ICanvasContext ctx = (ICanvasContext) viewer.getAdapter(ICanvasContext.class);
         if (ctx == null) {
-            System.out.println("No canvas context");
+            System.out.println("No canvas context"); //$NON-NLS-1$
             return null;
         }
         MouseInfo minfo = ctx.getSingleItem(MouseUtil.class).getMousePressedInfo(0);
         if(minfo == null) {
-            System.out.println("No mouse info");
+            System.out.println("No mouse info"); //$NON-NLS-1$
             return null;
         }
         final Point2D mpos = minfo.canvasPosition;
index 8cd899bb8a775498718c3f44295bff190f5c02e3..ce053c8830b8961b61b4207206bbf24092859160 100644 (file)
@@ -19,10 +19,10 @@ public class CreateText extends CreateShapeHandler {
     @Override
     public String getDefaultElementData() {
         final String data = 
-                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + 
-                "<svg overflow=\"visible\" version=\"1.1\">" +
-                "<text fill=\"rgb(0,0,0)\" stroke=\"none\" font-size=\"12\"><tspan font-family=\"sans-serif\" >Text</tspan></text>" + 
-                "</svg>";
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +  //$NON-NLS-1$
+                "<svg overflow=\"visible\" version=\"1.1\">" + //$NON-NLS-1$
+                "<text fill=\"rgb(0,0,0)\" stroke=\"none\" font-size=\"12\"><tspan font-family=\"sans-serif\" >Text</tspan></text>" +  //$NON-NLS-1$
+                "</svg>"; //$NON-NLS-1$
         return data;
     }
 
index e50233f399b2ad066114e97f84c7982c1ef905ee..51aec07c6d11b92d5dc234206305f363cee4ea92 100644 (file)
@@ -32,7 +32,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
  */
 public class DuplicatePinnedViewHandler extends AbstractHandler {
 
-    private static final String PIN_SELECTION_COMMAND = "org.simantics.modeling.ui.pinSelection";
+    private static final String PIN_SELECTION_COMMAND = "org.simantics.modeling.ui.pinSelection"; //$NON-NLS-1$
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
@@ -48,7 +48,7 @@ public class DuplicatePinnedViewHandler extends AbstractHandler {
             // with a property page just like the original.
             ISelection originalSelection = originalPropertyView.getLastSelection();
 
-            final String id = originalPart.getSite().getId() + "Pinned:" + UUID.randomUUID().toString();
+            final String id = originalPart.getSite().getId() + "Pinned:" + UUID.randomUUID().toString(); //$NON-NLS-1$
             PropertyPageView newPart = (PropertyPageView) WorkbenchUtils.activateView(id);
 
             newPart.partActivated(originalPart);
index c5f3daea62ccffb2c6ed375b057e12e224ab2c80..398ef5dc4135e2f696fbb26589265fec8d4f6f60 100644 (file)
@@ -22,7 +22,7 @@ public class ExpandFlagsHandler extends FlagOperationHandler {
     @Override
     protected void perform(IProgressMonitor monitor, WriteGraph graph, List<Resource> flags,
             ICanvasContext canvasContext) throws DatabaseException {
-        monitor.beginTask("Expand Flags", IProgressMonitor.UNKNOWN);
+        monitor.beginTask(Messages.ExpandFlagsHandler_MonitorExpandFlags, IProgressMonitor.UNKNOWN);
 
         Set<Resource> newSelection = new HashSet<Resource>();
         for (Resource flag : flags) {
index 03512a9c4c723178dda3d1eb8af2021b30bcdc45..35e3fb14e2916b86475aa777d918bfa5ff3cdeaa 100644 (file)
@@ -62,7 +62,7 @@ abstract public class ExplorerDynamicMenuContribution<T> extends DynamicMenuCont
        }
 
        protected ImageDescriptor silk(String name) {
-               return BundleUtils.getImageDescriptorFromBundle(Platform.getBundle("com.famfamfam.silk"), "/icons/" + name);
+               return BundleUtils.getImageDescriptorFromBundle(Platform.getBundle("com.famfamfam.silk"), "/icons/" + name); //$NON-NLS-1$ //$NON-NLS-2$
        }
 
        abstract protected T computeInput(ReadGraph graph, Object[] selection) throws DatabaseException;
index ed41bc13277b61f69c7a4b2af81a815f38888aa3..6f6338f55b3791fd566efce5a573e0ca4609d44c 100644 (file)
@@ -70,9 +70,9 @@ public class ImportSVG extends AbstractHandler {
                     }
                 });
 
-                IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput));
+                IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); //$NON-NLS-1$
                 if (eps.length == 0) {
-                    System.out.println("symbol editor part not found from multi page editor part: " + ap);
+                    System.out.println("symbol editor part not found from multi page editor part: " + ap); //$NON-NLS-1$
                     return null;
                 }
                 viewer = eps[0];
@@ -85,12 +85,12 @@ public class ImportSVG extends AbstractHandler {
         }
         ICanvasContext ctx = (ICanvasContext) viewer.getAdapter(ICanvasContext.class);
         if (ctx == null) {
-            System.out.println("No canvas context");
+            System.out.println("No canvas context"); //$NON-NLS-1$
             return null;
         }
         MouseInfo minfo = ctx.getSingleItem(MouseUtil.class).getMousePressedInfo(0);
         if(minfo == null) {
-            System.out.println("No mouse info");
+            System.out.println("No mouse info"); //$NON-NLS-1$
             return null;
         }
         final Point2D mpos = minfo.canvasPosition;
@@ -105,8 +105,8 @@ public class ImportSVG extends AbstractHandler {
         Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
 
         FileDialog dialog = new FileDialog(shell);
-        dialog.setText("Choose an image to be imported");
-        dialog.setFilterExtensions(new String[] {"*.svg", "*.png"});
+        dialog.setText(Messages.ImportSVG_ChooseImportImage);
+        dialog.setFilterExtensions(new String[] {"*.svg", "*.png"}); //$NON-NLS-1$ //$NON-NLS-2$
 
         final String filename = dialog.open();
         if(filename == null)
@@ -120,7 +120,7 @@ public class ImportSVG extends AbstractHandler {
 
                 @Override
                 public void perform(WriteGraph g) throws DatabaseException {
-                    Commands.get(g, "Simantics/Diagram/createSVGElement")
+                    Commands.get(g, "Simantics/Diagram/createSVGElement") //$NON-NLS-1$
                             .execute(g, g.syncRequest(new IndexRoot(composite)),
                                      composite, suffix(filename), data, mposX, mposY);
                 }
index 15d0ed086e42d4915815860429602bf3385e0919..ea0a40593be4500aae06ec4efe4ac97bba91f6f8 100644 (file)
@@ -43,7 +43,7 @@ public class MergeFlagsAction implements ActionFactory {
                     IRunnableWithProgress runnable = new IRunnableWithProgress() {
                         @Override
                         public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-                            final SubMonitor submonitor = SubMonitor.convert(monitor, "Merge Flags", 1000);
+                            final SubMonitor submonitor = SubMonitor.convert(monitor, Messages.MergeFlagsAction_MonitorMergeFlags, 1000);
                             try {
                                 Simantics.getSession().sync(new WriteRequest() {
                                     @Override
@@ -51,14 +51,14 @@ public class MergeFlagsAction implements ActionFactory {
                                         graph.markUndoPoint();
                                         
                                         SubMonitor expand = submonitor.newChild(10);
-                                        expand.subTask("Expand Composite Set");
+                                        expand.subTask(Messages.MergeFlagsAction_ExpandCompositeSet);
                                         MergeFlags.expandCompositeSet(graph, composites);
                                         if (monitor.isCanceled())
                                             throw new CancelTransactionException();
                                         expand.done();
 
                                         SubMonitor collect = submonitor.newChild(490);
-                                        collect.subTask("Collect flags");
+                                        collect.subTask(Messages.MergeFlagsAction_CollectFlag);
                                         collect.setWorkRemaining(composites.size());
                                         ArrayList<ArrayList<Resource>> groups = new ArrayList<ArrayList<Resource>>(); 
                                         for(Resource composite : composites) {
@@ -70,7 +70,7 @@ public class MergeFlagsAction implements ActionFactory {
                                         collect.done();
 
                                         SubMonitor merge = submonitor.newChild(500);
-                                        merge.subTask("Merge collected flags");
+                                        merge.subTask(Messages.MergeFlagsAction_MonitorMergeCollectedFlags);
                                         merge.setWorkRemaining(composites.size());
                                         for(ArrayList<Resource> group : groups) {
                                             MergeFlags.merge(graph, group);
index 9a7b1055cd08fc90bd0ddec2208fa66131371ea0..3671fa9bbb88298038be9ccc86f8128170a7b497 100644 (file)
@@ -22,7 +22,7 @@ public class MergeFlagsHandler extends FlagOperationHandler {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(MergeFlagsHandler.class);
     protected void perform(IProgressMonitor monitor, WriteGraph graph, List<Resource> flags, ICanvasContext canvasContext) throws DatabaseException {
-        monitor.beginTask("Merge Selected Flags", IProgressMonitor.UNKNOWN);
+        monitor.beginTask(Messages.MergeFlagsHandler_MonitorMergeSelectedFlags, IProgressMonitor.UNKNOWN);
         performMerge(graph, flags, canvasContext);
     }
 
index b3d4896266089592d437a2b2ccf76488401497de..773a3b0b08eed0b597c68092d05351db733baac0 100644 (file)
@@ -18,7 +18,7 @@ public class MergeRelatedFlagsHandler extends FlagOperationHandler {
     @Override
     protected void perform(IProgressMonitor monitor, WriteGraph graph, List<Resource> flags,
             ICanvasContext canvasContext) throws DatabaseException {
-        monitor.beginTask("Merge Related Flags", IProgressMonitor.UNKNOWN);
+        monitor.beginTask(Messages.MergeRelatedFlagsHandler_MonitorMergeRelatedFlags, IProgressMonitor.UNKNOWN);
         MergeFlags.expandFlagSet(graph, flags);
         MergeFlagsHandler.performMerge(graph, flags, canvasContext);
     }
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java
new file mode 100644 (file)
index 0000000..2039c10
--- /dev/null
@@ -0,0 +1,55 @@
+package org.simantics.modeling.ui.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.messages"; //$NON-NLS-1$
+       public static String AssignSymbolGroup_AreYouSureToRemoveSymbolGroup;
+       public static String AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1;
+       public static String AssignSymbolGroup_ConfirmRemoval;
+       public static String AssignSymbolGroup_GroupSymbolAlreadyExists;
+       public static String AssignSymbolGroup_NameMustNotBeEmpty;
+       public static String AssignSymbolGroup_NewSymbolGroup;
+       public static String AssignSymbolGroup_SameModelRequired;
+       public static String AssignSymbolGroup_SameModelRequiredMsg;
+       public static String AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn;
+       public static String AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn;
+       public static String AssignSymbolGroup_SymbolGroupAssignments;
+       public static String AssignSymbolGroup_WriteSymbolGroupName;
+       public static String CompilePGraphsAction_CompilePGraphs;
+       public static String CompilePGraphsAction_Continue;
+       public static String CompilePGraphsAction_FollowingIssuesFound;
+       public static String CompilePGraphsAction_ProblemsinOntologyDefinitionFile;
+       public static String ConfigureConnectionTypes_ConnectionTypeAssignments;
+       public static String ConfigureConnectionTypes_SameModelRequired;
+       public static String ConfigureConnectionTypes_SameModelRequiredMsg;
+       public static String ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoint;
+       public static String ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoints;
+       public static String Copy_Copy;
+       public static String ExpandFlagsHandler_MonitorExpandFlags;
+       public static String ImportSVG_ChooseImportImage;
+       public static String MergeFlagsAction_CollectFlag;
+       public static String MergeFlagsAction_ExpandCompositeSet;
+       public static String MergeFlagsAction_MonitorMergeCollectedFlags;
+       public static String MergeFlagsAction_MonitorMergeFlags;
+       public static String MergeFlagsHandler_MonitorMergeSelectedFlags;
+       public static String MergeRelatedFlagsHandler_MonitorMergeRelatedFlags;
+       public static String ModeledActions_ActivatorInvalidContributionsEncounteredIn;
+       public static String NewComponentTypeAction_ActivatorFailedToCreateNewUserComponent;
+       public static String NewComponentTypeAction_NewUserComponent;
+       public static String NewConnectionPoint_SelectConnectionPointType;
+       public static String NewLibrary_Library;
+       public static String NewProceduralComponentType_ActivatorFailedToCreateNewUserComponent;
+       public static String NewProceduralComponentType_NewUserComponent;
+       public static String NewSubscription_Subscription;
+       public static String RenameDiagramComponents_ActivatorRenameDiaActionFailed;
+       public static String SetInitialState_SetInitialState;
+       public static String SwitchComponentTypeContribution_AlternativeTypes;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 478d8b761046177484db3ecbc02643ada1801feb..e189d752daa85b89dc2fca8c33abbc604fec9c93 100644 (file)
@@ -33,6 +33,7 @@ import org.eclipse.jface.action.ActionContributionItem;
 import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.browsing.ui.NodeContext;
 import org.simantics.browsing.ui.common.NodeContextBuilder;
 import org.simantics.browsing.ui.model.InvalidContribution;
@@ -45,7 +46,6 @@ import org.simantics.issues.common.IssueUtils;
 import org.simantics.modeling.ui.Activator;
 import org.simantics.project.ontology.ProjectResource;
 import org.simantics.ui.contribution.DynamicMenuContribution;
-import org.simantics.ui.selection.WorkbenchSelectionElement;
 import org.simantics.ui.selection.WorkbenchSelectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -81,12 +81,12 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab
     public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
         if(data instanceof String) {
             String str = (String)data;
-            String[] parms = str.split(";");
+            String[] parms = str.split(";"); //$NON-NLS-1$
             for(String parm : parms) {
-                String[] keyValue = parm.split("=");
+                String[] keyValue = parm.split("="); //$NON-NLS-1$
                 if(keyValue.length == 2) {
                     String key = keyValue[0].trim();
-                    if("context".equals(key)) {
+                    if("context".equals(key)) { //$NON-NLS-1$
                         browseContexts = Collections.singleton(keyValue[1]);
                     }
                 }
@@ -126,7 +126,7 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab
                        result.add(NodeContextBuilder.buildWithInput(res));
                }
             } catch (DatabaseException e) {
-               LOGGER.error("Failed to get node contexts for selection.", e);
+               LOGGER.error("Failed to get node contexts for selection.", e); //$NON-NLS-1$
             }
         }
 
@@ -160,7 +160,7 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab
                 if (first)
                     first = false;
                 else
-                    items.add(new Separator(category == null ? "" : category.getLabel()));
+                    items.add(new Separator(category == null ? "" : category.getLabel())); //$NON-NLS-1$
                 for (Action action : actions)
                     items.add(new ActionContributionItem(action));
             }
@@ -176,10 +176,8 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab
     }
 
     @Override
-    protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection)
-            throws DatabaseException
-    {
-        List<NodeContext> contexts = Arrays.asList( (NodeContext[]) selection );
+    protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection) throws DatabaseException {
+        List<NodeContext> contexts = Arrays.asList((NodeContext[]) selection);
         if (contexts.isEmpty())
             return NONE;
 
@@ -200,24 +198,26 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab
 
                 result = new HashMap<>();
 
-                for(Map.Entry<IActionCategory, List<Action>> entry : m.entrySet()) {
+                for (Map.Entry<IActionCategory, List<Action>> entry : m.entrySet()) {
                     List<Action> exist = current.get(entry.getKey());
                     if (exist == null)
                         continue;
 
                     ArrayList<Action> l = new ArrayList<Action>();
-                    for(Action e : exist) {
+                    for (Action e : exist) {
                         String id = e.getId();
                         boolean found = false;
-                        for(Action a : entry.getValue()) {
-                            if(id.equals(a.getId())) {
+                        for (Action a : entry.getValue()) {
+                            if (id.equals(a.getId())) {
                                 found = true;
                                 break;
                             }
                         }
-                        if(found) l.add(e);
+                        if (found)
+                            l.add(e);
                     }
-                    if(!l.isEmpty()) result.put(entry.getKey(), l);
+                    if (!l.isEmpty())
+                        result.put(entry.getKey(), l);
                 }
 
                 current = result;
@@ -228,7 +228,9 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab
 
         } catch (InvalidContribution e) {
             Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                    "Invalid contribution encountered in " + getClass().getSimpleName() + ".", e));
+                    NLS.bind(Messages.ModeledActions_ActivatorInvalidContributionsEncounteredIn,
+                            getClass().getSimpleName()),
+                    e));
         }
         return NONE;
     }
index 5f3d55ff04968845f96f27b46ae527b87bc1810f..c420904b48c03cb520c8dcdffa441efcb8f9f68a 100644 (file)
@@ -48,12 +48,12 @@ public class ModeledDoubleClickActions implements IDoubleClickAction, IExecutabl
     public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
        if(data instanceof String) {
                String str = (String)data;
-               String[] parms = str.split(";");
+               String[] parms = str.split(";"); //$NON-NLS-1$
                for(String parm : parms) {
-                       String[] keyValue = parm.split("=");
+                       String[] keyValue = parm.split("="); //$NON-NLS-1$
                        if(keyValue.length == 2) {
                                String key = keyValue[0].trim();
-                               if("context".equals(key)) {
+                               if("context".equals(key)) { //$NON-NLS-1$
                                        browseContexts = Collections.singleton(keyValue[1]);
                                }
                        }
index fafaa7e51a09c4cad73590aa925fc3dc2c4c1671..a07fe933a4976d3631e95b36919f6a7f432d888f 100644 (file)
@@ -35,7 +35,7 @@ public class NewComponentTypeAction implements ActionFactory {
         return new Runnable() {
             @Override
             public void run() {
-                Job job = new DatabaseJob("New User Component") {
+                Job job = new DatabaseJob(Messages.NewComponentTypeAction_NewUserComponent) {
                     @Override
                     protected IStatus run(IProgressMonitor monitor) {
                         try {
@@ -48,7 +48,7 @@ public class NewComponentTypeAction implements ActionFactory {
                             });
                             return Status.OK_STATUS;
                         } catch (DatabaseException e) {
-                            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to create new user component.", e); 
+                            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewComponentTypeAction_ActivatorFailedToCreateNewUserComponent, e); 
                         }
                     }
                 };
index d73adc421be2afc70c0e15a3c089f34e3b2016e8..2d6074ec8bd7583d9dbd848a2a977b5d071a1eca 100644 (file)
@@ -91,7 +91,7 @@ public class NewConnectionPoint implements ActionFactory {
                                     name = sb.toString();
                                 } else {
                                     // domains.size() == 1
-                                    name = NameUtils.getSafeName(graph, _res) + " (" + graph.getURI(domains.iterator().next()) + ")";
+                                    name = NameUtils.getSafeName(graph, _res) + " (" + graph.getURI(domains.iterator().next()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                                 }
                                 map.put(_res, new Pair<String, ImageDescriptor>(name, null));
                                 
@@ -116,12 +116,12 @@ public class NewConnectionPoint implements ActionFactory {
                         }
                         String createConnectionPointComment(ReadGraph graph, Resource target, Resource[] cps) throws DatabaseException {
                             StringBuilder result = new StringBuilder();
-                            result.append("Created connection point");
+                            result.append("Created connection point"); //$NON-NLS-1$
                             if (cps.length > 1)
                                 result.append('s');
-                            result.append(" for ")
+                            result.append(" for ") //$NON-NLS-1$
                             .append(NameUtils.getSafeName(graph, componentType))
-                            .append(":\n");
+                            .append(":\n"); //$NON-NLS-1$
                             for (int i = 0; i < cps.length; ++i) {
                                 result.append('\t');
                                 result.append(NameUtils.getSafeName(graph, cps[i]));
@@ -162,7 +162,7 @@ public class NewConnectionPoint implements ActionFactory {
     private Resource[] queryCps(Map<Resource, Pair<String, ImageDescriptor>> map) {
 
         Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-        ResourceSelectionDialog3<Resource> dialog = new ResourceSelectionDialog3<Resource>(shell, map, "Select connection point type") {
+        ResourceSelectionDialog3<Resource> dialog = new ResourceSelectionDialog3<Resource>(shell, map, Messages.NewConnectionPoint_SelectConnectionPointType) {
             @Override
             protected IDialogSettings getBaseDialogSettings() {
                 return Activator.getDefault().getDialogSettings();
index 0efcc5b8c4cf695fb8f33e3400e9d72c8ccb3783..37a733a966ea3027273a44461b27e524c70f90d9 100644 (file)
@@ -29,7 +29,7 @@ public class NewDocument implements ActionFactory {
                         Layer0 L0 = Layer0.getInstance(graph);
                         DocumentResource DOC = DocumentResource.getInstance(graph);
 
-                        String name = NameUtils.findFreshEscapedName(graph, "Document", model, L0.ConsistsOf);
+                        String name = NameUtils.findFreshEscapedName(graph, "Document", model, L0.ConsistsOf); //$NON-NLS-1$
 
                         // Create DOC.WikiDocument instance
                         Resource wikiDocument = graph.newResource();
@@ -41,13 +41,13 @@ public class NewDocument implements ActionFactory {
                         Resource documentType = graph.getSingleObject(DOC.WikiDocument_WikiDocumentBinding, DOC.DocumentTypeBinding_HasDocumentType);
                         Resource document = graph.newResource();
                         graph.claim(document, L0.InstanceOf, null, DOC.ScenegraphDocument);
-                        graph.claimLiteral(document, L0.HasName, "Documentation");
+                        graph.claimLiteral(document, L0.HasName, "Documentation"); //$NON-NLS-1$
                         graph.claim(wikiDocument, DOC.HasDocumentation, document);
                         graph.claim(document, L0.PartOf, wikiDocument);
 
                         Resource scenegraph = graph.newResource();
                         graph.claim(scenegraph, L0.InstanceOf, null, documentType);
-                        graph.claimLiteral(scenegraph, L0.HasName, "Scenegraph");
+                        graph.claimLiteral(scenegraph, L0.HasName, "Scenegraph"); //$NON-NLS-1$
                         graph.claim(scenegraph, L0.PartOf, document);
                         graph.claim(document, DOC.ScenegraphDocument_scenegraph, scenegraph);
 
index d6205ea5f5696bcac491d44778ffdf0597506d06..c999b98d8312fd6134804eaa3bc9983b103e6a01 100644 (file)
@@ -39,12 +39,12 @@ public class NewLibrary implements ActionFactory {
         Layer0 l0 = Layer0.getInstance(graph);
 
         Resource library = graph.newResource();
-        String name = NameUtils.findFreshName(graph, "Library", parent, l0.ConsistsOf);
+        String name = NameUtils.findFreshName(graph, Messages.NewLibrary_Library, parent, l0.ConsistsOf);
         graph.claim(library, l0.InstanceOf, null, l0.Library);
         graph.addLiteral(library, l0.HasName, l0.NameOf, l0.String, name, Bindings.STRING);
         graph.claim(library, l0.PartOf, parent);
 
-        Layer0Utils.addCommentMetadata(graph, "Created new Library named " + name + ", resource " + library);
+        Layer0Utils.addCommentMetadata(graph, "Created new Library named " + name + ", resource " + library); //$NON-NLS-1$ //$NON-NLS-2$
 
         return library;
     }
index daa21c384d2cc94e48a9b02899c925e33d363e96..3169275493d27f2855b845445840def6ab1eeb0e 100644 (file)
@@ -63,8 +63,8 @@ public class NewProceduralComponentType implements ActionFactory {
         // Name
         String defaultName = graph.getRelatedValue(indexRoot, MOD.StructuralModel_HasDefaultComponentTypeName, Bindings.STRING);
         String name = NameUtils.findFreshName(graph, defaultName, library);
-        graph.claimLiteral(componentType, L0.HasName, name + "@1");
-        graph.claimLiteral(componentType, L0X.HasGeneratedNamePrefix, "");
+        graph.claimLiteral(componentType, L0.HasName, name + "@1"); //$NON-NLS-1$
+        graph.claimLiteral(componentType, L0X.HasGeneratedNamePrefix, ""); //$NON-NLS-1$
 
         // Substructure
 //        Resource substructureType = graph.getSingleObject(indexRoot, MOD.StructuralModel_HasComponentTypeSubstructureType);
@@ -83,13 +83,13 @@ public class NewProceduralComponentType implements ActionFactory {
 //        }
 
         graph.addLiteral(componentType, STR.ProceduralComponentType_code, STR.ProceduralComponentType_code_Inverse, 
-                STR.ProceduralComponentTypeCode, "[]", Bindings.STRING);
+                STR.ProceduralComponentTypeCode, "[]", Bindings.STRING); //$NON-NLS-1$
         
         Resource symbolDiagramType = graph.getPossibleObject(indexRoot, MOD.StructuralModel_HasSymbolDiagramType);
         if(symbolDiagramType == null) symbolDiagramType = DIA.Composite;
         
         // Symbol
-        Resource symbol = new ModelingUtils(graph).createSymbol2("Symbol", symbolDiagramType);
+        Resource symbol = new ModelingUtils(graph).createSymbol2("Symbol", symbolDiagramType); //$NON-NLS-1$
         graph.claim(componentType, MOD.ComponentTypeToSymbol, symbol);
         graph.claim(componentType, L0.ConsistsOf, symbol);
         
@@ -107,7 +107,7 @@ public class NewProceduralComponentType implements ActionFactory {
         return new Runnable() {
             @Override
             public void run() {
-                Job job = new DatabaseJob("New User Component") {
+                Job job = new DatabaseJob(Messages.NewProceduralComponentType_NewUserComponent) {
                     @Override
                     protected IStatus run(IProgressMonitor monitor) {
                         try {
@@ -116,12 +116,12 @@ public class NewProceduralComponentType implements ActionFactory {
                                 public void perform(WriteGraph graph) throws DatabaseException {
                                     graph.markUndoPoint();
                                     Resource r = NewProceduralComponentType.create(graph, library);
-                                    Layer0Utils.addCommentMetadata(graph, "Created new Procedural Component Type " + graph.getPossibleRelatedValue2(r, Layer0.getInstance(graph).HasName, Bindings.STRING));
+                                    Layer0Utils.addCommentMetadata(graph, "Created new Procedural Component Type " + graph.getPossibleRelatedValue2(r, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$
                                 }
                             });
                             return Status.OK_STATUS;
                         } catch (DatabaseException e) {
-                            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to create new user component.", e); 
+                            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewProceduralComponentType_ActivatorFailedToCreateNewUserComponent, e); 
                         }
                     }
                 };
index 2e8a8fcb81c8388f79804e15198b511c3f357a6f..f7bfdf0e2da40114144913057d0d50203aa8ff94 100644 (file)
@@ -35,7 +35,7 @@ public class NewSubscription implements ActionFactory {
                         
                         Layer0 l0 = Layer0.getInstance(g);
                         ModelingResources wr = ModelingResources.getInstance(g);
-                        String freshLabel = NameUtils.findFreshLabel(g, "Subscription", model);
+                        String freshLabel = NameUtils.findFreshLabel(g, Messages.NewSubscription_Subscription, model);
                         @SuppressWarnings("unused")
                         Resource subscription = GraphUtils.create2(g, wr.Subscription,
                                 l0.HasName, UUID.randomUUID().toString(),
@@ -43,7 +43,7 @@ public class NewSubscription implements ActionFactory {
                                 l0.PartOf, model);
                         
                         CommentMetadata cm = g.getMetadata(CommentMetadata.class);
-                        g.addMetadata(cm.add("Created subscription folder " + freshLabel));
+                        g.addMetadata(cm.add("Created subscription folder " + freshLabel)); //$NON-NLS-1$
                     }
                 });
             }
index 75bde31781e929abf8010076985670a92aaea96e..0c8b2573efd8f536dce9e2b4229df1ee2af44162 100644 (file)
@@ -51,7 +51,7 @@ public class RenameDiagramComponents implements ActionFactory {
                         });
                     }
                 } catch (DatabaseException e) {
-                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "RenameDiagramComponents action failed, see exception for details", e));
+                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.RenameDiagramComponents_ActivatorRenameDiaActionFailed, e));
                 }
             }
         };
index bc0b5cbe0d7cf88e2f95fcc1682bb29f3372fa73..93f69e25724beb1de9dba3a82e4592b0fb378c8c 100644 (file)
@@ -121,7 +121,7 @@ public class SetInitialState extends DynamicMenuContribution {
                     @Override
                     public void fill(Menu menu, int index) {
                         MenuItem setInitialState = new MenuItem(menu, SWT.CASCADE, index);
-                        setInitialState.setText("Set Initial State");
+                        setInitialState.setText(Messages.SetInitialState_SetInitialState);
                         Menu subMenu = new Menu(menu);
                         setInitialState.setMenu(subMenu);
 
index 193334e0b67789699358ebfee44d61b940cf0749..d8115f53e432396d166973d5f3bc25432bd7f3ba 100644 (file)
@@ -86,7 +86,7 @@ public class SwitchComponentTypeContribution extends ContributionItem {
         try {
             groups = Simantics.getSession().syncRequest(new ComponentSwitchGroupQuery(resource));
         } catch (DatabaseException e) {
-            LOGGER.error("Retrieval of switch groups failed.", e);
+            LOGGER.error("Retrieval of switch groups failed.", e); //$NON-NLS-1$
             return;
         }
         
@@ -160,7 +160,7 @@ public class SwitchComponentTypeContribution extends ContributionItem {
                     if(label == null) {
                         label = graph.getPossibleRelatedValue(group, L0.HasName);
                         if(label == null)
-                            label = "Alternative types";
+                            label = Messages.SwitchComponentTypeContribution_AlternativeTypes;
                     }
                     groupObj = new SwitchGroup(label);
                 }
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java
new file mode 100644 (file)
index 0000000..36ed5b8
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.modeling.ui.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class WorkbenchMessages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.messages"; //$NON-NLS-1$
+       public static String AssignSymbolGroupsDialog_NewDots;
+       public static String AssignSymbolGroupsDialog_RemoveAnd;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, WorkbenchMessages.class);
+       }
+
+       private WorkbenchMessages() {
+       }
+}
index f3ed6365f7c572efd308d109592614dd0519d0cf..a19df0e2d0593f929cba0efc5e82ddfbfeec9bcd 100644 (file)
@@ -117,7 +117,7 @@ public class GlobalModeledToolbarActions {
         public void exception(Throwable t) {
             Activator.getDefault().getLog().log(
                     new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                            "Global modeled toolbar contribution listener ran into an unexpected exception.",
+                            Messages.GlobalModeledToolbarActions_ActivatorGlobalModeledToolbarException,
                             t));
         }
 
@@ -155,7 +155,7 @@ public class GlobalModeledToolbarActions {
         } catch (InvalidContribution e) {
             Activator.getDefault().getLog().log(
                     new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                            "Encountered invalid modeled contribution(s) while loading global modeled toolbar contributions.",
+                            Messages.GlobalModeledToolbarActions_ActivatorEncounteredInvalidContributionException,
                             e));
         }
 
@@ -185,7 +185,7 @@ public class GlobalModeledToolbarActions {
                 if (first)
                     first = false;
                 else
-                    items.add(new Separator(category == null ? "" : category.getLabel()));
+                    items.add(new Separator(category == null ? "" : category.getLabel())); //$NON-NLS-1$
                 for (Action action : actions)
                     items.add(new ActionContributionItem(action));
             }
index 84eab0eb7629f01eee5a106db64eac9647b8cc34..e21e67455639fd2ff3b0e23f2d602edae7f23074 100644 (file)
@@ -90,9 +90,9 @@ public class ImportSVGPNG {
                     }
                 });
 
-                IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput));
+                IEditorPart[] eps = rfe.findEditors(new ResourceEditorInput("org.simantics.modeling.ui.symbolEditor", symbolEditorInput)); //$NON-NLS-1$
                 if (eps.length == 0) {
-                    System.out.println("symbol editor part not found from multi page editor part: " + ap);
+                    System.out.println("symbol editor part not found from multi page editor part: " + ap); //$NON-NLS-1$
                     return;
                 }
                 viewer = eps[0];
@@ -105,12 +105,12 @@ public class ImportSVGPNG {
         }
         ICanvasContext ctx = (ICanvasContext) viewer.getAdapter(ICanvasContext.class);
         if (ctx == null) {
-            System.out.println("No canvas context");
+            System.out.println("No canvas context"); //$NON-NLS-1$
             return;
         }
         MouseInfo minfo = ctx.getSingleItem(MouseUtil.class).getMousePressedInfo(0);
         if(minfo == null) {
-            System.out.println("No mouse info");
+            System.out.println("No mouse info"); //$NON-NLS-1$
             return;
         }
         final Point2D mpos = minfo.canvasPosition;
@@ -127,8 +127,8 @@ public class ImportSVGPNG {
         Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
 
         FileDialog dialog = new FileDialog(shell);
-        dialog.setText("Choose an image to be imported");
-        dialog.setFilterExtensions(new String[] {"*.svg", "*.png"});
+        dialog.setText(Messages.ImportSVGPNG_ChooseImportImage);
+        dialog.setFilterExtensions(new String[] {"*.svg", "*.png"}); //$NON-NLS-1$ //$NON-NLS-2$
 
         final String filename = dialog.open();
         if(filename == null)
@@ -142,7 +142,7 @@ public class ImportSVGPNG {
 
                 @Override
                 public void perform(WriteGraph g) throws DatabaseException {
-                    Object svg = Commands.get(g, "Simantics/Diagram/createSVGElementR")
+                    Object svg = Commands.get(g, "Simantics/Diagram/createSVGElementR") //$NON-NLS-1$
                             .execute(g, g.syncRequest(new IndexRoot(composite)),
                                      composite, suffix(filename), data, mposX, mposY);
 
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/Messages.java
new file mode 100644 (file)
index 0000000..443c445
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.modeling.ui.actions.e4;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.e4.messages"; //$NON-NLS-1$
+       public static String GlobalModeledToolbarActions_ActivatorEncounteredInvalidContributionException;
+       public static String GlobalModeledToolbarActions_ActivatorGlobalModeledToolbarException;
+       public static String ImportSVGPNG_ChooseImportImage;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/messages.properties
new file mode 100644 (file)
index 0000000..2dd0baf
--- /dev/null
@@ -0,0 +1,3 @@
+GlobalModeledToolbarActions_ActivatorEncounteredInvalidContributionException=Encountered invalid modeled contribution(s) while loading global modeled toolbar contributions.\r
+GlobalModeledToolbarActions_ActivatorGlobalModeledToolbarException=Global modeled toolbar contribution listener ran into an unexpected exception.\r
+ImportSVGPNG_ChooseImportImage=Choose an image to be imported\r
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/messages.properties
new file mode 100644 (file)
index 0000000..57f9e15
--- /dev/null
@@ -0,0 +1,43 @@
+AssignSymbolGroup_AreYouSureToRemoveSymbolGroup=Are you sure you want to remove symbol group ''{0}'' ?
+AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1=Are you sure you want to remove {0} symbol groups?
+AssignSymbolGroup_ConfirmRemoval=Confirm removal
+AssignSymbolGroup_GroupSymbolAlreadyExists=A symbol group with that name already exists.
+AssignSymbolGroup_NameMustNotBeEmpty=The name must be non-empty.
+AssignSymbolGroup_NewSymbolGroup=New Symbol Group
+AssignSymbolGroup_SameModelRequired=Same Model Required
+AssignSymbolGroup_SameModelRequiredMsg=All the selected symbols must be from within the same model.
+AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn=Select symbol groups the selected symbol is shown in.
+AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn=Select symbol groups the selected {0} symbols are shown in.
+AssignSymbolGroup_SymbolGroupAssignments=Symbol Group Assignments
+AssignSymbolGroup_WriteSymbolGroupName=Write the name of the new symbol group.
+AssignSymbolGroupsDialog_NewDots=&New...
+AssignSymbolGroupsDialog_RemoveAnd=&Remove
+CompilePGraphsAction_CompilePGraphs=Compile PGraphs
+CompilePGraphsAction_Continue=Continue
+CompilePGraphsAction_FollowingIssuesFound=The following issues were found:
+CompilePGraphsAction_ProblemsinOntologyDefinitionFile=Problems in the Ontology Definition File
+ConfigureConnectionTypes_ConnectionTypeAssignments=Connection Type Assignments
+ConfigureConnectionTypes_SameModelRequired=Same Model Required
+ConfigureConnectionTypes_SameModelRequiredMsg=All the selected connection points must be from within the same index root.
+ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoint=Select connection types for the selected connection point
+ConfigureConnectionTypes_SelectConnectionTypeForSelectedConnectionPoints=Select connection types for the selected connection points
+Copy_Copy=Copy
+ExpandFlagsHandler_MonitorExpandFlags=Expand Flags
+ImportSVG_ChooseImportImage=Choose an image to be imported
+MergeFlagsAction_CollectFlag=Collect flags
+MergeFlagsAction_ExpandCompositeSet=Expand Composite Set
+MergeFlagsAction_MonitorMergeCollectedFlags=Merge collected flags
+MergeFlagsAction_MonitorMergeFlags=Merge Flags
+MergeFlagsHandler_MonitorMergeSelectedFlags=Merge Selected Flags
+MergeRelatedFlagsHandler_MonitorMergeRelatedFlags=Merge Related Flags
+ModeledActions_ActivatorInvalidContributionsEncounteredIn=Invalid contribution encountered in {0}
+NewComponentTypeAction_ActivatorFailedToCreateNewUserComponent=Failed to create new user component.
+NewComponentTypeAction_NewUserComponent=New User Component
+NewConnectionPoint_SelectConnectionPointType=Select connection point type
+NewLibrary_Library=Library
+NewProceduralComponentType_ActivatorFailedToCreateNewUserComponent=Failed to create new user component.
+NewProceduralComponentType_NewUserComponent=New User Component
+NewSubscription_Subscription=Subscription
+RenameDiagramComponents_ActivatorRenameDiaActionFailed=RenameDiagramComponents action failed, see exception for details
+SetInitialState_SetInitialState=Set Initial State
+SwitchComponentTypeContribution_AlternativeTypes=Alternative types
index 5245089190e8434b118021f2d0f783a39d9eec59..22a61e2a19fbada135c1849532c07042543181c3 100644 (file)
@@ -16,6 +16,7 @@ import javax.swing.JDialog;
 import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.simantics.utils.strings.format.MetricsFormat;
 
 public class AWTStyleDialog extends JDialog {
@@ -33,7 +34,7 @@ public class AWTStyleDialog extends JDialog {
        private boolean useFormat = true;
        
        public AWTStyleDialog(Frame owner,boolean useFont, boolean useColor, boolean useFormat) {
-               super(owner,"Style",true);
+               super(owner,Messages.AWTStyleDialog_Style,true);
                this.useFont = useFont;
                this.useColor = useColor;
                this.useFormat = useFormat;
@@ -42,7 +43,7 @@ public class AWTStyleDialog extends JDialog {
        
        public AWTStyleDialog(boolean useFont, boolean useColor, boolean useFormat) {
                super();
-               setTitle("Style");
+               setTitle(Messages.AWTStyleDialog_Style);
                setModal(true);
                this.useFont = useFont;
                this.useColor = useColor;
@@ -52,41 +53,42 @@ public class AWTStyleDialog extends JDialog {
        
        public void setStartFont(Font font) {
                if (!useFont)
-                       throw new RuntimeException("Dialog is not configured with font support");
+                       throw new RuntimeException("Dialog is not configured with font support"); //$NON-NLS-1$
                fontChooser.setCurrentFont(font);
        }
        
        public void setStartColor(Color color) {
                if (!useColor)
-                       throw new RuntimeException("Dialog is not configured with color support");
+                       throw new RuntimeException("Dialog is not configured with color support"); //$NON-NLS-1$
                colorChooser.setColor(color);
        }
        
        public void setStartFormat(MetricsFormat format) {
                if (!useFormat)
-                       throw new RuntimeException("Dialog is not configured with format support");
+                       throw new RuntimeException("Dialog is not configured with format support"); //$NON-NLS-1$
                metricsEditor.setMetricsFormat(format);
        }
        
        private void createContents() {
-               
+
                JTabbedPane tabbedPane = new JTabbedPane();
-               getContentPane().add(tabbedPane,BorderLayout.CENTER);
+               getContentPane().add(tabbedPane, BorderLayout.CENTER);
                if (useFont)
-                       tabbedPane.addTab("Font", fontChooser = new FontChooser("Sample text"));
+                       tabbedPane.addTab(Messages.AWTStyleDialog_Font,
+                                       fontChooser = new FontChooser(Messages.AWTStyleDialog_SampleText));
                if (useColor)
-                       tabbedPane.addTab("Color",colorChooser = new JColorChooser(new Color(0, 0, 0)));
+                       tabbedPane.addTab(Messages.AWTStyleDialog_Color, colorChooser = new JColorChooser(new Color(0, 0, 0)));
                if (useFormat)
-                       tabbedPane.addTab("Metrics",metricsEditor = new MetricsEditor());
-               
+                       tabbedPane.addTab(Messages.AWTStyleDialog_Metrics, metricsEditor = new MetricsEditor());
+
                JPanel controlPanel = new JPanel();
-               getContentPane().add(controlPanel,BorderLayout.SOUTH);
+               getContentPane().add(controlPanel, BorderLayout.SOUTH);
                controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
-               
-               JButton okButton = new JButton("OK");
+
+               JButton okButton = new JButton(IDialogConstants.OK_LABEL);
                controlPanel.add(okButton);
                okButton.addActionListener(new ActionListener() {
-                       
+
                        @Override
                        public void actionPerformed(ActionEvent e) {
                                cancelled = false;
@@ -94,42 +96,41 @@ public class AWTStyleDialog extends JDialog {
                                AWTStyleDialog.this.dispose();
                        }
                });
-               
-               JButton cancelButton = new JButton("Cancel");
+
+               JButton cancelButton = new JButton(IDialogConstants.CANCEL_LABEL);
                controlPanel.add(cancelButton);
                cancelButton.addActionListener(new ActionListener() {
-                       
+
                        @Override
                        public void actionPerformed(ActionEvent e) {
                                AWTStyleDialog.this.setVisible(false);
                                AWTStyleDialog.this.dispose();
                        }
                });
-               
-               
+
                this.addWindowListener(new WindowListener() {
-                       
+
                        @Override
                        public void windowOpened(WindowEvent arg0) {}
-                       
+
                        @Override
                        public void windowIconified(WindowEvent arg0) {}
-                       
+
                        @Override
                        public void windowDeiconified(WindowEvent arg0) {}
-                       
+
                        @Override
                        public void windowDeactivated(WindowEvent arg0) {}
-                       
+
                        @Override
                        public void windowClosing(WindowEvent arg0) {
                                if (metricsEditor != null)
                                        metricsEditor.dispose();
                        }
-                       
+
                        @Override
                        public void windowClosed(WindowEvent arg0) {}
-                       
+
                        @Override
                        public void windowActivated(WindowEvent arg0) {}
                });
index 9db3a2401d7a449fe711bef4ce492edf6520c7ee..d3b042e5fadcc5295bfa4f0c36b88ca307186f47 100644 (file)
@@ -52,11 +52,11 @@ import org.simantics.utils.ui.ErrorLogger;
  */
 public class EditStyle {
 
-    private static final String SECTION_AWT_STYLE_DIALOG = "AWTStyleDialog";
-    private static final String SETTING_DIALOG_HEIGHT    = "h";
-    private static final String SETTING_DIALOG_WIDTH     = "w";
-    private static final String SETTING_DIALOG_Y         = "y";
-    private static final String SETTING_DIALOG_X         = "x";
+    private static final String SECTION_AWT_STYLE_DIALOG = "AWTStyleDialog"; //$NON-NLS-1$
+    private static final String SETTING_DIALOG_HEIGHT    = "h"; //$NON-NLS-1$
+    private static final String SETTING_DIALOG_WIDTH     = "w"; //$NON-NLS-1$
+    private static final String SETTING_DIALOG_Y         = "y"; //$NON-NLS-1$
+    private static final String SETTING_DIALOG_X         = "x"; //$NON-NLS-1$
 
     public static void openStyleDialog(final Resource[] resources) {
         if (resources.length == 0)
@@ -125,10 +125,10 @@ public class EditStyle {
                 final boolean useColor = hasColor;
                 final boolean useFormat = hasFormat;
 
-                Job job = new Job("Open Style Dialog") {
+                Job job = new Job(Messages.EditStyle_OpenStyleDialog) {
                     @Override
                     protected IStatus run(IProgressMonitor monitor) {
-                        monitor.beginTask("Open dialog", IProgressMonitor.UNKNOWN);
+                        monitor.beginTask(Messages.EditStyle_MonitorOpenDialog, IProgressMonitor.UNKNOWN);
                         SwingUtilities.invokeLater(new Runnable() {
                             @Override
                             public void run() {
index 85524e2ed9d0299b2e57a652b4c2d467d2d650e6..3580b82b6414333cae7c2d39faf17e11f1ab17c3 100644 (file)
@@ -27,7 +27,7 @@ public class FontChooser extends JPanel {
 
     private static final long serialVersionUID = -53650261362110193L;
 
-    private static Font DEFAULT_FONT = new Font("Arial", Font.PLAIN, 16);
+    private static Font DEFAULT_FONT = new Font(Messages.FontChooser_DefaultFont, Font.PLAIN, 16);
 
     private String sampleText;
     private JLabel text;
@@ -59,7 +59,7 @@ public class FontChooser extends JPanel {
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         String[] ff = ge.getAvailableFontFamilyNames();
         fonts = new String[ff.length + 1];
-        fonts[0] = "-- keep current font --";
+        fonts[0] = Messages.FontChooser_KeepCurrentFont;
         System.arraycopy(ff, 0, fonts, 1, ff.length);
 
         fontList = new JList(fonts);
@@ -102,14 +102,14 @@ public class FontChooser extends JPanel {
         sizeComboBox = new JComboBox(sizes);
         sizeComboBox.addActionListener(listener);
         sizeComboBox.setSelectedIndex(7);
-        controlPanel.add(new JLabel("Size: "));
+        controlPanel.add(new JLabel(Messages.FontChooser_Size));
         controlPanel.add(sizeComboBox);
 
-        boldCheckBox = new JCheckBox("Bold");
+        boldCheckBox = new JCheckBox(Messages.FontChooser_Bold);
         boldCheckBox.addActionListener(listener);
         controlPanel.add(boldCheckBox);
 
-        italicCheckBox = new JCheckBox("Italic");
+        italicCheckBox = new JCheckBox(Messages.FontChooser_Italic);
         italicCheckBox.addActionListener(listener);
         controlPanel.add(italicCheckBox);
 
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/Messages.java
new file mode 100644 (file)
index 0000000..5973ddd
--- /dev/null
@@ -0,0 +1,46 @@
+package org.simantics.modeling.ui.actions.style;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.style.messages"; //$NON-NLS-1$
+       public static String AWTStyleDialog_Color;
+       public static String AWTStyleDialog_Font;
+       public static String AWTStyleDialog_Metrics;
+       public static String AWTStyleDialog_SampleText;
+       public static String AWTStyleDialog_Style;
+       public static String EditStyle_MonitorOpenDialog;
+       public static String EditStyle_OpenStyleDialog;
+       public static String FontChooser_DefaultFont;
+       public static String FontChooser_Bold;
+       public static String FontChooser_Italic;
+       public static String FontChooser_KeepCurrentFont;
+       public static String FontChooser_Size;
+       public static String MetricsEditor_AddFormatTemplate;
+       public static String MetricsEditor_AddFormatTemplateTT;
+       public static String MetricsEditor_Format;
+       public static String MetricsEditor_FormatError;
+       public static String MetricsEditor_FormatName;
+       public static String MetricsEditor_FormatPattern;
+       public static String MetricsEditor_FormatPatternNotCorrect;
+       public static String MetricsEditor_Name;
+       public static String MetricsEditor_NewFormat;
+       public static String MetricsEditor_NewFormatField;
+       public static String MetricsEditor_NewFormatTT;
+       public static String MetricsEditor_Numbers;
+       public static String MetricsEditor_RemoveTemplate;
+       public static String MetricsEditor_RemoveTemplateTT;
+       public static String MetricsEditor_UpdateTemplate;
+       public static String MetricsEditor_UpdateTemplateTT;
+       public static String MetricsEditor_Value;
+       public static String MetricsEditor_ValuePresentation;
+       public static String MetricsEditor_ValueTest;
+       public static String MetricsEditor_ValueTestNotANumber;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index ca9ca5fe140bad1b3efbd1c3b3fa5453a8814497..19dae4057e293bb82c4432bcc5956f159f6e745c 100644 (file)
@@ -21,6 +21,7 @@ import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;
 import javax.swing.table.TableModel;
 
+import org.eclipse.osgi.util.NLS;
 import org.simantics.utils.strings.format.MetricsFormat;
 import org.simantics.utils.strings.format.MetricsFormatList;
 import org.simantics.utils.strings.format.MetricsFormatListListener;
@@ -60,13 +61,13 @@ public class MetricsEditor extends JPanel {
         panel.add(fieldPanel,BorderLayout.CENTER);
 
 
-        labelPanel.add(new JLabel("Value test:"));
+        labelPanel.add(new JLabel(Messages.MetricsEditor_ValueTest));
         fieldPanel.add(valueTestField);
-        labelPanel.add(new JLabel("Value presentation:"));
+        labelPanel.add(new JLabel(Messages.MetricsEditor_ValuePresentation));
         fieldPanel.add(valuePresentationField);
-        labelPanel.add(new JLabel("Format name:"));
+        labelPanel.add(new JLabel(Messages.MetricsEditor_FormatName));
         fieldPanel.add(formatNameField);
-        labelPanel.add(new JLabel("Format pattern:"));
+        labelPanel.add(new JLabel(Messages.MetricsEditor_FormatPattern));
         fieldPanel.add(formatPatternField);
 
         add(panel,BorderLayout.NORTH);
@@ -85,8 +86,8 @@ public class MetricsEditor extends JPanel {
         add(controlPanel,BorderLayout.SOUTH);
         controlPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
 
-        JButton addTemplateButton = new JButton("Add Format Template");
-        addTemplateButton.setToolTipText("Add current format to templates");
+        JButton addTemplateButton = new JButton(Messages.MetricsEditor_AddFormatTemplate);
+        addTemplateButton.setToolTipText(Messages.MetricsEditor_AddFormatTemplateTT);
         controlPanel.add(addTemplateButton);
         addTemplateButton.addActionListener(new ActionListener() {
 
@@ -96,8 +97,8 @@ public class MetricsEditor extends JPanel {
             }
         });
 
-        JButton removeTemplateButton = new JButton("Remove Template");
-        removeTemplateButton.setToolTipText("Remove selected template");
+        JButton removeTemplateButton = new JButton(Messages.MetricsEditor_RemoveTemplate);
+        removeTemplateButton.setToolTipText(Messages.MetricsEditor_RemoveTemplateTT);
         controlPanel.add(removeTemplateButton);
         removeTemplateButton.addActionListener(new ActionListener() {
 
@@ -107,8 +108,8 @@ public class MetricsEditor extends JPanel {
             }
         });
 
-        JButton updateTemplateButton = new JButton("Update Template");
-        updateTemplateButton.setToolTipText("Update selected template using current format");
+        JButton updateTemplateButton = new JButton(Messages.MetricsEditor_UpdateTemplate);
+        updateTemplateButton.setToolTipText(Messages.MetricsEditor_UpdateTemplateTT);
         controlPanel.add(updateTemplateButton);
         updateTemplateButton.addActionListener(new ActionListener() {
 
@@ -118,8 +119,8 @@ public class MetricsEditor extends JPanel {
             }
         });
 
-        JButton newFormatButton = new JButton("New Format");
-        newFormatButton.setToolTipText("Create a new Format");
+        JButton newFormatButton = new JButton(Messages.MetricsEditor_NewFormat);
+        newFormatButton.setToolTipText(Messages.MetricsEditor_NewFormatTT);
         controlPanel.add(newFormatButton);
         newFormatButton.addActionListener(new ActionListener() {
 
@@ -144,8 +145,8 @@ public class MetricsEditor extends JPanel {
         valueTestField.addActionListener(l);
         formatPatternField.addActionListener(l);
 
-        valueTestField.setText("123456.789");
-        formatPatternField.setText("%s");
+        valueTestField.setText(Messages.MetricsEditor_Numbers);
+        formatPatternField.setText("%s"); //$NON-NLS-1$
 
         updateValues();
     }
@@ -189,8 +190,8 @@ public class MetricsEditor extends JPanel {
 
     private void newFormat() {
         format = null;
-        formatNameField.setText("New format");
-        formatPatternField.setText("%s");
+        formatNameField.setText(Messages.MetricsEditor_NewFormatField);
+        formatPatternField.setText("%s"); //$NON-NLS-1$
         updateValues();
     }
 
@@ -227,7 +228,7 @@ public class MetricsEditor extends JPanel {
         try {
             d = Double.parseDouble(value);
         } catch (NumberFormatException e) {
-            valuePresentationField.setText("Value test is not a number");
+            valuePresentationField.setText(Messages.MetricsEditor_ValueTestNotANumber);
             return;
         }
         formatValue = d;
@@ -236,7 +237,7 @@ public class MetricsEditor extends JPanel {
         try {
             format = createMetricsFormatFromFields();
         } catch (Exception e) {
-            valuePresentationField.setText("Format pattern is not correct " + e.getMessage());
+            valuePresentationField.setText(NLS.bind(Messages.MetricsEditor_FormatPatternNotCorrect, e.getMessage()));
         }
         if (format == null)
             return; // TODO : show error
@@ -255,7 +256,7 @@ public class MetricsEditor extends JPanel {
         try {
             valuePresentationField.setText(format.formatValue(formatValue));
         } catch (Exception e) {
-            valuePresentationField.setText("Format error: "  + e.getMessage());
+            valuePresentationField.setText(NLS.bind(Messages.MetricsEditor_FormatError, e.getMessage()));
         }
         formatNameField.setText(format.getName());
         formatPatternField.setText(format.getPattern());
@@ -267,7 +268,7 @@ public class MetricsEditor extends JPanel {
 
     private class MetricsTableModel implements TableModel, MetricsFormatListListener {
 
-        private String[] columnNames = {"Name","Format","Value"};
+        private String[] columnNames = {Messages.MetricsEditor_Name,Messages.MetricsEditor_Format,Messages.MetricsEditor_Value};
         private MetricsFormatList formatList;
         private double formatValue = 0;
 
@@ -301,7 +302,7 @@ public class MetricsEditor extends JPanel {
             } else if (columnIndex == 2) {
                 return format.formatValue(formatValue);
             }
-            throw new IndexOutOfBoundsException("There is no column " + columnIndex);
+            throw new IndexOutOfBoundsException("There is no column " + columnIndex); //$NON-NLS-1$
         }
 
         @Override
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/messages.properties
new file mode 100644 (file)
index 0000000..c15f64f
--- /dev/null
@@ -0,0 +1,32 @@
+AWTStyleDialog_Color=Color
+AWTStyleDialog_Font=Font
+AWTStyleDialog_Metrics=Metrics
+AWTStyleDialog_SampleText=Sample text
+AWTStyleDialog_Style=Style
+EditStyle_MonitorOpenDialog=Open dialog
+EditStyle_OpenStyleDialog=Open Style Dialog
+FontChooser_DefaultFont=Arial
+FontChooser_Bold=Bold
+FontChooser_Italic=Italic
+FontChooser_KeepCurrentFont=-- keep current font --
+FontChooser_Size=Size: 
+MetricsEditor_AddFormatTemplate=Add Format Template
+MetricsEditor_AddFormatTemplateTT=Add current format to templates
+MetricsEditor_Format=Format
+MetricsEditor_FormatError=Format error: {}
+MetricsEditor_FormatName=Format name:
+MetricsEditor_FormatPattern=Format pattern:
+MetricsEditor_FormatPatternNotCorrect=Format pattern is not correct {0}
+MetricsEditor_Name=Name
+MetricsEditor_NewFormat=New Format
+MetricsEditor_NewFormatField=New format
+MetricsEditor_NewFormatTT=Create a new Format
+MetricsEditor_Numbers=123456.789
+MetricsEditor_RemoveTemplate=Remove Template
+MetricsEditor_RemoveTemplateTT=Remove selected template
+MetricsEditor_UpdateTemplate=Update Template
+MetricsEditor_UpdateTemplateTT=Update selected template using current format
+MetricsEditor_Value=Value
+MetricsEditor_ValuePresentation=Value presentation:
+MetricsEditor_ValueTest=Value test:
+MetricsEditor_ValueTestNotANumber=Value test is not a number
index c805087d4c1560f107bb4a609db6ee15b22c4d74..9ef7a33e79b3e1246528f484d2fdba8497d2b099 100644 (file)
@@ -60,7 +60,7 @@ public class ChartComposite extends ConfigurationComposite {
             public String perform(ReadGraph graph) throws DatabaseException {
                 Resource r = ResourceAdaptionUtils.toSingleResource(selection);
                 if (r == null)
-                    return "Selection";
+                    return "Selection"; //$NON-NLS-1$
                 return NameLabelUtil.modalName(graph, r);
             }
         };
@@ -93,7 +93,7 @@ public class ChartComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(nameText.getWidget());
 */
         Label autoscrollLabel = new Label(body, support, 0);
-        autoscrollLabel.setText("Auto-scroll settings:");
+        autoscrollLabel.setText(Messages.ChartComposite_AutoScrollSettings);
         autoscrollLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(autoscrollLabel.getControl());
         
@@ -103,7 +103,7 @@ public class ChartComposite extends ConfigurationComposite {
         GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(3).extendedMargins(5,5,5,5).applyTo(templateComposite);
 
         Label templateHeader = new Label(templateComposite, support, 0);
-        templateHeader.setText("Template");
+        templateHeader.setText(Messages.ChartComposite_Template);
         //templateHeader.setFont(smallFont);
         templateHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(templateHeader.getWidget());
@@ -115,7 +115,7 @@ public class ChartComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(templateCombo.getWidget());
 
         Button resetButton = new Button(templateComposite, support, SWT.NONE | SWT.READ_ONLY);
-        resetButton.setText("Apply");
+        resetButton.setText(Messages.ChartComposite_Apply);
         resetButton.addSelectionListener(new SelectionListenerImpl<Resource>(context) {
             @Override
             public void apply(WriteGraph graph, Resource monitor) throws DatabaseException {
@@ -137,13 +137,13 @@ public class ChartComposite extends ConfigurationComposite {
         GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).extendedMargins(5,5,5,5).applyTo(buttonComposite);
 
         Label startHeader = new Label(buttonComposite, support, 0);
-        startHeader.setText("Start time");
+        startHeader.setText(Messages.ChartComposite_StartTime);
         //startHeader.setFont(smallFont);
         startHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(startHeader.getWidget());
 
         TrackedText timeWindowStart = new TrackedText(buttonComposite, support, SWT.BORDER | SWT.FLAT);
-        timeWindowStart.getWidget().setToolTipText("Chart Window Fixed Start Time in Seconds or Yy Dd HH:mm:ss.ddd");
+        timeWindowStart.getWidget().setToolTipText(Messages.ChartComposite_ChartWindowTT);
         timeWindowStart.setTextFactory(new TimePropertyFactory(ChartResource.URIs.Chart_TimeWindowStart));
         timeWindowStart.addModifyListener(new TimePropertyModifier(context, ChartResource.URIs.Chart_TimeWindowStart, START_VALIDATOR));
         timeWindowStart.setInputValidator( START_VALIDATOR );
@@ -154,13 +154,13 @@ public class ChartComposite extends ConfigurationComposite {
 //        l1.setText("seconds");
 
         Label sizeHeader = new Label(buttonComposite, support, 0);
-        sizeHeader.setText("Length");
+        sizeHeader.setText(Messages.ChartComposite_Length);
         //sizeHeader.setFont(smallFont);
         sizeHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(sizeHeader.getWidget());
 
         TrackedText timeWindowLength = new TrackedText(buttonComposite, support, SWT.BORDER | SWT.FLAT);
-        timeWindowLength.getWidget().setToolTipText("Chart Window Fixed Time Axis Length in Seconds or Yy Dd HH:mm:ss.ddd");
+        timeWindowLength.getWidget().setToolTipText(Messages.ChartComposite_ChartWindowTT2);
         timeWindowLength.setTextFactory(new TimePropertyFactory(ChartResource.URIs.Chart_TimeWindowLength));
         timeWindowLength.addModifyListener(new TimePropertyModifier(context, ChartResource.URIs.Chart_TimeWindowLength, LENGTH_VALIDATOR));
         timeWindowLength.setInputValidator( LENGTH_VALIDATOR );
@@ -171,7 +171,7 @@ public class ChartComposite extends ConfigurationComposite {
 //        l2.setText("seconds");
 
         Label incrementHeader = new Label(buttonComposite, support, 0);
-        incrementHeader.setText("Scroll increment");
+        incrementHeader.setText(Messages.ChartComposite_ScrollIncrement);
         //incrementHeader.setFont(smallFont);
         incrementHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(incrementHeader.getWidget());
@@ -197,7 +197,7 @@ public class ChartComposite extends ConfigurationComposite {
                 try {
                     Double d = Double.parseDouble(newText);
                     if (d < 1 || d > 100)
-                        return "Increment must be between 1..100";
+                        return Messages.ChartComposite_ScrollIncrementRange;
                     return null;
                 } catch (NumberFormatException e) {
                     return e.getMessage();
@@ -208,7 +208,7 @@ public class ChartComposite extends ConfigurationComposite {
 
         Label l3 = new Label(buttonComposite, support, 0);
         l3.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
-        l3.setText("%");
+        l3.setText("%"); //$NON-NLS-1$
 
         Composite checkboxComposite = new Composite(buttonComposite, SWT.NONE);
         checkboxComposite.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
@@ -217,7 +217,7 @@ public class ChartComposite extends ConfigurationComposite {
 
         final Button showMilestones = new Button(checkboxComposite, support, SWT.CHECK);
         showMilestones.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
-        showMilestones.setText("Show &Milestones");
+        showMilestones.setText(Messages.ChartComposite_ShowMileStones);
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(showMilestones.getWidget());
         showMilestones.setSelectionFactory(new BooleanPropertyFactory(ChartResource.URIs.Chart_ShowMilestones));
         showMilestones.addSelectionListener(new SelectionAdapter() {
@@ -238,15 +238,15 @@ public class ChartComposite extends ConfigurationComposite {
                 } catch (DatabaseException e1) {
                     Activator.getDefault().getLog().log(
                             new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                                    "Failed to set Show Milestones", e1));
+                                    Messages.ChartComposite_ActivatorFailedToSetShowMilestones, e1));
                 }
             }
         });
 
         final Button trackExperimentTime = new Button(checkboxComposite, support, SWT.CHECK);
         trackExperimentTime.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
-        trackExperimentTime.setText("Hairline &Tracks Experiment Time");
-        trackExperimentTime.setTooltipText("Value Tip Hairline Tracks Experiment Time During Simulation");
+        trackExperimentTime.setText(Messages.ChartComposite_HairlineAndTracksExperimentTime);
+        trackExperimentTime.setTooltipText(Messages.ChartComposite_HairlineAndTracksExperimentTimeTT);
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(trackExperimentTime.getWidget());
         trackExperimentTime.setSelectionFactory(new BooleanPropertyFactory(ChartResource.URIs.Chart_trackExperimentTime));
         trackExperimentTime.addSelectionListener(new SelectionAdapter() {
@@ -267,7 +267,7 @@ public class ChartComposite extends ConfigurationComposite {
                 } catch (DatabaseException e1) {
                     Activator.getDefault().getLog().log(
                             new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                                    "Failed to set Track Experiment Time", e1));
+                                    Messages.ChartComposite_ActivatorFailedTrackExperimentTime, e1));
                 }
             }
         });
index bbf30a1643277234e40eb37c16f0f79269fe5d47..1015c3c6f8bb20e4ad7b748089874f103cf202e1 100644 (file)
@@ -36,7 +36,7 @@ public class DoublePropertyFactory extends ReadFactoryImpl<Resource, String> {
     @Override
     public String perform(ReadGraph graph, Resource r) throws DatabaseException {
         Double value = graph.getPossibleRelatedAdapter(r, graph.getResource(propertyURI), Double.class);
-        return value != null ? value.toString() : "";
+        return value != null ? value.toString() : ""; //$NON-NLS-1$
     }
 
 }
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/Messages.java
new file mode 100644 (file)
index 0000000..3fbf127
--- /dev/null
@@ -0,0 +1,29 @@
+package org.simantics.modeling.ui.chart.property;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.chart.property.messages"; //$NON-NLS-1$
+       public static String ChartComposite_ActivatorFailedToSetShowMilestones;
+       public static String ChartComposite_ActivatorFailedTrackExperimentTime;
+       public static String ChartComposite_Apply;
+       public static String ChartComposite_AutoScrollSettings;
+       public static String ChartComposite_ChartWindowTT;
+       public static String ChartComposite_ChartWindowTT2;
+       public static String ChartComposite_HairlineAndTracksExperimentTime;
+       public static String ChartComposite_HairlineAndTracksExperimentTimeTT;
+       public static String ChartComposite_Length;
+       public static String ChartComposite_ScrollIncrement;
+       public static String ChartComposite_ScrollIncrementRange;
+       public static String ChartComposite_ShowMileStones;
+       public static String ChartComposite_StartTime;
+       public static String ChartComposite_Template;
+       public static String TimeInputValidator_ValueRange;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 36349f96dc0e00c00a5812d2be3c7c3d52e9a58d..6347d00903bfb2bf775c4563c4b812ec0b529930 100644 (file)
@@ -27,7 +27,7 @@ public class ObtainedDoubleStringAdapter extends SimpleContextualAdapter<String,
     @Override
     public String adapt(ReadGraph graph, Resource source, RelationContext context) throws DatabaseException {
         Double value = ADAPTER.adapt(graph, source, context);
-        return value != null ? value.toString() : "";
+        return value != null ? value.toString() : ""; //$NON-NLS-1$
     }
 
 }
index dd7bf1f8a7255e2e193986f58e74b401ce04aacd..d8d48ca2ca5fad9319a34a8521564e5576a814ef 100644 (file)
@@ -16,6 +16,7 @@ import java.text.Format;
 import java.text.ParseException;
 
 import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.utils.format.TimeFormat;
 
 /**
@@ -23,7 +24,7 @@ import org.simantics.utils.format.TimeFormat;
  */
 public class TimeInputValidator implements IInputValidator {
        
-       Format decimalFormat = new DecimalFormat("0");
+       Format decimalFormat = new DecimalFormat("0"); //$NON-NLS-1$
 
        Format timeFormat = new TimeFormat(100, 0);
        
@@ -36,7 +37,7 @@ public class TimeInputValidator implements IInputValidator {
        public Double parse(String text) {
                if (text==null) return null;
                text = text.trim();
-               if (text.equals("")) return null;
+               if (text.equals("")) return null; //$NON-NLS-1$
 
                try {
                        return (Double) timeFormat.parseObject(text);
@@ -55,26 +56,28 @@ public class TimeInputValidator implements IInputValidator {
 
        @Override
        public String isValid(String text) {
-               if (text==null) return "Null";
+               if (text == null)
+                       return "Null"; //$NON-NLS-1$
                text = text.trim();
-               if (text.equals("")) return null;
+               if (text.equals("")) //$NON-NLS-1$
+                       return null;
 
                try {
                        Double d = (Double) timeFormat.parseObject(text);
-                       
-                       if (d != null && d.doubleValue()<minValue)
-                               return "The value must be at least "+minValue+" seconds.";
+
+                       if (d != null && d.doubleValue() < minValue)
+                               return NLS.bind(Messages.TimeInputValidator_ValueRange, minValue);
                        return null;
                } catch (ParseException e) {
                }
-               
+
                try {
                        Number n = (Number) decimalFormat.parseObject(text);
-                       if (n != null && n.doubleValue()<minValue)
-                               return "The value must be at least "+minValue+" seconds.";
+                       if (n != null && n.doubleValue() < minValue)
+                               return NLS.bind(Messages.TimeInputValidator_ValueRange, minValue); 
                        return null;
                } catch (ParseException e) {
-                       return "Unable to parse specified value as a measure of time.";
+                       return "Unable to parse specified value as a measure of time."; //$NON-NLS-1$
                }
        }
        
index 270f82d383c0500e9c858cc38cf3d970807588b6..597d7c6d3b776d6f2a0d39b01b205f4d0c8d01df 100644 (file)
@@ -39,7 +39,7 @@ public class TimePropertyFactory extends ReadFactoryImpl<Resource, String> {
     @Override
     public String perform(ReadGraph graph, Resource r) throws DatabaseException {
         Double value = graph.getPossibleRelatedAdapter(r, graph.getResource(propertyURI), Double.class);
-        if (value == null) return "";
+        if (value == null) return ""; //$NON-NLS-1$
        Format timeFormat = new TimeFormat(100, 3);
         return timeFormat.format(value);
     }
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/messages.properties
new file mode 100644 (file)
index 0000000..d4efd5c
--- /dev/null
@@ -0,0 +1,15 @@
+ChartComposite_ActivatorFailedToSetShowMilestones=Failed to set Show Milestones\r
+ChartComposite_ActivatorFailedTrackExperimentTime=Failed to set Track Experiment Time\r
+ChartComposite_Apply=Apply\r
+ChartComposite_AutoScrollSettings=Auto-scroll settings:\r
+ChartComposite_ChartWindowTT=Chart Window Fixed Start Time in Seconds or Yy Dd HH:mm:ss.ddd\r
+ChartComposite_ChartWindowTT2=Chart Window Fixed Time Axis Length in Seconds or Yy Dd HH:mm:ss.ddd\r
+ChartComposite_HairlineAndTracksExperimentTime=Hairline &Tracks Experiment Time\r
+ChartComposite_HairlineAndTracksExperimentTimeTT=Value Tip Hairline Tracks Experiment Time During Simulation\r
+ChartComposite_Length=Length\r
+ChartComposite_ScrollIncrement=Scroll increment\r
+ChartComposite_ScrollIncrementRange=Increment must be between 1..100\r
+ChartComposite_ShowMileStones=Show &Milestones\r
+ChartComposite_StartTime=Start time\r
+ChartComposite_Template=Template\r
+TimeInputValidator_ValueRange=The value must be at least {0} seconds.\r
index 74e5e7c676cfb5bb69340e54ae25813ff20008cb..56b5d895b3b02d04e9ecb01ab7e1aea7bfd66d25 100644 (file)
@@ -23,16 +23,16 @@ import org.simantics.ui.workbench.ResourceEditorPart;
 public class ComponentTypeEditor extends ResourceEditorPart implements IExecutableExtension {
 
     protected ComponentTypeViewer viewer;
-    protected String formTitle = "User Component Interface";
+    protected String formTitle = Messages.ComponentTypeEditor_UserComponentInterface;
 
     @Override
     public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
         if (data instanceof String) {
-            String[] params = ((String) data).split(";");
+            String[] params = ((String) data).split(";"); //$NON-NLS-1$
             for (String param : params) {
-                String[] keyValue = param.split("=");
+                String[] keyValue = param.split("="); //$NON-NLS-1$
                 if (keyValue.length == 2) {
-                    if ("formTitle".equals(keyValue[0])) {
+                    if ("formTitle".equals(keyValue[0])) { //$NON-NLS-1$
                         formTitle = keyValue[1];
                     }
                 }
index 0425ac149b81187a6ea64913b829506ad2c42cb5..57d0aa69a6bbfdd30e4905aabcb992fb571b9097 100644 (file)
@@ -62,7 +62,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide
                     Resource owner = graph.getPossibleObject(resource, STR.ComponentType_hasScript_Inverse);
                     immutable = owner != null && StructuralUtils.isImmutable(graph, owner);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -91,7 +91,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide
                 synchronized(annotationModel.getLockObject()) {
                     annotationModel.removeAllAnnotations();
                     for(CompilationError error : result.getErrors()) {
-                        Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, error.description);
+                        Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, error.description); //$NON-NLS-1$
                         int begin = Locations.beginOf(error.location);
                         int end = Locations.endOf(error.location);
                         Position position = new Position(begin, end - begin);
@@ -115,7 +115,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument");
+        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
index cbad48af48bfac990542f6bc8c7cf6dd08ae88e5..c3152692d097dc91f26407cf8e28f00102d3eaf3 100644 (file)
@@ -91,7 +91,7 @@ public class ComponentTypeScriptEditor extends SCLModuleEditor {
                             String name = graph.getRelatedValue(script, L0.HasName);
                             Resource componentType = graph.getSingleObject(script, STR.ComponentType_hasScript_Inverse);
                             String ctName = graph.getRelatedValue(componentType, L0.HasName);
-                            return ctName + " " + name;
+                            return ctName + " " + name; //$NON-NLS-1$
                         }
                         
                     },
@@ -103,17 +103,17 @@ public class ComponentTypeScriptEditor extends SCLModuleEditor {
     }
     
     private static final String[] EXECUTION_PHASES = new String[] {
-        "step",
-        "analogAutomation",
-        "binaryAutomation",
-        "preparation"
+        "step", //$NON-NLS-1$
+        "analogAutomation", //$NON-NLS-1$
+        "binaryAutomation", //$NON-NLS-1$
+        "preparation" //$NON-NLS-1$
     };
     
     private static final String[] EXECUTION_PHASE_LABELS = new String[] {
-        "Execute at each step",
-        "Execute together with analog automation",
-        "Execute together with binary automation",
-        "Execute during preparation"
+        Messages.ComponentTypeScriptEditor_ExecuteAtEachStep,
+        Messages.ComponentTypeScriptEditor_ExecuteAnalogAutomation,
+        Messages.ComponentTypeScriptEditor_ExecuteBinaryAutomation,
+        Messages.ComponentTypeScriptEditor_ExecuteDuringPreparation
     };
     
     @Override
index 7d256ba00e2dca5941e632a990105b02daee3d1d..75c60d24cd28d27190c382fba285def14f1f46a6 100644 (file)
@@ -185,22 +185,22 @@ public class ComponentTypeViewer {
                         String type =  graph.getPossibleRelatedValue(relation, L0.RequiresValueType);
                         String label = graph.getPossibleRelatedValue(relation, L0.HasLabel);
                         if (label == null)
-                            label = "";
+                            label = ""; //$NON-NLS-1$
                         String description = graph.getPossibleRelatedValue(relation, L0.HasDescription);
                         if (description == null)
-                            description = "";
+                            description = ""; //$NON-NLS-1$
                         NumberType numberType = null;
                         if(type == null)
-                            type = "Double";
+                            type = "Double"; //$NON-NLS-1$
                         String unit = graph.getPossibleRelatedValue(relation, L0X.HasUnit, Bindings.STRING);
-                        String defaultValue = "0";
+                        String defaultValue = "0"; //$NON-NLS-1$
                         String expression = null;
                         
                         for(Resource assertion : graph.getAssertedObjects(data.componentType, relation)) {
                             try {
                                 expression = graph.getPossibleRelatedValue(assertion, L0.SCLValue_expression, Bindings.STRING);
                                 if(expression != null) {
-                                       defaultValue = "=" + expression;
+                                       defaultValue = "=" + expression; //$NON-NLS-1$
                                 } else {
                                        Datatype dt = getPossibleDatatype(graph, assertion);
                                        if (dt == null)
@@ -306,9 +306,9 @@ public class ComponentTypeViewer {
             section.setReadOnly(readOnly);
         IMessageManager mm = data.form.getMessageManager();
         if (readOnly)
-            mm.addMessage("readonly", "(Opened in read-only mode)", null, IMessageProvider.INFORMATION);
+            mm.addMessage("readonly", Messages.ComponentTypeViewer_OpenedInReadOnly, null, IMessageProvider.INFORMATION); //$NON-NLS-1$
         else
-            mm.removeMessage("readonly");
+            mm.removeMessage("readonly"); //$NON-NLS-1$
     }
 
 }
index b64380b285d7b76593060b2e40a6a7d09f502b8f..048e0840eaa55f07a79da6f82f6620d15b06957d 100644 (file)
@@ -6,9 +6,11 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.IMessageProvider;
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
 import org.eclipse.swt.custom.TableEditor;
@@ -52,29 +54,29 @@ public class ComponentTypeViewerData {
      * Used to validate property names.
      */
     public static final Pattern PROPERTY_NAME_PATTERN =
-            Pattern.compile("([a-z]|_[0-9a-zA-Z_])[0-9a-zA-Z_]*");
+            Pattern.compile("([a-z]|_[0-9a-zA-Z_])[0-9a-zA-Z_]*"); //$NON-NLS-1$
 
     public static final String[] PROPERTY_TYPE_SUGGESTIONS = new String[] {
-        "Double",
-        "Integer",
-        "Float",
-        "String",
-        "Boolean",
-        "Long",
-        "[Double]",
-        "[Integer]",
-        "[Float]",
-        "[String]",
-        "[Boolean]",
-        "[Long]",
-        "Vector Double",
-        "Vector Integer",
-        "Vector Float",
-        "Vector String",
-        "Vector Boolean",
-        "Vector Long"        
+        "Double", //$NON-NLS-1$
+        "Integer", //$NON-NLS-1$
+        "Float", //$NON-NLS-1$
+        "String", //$NON-NLS-1$
+        "Boolean", //$NON-NLS-1$
+        "Long", //$NON-NLS-1$
+        "[Double]", //$NON-NLS-1$
+        "[Integer]", //$NON-NLS-1$
+        "[Float]", //$NON-NLS-1$
+        "[String]", //$NON-NLS-1$
+        "[Boolean]", //$NON-NLS-1$
+        "[Long]", //$NON-NLS-1$
+        "Vector Double", //$NON-NLS-1$
+        "Vector Integer", //$NON-NLS-1$
+        "Vector Float", //$NON-NLS-1$
+        "Vector String", //$NON-NLS-1$
+        "Vector Boolean", //$NON-NLS-1$
+        "Vector Long" //$NON-NLS-1$
     };
-    
+
     public Resource componentType;
     public FormToolkit tk;
     public Form form;
@@ -180,7 +182,7 @@ public class ComponentTypeViewerData {
                         graph.markUndoPoint();
                         Layer0 L0 = Layer0.getInstance(graph);
                         String prevName = graph.getPossibleRelatedValue2(propertyInfo.resource, L0.HasName);
-                        String oldCamelCasedLabel = prevName != null ? ComponentTypeCommands.camelCaseNameToLabel(prevName) : "";
+                        String oldCamelCasedLabel = prevName != null ? ComponentTypeCommands.camelCaseNameToLabel(prevName) : ""; //$NON-NLS-1$
                         String oldLabel = graph.getPossibleRelatedValue(propertyInfo.resource, L0.HasLabel);
                         boolean setLabel = oldLabel == null
                                 || oldLabel.isEmpty()
@@ -391,7 +393,7 @@ public class ComponentTypeViewerData {
 
     private Range parseRange(NumberType numberType, String minStr, String maxStr, boolean lowInclusive, boolean highInclusive) throws RangeException {
         try {
-            String rangeStr = (lowInclusive ? "[" : "(")  + minStr + ".." + maxStr + (highInclusive ? "]" : ")");
+            String rangeStr = (lowInclusive ? "[" : "(")  + minStr + ".." + maxStr + (highInclusive ? "]" : ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
             return Range.valueOf(rangeStr);
         } catch (IllegalArgumentException e) {
             // Limits are invalid
@@ -401,8 +403,8 @@ public class ComponentTypeViewerData {
     
     private static Combo createRangeInclusionCombo(Composite parent, boolean inclusive) {
         Combo rng = new Combo(parent, SWT.READ_ONLY);
-        rng.add("Inclusive");
-        rng.add("Exclusive");
+        rng.add(Messages.ComponentTypeViewerData_Inclusive);
+        rng.add(Messages.ComponentTypeViewerData_Exclusive);
         rng.select(inclusive ? 0 : 1);
         return rng;
     }
@@ -431,12 +433,12 @@ public class ComponentTypeViewerData {
         GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite);
 
         Label low = new Label(composite, SWT.NONE);
-        low.setText("Minimum Value:");
+        low.setText(Messages.ComponentTypeViewerData_MinimumValue);
         final Text lowText = new Text(composite, SWT.BORDER | extraTextStyle);
         GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).applyTo(lowText);
         final Combo lowSelector = createRangeInclusionCombo(composite, !range.getLower().isExclusive());
         Label high = new Label(composite, SWT.NONE);
-        high.setText("Maximum Value:");
+        high.setText(Messages.ComponentTypeViewerData_MaximumValue);
         final Text highText = new Text(composite, SWT.BORDER | extraTextStyle);
         GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).applyTo(highText);
         final Combo highSelector = createRangeInclusionCombo(composite, !range.getUpper().isExclusive());
@@ -446,10 +448,10 @@ public class ComponentTypeViewerData {
         GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).applyTo(buttonComposite);
 
         Button ok = new Button(buttonComposite, SWT.NONE);
-        ok.setText("&OK");
+        ok.setText(IDialogConstants.OK_LABEL);
         GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(ok);
         Button cancel = new Button(buttonComposite, SWT.NONE);
-        cancel.setText("&Cancel");
+        cancel.setText(IDialogConstants.CANCEL_LABEL);
         GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(ok);
 
         if (range.getLower().getValue() != null)
@@ -565,10 +567,10 @@ public class ComponentTypeViewerData {
             }
         };
 
-        String helpText = propertyInfo.immutable ? "ESC to close." : "Ctrl+Enter to apply changes, ESC to cancel.";
+        String helpText = propertyInfo.immutable ? Messages.ComponentTypeViewerData_ESCToClose : Messages.ComponentTypeViewerData_CtrlEnterApplyChanges;
         Label help = tk.createLabel(shell, helpText, SWT.BORDER | SWT.FLAT);
         GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(help);
-        help.setForeground( tk.getColors().createColor( "fg", tk.getColors().getSystemColor(SWT.COLOR_LIST_SELECTION) ) );
+        help.setForeground( tk.getColors().createColor( "fg", tk.getColors().getSystemColor(SWT.COLOR_LIST_SELECTION) ) ); //$NON-NLS-1$
 
         Display display = table.getDisplay();
         Rectangle clientArea = display.getClientArea();
@@ -599,16 +601,15 @@ public class ComponentTypeViewerData {
             return null;
         for (ComponentTypeViewerPropertyInfo info : properties) {
             if (propertyName.equals(info.name))
-                return "Property name '" + propertyName + "' is already in use.";
+                return NLS.bind(Messages.ComponentTypeViewerData_PropertyNameInUse, propertyName); 
         }
         for (NamedResource cp : connectionPoints) {
             if (propertyName.equals(cp.getName()))
-                return "Name '" + propertyName + "' is already used for a terminal.";
+                return NLS.bind(Messages.ComponentTypeViewerData_NameInUse, propertyName ); 
         }
         Matcher m = namePattern.matcher(propertyName);
         if (!m.matches())
-            return "Property name '" + propertyName + "' contains invalid characters, does not match pattern "
-                    + namePattern.pattern() + ".";
+            return NLS.bind(Messages.ComponentTypeViewerData_ContainsInvalidCharacters, propertyName, namePattern.pattern());
         return null;
     }
 
index e919aa71f00d01a8fa27b926a022aef077609e38..34d26e4915e387ca0d04266be246ede57d1081cd 100644 (file)
@@ -68,9 +68,16 @@ import org.slf4j.LoggerFactory;
 public class ConfigurationPropertiesSection implements ComponentTypeViewerSection {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationPropertiesSection.class);
-    
-    private static final String[] COLUMN_NAMES = 
-            new String[] {"Name", "Type", "Default Value", "Unit", "Range", "Label", "Description"};
+
+    private static final String[] COLUMN_NAMES = {
+            Messages.ConfigurationPropertiesSection_Name,
+            Messages.ConfigurationPropertiesSection_Type,
+            Messages.ConfigurationPropertiesSection_DefaultValue,
+            Messages.ConfigurationPropertiesSection_Unit,
+            Messages.ConfigurationPropertiesSection_Range,
+            Messages.ConfigurationPropertiesSection_Label,
+            Messages.ConfigurationPropertiesSection_Description
+    };
     private static final int[] COLUMN_LENGTHS =
             new int[] { 120, 100, 100, 50, 100, 100, 100 };
     private static final int[] COLUMN_WEIGHTS =
@@ -83,8 +90,8 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
      */
     private static final int[] IMMUTABLE_COLUMNS_WITH_IMMUTABLE_RELATION =
         { 0, 1, 3, 4, 5, 6 };
-    
     ComponentTypeViewerData data;
+    
     Table table;
     TableColumn[] columns;
     TableEditor editor;
@@ -104,7 +111,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
         
         section = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
         section.setLayout(new FillLayout());
-        section.setText("Configuration properties");
+        section.setText(Messages.ConfigurationPropertiesSection_ConfigurationProperties);
 
         Composite sectionBody = tk.createComposite(section);
         GridLayoutFactory.fillDefaults().numColumns(2).applyTo(sectionBody);
@@ -228,18 +235,18 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
         GridDataFactory.fillDefaults().applyTo(buttons);
         GridLayoutFactory.fillDefaults().applyTo(buttons);
 
-        newProperty = tk.createButton(buttons, "New property", SWT.PUSH);
+        newProperty = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_NewProperty, SWT.PUSH);
         GridDataFactory.fillDefaults().applyTo(newProperty);
-        removeProperty = tk.createButton(buttons, "Remove property", SWT.PUSH);
+        removeProperty = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_RemoveProperty, SWT.PUSH);
         GridDataFactory.fillDefaults().applyTo(removeProperty);
 
-        liftProperties = tk.createButton(buttons, "Lift Properties", SWT.PUSH);
+        liftProperties = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_LiftProperties, SWT.PUSH);
         GridDataFactory.fillDefaults().applyTo(liftProperties);
 
         hasTypes = !getTypes().isEmpty();
         
         if(hasTypes) {
-            setTypes = tk.createButton(buttons, "Assign Types", SWT.PUSH);
+            setTypes = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_AssignTypes, SWT.PUSH);
             GridDataFactory.fillDefaults().applyTo(setTypes);
         }
 
@@ -287,7 +294,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
                     if (!info.immutable)
                         propertiesToBeRemoved.add(info.resource);
                 }
-                System.out.println("remove " + propertiesToBeRemoved.size() + " resources");
+                //System.out.println("remove " + propertiesToBeRemoved.size() + " resources"); //$NON-NLS-1$ //$NON-NLS-2$
                 if(!propertiesToBeRemoved.isEmpty())
                     Simantics.getSession().async(new WriteRequest() {
                         @Override
@@ -355,7 +362,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
                                         String predicateName = NameUtils.getSafeName(graph, predicate);
                                         if(existing.contains(predicateName)) continue;
                                         
-                                        String name = componentName + " " + predicateName;
+                                        String name = componentName + " " + predicateName; //$NON-NLS-1$
                                         map.put(new LiftedProperty(component, type, predicate), new Pair<String, ImageDescriptor>(name, null));
                                         
                                     }
@@ -370,7 +377,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
                     });
                     
                     Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-                    LiftPropertiesDialog dialog = new LiftPropertiesDialog(shell, map, "Select properties to lift") {
+                    LiftPropertiesDialog dialog = new LiftPropertiesDialog(shell, map, Messages.ConfigurationPropertiesSection_SelectPropertiesToLift) {
                         @Override
                         protected IDialogSettings getBaseDialogSettings() {
                             return Activator.getDefault().getDialogSettings();
@@ -429,13 +436,13 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
                                             graph.claim(data.componentType, L0.DomainOf, copy);
                                             Layer0Utils.assert_(graph, data.componentType, copy, copyAss.iterator().next());
                                             CommentMetadata cm = graph.getMetadata(CommentMetadata.class);
-                                            graph.addMetadata(cm.add("Lifted property " + NameUtils.getSafeName(graph, copy) + " into "+ NameUtils.getSafeName(graph, data.componentType)));
+                                            graph.addMetadata(cm.add("Lifted property " + NameUtils.getSafeName(graph, copy) + " into "+ NameUtils.getSafeName(graph, data.componentType))); //$NON-NLS-1$ //$NON-NLS-2$
                                         }
                                         if(mapProperties) {
                                             Variable v = Variables.getVariable(graph, p.getComponent());
                                             Variable property = v.getProperty(graph, p.getPredicate());
                                             Variable displayValue = property.getProperty(graph, Variables.DISPLAY_VALUE);
-                                            displayValue.setValue(graph, "=" + NameUtils.getSafeName(graph, p.getPredicate()), Bindings.STRING);
+                                            displayValue.setValue(graph, "=" + NameUtils.getSafeName(graph, p.getPredicate()), Bindings.STRING); //$NON-NLS-1$
                                         }
                                         index++;
                                     }
@@ -447,7 +454,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
 
                 } catch (DatabaseException e1) {
                     
-                    LOGGER.error("Lifting properties failed", e1);
+                    LOGGER.error("Lifting properties failed", e1); //$NON-NLS-1$
                     return;
                     
                 }
@@ -470,7 +477,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
                     if(propertiesToSet.size() != 1) return;
 
                     Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-                    SetTypesDialog page = new SetTypesDialog(shell, getTypes(), "Select user types for property");
+                    SetTypesDialog page = new SetTypesDialog(shell, getTypes(), Messages.ConfigurationPropertiesSection_SelectUserTypesForProp);
                     if (page.open() == Window.OK) {
                         final Object[] result = page.getResult();
                         if (result != null && result.length > 0) {
@@ -569,7 +576,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio
                 }
             });
         } catch (DatabaseException e) {
-            LOGGER.error("Finding UserDefinedProperties failed.", e);
+            LOGGER.error("Finding UserDefinedProperties failed.", e); //$NON-NLS-1$
             return Collections.emptyMap();
         }
     }
index 19d9e6f29dc5c0f7e12b8e18844cb1d8999f6561..869d5e32aada675fb56981116fd2eb8ac0961c56 100644 (file)
@@ -42,8 +42,14 @@ import org.simantics.scl.runtime.function.Function4;
 import org.simantics.structural.stubs.StructuralResource2;
 
 public class DerivedPropertiesSection implements ComponentTypeViewerSection {
-    private static final String[] COLUMN_NAMES = 
-            new String[] {"Name", "Type", "Expression", "Unit", "Label", "Description"};
+    private static final String[] COLUMN_NAMES = {
+            Messages.DerivedPropertiesSection_Name,
+            Messages.DerivedPropertiesSection_Type,
+            Messages.DerivedPropertiesSection_Expression,
+            Messages.DerivedPropertiesSection_Unit,
+            Messages.DerivedPropertiesSection_Label,
+            Messages.DerivedPropertiesSection_Description
+    };
     private static final int[] COLUMN_LENGTHS =
             new int[] { 120, 100, 100, 70, 100, 100 };
     private static final int[] COLUMN_WEIGHTS =
@@ -71,7 +77,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
         Form form = data.form;
         section = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
         section.setLayout(new FillLayout());
-        section.setText("Derived properties");
+        section.setText(Messages.DerivedPropertiesSection_DerivedProperties);
 
         Composite sectionBody = tk.createComposite(section);
         GridLayoutFactory.fillDefaults().numColumns(2).applyTo(sectionBody);
@@ -191,9 +197,9 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
         GridDataFactory.fillDefaults().applyTo(buttons);
         GridLayoutFactory.fillDefaults().applyTo(buttons);
 
-        newProperty = tk.createButton(buttons, "New property", SWT.PUSH);
+        newProperty = tk.createButton(buttons, Messages.DerivedPropertiesSection_NewProperty, SWT.PUSH);
         GridDataFactory.fillDefaults().applyTo(newProperty);
-        removeProperty = tk.createButton(buttons, "Remove property", SWT.PUSH);
+        removeProperty = tk.createButton(buttons, Messages.DerivedPropertiesSection_RemoveProperty, SWT.PUSH);
         GridDataFactory.fillDefaults().applyTo(removeProperty);
 
         // Actions
@@ -247,11 +253,11 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
     public static String validateMonitorExpression(final RequestProcessor processor, final Resource componentType, final Resource relation, final String expression) {
 
         if (expression.trim().isEmpty()) {
-            return "Expression is empty.";
+            return Messages.DerivedPropertiesSection_ExpressionIsEmpty;
         }
 
         if (expression.trim().isEmpty()) {
-            return "Expression is empty.";
+            return Messages.DerivedPropertiesSection_ExpressionIsEmpty;
         }
         try {
             return processor.sync(new UniqueRead<String>() {
@@ -282,7 +288,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
                             
                         } catch (Exception e) {
                             String msg = e.getMessage();
-                            int index = msg.indexOf(":");
+                            int index = msg.indexOf(":"); //$NON-NLS-1$
                             if(index > 0) msg = msg.substring(index);
                             return msg;
                         }
@@ -327,7 +333,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
 
             TableItem item = new TableItem(table, SWT.NONE);
 
-            item.setText(0, info.valid != null ? info.name + " (!)" : info.name);
+            item.setText(0, info.valid != null ? info.name + " (!)" : info.name); //$NON-NLS-1$
             item.setText(1, info.type);
             item.setText(2, info.expression);
             item.setText(3, info.unitString());
index c924c12d9ea1e338976692bb1ca82e5c9ff2c916..656e2486fd2d569ec248052301c8b9625978c1cf 100644 (file)
@@ -74,7 +74,7 @@ public class LiftPropertiesDialog extends ResourceSelectionDialog3<LiftedPropert
 //             l.setText("Map lifted properties into interface");
 //             GridDataFactory.fillDefaults().grab(false, false).applyTo(l);
                checkbox = new Button(c, SWT.CHECK);
-               checkbox.setText("Map lifted properties into interface");
+               checkbox.setText(Messages.LiftPropertiesDialog_MapLiftedPropertiesIntoInterface);
                checkbox.addSelectionListener(new SelectionListener() {
                        
                        @Override
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/Messages.java
new file mode 100644 (file)
index 0000000..e84c6ff
--- /dev/null
@@ -0,0 +1,64 @@
+package org.simantics.modeling.ui.componentTypeEditor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.componentTypeEditor.messages"; //$NON-NLS-1$
+       public static String ComponentTypeEditor_UserComponentInterface;
+       public static String ComponentTypeScriptEditor_ExecuteAnalogAutomation;
+       public static String ComponentTypeScriptEditor_ExecuteAtEachStep;
+       public static String ComponentTypeScriptEditor_ExecuteBinaryAutomation;
+       public static String ComponentTypeScriptEditor_ExecuteDuringPreparation;
+       public static String ComponentTypeViewer_OpenedInReadOnly;
+       public static String ComponentTypeViewerData_ContainsInvalidCharacters;
+       public static String ComponentTypeViewerData_CtrlEnterApplyChanges;
+       public static String ComponentTypeViewerData_ESCToClose;
+       public static String ComponentTypeViewerData_Exclusive;
+       public static String ComponentTypeViewerData_Inclusive;
+       public static String ComponentTypeViewerData_MaximumValue;
+       public static String ComponentTypeViewerData_MinimumValue;
+       public static String ComponentTypeViewerData_NameInUse;
+       public static String ComponentTypeViewerData_PropertyNameInUse;
+       public static String ConfigurationPropertiesSection_AssignTypes;
+       public static String ConfigurationPropertiesSection_ConfigurationProperties;
+       public static String ConfigurationPropertiesSection_DefaultValue;
+       public static String ConfigurationPropertiesSection_Description;
+       public static String ConfigurationPropertiesSection_Label;
+       public static String ConfigurationPropertiesSection_LiftProperties;
+       public static String ConfigurationPropertiesSection_Name;
+       public static String ConfigurationPropertiesSection_NewProperty;
+       public static String ConfigurationPropertiesSection_Range;
+       public static String ConfigurationPropertiesSection_RemoveProperty;
+       public static String ConfigurationPropertiesSection_SelectPropertiesToLift;
+       public static String ConfigurationPropertiesSection_SelectUserTypesForProp;
+       public static String ConfigurationPropertiesSection_Type;
+       public static String ConfigurationPropertiesSection_Unit;
+       public static String DerivedPropertiesSection_DerivedProperties;
+       public static String DerivedPropertiesSection_Description;
+       public static String DerivedPropertiesSection_Expression;
+       public static String DerivedPropertiesSection_ExpressionIsEmpty;
+       public static String DerivedPropertiesSection_Label;
+       public static String DerivedPropertiesSection_Name;
+       public static String DerivedPropertiesSection_NewProperty;
+       public static String DerivedPropertiesSection_RemoveProperty;
+       public static String DerivedPropertiesSection_Type;
+       public static String DerivedPropertiesSection_Unit;
+       public static String LiftPropertiesDialog_MapLiftedPropertiesIntoInterface;
+       public static String ProceduralComponentInstanceViewer_CouldnotCreateVariableForResource;
+       public static String ProceduralComponentInstanceViewer_NoProceduralSubstructure;
+       public static String ProceduralComponentInstanceViewerEditorAdapter_ProceduralComponentInstanceViewer;
+       public static String ProceduralComponentTypeCodeDocumentProvider_ActivatorInternalErrorMsg;
+       public static String ProceduralComponentTypeEditorNamingService_UnsupportedInput;
+       public static String SCLModuleEditorAdapter_SCLModuleEditor;
+       public static String SCLModuleViewer_ApplyChanges;
+       public static String SCLModuleViewer_Code;
+       public static String SymbolCodeDocumentProvider2_ActivatorInternalErrorInCodeCompilation;
+       public static String SymbolDropHandlerDocumentProvider_ActivatorInternalError;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index aaf196df946efd8bac8179c8d3d902a03543560d..91c4310d92923a75d1565b52191ec39ed54b7fcb 100644 (file)
@@ -78,7 +78,7 @@ public class PGraphEditor extends TextEditor {
         try {
             getResourceInput().init(null);
         } catch (DatabaseException e) {
-            throw new PartInitException("Failed to initialize " + input, e);
+            throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$
         }
     }
 
index 39152636b0e80aab3d9b18eaa439ce26ca839cf1..e718390b8b6b041154b77b774ed55449b3862b51 100644 (file)
@@ -57,7 +57,7 @@ public class PGraphEditorDocumentProvider extends AbstractDocumentProvider {
                     if(graph.isInstanceOf(resource, L0.PGraph)) {
                         currentText = graph.getRelatedValue(resource, L0.PGraph_definition, Bindings.STRING);
                         errorHappened = false;
-                        return new Document(currentText != null ? currentText : "");
+                        return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                     } else {
                        Resource indexRoot = graph.syncRequest(new PossibleIndexRoot(resource));
                        try {
@@ -67,9 +67,9 @@ public class PGraphEditorDocumentProvider extends AbstractDocumentProvider {
                                    currentText = PrettyPrintTG.print(tg, false);
                                    errorHappened = false;
                                }
-                            return new Document(currentText != null ? currentText : "");
+                            return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                        } catch (Exception e) {
-                               throw new DatabaseException("Could not get PGraph from " + resource);
+                               throw new DatabaseException("Could not get PGraph from " + resource); //$NON-NLS-1$
                        }
                     }
                 }
@@ -96,7 +96,7 @@ public class PGraphEditorDocumentProvider extends AbstractDocumentProvider {
         synchronized(annotationModel.getLockObject()) {
             annotationModel.removeAllAnnotations();
             for(CompilationError error : errors) {
-                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true,
+                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, //$NON-NLS-1$
                         error.description);
                 int begin = Locations.beginOf(error.location);
                 int end = Locations.endOf(error.location);
@@ -121,7 +121,7 @@ public class PGraphEditorDocumentProvider extends AbstractDocumentProvider {
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog("PGraphEditorDocumentProvider.doSaveDocument");
+        TimeLogger.resetTimeAndLog("PGraphEditorDocumentProvider.doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
@@ -129,7 +129,7 @@ public class PGraphEditorDocumentProvider extends AbstractDocumentProvider {
                 graph.markUndoPoint();
                 Layer0 L0 = Layer0.getInstance(graph);
                 graph.claimLiteral(resource, L0.PGraph_definition, currentText, Bindings.STRING);
-                Layer0Utils.addCommentMetadata(graph, "Saved Ontology Definition File " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING));
+                Layer0Utils.addCommentMetadata(graph, "Saved Ontology Definition File " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$
             }
         });
     }
index bad6703b0971c6abdefdb62ae059d6301fa49df7..f61354a7142f271fedeb5a728a7bda2ccc1d84f0 100644 (file)
@@ -58,8 +58,8 @@ public class PGraphSourceViewerConfigurationNew extends SourceViewerConfiguratio
     ITokenScanner getSclTokenScanner() {
         RuleBasedScanner scanner = new RuleBasedScanner();
         
-        Font font = new Font(device, "Courier New", 10, SWT.NORMAL);
-        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD);
+        Font font = new Font(device, "Courier New", 10, SWT.NORMAL); //$NON-NLS-1$
+        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD); //$NON-NLS-1$
 
         Token defaultToken = new Token(
                 new TextAttribute(
@@ -100,20 +100,20 @@ public class PGraphSourceViewerConfigurationNew extends SourceViewerConfiguratio
             }
         });
 
-        reservedWord.addWord("if", reserved);
-        reservedWord.addWord("then", reserved);
-        reservedWord.addWord("else", reserved);
-        reservedWord.addWord("match", reserved);
-        reservedWord.addWord("with", reserved);
-        reservedWord.addWord("data", reserved);
-        reservedWord.addWord("type", reserved);
-        reservedWord.addWord("class", reserved);
+        reservedWord.addWord("if", reserved); //$NON-NLS-1$
+        reservedWord.addWord("then", reserved); //$NON-NLS-1$
+        reservedWord.addWord("else", reserved); //$NON-NLS-1$
+        reservedWord.addWord("match", reserved); //$NON-NLS-1$
+        reservedWord.addWord("with", reserved); //$NON-NLS-1$
+        reservedWord.addWord("data", reserved); //$NON-NLS-1$
+        reservedWord.addWord("type", reserved); //$NON-NLS-1$
+        reservedWord.addWord("class", reserved); //$NON-NLS-1$
         
         IRule[] rules = new IRule[] {
             //new MultiLineRule("\"\"\"", "\"\"\"", string),
-            new PatternRule("\"", "\"", string, '\\', true),
-            new MultiLineRule("/*", "*/", comment),
-            new PatternRule("//", null, comment, '\0', true),
+            new PatternRule("\"", "\"", string, '\\', true), //$NON-NLS-1$ //$NON-NLS-2$
+            new MultiLineRule("/*", "*/", comment), //$NON-NLS-1$ //$NON-NLS-2$
+            new PatternRule("//", null, comment, '\0', true), //$NON-NLS-1$
             reservedWord
         };
         scanner.setRules(rules);
index d35ea9f9328f1ffa3b254115bae7d8cb5b1cd8de..d7abea5dabb4f37e64a20d9515e080000a8bcbb6 100644 (file)
@@ -46,12 +46,12 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart {
                 Resource inputResource = getInputResource();
                 Variable context = Variables.getPossibleVariable(graph, inputResource);
                 if(context == null)
-                    return createErrorGraph("Couldn't create variable for the resource.");
+                    return createErrorGraph(Messages.ProceduralComponentInstanceViewer_CouldnotCreateVariableForResource);
                 try {
                     List<SubstructureElement> proceduralDesc = 
                             Functions.getProceduralDesc(graph, context);
                     if(proceduralDesc == null)
-                        return createErrorGraph("Component does not have a procedural substructure.");
+                        return createErrorGraph(Messages.ProceduralComponentInstanceViewer_NoProceduralSubstructure);
                     return createGraph(graph, proceduralDesc);
                 } catch(DatabaseException e) {
                     e.printStackTrace();
@@ -97,7 +97,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart {
     
     private static Graph createErrorGraph(String description) {
         Graph graph = new Graph();
-        new Node(graph, description).setShape("rectangle");
+        new Node(graph, description).setShape("rectangle"); //$NON-NLS-1$
         return graph;
     }
     
@@ -115,7 +115,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart {
             Node node = connectionPoints.get(interface_.relation);
             if(node == null) {
                 node = new Node(graph);
-                node.setShape("diamond");
+                node.setShape("diamond"); //$NON-NLS-1$
                 node.setLabel(nameOf(g, interface_.relation));
                 connectionPoints.put(interface_.relation, node);
             }
@@ -125,21 +125,21 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart {
 
     private static Graph createGraph(ReadGraph g, List<SubstructureElement> proceduralDesc) throws DatabaseException {
         Graph graph = new Graph();
-        graph.setRankdir("LR");
+        graph.setRankdir("LR"); //$NON-NLS-1$
         THashMap<String, Node> components = new THashMap<String, Node>();
         for(SubstructureElement element : proceduralDesc)
             if(element instanceof Component) {
                 Component component = (Component)element;
                 Record record = new Record();
-                record.add(component.name + " : " + nameOf(g, component.type));
+                record.add(component.name + " : " + nameOf(g, component.type)); //$NON-NLS-1$
                 StringBuilder b = new StringBuilder();
                 boolean first = true;
                 for(Property property : component.properties) {
                     if(first)
                         first = false;
                     else
-                        b.append("\\n");
-                    b.append(nameOf(g, property.relation) + " = " + property.value);
+                        b.append("\\n"); //$NON-NLS-1$
+                    b.append(nameOf(g, property.relation) + " = " + property.value); //$NON-NLS-1$
                 }
                 record.add(b.toString());
                 components.put(component.name, record.toNode(graph));
@@ -155,7 +155,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart {
                     Edge edge = new Edge(cp1.first, cp2.first);
                     if(cp1.second != null) {
                         if(cp2.second != null)
-                            edge.setLabel(cp1.second + "-" + cp2.second);
+                            edge.setLabel(cp1.second + "-" + cp2.second); //$NON-NLS-1$
                         else
                             edge.setLabel(cp1.second);
                     }
@@ -166,7 +166,7 @@ public class ProceduralComponentInstanceViewer extends ResourceEditorPart {
                 }
                 else {
                     Node p = new Node(graph);
-                    p.setShape("point");
+                    p.setShape("point"); //$NON-NLS-1$
                     boolean first = true;
                     for(ConnectionPoint cp : cps) {
                         Pair<Node, String> cp1 = getCp(g, graph, components, connectionPoints, cp);
index 012cd5e9ffd557acb7989af23436849d39963692..55d6178dd5f90bb34c311f03b6ef4a85af152f66 100644 (file)
@@ -18,11 +18,11 @@ public class ProceduralComponentInstanceViewerEditorAdapter extends
         AbstractResourceEditorAdapter {
     
     public static final ImageDescriptor ICON = ImageDescriptor.createFromURL(Activator.getDefault().getBundle()
-            .getResource("icons/shape_3d_gray.png"));
-    public static final String EDITOR_ID = "org.simantics.modeling.ui.proceduralComponentInstanceViewer";
+            .getResource("icons/shape_3d_gray.png")); //$NON-NLS-1$
+    public static final String EDITOR_ID = "org.simantics.modeling.ui.proceduralComponentInstanceViewer"; //$NON-NLS-1$
     
     public ProceduralComponentInstanceViewerEditorAdapter() {
-        super("Procedural Component Instance Viewer", ICON, -10);
+        super(Messages.ProceduralComponentInstanceViewerEditorAdapter_ProceduralComponentInstanceViewer, ICON, -10);
     }
 
     private static Resource browseComponent(ReadGraph graph, Resource input) throws DatabaseException {
index 25663edf2878f9592d27424a82aef397fdd058e6..1a1eb723fcfe363e000fcb4cf5d8f9e611780360 100644 (file)
@@ -56,7 +56,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor
                 public Document perform(ReadGraph graph) throws DatabaseException {
                     currentText = graph.getValue(resource, Bindings.STRING);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -111,7 +111,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor
             @Override
             public void exception(Throwable t) {
                 Activator.getDefault().getLog().log(
-                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t));
+                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ProceduralComponentTypeCodeDocumentProvider_ActivatorInternalErrorMsg, t));
             }
 
             @Override
@@ -124,7 +124,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument");
+        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
index be448e64b75a8969a7006eb6b3bf2211a8a2fe1d..1366354b81e3f8df951f2b084907c3d1691d13d3 100644 (file)
@@ -3,6 +3,7 @@ package org.simantics.modeling.ui.componentTypeEditor;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.IEditorInput;
 import org.simantics.NameLabelMode;
 import org.simantics.NameLabelUtil;
@@ -34,10 +35,10 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ
         if (input instanceof IResourceEditorInput) {
             Resource code = ((IResourceEditorInput) input).getResource();
             if (code != null) {
-                return truncated(getPropertyOwnerName(graph, code) + " (Code)", 256);
+                return truncated(getPropertyOwnerName(graph, code) + " (Code)", 256); //$NON-NLS-1$
             }
         }
-        return "Unsupported input: " + input;
+        return NLS.bind(Messages.ProceduralComponentTypeEditorNamingService_UnsupportedInput, input);
     }
 
     @Override
@@ -50,7 +51,7 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ
                 return sb.toString();
             }
         }
-        return "Unsupported input: " + input;
+        return NLS.bind(Messages.ProceduralComponentTypeEditorNamingService_UnsupportedInput, input);
     }
 
     private StringBuilder getTooltip(ReadGraph graph, String editorId, IResourceEditorInput input, StringBuilder sb) throws DatabaseException {
@@ -66,14 +67,14 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ
                 ResourceArray path = getPathInIndexRoot(graph, owner);
                 for (int i = path.size() - 2; i > 0; --i) {
                     String segment = NameLabelUtil.modalName(graph, path.get(i), mode);
-                    if (segment.contains("/"))
-                        segment = "\"" + segment + "\"";
+                    if (segment.contains("/")) //$NON-NLS-1$
+                        segment = "\"" + segment + "\""; //$NON-NLS-1$ //$NON-NLS-2$
 
-                    sb.append(segment).append("/");
+                    sb.append(segment).append("/"); //$NON-NLS-1$
                 }
                 sb.append(name);
                 String rootLabel = NameLabelUtil.modalName(graph, root, mode);
-                sb.append(" (" + rootLabel + ")");
+                sb.append(" (" + rootLabel + ")"); //$NON-NLS-1$ //$NON-NLS-2$
                 return sb;
             }
         }
@@ -85,7 +86,7 @@ public class ProceduralComponentTypeEditorNamingService extends EditorNamingServ
         Layer0 L0 = Layer0.getInstance(graph);
         Resource owner = graph.getPossibleObject(property, L0.PropertyOf);
         if (owner == null)
-            return "No owner (Code)";
+            return "No owner (Code)"; //$NON-NLS-1$
         return graph.getPossibleRelatedValue(owner, L0.HasName);
     }
 
index b080c0b1c7607d4c2aff1f6c6c9ae97f2bc05046..e5bfc8f44e66d2b44d2a667ca632e29e6b5eade7 100644 (file)
@@ -124,7 +124,7 @@ public class SCLEditorBase extends EditorPart implements IExecutableExtension {
                 public void perform(WriteGraph graph) throws DatabaseException {
                     graph.markUndoPoint();
                        save(graph, inputResource, originalText);
-                       Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(inputResource, Layer0.getInstance(graph).HasName, Bindings.STRING));
+                       Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(inputResource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -140,8 +140,8 @@ public class SCLEditorBase extends EditorPart implements IExecutableExtension {
         Layer0 L0 = Layer0.getInstance(graph);
         Resource parent = graph.getPossibleObject(inputResource, L0.PropertyOf);
         if(parent == null)
-            return "No parent";
-        return graph.getPossibleRelatedValue(parent, L0.HasName) + " (Code)";
+            return "No parent"; //$NON-NLS-1$
+        return graph.getPossibleRelatedValue(parent, L0.HasName) + " (Code)"; //$NON-NLS-1$
     }
     
     @Override
index 62c54d04e6ac6682bb263f375724916cfcea3227..6ac47e9fa69096b89f56d45fdc40618909cbd01e 100644 (file)
@@ -11,7 +11,7 @@ public class SCLEditorBaseUndoHandler extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         String id = event.getCommand().getId();
         SCLEditorBase editor = (SCLEditorBase)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
-        if(id.equals("org.eclipse.ui.edit.undo")) {
+        if(id.equals("org.eclipse.ui.edit.undo")) { //$NON-NLS-1$
             editor.editor.getUndoManager().undo();
         }
         else {
index 7e6426f076b5e11ec95cf2544db47c76583d65b2..ad36bb34c665a0705fd8d6aae98f9529e53dccdb 100644 (file)
@@ -85,7 +85,7 @@ public class SCLModuleEditor extends TextEditor {
         try {
             getResourceInput().init(null);
         } catch (DatabaseException e) {
-            throw new PartInitException("Failed to initialize " + input, e);
+            throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$
         }
     }
 
index 849c5be7c2ef9025de399a4b7c2dec96caeae71f..36120e91fbc61e145c0eedcd63f6542e31adc5cc 100644 (file)
@@ -20,7 +20,7 @@ public class SCLModuleEditorAdapter extends AbstractResourceEditorAdapter
         implements EditorAdapter {
 
     public SCLModuleEditorAdapter() {
-        super("SCL Module Editor", null, 20);
+        super(Messages.SCLModuleEditorAdapter_SCLModuleEditor, null, 20);
     }
     
     @Override
@@ -54,7 +54,7 @@ public class SCLModuleEditorAdapter extends AbstractResourceEditorAdapter
                     @Override
                     public void run() {
                         try {
-                            WorkbenchUtils.openEditor("org.simantics.scl.ui.editor2",
+                            WorkbenchUtils.openEditor("org.simantics.scl.ui.editor2", //$NON-NLS-1$
                                     new StandardSCLModuleEditorInput(uri));
                         } catch (PartInitException e) {
                             e.printStackTrace();
index 4a63200a2fb4e231462dc7cf227d3ecd105a99f0..220c5ebdf720436cf443ac229fa2d424f61c0b57 100644 (file)
@@ -66,7 +66,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider {
                     currentText = graph.getRelatedValue(resource, L0.SCLModule_definition, Bindings.STRING);
                     immutable = StructuralUtils.isImmutable(graph, resource);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -94,7 +94,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider {
                     return;
                 String moduleName = graph.getURI(resource);
                 SCLContext context = SCLContext.getCurrent();
-                context.put("graph", graph);
+                context.put("graph", graph); //$NON-NLS-1$
                 Failable<Module> result = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName, listener);
                 
                 if(result instanceof Failure) {
@@ -114,7 +114,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider {
         synchronized(annotationModel.getLockObject()) {
             annotationModel.removeAllAnnotations();
             for(CompilationError error : errors) {
-                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true,
+                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, //$NON-NLS-1$
                         error.description);
                 int begin = Locations.beginOf(error.location);
                 int end = Locations.endOf(error.location);
@@ -139,7 +139,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider {
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument");
+        TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
@@ -147,7 +147,7 @@ public class SCLModuleEditorDocumentProvider extends AbstractDocumentProvider {
                 graph.markUndoPoint();
                 Layer0 L0 = Layer0.getInstance(graph);
                 graph.claimLiteral(resource, L0.SCLModule_definition, currentText, Bindings.STRING);
-                Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING));
+                Layer0Utils.addCommentMetadata(graph, "Saved SCL Module " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$
             }
         });
     }
index 0a5188841c1e2c7d8f36896af90127888aa03729..235d89f7718fe165b58e1e1f05b7377b8880dc80 100644 (file)
@@ -73,7 +73,7 @@ public class SCLModuleViewer {
         Section codeSection = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
         codeSection.setLayout(new FillLayout());
         GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(codeSection);
-        codeSection.setText("Code");
+        codeSection.setText(Messages.SCLModuleViewer_Code);
         
         Composite codeSectionBody = tk.createComposite(codeSection);
         GridLayoutFactory.fillDefaults().numColumns(1).applyTo(codeSectionBody);
@@ -83,7 +83,7 @@ public class SCLModuleViewer {
         GridDataFactory.fillDefaults().applyTo(codeButtons);
         GridLayoutFactory.fillDefaults().applyTo(codeButtons);
 
-        Button applyChanges = tk.createButton(codeButtons, "Apply changes", SWT.PUSH);
+        Button applyChanges = tk.createButton(codeButtons, Messages.SCLModuleViewer_ApplyChanges, SWT.PUSH);
 
         code = new SCLTextEditorNew(codeSectionBody, 0);
         
index 44ceec1a65ff8ab9ec44da426c92fa82e945409a..7cb2391646277111509749709d4de871d52d49ee 100644 (file)
@@ -78,7 +78,7 @@ public class SCLQueryEditor extends TextEditor {
         try {
             getResourceInput().init(null);
         } catch (DatabaseException e) {
-            throw new PartInitException("Failed to initialize " + input, e);
+            throw new PartInitException("Failed to initialize " + input, e); //$NON-NLS-1$
         }
     }
 
index da8965671316ff5238930f216e02203f3e8fe344..3c5c20763ef3ddc82eabe063027fee452d92e25b 100644 (file)
@@ -71,16 +71,16 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider {
                     ModelingResources MOD = ModelingResources.getInstance(graph);
                     if(isType(graph)) {
                        Collection<Resource> assertions = graph.getAssertedObjects(resource, MOD.SCLQuery_values);
-                       if(assertions.size() != 1) throw new DatabaseException("No query text assertion defined in Query Type");
+                       if(assertions.size() != 1) throw new DatabaseException("No query text assertion defined in Query Type"); //$NON-NLS-1$
                        Resource value = assertions.iterator().next();
                            currentText = graph.getRelatedValue(value, L0.SCLValue_expression, Bindings.STRING);
                            errorHappened = false;
-                           return new Document(currentText != null ? currentText : "");
+                           return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                     } else {
                            Resource value = graph.getSingleObject(resource, MOD.SCLQuery_values);
                            currentText = graph.getRelatedValue(value, L0.SCLValue_expression, Bindings.STRING);
                            errorHappened = false;
-                           return new Document(currentText != null ? currentText : "");
+                           return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                     }
                 }
             });
@@ -107,7 +107,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider {
             public void run(ReadGraph graph) throws DatabaseException {
                 String moduleName = graph.getURI(resource);
                 SCLContext context = SCLContext.getCurrent();
-                context.put("graph", graph);
+                context.put("graph", graph); //$NON-NLS-1$
                 Failable<Module> result = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName, listener);
                 
                 if(result instanceof Failure) {
@@ -125,7 +125,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider {
         synchronized(annotationModel.getLockObject()) {
             annotationModel.removeAllAnnotations();
             for(CompilationError error : errors) {
-                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true,
+                Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, //$NON-NLS-1$
                         error.description);
                 int begin = Locations.beginOf(error.location);
                 int end = Locations.endOf(error.location);
@@ -150,7 +150,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider {
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument");
+        TimeLogger.resetTimeAndLog("SCLModuleEditorDocumentProvider.doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
                
@@ -162,7 +162,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider {
                        if(isType(graph)) {
        
                                Collection<Resource> assertions = graph.getAssertedObjects(resource, MOD.SCLQuery_values);
-                       if(assertions.size() > 1) throw new DatabaseException("Invalid query text assertions in Query Type");
+                       if(assertions.size() > 1) throw new DatabaseException("Invalid query text assertions in Query Type"); //$NON-NLS-1$
                        if(assertions.size() == 1) return assertions.iterator().next();
                        
                        Resource value = graph.newResource();
@@ -194,7 +194,7 @@ public class SCLQueryEditorDocumentProvider extends AbstractDocumentProvider {
                 Layer0 L0 = Layer0.getInstance(graph);
                 Resource value = getValue(graph);
                 graph.claimLiteral(value, L0.SCLValue_expression, currentText, Bindings.STRING);
-                Layer0Utils.addCommentMetadata(graph, "Saved SCL Query " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING));
+                Layer0Utils.addCommentMetadata(graph, "Saved SCL Query " + graph.getRelatedValue2(resource, Layer0.getInstance(graph).HasName, Bindings.STRING)); //$NON-NLS-1$
             }
         });
     }
index 9c9ebfe9e95b90c1f1dcd6e6effa8965e485838d..ddfb3d127add6c140158aae02eabf7bddbbe45b6 100644 (file)
@@ -72,7 +72,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider
                errorHappened = false;
                return graph.getRelatedValue(text, L0.SCLValue_expression, Bindings.STRING);
        }
-       return "";
+       return ""; //$NON-NLS-1$
     }
 
     protected void updateAnnotations() {
@@ -103,7 +103,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider
             @Override
             public void exception(Throwable t) {
                 Activator.getDefault().getLog().log(
-                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t));
+                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SymbolCodeDocumentProvider2_ActivatorInternalErrorInCodeCompilation, t));
             }
 
             @Override
@@ -116,7 +116,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument");
+        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
@@ -130,7 +130,7 @@ public class SymbolCodeDocumentProvider2 extends SCLModuleEditorDocumentProvider
                        ModelingResources MOD = ModelingResources.getInstance(graph);
                        Resource newValue = graph.newResource();
                        graph.claim(newValue, L0.InstanceOf, MOD.SCLValue);
-                       graph.claimLiteral(newValue, L0.HasValueType, "[String]", Bindings.STRING);
+                       graph.claimLiteral(newValue, L0.HasValueType, "[String]", Bindings.STRING); //$NON-NLS-1$
                        graph.claimLiteral(newValue, L0.SCLValue_expression, currentText, Bindings.STRING);
                        
                        Layer0Utils.assert_(graph, resource, DIA.symbolCode, newValue);
index 48c258d4737ec0c26aeb153b0b1d1bfc92795f3a..ce8cef894ec3c81391de8f45545ba84705b04554 100644 (file)
@@ -72,7 +72,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr
                errorHappened = false;
                return graph.getRelatedValue(text, L0.SCLValue_expression, Bindings.STRING);
        }
-       return "";
+       return ""; //$NON-NLS-1$
     }
 
     protected void updateAnnotations() {
@@ -103,7 +103,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr
             @Override
             public void exception(Throwable t) {
                 Activator.getDefault().getLog().log(
-                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t));
+                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SymbolDropHandlerDocumentProvider_ActivatorInternalError, t));
             }
 
             @Override
@@ -116,7 +116,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr
     @Override
     protected void doSaveDocument(IProgressMonitor monitor, Object element,
             IDocument document, boolean overwrite) throws CoreException {
-        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument");
+        TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$
         currentText = document.get();
         Simantics.getSession().asyncRequest(new WriteRequest() {
             @Override
@@ -130,7 +130,7 @@ public class SymbolDropHandlerDocumentProvider extends SCLModuleEditorDocumentPr
                        ModelingResources MOD = ModelingResources.getInstance(graph);
                        Resource newValue = graph.newResource();
                        graph.claim(newValue, L0.InstanceOf, MOD.SCLValue);
-                       graph.claimLiteral(newValue, L0.HasValueType, "[WorkbenchSelectionElement] -> <WriteGraph,Proc> ()", Bindings.STRING);
+                       graph.claimLiteral(newValue, L0.HasValueType, "[WorkbenchSelectionElement] -> <WriteGraph,Proc> ()", Bindings.STRING); //$NON-NLS-1$
                        graph.claimLiteral(newValue, L0.SCLValue_expression, currentText, Bindings.STRING);
                        
                        Layer0Utils.assert_(graph, resource, DIA.symbolDropHandler, newValue);
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/messages.properties
new file mode 100644 (file)
index 0000000..72f6b3b
--- /dev/null
@@ -0,0 +1,50 @@
+ComponentTypeEditor_UserComponentInterface=User Component Interface
+ComponentTypeScriptEditor_ExecuteAnalogAutomation=Execute together with analog automation
+ComponentTypeScriptEditor_ExecuteAtEachStep=Execute at each step
+ComponentTypeScriptEditor_ExecuteBinaryAutomation=Execute together with binary automation
+ComponentTypeScriptEditor_ExecuteDuringPreparation=Execute during preparation
+ComponentTypeViewer_OpenedInReadOnly=(Opened in read-only mode)
+ComponentTypeViewerData_ContainsInvalidCharacters=Property name ''{0}'' contains invalid characters, does not match pattern {1}.
+ComponentTypeViewerData_CtrlEnterApplyChanges=Ctrl+Enter to apply changes, ESC to cancel.
+ComponentTypeViewerData_ESCToClose=ESC to close.
+ComponentTypeViewerData_Exclusive=Exclusive
+ComponentTypeViewerData_Inclusive=Inclusive
+ComponentTypeViewerData_MaximumValue=Maximum Value:
+ComponentTypeViewerData_MinimumValue=Minimum Value:
+ComponentTypeViewerData_NameInUse=Name ''{0}'' is already used for a terminal.
+ComponentTypeViewerData_PropertyNameInUse=Property name ''{0}'' is already in use.
+ConfigurationPropertiesSection_AssignTypes=Assign Types
+ConfigurationPropertiesSection_ConfigurationProperties=Configuration properties
+ConfigurationPropertiesSection_DefaultValue=Default Value
+ConfigurationPropertiesSection_Description=Description
+ConfigurationPropertiesSection_Label=Label
+ConfigurationPropertiesSection_LiftProperties=Lift Properties
+ConfigurationPropertiesSection_Name=Name
+ConfigurationPropertiesSection_NewProperty=New property
+ConfigurationPropertiesSection_Range=Range
+ConfigurationPropertiesSection_RemoveProperty=Remove property
+ConfigurationPropertiesSection_SelectPropertiesToLift=Select properties to lift
+ConfigurationPropertiesSection_SelectUserTypesForProp=Select user types for property
+ConfigurationPropertiesSection_Type=Type
+ConfigurationPropertiesSection_Unit=Unit
+DerivedPropertiesSection_DerivedProperties=Derived properties
+DerivedPropertiesSection_Description=Description
+DerivedPropertiesSection_Expression=Expression
+DerivedPropertiesSection_ExpressionIsEmpty=Expression is empty.
+DerivedPropertiesSection_Label=Label
+DerivedPropertiesSection_Name=Name
+DerivedPropertiesSection_NewProperty=New property
+DerivedPropertiesSection_RemoveProperty=Remove property
+DerivedPropertiesSection_Type=Type
+DerivedPropertiesSection_Unit=Unit
+LiftPropertiesDialog_MapLiftedPropertiesIntoInterface=Map lifted properties into interface
+ProceduralComponentInstanceViewer_CouldnotCreateVariableForResource=Couldn't create variable for the resource.
+ProceduralComponentInstanceViewer_NoProceduralSubstructure=Component does not have a procedural substructure.
+ProceduralComponentInstanceViewerEditorAdapter_ProceduralComponentInstanceViewer=Procedural Component Instance Viewer
+ProceduralComponentTypeCodeDocumentProvider_ActivatorInternalErrorMsg=Internal error in procedural user component code compilation.
+ProceduralComponentTypeEditorNamingService_UnsupportedInput=Unsupported input: {0}
+SCLModuleEditorAdapter_SCLModuleEditor=SCL Module Editor
+SCLModuleViewer_ApplyChanges=Apply changes
+SCLModuleViewer_Code=Code
+SymbolCodeDocumentProvider2_ActivatorInternalErrorInCodeCompilation=Internal error in procedural user component code compilation.
+SymbolDropHandlerDocumentProvider_ActivatorInternalError=Internal error in procedural user component code compilation.
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/Messages.java
new file mode 100644 (file)
index 0000000..eb8bec9
--- /dev/null
@@ -0,0 +1,26 @@
+package org.simantics.modeling.ui.diagram;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagram.messages"; //$NON-NLS-1$
+       public static String PageDescComposite_Landscape;
+       public static String PageDescComposite_MarginsMM;
+       public static String PageDescComposite_Orientation;
+       public static String PageDescComposite_Portrait;
+       public static String PageDescComposite_Size;
+       public static String PageSettingsDialog_Display;
+       public static String PageSettingsDialog_GridSizeMM;
+       public static String PageSettingsDialog_GridSnapping;
+       public static String PageSettingsDialog_PageSettings;
+       public static String PageSettingsDialog_PageSize;
+       public static String PageSettingsDialog_ShowMargins;
+       public static String PageSettingsDialog_ShowPageBorders;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 025dd45a0f17e3f38d2ed7e3eab084825586695a..b76eb23e05717ddbd3eecab20ffcd02e77a1b515 100644 (file)
@@ -120,7 +120,7 @@ public class PageDescComposite extends Composite {
 
     public void setPageDesc(PageDesc desc) {
         if (desc == null)
-            throw new NullPointerException("null page desc");
+            throw new NullPointerException("null page desc"); //$NON-NLS-1$
         this.desc = desc;
         applyValuesToWidgets();
     }
@@ -133,7 +133,7 @@ public class PageDescComposite extends Composite {
         //parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE));
         GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(parent);
         Label label = new Label(parent, 0);
-        label.setText("Size:");
+        label.setText(Messages.PageDescComposite_Size);
         combo = new Combo(parent, 0);
         combo.addListener(SWT.Selection, new Listener() {
             @Override
@@ -151,7 +151,7 @@ public class PageDescComposite extends Composite {
         GridDataFactory.fillDefaults().grab(true, true).grab(true, true).align(SWT.CENTER, SWT.CENTER).span(1, 2).applyTo(marginComposite);
         GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).spacing(3, 3).applyTo(marginComposite);
         label = new Label(marginComposite, 0);
-        label.setText("Margins (mm)");
+        label.setText(Messages.PageDescComposite_MarginsMM);
 
         GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.TOP).span(3, 1).applyTo(label);
         label = new Label(marginComposite, 0);
@@ -203,14 +203,14 @@ public class PageDescComposite extends Composite {
         addMarginListeners();
 
         label = new Label(parent, 0);
-        label.setText("Orientation:");
+        label.setText(Messages.PageDescComposite_Orientation);
         Composite comp = new Composite(parent, 0);
         GridDataFactory.fillDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(comp);
         GridLayoutFactory.fillDefaults().numColumns(1).applyTo(comp);
         portrait = new Button(comp, SWT.RADIO);
         landscape = new Button(comp, SWT.RADIO);
-        portrait.setText("Portrait");
-        landscape.setText("Landscape");
+        portrait.setText(Messages.PageDescComposite_Portrait);
+        landscape.setText(Messages.PageDescComposite_Landscape);
 
         Listener orientationListener = new Listener() {
             @Override
index 94c03494b259a4da37dc51bd25ff948d4084f3b2..ee7382cb3d29076b3554bb69465ac986fa1261ef 100644 (file)
@@ -73,7 +73,7 @@ public class PageSettingsDialog extends Dialog {
     @Override
     protected void configureShell(Shell newShell) {
         super.configureShell(newShell);
-        newShell.setText("Page Settings");
+        newShell.setText(Messages.PageSettingsDialog_PageSettings);
     }
 
     @Override
@@ -81,27 +81,27 @@ public class PageSettingsDialog extends Dialog {
         Composite composite = (Composite) super.createDialogArea(parent);
 
         Group group = new Group(composite, SWT.NONE);
-        group.setText("Grid Snapping");
+        group.setText(Messages.PageSettingsDialog_GridSnapping);
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(group);
         Label label = new Label(group, SWT.NONE);
-        label.setText("Grid size (mm)");
+        label.setText(Messages.PageSettingsDialog_GridSizeMM);
         gridSizeText = new Text(group, SWT.SINGLE|SWT.BORDER);
         GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(group);
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(gridSizeText);
 
         Group pageGroup = new Group(composite, SWT.NONE);
-        pageGroup.setText("Page size");
+        pageGroup.setText(Messages.PageSettingsDialog_PageSize);
         pdc = new PageDescComposite(pageGroup, SWT.NONE);
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(pageGroup);
         GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(pageGroup);
         GridDataFactory.fillDefaults().grab(true, true).span(1, 1).applyTo(pdc);
 
         Group displayGroup = new Group(composite, SWT.NONE);
-        displayGroup.setText("Display");
+        displayGroup.setText(Messages.PageSettingsDialog_Display);
         showBordersButton = new Button(displayGroup, SWT.CHECK);
-        showBordersButton.setText("Show page borders");
+        showBordersButton.setText(Messages.PageSettingsDialog_ShowPageBorders);
         showMarginsButton = new Button(displayGroup, SWT.CHECK);
-        showMarginsButton.setText("Show margins");
+        showMarginsButton.setText(Messages.PageSettingsDialog_ShowMargins);
         GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(displayGroup);
 
         GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(displayGroup);
@@ -162,13 +162,13 @@ public class PageSettingsDialog extends Dialog {
             @Override
             public void perform(WriteGraph graph) throws DatabaseException {
                 Resource model = graph.syncRequest(new IndexRoot(diagramResource));
-                Commands.get(graph, "Simantics/PageSettings/setPageDesc")
+                Commands.get(graph, "Simantics/PageSettings/setPageDesc") //$NON-NLS-1$
                         .execute(graph, model, diagramResource, pageDesc.toRepr());
-                Commands.get(graph, "Simantics/PageSettings/setGridSize")
+                Commands.get(graph, "Simantics/PageSettings/setGridSize") //$NON-NLS-1$
                         .execute(graph, model, diagramResource, gridSize);
-                Commands.get(graph, "Simantics/PageSettings/setPageBordersVisible")
+                Commands.get(graph, "Simantics/PageSettings/setPageBordersVisible") //$NON-NLS-1$
                         .execute(graph, model, diagramResource, borders);
-                Commands.get(graph, "Simantics/PageSettings/setMarginsVisible")
+                Commands.get(graph, "Simantics/PageSettings/setMarginsVisible") //$NON-NLS-1$
                         .execute(graph, model, diagramResource, margins);
             }
         });
index 19cb9ffa022260c02c68ad3d5540b6062552c528..30615db963ec6f74c51434f272686f9bcf174704 100644 (file)
@@ -29,7 +29,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils;
  */
 public class ResetProfileMonitorTransformContribution extends DynamicMenuContribution implements IExecutableExtension {
 
-    String          name    = "";
+    String          name    = ""; //$NON-NLS-1$
     ImageDescriptor image   = null;
 
     @Override
@@ -38,8 +38,8 @@ public class ResetProfileMonitorTransformContribution extends DynamicMenuContrib
         if (data instanceof Map<?,?>) {
             @SuppressWarnings("unchecked")
             Map<String, String> args = (Map<String, String>) data;
-            name = args.get("name");
-            String imageId = args.get("image");
+            name = args.get("name"); //$NON-NLS-1$
+            String imageId = args.get("image"); //$NON-NLS-1$
             image = Activator.getDefault().getImageRegistry().getDescriptor(imageId);
         }
     }
@@ -75,7 +75,7 @@ public class ResetProfileMonitorTransformContribution extends DynamicMenuContrib
                         Simantics.async(new WriteRequest() {
                             @Override
                             public void perform(WriteGraph graph) throws DatabaseException {
-                                Command cmd = Commands.get(graph, "Simantics/Profile/resetProfileMonitorPosition");
+                                Command cmd = Commands.get(graph, "Simantics/Profile/resetProfileMonitorPosition"); //$NON-NLS-1$
                                 Resource model = graph.syncRequest(new IndexRoot((Resource)elements[0]));
                                 for(Object element : elements)
                                     cmd.execute(graph, model, element);
index d6570a68f93d67fcde8158a3dd8efe99b99eb5ed..6441cdd4c1e280ff2135eeba19d89464e14b0303 100644 (file)
@@ -27,7 +27,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
  */
 public class SetFocusabilityContribution extends DynamicMenuContribution implements IExecutableExtension {
 
-    String          name    = "";
+    String          name    = ""; //$NON-NLS-1$
     ImageDescriptor image   = null;
     boolean         allow = true;
 
@@ -37,10 +37,10 @@ public class SetFocusabilityContribution extends DynamicMenuContribution impleme
         if (data instanceof Map<?,?>) {
             @SuppressWarnings("unchecked")
             Map<String, String> args = (Map<String, String>) data;
-            name = args.get("name");
-            String imageId = args.get("image");
+            name = args.get("name"); //$NON-NLS-1$
+            String imageId = args.get("image"); //$NON-NLS-1$
             image = Activator.getDefault().getImageRegistry().getDescriptor(imageId);
-            allow = Boolean.parseBoolean(args.get("allow"));
+            allow = Boolean.parseBoolean(args.get("allow")); //$NON-NLS-1$
         }
     }
 
index 60f28f17b9efa222bb9e6320c09586a51451fe30..a7329a979890c191957c99555eb9af0b6e2cd672 100644 (file)
@@ -68,23 +68,23 @@ import org.simantics.utils.strings.format.MetricsFormatList;
  * @author J-P Laine
  */
 public class SliderClass {
-    public static final Key  KEY_SLIDER_RESOURCE_PATH = new KeyOf(Collection.class, "SLIDER_RESOURCE_PATH");
-    public static final Key  KEY_SLIDER_COMPONENT     = new KeyOf(Object.class, "SLIDER_COMPONENT");
-    public static final Key  KEY_SLIDER_SUFFIX        = new KeyOf(String.class, "SLIDER_SUFFIX");
-    public static final Key  KEY_SLIDER_RANGE         = new KeyOf(Range.class, "SLIDER_SUBSTITUTIONS");
-    public static final Key  KEY_SLIDER_GC            = new KeyOf(Graphics2D.class, "SLIDER_GC");
-    public static final Key  KEY_SLIDER_VALUE            = new KeyOf(Double.class, "SLIDER_VALUE");
-    public static final Key  KEY_TOOLTIP_TEXT            = new KeyOf(String.class, "TOOLTIP_TEXT");
-    public static final Key  KEY_NUMBER_FORMAT           = new KeyOf(MetricsFormat.class, "NUMBER_FORMAT");
+    public static final Key  KEY_SLIDER_RESOURCE_PATH = new KeyOf(Collection.class, "SLIDER_RESOURCE_PATH"); //$NON-NLS-1$
+    public static final Key  KEY_SLIDER_COMPONENT     = new KeyOf(Object.class, "SLIDER_COMPONENT"); //$NON-NLS-1$
+    public static final Key  KEY_SLIDER_SUFFIX        = new KeyOf(String.class, "SLIDER_SUFFIX"); //$NON-NLS-1$
+    public static final Key  KEY_SLIDER_RANGE         = new KeyOf(Range.class, "SLIDER_SUBSTITUTIONS"); //$NON-NLS-1$
+    public static final Key  KEY_SLIDER_GC            = new KeyOf(Graphics2D.class, "SLIDER_GC"); //$NON-NLS-1$
+    public static final Key  KEY_SLIDER_VALUE            = new KeyOf(Double.class, "SLIDER_VALUE"); //$NON-NLS-1$
+    public static final Key  KEY_TOOLTIP_TEXT            = new KeyOf(String.class, "TOOLTIP_TEXT"); //$NON-NLS-1$
+    public static final Key  KEY_NUMBER_FORMAT           = new KeyOf(MetricsFormat.class, "NUMBER_FORMAT"); //$NON-NLS-1$
 
     /**
      * If this hint is defined, the monitor will force its x-axis to match this
      * angle. If this hint doesn't exist, the monitor will not force x-axis
      * orientation.
      */
-    public static final Key  KEY_DIRECTION             = new KeyOf(Double.class, "SLIDER_DIRECTION");
+    public static final Key  KEY_DIRECTION             = new KeyOf(Double.class, "SLIDER_DIRECTION"); //$NON-NLS-1$
 
-    public static final Key  KEY_SG_NODE             = new SceneGraphNodeKey(Node.class, "SLIDER_SG_NODE");
+    public static final Key  KEY_SG_NODE             = new SceneGraphNodeKey(Node.class, "SLIDER_SG_NODE"); //$NON-NLS-1$
     public final static MetricsFormat DEFAULT_NUMBER_FORMAT  = MetricsFormatList.METRICS_DECIMAL;
 
     public static class Range<T> {
@@ -420,7 +420,7 @@ public class SliderClass {
 
                 @Override
                 public Node init(G2DParentNode parent) {
-                    SliderNode node = parent.getOrCreateNode(""+hashCode(), SliderNode.class);
+                    SliderNode node = parent.getOrCreateNode(""+hashCode(), SliderNode.class); //$NON-NLS-1$
                     node.setValue(0);
                     node.setBounds(new Rectangle2D.Double(0, 0, 50, 22));
                     node.setTransform(AffineTransform.getScaleInstance(staticScaleX, staticScaleY));
index 81bac0b7d8583cb4c1fc9582be62f91ee42bdfa4..0cef57cc219da50ebf654781489ea9af4047f278 100644 (file)
@@ -29,7 +29,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils;
  */
 public class ToggleProfileMonitorsContribution extends DynamicMenuContribution implements IExecutableExtension {
 
-    String          name    = "";
+    String          name    = ""; //$NON-NLS-1$
     ImageDescriptor image   = null;
     boolean         allow = true;
 
@@ -39,10 +39,10 @@ public class ToggleProfileMonitorsContribution extends DynamicMenuContribution i
         if (data instanceof Map<?,?>) {
             @SuppressWarnings("unchecked")
             Map<String, String> args = (Map<String, String>) data;
-            name = args.get("name");
-            String imageId = args.get("image");
+            name = args.get("name"); //$NON-NLS-1$
+            String imageId = args.get("image"); //$NON-NLS-1$
             image = Activator.getDefault().getImageRegistry().getDescriptor(imageId);
-            allow = Boolean.parseBoolean(args.get("allow"));
+            allow = Boolean.parseBoolean(args.get("allow")); //$NON-NLS-1$
         }
     }
 
@@ -81,7 +81,7 @@ public class ToggleProfileMonitorsContribution extends DynamicMenuContribution i
 
                                                        @Override
                                                        public void perform(WriteGraph graph) throws DatabaseException {
-                                                           Command command = Commands.get(graph, "Simantics/Diagram/showProfileMonitors");
+                                                           Command command = Commands.get(graph, "Simantics/Diagram/showProfileMonitors"); //$NON-NLS-1$
                                                                for(Object object : elements) {
                                                                        Resource element = (Resource)object;
                                                                        command.execute(graph, graph.syncRequest(new IndexRoot(element)), element, allow);
index eda7fc977a852b6255b400020a88078710e2c08a..a9b1d6b8772ac76b942d4a94b14a8a7f996960bb 100644 (file)
@@ -29,7 +29,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils;
  */
 public class UpDownProfileMonitorsContribution extends DynamicMenuContribution implements IExecutableExtension {
 
-    String          name    = "";
+    String          name    = ""; //$NON-NLS-1$
     ImageDescriptor image   = null;
     boolean         allow = true;
 
@@ -39,10 +39,10 @@ public class UpDownProfileMonitorsContribution extends DynamicMenuContribution i
         if (data instanceof Map<?,?>) {
             @SuppressWarnings("unchecked")
             Map<String, String> args = (Map<String, String>) data;
-            name = args.get("name");
-            String imageId = args.get("image");
+            name = args.get("name"); //$NON-NLS-1$
+            String imageId = args.get("image"); //$NON-NLS-1$
             image = Activator.getDefault().getImageRegistry().getDescriptor(imageId);
-            allow = Boolean.parseBoolean(args.get("allow"));
+            allow = Boolean.parseBoolean(args.get("allow")); //$NON-NLS-1$
         }
     }
 
@@ -81,7 +81,7 @@ public class UpDownProfileMonitorsContribution extends DynamicMenuContribution i
 
                             @Override
                             public void perform(WriteGraph graph) throws DatabaseException {
-                                Command command = Commands.get(graph, "Simantics/Diagram/setProfileMonitorsDirectionUp");
+                                Command command = Commands.get(graph, "Simantics/Diagram/setProfileMonitorsDirectionUp"); //$NON-NLS-1$
                                 for(Object object : elements) {
                                     Resource element = (Resource)object;
                                     command.execute(graph, graph.syncRequest(new IndexRoot(element)), element, allow);
index 8a541eefcd67c643d56c63a5cdc4a52550e81e3e..5b324dd655a9f6b85c4034ff2a0d6d5ada715be4 100644 (file)
@@ -20,14 +20,14 @@ public final class ValueFormatUtil {
 
     static String valueStr(Object value_) {
         if (value_ == null)
-            return "<null>";
+            return "<null>"; //$NON-NLS-1$
         //return valueStr(value_, "0.0###");
         return valueStr(value_, MetricsFormatList.METRICS_GENERIC);
     }
 
     public static String valueStr(Object value_, MetricsFormat decimalFormat) {
         if (value_ == null)
-            return "<null>";
+            return "<null>"; //$NON-NLS-1$
 
         Class<?> clazz = value_.getClass();
         //System.out.println("FOO: " + clazz + ": " + value_);
@@ -77,7 +77,7 @@ public final class ValueFormatUtil {
         boolean first = true;
         for (double d : ds) {
             if (!first)
-                sb.append(", ");
+                sb.append(", "); //$NON-NLS-1$
             else
                 first = false;
             //sb.append(format.format(d));
@@ -98,7 +98,7 @@ public final class ValueFormatUtil {
         boolean first = true;
         for (float d : ds) {
             if (!first)
-                sb.append(", ");
+                sb.append(", "); //$NON-NLS-1$
             else
                 first = false;
             //sb.append(format.format(d));
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/messages.properties
new file mode 100644 (file)
index 0000000..3bc44d5
--- /dev/null
@@ -0,0 +1,12 @@
+PageDescComposite_Landscape=Landscape\r
+PageDescComposite_MarginsMM=Margins (mm)\r
+PageDescComposite_Orientation=Orientation:\r
+PageDescComposite_Portrait=Portrait\r
+PageDescComposite_Size=Size:\r
+PageSettingsDialog_Display=Display\r
+PageSettingsDialog_GridSizeMM=Grid size (mm)\r
+PageSettingsDialog_GridSnapping=Grid Snapping\r
+PageSettingsDialog_PageSettings=Page Settings\r
+PageSettingsDialog_PageSize=Page size\r
+PageSettingsDialog_ShowMargins=Show margins\r
+PageSettingsDialog_ShowPageBorders=Show page borders\r
index 5156f5014a5cdd44eb9e0f177e6449eae5037c53..6106a363d3bde47607dc51ed0fbb70bfdf627b1e 100644 (file)
@@ -39,7 +39,7 @@ public class AvailableFormatFactory extends ReadFactoryImpl<Resource, Map<String
                for (Resource template : result.values()) {
                        String label = graph.getPossibleRelatedAdapter(template, L0.HasLabel, String.class);
                        String format = graph.getPossibleRelatedValue(template, DIA.RealizedFormatter_HasDefinition, Bindings.STRING);
-                       keys[i] = "" + label + " (" + format + ")";
+                       keys[i] = "" + label + " (" + format + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                        values[i] = template;
                        ++i;
                }
index 897aa85152c3449c32f012d7f31932aea8245ef4..d0f69f153fac0525f42d5e46a1bb70780a52d687 100644 (file)
@@ -13,7 +13,7 @@ public class CurrentExpressionFactory extends ReadFactoryImpl<Resource, String>
                
                Layer0X L0X = Layer0X.getInstance(graph);
                String exp = graph.getPossibleRelatedAdapter(monitor, L0X.HasExpression, String.class);
-               return exp != null ? exp : "value";
+               return exp != null ? exp : "value"; //$NON-NLS-1$
                
        }
        
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/Messages.java
new file mode 100644 (file)
index 0000000..3b07917
--- /dev/null
@@ -0,0 +1,27 @@
+package org.simantics.modeling.ui.diagram.monitor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagram.monitor.messages"; //$NON-NLS-1$
+       public static String MonitorComposite_Alignment;
+       public static String MonitorComposite_CenterAlignment;
+       public static String MonitorComposite_Color;
+       public static String MonitorComposite_FontFamily;
+       public static String MonitorComposite_FontSize;
+       public static String MonitorComposite_Formatting;
+       public static String MonitorComposite_LeftAlignment;
+       public static String MonitorComposite_ResetLocalChanges;
+       public static String MonitorComposite_RightAlignment;
+       public static String MonitorComposite_SetAsDefault;
+       public static String MonitorComposite_SetAsDefaultForNewlyCreatedMonitors;
+       public static String MonitorComposite_SetMonitorColor;
+       public static String MonitorComposite_Template;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 597a125a896594690d392394faa64c19acd9c18a..c7a2b6385a276e20e1aecd90ea876e5af243ee41 100644 (file)
@@ -70,9 +70,9 @@ import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
 public class MonitorClassFactory2 extends SyncElementFactory {
 
     private static final Key               KEY_VARIABLE_LISTENER = new KeyOf(MonitorListener.class,
-                                                                         "MONITOR_VARIABLE_LISTENER");
+                                                                         "MONITOR_VARIABLE_LISTENER"); //$NON-NLS-1$
 
-    private static final String            CLASS_ID          = "Monitor";
+    private static final String            CLASS_ID          = "Monitor"; //$NON-NLS-1$
 
     private static final IHintSynchronizer HINT_SYNCHRONIZER = new CompositeHintSynchronizer(
             MonitorSynchronizer.INSTANCE,
@@ -144,7 +144,7 @@ public class MonitorClassFactory2 extends SyncElementFactory {
         loadParentRelationships(graph, element, e);
 
         final Map<String, String> substitutions = new HashMap<String, String>();
-        substitutions.put("#v1", "");
+        substitutions.put("#v1", ""); //$NON-NLS-1$ //$NON-NLS-2$
 
         final Resource diagramRuntime = diagram.getHint(DiagramModelHints.KEY_DIAGRAM_RUNTIME_RESOURCE);
         if (diagramRuntime != null) {
index 7dac7a0b09b3c20c5b4553fe3305277305eca972..a061d5b7ad38e96a11f75450bcd0272236bcd484 100644 (file)
@@ -55,7 +55,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 
 public class MonitorComposite extends ConfigurationComposite {
 
-    private static final String DATA_CURRENT_COLOR = "COLOR";
+    private static final String DATA_CURRENT_COLOR = "COLOR"; //$NON-NLS-1$
 
     public void create(final Composite body, IWorkbenchSite site, final ISessionContext context, final WidgetSupport support) {
         final Display display = body.getDisplay();
@@ -71,7 +71,7 @@ public class MonitorComposite extends ConfigurationComposite {
         support.setParameter(WidgetSupport.RESOURCE_MANAGER, resourceManager);
 
         Label templateHeader = new Label(buttonComposite, support, 0);
-        templateHeader.setText("Template");
+        templateHeader.setText(Messages.MonitorComposite_Template);
         //templateHeader.setFont(smallFont);
         templateHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(templateHeader.getWidget());
@@ -83,8 +83,8 @@ public class MonitorComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(true, false).applyTo(templateCombo.getWidget());
 
         Button setDefaultButton = new Button(buttonComposite, support, SWT.NONE | SWT.READ_ONLY);
-        setDefaultButton.setText("Set As Default");
-        setDefaultButton.setTooltipText("Set As Default for Newly Created Monitors");
+        setDefaultButton.setText(Messages.MonitorComposite_SetAsDefault);
+        setDefaultButton.setTooltipText(Messages.MonitorComposite_SetAsDefaultForNewlyCreatedMonitors);
         setDefaultButton.addSelectionListener(new SelectionListenerImpl<Resource>(context) {
             @Override
             public void apply(WriteGraph graph, Resource monitor) throws DatabaseException {
@@ -102,7 +102,7 @@ public class MonitorComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(false, false).applyTo(setDefaultButton.getWidget());
 
         Button resetButton = new Button(buttonComposite, support, SWT.NONE | SWT.READ_ONLY);
-        resetButton.setText("Reset Local Changes");
+        resetButton.setText(Messages.MonitorComposite_ResetLocalChanges);
         resetButton.addSelectionListener(new SelectionListenerImpl<Resource>(context) {
             @Override
             public void apply(WriteGraph graph, Resource monitor) throws DatabaseException {
@@ -119,7 +119,7 @@ public class MonitorComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(false, false).applyTo(resetButton.getWidget());
 
         Label fontHeader = new Label(buttonComposite, support, 0);
-        fontHeader.setText("Font Family");
+        fontHeader.setText(Messages.MonitorComposite_FontFamily);
         //fontHeader.setFont(smallFont);
         fontHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(fontHeader.getWidget());
@@ -131,7 +131,7 @@ public class MonitorComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(true, false).span(3,1).applyTo(fontCombo.getWidget());
 
         Label sizeHeader = new Label(buttonComposite, support, 0);
-        sizeHeader.setText("Font Size");
+        sizeHeader.setText(Messages.MonitorComposite_FontSize);
         //sizeHeader.setFont(smallFont);
         sizeHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(sizeHeader.getWidget());
@@ -143,7 +143,7 @@ public class MonitorComposite extends ConfigurationComposite {
         GridDataFactory.fillDefaults().grab(false, false).span(3,1).minSize(50, 0).applyTo(sizeCombo.getWidget());
 
         Label formatterHeader = new Label(buttonComposite, support, 0);
-        formatterHeader.setText("Formatting");
+        formatterHeader.setText(Messages.MonitorComposite_Formatting);
         //formatterHeader.setFont(smallFont);
         formatterHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(formatterHeader.getWidget());
@@ -160,12 +160,12 @@ public class MonitorComposite extends ConfigurationComposite {
         GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).extendedMargins(5,5,5,5).applyTo(rowComposite);
 
         Label alignHeader = new Label(rowComposite, support, 0);
-        alignHeader.setText("Alignment");
+        alignHeader.setText(Messages.MonitorComposite_Alignment);
         //alignHeader.setFont(smallFont);
         alignHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(alignHeader.getWidget());
 
-        Bundle iconBundle = Platform.getBundle("com.famfamfam.silk");
+        Bundle iconBundle = Platform.getBundle("com.famfamfam.silk"); //$NON-NLS-1$
 
         Composite alignComposite = new Composite(rowComposite, SWT.NONE);
         alignComposite.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
@@ -173,25 +173,25 @@ public class MonitorComposite extends ConfigurationComposite {
         GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(4).extendedMargins(5,5,5,5).applyTo(alignComposite);
 
         Button leadButton = new Button(alignComposite, support, SWT.TOGGLE);
-        leadButton.setTooltipText("Left Alignment");
-        leadButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_left.png")));
+        leadButton.setTooltipText(Messages.MonitorComposite_LeftAlignment);
+        leadButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_left.png"))); //$NON-NLS-1$
         leadButton.setSelectionFactory(new AlignmentSelectedFactory(G2DResource.URIs.Alignment_Leading));
         leadButton.addSelectionListener(new AlignmentSelectionListener(context, G2DResource.URIs.Alignment_Leading));
 
         Button centerButton = new Button(alignComposite, support, SWT.TOGGLE);
-        centerButton.setTooltipText("Center Alignment");
-        centerButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_center.png")));
+        centerButton.setTooltipText(Messages.MonitorComposite_CenterAlignment);
+        centerButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_center.png"))); //$NON-NLS-1$
         centerButton.setSelectionFactory(new AlignmentSelectedFactory(G2DResource.URIs.Alignment_Center));
         centerButton.addSelectionListener(new AlignmentSelectionListener(context, G2DResource.URIs.Alignment_Center));
 
         Button trailButton = new Button(alignComposite, support, SWT.TOGGLE);
-        trailButton.setTooltipText("Right Alignment");
-        trailButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_right.png")));
+        trailButton.setTooltipText(Messages.MonitorComposite_RightAlignment);
+        trailButton.setImage((Image) resourceManager.get(BundleUtils.getImageDescriptorFromBundle(iconBundle, "icons/text_align_right.png"))); //$NON-NLS-1$
         trailButton.setSelectionFactory(new AlignmentSelectedFactory(G2DResource.URIs.Alignment_Trailing));
         trailButton.addSelectionListener(new AlignmentSelectionListener(context, G2DResource.URIs.Alignment_Trailing));
 
         Label colorHeader = new Label(rowComposite, support, 0);
-        colorHeader.setText("Color");
+        colorHeader.setText(Messages.MonitorComposite_Color);
         colorHeader.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
         GridDataFactory.fillDefaults().indent(20, 0).grab(false, false).span(1, 1).align(SWT.LEFT, SWT.CENTER).applyTo(colorHeader.getWidget());
 
@@ -217,7 +217,7 @@ public class MonitorComposite extends ConfigurationComposite {
             final Resource[] resources = ResourceAdaptionUtils.toResources(input);
             if (resources.length != 0) {
                 ColorDialog dialog = new ColorDialog(WorkbenchUtils.getActiveWorkbenchWindowShell(), SWT.NONE);
-                dialog.setText("Set Monitor Color");
+                dialog.setText(Messages.MonitorComposite_SetMonitorColor);
                 Color oldColor = (Color) control.getData(DATA_CURRENT_COLOR);
                 if (oldColor != null) {
                     RGB oldRgb = Colors.rgb(oldColor);
@@ -301,7 +301,7 @@ public class MonitorComposite extends ConfigurationComposite {
                         graph.claimLiteral(realizedColor, DIA.RealizedColor_HasRGB, L0.DoubleArray, color, Bindings.DOUBLE_ARRAY);
                     }
                     CommentMetadata cm = graph.getMetadata(CommentMetadata.class);
-                    graph.addMetadata(cm.add("Set color to " + rgb + " for resources " + Arrays.toString(resources)));
+                    graph.addMetadata(cm.add("Set color to " + rgb + " for resources " + Arrays.toString(resources))); //$NON-NLS-1$ //$NON-NLS-2$
                 }
             });
         } catch (DatabaseException e) {
index f528035e5b260a1fdec84709f56ab55396f9b3cc..3a96e1e7c05e9915fb973132ddbaafb5e5b621f5 100644 (file)
@@ -69,32 +69,32 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
        }
 
        public void outAConstantValue(AConstantValue node) {
-               if(DEBUG) System.out.println("outAConstantValue " + node);
+               if(DEBUG) System.out.println("outAConstantValue " + node); //$NON-NLS-1$
                stack.push(Double.valueOf(node.toString()));
        }
 
        public void outAStringValue(AStringValue node) {
-               if(DEBUG) System.out.println("outAStringValue " + node);
+               if(DEBUG) System.out.println("outAStringValue " + node); //$NON-NLS-1$
                String value = node.toString();
                stack.push(value.substring(1, value.length() - 2));
        }
 
        public void outAAddressValue(AAddressValue node) {
-               if(DEBUG) System.out.println("outAAddressValue " + node);
+               if(DEBUG) System.out.println("outAAddressValue " + node); //$NON-NLS-1$
                stack.push('&' + node.getRange().toString());
        }
 
        @Override
        public void outASingleRange(ASingleRange node) {
                
-               if(DEBUG) System.out.println("outASingleRange " + node);
+               if(DEBUG) System.out.println("outASingleRange " + node); //$NON-NLS-1$
                
        }
        
        @Override
        public void outARviValue(ARviValue node) {
                
-               if(DEBUG) System.out.println("outARviValue " + node);
+               if(DEBUG) System.out.println("outARviValue " + node); //$NON-NLS-1$
                
                String rvi = node.toString().trim();
                
@@ -103,7 +103,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
                        stack.push(format(var.getValue(graph)));
                } catch (DatabaseException e) {
                        Logger.defaultLogError(e);
-                       stack.push("<No value for '" + rvi + "'>");
+                       stack.push("<No value for '" + rvi + "'>"); //$NON-NLS-1$ //$NON-NLS-2$
                }
                
        }
@@ -111,10 +111,10 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
        @Override
        public void outAVariablePrimary(AVariablePrimary node) {
                
-               if(DEBUG) System.out.println("outAVariablePrimary " + node);
+               if(DEBUG) System.out.println("outAVariablePrimary " + node); //$NON-NLS-1$
                
                String identifier = node.toString().trim();
-               if("value".equals(identifier)) {
+               if("value".equals(identifier)) { //$NON-NLS-1$
                        try {
                                stack.push(format(variable.getValue(graph)));
                        } catch (DatabaseException e) {
@@ -128,7 +128,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
        
        public void outARangeValue(ARangeValue node) {
 
-               if(DEBUG) System.out.println("outARangeValue " + node);
+               if(DEBUG) System.out.println("outARangeValue " + node); //$NON-NLS-1$
 
                String identifier = node.getRange().toString().trim();
                stack.push(identifier);
@@ -138,7 +138,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
        private String format(Object o) {
                if(formatter != null)
                        return formatter.format(o);
-               else return o != null ? o.toString() : "";
+               else return o != null ? o.toString() : ""; //$NON-NLS-1$
        }
 
        private double extractValue(Object o) {
@@ -170,7 +170,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
 
        public void outAPlusExpression(APlusExpression node) {
                
-               if(DEBUG) System.out.println("outAPlusExpression " + node);
+               if(DEBUG) System.out.println("outAPlusExpression " + node); //$NON-NLS-1$
                
                Object o2 = stack.pop();
                Object o1 = stack.pop();
@@ -182,7 +182,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
 
        public void outAMultMultiplicative(AMultMultiplicative node) {
                
-               if(DEBUG) System.out.println("outAMultiplicative " + node);
+               if(DEBUG) System.out.println("outAMultiplicative " + node); //$NON-NLS-1$
                
                Object o1 = stack.pop();
                Object o2 = stack.pop();
@@ -203,14 +203,14 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
 
        public void outAFunctionPrimary(AFunctionPrimary node) {
 
-               if(DEBUG) System.out.println("outAFunctionPrimary " + node);
+               if(DEBUG) System.out.println("outAFunctionPrimary " + node); //$NON-NLS-1$
 
                try {
 
-                       String functionName = node.getFunc().getText().replace("(", "");
+                       String functionName = node.getFunc().getText().replace("(", ""); //$NON-NLS-1$ //$NON-NLS-2$
 
                        if (DEBUG_APPLICATION)
-                           System.out.println("function apply " + functionName);
+                           System.out.println("function apply " + functionName); //$NON-NLS-1$
 
                        Function function = builtins.get(functionName);
                        if (function != null) {
@@ -261,7 +261,7 @@ public class MonitorExpressionVisitor extends DepthFirstAdapter {
                                } else {
 
                                    //stack.push(null);
-                                   throw new EvaluationException("Function not found in dependencies: '" + functionName + "'");
+                                   throw new EvaluationException("Function not found in dependencies: '" + functionName + "'"); //$NON-NLS-1$ //$NON-NLS-2$
 
                                }
 
index 076c97f8747ca38ed04f772698bb0ef24b0f7c57..21c13a2985deee34ee43cc45e5058b637492ceb3 100644 (file)
@@ -42,13 +42,13 @@ public class MonitorListener implements Listener<MonitorVariableValue>, Runnable
 
     public MonitorListener(Resource element, ICanvasContext canvas, IDiagram diagram, Map<String, String> substitutions) {
         if (element == null)
-            throw new NullPointerException("null element");
+            throw new NullPointerException("null element"); //$NON-NLS-1$
         if (canvas == null)
-            throw new NullPointerException("null canvas");
+            throw new NullPointerException("null canvas"); //$NON-NLS-1$
         if (diagram == null)
-            throw new NullPointerException("null diagram");
+            throw new NullPointerException("null diagram"); //$NON-NLS-1$
         if (substitutions == null)
-            throw new NullPointerException("null substitutions");
+            throw new NullPointerException("null substitutions"); //$NON-NLS-1$
         this.element = element;
         this.canvas = canvas;
         this.diagram = diagram;
@@ -118,12 +118,12 @@ public class MonitorListener implements Listener<MonitorVariableValue>, Runnable
         // finished.
         MonitorVariableValue result = lastScheduledUpdate.getAndSet(null);
 
-        String value = "<no variable>";
+        String value = "<no variable>"; //$NON-NLS-1$
         if (result != null) {
             if (result.getValue() != null) {
                 value = result.getValue();//ValueFormatUtil.valueStr(result.getValue(), format);
             } else {
-                value = "<no value>";
+                value = "<no value>"; //$NON-NLS-1$
             }
             el.setHint(MonitorClass.KEY_MONITOR_COMPONENT, result.getMonitorVariable().getMonitorComponent());
             ElementUtils.setOrRemoveHint(el, MonitorClass.KEY_MONITOR_IS_EXTERNAL, result.getMonitorVariable().isExternal());
@@ -132,7 +132,7 @@ public class MonitorListener implements Listener<MonitorVariableValue>, Runnable
             el.removeHint(MonitorClass.KEY_MONITOR_IS_EXTERNAL);
         }
 
-        substitutions.put("#v1", value);
+        substitutions.put("#v1", value); //$NON-NLS-1$
 
         final Map<String, String> subs = el.getHint(MonitorClass.KEY_MONITOR_SUBSTITUTIONS);
         if (substitutions != subs)
index 92adb5cfa75dd996eaa2e60e7c8d8d1e65b7da4a..e7c3236e20ee737575ac140faa7dfae4a7cf0a42 100644 (file)
@@ -37,7 +37,7 @@ final public class MonitorValue extends TernaryRead<String, Formatter, Variable,
             Object result = visitor.getResult();
             if (result instanceof Throwable)
                 return ((Throwable) result).getLocalizedMessage();
-            return result != null ? result.toString() : "null";
+            return result != null ? result.toString() : "null"; //$NON-NLS-1$
         } catch (ExpressionException e) {
             ErrorLogger.defaultLogError(e);
             return e.getMessage();
index 5702fe9e496d893862802df9461b6ee6d45e97db..1cf11f119760fa60d26f70014b4d7c717b6b7bd5 100644 (file)
@@ -30,7 +30,7 @@ public class MonitorVariableWrite extends WriteRequest {
 
             // Add a comment to metadata.
             CommentMetadata cm = graph.getMetadata(CommentMetadata.class);
-            graph.addMetadata(cm.add("Set value " + ObjectUtils.toString(label)));
+            graph.addMetadata(cm.add("Set value " + ObjectUtils.toString(label))); //$NON-NLS-1$
         } else {
             new VariableWriteImplied(variable, label).perform(graph);
         }
index 987994045152536df6d1852158e2e293c438a354..05fb3bef5fc0278af736b0ba49ca07a527ed7e26 100644 (file)
@@ -41,7 +41,7 @@ public class MonitorWriter implements ElementWriter {
 
         Resource monitorComponent = element.getHint(MonitorClass.KEY_MONITOR_COMPONENT);
         if (monitorComponent == null)
-            throw new IllegalArgumentException("KEY_MONITOR_COMPONENT hint not set");
+            throw new IllegalArgumentException("KEY_MONITOR_COMPONENT hint not set"); //$NON-NLS-1$
 
         Layer0 L0 = Layer0.getInstance(g);
         Layer0X L0X = Layer0X.getInstance(g);
@@ -57,7 +57,7 @@ public class MonitorWriter implements ElementWriter {
             }
         }
 
-        String label = "";
+        String label = ""; //$NON-NLS-1$
         g.claimLiteral(elementResource, L0.HasLabel, label);
 
         Double ddir = element.getHint(MonitorClass.KEY_DIRECTION);
@@ -96,7 +96,7 @@ public class MonitorWriter implements ElementWriter {
             case TRAILING: return g2d.Alignment_Trailing;
             case CENTER: return g2d.Alignment_Center;
             default:
-                throw new IllegalArgumentException("unsupported alignment: " + alignment);
+                throw new IllegalArgumentException("unsupported alignment: " + alignment); //$NON-NLS-1$
         }
     }
 
index 4cb51f2896778ec4951ffbebde8f8669183f687e..7ac236e7dace76088d16d112946ce14bf5ef7b0a 100644 (file)
@@ -26,16 +26,16 @@ public class RealizedFormatterAdapter extends SimpleContextualAdapter<Formatter,
                String definition = graph.getRelatedValue(formatter, DIA.RealizedFormatter_HasDefinition, Bindings.STRING);
                final String label = graph.getPossibleRelatedAdapter(formatter, L0.HasLabel, String.class);
                final DecimalFormat format = new DecimalFormat(definition, DecimalFormatSymbols.getInstance(Locale.US));
-               final String toString = label + " (" + definition + ")";
+               final String toString = label + " (" + definition + ")"; //$NON-NLS-1$ //$NON-NLS-2$
 
                return new Formatter() {
 
                        private String formatNumber(Number v) {
                                double dv = v.doubleValue();
                                if (Double.isInfinite(dv)) {
-                                       return (dv == Double.POSITIVE_INFINITY) ? "\u221E" : "-\u221E";
+                                       return (dv == Double.POSITIVE_INFINITY) ? "\u221E" : "-\u221E"; //$NON-NLS-1$ //$NON-NLS-2$
                                } else if (Double.isNaN(dv)) {
-                                       return "NaN";
+                                       return "NaN"; //$NON-NLS-1$
                                } else {
                                        return format.format(v);
                                }
@@ -55,7 +55,7 @@ public class RealizedFormatterAdapter extends SimpleContextualAdapter<Formatter,
                                                return (String)object;
                                        }
                                } else {
-                                       return object != null ? object.toString() : "";
+                                       return object != null ? object.toString() : ""; //$NON-NLS-1$
                                }
                        }
 
index ad8216d7599a17d428025cbec9860dec29394632..7cc42e3ad4426babf6738ed6b5362e8ecb724567 100644 (file)
@@ -91,7 +91,7 @@ public class ResolveMonitorVariable extends BinaryRead<Resource, Resource, Monit
 
         Layer0X L0X = Layer0X.getInstance(graph);
         String _expression = graph.getPossibleRelatedAdapter(parameter2, L0X.HasExpression, String.class);
-        if(_expression == null) _expression  = "value";
+        if(_expression == null) _expression  = "value"; //$NON-NLS-1$
 
         RVI rvi = null;
         try {
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/messages.properties
new file mode 100644 (file)
index 0000000..592d887
--- /dev/null
@@ -0,0 +1,13 @@
+MonitorComposite_Alignment=Alignment\r
+MonitorComposite_CenterAlignment=Center Alignment\r
+MonitorComposite_Color=Color\r
+MonitorComposite_FontFamily=Font Family\r
+MonitorComposite_FontSize=Font Size\r
+MonitorComposite_Formatting=Formatting\r
+MonitorComposite_LeftAlignment=Left Alignment\r
+MonitorComposite_ResetLocalChanges=Reset Local Changes\r
+MonitorComposite_RightAlignment=Right Alignment\r
+MonitorComposite_SetAsDefault=Set As Default\r
+MonitorComposite_SetAsDefaultForNewlyCreatedMonitors=Set As Default for Newly Created Monitors\r
+MonitorComposite_SetMonitorColor=Set Monitor Color\r
+MonitorComposite_Template=Template\r
index 7e97ccc5629ca7619ee6ac34001b2de81c191ea5..6e611922a97a3bda09219d54d954ffaa71da8f8a 100644 (file)
@@ -52,7 +52,7 @@ public class ComponentsRenamingDialog extends Dialog {
     
     @Override
     protected Control createDialogArea(Composite parent) {
-        getShell().setText("Rename diagram contents");
+        getShell().setText(Messages.ComponentsRenamingDialog_RenameDiagramContents);
         getShell().setLayout(new GridLayout());
         Composite composite = new Composite(parent, SWT.NONE);
         composite.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -66,7 +66,7 @@ public class ComponentsRenamingDialog extends Dialog {
             GridLayoutFactory.fillDefaults().numColumns(2).margins(5, 5).applyTo(area);
             
             oldNamePrefixLabel = new Label(area, SWT.NONE);
-            oldNamePrefixLabel.setText("Old name prefix:");
+            oldNamePrefixLabel.setText(Messages.ComponentsRenamingDialog_OldNamePrefix);
             
             oldNamePrefix = new Text(area, SWT.READ_ONLY | SWT.BORDER);
             oldNamePrefix.setEditable(false);
@@ -74,7 +74,7 @@ public class ComponentsRenamingDialog extends Dialog {
             GridDataFactory.fillDefaults().grab(true, false).applyTo(oldNamePrefix);
             
             Label newNamePrefixLabel = new Label(area, SWT.NONE);
-            newNamePrefixLabel.setText("&New name prefix:");
+            newNamePrefixLabel.setText(Messages.ComponentsRenamingDialog_NewNamePrefixAnd);
             
             newNamePrefix = new Text(area, SWT.BORDER);
             newNamePrefix.setText(model.oldNamePrefix);
@@ -123,7 +123,7 @@ public class ComponentsRenamingDialog extends Dialog {
         // Reset
         
         final Button resetNames = new Button(composite, SWT.CHECK);
-        resetNames.setText("&Reset names");
+        resetNames.setText(Messages.ComponentsRenamingDialog_ResetNamesAnd);
         resetNames.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -154,7 +154,7 @@ public class ComponentsRenamingDialog extends Dialog {
         });
         
         TableViewerColumn oldNameColumn = new TableViewerColumn(tableViewer, SWT.NONE);
-        oldNameColumn.getColumn().setText("Old name");
+        oldNameColumn.getColumn().setText(Messages.ComponentsRenamingDialog_OldName);
         oldNameColumn.getColumn().setWidth(250);
         oldNameColumn.setLabelProvider(new ColumnLabelProvider() {
             @Override
@@ -165,7 +165,7 @@ public class ComponentsRenamingDialog extends Dialog {
         });
         
         TableViewerColumn newNameColumn = new TableViewerColumn(tableViewer, SWT.NONE);
-        newNameColumn.getColumn().setText("New name");
+        newNameColumn.getColumn().setText(Messages.ComponentsRenamingDialog_NewName);
         newNameColumn.getColumn().setWidth(250);
         newNameColumn.setLabelProvider(new ColumnLabelProvider() {
             @Override
@@ -209,7 +209,7 @@ public class ComponentsRenamingDialog extends Dialog {
         GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(bar);
         bar.setLayout(new RowLayout());
         Button selectAll = new Button(bar, SWT.PUSH);
-        selectAll.setText("Select &All");
+        selectAll.setText(Messages.ComponentsRenamingDialog_SelectAllAnd);
         selectAll.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -218,7 +218,7 @@ public class ComponentsRenamingDialog extends Dialog {
             }
         });
         Button clearSelection = new Button(bar, SWT.PUSH);
-        clearSelection.setText("&Clear Selection");
+        clearSelection.setText(Messages.ComponentsRenamingDialog_ClearSelectionAnd);
         clearSelection.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -240,10 +240,10 @@ public class ComponentsRenamingDialog extends Dialog {
         shell.open();
         
         ComponentsRenamingModel model = new ComponentsRenamingModel();
-        model.oldNamePrefix = "FOO";
-        model.newNamePrefix = "FOO";
+        model.oldNamePrefix = "FOO"; //$NON-NLS-1$
+        model.newNamePrefix = "FOO"; //$NON-NLS-1$
         for(int i=0;i<100;++i)
-            model.entries.add(new NameEntry(null, "FOO"+(i*5), "FOO"+(i*5), "PREFIX"));
+            model.entries.add(new NameEntry(null, "FOO"+(i*5), "FOO"+(i*5), "PREFIX")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         
         ComponentsRenamingDialog dialog = new ComponentsRenamingDialog(shell, model);
         dialog.open();
index 452be9b333501c561fa4cf6b66935c017f745a2c..da861d816b5eff552c50c635da1d7c88c3d88ef5 100644 (file)
@@ -59,7 +59,7 @@ public class ComponentsRenamingModel {
             Resource componentType = g.getPossibleType(component, STR.Component);
             String componentTypePrefix = componentType != null
                     ? g.<String>getPossibleRelatedValue(componentType, L0X.HasGeneratedNamePrefix, Bindings.STRING)
-                    : "";
+                    : ""; //$NON-NLS-1$
             entries.add(new NameEntry(component, name, name, componentTypePrefix));
         }
         Collections.sort(entries);
@@ -98,7 +98,7 @@ public class ComponentsRenamingModel {
                     }
                 });
             } catch (DatabaseException e) {
-                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "validateNewNames failed, see exception for details", e));
+                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "validateNewNames failed, see exception for details", e)); //$NON-NLS-1$
             }
         } else {
             if (reset) {
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/Messages.java
new file mode 100644 (file)
index 0000000..0afa066
--- /dev/null
@@ -0,0 +1,22 @@
+package org.simantics.modeling.ui.diagram.renaming;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagram.renaming.messages"; //$NON-NLS-1$
+       public static String ComponentsRenamingDialog_ClearSelectionAnd;
+       public static String ComponentsRenamingDialog_NewName;
+       public static String ComponentsRenamingDialog_NewNamePrefixAnd;
+       public static String ComponentsRenamingDialog_OldName;
+       public static String ComponentsRenamingDialog_OldNamePrefix;
+       public static String ComponentsRenamingDialog_RenameDiagramContents;
+       public static String ComponentsRenamingDialog_ResetNamesAnd;
+       public static String ComponentsRenamingDialog_SelectAllAnd;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/renaming/messages.properties
new file mode 100644 (file)
index 0000000..1949812
--- /dev/null
@@ -0,0 +1,8 @@
+ComponentsRenamingDialog_ClearSelectionAnd=&Clear Selection\r
+ComponentsRenamingDialog_NewName=New name\r
+ComponentsRenamingDialog_NewNamePrefixAnd=&New name prefix:\r
+ComponentsRenamingDialog_OldName=Old name\r
+ComponentsRenamingDialog_OldNamePrefix=Old name prefix:\r
+ComponentsRenamingDialog_RenameDiagramContents=Rename diagram contents\r
+ComponentsRenamingDialog_ResetNamesAnd=&Reset names\r
+ComponentsRenamingDialog_SelectAllAnd=Select &All\r
index d86925e485d187ef8d48e25535a091ffbcb5facd..57b0bd9b86af26ce112aff5101b4bff12be24133 100644 (file)
@@ -66,10 +66,10 @@ public class ConnectionPointNameStyle extends StyleBase<List<ConnectionPointName
         }
     }
 
-    protected static final String PARENT_NODE_NAME_PREFIX = "_tNames";
-    protected static final String NODE_NAME_PREFIX        = "_";
+    protected static final String PARENT_NODE_NAME_PREFIX = "_tNames"; //$NON-NLS-1$
+    protected static final String NODE_NAME_PREFIX        = "_"; //$NON-NLS-1$
 
-    protected static final Font   FONT = Font.decode("Arial 6");
+    protected static final Font   FONT = Font.decode("Arial 6"); //$NON-NLS-1$
 
     protected static final double DEFAULT_SCALE = 0.05;
 
@@ -163,7 +163,7 @@ public class ConnectionPointNameStyle extends StyleBase<List<ConnectionPointName
         if (count < 2)
             return;
 
-        G2DParentNode parentNode = ProfileVariables.claimChild(_node, "", PARENT_NODE_NAME_PREFIX, G2DParentNode.class, observer);
+        G2DParentNode parentNode = ProfileVariables.claimChild(_node, "", PARENT_NODE_NAME_PREFIX, G2DParentNode.class, observer); //$NON-NLS-1$
         parentNode.setTransform(resultList.get(0).getTransform());
         parentNode.setZIndex(Integer.MAX_VALUE >> 1);
 
@@ -171,7 +171,7 @@ public class ConnectionPointNameStyle extends StyleBase<List<ConnectionPointName
 
         for (int i = 1; i < count; ++i) {
             Result result = resultList.get(i);
-            TextNode node = ProfileVariables.claimChild(parentNode, "", NODE_NAME_PREFIX + i, TextNode.class, observer);
+            TextNode node = ProfileVariables.claimChild(parentNode, "", NODE_NAME_PREFIX + i, TextNode.class, observer); //$NON-NLS-1$
             node.setZIndex(i);
             node.setBackgroundColor(backgroundColor);
             node.setColor(textColor);
@@ -231,7 +231,7 @@ public class ConnectionPointNameStyle extends StyleBase<List<ConnectionPointName
     @Override
     protected void cleanupStyleForNode(INode node) {
         if (node instanceof SingleElementNode) {
-            ProfileVariables.denyChild(node, "", PARENT_NODE_NAME_PREFIX);
+            ProfileVariables.denyChild(node, "", PARENT_NODE_NAME_PREFIX); //$NON-NLS-1$
         }
     }
 
index bb626c8641259959d11fbd94c7a832a6303e5c92..6e4d57b29c384dddc782c764f647e75b073a58fb 100644 (file)
@@ -39,7 +39,7 @@ import org.simantics.utils.datastructures.map.Tuple;
  */
 public class DocumentDecorationStyle extends StyleBase<DocumentResult> {
 
-    private static final String DECORATION_NODE_NAME = "documentDecorations";
+    private static final String DECORATION_NODE_NAME = "documentDecorations"; //$NON-NLS-1$
 
     private Set<Resource> getContexts(ReadGraph graph, Resource element) throws DatabaseException {
 
@@ -72,11 +72,11 @@ public class DocumentDecorationStyle extends StyleBase<DocumentResult> {
     @Override
     public void applyStyleForNode(EvaluationContext observer, INode node, DocumentResult result) {
         if (result == null) {
-            ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME);
+            ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$
             return;
         }
 
-        SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer);
+        SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer); //$NON-NLS-1$
 
         Rectangle2D bounds = NodeUtil.getLocalBounds(node, Decoration.class);
 
@@ -92,12 +92,12 @@ public class DocumentDecorationStyle extends StyleBase<DocumentResult> {
 
     @Override
     protected void cleanupStyleForNode(INode node) {
-        ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME);
+        ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$
     }
 
     @Override
     public String toString() {
-        return "Document decoration";
+        return "Document decoration"; //$NON-NLS-1$
     }
 
 }
index 0200af96e520bc48835859c163f73145092b1358..d473ff46df044a4db03b1bb694fb23e5bbf3ca3c 100644 (file)
@@ -48,7 +48,7 @@ import org.simantics.utils.datastructures.map.Tuple;
  */
 public class IssueDecorationStyle extends StyleBase<IssueResult> {
 
-    private static final String DECORATION_NODE_NAME = "issueDecorations";
+    private static final String DECORATION_NODE_NAME = "issueDecorations"; //$NON-NLS-1$
 
     private List<Resource> getContexts(ReadGraph graph, Resource element) throws DatabaseException {
 
@@ -93,11 +93,11 @@ public class IssueDecorationStyle extends StyleBase<IssueResult> {
     @Override
     public void applyStyleForNode(EvaluationContext observer, INode node, IssueResult result) {
         if (result == null) {
-            ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME);
+            ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$
             return;
         }
 
-        SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer);
+        SVGNode svgNode = ProfileVariables.claimChild(node, "", DECORATION_NODE_NAME, DecorationSVGNode.class, observer); //$NON-NLS-1$
 
         svgNode.setZIndex( Integer.MAX_VALUE );
         svgNode.setTransform(getDecorationPosition(node)); 
@@ -135,12 +135,12 @@ public class IssueDecorationStyle extends StyleBase<IssueResult> {
 
     @Override
     protected void cleanupStyleForNode(INode node) {
-        ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME);
+        ProfileVariables.denyChild(node, "", DECORATION_NODE_NAME); //$NON-NLS-1$
     }
 
     @Override
     public String toString() {
-        return "Issue decoration";
+        return "Issue decoration";  //$NON-NLS-1$
     }
     
     /**
index 57ae0b8c5433aca6038ad8f28db31f3d187cca44..002cffab9f67a402f65c0e1cb1b1b1cfc65c48e0 100644 (file)
@@ -41,9 +41,9 @@ import org.simantics.utils.datastructures.map.Tuple;
  */
 public class SymbolTerminalNameStyle extends StyleBase<SymbolNameResult> {
 
-    static final Font FONT = Font.decode("Arial 6");
+    static final Font FONT = Font.decode("Arial 6"); //$NON-NLS-1$
 
-    private static final String NODE_NAME = "terminalName";
+    private static final String NODE_NAME = "terminalName"; //$NON-NLS-1$
 
     /**
      * Must override the StyleBase implementation because terminals do not
@@ -88,7 +88,7 @@ public class SymbolTerminalNameStyle extends StyleBase<SymbolNameResult> {
     private AffineTransform getSymbolTransform(INode node, Vec2d offset, double size) {
        if(node instanceof SingleElementNode) {
                SingleElementNode s = (SingleElementNode)node;
-               INode symbol = NodeUtil.findChildByPrefix(s, "composite_image"); 
+               INode symbol = NodeUtil.findChildByPrefix(s, "composite_image");  //$NON-NLS-1$
                return translateAndScaleIfNeeded(symbol != null ? ((IG2DNode)symbol).getTransform() : new AffineTransform(), offset, size);
        }
        return null;
@@ -98,11 +98,11 @@ public class SymbolTerminalNameStyle extends StyleBase<SymbolNameResult> {
     public void applyStyleForNode(EvaluationContext observer, INode _node, SymbolNameResult result) {
        
         if (result == null) {
-            ProfileVariables.denyChild(_node, "", NODE_NAME);
+            ProfileVariables.denyChild(_node, "", NODE_NAME); //$NON-NLS-1$
             return;
         }
 
-        TextNode node = ProfileVariables.claimChild(_node, "", NODE_NAME, TextNode.class, observer);
+        TextNode node = ProfileVariables.claimChild(_node, "", NODE_NAME, TextNode.class, observer); //$NON-NLS-1$
 
         node.setZIndex( Integer.MAX_VALUE );
         node.setTransform( getSymbolTransform(_node, new Vec2d(0, -1), 0.08) ); 
@@ -115,7 +115,7 @@ public class SymbolTerminalNameStyle extends StyleBase<SymbolNameResult> {
 
     @Override
     protected void cleanupStyleForNode(INode node) {
-        ProfileVariables.denyChild(node, "", NODE_NAME);
+        ProfileVariables.denyChild(node, "", NODE_NAME); //$NON-NLS-1$
     }
 
 }
index d93264f4690486330d19f3ef84ec2b7973a2b291..f29167653f180539fd6ba76858ff47b42961fb63 100644 (file)
@@ -145,7 +145,7 @@ public class TypicalInheritanceStyle extends StyleBase<TypicalInheritanceResult>
             ShapeNode node = null;
 
             if (_node instanceof ParentNode<?>) {
-                node = ProfileVariables.claimChild(_node, "", "typical", DecorationShapeNode.class, context);
+                node = ProfileVariables.claimChild(_node, "", "typical", DecorationShapeNode.class, context); //$NON-NLS-1$ //$NON-NLS-2$
             } else {
                 // Ignore, cannot create decoration.
                 return;
@@ -225,8 +225,8 @@ public class TypicalInheritanceStyle extends StyleBase<TypicalInheritanceResult>
 
     @Override
     protected void cleanupStyleForNode(EvaluationContext context, INode node) {
-        ProfileVariables.denyChild(node, "*", "typical");
-        ProfileVariables.denyChild(node, "", "typical");
+        ProfileVariables.denyChild(node, "*", "typical"); //$NON-NLS-1$ //$NON-NLS-2$
+        ProfileVariables.denyChild(node, "", "typical"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
 }
index b24970ffd67a1b7cb5f1c26db62b09ad0399dee4..158a3af5404005b3c2dcfae81f6f98ffc66d0021 100644 (file)
@@ -34,7 +34,7 @@ public final class DefaultTerminalNamingStrategy implements TerminalNamingStrate
     public String getName(ReadGraph graph, TerminalInfo info) throws DatabaseException {
         Terminal t = graph.syncRequest(new ResolveTerminal(info));
         if (t == null)
-            return "Could not resolve component terminal";
+            return "Could not resolve component terminal"; //$NON-NLS-1$
         return graph.syncRequest(new TerminalMessage(t));
     }
 
@@ -90,12 +90,12 @@ public final class DefaultTerminalNamingStrategy implements TerminalNamingStrate
             if (name.equals(label)) {
                 sb.append(name);
             } else {
-                sb.append("(").append(name).append(") ").append(label);
+                sb.append("(").append(name).append(") ").append(label); //$NON-NLS-1$ //$NON-NLS-2$
             }
-            sb.append(" [").append(componentName);
+            sb.append(" [").append(componentName); //$NON-NLS-1$
             if (componentTypeName != null)
-                sb.append(" : ").append(componentTypeName);
-            sb.append("]");
+                sb.append(" : ").append(componentTypeName); //$NON-NLS-1$
+            sb.append("]"); //$NON-NLS-1$
 
             return sb.toString();
         }
index 60dc7f5991854a62706aadde0157b4d71cc50e76..ddba8ebfb322a9323b22bf08dd3bcca4eb7d8fd5 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExecutableExtension;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorInput;
@@ -84,7 +85,7 @@ public class DiagramEditor extends EditorPart implements IResourceEditorPart2, I
      * 
      * @see #setInitializationData(IConfigurationElement, String, Object)
      */
-    public static final String    ARG_VIEWER = "viewer";
+    public static final String    ARG_VIEWER = "viewer"; //$NON-NLS-1$
 
     private Composite             parent;
 
@@ -120,16 +121,16 @@ public class DiagramEditor extends EditorPart implements IResourceEditorPart2, I
         if (data instanceof String) {
             viewerContributor = cfig.getContributor().getName();
 
-            String[] parameters = ((String) data).split(";");
+            String[] parameters = ((String) data).split(";"); //$NON-NLS-1$
 
             for (String parameter : parameters) {
-                String[] keyValue = parameter.split("=");
+                String[] keyValue = parameter.split("="); //$NON-NLS-1$
                 if (keyValue.length > 2) {
-                    ErrorLogger.defaultLogWarning("Invalid parameter '" + parameter + ". Complete view argument: " + data, null);
+                    ErrorLogger.defaultLogWarning(NLS.bind(Messages.DiagramEditor_InvalidParameter, parameter, data), null); 
                     continue;
                 }
                 String key = keyValue[0];
-                String value = keyValue.length > 1 ? keyValue[1] : "";
+                String value = keyValue.length > 1 ? keyValue[1] : ""; //$NON-NLS-1$
 
                 if (ARG_VIEWER.equals(key)) {
                     viewerClassName = value;
@@ -141,25 +142,25 @@ public class DiagramEditor extends EditorPart implements IResourceEditorPart2, I
     protected DiagramViewer createViewer() throws PartInitException {
         if (viewerClassName == null)
             throw new PartInitException(
-                    "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '"
-                            + viewerContributor + "'");
+                    "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '" //$NON-NLS-1$
+                            + viewerContributor + "'"); //$NON-NLS-1$
 
         try {
             Bundle b = Platform.getBundle(viewerContributor);
             if (b == null)
-                throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '"
-                        + viewerContributor + "' was not found in the platform.");
+                throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '" //$NON-NLS-1$ //$NON-NLS-2$
+                        + viewerContributor + "' was not found in the platform."); //$NON-NLS-1$
 
             Class<?> clazz = b.loadClass(viewerClassName);
             if (!DiagramViewer.class.isAssignableFrom(clazz))
-                throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to "
-                        + DiagramViewer.class + ".");
+                throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to " //$NON-NLS-1$ //$NON-NLS-2$
+                        + DiagramViewer.class + "."); //$NON-NLS-1$
 
             Constructor<?> ctor = clazz.getConstructor();
             return (DiagramViewer) ctor.newInstance();
         } catch (Exception e) {
-            throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName
-                    + "' from bundle '" + viewerContributor + "'. See exception for details.", e);
+            throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName //$NON-NLS-1$
+                    + "' from bundle '" + viewerContributor + "'. See exception for details.", e); //$NON-NLS-1$ //$NON-NLS-2$
         }
     }
 
index 1632f32caa5c0d6e58d2d9ff15992ea2a7ab01bb..895c4bfa25e1afc89b97023ed5c99e36e903b99e 100644 (file)
@@ -73,15 +73,15 @@ import org.simantics.utils.ui.ISelectionUtils;
 
 public class DiagramLayersPage extends Page implements ILayersViewPage {
 
-    private static final String TEXT_APPLY_FOCUS_SETTINGS = "Focus Active";
-    private static final String TOOLTIP_APPLY_FOCUS_SETTINGS = "Only Focus Diagram Elements For Active Roles";
-    private static final String TEXT_IGNORE_FOCUS_SETTINGS = "Focus All";
-    private static final String TOOLTIP_IGNORE_FOCUS_SETTINGS = "Focus All Diagram Elements Regardless Of Active Roles";
+    private static final String TEXT_APPLY_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusActive;
+    private static final String TOOLTIP_APPLY_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusActiveTT;
+    private static final String TEXT_IGNORE_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusAll;
+    private static final String TOOLTIP_IGNORE_FOCUS_SETTINGS = Messages.DiagramLayersPage_FocusAllTT;
 
-    private static final String TEXT_APPLY_VISIBILITY_SETTINGS = "Show Active";
-    private static final String TOOLTIP_APPLY_VISIBILITY_SETTINGS = "Only Show Diagram Elements For Active Roles";
-    private static final String TEXT_IGNORE_VISIBILITY_SETTINGS = "Show All";
-    private static final String TOOLTIP_IGNORE_VISIBILITY_SETTINGS = "Show All Diagram Elements Regardless Of Active Roles";
+    private static final String TEXT_APPLY_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowActive;
+    private static final String TOOLTIP_APPLY_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowActiveTT;
+    private static final String TEXT_IGNORE_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowAll;
+    private static final String TOOLTIP_IGNORE_VISIBILITY_SETTINGS = Messages.DiagramLayersPage_ShowAllTT;
 
     final private ICanvasContext context;
     final private IDiagram diagram;
@@ -107,7 +107,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
         boolean toBoolean() {
             switch (this) {
                 case Both:
-                    throw new IllegalStateException("cannot convert Tristate Both to boolean");
+                    throw new IllegalStateException("cannot convert Tristate Both to boolean"); //$NON-NLS-1$
                 case False:
                     return false;
                 case True:
@@ -305,8 +305,8 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
         GridLayoutFactory.fillDefaults().numColumns(4).applyTo(composite);
 
         Button addButton = new Button(composite, SWT.NONE);
-        addButton.setText("New");
-        addButton.setToolTipText("Create New Diagram Role");
+        addButton.setText(Messages.DiagramLayersPage_New);
+        addButton.setToolTipText(Messages.DiagramLayersPage_NewTT);
         addButton.addSelectionListener(new SelectionListener() {
 
             String findFreshName(ILayers layers, String proposal) {
@@ -324,13 +324,13 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
                     if (!match)
                         return name;
                     ++i;
-                    name = proposal + " " + i;
+                    name = proposal + " " + i; //$NON-NLS-1$
                 }
             }
 
             @Override
             public void widgetSelected(SelectionEvent e) {
-                String name = findFreshName(layers, "New Role");
+                String name = findFreshName(layers, Messages.DiagramLayersPage_NewRole);
                 SimpleLayer layer = new SimpleLayer(name);
                 layers.addLayer(layer);
                 layers.activate(layer);
@@ -344,8 +344,8 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
         });
 
         final Button removeButton = new Button(composite, SWT.NONE);
-        removeButton.setText("Remove");
-        removeButton.setToolTipText("Remove Selected Diagram Role");
+        removeButton.setText(Messages.DiagramLayersPage_Remove);
+        removeButton.setToolTipText(Messages.DiagramLayersPage_RemoveTT);
         removeButton.addSelectionListener(new SelectionListener() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -475,19 +475,19 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
         viewer = new CheckboxTreeViewer(composite, SWT.BORDER | SWT.FULL_SELECTION );
 
         GridDataFactory.fillDefaults().grab(true, true).span(4, 1).applyTo(viewer.getControl());
-        viewer.getControl().setToolTipText("Selects the diagram to include in the exported document.");
+        viewer.getControl().setToolTipText(Messages.DiagramLayersPage_SelectTT);
         viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
         viewer.getTree().setHeaderVisible(true);
         editor = new TreeEditor(viewer.getTree());
 
         final TreeColumn column1 = new TreeColumn(viewer.getTree(), SWT.LEFT);
-        column1.setText("Role");
+        column1.setText(Messages.DiagramLayersPage_Role);
         column1.setWidth(100);
         final TreeColumn column2 = new TreeColumn(viewer.getTree(), SWT.LEFT);
-        column2.setText("Show");
+        column2.setText(Messages.DiagramLayersPage_Show);
         column2.setWidth(50);
         final TreeColumn column3 = new TreeColumn(viewer.getTree(), SWT.LEFT);
-        column3.setText("Focus");
+        column3.setText(Messages.DiagramLayersPage_Focus);
         column3.setWidth(50);
         viewer.getTree().addListener(SWT.Resize, new Listener() {
             @Override
@@ -551,7 +551,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
                     // FIXME: Eclipse currently eats F2 presses. This should be
                     // implemented as a command handler or find some way to
                     // force these listeners to have priority...
-                    System.out.println("startediting");
+                    System.out.println("startediting"); //$NON-NLS-1$
 
                     TreeItem[] items = viewer.getTree().getSelection();
                     if(items.length != 1)
@@ -685,7 +685,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
                     ILayer layer  = (ILayer)cell.getElement();
                     cell.setText(layer.getName());
                 } else {
-                    cell.setText("");
+                    cell.setText(""); //$NON-NLS-1$
                 }
             }
         });
@@ -761,7 +761,7 @@ public class DiagramLayersPage extends Page implements ILayersViewPage {
                         if(layer instanceof IEditableLayer) {
                             IEditableLayer l = (IEditableLayer)layer;
                             l.setName(text.getText());
-                            System.out.println("renamed layer to " + text.getText());
+                            System.out.println("renamed layer to " + text.getText()); //$NON-NLS-1$
                             viewer.refresh();
                         }
 
index 289df6b888f754cd10ae10836cd72089701e032b..8e677695624e709e601f77a70e10be0d34bf7ffa 100644 (file)
@@ -97,7 +97,7 @@ public class DiagramOutlinePage extends Page implements IContentOutlinePage, IPo
         this.explorer = GraphExplorerFactory.getInstance().selectionDataResolver(new DefaultSelectionDataResolver()).create(composite);
                Control control = explorer.getControl();
         ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);
-        new ContextMenuInitializer("#GraphExplorerPopup").createContextMenu(control, selectionProvider, getSite());
+        new ContextMenuInitializer("#GraphExplorerPopup").createContextMenu(control, selectionProvider, getSite()); //$NON-NLS-1$
         GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
 
         // Consider ENTER presses to simulate mouse left button double clicks
@@ -223,7 +223,7 @@ public class DiagramOutlinePage extends Page implements IContentOutlinePage, IPo
 
     static class LinkWithEditor extends LinkWithEditorContribution {
         public LinkWithEditor() {
-            super("DiagramOutlinePage.linkWithEditor", Activator.getDefault().getPreferenceStore());
+            super("DiagramOutlinePage.linkWithEditor", Activator.getDefault().getPreferenceStore()); //$NON-NLS-1$
         }
     }
 
index 92d46e160e8f91347dee82da58c2698e5a7ba198..e773a7a639b181cd46c1cce60d2794eae9c9dc52 100644 (file)
@@ -184,8 +184,8 @@ public class DiagramViewer
         void doSetTitleToolTip(String name);
     }
 
-    public static final String                     DIAGRAMMING_CONTEXT      = "org.simantics.modeling.ui.diagramming";
-    private static final String                     PREFERENCE_VIRTUAL_GRAPH = "preferences";
+    public static final String                     DIAGRAMMING_CONTEXT      = "org.simantics.modeling.ui.diagramming"; //$NON-NLS-1$
+    private static final String                     PREFERENCE_VIRTUAL_GRAPH = "preferences"; //$NON-NLS-1$
 
     private static final boolean                    PROFILE                  = false;
 
@@ -348,7 +348,7 @@ public class DiagramViewer
         try {
             return BrowseContext.getBrowseContextClosure(Simantics.getSession(), defaultPropertyBrowseContexts);
         } catch (DatabaseException e) {
-            ExceptionUtils.logAndShowError("Failed to load modeled browse contexts for property page, see exception for details.", e);
+            ExceptionUtils.logAndShowError(Messages.DiagramViewer_FailedtoLoadModeled, e);
             return defaultPropertyBrowseContexts;
         }
     }
@@ -358,7 +358,7 @@ public class DiagramViewer
     }
 
     protected String getPopupId() {
-        return "#ModelingDiagramPopup";
+        return "#ModelingDiagramPopup"; //$NON-NLS-1$
     }
 
     protected void getPreferences() {
@@ -422,7 +422,7 @@ public class DiagramViewer
         resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
         c = new SWTChassis(parent, 0);
 
-        Object task = BEGIN("DV.precreateParticipants");
+        Object task = BEGIN("DV.precreateParticipants"); //$NON-NLS-1$
         createCustomParticipants();
         END(task);
 
@@ -464,7 +464,7 @@ public class DiagramViewer
         swt = SWTThread.getThreadAccess(display);
         statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
 
-        Object task = BEGIN("DV.initSession");
+        Object task = BEGIN("DV.initSession"); //$NON-NLS-1$
         initSession();
         END(task);
 
@@ -483,7 +483,7 @@ public class DiagramViewer
             this.canvasContext = new CanvasContext(thread);
             this.canvasContext.setLocked(true);
 
-            task = BEGIN("DV.createChassis");
+            task = BEGIN("DV.createChassis"); //$NON-NLS-1$
             createChassis(parent);
             END(task);
         } catch (DatabaseException e) {
@@ -513,9 +513,9 @@ public class DiagramViewer
      * Invoke this only from the AWT thread.
      */
     protected void initializeCanvas() {
-        Object canvasInit = BEGIN("DV.canvasInitialization");
+        Object canvasInit = BEGIN("DV.canvasInitialization"); //$NON-NLS-1$
 
-        Object task = BEGIN("DV.createViewerCanvas");
+        Object task = BEGIN("DV.createViewerCanvas"); //$NON-NLS-1$
         initializeCanvasContext(canvasContext);
         END(task);
 
@@ -532,7 +532,7 @@ public class DiagramViewer
         canvasContext.getHintStack().addKeyHintListener(GridPainter.KEY_GRID_ENABLED, canvasHintListener);
         canvasContext.getHintStack().addKeyHintListener(RulerPainter.KEY_RULER_ENABLED, canvasHintListener);
 
-        task = BEGIN("DV.setCanvasContext");
+        task = BEGIN("DV.setCanvasContext"); //$NON-NLS-1$
         setCanvasContext(canvasContext);
         END(task);
 
@@ -557,7 +557,7 @@ public class DiagramViewer
      *        cancelled.
      */
     protected void performActivation(IProgressMonitor monitor) {
-        SubMonitor progress = SubMonitor.convert(monitor, "Activate Mapping", 100);
+        SubMonitor progress = SubMonitor.convert(monitor, Messages.DiagramViewer_MonitorActivateMapping, 100);
         IActivationManager activationManager = sessionContext.getSession().peekService(IActivationManager.class);
         if (activationManager != null) {
             activation = activationManager.activate(diagramResource);
@@ -573,7 +573,7 @@ public class DiagramViewer
      */
     protected void scheduleZoomToFit(IDiagram diagram) {
         if (diagram == null)
-            throw new IllegalStateException("diagram is null");
+            throw new IllegalStateException("diagram is null"); //$NON-NLS-1$
 
         CanvasUtils.scheduleZoomToFit(swt, () -> disposed, canvasContext, diagram);
     }
@@ -664,7 +664,7 @@ public class DiagramViewer
                 }
             });
         } catch (DatabaseException e) {
-            throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e);
+            throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$
         }
     }
 
@@ -691,7 +691,7 @@ public class DiagramViewer
         // unnecessary visual glitches.
         h.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE);
 
-        Object task = BEGIN("createSynchronizer");
+        Object task = BEGIN("createSynchronizer"); //$NON-NLS-1$
         this.synchronizer = createSynchronizer(ctx, sessionContext);
         END(task);
 
@@ -807,7 +807,7 @@ public class DiagramViewer
                 }
             }, parameter -> {
                 if (parameter != null)
-                    ErrorLogger.defaultLogError("Failed to write default diagram page description to database, see exception for details", parameter);
+                    ErrorLogger.defaultLogError("Failed to write default diagram page description to database, see exception for details", parameter); //$NON-NLS-1$
             });
         }
 
@@ -833,7 +833,7 @@ public class DiagramViewer
 
     protected void setDiagramDesc(ICanvasContext ctx, DiagramDesc diagramDesc) {
         if (diagramDesc == null)
-            throw new NullPointerException("null diagram desc");
+            throw new NullPointerException("null diagram desc"); //$NON-NLS-1$
 
         if (diagramDesc.equals(this.diagramDesc))
             return;
@@ -949,7 +949,7 @@ public class DiagramViewer
 
     public void init(DiagramViewerHost _host, IEditorSite site, IEditorInput input, DataContainer<IDiagram> diagramContainer, WorkbenchSelectionProvider selectionProvider) {
         if (!(input instanceof IResourceEditorInput))
-            throw new RuntimeException("Invalid input: must be IResourceEditorInput");
+            throw new RuntimeException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$
 
         setHost(_host);
         setSite(site);
@@ -991,7 +991,7 @@ public class DiagramViewer
             try {
                 return (T) DiagramTypeUtils.readSymbolProviderFactory(sessionContext.getSession(), diagramResource);
             } catch (DatabaseException e) {
-                ErrorLogger.defaultLogError(getClass() + " failed to adapt to SymbolProviderFactory, see exception for details.", e);
+                ErrorLogger.defaultLogError(getClass() + " failed to adapt to SymbolProviderFactory, see exception for details.", e); //$NON-NLS-1$
                 return null;
             }
         }
index 62783b655224363d201ec30105e89dfb73cccca3..8cb4f52c189d534c66a1564b23a21c2f973e23e3 100644 (file)
@@ -84,24 +84,24 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor {
 
     @Override
     public void contributeToCoolBar(ICoolBarManager coolBarManager) {
-        IContributionItem item = coolBarManager.find("org.simantics.modeling.ui.diagramtoolbar");
+        IContributionItem item = coolBarManager.find("org.simantics.modeling.ui.diagramtoolbar"); //$NON-NLS-1$
         if (item instanceof ToolBarContributionItem)
             mgr = ((ToolBarContributionItem) item).getToolBarManager();
         if (mgr == null)
             return;
 
-        pointerAction = new ModeAction("org.simantics.modeling.ui.pointerMode", Hints.POINTERTOOL);
-        pointerAction.setText("Pointer Mode");
+        pointerAction = new ModeAction("org.simantics.modeling.ui.pointerMode", Hints.POINTERTOOL); //$NON-NLS-1$
+        pointerAction.setText(Messages.DiagramViewerActionContributor_PointerMode);
         pointerAction.setImageDescriptor(Activator.POINTER_MODE);
-        connectAction = new ModeAction("org.simantics.modeling.ui.connectMode", Hints.CONNECTTOOL);
-        connectAction.setText("Connect Mode");
+        connectAction = new ModeAction("org.simantics.modeling.ui.connectMode", Hints.CONNECTTOOL); //$NON-NLS-1$
+        connectAction.setText(Messages.DiagramViewerActionContributor_ConnectMode);
         connectAction.setImageDescriptor(Activator.CONNECT_MODE);
 
         pointerItem = new ActionContributionItem(pointerAction);
         connectItem = new ActionContributionItem(connectAction);
 
-        mgr.appendToGroup("tool.additions", pointerItem);
-        mgr.appendToGroup("tool.additions", connectItem);
+        mgr.appendToGroup("tool.additions", pointerItem); //$NON-NLS-1$
+        mgr.appendToGroup("tool.additions", connectItem); //$NON-NLS-1$
         mgr.markDirty();
 
         getPage().addPartListener(partListener);
@@ -131,7 +131,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor {
 
     public void setActiveEditor(IEditorPart part) {
         if (DEBUG)
-            System.out.println("setActiveEditor: " + part);
+            System.out.println("setActiveEditor: " + part); //$NON-NLS-1$
         if (part == activePart)
             return;
 
@@ -146,7 +146,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor {
 
     private void setContext(IEditorPart part, ICanvasContext context) {
         if (DEBUG)
-            System.out.println("setContext: " + part + "\nNEW CONTEXT: " + context + "\nPREVIOUS CONTEXT: " + currentContext);
+            System.out.println("setContext: " + part + "\nNEW CONTEXT: " + context + "\nPREVIOUS CONTEXT: " + currentContext); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
         ICanvasContext previous = currentContext;
         currentContext = context;
@@ -165,7 +165,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor {
 
     private void updateActionBars(IEditorPart part, IToolMode toolMode) {
         if (DEBUG)
-            System.out.println("updateActionBars: " + part + ", " + toolMode);
+            System.out.println("updateActionBars: " + part + ", " + toolMode); //$NON-NLS-1$ //$NON-NLS-2$
         updateToolMode(toolMode);
         if (part != null)
             part.getEditorSite().getActionBars().updateActionBars();
@@ -173,7 +173,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor {
 
     private void updateToolMode(IToolMode toolMode) {
         if (DEBUG)
-            System.out.println("updateToolMode: " + toolMode);
+            System.out.println("updateToolMode: " + toolMode); //$NON-NLS-1$
         if (toolMode != null) {
             pointerAction.setEnabled(true);
             connectAction.setEnabled(true);
@@ -238,7 +238,7 @@ public class DiagramViewerActionContributor extends EditorActionBarContributor {
                     IToolMode toolMode = context.getHintStack().getHint(Hints.KEY_TOOL);
                     if (!targetMode.equals(toolMode)) {
                         if (DEBUG)
-                            System.out.println("changing tool mode to " + targetMode.getId());
+                            System.out.println("changing tool mode to " + targetMode.getId()); //$NON-NLS-1$
                         context.getDefaultHintContext().setHint(Hints.KEY_TOOL, targetMode);
                     }
                 }
index 85f0dbbe7b432f35548a38488fa30491407036a9..62b1d028f8db6fb2004e8222010e04e29febe9e2 100644 (file)
@@ -31,17 +31,17 @@ public class DiagramViewerLoadJob extends DatabaseJob {
     private DiagramViewer        viewer;
 
     public DiagramViewerLoadJob(DiagramViewer viewer) {
-        super("Load Diagram");
+        super(Messages.DiagramViewerLoadJob_LoadDiagram);
         setUser(true);
         this.viewer = viewer;
     }
 
     @Override
     protected IStatus run(final IProgressMonitor monitor) {
-        final SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 200);
+        final SubMonitor mon = SubMonitor.convert(monitor, Messages.DiagramViewerLoadJob_MonitorLoadingDiagram, 200);
 
         try {
-            Object task = BEGIN("DV.loadDiagram");
+            Object task = BEGIN("DV.loadDiagram"); //$NON-NLS-1$
             final IDiagram diagram = viewer.loadDiagram(mon.newChild(100), viewer.diagramResource);
             if (diagram == null)
                 return Status.CANCEL_STATUS;
@@ -49,7 +49,7 @@ public class DiagramViewerLoadJob extends DatabaseJob {
 
             // Start an activation for the input resource.
             // This will activate mapping if necessary.
-            task = BEGIN("DV.performActivation");
+            task = BEGIN("DV.performActivation"); //$NON-NLS-1$
             viewer.performActivation(mon.newChild(50));
             END(task);
 
@@ -58,16 +58,16 @@ public class DiagramViewerLoadJob extends DatabaseJob {
                 @Override
                 public void run() {
                     setThread(viewer.canvasContext.getThreadAccess().getThread());
-                    mon.setTaskName("Finalize Diagram Loading");
+                    mon.setTaskName(Messages.DiagramViewerLoadJob_MonitorFinalizeDiagramLoading);
 
                     try {
-                        Object task = BEGIN("DV.beforeSetDiagram");
+                        Object task = BEGIN("DV.beforeSetDiagram"); //$NON-NLS-1$
                         viewer.beforeSetDiagram(diagram);
                         mon.worked(10);
                         END(task);
 
-                        task = BEGIN("DV.setDiagramHint");
-                        mon.subTask("Set Diagram");
+                        task = BEGIN("DV.setDiagramHint"); //$NON-NLS-1$
+                        mon.subTask(Messages.DiagramViewerLoadJob_SetDiagram);
                         DataContainer<IDiagram> diagramContainer = viewer.sourceDiagramContainer;
                         if (diagramContainer != null)
                             diagramContainer.set( diagram );
@@ -79,24 +79,24 @@ public class DiagramViewerLoadJob extends DatabaseJob {
                        viewer.selectionProvider.fireSelection(Collections.emptyList());
                         
                         // Zoom to fit if no previous view transform is available
-                        task = BEGIN("DV.scheduleZoomToFit");
+                        task = BEGIN("DV.scheduleZoomToFit"); //$NON-NLS-1$
                         viewer.scheduleZoomToFit(diagram);
                         mon.worked(10);
                         END(task);
 
-                        task = BEGIN("DV.onCreated");
-                        mon.subTask("");
+                        task = BEGIN("DV.onCreated"); //$NON-NLS-1$
+                        mon.subTask(""); //$NON-NLS-1$
                         viewer.onCreated();
                         mon.worked(10);
                         END(task);
 
-                        task = BEGIN("DV.applyEditorState");
-                        mon.subTask("Apply editor state");
+                        task = BEGIN("DV.applyEditorState"); //$NON-NLS-1$
+                        mon.subTask(Messages.DiagramViewerLoadJob_ApplyEditorState);
                         viewer.applyEditorState(viewer.editorState, viewer.canvasContext);
                         mon.worked(10);
                         END(task);
 
-                        task = BEGIN("DV.activateUiContexts");
+                        task = BEGIN("DV.activateUiContexts"); //$NON-NLS-1$
                         viewer.contextUtil.inContextThread(new Runnable() {
                             @Override
                             public void run() {
@@ -116,11 +116,11 @@ public class DiagramViewerLoadJob extends DatabaseJob {
         } catch (CancelTransactionException e) {
             monitor.done();
             viewer = null;
-            return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, "Diagram loading was cancelled.", e);
+            return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, Messages.DiagramViewerLoadJob_ActivatorDiagramLoadingCancelled, e);
         } catch (Throwable t) {
             monitor.done();
             viewer = null;
-            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Diagram loading failed, see exception for details.", t);
+            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.DiagramViewerLoadJob_ActivatorDiagramLoadingFailed, t);
         }
     }
 
index f1493e4cca5a5952e78c0155a548b7110f4a0758..b7ea5ac78a1efff4769b267fdaa7ddf565cdea41 100644 (file)
@@ -163,7 +163,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider {
                                if (resource != null) {
                                        objects.add( constructSelectionElement(runtime, resource) );
                                } else {
-                                       System.out.println("  unrecognized selection: " + o.getClass() + ": " + o);
+                                       System.out.println("  unrecognized selection: " + o.getClass() + ": " + o); //$NON-NLS-1$ //$NON-NLS-2$
                                }
                        }
                        if (objects.isEmpty() && runtime != null && dr != null) {
index b1778a3420cabe8b93259d9935f070761890a27e..db7e2571dde5b8e8bd0cc28e5b55e2be11a8d04a 100644 (file)
@@ -27,7 +27,7 @@ public class DisposingPolicy {
             currentlyScheduled = null;
             runnable.run();
             if(DEBUG)
-                System.out.println("Executed disposer " + runnable);
+                System.out.println("Executed disposer " + runnable); //$NON-NLS-1$
             if(!disposerQueue.isEmpty())
                 scheduleDispose();
         }
@@ -54,7 +54,7 @@ public class DisposingPolicy {
                 MIN_DELAY);
         Display.getCurrent().timerExec((int)delay, disposeOne);
         if(DEBUG)
-            System.out.println("Scheduled disposer " + currentlyScheduled + " in " + delay + " ms");
+            System.out.println("Scheduled disposer " + currentlyScheduled + " in " + delay + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
     /**
@@ -65,7 +65,7 @@ public class DisposingPolicy {
      */
     public void addDisposer(Runnable disposer) {
         if(DEBUG)
-            System.out.println("Added disposer " + disposer);
+            System.out.println("Added disposer " + disposer); //$NON-NLS-1$
         if(disposeTime.contains(disposer))
             return;
         if(disposerQueue.size() >= maxQueueLength)
@@ -82,7 +82,7 @@ public class DisposingPolicy {
      */
     public void removeDisposer(Runnable disposer) {
         if(DEBUG)
-            System.out.println("Removed disposer " + disposer);
+            System.out.println("Removed disposer " + disposer); //$NON-NLS-1$
         disposerQueue.remove(disposer);
         disposeTime.remove(disposer);
         if(disposer == currentlyScheduled) {
index 6a58dac08137d89d7ef25f4a34f42790fb65d710..970fbc650dd4f32cc788506bc6e0235783cb0305 100644 (file)
@@ -3,14 +3,52 @@ package org.simantics.modeling.ui.diagramEditor;
 import org.eclipse.osgi.util.NLS;
 
 public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagramEditor.messages"; //$NON-NLS-1$
-    public static String        PopulateElementDropParticipant_PreDropFixesFailed;
-    public static String        PopulateElementDropParticipant_PreDropFixesFailed_Title;
-    static {
-        // initialize resource bundle
-        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagramEditor.messages"; //$NON-NLS-1$
+       public static String DiagramEditor_InvalidParameter;
+       public static String DiagramLayersPage_FocusActive;
+       public static String DiagramLayersPage_FocusActiveTT;
+       public static String DiagramLayersPage_Focus;
+       public static String DiagramLayersPage_FocusAll;
+       public static String DiagramLayersPage_FocusAllTT;
+       public static String DiagramLayersPage_New;
+       public static String DiagramLayersPage_NewRole;
+       public static String DiagramLayersPage_NewTT;
+       public static String DiagramLayersPage_Remove;
+       public static String DiagramLayersPage_RemoveTT;
+       public static String DiagramLayersPage_Role;
+       public static String DiagramLayersPage_SelectTT;
+       public static String DiagramLayersPage_ShowActive;
+       public static String DiagramLayersPage_ShowActiveTT;
+       public static String DiagramLayersPage_Show;
+       public static String DiagramLayersPage_ShowAll;
+       public static String DiagramLayersPage_ShowAllTT;
+       public static String DiagramViewer_FailedtoLoadModeled;
+       public static String DiagramViewer_MonitorActivateMapping;
+       public static String DiagramViewerActionContributor_ConnectMode;
+       public static String DiagramViewerActionContributor_PointerMode;
+       public static String DiagramViewerLoadJob_ActivatorDiagramLoadingCancelled;
+       public static String DiagramViewerLoadJob_ActivatorDiagramLoadingFailed;
+       public static String DiagramViewerLoadJob_ApplyEditorState;
+       public static String DiagramViewerLoadJob_LoadDiagram;
+       public static String DiagramViewerLoadJob_MonitorFinalizeDiagramLoading;
+       public static String DiagramViewerLoadJob_MonitorLoadingDiagram;
+       public static String DiagramViewerLoadJob_SetDiagram;
+       public static String OpenDiagramAdapter_DiagramEditor;
+       public static String OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference;
+       public static String OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent;
+       public static String OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList;
+       public static String OpenDiagramFromConfigurationAdapter_DiagramEditor;
+       public static String OpenDiagramFromIssue_OpenDiagramRefComponent;
+       public static String OpenDiagramFromSymbolAdapter_SymbolEditor;
+       public static String OpenSheetAdapter_SpreadsheetEditor;
+       public static String PopulateElementDropParticipant_PreDropFixesFailed;
+       public static String PopulateElementDropParticipant_PreDropFixesFailed_Title;
+       public static String SheetViewer_MonitorLoadingDiagram;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
 
-    private Messages() {
-    }
+       private Messages() {
+       }
 }
index fb3716f98e9c441d6dd48a578db625df3ba5dd31..ab41cca82191d10d12a019243273440b1df523eb 100644 (file)
@@ -32,10 +32,10 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
  */
 public class OpenDiagramAdapter extends AbstractResourceEditorAdapter {
 
-    private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor";
+    private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor"; //$NON-NLS-1$
 
     public OpenDiagramAdapter() {
-        super("Diagram Editor", Activator.COMPOSITE_ICON);
+        super(Messages.OpenDiagramAdapter_DiagramEditor, Activator.COMPOSITE_ICON);
     }
 
     protected String getEditorId() {
index e015796c712fe56c44eef4b40af27c0ef794e5e9..d5071303e4924b22a3f812f05b312141d03a5ed1 100644 (file)
@@ -57,10 +57,10 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
 
     private static final Logger LOGGER = LoggerFactory.getLogger(OpenDiagramFromComponentAdapter.class);
 
-    private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor";
+    private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; //$NON-NLS-1$
 
     public OpenDiagramFromComponentAdapter() {
-        super("Open Diagram Containing This Component", Activator.SYMBOL_ICON);
+        super(Messages.OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent, Activator.SYMBOL_ICON);
     }
 
     @Override
@@ -76,7 +76,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
     private Pair<Resource, String> tryGetResource(ReadGraph graph, Object input) throws DatabaseException {
         Resource r = ResourceAdaptionUtils.toSingleResource(input);
         if (r != null)
-            return Pair.make(r, "");
+            return Pair.make(r, ""); //$NON-NLS-1$
         Variable v = AdaptionUtils.adaptToSingle(input, Variable.class);
         return findResource(graph, v);
     }
@@ -86,20 +86,20 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
         while (v != null) {
             Resource r = v.getPossibleRepresents(graph);
             if (r != null) {
-                String rvi = "";
+                String rvi = ""; //$NON-NLS-1$
                 if (path != null) {
                     int pathLength = path.size();
                     for (int i = 0; i < pathLength; i++)
                         path.set(i, URIStringUtils.escape(path.get(i)));
                     Collections.reverse(path);
-                    rvi = EString.implode(path, "/");
+                    rvi = EString.implode(path, "/"); //$NON-NLS-1$
                 }
                 return Pair.make(r, rvi);
             }
             if (path == null)
                 path = new ArrayList<>(2);
             path.add( v.getName(graph) );
-            v = v.browsePossible(graph, ".");
+            v = v.browsePossible(graph, "."); //$NON-NLS-1$
         }
         return null;
     }
@@ -120,9 +120,9 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
                 Variable v = AdaptionUtils.adaptToSingle(input, Variable.class);
 
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent resource URI: " + NameUtils.getURIOrSafeNameInternal(graph, r.first));
-                    LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent RVI: " + r.second);
-                    LOGGER.debug(getClass().getSimpleName() + ".openEditor: input variable URI: " + (v != null ? v.getURI(graph) : "null"));
+                    LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent resource URI: " + NameUtils.getURIOrSafeNameInternal(graph, r.first)); //$NON-NLS-1$
+                    LOGGER.debug(getClass().getSimpleName() + ".openEditor: input's nearest parent RVI: " + r.second); //$NON-NLS-1$
+                    LOGGER.debug(getClass().getSimpleName() + ".openEditor: input variable URI: " + (v != null ? v.getURI(graph) : "null")); //$NON-NLS-1$ //$NON-NLS-2$
                 }
 
                 final Collection<Runnable> rs = tryFindDiagram(graph, r.first, v, r.second);
@@ -154,16 +154,16 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
             Resource diagram = ComponentUtils.getPossibleCompositeDiagram(g, composite);
 
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: component: " + NameUtils.getURIOrSafeNameInternal(g, component));
-                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: composite: " + NameUtils.getURIOrSafeNameInternal(g, composite));
+                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: component: " + NameUtils.getURIOrSafeNameInternal(g, component)); //$NON-NLS-1$
+                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: composite: " + NameUtils.getURIOrSafeNameInternal(g, composite)); //$NON-NLS-1$
             }
 
             Collection<Resource> referenceElements = diagram == null ? g.getObjects(component, MOD.HasParentComponent_Inverse) : Collections.<Resource>emptyList();
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: diagram: " + NameUtils.getURIOrSafeNameInternal(g, diagram));
-                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: referenceElements: " + referenceElements.size());
+                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: diagram: " + NameUtils.getURIOrSafeNameInternal(g, diagram)); //$NON-NLS-1$
+                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: referenceElements: " + referenceElements.size()); //$NON-NLS-1$
                 for (Object object : referenceElements)
-                    LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object));
+                    LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); //$NON-NLS-1$
             }
             if (diagram == null && referenceElements.isEmpty())
                 return Collections.emptyList();
@@ -175,7 +175,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
             if (indexRoot == null)
                 return Collections.emptyList();
             if (LOGGER.isDebugEnabled())
-                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: Model: " + indexRoot);
+                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: Model: " + indexRoot); //$NON-NLS-1$
 
             if (diagram != null) {
                 if(OpenDiagramFromConfigurationAdapter.isLocked(g, diagram))
@@ -192,23 +192,23 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
                         if (parent != null) {
                             rvi = parent.getPossibleRVI(g);
                             if (LOGGER.isDebugEnabled())
-                                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI: " + rvi);
+                                LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI: " + rvi); //$NON-NLS-1$
                         }
                     }
                 } else {
                     allowNullRvi = true;
                     rvi = compositeVariable.getPossibleRVI(g);
                     if (LOGGER.isDebugEnabled())
-                        LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI from resource path: " + rvi);
+                        LOGGER.debug(getClass().getSimpleName() + ".findDiagram: resolved RVI from resource path: " + rvi); //$NON-NLS-1$
                 }
                 if (rvi == null && !allowNullRvi)
                     return Collections.emptyList();
 
                 Collection<Object> selectedObjects = findElementObjects(g, component, rviFromComponent);
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + selectedObjects.size());
+                    LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + selectedObjects.size()); //$NON-NLS-1$
                     for (Object object : selectedObjects)
-                        LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object));
+                        LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, (Resource) object)); //$NON-NLS-1$
                 }
                 // Prevent diagram from opening if there's nothing to select
                 // on the diagram based on the received input.
@@ -218,11 +218,11 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
                 final MapSet<NamedResource, Resource> referencingDiagrams = listReferenceDiagrams(g, referenceElements);
                 final Set<NamedResource> diagrams = referencingDiagrams.getKeys();
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + diagrams.size());
+                    LOGGER.debug(getClass().getSimpleName() + ".findDiagram: selected objects: " + diagrams.size()); //$NON-NLS-1$
                     for (NamedResource d : diagrams) {
-                        LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, d.getResource()) + ":");
+                        LOGGER.debug("\t" + NameUtils.getURIOrSafeNameInternal(g, d.getResource()) + ":"); //$NON-NLS-1$ //$NON-NLS-2$
                         for (Resource referenceElement : referencingDiagrams.getValues(d)) {
-                            LOGGER.debug("\t\t" + NameUtils.getURIOrSafeNameInternal(g, referenceElement));
+                            LOGGER.debug("\t\t" + NameUtils.getURIOrSafeNameInternal(g, referenceElement)); //$NON-NLS-1$
                         }
                     }
                 }
@@ -299,7 +299,7 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
         while (v != null) {
             Resource represents = v.getPossibleRepresents(graph);
             if (LOGGER.isDebugEnabled())
-                LOGGER.debug(v.getURI(graph) + " -> " + NameUtils.getURIOrSafeNameInternal(graph, represents));
+                LOGGER.debug(v.getURI(graph) + " -> " + NameUtils.getURIOrSafeNameInternal(graph, represents)); //$NON-NLS-1$
             if (represents != null)
                 return v;
             v = v.getParent(graph);
@@ -364,8 +364,8 @@ public class OpenDiagramFromComponentAdapter extends AbstractResourceEditorAdapt
     protected NamedResource queryTarget(final Shell parentShell, Collection<NamedResource> options) {
         NavigationTargetChooserDialog dialog = new NavigationTargetChooserDialog(
                 parentShell, options.toArray(new NamedResource[options.size()]),
-                "Choose Diagram with Component Reference",
-                "Select single diagram from list");
+                Messages.OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference,
+                Messages.OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList);
         return dialog.open() != Window.OK ? null : dialog.getSelection();
     }
 
index 1ba559e563245878643c2aa06927b3471e6640b8..8c052561e2340ed051d5989836742d0684083e0f 100644 (file)
@@ -42,10 +42,10 @@ import org.simantics.utils.threads.ThreadUtils;
  */
 public class OpenDiagramFromConfigurationAdapter extends AbstractResourceEditorAdapter {
 
-    private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor";
+    private static final String EDITOR_ID = "org.simantics.modeling.ui.diagramEditor"; //$NON-NLS-1$
 
     public OpenDiagramFromConfigurationAdapter() {
-        super("Diagram Editor", Activator.COMPOSITE_ICON);
+        super(Messages.OpenDiagramFromConfigurationAdapter_DiagramEditor, Activator.COMPOSITE_ICON);
     }
 
     protected String getEditorId() {
index 9214082f24079d2ced9ffcbe8bf355172d47e9e0..7bb39804c431109706ad71fe49fd1dc15548017e 100644 (file)
@@ -45,10 +45,10 @@ import org.simantics.utils.ui.ISelectionUtils;
  */
 public class OpenDiagramFromIssue extends AbstractResourceEditorAdapter {
 
-    private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor";
+    private static final String EDITOR_ID = "org.simantics.modeling.ui.plainDiagramEditor"; //$NON-NLS-1$
 
     public OpenDiagramFromIssue() {
-        super("Open Diagram Containing Referenced Component", Activator.COMPOSITE_ICON);
+        super(Messages.OpenDiagramFromIssue_OpenDiagramRefComponent, Activator.COMPOSITE_ICON);
     }
 
     protected String getEditorId(ReadGraph g, Resource diagram) throws DatabaseException {
@@ -157,7 +157,7 @@ public class OpenDiagramFromIssue extends AbstractResourceEditorAdapter {
     }
 
     protected static Collection<Object> findElementObjects(ReadGraph g, Resource component) throws DatabaseException {
-        Collection<Object> result = findElementObjects(g, component, "");
+        Collection<Object> result = findElementObjects(g, component, ""); //$NON-NLS-1$
         ModelingResources MOD = ModelingResources.getInstance(g);
         for (Resource element : g.getObjects(component, MOD.HasParentComponent_Inverse))
             result.add(element);
index 8739f904f1440292433e910ccc2a233a8d59a68a..3847344360871ff910ceb77b6d17018c3c9e7243 100644 (file)
@@ -36,10 +36,10 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
  */
 public class OpenDiagramFromSymbolAdapter extends AbstractResourceEditorAdapter {
 
-    private static final String EDITOR_ID = "org.simantics.modeling.ui.symbolEditor";
+    private static final String EDITOR_ID = "org.simantics.modeling.ui.symbolEditor"; //$NON-NLS-1$
 
     public OpenDiagramFromSymbolAdapter() {
-        super("Symbol Editor", Activator.SYMBOL_ICON);
+        super(Messages.OpenDiagramFromSymbolAdapter_SymbolEditor, Activator.SYMBOL_ICON);
     }
 
     protected String getEditorId() {
index ae88498dc948dc572b800d44a385c0f01e40a83d..b7c0584e213be4f2cb8f24f629f5815b9c54cf86 100644 (file)
@@ -33,10 +33,10 @@ import org.slf4j.LoggerFactory;
 public class OpenSheetAdapter extends AbstractResourceEditorAdapter {
     private static final Logger LOGGER = LoggerFactory.getLogger(OpenSheetAdapter.class);
 
-    private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2";
+    private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2"; //$NON-NLS-1$
 
     public OpenSheetAdapter() {
-        super("Spreadsheet Editor", Activator.COMPOSITE_ICON);
+        super(Messages.OpenSheetAdapter_SpreadsheetEditor, Activator.COMPOSITE_ICON);
     }
 
     protected String getEditorId() {
@@ -65,7 +65,7 @@ public class OpenSheetAdapter extends AbstractResourceEditorAdapter {
                             String editorId = getEditorId();
                             WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, r, model, rvi));
                         } catch (PartInitException e) {
-                               LOGGER.error("Failed to open the spreadsheet editor.", e);
+                               LOGGER.error("Failed to open the spreadsheet editor.", e); //$NON-NLS-1$
                         }
                     }
                 });
index 1c35147934c37ecfc7ab5b1f0e49523561b8bcbf..d12f9def3fdc1e7dbf77292fe4777ec91b2c66e1 100644 (file)
@@ -101,13 +101,13 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
             try {
                 Object obj = tr.getTransferData(LocalObjectTransferable.FLAVOR);
                 if (DEBUG)
-                    System.out.println("GOT FROM AWT: " + obj);
+                    System.out.println("GOT FROM AWT: " + obj); //$NON-NLS-1$
 
                 // Check SWT
                 if (!(obj instanceof IStructuredSelection)) {
                     obj = LocalObjectTransfer.getTransfer().getObject();
                     if (DEBUG)
-                        System.out.println("GOT FROM SWT: " + obj);
+                        System.out.println("GOT FROM SWT: " + obj); //$NON-NLS-1$
                 }
 
                 if (obj instanceof IStructuredSelection) {
@@ -132,7 +132,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
                 }
 
             } catch (UnsupportedFlavorException|IOException|DatabaseException e) {
-                LOGGER.error("dragEnter failed", e);
+                LOGGER.error("dragEnter failed", e); //$NON-NLS-1$
             }
         }
 
@@ -190,15 +190,15 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
         public List<ElementClassDragItem> resolve(ReadGraph graph, Variable parameter) throws DatabaseException {
 
             if (DEBUG) {
-                System.out.println("PARAM: " + parameter.getURI(graph));
-                Variable parent = parameter.browsePossible(graph, "..");
-                System.out.println("PARENT: " + parent.getURI(graph));
+                System.out.println("PARAM: " + parameter.getURI(graph)); //$NON-NLS-1$
+                Variable parent = parameter.browsePossible(graph, ".."); //$NON-NLS-1$
+                System.out.println("PARENT: " + parent.getURI(graph)); //$NON-NLS-1$
                 Resource parentComposite = parent.getPossibleRepresents(graph);
-                System.out.println("PARENT REPRESENTS: " + NameUtils.getSafeLabel(graph, parentComposite));
+                System.out.println("PARENT REPRESENTS: " + NameUtils.getSafeLabel(graph, parentComposite)); //$NON-NLS-1$
                 String prvi = Variables.getRVI(graph, parent);
-                System.out.println("PARENT RVI: " + prvi);
+                System.out.println("PARENT RVI: " + prvi); //$NON-NLS-1$
                 String parvi = Variables.getRVI(graph, parameter);
-                System.out.println("PARAM RVI: " + parvi);
+                System.out.println("PARAM RVI: " + parvi); //$NON-NLS-1$
             }
 
             Triple<Variable, Resource, IElement> match = findElementInDiagram(graph, parameter, false);
@@ -216,13 +216,13 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
             }
 
             if (DEBUG) {
-                System.out.println("p=" + parameter.getURI(graph));
-                System.out.println("c=" + match.first.getURI(graph));
+                System.out.println("p=" + parameter.getURI(graph)); //$NON-NLS-1$
+                System.out.println("c=" + match.first.getURI(graph)); //$NON-NLS-1$
             }
 
             String rvi = Variables.getRVI(graph, match.first, parameter);
             if (DEBUG)
-                System.out.println("r=" + rvi);
+                System.out.println("r=" + rvi); //$NON-NLS-1$
 
             Resource type = graph.getResource(typeURI);
 
@@ -246,7 +246,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
                 return null;
 
             if (DEBUG)
-                System.out.println("findElementInDiagram " + property.getURI(graph) + " " + property);
+                System.out.println("findElementInDiagram " + property.getURI(graph) + " " + property); //$NON-NLS-1$ //$NON-NLS-2$
 
             DiagramResource DIA = DiagramResource.getInstance(graph);
             ModelingResources MOD = ModelingResources.getInstance(graph);
@@ -260,7 +260,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
             Resource represents = property.getPossibleRepresents(graph);
             if (represents != null) {
                 if (DEBUG)
-                    System.out.println("represents " + NameUtils.getSafeName(graph, represents, true));
+                    System.out.println("represents " + NameUtils.getSafeName(graph, represents, true)); //$NON-NLS-1$
                 Resource elementResource = graph.getPossibleObject(represents, MOD.ComponentToElement);
                 // There must have be at least one
                 // PROPERTY role variable in the
@@ -290,7 +290,7 @@ public class PopulateElementMonitorDropParticipant extends PopulateElementDropPa
                 }
             }
 
-            return findElementInDiagram(graph, property.browsePossible(graph, "."), propertyRoleFound);
+            return findElementInDiagram(graph, property.browsePossible(graph, "."), propertyRoleFound); //$NON-NLS-1$
         }
 
     }
index 2838892c402e2831f8df68f924b374819eaddcf7..22a1b59e4ec9a22d9d466b986c1bee0d9afa9631 100644 (file)
@@ -195,7 +195,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
     }
 
     protected String getPopupId() {
-        return "#ModelingDiagramPopup";
+        return "#ModelingDiagramPopup"; //$NON-NLS-1$
     }
 
     protected void getPreferences() {
@@ -227,7 +227,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
         swt = SWTThread.getThreadAccess(parent.getDisplay());
         statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
 
-        Object task = BEGIN("DV.initSession");
+        Object task = BEGIN("DV.initSession"); //$NON-NLS-1$
         initSession();
         END(task);
 
@@ -235,7 +235,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
         readNames();
         getPreferences();
 
-        task = BEGIN("DV.createChassis");
+        task = BEGIN("DV.createChassis"); //$NON-NLS-1$
         createChassis(parent);
         END(task);
 
@@ -246,9 +246,9 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
     }
 
     protected void initializeCanvas() {
-        Object canvasInit = BEGIN("DV.canvasInitialization");
+        Object canvasInit = BEGIN("DV.canvasInitialization"); //$NON-NLS-1$
 
-        Object task = BEGIN("DV.createViewerCanvas");
+        Object task = BEGIN("DV.createViewerCanvas"); //$NON-NLS-1$
 //        ThreadUtils.syncExec(AWTThread.getThreadAccess(), new Runnable() {
 //            @Override
 //            public void run() {
@@ -259,17 +259,17 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
 
         //FullscreenUtils.addFullScreenHandler(canvasContext, s, canvasProvider);
 
-        task = BEGIN("DV.setCanvasContext");
+        task = BEGIN("DV.setCanvasContext"); //$NON-NLS-1$
         setCanvasContext(canvasContext);
         END(task);
 
         try {
-            task = BEGIN("DV.loadDiagram");
+            task = BEGIN("DV.loadDiagram"); //$NON-NLS-1$
             sourceDiagram = loadDiagram(diagramResource);
             END(task);
 
             // Zoom to fit
-            task = BEGIN("DV.scheduleZoomToFit");
+            task = BEGIN("DV.scheduleZoomToFit"); //$NON-NLS-1$
 
 //            canvasContext.getDefaultHintContext().setHint(Hints.KEY_CANVAS_TRANSFORM, new AffineTransform());
 //            canvasContext.getContentContext().setDirty();
@@ -279,15 +279,15 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
 
             // Start an activation for the input resource.
             // This will activate mapping if necessary.
-            task = BEGIN("DV.performActivation");
+            task = BEGIN("DV.performActivation"); //$NON-NLS-1$
             performActivation();
             END(task);
 
-            task = BEGIN("DV.activate context");
+            task = BEGIN("DV.activate context"); //$NON-NLS-1$
             contextUtil.activate(DiagramViewer.DIAGRAMMING_CONTEXT);
             END(task);
 
-            task = BEGIN("DV.onCreated");
+            task = BEGIN("DV.onCreated"); //$NON-NLS-1$
             onCreated();
             END(task);
 
@@ -313,7 +313,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
 
     protected void scheduleZoomToFit() {
         if (sourceDiagram == null)
-            throw new IllegalStateException("source diagram is null");
+            throw new IllegalStateException("source diagram is null"); //$NON-NLS-1$
 
         sourceDiagram.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE);
         sourceDiagram.setHint(DiagramHints.KEY_INITIAL_ZOOM_TO_FIT, Boolean.TRUE);
@@ -353,7 +353,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
             PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
                 @Override
                 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-                    SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 100);
+                    SubMonitor mon = SubMonitor.convert(monitor, Messages.SheetViewer_MonitorLoadingDiagram, 100);
                     try {
                         dc.set( loadDiagram(mon.newChild(100), r) );
                     } catch (DatabaseException e) {
@@ -375,17 +375,17 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
     }
 
     protected IDiagram loadDiagram(IProgressMonitor monitor, Resource r) throws DatabaseException {
-        SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 100);
+        SubMonitor mon = SubMonitor.convert(monitor, Messages.SheetViewer_MonitorLoadingDiagram, 100);
 
-        Object task = BEGIN("DV.DiagramLoadQuery");
+        Object task = BEGIN("DV.DiagramLoadQuery"); //$NON-NLS-1$
         IDiagram d = sessionContext.getSession().syncRequest(DiagramRequests.loadDiagram(mon.newChild(100), getResourceInput2().getModel(null), r, null, structuralPath, synchronizer, null));
         END(task);
 
-        task = BEGIN("DV.setDiagramHint");
+        task = BEGIN("DV.setDiagramHint"); //$NON-NLS-1$
         canvasContext.getDefaultHintContext().setHint(DiagramHints.KEY_DIAGRAM, d);
         END(task);
 
-        task = BEGIN("DV.set other hints");
+        task = BEGIN("DV.set other hints"); //$NON-NLS-1$
         // Setup a copy advisor for the synchronizer
         //d.setHint(SynchronizationHints.COPY_ADVISOR, new MappedElementCopyAdvisor(new ComponentCopyAdvisor()));
         d.setHint(DiagramHints.KEY_USE_CONNECTION_FLAGS, Boolean.FALSE);
@@ -407,7 +407,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
                 }
             });
         } catch (DatabaseException e) {
-            throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e);
+            throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$
         }
     }
 
@@ -428,7 +428,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
         CanvasContext ctx = new CanvasContext(thread);
         IHintContext h = ctx.getDefaultHintContext();
 
-        Object task = BEGIN("createSynchronizer");
+        Object task = BEGIN("createSynchronizer"); //$NON-NLS-1$
         this.synchronizer = createSynchronizer(ctx, sessionContext);
         END(task);
 
@@ -619,7 +619,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 {
     @Override
     public void init(IEditorSite site, IEditorInput input) throws PartInitException {
         if (!(input instanceof IResourceEditorInput))
-            throw new PartInitException("Invalid input: must be IResourceEditorInput");
+            throw new PartInitException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$
         setSite(site);
         setInput(input);
         support = new ResourceEditorSupport(this);
index d067ba344035fb7e0a300848d2c76441de742ba0..47913a7e078403a2ed9f51c793eea91635b4aa5c 100644 (file)
@@ -157,7 +157,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
             IHintContext hints = new HintContext();
             hints.setHint(DiagramModelHints.KEY_ACTIVE_EXPERIMENT, experiment);
             if(layer != null) {
-                System.out.println("using layer '"+layer+"'");
+                System.out.println("using layer '"+layer+"'"); //$NON-NLS-1$ //$NON-NLS-2$
                 hints.setHint(DiagramHints.KEY_FIXED_LAYERS, new String[] { layer });
             }
 
@@ -170,7 +170,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
 
     void scheduleZoomToFit() {
         if (sourceDiagram == null)
-            throw new IllegalStateException("source diagram is null");
+            throw new IllegalStateException("source diagram is null"); //$NON-NLS-1$
 
         sourceDiagram.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE);
         sourceDiagram.setHint(DiagramHints.KEY_INITIAL_ZOOM_TO_FIT, Boolean.TRUE);
@@ -188,7 +188,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
         if(experiment != null)
             hints.setHint(DiagramModelHints.KEY_ACTIVE_EXPERIMENT, experiment);
         if(layer != null) {
-            System.out.println("using layer '"+layer+"'");
+            System.out.println("using layer '"+layer+"'"); //$NON-NLS-1$ //$NON-NLS-2$
             hints.setHint(DiagramHints.KEY_FIXED_LAYERS, new String[] { layer });
         }
         IDiagram d = sessionContext.getSession().syncRequest(DiagramRequests.loadDiagram(new NullProgressMonitor(), getResourceInput2().getModel(null), structuralPath.resources[0], null, structuralPath.removeFromBeginning(0), synchronizer, hints));
@@ -213,7 +213,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
                 }
             });
         } catch (DatabaseException e) {
-            throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e);
+            throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$
         }
     }
 
@@ -311,7 +311,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
 
     @Override
     public void dispose() {
-        System.out.println("RemoteDiagramViewer.dispose()");
+        System.out.println("RemoteDiagramViewer.dispose()"); //$NON-NLS-1$
         if(getSite() != null) {
             IContextService contextService = (IContextService) getSite().getService(IContextService.class);
             contextService.deactivateContext(contextActivation);
@@ -352,7 +352,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
     public void init(IEditorSite site, IEditorInput input)
     throws PartInitException {
         if (!(input instanceof IResourceEditorInput))
-            throw new PartInitException("Invalid input: must be IResourceEditorInput");
+            throw new PartInitException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$
         setSite(site);
         setInput(input);
         support = new ResourceEditorSupport(this);
@@ -376,7 +376,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart
         try {
             SerialisationSupport support = session.getService(SerialisationSupport.class);
             ResourceTransferData data = ResourceTransferUtils.readAwtTransferable(support, tr);
-            if ("property".equals(data.getPurpose()))
+            if ("property".equals(data.getPurpose())) //$NON-NLS-1$
                 return data.toResourceArrayArray();
         } catch (UnsupportedFlavorException e) {
             throw new RuntimeException(e);
index 4ed40f2f87fb6b66786ee43fb04d2b1597c1be33..0560954afd9f98638807a24c20bc67e70fd9d82e 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.Platform;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.workbench.modeling.EPartService;
 import org.eclipse.e4.ui.workbench.modeling.IPartListener;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.PartInitException;
@@ -65,7 +66,7 @@ public class DiagramEditor extends E4ResourceEditorBase implements DiagramViewer
      * 
      * @see #setInitializationData(IConfigurationElement, String, Object)
      */
-    public static final String    ARG_VIEWER = "viewer";
+    public static final String    ARG_VIEWER = "viewer"; //$NON-NLS-1$
 
     private Composite             parent;
 
@@ -84,25 +85,26 @@ public class DiagramEditor extends E4ResourceEditorBase implements DiagramViewer
      */
     @Override
     public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
-//        super.setInitializationData(cfig, propertyName, data);
+        // super.setInitializationData(cfig, propertyName, data);
 
         if (data instanceof String) {
             viewerContributor = cfig.getContributor().getName();
 
-            String[] parameters = ((String) data).split(";");
+            String[] parameters = ((String) data).split(";"); //$NON-NLS-1$
 
             for (String parameter : parameters) {
-                String[] keyValue = parameter.split("=");
+                String[] keyValue = parameter.split("="); //$NON-NLS-1$
                 if (keyValue.length > 2) {
-                    ErrorLogger.defaultLogWarning("Invalid parameter '" + parameter + ". Complete view argument: " + data, null);
+                    ErrorLogger.defaultLogWarning(NLS.bind(Messages.DiagramEditor_InvalidParameter, parameter, data),
+                            null);
                     continue;
                 }
                 String key = keyValue[0];
-                String value = keyValue.length > 1 ? keyValue[1] : "";
+                String value = keyValue.length > 1 ? keyValue[1] : ""; //$NON-NLS-1$
 
                 if (ARG_VIEWER.equals(key)) {
                     viewerClassName = value;
-                } 
+                }
             }
         }
     }
@@ -110,25 +112,25 @@ public class DiagramEditor extends E4ResourceEditorBase implements DiagramViewer
     protected DiagramViewer createViewer() throws PartInitException {
         if (viewerClassName == null)
             throw new PartInitException(
-                    "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '"
-                            + viewerContributor + "'");
+                    "DiagramViewer contributor class was not specified in editor extension's class attribute viewer-argument. contributor is '" //$NON-NLS-1$
+                            + viewerContributor + "'"); //$NON-NLS-1$
 
         try {
             Bundle b = Platform.getBundle(viewerContributor);
             if (b == null)
-                throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '"
-                        + viewerContributor + "' was not found in the platform.");
+                throw new PartInitException("DiagramViewer '" + viewerClassName + "' contributor bundle '" //$NON-NLS-1$ //$NON-NLS-2$
+                        + viewerContributor + "' was not found in the platform."); //$NON-NLS-1$
 
             Class<?> clazz = b.loadClass(viewerClassName);
             if (!DiagramViewer.class.isAssignableFrom(clazz))
-                throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to "
-                        + DiagramViewer.class + ".");
+                throw new PartInitException("DiagramViewer class '" + viewerClassName + "' is not assignable to " //$NON-NLS-1$ //$NON-NLS-2$
+                        + DiagramViewer.class + "."); //$NON-NLS-1$
 
             Constructor<?> ctor = clazz.getConstructor();
             return (DiagramViewer) ctor.newInstance();
         } catch (Exception e) {
-            throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName
-                    + "' from bundle '" + viewerContributor + "'. See exception for details.", e);
+            throw new PartInitException("Failed to instantiate DiagramViewer implementation '" + viewerClassName //$NON-NLS-1$
+                    + "' from bundle '" + viewerContributor + "'. See exception for details.", e); //$NON-NLS-1$ //$NON-NLS-2$
         }
     }
 
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/Messages.java
new file mode 100644 (file)
index 0000000..1a8a8b6
--- /dev/null
@@ -0,0 +1,19 @@
+package org.simantics.modeling.ui.diagramEditor.e4;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.diagramEditor.e4.messages"; //$NON-NLS-1$
+       public static String DiagramEditor_InvalidParameter;
+       public static String PopulateElementDropParticipant_ActivatorDiagramContentTrackingFailed;
+       public static String PopulateElementDropParticipant_CannotCreateElementIntoDiagram;
+       public static String PopulateElementDropParticipant_CannotInstantiate;
+       public static String PopulateElementDropParticipant_CannotInstantiateUserComponent;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 51f5d82698201b412e8dde2437e8cc13ff2287ac..ac9413064a7b8b222e401a820e0e552a582dc198 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.RequestProcessor;
@@ -210,32 +211,33 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i
         return processor.syncRequest(new UniqueRead<String>() {
             @Override
             public String perform(ReadGraph graph) throws DatabaseException {
-//                System.out.println("dragged resource: " + draggedResource);
-//                System.out.println("drop target resource: " + dropTarget);
+                // System.out.println("dragged resource: " + draggedResource);
+                // System.out.println("drop target resource: " + dropTarget);
                 Resource sourceModel = graph.syncRequest(new PossibleIndexRoot(draggedResource));
                 Resource targetModel = graph.syncRequest(new PossibleIndexRoot(dropTarget));
-//                System.out.println("source model: " + sourceModel);
-//                System.out.println("target model: " + targetModel);
+                // System.out.println("source model: " + sourceModel);
+                // System.out.println("target model: " + targetModel);
 
                 // Prevent dragging data from one source model to another.
                 // If source is not part of any model, everything is okay.
                 if (sourceModel != null && !graph.syncRequest(new IsLinkedTo(targetModel, sourceModel))) {
                     // Prevent a symbol instantiating within its own configuration.
                     // NOTE: this doesn't handle transitive cycles.
-                    return "Cannot instantiate " + NameUtils.getSafeName(graph, draggedResource) + " into model "
-                            + NameUtils.getURIOrSafeNameInternal(graph, targetModel) + ". The source namespace ("
-                            + NameUtils.getURIOrSafeNameInternal(graph, sourceModel) + ") is not linked to the target model.";
+                    return NLS.bind(Messages.PopulateElementDropParticipant_CannotInstantiate,
+                            new Object[] { NameUtils.getSafeName(graph, draggedResource),
+                                    NameUtils.getURIOrSafeNameInternal(graph, targetModel),
+                                    NameUtils.getURIOrSafeNameInternal(graph, sourceModel) });
                 }
-                
+
                 // Prevent dragging to published components
                 ModelingResources MOD = ModelingResources.getInstance(graph);
                 StructuralResource2 STR = StructuralResource2.getInstance(graph);
                 Resource configuration = graph.getPossibleObject(dropTarget, MOD.DiagramToComposite);
                 if (configuration != null) {
                     Resource componentTypeFromDiagram = graph.getPossibleObject(configuration, STR.Defines);
-                    if(componentTypeFromDiagram != null) {
-                           if(Layer0Utils.isPublished(graph, componentTypeFromDiagram))
-                               return "Cannot create elements into a diagram that belongs to a published user component.";
+                    if (componentTypeFromDiagram != null) {
+                        if (Layer0Utils.isPublished(graph, componentTypeFromDiagram))
+                            return Messages.PopulateElementDropParticipant_CannotCreateElementIntoDiagram;
                     }
                 }
 
@@ -244,8 +246,9 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i
                 if (componentTypeFromSymbol != null) {
                     if (configuration != null) {
                         Resource componentTypeFromDiagram = graph.getPossibleObject(configuration, STR.Defines);
-                        if (componentTypeFromDiagram != null && componentTypeFromSymbol.equals(componentTypeFromDiagram)) {
-                            return "Cannot instantiate user component within its own configuration.";
+                        if (componentTypeFromDiagram != null
+                                && componentTypeFromSymbol.equals(componentTypeFromDiagram)) {
+                            return Messages.PopulateElementDropParticipant_CannotInstantiateUserComponent;
                         }
                     }
                 }
@@ -284,7 +287,7 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i
 
     @Override
     public void drop(DropTargetDropEvent dtde, final IDnDContext dp) {
-        TimeLogger.resetTimeAndLog(getClass(), "drop");
+        TimeLogger.resetTimeAndLog(getClass(), "drop"); //$NON-NLS-1$
 
         final IDiagram d = getHint(DiagramHints.KEY_DIAGRAM);
         if (d == null)
@@ -381,7 +384,7 @@ public class PopulateElementDropParticipant extends AbstractDiagramParticipant i
                 }
             }
         } catch (DatabaseException e) {
-            Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Diagram content change tracking failed.", e));
+            Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.PopulateElementDropParticipant_ActivatorDiagramContentTrackingFailed, e));
         }
     }
 
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/messages.properties
new file mode 100644 (file)
index 0000000..91cbaa2
--- /dev/null
@@ -0,0 +1,5 @@
+DiagramEditor_InvalidParameter=Invalid parameter ''{0}''. Complete view argument: {1}
+PopulateElementDropParticipant_ActivatorDiagramContentTrackingFailed=Diagram content change tracking failed.
+PopulateElementDropParticipant_CannotCreateElementIntoDiagram=Cannot create elements into a diagram that belongs to a published user component.
+PopulateElementDropParticipant_CannotInstantiate=Cannot instantiate {0} into model {1}. The source namespace ({2}) is not linked to the target model.
+PopulateElementDropParticipant_CannotInstantiateUserComponent=Cannot instantiate user component within its own configuration.
index 7ed685f76f805c99e332a1955a0e8e8375c652f3..19052dac19bb515be2342d9e1736480373eea877 100644 (file)
@@ -1,2 +1,40 @@
+DiagramEditor_InvalidParameter=Invalid parameter ''{0}''. Complete view argument: {1}
+DiagramLayersPage_Focus=Focus
+DiagramLayersPage_FocusActive=Focus Active
+DiagramLayersPage_FocusActiveTT=Only Focus Diagram Elements For Active Roles
+DiagramLayersPage_FocusAll=Focus All
+DiagramLayersPage_FocusAllTT=Focus All Diagram Elements Regardless Of Active Roles
+DiagramLayersPage_New=New
+DiagramLayersPage_NewRole=New Role
+DiagramLayersPage_NewTT=Create New Diagram Role
+DiagramLayersPage_Remove=Remove
+DiagramLayersPage_RemoveTT=Remove Selected Diagram Role
+DiagramLayersPage_Role=Role
+DiagramLayersPage_SelectTT=Selects the diagram to include in the exported document.
+DiagramLayersPage_Show=Show
+DiagramLayersPage_ShowActive=Show Active
+DiagramLayersPage_ShowActiveTT=Only Show Diagram Elements For Active Roles
+DiagramLayersPage_ShowAll=Show All
+DiagramLayersPage_ShowAllTT=Show All Diagram Elements Regardless Of Active Roles
+DiagramViewer_FailedtoLoadModeled=Failed to load modeled browse contexts for property page, see exception for details.
+DiagramViewer_MonitorActivateMapping=Activate Mapping
+DiagramViewerActionContributor_ConnectMode=Connect Mode
+DiagramViewerActionContributor_PointerMode=Pointer Mode
+DiagramViewerLoadJob_ActivatorDiagramLoadingCancelled=Diagram loading was cancelled.
+DiagramViewerLoadJob_ActivatorDiagramLoadingFailed=Diagram loading failed, see exception for details.
+DiagramViewerLoadJob_ApplyEditorState=Apply editor state
+DiagramViewerLoadJob_LoadDiagram=Load Diagram
+DiagramViewerLoadJob_MonitorFinalizeDiagramLoading=Finalize Diagram Loading
+DiagramViewerLoadJob_MonitorLoadingDiagram=Loading Diagram
+DiagramViewerLoadJob_SetDiagram=Set Diagram
+OpenDiagramAdapter_DiagramEditor=Diagram Editor
+OpenDiagramFromComponentAdapter_ChooseDiagramComponetReference=Choose Diagram with Component Reference
+OpenDiagramFromComponentAdapter_OpenDiagramContainingComponent=Open Diagram Containing This Component
+OpenDiagramFromComponentAdapter_SelectSingleDiagramfromList=Select single diagram from list
+OpenDiagramFromConfigurationAdapter_DiagramEditor=Diagram Editor
+OpenDiagramFromIssue_OpenDiagramRefComponent=Open Diagram Containing Referenced Component
+OpenDiagramFromSymbolAdapter_SymbolEditor=Symbol Editor
+OpenSheetAdapter_SpreadsheetEditor=Spreadsheet Editor
 PopulateElementDropParticipant_PreDropFixesFailed=Drop failed because the following pre-drop fixes could not be performed:\n\n{0}
 PopulateElementDropParticipant_PreDropFixesFailed_Title=Drop Failed
+SheetViewer_MonitorLoadingDiagram=Loading Diagram
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/messages.properties
new file mode 100644 (file)
index 0000000..64efb89
--- /dev/null
@@ -0,0 +1 @@
+ModelingUIUtils_SelectQueryType=Select query type from list\r
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/Messages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/Messages.java
new file mode 100644 (file)
index 0000000..874001b
--- /dev/null
@@ -0,0 +1,40 @@
+package org.simantics.modeling.ui.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.wizard.messages"; //$NON-NLS-1$
+       public static String MigrateWizard_ActivatorMigrationFailed;
+       public static String MigrateWizard_ActivatorMigrationInterrupted;
+       public static String MigrateWizard_BrowseAnd;
+       public static String MigrateWizard_BrowseAnd1;
+       public static String MigrateWizard_Continue;
+       public static String MigrateWizard_InstanceFoundCannotBeMigrated;
+       public static String MigrateWizard_InstancesWereFound;
+       public static String MigrateWizard_LocationAnd;
+       public static String MigrateWizard_LocationInstance;
+       public static String MigrateWizard_MigratableInstancesFound;
+       public static String MigrateWizard_MigrationReport;
+       public static String MigrateWizard_MonitorCommitingChanges;
+       public static String MigrateWizard_NoInstancesFound;
+       public static String MigrateWizard_NoInstancesWereFound;
+       public static String MigrateWizard_NumberOfInstancesFound;
+       public static String MigrateWizard_OneMigratableInstanceFound;
+       public static String MigrateWizard_PerformMigration;
+       public static String MigrateWizard_RetainSymbolName;
+       public static String MigrateWizard_SelectAllAnd;
+       public static String MigrateWizard_SelectInstancesToMigrate;
+       public static String MigrateWizard_SelectNoneAnd;
+       public static String MigrateWizard_SelectSourceType;
+       public static String MigrateWizard_SelectTargetType;
+       public static String MigrateWizard_SourceAnd;
+       public static String MigrateWizard_TargetAnd;
+       public static String MigrateWizard_TargetAndSymbol;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
index 14386190c53b0a89e873582c16445acef8cf9ce0..751ec023c1e6d4903a41b0a4be6830a7bc75b267 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CCombo;
 import org.eclipse.swt.events.ModifyEvent;
@@ -60,7 +61,6 @@ import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.common.NamedResource;
 import org.simantics.db.common.request.ObjectsWithType;
-import org.simantics.db.common.request.ReadRequest;
 import org.simantics.db.common.request.UnaryRead;
 import org.simantics.db.common.request.UniqueRead;
 import org.simantics.db.common.request.WriteResultRequest;
@@ -103,12 +103,12 @@ public class MigrateWizard extends Wizard {
        
        this.initial = initial;
 
-        setWindowTitle("Perform migration");
+        setWindowTitle(Messages.MigrateWizard_PerformMigration);
         setNeedsProgressMonitor(true);
         setForcePreviousAndNextButtons(false);
         setDialogSettings(Activator.getDefault().getDialogSettings());
 
-        prefnode = InstanceScope.INSTANCE.getNode( "org.simantics.modeling.ui.wizard.MigrateWizard" );
+        prefnode = InstanceScope.INSTANCE.getNode( "org.simantics.modeling.ui.wizard.MigrateWizard" ); //$NON-NLS-1$
         
     }
 
@@ -158,8 +158,8 @@ public class MigrateWizard extends Wizard {
                             graph.markUndoPoint();
                             String report = UserComponentMigration.doMigration(mon.newChild(500, SubMonitor.SUPPRESS_NONE), graph, result);
                             UserComponentMigration.doPostMigration(mon.newChild(500, SubMonitor.SUPPRESS_NONE), graph, result);
-                            mon.setTaskName("Committing Changes");
-                            mon.subTask("");
+                            mon.setTaskName(Messages.MigrateWizard_MonitorCommitingChanges);
+                            mon.subTask(""); //$NON-NLS-1$
                             return report;
                         }
                     });
@@ -187,11 +187,11 @@ public class MigrateWizard extends Wizard {
             Throwable cause = e.getCause();
             if (!(cause instanceof CancelTransactionException || cause instanceof OperationCanceledException)) {
                 Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                        "Migration failed, see Error Log for details.", e.getCause()));
+                        Messages.MigrateWizard_ActivatorMigrationFailed, e.getCause()));
             }
         } catch (InterruptedException e) {
             Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
-                    "Migration interrupted, see Error Log for details.", e));
+                    Messages.MigrateWizard_ActivatorMigrationInterrupted, e));
         }
         return false;
     }
@@ -218,9 +218,9 @@ public class MigrateWizard extends Wizard {
 
         public ReportDialog(Shell shell, String report, int width, int height) {
             super(shell, 
-                    "Migration report", null, 
-                    "", 
-                    MessageDialog.INFORMATION, new String[] { "Continue" }, 0);
+                    Messages.MigrateWizard_MigrationReport, null, 
+                    "",  //$NON-NLS-1$
+                    MessageDialog.INFORMATION, new String[] { Messages.MigrateWizard_Continue }, 0);
             this.report = report;
             this.initialWidth = width;
             this.initialHeight = height;
@@ -282,7 +282,7 @@ public class MigrateWizard extends Wizard {
         String                previouslySelectedLocationId = null;
 
         public MigratePage(String initial) {
-            super("Perform migration", "Perform migration", null);
+            super(Messages.MigrateWizard_PerformMigration, Messages.MigrateWizard_PerformMigration, null);
             this.initial = initial;
         }
 
@@ -297,7 +297,7 @@ public class MigrateWizard extends Wizard {
                 container.setLayout(layout);
             }
 
-            new Label(container, SWT.NONE).setText("&Source:");
+            new Label(container, SWT.NONE).setText(Messages.MigrateWizard_SourceAnd);
             source = new Text(container, SWT.BORDER);
             source.setText(initial);
             source.addModifyListener(new ModifyListener() {
@@ -310,14 +310,14 @@ public class MigrateWizard extends Wizard {
             GridDataFactory.fillDefaults().grab(true, false).span(8, 1).applyTo(source);
 
             browseSource = new Button(container, SWT.NONE);
-            browseSource.setText("&Browse");
+            browseSource.setText(Messages.MigrateWizard_BrowseAnd);
             GridDataFactory.fillDefaults().grab(false, false).applyTo(browseSource);
             browseSource.addSelectionListener(new SelectionAdapter() {
                 @Override
                 public void widgetSelected(SelectionEvent e_) {
                     try {
                         Map<String, Pair<String, ImageDescriptor>> map = Simantics.getSession().syncRequest(new BrowseSourceContentRequest(target.getText()));
-                        String uri = queryTargetSelection("Select Source Type", map);
+                        String uri = queryTargetSelection(Messages.MigrateWizard_SelectSourceType, map);
                         if (uri != null)
                             source.setText(uri);
                     } catch (DatabaseException e) {
@@ -326,7 +326,7 @@ public class MigrateWizard extends Wizard {
                 }
             });
 
-            new Label(container, SWT.NONE).setText("&Target:");
+            new Label(container, SWT.NONE).setText(Messages.MigrateWizard_TargetAnd);
             target = new Text(container, SWT.BORDER);
             target.setText(initial);
             target.addModifyListener(new ModifyListener() {
@@ -340,14 +340,14 @@ public class MigrateWizard extends Wizard {
             GridDataFactory.fillDefaults().grab(true, false).span(8, 1).applyTo(target);
 
             browseTarget = new Button(container, SWT.NONE);
-            browseTarget.setText("B&rowse");
+            browseTarget.setText(Messages.MigrateWizard_BrowseAnd1);
             GridDataFactory.fillDefaults().grab(false, false).applyTo(browseTarget);
             browseTarget.addSelectionListener(new SelectionAdapter() {
                 @Override
                 public void widgetSelected(SelectionEvent e_) {
                     try {
                         Map<String, Pair<String, ImageDescriptor>> map = Simantics.getSession().syncRequest(new BrowseTargetContentRequest(source.getText()));
-                        String uri = queryTargetSelection("Select Target Type", map);
+                        String uri = queryTargetSelection(Messages.MigrateWizard_SelectTargetType, map);
                         if (uri != null)
                             target.setText(uri);
                     } catch (DatabaseException e) {
@@ -357,7 +357,7 @@ public class MigrateWizard extends Wizard {
             });
 
             symbolsLabel = new Label(container, SWT.NONE);
-            symbolsLabel.setText("Target &symbol:");
+            symbolsLabel.setText(Messages.MigrateWizard_TargetAndSymbol);
             GridDataFactory.fillDefaults().applyTo(symbolsLabel);
 
             symbols = new CCombo(container, SWT.BORDER | SWT.READ_ONLY);
@@ -373,10 +373,10 @@ public class MigrateWizard extends Wizard {
 
             instanceLabel = new Label(container, SWT.NONE);
             GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(instanceLabel);
-            instanceLabel.setText("");
+            instanceLabel.setText(""); //$NON-NLS-1$
 
             locationsLabel = new Label(container, SWT.NONE);
-            locationsLabel.setText("&Locations:");
+            locationsLabel.setText(Messages.MigrateWizard_LocationAnd);
             locations = new CCombo(container, SWT.BORDER | SWT.READ_ONLY);
             locations.setVisibleItemCount(25);
             locations.addSelectionListener(new SelectionAdapter() {
@@ -392,16 +392,16 @@ public class MigrateWizard extends Wizard {
             GridDataFactory.fillDefaults().grab(true, false).span(9, 1).applyTo(locations);
 
             instancesLabel = new Label(container, SWT.NONE);
-            instancesLabel.setText("&Select instances to migrate:");
+            instancesLabel.setText(Messages.MigrateWizard_SelectInstancesToMigrate);
             GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(instancesLabel);
 
             buttonBar = new Composite(container, SWT.NONE);
             RowLayoutFactory.fillDefaults().type(SWT.HORIZONTAL).applyTo(buttonBar);
             GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(buttonBar);
             Button selectAll = new Button(buttonBar, SWT.PUSH);
-            selectAll.setText("Select &All");
+            selectAll.setText(Messages.MigrateWizard_SelectAllAnd);
             Button selectNone = new Button(buttonBar, SWT.PUSH);
-            selectNone.setText("Select &None");
+            selectNone.setText(Messages.MigrateWizard_SelectNoneAnd);
             selectAll.addSelectionListener(new SelectionAdapter() {
                 @Override
                 public void widgetSelected(SelectionEvent e) {
@@ -475,7 +475,7 @@ public class MigrateWizard extends Wizard {
                 });
 
                 symbols.removeAll();
-                symbols.add("<retain symbol name>");
+                symbols.add(Messages.MigrateWizard_RetainSymbolName);
                 for(NamedResource nr : syms) {
                     symbols.add(nr.getName());
                 }
@@ -546,7 +546,7 @@ public class MigrateWizard extends Wizard {
 
             int preSelect = -1, i = 0;
             for (Triple<String,NamedResource,Collection<MigrationOperation>> r : model.instances) {
-                locations.add(r.second.getName() + " (" + r.third.size() + " instances)");
+                locations.add(NLS.bind(Messages.MigrateWizard_LocationInstance, r.second.getName(), r.third.size())); 
                 if (r.first.equals(previouslySelectedLocationId))
                     preSelect = i;
                 if (preSelect < 0 && model.activeModels.contains(r.second.getResource()))
@@ -554,7 +554,7 @@ public class MigrateWizard extends Wizard {
                 ++i;
             }
             if (locations.getItemCount() == 0) {
-                locations.add("<no instances were found>");
+                locations.add(Messages.MigrateWizard_NoInstancesFound);
                 locations.select(0);
             } else {
                 locations.select(preSelect > -1 ? preSelect : 0);
@@ -564,27 +564,30 @@ public class MigrateWizard extends Wizard {
         void refreshInstances() {
 
             int toMigrate = 0;
-            for(Triple<String,NamedResource,Collection<MigrationOperation>> pair : model.instances) {
+            for (Triple<String, NamedResource, Collection<MigrationOperation>> pair : model.instances) {
                 toMigrate += pair.third.size();
             }
 
-            if(model.instanceCount == 0)
-                instanceLabel.setText("No instances were found.");
-            else if(model.instanceCount == 1) {
-                if(toMigrate == 1) {
-                    instanceLabel.setText("1 migratable instance found.");
+            if (model.instanceCount == 0)
+                instanceLabel.setText(Messages.MigrateWizard_NoInstancesWereFound);
+            else if (model.instanceCount == 1) {
+                if (toMigrate == 1) {
+                    instanceLabel.setText(Messages.MigrateWizard_OneMigratableInstanceFound);
                 } else {
-                    instanceLabel.setText("1 instance found, but it cannot be migrated with current settings.");
+                    instanceLabel.setText(Messages.MigrateWizard_InstanceFoundCannotBeMigrated);
                 }
             } else {
-                if(toMigrate < model.instanceCount) {
-                    if(toMigrate == 0) {
-                        instanceLabel.setText(model.instanceCount + " instances were found. None of them can be migrated with current settings.");
+                if (toMigrate < model.instanceCount) {
+                    if (toMigrate == 0) {
+                        instanceLabel
+                        .setText(NLS.bind(Messages.MigrateWizard_NumberOfInstancesFound, model.instanceCount));
                     } else {
-                        instanceLabel.setText(model.instanceCount + " instances were found. " + (model.instanceCount-toMigrate) + " of them cannot be migrated with current settings.");
+                        instanceLabel.setText(NLS.bind(Messages.MigrateWizard_InstancesWereFound, model.instanceCount,
+                                (model.instanceCount - toMigrate)));
                     }
                 } else {
-                    instanceLabel.setText(model.instanceCount + " migratable instances found. ");
+                    instanceLabel
+                    .setText(NLS.bind(Messages.MigrateWizard_MigratableInstancesFound, model.instanceCount));
                 }
             }
 
@@ -593,7 +596,7 @@ public class MigrateWizard extends Wizard {
             if (model == null)
                 return;
 
-            if(toMigrate == 0) {
+            if (toMigrate == 0) {
                 locationsLabel.setVisible(false);
                 locations.setVisible(false);
                 GridDataFactory.fillDefaults().exclude(true).applyTo(locationsLabel);
@@ -605,25 +608,26 @@ public class MigrateWizard extends Wizard {
                 GridDataFactory.fillDefaults().grab(true, false).span(9, 1).applyTo(locations);
             }
 
-            if(!model.instances.isEmpty()) {
+            if (!model.instances.isEmpty()) {
 
                 int locationIndex = locations.getSelectionIndex();
-                if(locationIndex == -1) return;
+                if (locationIndex == -1)
+                    return;
 
                 model.sortedShownInstances = new ArrayList<>();
-                for(MigrationOperation o : model.instances.get(locationIndex).third)
+                for (MigrationOperation o : model.instances.get(locationIndex).third)
                     model.sortedShownInstances.add(o);
                 Collections.sort(model.sortedShownInstances, MIGRATION_OP_COMPARATOR);
-                for(MigrationOperation o : model.sortedShownInstances) {
+                for (MigrationOperation o : model.sortedShownInstances) {
                     String uri = o.toString();
-                    uri = uri.replace("http://Projects/Development%20Project/", "");
+                    uri = uri.replace("http://Projects/Development%20Project/", ""); //$NON-NLS-1$ //$NON-NLS-2$
                     uri = URIStringUtils.unescape(uri);
                     instances.add(uri);
                 }
 
             }
 
-            if(model.sortedShownInstances.isEmpty()) {
+            if (model.sortedShownInstances.isEmpty()) {
                 instancesLabel.setVisible(false);
                 instances.setVisible(false);
                 buttonBar.setVisible(false);
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/messages.properties b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/wizard/messages.properties
new file mode 100644 (file)
index 0000000..64d3063
--- /dev/null
@@ -0,0 +1,26 @@
+MigrateWizard_ActivatorMigrationFailed=Migration failed, see Error Log for details.
+MigrateWizard_ActivatorMigrationInterrupted=Migration interrupted, see Error Log for details.
+MigrateWizard_BrowseAnd=&Browse
+MigrateWizard_BrowseAnd1=B&rowse
+MigrateWizard_Continue=Continue
+MigrateWizard_InstanceFoundCannotBeMigrated=1 instance found, but it cannot be migrated with current settings.
+MigrateWizard_InstancesWereFound={0} instances were found. {1} of them cannot be migrated with current settings.
+MigrateWizard_LocationAnd=&Locations:
+MigrateWizard_LocationInstance={0} ({1} instances)
+MigrateWizard_MigratableInstancesFound={0} migratable instances found. 
+MigrateWizard_MigrationReport=Migration report
+MigrateWizard_MonitorCommitingChanges=Committing Changes
+MigrateWizard_NoInstancesFound=<no instances were found>
+MigrateWizard_NoInstancesWereFound=No instances were found.
+MigrateWizard_NumberOfInstancesFound={0} instances were found. None of them can be migrated with current settings.
+MigrateWizard_OneMigratableInstanceFound=1 migratable instance found.
+MigrateWizard_PerformMigration=Perform migration
+MigrateWizard_RetainSymbolName=<retain symbol name>
+MigrateWizard_SelectAllAnd=Select &All
+MigrateWizard_SelectInstancesToMigrate=&Select instances to migrate:
+MigrateWizard_SelectNoneAnd=Select &None
+MigrateWizard_SelectSourceType=Select Source Type
+MigrateWizard_SelectTargetType=Select Target Type
+MigrateWizard_SourceAnd=&Source:
+MigrateWizard_TargetAnd=&Target:
+MigrateWizard_TargetAndSymbol=Target &symbol:
index d0a777caa8ffbdf061c1f64b003ae24f2d4d3608..27955fb7ee2ae99d95eab3d19653e71c8bbc7441 100644 (file)
@@ -58,7 +58,13 @@ public class SCLTypeUtils {
         TYPE_MAP.put("Vector Double", Types.vector(Types.DOUBLE));
         TYPE_MAP.put("Vector String", Types.vector(Types.STRING));
         TYPE_MAP.put("ByteArray", Types.BYTE_ARRAY);
-        
+
+        // #83: L0.typeResource
+        TCon variable = Types.con("Simantics/Variables", "Variable");
+        add(variable);
+        TYPE_MAP.put("Variable -> Resource -> <ReadGraph> Resource",
+                Types.functionE(new Type[] {variable, Types.RESOURCE}, Types.READ_GRAPH, Types.RESOURCE));
+
         add((TCon)Types.RESOURCE);
         add(Types.con("Simantics/GUID", "GUID")); // L0.GUID
         add(Types.con("Simantics/Variables", "StructuredProperty")); // L0.methods
index b06143bf6ee23cc82574666390a0d49c3c99de4a..c5ca0e754cada161035bbcee68289b4dc135062a 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -21,6 +21,8 @@ import org.eclipse.jface.viewers.IPostSelectionProvider;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.simantics.utils.ObjectUtils;
 
 /**
  * BaseSelectionProvider is a base implementation ISelectionProvider -interface.
@@ -34,21 +36,40 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
  * </p>
  * 
  * @author Toni Kalajainen
- * @author Tuukka Lehtonen
  */
-public class BasePostSelectionProvider extends BaseSelectionProvider implements IPostSelectionProvider {
+public class BasePostSelectionProvider implements IPostSelectionProvider {
 
-    protected ListenerList<ISelectionChangedListener> postSelectionListeners = new ListenerList<>();
+    protected ListenerList selectionListeners = new ListenerList();
+
+    protected ListenerList postSelectionListeners = new ListenerList();
+
+    protected ISelection selection = StructuredSelection.EMPTY;
+
+    public void addSelectionChangedListener(ISelectionChangedListener listener) {
+        selectionListeners.add(listener);
+    }
+
+    public ISelection getSelection() {
+        return selection;
+    }
 
     public void clearListeners() {
-        super.clearListeners();
-        clearPostSelectionChangedListeners();
+        selectionListeners.clear();
+        postSelectionListeners.clear();
+    }
+
+    public void clearSelectionChangedListeners() {
+        postSelectionListeners.clear();
     }
 
     public void clearPostSelectionChangedListeners() {
         postSelectionListeners.clear();
     }
 
+    public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+        selectionListeners.remove(listener);
+    }
+
     @Override
     public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
         postSelectionListeners.add(listener);
@@ -59,10 +80,30 @@ public class BasePostSelectionProvider extends BaseSelectionProvider implements
         postSelectionListeners.remove(listener);
     }
 
+    public void setSelection(ISelection selection) {
+        setSelectionWithoutFiring(selection);
+    }
+
+    protected Object[] getListeners() {
+        return selectionListeners.getListeners();
+    }
+
     protected Object[] getPostListeners() {
         return postSelectionListeners.getListeners();
     }
 
+    /**
+     * Notify other UIs that selection has changed
+     * @param selection new selection
+     */
+    public void fireSelection(ISelection selection) {
+        if (selection == null)
+            return;
+        SelectionChangedEvent e = new SelectionChangedEvent(this, selection);
+        for (Object l : getListeners())
+            ((ISelectionChangedListener) l).selectionChanged(e);
+    }
+
     /**
      * Notify other UIs that selection has changed
      * @param selection new selection
@@ -82,4 +123,46 @@ public class BasePostSelectionProvider extends BaseSelectionProvider implements
         }
     }
 
+    public void setSelectionWithoutFiring(ISelection selection) {
+        this.selection = selection;
+    }
+
+
+    /**
+     * Sets a new selection and always fires a SelectionChangedEvent about it.
+     * 
+     * @param selection the new selection
+     */
+    public void setAndFireSelection(ISelection selection) {
+        setSelection(selection);
+        fireSelection(selection);
+    }
+
+    /**
+     * Sets the new selection for this provider and fires all selection change
+     * listeners if the specified selection differs from the current selection.
+     * If the selection is either the same object or considered equal to the
+     * current selection, the listeners are not fired.
+     * 
+     * @param selection the new selection
+     */
+    public void setAndFireNonEqualSelection(ISelection selection) {
+        ISelection old = getSelection();
+        if (ObjectUtils.objectEquals(old, selection))
+            return;
+
+        this.selection = selection;
+        if (selection != null && !selection.equals(old))
+            fireSelection(selection);
+    }
+
+    public boolean selectionEquals(ISelection s) {
+        if (s == selection)
+            return true;
+        if (s == null)
+            // Old selection had to be non-null
+            return true;
+        return s.equals(selection);
+    }
+
 }
index 55ec0241b151540a9005b0f9ae842f7d685a3392..b2e6d921548618c790aa910bb3ee43713c2bda37 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -20,7 +20,6 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
-import org.simantics.utils.ObjectUtils;
 
 /**
  * BaseSelectionProvider is a base implementation ISelectionProvider -interface.
@@ -40,7 +39,7 @@ import org.simantics.utils.ObjectUtils;
  */
 public class BaseSelectionProvider implements ISelectionProvider {
 
-    protected ListenerList<ISelectionChangedListener> selectionListeners = new ListenerList<>();
+    protected ListenerList selectionListeners = new ListenerList();
 
     protected ISelection selection = StructuredSelection.EMPTY;
 
@@ -60,14 +59,6 @@ public class BaseSelectionProvider implements ISelectionProvider {
         return selection;
     }
 
-    public void clearListeners() {
-        clearSelectionChangedListeners();
-    }
-
-    public void clearSelectionChangedListeners() {
-        selectionListeners.clear();
-    }
-
     public void removeSelectionChangedListener(ISelectionChangedListener listener) {
         selectionListeners.remove(listener);
     }
@@ -115,15 +106,14 @@ public class BaseSelectionProvider implements ISelectionProvider {
      * 
      * @param selection the new selection
      */
-    public boolean setAndFireNonEqualSelection(ISelection selection) {
+    public void setAndFireNonEqualSelection(ISelection selection) {
         ISelection old = getSelection();
-        if (ObjectUtils.objectEquals(old, selection))
-            return false;
+        if (selection == old)
+            return;
 
         this.selection = selection;
-        if (selection != null)
+        if (selection != null && !selection.equals(old))
             fireSelection(selection);
-        return true;
     }
 
     public boolean selectionEquals(ISelection s) {
index e196e673267ddaf8d7a17ad6fc78b10c7eda78c2..1666413e9c56d45ee16e8afeda3baf3e07e17446 100644 (file)
@@ -10,8 +10,11 @@ import org.eclipse.jface.viewers.IPostSelectionProvider;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
 import org.eclipse.ui.IWorkbenchSite;
 import org.simantics.browsing.ui.Column;
 import org.simantics.browsing.ui.StatePersistor;
@@ -42,19 +45,9 @@ public class SWTExplorer extends SingleSWTViewNode<ModelBrowser> {
        public Boolean useNodeBrowseContexts;
        public Boolean useNodeActionContexts;
        public StatePersistor persistor;
-
+       
        public ISelection lastSelection;
-
-       private ISelectionChangedListener internalToExternalSelectionPropagator = event -> {
-               IWorkbenchSite site = getSite();
-               if (site != null) {
-                       ISelectionProvider sp = site.getSelectionProvider();
-                       if (sp != null) {
-                               sp.setSelection(event.getSelection());
-                       }
-               }
-       };
-
+       
        @Override
        public void createControls(Composite parent) {
 
@@ -77,30 +70,80 @@ public class SWTExplorer extends SingleSWTViewNode<ModelBrowser> {
                if (uiContext != null) {
                        control.setUiContexts(Collections.singleton(uiContext));
                }
-
+               
                control.setStatePersistor(persistor);
-
+               
                control.finish();
 
                setProperties();
-
+               
                control.setInputSource(PassThruInputSource.INSTANCE);
 
-               ISelectionProvider isp = (ISelectionProvider)control.getExplorer().getAdapter(ISelectionProvider.class);
-               if (isp instanceof IPostSelectionProvider) {
-                       ((IPostSelectionProvider) isp).addPostSelectionChangedListener(internalToExternalSelectionPropagator);
-               } else {
-                       isp.addSelectionChangedListener(internalToExternalSelectionPropagator);
-               }
-
-               control.addListenerToControl(SWT.Selection, event -> {
-                       if(selectionListener != null)
-                               selectionListener.apply(event);
-                       ISelection selection = (ISelection)control.getExplorer().getWidgetSelection();
-                       propertyCallback.apply("selection", selection);
-                       lastSelection = selection;
+               ISelectionProvider sp = (ISelectionProvider)control.getExplorer().getAdapter(ISelectionProvider.class);
+               sp.addSelectionChangedListener(new ISelectionChangedListener() {
+                       
+                       @Override
+                       public void selectionChanged(SelectionChangedEvent event) {
+                               if (site != null) {
+                                       ISelectionProvider sp = site.getSelectionProvider();
+                                       if (sp != null) {
+                                               sp.setSelection(event.getSelection());
+                                       }
+                               }
+                       }
+                       
                });
-
+               
+               IPostSelectionProvider psp = (IPostSelectionProvider)control.getExplorer().getAdapter(IPostSelectionProvider.class);
+               psp.addPostSelectionChangedListener(new ISelectionChangedListener() {
+                       
+                       @Override
+                       public void selectionChanged(SelectionChangedEvent event) {
+                               
+//                             ISelection selection = (ISelection)control.getExplorer().getWidgetSelection();
+                               if (site != null) {
+                                       ISelectionProvider sp = site.getSelectionProvider();
+                                       if (sp != null) {
+                                               sp.setSelection(event.getSelection());
+                                       }
+                               }
+                               
+                       }
+                       
+               });
+               
+               control.addListenerToControl(SWT.Selection, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               
+                               if(selectionListener != null)
+                                       selectionListener.apply(event);
+                               
+                               ISelection selection = (ISelection)control.getExplorer().getWidgetSelection();
+                               // [Tuukka@2012-04-08] Disabled this because it was causing
+                               // horrible selection feedback effects in the Model Browser
+                               // view that is using it. It causes the browser to react to
+                               // external selections which were initially published as its own
+                               // with a delay.
+                               //System.out.println("selection: " + selection);
+//                             if(publishSelection != null && publishSelection) {
+//                                     if (site != null) {
+//                                             ISelectionProvider sp = site.getSelectionProvider();
+//                                             if (sp != null) {
+//                                                     sp.setSelection(selection);
+//                                             }
+//                                     }
+//                             }
+                               
+                               propertyCallback.apply("selection", selection);
+                               
+                               lastSelection = selection;
+                               
+                       }
+                       
+               });
+                       
        }
 
        public void synchronizeColumnsVisible(Boolean columnsVisible) {
@@ -148,16 +191,5 @@ public class SWTExplorer extends SingleSWTViewNode<ModelBrowser> {
 
        final public void synchronizeLayout(LayoutBean layout) {
        }
-
-       @Override
-       public void dispose() {
-               ISelectionProvider isp = (ISelectionProvider)control.getExplorer().getAdapter(ISelectionProvider.class);
-               if (isp instanceof IPostSelectionProvider) {
-                       ((IPostSelectionProvider) isp).removePostSelectionChangedListener(internalToExternalSelectionPropagator);
-               } else {
-                       isp.removeSelectionChangedListener(internalToExternalSelectionPropagator);
-               }
-               super.dispose();
-       }
-
+       
 }
index cd17a18726a1e9a0d10ab0cd06b74e14314e814b..18048f38c7654a2b322b317d8370b4f32d537460 100644 (file)
@@ -16,8 +16,7 @@ Require-Bundle: org.simantics.browsing.ui.swt;bundle-version="1.1.0";visibility:
  org.simantics.project;bundle-version="1.0.1",
  org.simantics.scenegraph.loader;bundle-version="1.0.0";visibility:=reexport,
  org.simantics.scenegraph.ontology;bundle-version="1.0.0",
- org.simantics.utils.thread.swt;bundle-version="1.1.0",
- org.slf4j.api
+ org.simantics.utils.thread.swt;bundle-version="1.1.0"
 Export-Package: org.simantics.views.swt
 Bundle-Activator: org.simantics.views.swt.Activator
 Bundle-Vendor: Semantum Oy
index 92396f421de9d37e0b9673d8989d3ca894db64eb..f50954857e7d3611d7956968ece2559d6f9bf8ea 100644 (file)
@@ -27,6 +27,7 @@ import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.IWorkbenchSite;
 import org.simantics.Simantics;
+import org.simantics.browsing.ui.common.ErrorLogger;
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;
 import org.simantics.db.ReadGraph;
@@ -35,6 +36,7 @@ import org.simantics.db.VirtualGraph;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.request.WriteResultRequest;
+import org.simantics.db.common.utils.Logger;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.exception.ServiceNotFoundException;
 import org.simantics.db.layer0.util.RemoverUtil;
@@ -45,11 +47,8 @@ import org.simantics.layer0.Layer0;
 import org.simantics.scenegraph.ontology.ScenegraphResources;
 import org.simantics.scl.runtime.function.Function1;
 import org.simantics.ui.workbench.IPropertyPage;
-import org.simantics.utils.ui.ErrorLogger;
-import org.simantics.utils.ui.jface.BasePostSelectionProvider;
+import org.simantics.utils.ui.jface.ActiveSelectionProvider;
 import org.simantics.views.swt.client.base.SWTRoot;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * To use this class, first model your view contents in .pgraph files according
@@ -68,8 +67,6 @@ import org.slf4j.LoggerFactory;
  */
 public class ModelledView extends SimanticsView implements IPartListener2 {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(ModelledView.class);
-
     public static final int TIME_BEFORE_DISPOSE_WHEN_HIDDEN = 30000; // ms
     
     private static final boolean           DEBUG             = false;
@@ -91,11 +88,10 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
 
     protected ModelledSupport              support;
 
-    private BasePostSelectionProvider      selectionProvider = new BasePostSelectionProvider() {
+    ActiveSelectionProvider                selectionProvider = new ActiveSelectionProvider() {
         @Override
         public void setSelection(ISelection selection) {
-            super.setAndFireNonEqualSelection(selection);
-            super.firePostSelection(selection);
+            super.setSelection(selection);
         }
     };
 
@@ -105,6 +101,7 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
 
     @Override
     protected WidgetSupportImpl createSupport() {
+
         try {
             runtime = Simantics.getSession().sync(
                     new WriteResultRequest<Resource>(Simantics.getSession().getService(VirtualGraph.class)) {
@@ -117,13 +114,16 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
                             return runtime;
                         }
                     });
-        } catch (ServiceNotFoundException | DatabaseException e) {
-            LOGGER.error("Failed to initialize modelled view database runtime support structures", e);
+        } catch (ServiceNotFoundException e) {
+            Logger.defaultLogError(e);
+        } catch (DatabaseException e) {
+            Logger.defaultLogError(e);
         }
 
         support = new ModelledSupport(this);
 
         return support;
+
     }
 
     public void fireInput() {
@@ -166,7 +166,9 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
         }
 
         if (load) {
+
             try {
+
                 loader = new SWTViewLoaderProcess(this, getSite(), getClass().getSimpleName());
 
                 viewVariable = loader.getVariable(Simantics.getSession(), configurationURI(), runtime);
@@ -198,10 +200,17 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
 
                 body.layout(true);
 
+                getSite().setSelectionProvider(selectionProvider);
+
             } catch (DatabaseException e) {
-                LOGGER.error("Failed to create modelled SWT view controls", e);
+
+                e.printStackTrace();
+                Logger.defaultLogError(e);
+
             }
+
         }
+
     }
 
     @Override
@@ -211,12 +220,14 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
         // Only create controls if the part is TRULY visible.
         // Fast view parts seem to cause calls to createPartControl even
         // when the part is hidden in reality
+        boolean visible = site.getPage().isPartVisible(this);
         if (DEBUG)
             System.out.println(this + ": createControls( visible=" + site.getPage().isPartVisible(this) + " )");
         doCreateControls(true);
 
         getSite().setSelectionProvider(selectionProvider);
         getSite().getPage().addPartListener(this);
+
     }
 
     protected void inputChanged(IWorkbenchPart provider, Object input) {
@@ -280,8 +291,10 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
                     RemoverUtil.remove(graph, rt);
                 }
             });
-        } catch (ServiceNotFoundException | DatabaseException e) {
-            LOGGER.error("Failed to dispose of modelled view database runtime support structures", e);
+        } catch (ServiceNotFoundException e) {
+            Logger.defaultLogError(e);
+        } catch (DatabaseException e) {
+            Logger.defaultLogError(e);
         }
     }
 
@@ -381,10 +394,10 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
             }
         }
     }
-
+    
     // Can be used to cancel already scheduled dispose
     volatile boolean reallyClearExisting = false;
-
+    
     Runnable clearExisting = new Runnable() {
 
         @Override
@@ -432,5 +445,5 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
     protected IPropertyPage getPropertyPage() {
        return null;
     }
-
+    
 }
diff --git a/i18n.md b/i18n.md
index 8da7b4ad0e734723b56fdfa4f34c4511258f0bb5..780f6579e459fb46008433c293ba1f4ec82a7b31 100644 (file)
--- a/i18n.md
+++ b/i18n.md
@@ -1,10 +1,54 @@
 ## Strings externalized from bundles ##
 
 * [x] org.simantics.scl.ui
+* [x] org.simantics.db.procore.ui
+* [x] org.simantics.debug.ui 
+* [x] org.simantics.desktop.ui
+* [x] org.simantics.document.linking.ui
+* [x] org.simantics.document.ui
+* [x] org.simantics.document.ui.ontology
+* [x] org.simantics.export.ui
+* [x] org.simantics.fileimport.ui
+* [x] org.simantics.graphviz.ui
+* [x] org.simantics.help.ui
+* [x] org.simantics.image.ui
+* [x] org.simantics.issues.ui
+* [x] org.simantics.logging.ui
+* [x] org.simantics.message.ui
+* [x] org.simantics.migration.ui
+* ...
 
 ## TODO ##
+* /org.simantics.browsing.ui 
+* /org.simantics.browsing.ui.common (All can be ignored)
+* /org.simantics.browsing.ui.graph (Nothing to externalize or all can be ignored) 
+* /org.simantics.browsing.ui.graph  (Nothing to externalize or all can be ignored) 
+* /org.simantics.browsing.ui.graph.impl (Nothing to externalize or all can be ignored) 
+* /org.simantics.browsing.ui.model
+* /org.simantics.browsing.ui.nattable
+* /org.simantics.browsing.ui.ontology (Nothing to externalize or all can be ignored) 
+* /org.simantics.browsing.ui.platform (Nothing to externalize or all can be ignored) 
+* /org.simantics.browsing.ui.swt (Nothing to externalize or all can be ignored) 
+* /org.simantics.debug.browser.ui (Nothing to externalize or all can be ignored) 
+* /org.simantics.desktop.ui.ontology (No strings to externalize)
+* /org.simantics.issues.ui.ontology (Nothing to externalize)
+
+
+* /org.simantics.modeling.ui (In progress) 
+* /org.simantics.modeling.ui.workbench
+* /org.simantics.platform.ui.ontology
+* /org.simantics.scenegraph.ui
+* /org.simantics.simulation.ui
+* /org.simantics.spreadsheet.ui
+* /org.simantics.structural.ui
+* /org.simantics.team.ui
+* /org.simantics.tests.modelled.ui
+* /org.simantics.tests.modelled.ui.ontology
+* /org.simantics.ui
+* /org.simantics.ui.workspace.tracker
+* /org.simantics.utils.ui
+* /org.simantics.wiki.ui
 
-* [ ] org.simantics.event
-* [ ] org.simantics.modeling.ui
-* [ ] org.simantics.browsing.ui*
+* 
+* 
 * ...
index 4d0f06c1b8c98845e56a530b6d5617c3fb4bb41e..822da2a759488ac256e72aa5fa679804d1b20e88 100644 (file)
@@ -26,6 +26,8 @@
         <grpc.version.actual>1.14.0.b007</grpc.version.actual>
         <protobuf.version>3.5.1</protobuf.version>
         <zeroturnaround.version>1.10</zeroturnaround.version>
+        <eclipse.collections.version>9.2.0</eclipse.collections.version>
+        <caffeine.version>2.6.2</caffeine.version>
     </properties>
 
     <repositories>
                                     <source>true</source>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.collections:eclipse-collections-api:8.1.0</id>
+                                    <id>org.eclipse.collections:eclipse-collections-api:${eclipse.collections.version}</id>
                                     <override>true</override>
                                     <source>true</source>
                                     <instructions>
                                     </instructions>
                                 </artifact>
                                 <artifact>
-                                    <id>org.eclipse.collections:eclipse-collections:8.1.0</id>
+                                    <id>org.eclipse.collections:eclipse-collections:${eclipse.collections.version}</id>
                                     <source>true</source>
+                                    <instructions>
+                                        <Require-Bundle>org.eclipse.collections.eclipse-collections-api;bundle-version="${eclipse.collections.version}"</Require-Bundle>
+                                        <Import-Package>!org.eclipse.*,!sun.misc.*,*;resolution:=optional</Import-Package>
+                                    </instructions>
                                 </artifact>
                                 <artifact>
                                     <id>net.sf.trove4j:trove4j:3.0.3</id>
                                     <source>true</source>
                                     <transitive>false</transitive>
                                 </artifact>
+                                <artifact>
+                                    <id>com.github.ben-manes.caffeine:caffeine:${caffeine.version}</id>
+                                    <source>true</source>
+                                    <override>true</override>
+                                    <instructions>
+                                        <Bundle-SymbolicName>com.github.benmanes.caffeine</Bundle-SymbolicName>
+                                    </instructions>
+                                </artifact>
+                                <artifact>
+                                    <id>net.jcip:jcip-annotations:1.0</id>
+                                    <source>true</source>
+                                </artifact>
                             </artifacts>
                         </configuration>
                     </execution>
index 39b63c593852e73470d3111d489ef146b5e33d68..a8f5f2295811decf8f2aa75c0b35ae374d5b10ae 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
-<target name="Eclipse Oxygen" sequenceNumber="1536132643">
+<target name="Eclipse Oxygen" sequenceNumber="1536142643">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
       <unit id="com.google.guava" version="21.0.0.v20170206-1425"/>
       <unit id="org.bouncycastle.bcprov-jdk14.source" version="1.38.0"/>
       <unit id="org.bouncycastle.bctsp-jdk14" version="1.38.0"/>
       <unit id="org.bouncycastle.bctsp-jdk14.source" version="1.38.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections-api" version="8.1.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections-api.source" version="8.1.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections" version="8.1.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections.source" version="8.1.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections-api" version="9.2.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections-api.source" version="9.2.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections" version="9.2.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections.source" version="9.2.0"/>
       <unit id="org.eclipse.jetty.servlets" version="9.4.5.v20170502"/>
       <unit id="org.eclipse.jetty.servlets.source" version="9.4.5.v20170502"/>
+      <unit id="com.github.benmanes.caffeine" version="2.6.2"/>
+      <unit id="com.github.benmanes.caffeine.source" version="2.6.2"/>
       <unit id="org.glassfish.hk2.api" version="2.5.0.b32"/>
       <unit id="org.glassfish.hk2.api.source" version="2.5.0.b32"/>
       <unit id="org.glassfish.hk2.locator" version="2.5.0.b32"/>
index 83f2c2c7461f4c8a1e624ba24bc93665287a6bda..abbf6cf50c276cdc84634abb48408e7149cee55d 100644 (file)
@@ -292,6 +292,8 @@ location "http://www.simantics.org/download/master/external-components/maven" {
        org.eclipse.collections.eclipse-collections.source
        org.eclipse.jetty.servlets
        org.eclipse.jetty.servlets.source
+       com.github.benmanes.caffeine
+       com.github.benmanes.caffeine.source
        org.glassfish.hk2.api
        org.glassfish.hk2.api.source
        org.glassfish.hk2.locator
index f54a47e8bf3bdf0a5cb5970e11386290c927f50c..1cf10acc75a0cd13f028b47c88f037d68a7d3b0b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
-<target name="Simantics 1.37.0" sequenceNumber="1540817210">
+<target name="Simantics 1.37.0" sequenceNumber="1536142643">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
       <unit id="com.google.guava" version="21.0.0.v20170206-1425"/>
       <unit id="org.bouncycastle.bcprov-jdk14.source" version="1.38.0"/>
       <unit id="org.bouncycastle.bctsp-jdk14" version="1.38.0"/>
       <unit id="org.bouncycastle.bctsp-jdk14.source" version="1.38.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections-api" version="8.1.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections-api.source" version="8.1.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections" version="8.1.0"/>
-      <unit id="org.eclipse.collections.eclipse-collections.source" version="8.1.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections-api" version="9.2.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections-api.source" version="9.2.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections" version="9.2.0"/>
+      <unit id="org.eclipse.collections.eclipse-collections.source" version="9.2.0"/>
       <unit id="org.eclipse.jetty.servlets" version="9.4.5.v20170502"/>
       <unit id="org.eclipse.jetty.servlets.source" version="9.4.5.v20170502"/>
+      <unit id="com.github.benmanes.caffeine" version="2.6.2"/>
+      <unit id="com.github.benmanes.caffeine.source" version="2.6.2"/>
       <unit id="org.glassfish.hk2.api" version="2.5.0.b32"/>
       <unit id="org.glassfish.hk2.api.source" version="2.5.0.b32"/>
       <unit id="org.glassfish.hk2.locator" version="2.5.0.b32"/>