Revision ae55584a
Added by Patrick Plitzner over 4 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java | ||
---|---|---|
13 | 13 |
import org.eclipse.core.commands.ExecutionException; |
14 | 14 |
import org.eclipse.core.commands.IHandler; |
15 | 15 |
import org.eclipse.core.commands.common.NotDefinedException; |
16 |
import org.eclipse.ui.IWorkbenchPage; |
|
17 | 16 |
import org.eclipse.ui.handlers.HandlerUtil; |
18 | 17 |
|
19 | 18 |
import eu.etaxonomy.cdm.api.service.DeleteResult; |
... | ... | |
69 | 68 |
} catch (NotDefinedException e) { |
70 | 69 |
MessagingUtils.error(getClass(), e); |
71 | 70 |
} |
72 |
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); |
|
73 | 71 |
if (selectedElement instanceof TaxonBase){ |
74 | 72 |
if (((TaxonBase)selectedElement).getId() == 0){ |
75 | 73 |
if (selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()) { |
... | ... | |
91 | 89 |
if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){ |
92 | 90 |
return ; |
93 | 91 |
} |
94 |
operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
|
|
92 |
operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); |
|
95 | 93 |
|
96 | 94 |
} |
97 | 95 |
// misapplication |
... | ... | |
100 | 98 |
if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){ |
101 | 99 |
return ; |
102 | 100 |
} |
103 |
operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Taxon) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
|
|
101 |
operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Taxon) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); |
|
104 | 102 |
} else { |
105 | 103 |
throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT); |
106 | 104 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java | ||
---|---|---|
51 | 51 |
* @param misapplication a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
52 | 52 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
53 | 53 |
*/ |
54 |
public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
|
|
54 |
public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator, |
|
55 | 55 |
Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
56 | 56 |
//super(label, undoContext, taxon, postOperationEnabled); |
57 |
super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
|
|
57 |
super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); |
|
58 | 58 |
this.misapplication = misapplication; |
59 | 59 |
this.element = taxon; |
60 | 60 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java | ||
---|---|---|
14 | 14 |
import org.eclipse.core.runtime.IAdaptable; |
15 | 15 |
import org.eclipse.core.runtime.IProgressMonitor; |
16 | 16 |
import org.eclipse.core.runtime.IStatus; |
17 |
import org.eclipse.ui.IWorkbenchPage; |
|
18 | 17 |
|
19 | 18 |
import eu.etaxonomy.cdm.api.application.ICdmRepository; |
20 | 19 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
50 | 49 |
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object. |
51 | 50 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
52 | 51 |
*/ |
53 |
public DeleteSynonymOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
|
|
52 |
public DeleteSynonymOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator, |
|
54 | 53 |
Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
55 |
super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
|
|
54 |
super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); |
|
56 | 55 |
this.synonym = synonym; |
57 | 56 |
this.element = taxon; |
58 | 57 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonBaseOperation.java | ||
---|---|---|
5 | 5 |
import org.eclipse.core.runtime.IAdaptable; |
6 | 6 |
import org.eclipse.core.runtime.IProgressMonitor; |
7 | 7 |
import org.eclipse.core.runtime.IStatus; |
8 |
import org.eclipse.ui.IWorkbenchPage; |
|
9 | 8 |
|
10 | 9 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
11 | 10 |
import eu.etaxonomy.cdm.api.service.DeleteResult; |
... | ... | |
22 | 21 |
public DeleteTaxonBaseOperation(String label, |
23 | 22 |
IUndoContext undoContext, |
24 | 23 |
TaxonBaseDeletionConfigurator configurator, |
25 |
IWorkbenchPage activePage, |
|
26 | 24 |
IPostOperationEnabled postOperationEnabled, |
27 | 25 |
IConversationEnabled conversationEnabled, |
28 | 26 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java | ||
---|---|---|
8 | 8 |
import org.eclipse.core.runtime.IAdaptable; |
9 | 9 |
import org.eclipse.core.runtime.IProgressMonitor; |
10 | 10 |
import org.eclipse.core.runtime.IStatus; |
11 |
import org.eclipse.ui.IWorkbenchPage; |
|
12 | 11 |
|
13 | 12 |
import eu.etaxonomy.cdm.api.application.ICdmRepository; |
14 | 13 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
30 | 29 |
Taxon taxon, |
31 | 30 |
TaxonDeletionConfigurator configurator, |
32 | 31 |
Classification classification, |
33 |
IWorkbenchPage activePage, |
|
34 | 32 |
IPostOperationEnabled postOperationEnabled, |
35 | 33 |
IConversationEnabled conversationEnabled, |
36 | 34 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
37 |
super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
|
|
35 |
super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); |
|
38 | 36 |
this.element = taxon; |
39 | 37 |
|
40 | 38 |
Set<TaxonNode> nodes = taxon.getTaxonNodes(); |
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
taxon.addMisappliedName(misapplication, null, null); |
45 | 45 |
|
46 |
operation = new DeleteMisapplicationOperation("", undoContext, null, null, taxon, misapplication, postOperation, null, null);
|
|
46 |
operation = new DeleteMisapplicationOperation("", undoContext, null, taxon, misapplication, postOperation, null, null); |
|
47 | 47 |
|
48 | 48 |
} |
49 | 49 |
|
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperationTest.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
taxon.addSynonym(synonym, synonymType); |
47 | 47 |
|
48 |
operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), null, taxon,synonym, postOperation, null, null);
|
|
48 |
operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), taxon,synonym, postOperation, null, null); |
|
49 | 49 |
|
50 | 50 |
} |
51 | 51 |
|
Also available in: Unified diff
ref #6595 remove unused parameter