Project

General

Profile

« Previous | Next » 

Revision a174673d

Added by Katja Luther about 6 years ago

better handling of updating misapplied names

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
16 16

  
17 17
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
18 18
import org.eclipse.e4.core.contexts.IEclipseContext;
19
import org.eclipse.e4.core.di.annotations.Optional;
19 20
import org.eclipse.e4.core.services.log.Logger;
21
import org.eclipse.e4.ui.di.UIEventTopic;
20 22
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
21 23
import org.eclipse.jface.viewers.IStructuredSelection;
22 24
import org.eclipse.jface.viewers.StructuredSelection;
......
31 33
import eu.etaxonomy.cdm.model.taxon.Taxon;
32 34
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
33 35
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
36
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
34 37
import eu.etaxonomy.taxeditor.l10n.Messages;
35 38
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
36 39
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
......
48 51
public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
49 52
	@Inject
50 53
	private Logger logger;
51
	
54

  
52 55
	@Inject
53 56
    public SupplementalDataPartE4() {
54 57
    }
......
84 87
	        if (partObject instanceof ITaxonEditor && structuredSelection.getFirstElement() instanceof Taxon ){
85 88
	            if (((ITaxonEditor)partObject).getTaxon() != structuredSelection.getFirstElement() && ((Taxon)structuredSelection.getFirstElement()).isMisapplication()){
86 89
	                Set<TaxonRelationship> rels =((Taxon)structuredSelection.getFirstElement()).getTaxonRelations(((ITaxonEditor)partObject).getTaxon());
87
	                if (rels.size() == 1){
90
	                if (rels != null && rels.size() == 1){
88 91
	                    structuredSelection = new StructuredSelection(rels.iterator().next());
89 92
	                }else{
90 93
	                    showEmptyPage();
......
151 154
    protected String getViewName() {
152 155
		return Messages.SupplementalDataViewPart_VIEWER_NAME;
153 156
	}
157

  
158
	@Inject
159
    @Optional
160
    private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL)boolean refresh){
161
        if(refresh){
162

  
163
            viewer.refresh();
164
        }
165
    }
154 166
}

Also available in: Unified diff