Project

General

Profile

« Previous | Next » 

Revision 6393027d

Added by Patrick Plitzner over 6 years ago

ref #6907, #6597 Refresh details view after changing desc element

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/operation/ChangeDescriptionElementType.java
1 1
/**
2 2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
15 15
import org.eclipse.core.runtime.IStatus;
16 16
import org.eclipse.core.runtime.Status;
17 17
import org.eclipse.jface.dialogs.MessageDialog;
18
import org.eclipse.jface.viewers.Viewer;
18 19
import org.eclipse.swt.widgets.Display;
19 20

  
20 21
import eu.etaxonomy.cdm.model.description.CategoricalData;
......
29 30
import eu.etaxonomy.cdm.model.description.TextData;
30 31
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
31 32
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
33
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
32 34

  
33 35
/**
34 36
 * <p>ChangeDescriptionElementType class.</p>
......
41 43

  
42 44
	private DescriptionElementBase sourceElement;
43 45
	private DescriptionElementBase destinationElement;
44
	
46
	private Viewer viewer;
47

  
45 48
	/**
46 49
	 * <p>Constructor for ChangeDescriptionElementType.</p>
47 50
	 *
......
50 53
	 * @param sourceType a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
51 54
	 * @param postOperation a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
52 55
	 */
53
	public ChangeDescriptionElementType(String label, DescriptionElementBase sourceType, IPostOperationEnabled postOperation, 
56
	public ChangeDescriptionElementType(String label, DescriptionElementBase sourceType, IPostOperationEnabled postOperation,
54 57
			IUndoContext undoContext) {
55 58
		super(label, undoContext, postOperation);
56 59
		this.sourceElement = sourceType;
60
		if(postOperation instanceof DetailsPartE4){
61
		    this.viewer = ((DetailsPartE4) postOperation).getViewer();
62
		}
57 63
	}
58 64

  
59 65
	/* (non-Javadoc)
......
65 71
			throws ExecutionException {
66 72
		DescriptionBase inDescription = sourceElement.getInDescription();
67 73
		Feature feature = sourceElement.getFeature();
68
		
74

  
69 75
		if(sourceElement instanceof TextData){
70 76
			// FIXME I guess there are features that support more that one of these
71 77
			// and that case is not handled correctly at the moment
......
100 106
		destinationElement.setFeature(feature);
101 107
		inDescription.addElement(destinationElement);
102 108
		inDescription.removeElement(sourceElement);
109

  
110
        viewer.setInput(destinationElement);
103 111
		return postExecute(destinationElement);
104 112
	}
105 113

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmDataViewerE4.java
13 13

  
14 14
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
15 15
import org.eclipse.e4.core.contexts.IEclipseContext;
16
import org.eclipse.jface.viewers.StructuredSelection;
17 16
import org.eclipse.jface.viewers.Viewer;
18 17
import org.eclipse.swt.SWT;
19 18
import org.eclipse.swt.widgets.Composite;
......
146 145
	/** {@inheritDoc} */
147 146
	@Override
148 147
	public void refresh() {
149
        setSelection(new StructuredSelection(input));
150

  
151 148
		showParts();
152 149

  
153 150
		managedForm.setInput(input);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
247 247
    @Override
248 248
    public boolean postOperation(CdmBase objectAffectedByOperation) {
249 249
        changed(objectAffectedByOperation);
250
        viewer.setInput(objectAffectedByOperation);
251 250
        return true;
252 251
    }
253 252

  

Also available in: Unified diff