]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Util.java
Externalize strings in org.simantics.db.procore.ui
[simantics/platform.git] / bundles / org.simantics.db.procore.ui / src / org / simantics / db / procore / ui / internal / Util.java
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();
     }
 }