merging in latest changes from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / store / StoreUtil.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.store;
12
13 import java.util.UUID;
14
15 import org.eclipse.core.commands.operations.IOperationHistory;
16 import org.eclipse.core.commands.operations.IUndoContext;
17 import org.eclipse.core.runtime.IStatus;
18 import org.eclipse.jface.action.IStatusLineManager;
19 import org.eclipse.ui.IEditorInput;
20 import org.eclipse.ui.IEditorPart;
21
22 import eu.etaxonomy.cdm.model.common.TermBase;
23 import eu.etaxonomy.taxeditor.model.AbstractUtility;
24 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
25
26 /**
27 * <p>StoreUtil class.</p>
28 *
29 * @author n.hoffmann
30 * @created 11.05.2009
31 * @version 1.0
32 */
33 public class StoreUtil extends AbstractUtility {
34
35 /**
36 * <p>checktaxonExists</p>
37 *
38 * @param fromString a {@link java.util.UUID} object.
39 */
40 public static void checktaxonExists(UUID fromString) {
41 // if (CdmStore.getTaxonService().getTaxonByUuid(UUID.fromString(uuid)) == null) {
42 // logger.warn("Couldn't find taxon with UUID " + uuid);
43 // return null;
44 // }
45 }
46
47 /**
48 * <p>getOperationHistory</p>
49 *
50 * @return a {@link org.eclipse.core.commands.operations.IOperationHistory} object.
51 */
52 public static IOperationHistory getOperationHistory() {
53 return TaxeditorStorePlugin.getDefault().getWorkbench().
54 getOperationSupport().getOperationHistory();
55 }
56
57 /**
58 * <p>setStatusLineManager</p>
59 *
60 * @param manager a {@link org.eclipse.jface.action.IStatusLineManager} object.
61 */
62 public static void setStatusLineManager(IStatusLineManager manager) {
63 statusLineManager = manager;
64 }
65
66
67 /**
68 * <p>getUndoContext</p>
69 *
70 * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
71 */
72 public static IUndoContext getUndoContext(){
73 return IOperationHistory.GLOBAL_UNDO_CONTEXT;
74 }
75
76 /**
77 * <p>getPluginId</p>
78 *
79 * @return a {@link java.lang.String} object.
80 */
81 public static String getPluginId(){
82 return TaxeditorStorePlugin.PLUGIN_ID;
83 }
84
85 /**
86 *
87 * @return
88 */
89 public static IEditorInput getActiveEditorInput() {
90 IEditorPart activeEditor = getActiveEditor();
91 if (activeEditor != null){
92 return activeEditor.getEditorInput();
93 }
94 return null;
95 }
96 }