]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix typical toolbar calculations to not throw ClassCastExceptions 56/2856/1
authorjsimomaa <jani.simomaa@gmail.com>
Mon, 25 Feb 2019 09:25:15 +0000 (11:25 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 18 Apr 2019 11:00:32 +0000 (11:00 +0000)
gitlab #264

Change-Id: I352dcf48397f76986a44c01494a7ff5c89852f4a
(cherry picked from commit d8a328f8b97add888a0c89af1052978a226b7784)

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