Project

General

Profile

« Previous | Next » 

Revision eb140397

Added by Katja Luther about 6 years ago

fix refresh after classification delete in taxon navigator

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingDeleteTaxonNodeHandlerE4.java
73 73
        classifications = new HashSet();
74 74
        while (selectionIterator.hasNext()){
75 75
            Object object = selectionIterator.next();
76
            if(object instanceof TaxonNodeDto) {
77
                treeNodes.add((TaxonNodeDto) object);
78
            }else if (object instanceof TaxonNode && !((TaxonNode)object).hasTaxon()){
79
                TaxonNodeDto dto = new TaxonNodeDto(Classification.class,(TaxonNode)object);
76
            if (object instanceof TaxonNodeDto && ((TaxonNodeDto)object).getTaxonUuid() == null){
77
                TaxonNodeDto dto = (TaxonNodeDto)object;
80 78
                classifications.add(dto);
81 79
                containsClassification = true;
80
            }else if(object instanceof TaxonNodeDto) {
81
                treeNodes.add((TaxonNodeDto) object);
82 82
            }
83 83
        }
84 84
        for (TaxonNodeDto treeNode : treeNodes) {
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingDeleteTaxonNodeOperation.java
16 16
import org.eclipse.core.runtime.IProgressMonitor;
17 17

  
18 18
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
19
import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
19 20
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
20 21
import eu.etaxonomy.cdm.api.service.DeleteResult;
21 22
import eu.etaxonomy.cdm.api.service.UpdateResult;
......
59 60
     */
60 61
    @Override
61 62
    protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
62

  
63
        DeleteResult result = new DeleteResult();
63 64

  
64 65
        if(treeNodes.size() == 1) {
65 66
            // when single node this is either a taxon or a classification
66 67
            TaxonNodeDto node = treeNodes.iterator().next();
67 68
            if(node.getTaxonUuid() == null) {
68
                return CdmApplicationState.getCurrentAppConfig().getClassificationService().delete(node.getClassificationUUID());
69
                result = CdmApplicationState.getCurrentAppConfig().getClassificationService().delete(node.getClassificationUUID());
70
            }else{
71
                result =  CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().deleteTaxonNode((node).getUuid(), config);
69 72
            }
70
            return CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().deleteTaxonNode((node).getUuid(), config);
71 73
//            } else if(node.getType().equals( Classification.class)) {
72 74
//                entityType = Classification.class;
73 75
//                return CdmApplicationState.getCurrentAppConfig().getClassificationService().delete(node.getUuid());
......
86 88
                    classificationsUuids.add(treeNode.getClassificationUUID());
87 89
                }
88 90
            }
89
            DeleteResult result = new DeleteResult();
91

  
90 92
            if (!treeNodeUuids.isEmpty()){
91 93
                result.includeResult(CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().deleteTaxonNodes(treeNodeUuids, new TaxonDeletionConfigurator()));
92 94
            }
......
96 98
                }
97 99
            }
98 100

  
99
            return result;
100
        }
101 101

  
102

  
103
        }
104
        CdmApplicationState.getCurrentDataChangeService()
105
        .fireChangeEvent(new CdmChangeEvent(Action.Delete, result.getDeletedObjects(), this), true);
106
        return result;
102 107
    }
103 108

  
104 109
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/util/TaxonTreeNodeContentProvider.java
77 77
     */
78 78
    @Override
79 79
    public Object getParent(Object element) {
80
        if (taxonNodeService == null){
81
            taxonNodeService = CdmStore.getService(ITaxonNodeService.class);
82
        }
80 83
        if(element instanceof TaxonNodeDto){
81 84
            if (((TaxonNodeDto) element).getParentUUID() != null){
82 85
                TaxonNode parent = taxonNodeService.load(((TaxonNodeDto) element).getParentUUID());

Also available in: Unified diff