Revision 887f95c5
Added by Katja Luther over 3 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/DeleteHandlerE4.java | ||
---|---|---|
21 | 21 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
22 | 22 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
23 | 23 |
import org.eclipse.e4.ui.services.IServiceConstants; |
24 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
24 | 25 |
import org.eclipse.jface.dialogs.MessageDialog; |
25 | 26 |
import org.eclipse.jface.viewers.TreeSelection; |
26 | 27 |
import org.eclipse.swt.widgets.Shell; |
... | ... | |
29 | 30 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
30 | 31 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
31 | 32 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
33 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
32 | 34 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
33 | 35 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
34 | 36 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
... | ... | |
58 | 60 |
protected static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION = Messages.DeleteHandler_DELETE_CLASSIFICATION; |
59 | 61 |
protected static final String CONFIRM_DELETION = Messages.DeleteHandler_CONFIRM_DELETE; |
60 | 62 |
protected static final String DELETE = Messages.DeleteHandler_DELETE; |
63 |
EPartService partService; |
|
61 | 64 |
|
62 | 65 |
@Execute |
63 | 66 |
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, |
64 | 67 |
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, |
65 | 68 |
@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
69 |
EPartService partService, |
|
66 | 70 |
MHandledMenuItem menuItem, UISynchronize sync) { |
67 |
|
|
71 |
this.partService = partService; |
|
68 | 72 |
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject(); |
69 | 73 |
|
70 | 74 |
Iterator selectionIterator = selection.iterator(); |
... | ... | |
194 | 198 |
protected boolean closeObsoleteEditor(TaxonNodeDto taxonNode){ |
195 | 199 |
//FIXME E4 migrate |
196 | 200 |
boolean result = true; |
197 |
// for (IEditorReference ref : activePage.getEditorReferences()) { |
|
198 |
// try { |
|
199 |
// String treeIndex = ((ITreeNode)taxonNode).treeIndex(); |
|
200 |
// |
|
201 |
// |
|
202 |
// IEditorInput input = ref.getEditorInput(); |
|
203 |
// if (input instanceof TaxonEditorInput) { |
|
204 |
// TaxonNode node = ((TaxonEditorInput) input).getTaxonNode(); |
|
205 |
// //if node is a child of taxonNode then close the editor |
|
206 |
// if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){ |
|
207 |
// //if (taxonNode.equals(node)) { |
|
208 |
// result &= activePage.closeEditor(ref.getEditor(false), true); |
|
209 |
// |
|
210 |
// } |
|
211 |
// } |
|
212 |
// } catch (PartInitException e) { |
|
213 |
// continue; |
|
214 |
// } |
|
215 |
// } |
|
201 |
EditorUtil.closeObsoleteEditor(taxonNode, partService); |
|
202 |
|
|
216 | 203 |
return result; |
217 | 204 |
} |
218 | 205 |
} |
Also available in: Unified diff
code cleaning in navigator