3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.bulkeditor
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.core
.commands
.operations
.IOperationHistory
;
15 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
16 import org
.eclipse
.core
.runtime
.Assert
;
17 import org
.eclipse
.ui
.IEditorInput
;
18 import org
.eclipse
.ui
.IEditorPart
;
19 import org
.eclipse
.ui
.PartInitException
;
21 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
22 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AbstractBulkEditorInput
;
23 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.BulkEditorInputTypeValues
.BulkEditorInputType
;
24 import eu
.etaxonomy
.taxeditor
.bulkeditor
.internal
.TaxeditorBulkeditorPlugin
;
25 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
28 * <p>BulkEditorUtil class.</p>
31 * @created Mar 12, 2010
34 public class BulkEditorUtil
extends AbstractUtility
{
37 * Opens a new editor window with the given input
42 * @throws PartInitException
44 private static IEditorPart
open(IEditorInput input
, String editorId
)
45 throws PartInitException
{
46 return getActivePage().openEditor(input
, editorId
);
50 * <p>openEmptyEditor</p>
52 * @param inputType a {@link eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues.BulkEditorInputType} object.
53 * @throws org.eclipse.ui.PartInitException if any.
55 public static void openEmptyEditor(BulkEditorInputType inputType
) throws PartInitException
{
56 AbstractBulkEditorInput editorInput
= AbstractBulkEditorInput
.NewInstance(inputType
);
57 open(editorInput
, BulkEditor
.ID
);
63 * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
64 * @throws org.eclipse.ui.PartInitException if any.
66 public static void openEditor(IdentifiableEntity entity
) throws PartInitException
{
67 Assert
.isNotNull(entity
, "Entity must not be null");
68 AbstractBulkEditorInput editorInput
= AbstractBulkEditorInput
.NewInstance(entity
);
69 open(editorInput
, BulkEditor
.ID
);
75 * @return a {@link java.lang.String} object.
77 protected static String
getPluginId(){
78 return TaxeditorBulkeditorPlugin
.PLUGIN_ID
;
82 * <p>getUndoContext</p>
84 * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
86 public static IUndoContext
getUndoContext(){
87 return IOperationHistory
.GLOBAL_UNDO_CONTEXT
;