Project

General

Profile

« Previous | Next » 

Revision d0ba58fc

Added by Patrick Plitzner over 9 years ago

  • refactored DerivateViewEditorInput to use UUIDs instead of CDM entities
    • added delete operation to DerivateView (currently only deleting leafs of the derivate tree is allowed)

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java
15 15
import org.eclipse.core.runtime.IProgressMonitor;
16 16
import org.eclipse.core.runtime.IStatus;
17 17

  
18
import eu.etaxonomy.cdm.api.service.DeleteResult;
19
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
20
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
18 21
import eu.etaxonomy.cdm.model.common.CdmBase;
22
import eu.etaxonomy.taxeditor.model.MessagingUtils;
19 23
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
20 24
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
25
import eu.etaxonomy.taxeditor.store.CdmStore;
21 26

  
22 27
/**
23 28
 *
......
27 32
 */
28 33
public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
29 34

  
35
    private final SpecimenDeleteConfigurator deleteConfigurator;
36

  
30 37
    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
31 38
            IPostOperationEnabled postOperationEnabled) {
39
        this(label, undoContext, element, postOperationEnabled, new SpecimenDeleteConfigurator());
40
    }
41

  
42
    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
43
            IPostOperationEnabled postOperationEnabled, SpecimenDeleteConfigurator config) {
32 44
        super(label, undoContext, element, postOperationEnabled);
45
        this.deleteConfigurator = config;
33 46
    }
34 47

  
48

  
35 49
    /*
36 50
     * (non-Javadoc)
37 51
     *
......
42 56
    /** {@inheritDoc} */
43 57
    @Override
44 58
    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
45
        return postExecute(null);
59
        DeleteResult deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
60
        if(!deleteResult.isOk()){
61
            String exceptionMessage = "";
62
            for(Exception exception:deleteResult.getExceptions()){
63
                exceptionMessage += exception.getLocalizedMessage();
64
            }
65
            //TODO: add method to DeleteResult to sum up exceptions
66
            MessagingUtils.warningDialog("Deletion failed", this, exceptionMessage);
67
            return postExecute(null);
68
        }
69
        return postExecute(element);
46 70
    }
47 71

  
48 72
    /*

Also available in: Unified diff