]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.e4/src/org/argeo/cms/e4/CmsE4Utils.java
1 package org
.argeo
.cms
.e4
;
3 import org
.argeo
.cms
.CmsException
;
4 import org
.eclipse
.e4
.ui
.model
.application
.ui
.basic
.MPart
;
5 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
6 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
.PartState
;
8 public class CmsE4Utils
{
9 public static void openEditor(EPartService partService
, String editorId
, String key
, String state
) {
10 for (MPart part
: partService
.getParts()) {
11 String id
= part
.getPersistedState().get(key
);
12 if (id
!= null && state
.equals(id
)) {
13 partService
.showPart(part
, PartState
.ACTIVATE
);
19 MPart part
= partService
.createPart(editorId
);
21 throw new CmsException("No editor found with id " + editorId
);
22 part
.getPersistedState().put(key
, state
);
23 partService
.showPart(part
, PartState
.ACTIVATE
);
26 private CmsE4Utils() {