Project

General

Profile

« Previous | Next » 

Revision e65bc0e2

Added by Katja Luther 5 months ago

ref #10182: update details view when it gets the focus and there are changes

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonEditor.java
396 396
        EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, new TaxonNodeDto(input.getTaxonNode().getParent()));
397 397
        EventUtility.postEvent(WorkbenchEventConstants.SAVE_TAXON, true);
398 398
        EventUtility.postAsyncEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
399
//        EventUtility.postAsyncEvent(WorkbenchEventConstants.NEED_REFRESH_DETAILS, false);
399 400
        // Stop the progress monitor.
400 401
        monitor.done();
401 402
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/WorkbenchEventConstants.java
58 58
    
59 59
    public static final String REFRESH_MATRIX = "REFRESH/MATRIX";
60 60
    
61
    public static final String ENABLE_TAXON_DETAILS = "BLOCK/DETAILS/TAXON";
61
    public static final String NEED_REFRESH_DETAILS = "BLOCK/DETAILS/TAXON";
62 62

  
63 63
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
31 31
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
32 32
import eu.etaxonomy.taxeditor.model.MessagingUtils;
33 33
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
34
import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
34 35
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
35 36
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
36 37

  
......
59 60

  
60 61
    @Override
61 62
    public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
62
        if (activePart == thisPart){
63
            return;
63
    	if (activePart == null) {
64
    		return;
65
    	}
66
    	
67
        if (activePart == thisPart ){
68
        	if (this.getViewer().isNeedsRefresh()) {
69
        		viewer.refresh();
70
        		viewer.setNeedsRefresh(false);
71
        		return;
72
        	}else {
73
        		return;
74
        	}
64 75
        }
65 76
        
66 77
       
......
106 117
            viewer.setSelection(structuredSelection, false);
107 118

  
108 119
            showViewer(structuredSelection, activePart, viewer);
109

  
120
            viewer.setNeedsRefresh(false);
110 121
            return;
111 122
        }
112 123
        else{
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
162 162
    private ISelection selection;
163 163
    private boolean detailsEnabled = true;
164 164
    private Object activePart;
165
    
166
    private boolean needsRefresh = false;
165 167

  
166 168
    public boolean isDetailsEnabled() {
167 169
		return detailsEnabled;
......
176 178
        setInput(input);
177 179

  
178 180
    }
181
	
182
	public boolean isNeedsRefresh() {
183
		return needsRefresh;
184
	}
185

  
186
	public void setNeedsRefresh(boolean needsRefresh) {
187
		this.needsRefresh = needsRefresh;
188
	}
179 189
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
180 190
    // since we are getting implementations of DerivedUnitBase from the bulk
181 191
    // editor and not derived unit facade objects,
......
987 997
    private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS)boolean refresh){
988 998
        if(refresh){
989 999
        	//refresh_withoutnew_build(); this would use the update without creation of all fields
990
        	refresh();
1000
        	if (needsRefresh) {
1001
        		refresh();
1002
        	}
1003
        	this.needsRefresh = false;
991 1004
        }
992 1005
    }
993 1006
    
994 1007
    @Inject
995 1008
    @Optional
996
    private void blockView(@UIEventTopic(WorkbenchEventConstants.ENABLE_TAXON_DETAILS)boolean enable){
1009
    private void needsRefresh(@UIEventTopic(WorkbenchEventConstants.NEED_REFRESH_DETAILS)boolean enable){
997 1010
       for (IFormPart part :this.managedForm.getParts()) {
998 1011
    	   if (part instanceof CdmSectionPart) {
999
    		   ((CdmSectionPart)part).getSection().setEnabled(enable);
1012
    		   //((CdmSectionPart)part).getSection().setEnabled(enable);
1013
    		   this.setNeedsRefresh(!enable);
1014
    		   
1000 1015
    	   }
1001 1016
       }
1002 1017
    	
......
1020 1035
           }
1021 1036
        }
1022 1037
    }
1038

  
1039
	
1023 1040
}

Also available in: Unified diff