Project

General

Profile

« Previous | Next » 

Revision b244c100

Added by Katja Luther over 6 years ago

fix #5342

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java
12 12
import org.eclipse.core.commands.ExecutionEvent;
13 13
import org.eclipse.core.commands.ExecutionException;
14 14
import org.eclipse.core.commands.common.NotDefinedException;
15
import org.eclipse.jface.dialogs.MessageDialog;
15 16
import org.eclipse.jface.viewers.ISelection;
16 17
import org.eclipse.jface.viewers.IStructuredSelection;
17 18
import org.eclipse.swt.widgets.Display;
......
26 27
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
27 28
import eu.etaxonomy.taxeditor.editor.EditorUtil;
28 29
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
29
import eu.etaxonomy.taxeditor.editor.Page;
30 30
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
31
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
32 31
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
33 32
import eu.etaxonomy.taxeditor.model.AbstractUtility;
34 33
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
......
53 52
	private MoveDescriptionToOtherTaxonOperation operation;
54 53

  
55 54
	private UUID newAcceptedTaxonNodeUuid;
56
	private TaxonNameEditor editor;
55
	private MultiPageTaxonEditor editor;
57 56

  
58 57
	/* (non-Javadoc)
59 58
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
......
63 62
    public Object execute(ExecutionEvent event) throws ExecutionException {
64 63

  
65 64
		ISelection selection = HandlerUtil.getCurrentSelection(event);
65
		editor = EditorUtil.getActiveMultiPageTaxonEditor();
66
		if (this.editor.isDirty()){
67
		    boolean proceed = MessageDialog.openQuestion(null,
68
	                   "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
69
	        if (proceed) {
70
	            editor.doSave(EditorUtil.getMonitor());
71
	        } else {
72
	            return null;
73
	        }
74

  
75
		}
76

  
66 77

  
67 78
		if(selection instanceof IStructuredSelection){
68 79

  
......
88 99

  
89 100
			// Choose the target taxon
90 101
			List<UUID> excludeTaxa = new ArrayList<UUID>();
91
			editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
102

  
103

  
92 104
			excludeTaxa.add(descriptions.get(0).getTaxon().getUuid());
93 105

  
94 106
			//get current taxon node
......
143 155

  
144 156
			@Override
145 157
            public void run() {
146
				AbstractUtility.close(editor.getMultiPageTaxonEditor());
158
				AbstractUtility.close(editor);
147 159

  
148 160
				try {
149 161
					MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);

Also available in: Unified diff