2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
;
12 import org
.eclipse
.core
.commands
.operations
.IOperationHistory
;
13 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
14 import org
.eclipse
.core
.runtime
.Assert
;
15 import org
.eclipse
.ui
.IEditorInput
;
16 import org
.eclipse
.ui
.IEditorPart
;
17 import org
.eclipse
.ui
.PartInitException
;
19 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
20 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AbstractBulkEditorInput
;
21 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.BulkEditorInputType
;
22 import eu
.etaxonomy
.taxeditor
.bulkeditor
.internal
.TaxeditorBulkeditorPlugin
;
23 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
26 * <p>BulkEditorUtil class.</p>
29 * @created Mar 12, 2010
32 public class BulkEditorUtil
extends AbstractUtility
{
35 * Opens a new editor window with the given input
40 * @throws PartInitException
42 private static IEditorPart
open(IEditorInput input
, String editorId
)
43 throws PartInitException
{
44 return getActivePage().openEditor(input
, editorId
);
48 * <p>openEmptyEditor</p>
50 * @param inputType a {@link eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues.BulkEditorInputType} object.
51 * @throws org.eclipse.ui.PartInitException if any.
53 public static void openEmptyEditor(BulkEditorInputType inputType
) throws PartInitException
{
54 AbstractBulkEditorInput editorInput
= AbstractBulkEditorInput
.NewInstance(inputType
);
55 open(editorInput
, BulkEditor
.ID
);
61 * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
62 * @throws org.eclipse.ui.PartInitException if any.
64 public static void openEditor(IdentifiableEntity entity
) throws PartInitException
{
65 Assert
.isNotNull(entity
, "Entity must not be null");
66 AbstractBulkEditorInput editorInput
= AbstractBulkEditorInput
.NewInstance(entity
);
67 open(editorInput
, BulkEditor
.ID
);
73 * @return a {@link java.lang.String} object.
75 public static String
getPluginId(){
76 return TaxeditorBulkeditorPlugin
.PLUGIN_ID
;
80 * <p>getUndoContext</p>
82 * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
84 public static IUndoContext
getUndoContext(){
85 return IOperationHistory
.GLOBAL_UNDO_CONTEXT
;