Project

General

Profile

« Previous | Next » 

Revision 6f5407a6

Added by Patrick Plitzner over 6 years ago

ref #6905, #6597 Allow saving of editor when view is active

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
21 21
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
22 22
import eu.etaxonomy.taxeditor.model.AbstractUtility;
23 23
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
24
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
24 25

  
25 26
/**
26 27
 * @author pplitzner
27 28
 * @since Aug 10, 2017
28 29
 *
29 30
 */
30
public abstract class AbstractCdmEditorPartE4 implements IConversationEnabled, IDirtyMarkable{
31
public abstract class AbstractCdmEditorPartE4 implements IConversationEnabled, IDirtyMarkable, ISelectionElementEditingPart{
31 32

  
32 33
    protected AbstractCdmDataViewerE4 viewer;
33 34

  
......
83 84
        return null;
84 85
    }
85 86

  
87
    /**
88
     * {@inheritDoc}
89
     */
90
    @Override
91
    public Object getSelectionProvidingPart() {
92
        return selectionProvidingPart;
93
    }
94

  
86 95
    @PreDestroy
87 96
    public void dispose() {
88 97
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
18 18
import org.eclipse.jface.viewers.IStructuredSelection;
19 19
import org.eclipse.jface.viewers.StructuredSelection;
20 20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.ui.IEditorPart;
22 21

  
23 22
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
24 23
import eu.etaxonomy.cdm.model.description.Feature;
......
79 78
            showEmptyPage();
80 79
            return;
81 80
        }
82
        if((partObject instanceof IEditorPart) || (partObject instanceof IPartContentHasDetails)
83
                && partObject instanceof IConversationEnabled) {
81
        if(partObject instanceof IPartContentHasDetails){
82
            if(partObject instanceof IConversationEnabled && ((IConversationEnabled) partObject).getConversationHolder()==null) {
83
                //TODO show specific message (refactor EmptyElement to allow specific messages)
84
                showEmptyPage();
85
                return;
86
            }
84 87
            // do not show details for feature nodes TODO strange check to avoid having shown the distribution map for every FeatureNodeContainer
85 88
            if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
86 89
                // do show the map for distributions
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/SaveHandler.java
39 39
                else if(savablePart instanceof IE4SavablePart){
40 40
                    ((IE4SavablePart) savablePart).save(new NullProgressMonitor());
41 41
                }
42
                else if(savablePart instanceof MPart){
43
                    savePart(partService, commandService, handlerService, (MPart) savablePart);
44
                }
42 45
            }
43 46
        }
44 47
	}
45 48

  
46 49
	private Object findSavablePart(ISelectionElementEditingPart part){
47 50
	    Object selectionProvidingPart = part.getSelectionProvidingPart();
48
	    if(selectionProvidingPart instanceof ISaveablePart || selectionProvidingPart instanceof IE4SavablePart){
51
	    if(selectionProvidingPart instanceof ISaveablePart || selectionProvidingPart instanceof IE4SavablePart || selectionProvidingPart instanceof MPart){
49 52
	        return selectionProvidingPart;
50 53
	    }
51 54
	    else if(selectionProvidingPart instanceof ISelectionElementEditingPart){

Also available in: Unified diff