Revision dea7cd9c
Added by Patrick Plitzner over 9 years ago
- added command, handler, double click listener to open taxa from associated taxa section in details view
- caught runtime exception for orphaned taxa
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java | ||
---|---|---|
27 | 27 |
import org.eclipse.ui.PartInitException; |
28 | 28 |
import org.eclipse.ui.handlers.HandlerUtil; |
29 | 29 |
|
30 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
30 | 31 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
31 | 32 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
32 | 33 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
34 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
33 | 35 |
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor; |
34 | 36 |
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput; |
35 | 37 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
36 | 38 |
import eu.etaxonomy.taxeditor.editor.key.KeyEditor; |
37 | 39 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput; |
38 |
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput; |
|
39 | 40 |
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor; |
41 |
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput; |
|
40 | 42 |
import eu.etaxonomy.taxeditor.editor.view.dataimport.BioCaseEditorInput; |
41 | 43 |
import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor; |
42 | 44 |
import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorInput; |
... | ... | |
46 | 48 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; |
47 | 49 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; |
48 | 50 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
51 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
52 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
49 | 53 |
|
50 | 54 |
/** |
51 | 55 |
* Utility for the editor package |
... | ... | |
157 | 161 |
*/ |
158 | 162 |
public static void openTaxonBase(UUID taxonBaseUuid) |
159 | 163 |
throws PartInitException { |
164 |
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid); |
|
165 |
if (taxonBase != null && taxonBase.isOrphaned()) { |
|
166 |
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."); |
|
167 |
return; |
|
168 |
} |
|
160 | 169 |
TaxonEditorInput input = TaxonEditorInput |
161 | 170 |
.NewInstanceFromTaxonBase(taxonBaseUuid); |
162 | 171 |
open(input); |
... | ... | |
433 | 442 |
} |
434 | 443 |
return null; |
435 | 444 |
} |
445 |
|
|
446 |
/** |
|
447 |
* Opens a taxon editor for the given object if the given object is a valid input. |
|
448 |
* @param object the object for which the editor will be opened |
|
449 |
* @throws PartInitException |
|
450 |
*/ |
|
451 |
public static void openTaxonEditor(Object object) throws PartInitException { |
|
452 |
if(object instanceof TaxonBase<?>){ |
|
453 |
openTaxonBase(((TaxonBase<?>) object).getUuid()); |
|
454 |
} |
|
455 |
} |
|
436 | 456 |
} |
Also available in: Unified diff