]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4WorkbenchUtils.java
Sync git svn branch with SVN repository r33144.
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / workbench / e4 / E4WorkbenchUtils.java
index 217185ddca0ac250f8eb5ffe30c7f12f1e6e4e56..901772ba7b68f88a8f25e3d7c7a01b6c13794c7d 100644 (file)
@@ -142,4 +142,26 @@ public class E4WorkbenchUtils {
         return stack;\r
     }\r
 \r
+    public static void openAndShowPart(MPart part) {\r
+        IEclipseContext context = PlatformUI.getWorkbench().getService(IEclipseContext.class);\r
+        EPartService partService = context.get(EPartService.class);\r
+        if (!partService.isPartVisible(part))\r
+            partService.showPart(part, PartState.ACTIVATE);\r
+        else\r
+            partService.activate(part);\r
+    }\r
+\r
+    \r
+    public static void openAndShowPart(String partId) {\r
+        IEclipseContext context = PlatformUI.getWorkbench().getService(IEclipseContext.class);\r
+        EPartService partService = context.get(EPartService.class);\r
+        partService.showPart(partId, PartState.ACTIVATE);\r
+    }\r
+\r
+    public static MPart getMPartById(String partId) {\r
+        IEclipseContext context = PlatformUI.getWorkbench().getService(IEclipseContext.class);\r
+        EPartService partService = context.get(EPartService.class);\r
+        return partService.findPart(partId);\r
+    }\r
+\r
 }\r