E4WorkbenchUtils.getMPartById to create the part if not already created 97/597/3
authorjsimomaa <jani.simomaa@gmail.com>
Mon, 5 Jun 2017 11:56:31 +0000 (14:56 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 5 Jun 2017 20:16:44 +0000 (23:16 +0300)
refs #7275

Change-Id: Iff469ad0586c8ad16f411ab232ffc5a47825ef72

bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4WorkbenchUtils.java

index a7db1e2aa930e8dd0974aed267a941687309e95f..3c1888a0112c2c2f382e82c05915372ce51d440d 100644 (file)
@@ -161,7 +161,10 @@ public class E4WorkbenchUtils {
     public static MPart getMPartById(String partId) {
         IEclipseContext context = PlatformUI.getWorkbench().getService(IEclipseContext.class);
         EPartService partService = context.get(EPartService.class);
-        return partService.findPart(partId);
+        MPart part = partService.findPart(partId);
+        if (part == null)
+            part = partService.createPart(partId);
+        return part;
     }
 
 }