]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/handlers/e4/SyncCurrentTypicalInstanceWithTemplate.java
Fix typical toolbar calculations to not throw ClassCastExceptions
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / handlers / e4 / SyncCurrentTypicalInstanceWithTemplate.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