Project

General

Profile

« Previous | Next » 

Revision a6de10b5

Added by Katja Luther over 7 years ago

ref #6219: add warning that synonym is deleted immediately

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.editor.name.operation;
11 11

  
12
import java.util.Set;
13

  
14 12
import org.eclipse.core.commands.ExecutionException;
15 13
import org.eclipse.core.commands.operations.IUndoContext;
16 14
import org.eclipse.core.runtime.IAdaptable;
17 15
import org.eclipse.core.runtime.IProgressMonitor;
18 16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.ui.IWorkbenchPage;
19 18

  
20 19
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
20
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
21 21
import eu.etaxonomy.cdm.api.service.DeleteResult;
22 22
import eu.etaxonomy.cdm.api.service.ITaxonService;
23
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
23 24
import eu.etaxonomy.cdm.model.taxon.Synonym;
24 25
import eu.etaxonomy.cdm.model.taxon.SynonymType;
25 26
import eu.etaxonomy.cdm.model.taxon.Taxon;
26
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
27
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
28
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
29 27
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
28
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
30 29
import eu.etaxonomy.taxeditor.store.CdmStore;
31 30

  
32 31
/**
......
35 34
 * @author p.ciardelli
36 35
 * @created 14.01.2009
37 36
 */
38
public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
37
public class DeleteSynonymOperation extends DeleteTaxonBaseOperation {
39 38

  
40 39
	private final Synonym synonym;
41 40
	private SynonymType synonymType;
42 41

  
42

  
43 43
	/**
44 44
	 * <p>Constructor for DeleteSynonymOperation.</p>
45 45
	 *
......
49 49
	 * @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
50 50
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
51 51
	 */
52
	public DeleteSynonymOperation(String label, IUndoContext undoContext,
53
			Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled) {
54
		super(label, undoContext, taxon, postOperationEnabled);
52
	public DeleteSynonymOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
53
			Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
54
		super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
55 55
		this.synonym = synonym;
56 56
	}
57 57

  
......
75 75

  
76 76
		} else {
77 77
			//TODO: this should be moved to the handler, the operations should not contain ui code
78
			DeleteResult result = service.deleteSynonym(synonym.getUuid(), null);
79
			if (result.isError()){
80
				DeleteResultMessagingUtils.messageDialogWithDetails(result, "Delete failed", TaxeditorEditorPlugin.PLUGIN_ID);
81
			} else if (!result.getUpdatedObjects().isEmpty()){
82
			    DeleteResultMessagingUtils.messageDialogWithDetails(result, "The Synonym could be deleted, but related object(s) could not be deleted", TaxeditorEditorPlugin.PLUGIN_ID);
83
			}
78
			setResult(service.deleteSynonym(synonym.getUuid(), null));
79

  
84 80
		}
85 81
	//	taxon.removeSynonym(synonym);
86 82
//				CdmStore.getTaxonService().deleteSynonymRelationships(synonym);
......
111 107
		// Redraw editor if exists
112 108
		return postExecute(synonym);
113 109
	}
110

  
111
    /**
112
     * @return the result
113
     */
114
    @Override
115
    public DeleteResult getResult() {
116
        return result;
117
    }
118

  
119
    /**
120
     * @param result the result to set
121
     */
122
    public void setResult(DeleteResult result) {
123
        this.result = result;
124
    }
114 125
}

Also available in: Unified diff