Project

General

Profile

« Previous | Next » 

Revision c2e12c2b

Added by Patrick Plitzner almost 6 years ago

ref #6806 Implement operation framework for feature tree editor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureHandler.java
18 18
import org.eclipse.e4.ui.services.IServiceConstants;
19 19
import org.eclipse.jface.viewers.IStructuredSelection;
20 20

  
21
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
22
import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
23 21
import eu.etaxonomy.cdm.model.description.FeatureNode;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
22
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor;
23
import eu.etaxonomy.taxeditor.featuretree.e4.operation.RemoveFeatureOperation;
25 24
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
26 25

  
27 26
/**
......
34 33
    @Execute
35 34
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
36 35
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection){
36
        FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject();
37 37
        for (Object selectedObject : selection.toArray()) {
38 38
            FeatureNode featureNode = (FeatureNode) selectedObject;
39
            CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
39
            RemoveFeatureOperation operation = new RemoveFeatureOperation(featureNode, editor, editor);
40
            editor.addOperation(operation);
41
            FeatureNode parent = featureNode.getParent();
42
            parent.removeChild(featureNode);
40 43
        }
41
        IE4ViewerPart editor = (IE4ViewerPart) thisPart.getObject();
44
        editor.setDirty(true);
42 45
        editor.refresh();
43 46
    }
44 47

  

Also available in: Unified diff