]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix typical toolbar calculations to not throw ClassCastExceptions 84/2684/4
authorjsimomaa <jani.simomaa@gmail.com>
Mon, 25 Feb 2019 09:25:15 +0000 (11:25 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 25 Feb 2019 11:20:50 +0000 (11:20 +0000)
gitlab #264

Change-Id: I352dcf48397f76986a44c01494a7ff5c89852f4a

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 9e58624803a8abfd559d230e17ffba77a62e40e0..df95cb90df4f31fed66fbb17a5b4a2991b59719a 100644 (file)
@@ -44,8 +44,12 @@ public class SyncCurrentTypicalInstanceWithTemplate {
             return false;
         if (DatabaseJob.inProgress())
             return false;
-        IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
-        return TypicalPropertyTester.isTypicalInstanceEditor(Simantics.getSession(), input.getResource());
+        if (activeEditor.getEditorInput() instanceof IResourceEditorInput) {
+            IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
+            return TypicalPropertyTester.isTypicalInstanceEditor(Simantics.getSession(), input.getResource());
+        } else {
+            return false;
+        }
     }
     
     @Execute
index 3558aaa62cd9e702273ba6b104066381a4108d0b..9936b603b32395d8cd0cdd7cb69f32f58effe6fa 100644 (file)
@@ -43,8 +43,12 @@ public class SyncCurrentTypicalTemplateToInstances {
             return false;
         if (DatabaseJob.inProgress())
             return false;
-        IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
-        return TypicalPropertyTester.isTypicalMasterEditor(Simantics.getSession(), input.getResource());
+        if (activeEditor.getEditorInput() instanceof IResourceEditorInput) {
+            IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
+            return TypicalPropertyTester.isTypicalMasterEditor(Simantics.getSession(), input.getResource());
+        } else {
+            return false;
+        }
     }
     
     @Execute