From: jsimomaa Date: Mon, 5 Jun 2017 11:56:31 +0000 (+0300) Subject: E4WorkbenchUtils.getMPartById to create the part if not already created X-Git-Tag: v1.31.0~333 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=695ffae899b981f31695e5fdd30ac8fed9fe84b8;p=simantics%2Fplatform.git E4WorkbenchUtils.getMPartById to create the part if not already created refs #7275 Change-Id: Iff469ad0586c8ad16f411ab232ffc5a47825ef72 --- diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4WorkbenchUtils.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4WorkbenchUtils.java index a7db1e2aa..3c1888a01 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4WorkbenchUtils.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/e4/E4WorkbenchUtils.java @@ -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; } }