Project

General

Profile

« Previous | Next » 

Revision c41a916e

Added by Patrick Plitzner over 5 years ago

Fix selection when creating new nodes

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
148 148
	    this.dirty.setDirty(isDirty);
149 149
	}
150 150

  
151
	public boolean isDirty(){
151
	@Override
152
    public boolean isDirty(){
152 153
	    return dirty.isDirty();
153 154
	}
154 155

  
......
209 210

  
210 211
        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(getRootEntities());
211 212

  
212
        Object[] expandedElements = viewer.getExpandedElements();
213 213
        initialiseRootEntities();
214
        viewer.setExpandedElements(expandedElements);
215 214

  
216 215
        this.setDirty(false);
217 216
	}
218 217

  
219 218
    private void initialiseRootEntities() {
219
        Object[] expandedElements = viewer.getExpandedElements();
220 220
        viewer.getTree().removeAll();
221 221
        List<FeatureTree> trees = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null);
222 222
        viewer.setInput(trees);
223
        viewer.setExpandedElements(expandedElements);
223 224
    }
224 225

  
225 226
	@PreDestroy
......
300 301
    public boolean postOperation(Object objectAffectedByOperation) {
301 302
        initialiseRootEntities();
302 303
        viewer.refresh();
303
        if(objectAffectedByOperation != null){
304
        if(objectAffectedByOperation instanceof FeatureNode){
305
            FeatureNode node = (FeatureNode)objectAffectedByOperation;
306
            viewer.expandToLevel(node.getFeatureTree(), 1);
304 307
            StructuredSelection selection = new StructuredSelection(objectAffectedByOperation);
305 308
            viewer.setSelection(selection);
306
            viewer.expandToLevel(objectAffectedByOperation, 1);
307 309
        }
308 310
        return true;
309 311
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/operation/AddFeatureOperation.java
14 14
import org.eclipse.core.runtime.IStatus;
15 15

  
16 16
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
17
import eu.etaxonomy.cdm.api.service.UpdateResult;
17 18
import eu.etaxonomy.cdm.model.description.Feature;
18 19
import eu.etaxonomy.cdm.model.description.FeatureNode;
19 20
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
......
39 40

  
40 41
    @Override
41 42
    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
42
        CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(node.getUuid(), element.getUuid());
43
        return postExecute(element);
43
        UpdateResult updateResult = CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(node.getUuid(), element.getUuid());
44
        return postExecute(updateResult.getCdmEntity());
44 45
    }
45 46

  
46 47
    @Override

Also available in: Unified diff