import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor;
import org.simantics.db.Resource;
import org.simantics.utils.datastructures.ArrayMap;
+import org.simantics.utils.ui.workbench.WorkbenchUtils;
/**
* @author Tuukka Lehtonen
return partService.findPart(partId);
}
+ @SuppressWarnings("restriction")
+ public static IEditorPart getActiveIEditorPart(MPart mActiveEditorPart) {
+ // TODO: Fix this when we get rid of CompatibilityEditors
+ IEditorPart activeEditor = null;
+ if (mActiveEditorPart != null) {
+ Object editor = mActiveEditorPart.getObject();
+ if (editor instanceof CompatibilityEditor) {
+ CompatibilityEditor compEditor = (CompatibilityEditor) editor;
+ activeEditor = compEditor.getEditor();
+ } else {
+ // TODO: This is not good practice with E4 but an OK fallback for now
+ activeEditor = WorkbenchUtils.getActiveEditor();
+ }
+ }
+ return activeEditor;
+ }
}