Revision d12aec9d
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java | ||
---|---|---|
12 | 12 |
import java.util.Collection; |
13 | 13 |
import java.util.Comparator; |
14 | 14 |
|
15 |
import org.eclipse.core.commands.operations.IOperationHistory; |
|
15 | 16 |
import org.eclipse.core.runtime.IStatus; |
17 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
16 | 18 |
import org.eclipse.jface.action.Action; |
17 | 19 |
import org.eclipse.jface.action.IAction; |
18 | 20 |
import org.eclipse.jface.action.ToolBarManager; |
... | ... | |
31 | 33 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
32 | 34 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
33 | 35 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
36 |
import eu.etaxonomy.taxeditor.editor.ITaxonEditor; |
|
34 | 37 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
38 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
35 | 39 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
36 | 40 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
41 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
37 | 42 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
38 | 43 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
39 | 44 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
42 | 47 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
43 | 48 |
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection; |
44 | 49 |
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; |
50 |
import eu.etaxonomy.taxeditor.ui.section.name.operation.DeleteTypeDesignationOperation; |
|
45 | 51 |
import eu.etaxonomy.taxeditor.ui.section.name.type.CloneTypeWizard; |
52 |
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4; |
|
46 | 53 |
|
47 | 54 |
/** |
48 | 55 |
* @author n.hoffmann |
... | ... | |
140 | 147 |
public void removeElement(TypeDesignationBase element) { |
141 | 148 |
boolean removeTypeDesignationFromAllTypifiedNames = PreferencesUtil.getBooleanValue(IPreferenceKeys.ADD_TYPES_TO_ALL_NAMES); |
142 | 149 |
TaxonName entity = removeTypeDesignationFromAllTypifiedNames ? null : getEntity(); |
143 |
CdmStore.getService(INameService.class).deleteTypeDesignation(entity.getUuid(), element.getUuid()); |
|
150 |
DetailsPartE4 detailsView = AbstractUtility.getDetailsView(getFormFactory().getContext().get((EPartService.class))); |
|
151 |
if(detailsView!=null |
|
152 |
&& detailsView.getSelectionProvidingPart().getObject() instanceof ITaxonEditor |
|
153 |
&& detailsView.getSelectionProvidingPart().getObject() instanceof IPostOperationEnabled) { |
|
154 |
DeleteTypeDesignationOperation operation = new DeleteTypeDesignationOperation( |
|
155 |
"Remove type designation", |
|
156 |
IOperationHistory.GLOBAL_UNDO_CONTEXT, |
|
157 |
entity, |
|
158 |
element, |
|
159 |
(IPostOperationEnabled) detailsView.getSelectionProvidingPart().getObject(), |
|
160 |
null); |
|
161 |
((ITaxonEditor) detailsView.getSelectionProvidingPart().getObject()).addOperation(operation); |
|
162 |
} |
|
163 |
if(entity!=null){ |
|
164 |
entity.removeTypeDesignation(element); |
|
165 |
} |
|
144 | 166 |
updateToolbar(); |
145 | 167 |
} |
146 | 168 |
|
Also available in: Unified diff
ref #8222 Delete type designations via operations