Project

General

Profile

Download (1.57 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.navigation.key.polytomous.e4.handler;
11

    
12
import javax.inject.Named;
13

    
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.e4.core.di.annotations.Execute;
16
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.jface.viewers.StructuredSelection;
19
import org.eclipse.jface.wizard.WizardDialog;
20
import org.eclipse.swt.widgets.Shell;
21

    
22
import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4;
23
import eu.etaxonomy.taxeditor.newWizard.NewPolytomousKeyWizard;
24

    
25
/**
26
 *
27
 * @author pplitzner
28
 * @since Sep 28, 2017
29
 *
30
 */
31
public class NewPolytomousKeyHandlerE4 {
32

    
33
    @Execute
34
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
35
             @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
36

    
37
        PolytomousKeyViewPartE4 view = (PolytomousKeyViewPartE4) activePart.getObject();
38
        NewPolytomousKeyWizard wizard = new NewPolytomousKeyWizard();
39
        wizard.init(null,null);
40
        WizardDialog dialog = new WizardDialog(shell, wizard);
41
        int status = dialog.open();
42
        if(status == IStatus.OK) {
43
            view.refresh();
44
            view.setViewerSelection(new StructuredSelection(wizard.getEntity()),true);
45
            view.openSelectedKeyNodes();
46
        }
47
    }
48
}
(1-1/6)