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
.eclipse
.core
.commands
.operations
.IOperationHistory
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import org
.eclipse
.core
.runtime
.Assert
;
16 import org
.eclipse
.ui
.IEditorInput
;
17 import org
.eclipse
.ui
.IEditorPart
;
18 import org
.eclipse
.ui
.PartInitException
;
20 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
21 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AbstractBulkEditorInput
;
22 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.BulkEditorInputType
;
23 import eu
.etaxonomy
.taxeditor
.bulkeditor
.internal
.TaxeditorBulkeditorPlugin
;
24 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
27 * <p>BulkEditorUtil class.</p>
30 * @created Mar 12, 2010
33 public class BulkEditorUtil
extends AbstractUtility
{
36 * Opens a new editor window with the given input
41 * @throws PartInitException
43 private static IEditorPart
open(IEditorInput input
, String editorId
)
44 throws PartInitException
{
45 return getActivePage().openEditor(input
, editorId
);
49 * <p>openEmptyEditor</p>
51 * @param inputType a {@link eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues.BulkEditorInputType} object.
52 * @throws org.eclipse.ui.PartInitException if any.
54 public static void openEmptyEditor(BulkEditorInputType inputType
) throws PartInitException
{
55 AbstractBulkEditorInput editorInput
= AbstractBulkEditorInput
.NewInstance(inputType
);
56 open(editorInput
, BulkEditor
.ID
);
62 * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
63 * @throws org.eclipse.ui.PartInitException if any.
65 public static void openEditor(IdentifiableEntity entity
) throws PartInitException
{
66 Assert
.isNotNull(entity
, "Entity must not be null");
67 AbstractBulkEditorInput editorInput
= AbstractBulkEditorInput
.NewInstance(entity
);
68 open(editorInput
, BulkEditor
.ID
);
74 * @return a {@link java.lang.String} object.
76 protected static String
getPluginId(){
77 return TaxeditorBulkeditorPlugin
.PLUGIN_ID
;
81 * <p>getUndoContext</p>
83 * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
85 public static IUndoContext
getUndoContext(){
86 return IOperationHistory
.GLOBAL_UNDO_CONTEXT
;