]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Add DatabaseJob.inProgress() checking to certain UI-handlers 04/2704/1
authorjsimomaa <jani.simomaa@gmail.com>
Thu, 8 Nov 2018 07:03:03 +0000 (09:03 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 25 Feb 2019 14:01:59 +0000 (14:01 +0000)
gitlab #186

Change-Id: Ib8d547a54ffefde6ebf887e162d3adc8479c6de4
(cherry picked from commit d924aa9e2691606e0bc8044cce01aff4abcc7bc9)

bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/EditStyleHandler.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/handlers/e4/SyncCurrentTypicalInstanceWithTemplate.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/handlers/e4/SyncCurrentTypicalTemplateToInstances.java

index 40c76d7470d50cfb455f4726e6365b97a54f1e72..d02778d5585a93bc0b0589dcb42f0922a14444b2 100644 (file)
@@ -23,6 +23,7 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor;
+import org.simantics.DatabaseJob;
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
@@ -59,7 +60,8 @@ public class EditStyleHandler {
             return false;
         if (s == null)
             return false;
-
+        if (DatabaseJob.inProgress())
+            return false;
         final Resource[] resources = ResourceAdaptionUtils.toResources(s);
         if (resources.length != 0) {
             if (!Arrays.equals(resources, lastResources)) {
index 0c9641a27f45275ce221c06b4e58c3d68c071c17..9e58624803a8abfd559d230e17ffba77a62e40e0 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor;
+import org.simantics.DatabaseJob;
 import org.simantics.Simantics;
 import org.simantics.db.Resource;
 import org.simantics.db.Session;
@@ -41,6 +42,8 @@ public class SyncCurrentTypicalInstanceWithTemplate {
         }
         if (activeEditor == null)
             return false;
+        if (DatabaseJob.inProgress())
+            return false;
         IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
         return TypicalPropertyTester.isTypicalInstanceEditor(Simantics.getSession(), input.getResource());
     }
index 0678d5c3b93dd4f996f1b8db983bde8427cd9f8c..3558aaa62cd9e702273ba6b104066381a4108d0b 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor;
+import org.simantics.DatabaseJob;
 import org.simantics.Simantics;
 import org.simantics.db.Resource;
 import org.simantics.db.Session;
@@ -40,6 +41,8 @@ public class SyncCurrentTypicalTemplateToInstances {
         }
         if (activeEditor == null)
             return false;
+        if (DatabaseJob.inProgress())
+            return false;
         IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
         return TypicalPropertyTester.isTypicalMasterEditor(Simantics.getSession(), input.getResource());
     }