1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.editor.name.handler;
|
11
|
|
12
|
import org.eclipse.core.commands.ExecutionEvent;
|
13
|
import org.eclipse.core.commands.ExecutionException;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
16
|
import eu.etaxonomy.taxeditor.editor.EditorUtil;
|
17
|
import eu.etaxonomy.taxeditor.editor.Page;
|
18
|
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
|
19
|
import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
* @created Jan 28, 2011
|
24
|
* @version 1.0
|
25
|
*/
|
26
|
public class DeleteAllEmptyNamesHandler extends DeleteTaxonBaseHandler {
|
27
|
|
28
|
/* (non-Javadoc)
|
29
|
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
30
|
*/
|
31
|
@Override
|
32
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
33
|
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
|
34
|
|
35
|
for(AbstractGroupedContainer<TaxonBase> containerWithEmptyName : editor.getEmptyContainers()){
|
36
|
editor.removeGroup(containerWithEmptyName.getGroup());
|
37
|
doExecute(event, editor, containerWithEmptyName.getData());
|
38
|
}
|
39
|
|
40
|
return null;
|
41
|
}
|
42
|
|
43
|
}
|