Project

General

Profile

« Previous | Next » 

Revision 06122990

Added by Patrick Plitzner about 5 years ago

ref #8233 Ask for saving before cloning type designation

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java
50 50
import eu.etaxonomy.taxeditor.ui.section.name.operation.DeleteTypeDesignationOperation;
51 51
import eu.etaxonomy.taxeditor.ui.section.name.type.CloneTypeWizard;
52 52
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
53
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
53 54

  
54 55
/**
55 56
 * @author n.hoffmann
......
71 72
	            || getEntity().getTypeDesignations().stream().noneMatch(designation->designation instanceof SpecimenTypeDesignation)){
72 73
	        return;
73 74
	    }
74
	    Action addAction = new Action(Messages.TypeDesignationSection_CREATE_DUPLICATE, IAction.AS_PUSH_BUTTON){
75
	    Action cloneAction = new Action(Messages.TypeDesignationSection_CREATE_DUPLICATE, IAction.AS_PUSH_BUTTON){
75 76
            @Override
76 77
            public void run() {
78
                DetailsPartE4 detailsView = AbstractUtility.getDetailsView(getFormFactory().getContext().get((EPartService.class)));
79
                if(detailsView!=null
80
                        && detailsView.getSelectionProvidingPart().getObject() instanceof IE4SavablePart
81
                        && StoreUtil.promptCheckIsDirty(((IE4SavablePart)detailsView.getSelectionProvidingPart().getObject()))){
82
                    return;
83
                }
77 84
                CloneTypeWizard wizard = new CloneTypeWizard(getEntity());
78 85
                WizardDialog dialog = new WizardDialog(getShell(), wizard);
79 86

  
......
89 96
                        MessagingUtils.warningDialog(Messages.TypeDesignationSection_DUPLICATE_FAILED, this, result.getExceptions().toString());
90 97
                    }
91 98
                    StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
92
                    internalUpdateSection(true);
99
                    internalUpdateSection(false);
93 100
                }
94 101
            }
95 102
        };
96
        addAction.setImageDescriptor(new ImageDescriptor() {
103
        cloneAction.setImageDescriptor(new ImageDescriptor() {
97 104

  
98 105
            @Override
99 106
            public ImageData getImageData() {
100 107
                return ImageResources.getImage(ImageResources.COPY_ICON).getImageData();
101 108
            }
102 109
        });
103
        addAction.setToolTipText(Messages.TypeDesignationSection_CREATE_DUPLICATE);
110
        cloneAction.setToolTipText(Messages.TypeDesignationSection_CREATE_DUPLICATE);
104 111

  
105
        toolBarManager.add(addAction);
112
        toolBarManager.add(cloneAction);
106 113
	}
107 114

  
108 115
	@Override

Also available in: Unified diff