]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed SCL Console Clear Console active-state when imports are erroneous 01/1401/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 26 Jan 2018 11:33:10 +0000 (13:33 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 26 Jan 2018 11:33:10 +0000 (13:33 +0200)
Current imports were set too early in SCLConsoleView which before the
SCLConsoleListener that enables the buttons is registered.

refs #7727

Change-Id: I7cb0645bea5dc48a4ad54f2147c83cb8dfb2f35f

bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/Activator.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/SCLConsoleListener.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLScriptConsoleView.java

index 788615ae08e3bed0b3167a263fc7b2955c86f8d5..5a4a58f33ffbe971cbc4daa8a5caeb975171605f 100644 (file)
@@ -98,7 +98,7 @@ public class Activator extends AbstractUIPlugin {
     public void start(BundleContext context) throws Exception {
         super.start(context);
         plugin = this;
-        this.context = context;
+        Activator.context = context;
 
         Bundle bundle = context.getBundle();
 
@@ -180,14 +180,6 @@ public class Activator extends AbstractUIPlugin {
                     public void startedExecution() {
                         Simantics.getSession().markUndoPoint();
                     }
-                    
-                    @Override
-                    public void finishedExecution() {
-                    }
-                    
-                    @Override
-                    public void consoleIsNotEmptyAnymore() {
-                    }
                 }, properties);
         
         context.registerService(ImportModulesAction.class, OntologyImportModulesAction.INSTANCE,
index e5cc305840892ffb1b2b85250fa463c5f27d2694..f07dfc58eed22de8725ce82d8ddd0e291b6e127f 100644 (file)
@@ -1,7 +1,7 @@
 package org.simantics.scl.compiler.commands;
 
 public interface SCLConsoleListener {
-    void startedExecution();
-    void finishedExecution();
-    void consoleIsNotEmptyAnymore();
+    default void startedExecution() {}
+    default void finishedExecution() {}
+    default void consoleIsNotEmptyAnymore() {}
 }
index 4c0d829f350580386299bef6ac222bcc1cdbeb71..67de0b2ffe9e02571d75ec114c22416498e51274 100644 (file)
@@ -173,11 +173,6 @@ public class SCLConsoleView extends ViewPart {
         store.setDefault(REFRESH_AUTOMATICALLY, true);
         
         this.console = new SCLConsole(parent, SWT.NONE);
-        
-        setRefreshAutomatically(store.getBoolean(REFRESH_AUTOMATICALLY), false);
-        setCurrentImports(readImportPreferences());
-
-        addScriptDropSupport(console);
 
         IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
         
@@ -253,7 +248,7 @@ public class SCLConsoleView extends ViewPart {
                 manageImports();
             }
         });
-        
+
         // Show action for running SCL tests if in development mode
         if (Platform.inDevelopmentMode()) {
             toolBarManager.add(new Action("Run tests",
@@ -266,6 +261,12 @@ public class SCLConsoleView extends ViewPart {
         }
         
         toolBarManager.update(true);
+
+        setRefreshAutomatically(store.getBoolean(REFRESH_AUTOMATICALLY), false);
+        // Do this after the actions and SCLConsoleListener are
+        // registered because it can cause output to the console.
+        setCurrentImports(readImportPreferences());
+        addScriptDropSupport(console);
     }
 
     private class ScriptRunningDropTarget extends DropTargetAdapter {
index 71801c69025d8b150985bff4a9914fae000b863b..cef58bb3d5c333053d531bf3cfc55d84963fe0b5 100644 (file)
@@ -26,12 +26,6 @@ public class SCLScriptConsoleView extends ViewPart {
         toolBarManager.add(clearAction);
 
         console.addListener(new SCLConsoleListener() {
-            @Override
-            public void startedExecution() {
-            }
-            @Override
-            public void finishedExecution() {
-            }
             @Override
             public void consoleIsNotEmptyAnymore() {
                 clearAction.setEnabled(true);