ref #6925 Open PK editor in editor area
authorPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 27 Oct 2017 11:40:12 +0000 (13:40 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 27 Oct 2017 11:40:12 +0000 (13:40 +0200)
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingEditPolytomousKeyNodesHandlerE4.java

index 35a016269e1b069f48a6620e1f8cc02be9000350..d69578bf3d906cbd431b1498e4d15ee7ca8b6fd7 100644 (file)
@@ -20,6 +20,7 @@ Require-Bundle: org.eclipse.ui,
  eu.etaxonomy.taxeditor.cdmlib,
  eu.etaxonomy.taxeditor.store,
  eu.etaxonomy.taxeditor.editor,
+ eu.etaxonomy.taxeditor.workbench,
  org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0.v20160229-1459",
  org.eclipse.e4.ui.di,
  javax.inject,
index cc3d5d41e7fa01a3fa7de2753192d1c58822b7c7..a48e1708d5dce2e9a222d289dc055a2cf939dd34 100644 (file)
@@ -18,9 +18,12 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.e4.core.di.annotations.CanExecute;
 import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.MApplication;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
 import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
 import org.eclipse.e4.ui.services.IServiceConstants;
+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.jface.viewers.IStructuredSelection;
@@ -33,6 +36,7 @@ import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
 import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
 
 /**
  * @author cmathew
@@ -44,7 +48,7 @@ public class RemotingEditPolytomousKeyNodesHandlerE4 {
     public static final String OPENING_POLYTOMOUS_KEYS = Messages.EditPolytomousKeyNodesHandler_OPEN_KEYS;
 
     @Execute
-    public void execute(EPartService partService,
+    public void execute(EModelService modelService, EPartService partService, MApplication application,
             @Named(IServiceConstants.ACTIVE_SELECTION)Object selection) {
 
         if(selection instanceof StructuredSelection){
@@ -81,6 +85,10 @@ public class RemotingEditPolytomousKeyNodesHandlerE4 {
                                         }
                                         if(part==null){
                                             part = partService.createPart("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4");
+                                            MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+                                            if(editorAreaPartStack!=null){
+                                                editorAreaPartStack.getChildren().add(part);
+                                            }
                                             part = partService.showPart(part, PartState.ACTIVATE);
                                             PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) part.getObject();
                                             editor.init(input);