Project

General

Profile

Download (1.54 KB) Statistics
| Branch: | Tag: | Revision:
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.e4.handler;
11

    
12
import javax.inject.Named;
13

    
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.swt.widgets.Shell;
20

    
21
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
22
import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
23

    
24
/**
25
 *
26
 * @author pplitzner
27
 * @since Aug 28, 2017
28
 *
29
 */
30
public class DeleteAllEmptyNamesHandlerE4 extends DeleteTaxonBaseHandlerE4 {
31

    
32
    @Override
33
    @Execute
34
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
35
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selectedElement,
36
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
37
            MHandledMenuItem menuItem) {
38

    
39
        editor = (TaxonNameEditorE4) activePart.getObject();
40

    
41
		for(AbstractGroupedContainerE4 containerWithEmptyName : editor.getEmptyContainers()){
42
		    editor.removeGroup(containerWithEmptyName.getGroup());
43
			doExecute(menuItem.getLocalizedLabel(), shell, editor, containerWithEmptyName.getData());
44
		}
45

    
46
	}
47

    
48
}
(8-8/12)