ref #8229: update correct property path for search in name and taxon bulkeditor
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / BulkEditorUtil.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.bulkeditor;
11
12 import org.eclipse.core.commands.operations.IOperationHistory;
13 import org.eclipse.core.commands.operations.IUndoContext;
14 import org.eclipse.e4.ui.model.application.MApplication;
15 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16 import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
17 import org.eclipse.e4.ui.workbench.modeling.EModelService;
18 import org.eclipse.e4.ui.workbench.modeling.EPartService;
19 import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
20
21 import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
22 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
23 import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
24 import eu.etaxonomy.taxeditor.model.AbstractUtility;
25 import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
26
27 /**
28 * <p>BulkEditorUtil class.</p>
29 *
30 * @author n.hoffmann
31 * @created Mar 12, 2010
32 * @version 1.0
33 */
34 public class BulkEditorUtil extends AbstractUtility{
35
36
37 /**
38 * <p>getPluginId</p>
39 *
40 * @return a {@link java.lang.String} object.
41 */
42 public static String getPluginId(){
43 return TaxeditorBulkeditorPlugin.PLUGIN_ID;
44 }
45
46 public static void openBulkEditor(AbstractBulkEditorInput<?> input,
47 EModelService modelService, EPartService partService, MApplication application){
48 MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
49 MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
50 if(editorAreaPartStack!=null){
51 editorAreaPartStack.getChildren().add(part);
52 }
53 part = partService.showPart(part, PartState.ACTIVATE);
54 BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
55 bulkEditor.init(input);
56 }
57
58 /**
59 * <p>getUndoContext</p>
60 *
61 * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
62 */
63 public static IUndoContext getUndoContext(){
64 return IOperationHistory.GLOBAL_UNDO_CONTEXT;
65 }
66 }