]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramEditor.java
Externalize strings
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / diagramEditor / e4 / DiagramEditor.java
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$
         }
     }