import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.BioCaseEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor;
+//import eu.etaxonomy.taxeditor.store.view.dataimport.BioCaseEditorInput;
+//import eu.etaxonomy.taxeditor.view.dataimport.DataImportEditor;
+//import eu.etaxonomy.taxeditor.view.dataimport.DataImportEditorInput;
+//import eu.etaxonomy.taxeditor.view.dataimport.GbifImportEditor;
+//import eu.etaxonomy.taxeditor.view.dataimport.GbifImportEditorInput;
+//import eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
*/
private static IEditorPart open(final IEditorInput input,
final String editorId) throws PartInitException {
- return getActivePage().openEditor(input, editorId);
+ IEditorPart editor = getActivePage().openEditor(input, editorId);
+ if(input != null &&
+ editor.getEditorInput() != null &&
+ input != editor.getEditorInput() &&
+ input instanceof CdmEntitySessionInput) {
+ ((CdmEntitySessionInput)input).dispose();
+ }
+ return editor;
}
/**
* @param input a {@link DataImportEditorInput}
* @throws PartInitException
*/
- public static void open(DataImportEditorInput<?> input)
- throws PartInitException {
- if(input instanceof BioCaseEditorInput){
- open(input, SpecimenImportEditor.ID);
- }
- else if(input instanceof GbifImportEditorInput){
- open(input, GbifImportEditor.ID);
- }
- }
+// public static void open(DataImportEditorInput<?> input)
+// throws PartInitException {
+// if(input instanceof BioCaseEditorInput){
+// open(input, SpecimenImportEditor.ID);
+// }
+// else if(input instanceof GbifImportEditorInput){
+// open(input, GbifImportEditor.ID);
+// }
+// }
/**
* Taxon Editors may be opened by supplying a taxon node uuid. Session gets
throws PartInitException {
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
if (taxonBase != null && taxonBase.isOrphaned()) {
- MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
+ if(taxonBase.isInstanceOf(Synonym.class)){
+ MessagingUtils.warningDialog("Orphaned accepted taxon", TaxonEditorInput.class, "The accepted "
+ + "taxon of this synonym is not part of any classification. Editing with the "
+ + "name editor is currently not implemented. Try to edit the taxon with the bulk editor.");
return;
+ }
+ else{
+ MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon "
+ + "i.e. a taxon that is not connected to a classification and not having any taxonomic "
+ + "relationships. Editing of orphaned taxa in the name editor is currently not supported. "
+ + "Try editing with the bulk editor");
+ return;
+ }
}
TaxonEditorInput input = TaxonEditorInput
.NewInstanceFromTaxonBase(taxonBaseUuid);
- open(input);
+ if(input!=null && input.getTaxonNode()!=null){
+ open(input);
+ }
}
/**
open(input);
}
- public static void openPolytomousKeyEditor(UUID polytomousKeyUuid, String name)
- throws Exception {
- PolytomousKeyEditorInput input = new PolytomousKeyEditorInput(polytomousKeyUuid, name);
- open(input);
- }
+// public static void openPolytomousKeyEditor(UUID polytomousKeyUuid, String name)
+// throws Exception {
+// PolytomousKeyEditorInput input = new PolytomousKeyEditorInput(polytomousKeyUuid, name);
+// open(input);
+// }
public static void openCdmAuthorities(UUID groupUuid)
throws Exception {
}
}
- /**
- * Iterates recursively over all originals having the given specimen as a derivate.
- * If a {@link FieldUnit} is found it is returned
- * @param specimen the start element for which the originals are iterated recursively
- * @return the FieldUnit if found, <code>null</code> otherwise
- */
- public static FieldUnit getFieldUnit(SpecimenOrObservationBase<?> specimen){
- SpecimenOrObservationBase<?> topMostDerivate = getTopMostDerivate(specimen);
- if(topMostDerivate instanceof FieldUnit) {
- return (FieldUnit) topMostDerivate;
- }
- return null;
- }
-
/**
* If the current selection is a single {@link TreeNode} it will be returned.
* @param selection the selection to check