Project

General

Profile

Revision cb86d7ee

IDcb86d7ee94765fcb197a9bd26f896e0a429d09ac
Parent 54cc3ca6
Child 5794ab10

Added by Patrick Plitzner about 1 year ago

fix #6742 Fix Link with taxon selection in specimen tree editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
47 47
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
48 48
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
49 49
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
50
import eu.etaxonomy.cdm.api.service.ITaxonService;
50 51
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
51 52
import eu.etaxonomy.cdm.model.common.CdmBase;
52 53
import eu.etaxonomy.cdm.model.molecular.SingleRead;
53 54
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
54 55
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
55 56
import eu.etaxonomy.cdm.model.taxon.Taxon;
57
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
56 58
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
59
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
57 60
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
58 61
import eu.etaxonomy.taxeditor.editor.EditorUtil;
59 62
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
......
509 512
    @Inject
510 513
    @Optional
511 514
    public void selectionChanged(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
512
            @Named(IServiceConstants.ACTIVE_PART) MPart activePart, MPart thisPart)
513
    {
514
    	if(activePart == thisPart || viewer==null){
515
            @Named(IServiceConstants.ACTIVE_PART) MPart activePart, MPart thisPart){
516
        if(activePart == thisPart || viewer==null){
515 517
            return;
516 518
        }
517 519
        if(viewer.getTree().isDisposed()){
......
519 521
        }
520 522
        if(listenToSelectionChange){
521 523
            selectedTaxon = null;
522
            if(activePart instanceof TaxonNameEditorE4){
523
                selectedTaxon = ((TaxonNameEditorE4) activePart).getTaxon();
524
            if(activePart.getObject() instanceof TaxonNameEditorE4){
525
                selectedTaxon = ((TaxonNameEditorE4) activePart.getObject()).getTaxon();
524 526
            }
525 527
            else if(selection != null){
526 528
                Object selectedElement = selection.getFirstElement();
527
                if(selectedElement instanceof CdmBase){
528
                    if(((CdmBase) selectedElement).isInstanceOf(TaxonNode.class)){
529
                if(selectedElement instanceof TaxonNodeDto){
530
                    TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(((TaxonNodeDto)selectedElement).getTaxonUuid());
531
                    if(HibernateProxyHelper.isInstanceOf(taxonBase, Taxon.class)){
532
                        selectedTaxon = HibernateProxyHelper.deproxy(taxonBase, Taxon.class);
533
                    }
534
                    else if(selectedElement instanceof TaxonNode){
529 535
                        selectedTaxon = HibernateProxyHelper.deproxy(selectedElement, TaxonNode.class).getTaxon();
530 536
                    }
531
                    else if(((CdmBase) selectedElement).isInstanceOf(Taxon.class)){
537
                    else if(selectedElement instanceof Taxon){
532 538
                        selectedTaxon = HibernateProxyHelper.deproxy(selectedElement, Taxon.class);
533 539
                    }
534 540
                }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)