]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CompilePGraphsAction.java
Externalize strings
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / actions / CompilePGraphsAction.java
index eda0228f9049d08ab1fba7e8ea0e5983d603de48..651f4f66b21128892a8bd0b8d595996db0f10bf1 100644 (file)
@@ -18,7 +18,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.adapter.ActionFactory;
 import org.simantics.graph.compiler.CompilationResult;
-import org.simantics.ltk.Problem;
+import org.simantics.graph.compiler.internal.ltk.Problem;
 import org.simantics.modeling.CompilePGraphs;
 import org.simantics.modeling.ui.Activator;
 import org.simantics.utils.ui.ExceptionUtils;
@@ -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 {
@@ -52,34 +52,43 @@ public class CompilePGraphsAction implements ActionFactory {
     }
 
     public static class CompileUserAgent implements CompilePGraphs.UserAgent {
+       
         @Override
         public void reportProblems(CompilationResult result) {
-            class ErrorMessageDialog extends MessageDialog {
-                public ErrorMessageDialog(Shell shell) {
-                    super(shell, 
-                            "Unsatisfied dependencies", null, 
-                            "The following dependencies were missing. Please import the dependencies and try again.", 
-                            MessageDialog.ERROR, new String[] { "Continue" }, 0);
-                }
+               Runnable runnable = () -> {
+                       class ErrorMessageDialog extends MessageDialog {
+                               public ErrorMessageDialog(Shell shell) {
+                                       super(shell, 
+                                                       Messages.CompilePGraphsAction_ProblemsinOntologyDefinitionFile, null, 
+                                                       Messages.CompilePGraphsAction_FollowingIssuesFound, 
+                                                       MessageDialog.ERROR, new String[] { Messages.CompilePGraphsAction_Continue }, 0);
+                               }
 
-                @Override
-                protected Control createCustomArea(Composite composite) {
-                    GridLayoutFactory.fillDefaults().applyTo(composite);
+                               @Override
+                               protected Control createCustomArea(Composite composite) {
+                                       GridLayoutFactory.fillDefaults().applyTo(composite);
 
-                    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");
-                    for (Problem problem : result.getWarnings())
-                        list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
+                                       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"); //$NON-NLS-1$ //$NON-NLS-2$
+                                       for (Problem problem : result.getWarnings())
+                                               list.add(problem.getLocation() + ": " + problem.getDescription() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
 
-                    return composite;
-                }
-            }
+                                       return composite;
+                               }
+                       }
 
-            ErrorMessageDialog md = new ErrorMessageDialog(Display.getCurrent().getActiveShell());
-            md.open();
+                       ErrorMessageDialog md = new ErrorMessageDialog(Display.getCurrent().getActiveShell());
+                       md.open();
+               };              
+               
+               Display display = Display.getCurrent();
+               if (display == null)
+                       display = Display.getDefault();
+               display.asyncExec(runnable);
         }
+
     }
 
 }