Revision f30ec5df
Added by Katja Luther almost 8 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java | ||
---|---|---|
17 | 17 |
import org.eclipse.core.runtime.IStatus; |
18 | 18 |
import org.eclipse.core.runtime.Status; |
19 | 19 |
import org.eclipse.jface.viewers.IStructuredSelection; |
20 |
import org.eclipse.ui.IEditorInput; |
|
21 |
import org.eclipse.ui.IEditorReference; |
|
22 |
import org.eclipse.ui.IWorkbenchPage; |
|
23 |
import org.eclipse.ui.PartInitException; |
|
20 | 24 |
import org.eclipse.ui.handlers.HandlerUtil; |
21 | 25 |
|
26 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput; |
|
22 | 27 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
23 | 28 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels; |
24 | 29 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation; |
... | ... | |
58 | 63 |
if(!confirmation) { |
59 | 64 |
return Status.CANCEL_STATUS; |
60 | 65 |
} |
66 |
closeObsoleteEditor(event); |
|
61 | 67 |
return Status.OK_STATUS; |
62 | 68 |
} |
63 | 69 |
|
... | ... | |
79 | 85 |
// TODO Auto-generated method stub |
80 | 86 |
|
81 | 87 |
} |
88 |
protected boolean closeObsoleteEditor(ExecutionEvent event){ |
|
89 |
boolean result = true; |
|
90 |
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); |
|
91 |
|
|
92 |
for (IEditorReference ref : activePage.getEditorReferences()) { |
|
93 |
try { |
|
94 |
IEditorInput input = ref.getEditorInput(); |
|
95 |
if (input instanceof PolytomousKeyEditorInput) { |
|
96 |
UUID uuidForKey = ((PolytomousKeyEditorInput) input).getKey().getUuid(); |
|
97 |
for (UUID keyUuid :keysToDelete) { |
|
98 |
if( uuidForKey.equals(keyUuid)){ |
|
99 |
result &= activePage.closeEditor(ref.getEditor(false), false); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
} |
|
104 |
} catch (PartInitException e) { |
|
105 |
continue; |
|
106 |
} |
|
107 |
} |
|
108 |
return result; |
|
109 |
} |
|
82 | 110 |
|
83 | 111 |
} |
Also available in: Unified diff
fixing the deletion of polytomous keys