1 package eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
.handler
;
3 import java
.util
.Collections
;
6 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
7 import org
.eclipse
.swt
.widgets
.Shell
;
9 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
10 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
11 import eu
.etaxonomy
.taxeditor
.editor
.AppModelId
;
12 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
13 import eu
.etaxonomy
.taxeditor
.editor
.l10n
.Messages
;
14 import eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
.DerivateViewEditorInput
;
15 import eu
.etaxonomy
.taxeditor
.handler
.defaultHandler
.e4
.DefaultOpenHandlerBaseE4
;
16 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
18 public class OpenDerivativeEditorForDescriptionElement
extends DefaultOpenHandlerBaseE4
<IndividualsAssociation
> {
21 // protected IndividualsAssociation getEntity(UUID uuid) {
22 // DescriptionElementBase descriptionElement = CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null);
23 // if(descriptionElement!=null && descriptionElement.isInstanceOf(IndividualsAssociation.class)){
24 // return (IndividualsAssociation) descriptionElement;
30 protected void open(IndividualsAssociation entity
, Shell shell
, EPartService partService
) {
31 if(entity
==null || entity
.getAssociatedSpecimenOrObservation()==null){
32 MessagingUtils
.messageDialog(Messages
.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS
, this, Messages
.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS_MESSAGE
);
35 SpecimenOrObservationBase associatedSpecimenOrObservation
= entity
.getAssociatedSpecimenOrObservation();
36 if(associatedSpecimenOrObservation
!=null){
37 UUID specimenUuid
= associatedSpecimenOrObservation
.getUuid();
38 EditorUtil
.openSpecimenEditor(new DerivateViewEditorInput(Collections
.singletonList(specimenUuid
)), modelService
, partService
, application
);
46 protected boolean canExecute(Object entity
) {
51 protected String
getPartId() {
52 return AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW
;