Project

General

Profile

« Previous | Next » 

Revision bc330e88

Added by Patrick Plitzner over 6 years ago

ref #6925 Refactor NavigationUtil.isDirty()

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveFactualDataHandlerE4.java
11 11
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
12 12
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
13 13
import org.eclipse.e4.ui.services.IServiceConstants;
14
import org.eclipse.e4.ui.workbench.modeling.EPartService;
14 15
import org.eclipse.jface.dialogs.MessageDialog;
15 16
import org.eclipse.jface.viewers.TreeSelection;
16 17
import org.eclipse.swt.widgets.Display;
......
33 34
    @Execute
34 35
    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
35 36
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
36
            @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
37
            @Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService) {
37 38

  
38 39
        TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
39 40

  
......
42 43
            if(object instanceof TaxonNode){
43 44
                TaxonNode taxonNode = HibernateProxyHelper.deproxy(object, TaxonNode.class);
44 45
                final TaxonNode sourceTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid());
45
                if(NavigationUtil.isDirty(sourceTaxonNode)){
46
                if(NavigationUtil.isDirty(sourceTaxonNode, partService)){
46 47
                    MessageDialog.openWarning(shell, Messages.MoveFactualDataHandler_UNSAVED_SOURCE, Messages.MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE);
47 48
                    return;
48 49
                }
......
63 64
                    }
64 65
                    //reload to avoid session conflicts
65 66
                    final TaxonNode targetTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(dialogTaxonNode.getUuid());
66
                    if(NavigationUtil.isDirty(targetTaxonNode)){
67
                    if(NavigationUtil.isDirty(targetTaxonNode, partService)){
67 68
                        MessageDialog.openWarning(shell, Messages.MoveFactualDataHandler_UNSAVED_TARGET, Messages.MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE);
68 69
                        return;
69 70
                    }

Also available in: Unified diff