import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
+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.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* <p>BulkEditorUtil class.</p>
return TaxeditorBulkeditorPlugin.PLUGIN_ID;
}
+ public static void openBulkEditor(AbstractBulkEditorInput<?> input,
+ EModelService modelService, EPartService partService, MApplication application){
+ MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
+ bulkEditor.init(input);
+ }
+
/**
* <p>getUndoContext</p>
*
package eu.etaxonomy.taxeditor.bulkeditor.e4.handler;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.MApplication;
+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 eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
-import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
public class OpenBulkEditorHandlerE4 {
@Execute
- public void execute(ParameterizedCommand command, EPartService partService) {
+ public void execute(ParameterizedCommand command, EPartService partService, MApplication application, EModelService modelService) {
String inputTypeId = (String) command.getParameterMap().get(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID);
BulkEditorInputType inputType = BulkEditorInputType.getById(inputTypeId);
-
- MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
- part = partService.showPart(part, PartState.ACTIVATE);
- BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
- bulkEditor.init(AbstractBulkEditorInput.NewInstance(inputType));
+ AbstractBulkEditorInput input = AbstractBulkEditorInput.NewInstance(inputType);
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
}
}
import java.util.UUID;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
-import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
@Override
protected void open(IdentifiableEntity entity, Shell shell, EPartService partService) {
- MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
- part = partService.showPart(part, PartState.ACTIVATE);
- BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
- bulkEditor.init(AbstractBulkEditorInput.NewInstance(entity));
+ AbstractBulkEditorInput input = AbstractBulkEditorInput.NewInstance(entity);
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
}
/**
import java.util.UUID;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
-import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
@Override
protected void open(TaxonNode entity, Shell shell, EPartService partService) {
- MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
- part = partService.showPart(part, PartState.ACTIVATE);
- BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
- bulkEditor.init(AbstractBulkEditorInput.NewInstance(entity.getTaxon()));
+ AbstractBulkEditorInput input = AbstractBulkEditorInput.NewInstance(entity.getTaxon());
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
}
/**
package eu.etaxonomy.taxeditor.editor;
import java.util.Collection;
-import java.util.List;
import java.util.UUID;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.e4.ui.model.application.MApplication;
-import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* Utility for the editor package
if(part==null){
part = partService.createPart(NAME_EDITOR_ID);
- MPartStack editorAreaPartStack = getEditorAreaPartStack(application, modelService);
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
if(editorAreaPartStack!=null){
editorAreaPartStack.getChildren().add(part);
}
}
}
- public static MPartStack getEditorAreaPartStack(MApplication application, EModelService modelService){
- //FIXME E4 hack for opening in e3 editor area
- if(application!=null){
- //FIXME E4 hack for opening in e3 editor area
- List<MArea> elements = modelService.findElements(application, "org.eclipse.ui.editorss", MArea.class, null);
- for (MArea mArea : elements) {
- List<MPartSashContainerElement> children = mArea.getChildren();
- for (MPartSashContainerElement mPartSashContainerElement : children) {
- if(mPartSashContainerElement instanceof MPartStack){
- return (MPartStack) mPartSashContainerElement;
- }
- }
- }
- }
- return null;
- }
-
/**
* An uninitialized taxon is one that hasn't been saved yet. As such, it
* should appear in neither the list of recent names nor in the taxonomic
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler;
import org.eclipse.e4.ui.model.application.MApplication;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
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 eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
-import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
public class OpenRelatedConceptInBulkEditorHandlerE4 extends OpenRelatedConceptHandlerE4{
@Override
protected void openConcept(TaxonBase<?> relatedTaxon, EModelService modelService, EPartService partService, MApplication application) {
AbstractBulkEditorInput<?> input = AbstractBulkEditorInput.NewInstance(relatedTaxon);
- MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
- part = partService.showPart(part, PartState.ACTIVATE);
- BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
- bulkEditor.init(input);
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
}
}
*/
package eu.etaxonomy.taxeditor.workbench;
+import java.util.List;
+
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
}
return null;
}
+
+ public static MPartStack getEditorAreaPartStack(MApplication application, EModelService modelService){
+ //FIXME E4 hack for opening in e3 editor area
+ if(application!=null){
+ //FIXME E4 hack for opening in e3 editor area
+ List<MArea> elements = modelService.findElements(application, "org.eclipse.ui.editorss", MArea.class, null);
+ for (MArea mArea : elements) {
+ List<MPartSashContainerElement> children = mArea.getChildren();
+ for (MPartSashContainerElement mPartSashContainerElement : children) {
+ if(mPartSashContainerElement instanceof MPartStack){
+ return (MPartStack) mPartSashContainerElement;
+ }
+ }
+ }
+ }
+ return null;
+ }
}