// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
// return null;
// }
}
-
+
+ /**
+ * If the object given is already a {@link CdmBase} then it is returned.<br>
+ * If it is a facade then it is asked for its "responsible" CdmBase entity.<br>
+ * Otherwise an exception is thrown.
+ * @param object the object to test for CdmBase
+ * @return a CdmBase object
+ * @throws IllegalArgumentException if the tested object is neither a CdmBase nor a facade
+ */
+ public static CdmBase getCdmEntity(Object object){
+ // TODO temporary solution for ticket #????
+ if(object instanceof DerivedUnitFacade){
+ return ((DerivedUnitFacade)object).getBaseUnit();
+ }
+ else if(object instanceof CdmBase){
+ return (CdmBase) object;
+ }
+ throw new IllegalArgumentException("Object is neither a CdmBase nor an EntityFacade");
+ }
+
/**
* <p>getOperationHistory</p>
*
return TaxeditorStorePlugin.getDefault().getWorkbench().
getOperationSupport().getOperationHistory();
}
-
+
/**
* <p>setStatusLineManager</p>
*
public static void setStatusLineManager(IStatusLineManager manager) {
statusLineManager = manager;
}
-
+
/**
* <p>getUndoContext</p>
public static IUndoContext getUndoContext(){
return IOperationHistory.GLOBAL_UNDO_CONTEXT;
}
-
+
/**
* <p>getPluginId</p>
*
}
/**
- *
+ *
* @return
*/
public static IEditorInput getActiveEditorInput() {