Revision 09a1be0a
Added by Patrick Plitzner about 10 years ago
- added util method to get for getting a CDM entity (used in authenication/permission framework)
- made use of this method where the type of the parameter was too general (like object)
- made getBaseUnit() of DerivedUnitFacade public
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
18 | 18 |
import org.eclipse.ui.IEditorInput; |
19 | 19 |
import org.eclipse.ui.IEditorPart; |
20 | 20 |
|
21 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
|
22 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
21 | 23 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
22 | 24 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
23 | 25 |
|
... | ... | |
41 | 43 |
// return null; |
42 | 44 |
// } |
43 | 45 |
} |
44 |
|
|
46 |
|
|
47 |
/** |
|
48 |
* If the object given is already a {@link CdmBase} then it is returned.<br> |
|
49 |
* If it is a facade then it is asked for its "responsible" CdmBase entity.<br> |
|
50 |
* Otherwise an exception is thrown. |
|
51 |
* @param object the object to test for CdmBase |
|
52 |
* @return a CdmBase object |
|
53 |
* @throws IllegalArgumentException if the tested object is neither a CdmBase nor a facade |
|
54 |
*/ |
|
55 |
public static CdmBase getCdmEntity(Object object){ |
|
56 |
// TODO temporary solution for ticket #???? |
|
57 |
if(object instanceof DerivedUnitFacade){ |
|
58 |
return ((DerivedUnitFacade)object).getBaseUnit(); |
|
59 |
} |
|
60 |
else if(object instanceof CdmBase){ |
|
61 |
return (CdmBase) object; |
|
62 |
} |
|
63 |
throw new IllegalArgumentException("Object is neither a CdmBase nor an EntityFacade"); |
|
64 |
} |
|
65 |
|
|
45 | 66 |
/** |
46 | 67 |
* <p>getOperationHistory</p> |
47 | 68 |
* |
... | ... | |
51 | 72 |
return TaxeditorStorePlugin.getDefault().getWorkbench(). |
52 | 73 |
getOperationSupport().getOperationHistory(); |
53 | 74 |
} |
54 |
|
|
75 |
|
|
55 | 76 |
/** |
56 | 77 |
* <p>setStatusLineManager</p> |
57 | 78 |
* |
... | ... | |
60 | 81 |
public static void setStatusLineManager(IStatusLineManager manager) { |
61 | 82 |
statusLineManager = manager; |
62 | 83 |
} |
63 |
|
|
84 |
|
|
64 | 85 |
|
65 | 86 |
/** |
66 | 87 |
* <p>getUndoContext</p> |
... | ... | |
70 | 91 |
public static IUndoContext getUndoContext(){ |
71 | 92 |
return IOperationHistory.GLOBAL_UNDO_CONTEXT; |
72 | 93 |
} |
73 |
|
|
94 |
|
|
74 | 95 |
/** |
75 | 96 |
* <p>getPluginId</p> |
76 | 97 |
* |
... | ... | |
81 | 102 |
} |
82 | 103 |
|
83 | 104 |
/** |
84 |
*
|
|
105 |
* |
|
85 | 106 |
* @return |
86 | 107 |
*/ |
87 | 108 |
public static IEditorInput getActiveEditorInput() { |
Also available in: Unified diff