import org.simantics.db.Session;
import org.simantics.db.exception.DatabaseException;
import org.simantics.modeling.typicals.SyncTypicalTemplatesToInstances;
+import org.simantics.modeling.ui.diagramEditor.DiagramEditor;
import org.simantics.modeling.ui.documents.OpenPlainTextDocumentAdapter;
import org.simantics.modeling.ui.property.TypicalPropertyTester;
import org.simantics.modeling.ui.typicals.RuleChooserDialog;
// TODO: This is not good practice with E4 but an OK fallback for now
activeEditor = WorkbenchUtils.getActiveEditor();
}
- if (activeEditor == null)
+ if (activeEditor == null || (!(activeEditor instanceof DiagramEditor)))
return false;
if (DatabaseJob.inProgress())
return false;
if (activeEditor.getEditorInput() instanceof IResourceEditorInput) {
- IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
- return TypicalPropertyTester.isTypicalMasterEditor(Simantics.getSession(), input.getResource());
+ return TypicalPropertyTester.isTypicalMasterEditor(activeEditor);
} else {
return false;
}