Revision fd4fff8b
Added by Patrick Plitzner about 8 years ago
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
702 | 702 |
label="%command.label.27" |
703 | 703 |
style="push"> |
704 | 704 |
</command> |
705 |
<separator |
|
706 |
name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator3" |
|
707 |
visible="true"> |
|
708 |
</separator> |
|
709 |
<menu |
|
710 |
label="%menu.label.1"> |
|
711 |
<dynamic |
|
712 |
class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.DynamicFeatureMenu" |
|
713 |
id="eu.etaxonomy.taxeditor.dynamicFeatureMenu"> |
|
714 |
</dynamic> |
|
715 |
<visibleWhen |
|
716 |
checkEnabled="true"> |
|
717 |
<or> |
|
718 |
<reference |
|
719 |
definitionId="isDescription"> |
|
720 |
</reference> |
|
721 |
<reference |
|
722 |
definitionId="isDescriptionElement"> |
|
723 |
</reference> |
|
724 |
<reference |
|
725 |
definitionId="isFeatureNodeContainer"> |
|
726 |
</reference> |
|
727 |
</or> |
|
728 |
</visibleWhen> |
|
729 |
</menu> |
|
730 | 705 |
<command |
731 | 706 |
commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionToTaxon" |
732 | 707 |
label="%command.label.28" |
... | ... | |
754 | 729 |
</or> |
755 | 730 |
</visibleWhen> |
756 | 731 |
</command> |
732 |
<dynamic |
|
733 |
class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu" |
|
734 |
id="eu.etaxonomy.taxeditor.editor.descriptive.cdmViewerContextMenu"> |
|
735 |
</dynamic> |
|
736 |
<separator |
|
737 |
name="eu.etaxonomy.taxeditor.editor.separator1"> |
|
738 |
</separator> |
|
757 | 739 |
<separator |
758 | 740 |
name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterNew" |
759 | 741 |
visible="true"> |
... | ... | |
775 | 757 |
<separator |
776 | 758 |
name="eu.etaxonomy.taxeditor.editor.separator1"> |
777 | 759 |
</separator> |
760 |
<separator |
|
761 |
name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator3" |
|
762 |
visible="true"> |
|
763 |
</separator> |
|
764 |
<menu |
|
765 |
label="%menu.label.1"> |
|
766 |
<dynamic |
|
767 |
class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.DynamicFeatureMenu" |
|
768 |
id="eu.etaxonomy.taxeditor.dynamicFeatureMenu"> |
|
769 |
</dynamic> |
|
770 |
<visibleWhen |
|
771 |
checkEnabled="true"> |
|
772 |
<or> |
|
773 |
<reference |
|
774 |
definitionId="isDescription"> |
|
775 |
</reference> |
|
776 |
<reference |
|
777 |
definitionId="isDescriptionElement"> |
|
778 |
</reference> |
|
779 |
<reference |
|
780 |
definitionId="isFeatureNodeContainer"> |
|
781 |
</reference> |
|
782 |
</or> |
|
783 |
</visibleWhen> |
|
784 |
</menu> |
|
778 | 785 |
</menuContribution> |
779 | 786 |
<menuContribution |
780 | 787 |
locationURI="popup:eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"> |
... | ... | |
1241 | 1248 |
</with> |
1242 | 1249 |
</activeWhen> |
1243 | 1250 |
</handler> |
1251 |
<handler |
|
1252 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForDescriptionElement" |
|
1253 |
commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor"> |
|
1254 |
<activeWhen> |
|
1255 |
<with |
|
1256 |
variable="activePartId"> |
|
1257 |
<equals |
|
1258 |
value="eu.etaxonomy.taxeditor.editor.view.descriptive"> |
|
1259 |
</equals> |
|
1260 |
</with> |
|
1261 |
</activeWhen> |
|
1262 |
</handler> |
|
1244 | 1263 |
</extension> |
1245 | 1264 |
<extension |
1246 | 1265 |
name="%extension.name" |
... | ... | |
1585 | 1604 |
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler" |
1586 | 1605 |
id="eu.etaxonomy.taxeditor.editor.openSpecimenEditor" |
1587 | 1606 |
name="Open Derivative Editor"> |
1607 |
<commandParameter |
|
1608 |
id="eu.etaxonomy.taxeditor.editor.openSpecimenEditor.uuid" |
|
1609 |
name="Specimen Uuids" |
|
1610 |
optional="true" |
|
1611 |
typeId="eu.etaxonomy.taxeditor.uuidParameterType"> |
|
1612 |
</commandParameter> |
|
1588 | 1613 |
</command> |
1589 | 1614 |
<command |
1590 | 1615 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.ListenToSelectionChangeHandler" |
... | ... | |
1908 | 1933 |
selection="eu.etaxonomy.cdm.model.taxon.TaxonBase" |
1909 | 1934 |
viewerName="TaxonEditor"> |
1910 | 1935 |
</viewCommandMapping> |
1936 |
<viewCommandMapping |
|
1937 |
commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor" |
|
1938 |
selection="eu.etaxonomy.cdm.model.description.IndividualsAssociation" |
|
1939 |
viewerName="Derivative Editor"> |
|
1940 |
</viewCommandMapping> |
|
1911 | 1941 |
</extension> |
1912 | 1942 |
</plugin> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.view.derivate.handler; |
|
2 |
|
|
3 |
import java.util.Collections; |
|
4 |
import java.util.UUID; |
|
5 |
|
|
6 |
import org.eclipse.core.commands.ExecutionEvent; |
|
7 |
import org.eclipse.ui.PartInitException; |
|
8 |
|
|
9 |
import eu.etaxonomy.cdm.api.service.IDescriptionService; |
|
10 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
11 |
import eu.etaxonomy.cdm.model.description.IndividualsAssociation; |
|
12 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
13 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
14 |
import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler; |
|
15 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; |
|
16 |
import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase; |
|
17 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
18 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
19 |
|
|
20 |
public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandlerBase<IndividualsAssociation> { |
|
21 |
|
|
22 |
@Override |
|
23 |
protected IndividualsAssociation getEntity(UUID uuid) { |
|
24 |
DescriptionElementBase descriptionElement = CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null); |
|
25 |
if(descriptionElement.isInstanceOf(IndividualsAssociation.class)){ |
|
26 |
return (IndividualsAssociation) descriptionElement; |
|
27 |
} |
|
28 |
return null; |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
protected void open(ExecutionEvent event, IndividualsAssociation entity) { |
|
33 |
SpecimenOrObservationBase associatedSpecimenOrObservation = entity.getAssociatedSpecimenOrObservation(); |
|
34 |
if(associatedSpecimenOrObservation!=null){ |
|
35 |
UUID specimenUuid = associatedSpecimenOrObservation.getUuid(); |
|
36 |
try { |
|
37 |
EditorUtil.open(new DerivateViewEditorInput(Collections.singletonList(specimenUuid))); |
|
38 |
} catch (PartInitException e) { |
|
39 |
MessagingUtils.error(OpenDerivateViewHandler.class, "Derivative Editor could not be opened", e); |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
} |
Also available in: Unified diff
Extend factual data view context menu with option to open specimen directly in DerivativeEditor