Project

General

Profile

« Previous | Next » 

Revision cf349935

Added by Patrick Plitzner over 5 years ago

Ask for saving before executing operations

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddChildFeatureHandler.java
13 13
import javax.inject.Named;
14 14

  
15 15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.NullProgressMonitor;
16 17
import org.eclipse.e4.core.di.annotations.CanExecute;
17 18
import org.eclipse.e4.core.di.annotations.Execute;
18 19
import org.eclipse.e4.core.di.annotations.Optional;
......
26 27
import eu.etaxonomy.cdm.model.description.Feature;
27 28
import eu.etaxonomy.cdm.model.description.FeatureNode;
28 29
import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
30
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDropAdapter;
29 31
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor;
30 32
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation;
33
import eu.etaxonomy.taxeditor.model.MessagingUtils;
31 34

  
32 35
/**
33 36
 * @author pplitzner
......
41 44
            @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
42 45
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
43 46
        FeatureTreeEditor editor = ((FeatureTreeEditor) thisPart.getObject());
47
        if (editor.isDirty()) {
48
            if (MessagingUtils.confirmDialog(FeatureNodeDropAdapter.SAVE_CHANGES_TITLE,
49
                    FeatureNodeDropAdapter.SAVE_CHANGES_MESSAGE)){
50
                editor.save(new NullProgressMonitor());
51
            }
52
            else{
53
                return;
54
            }
55
        }
56

  
44 57
        AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
45 58
        WizardDialog dialog = new WizardDialog(shell, wizard);
46 59

  

Also available in: Unified diff