Project

General

Profile

Download (1.52 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.navigator.e4.handler;
11

    
12
import javax.inject.Named;
13

    
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.e4.ui.services.IServiceConstants;
16
import org.eclipse.jface.wizard.WizardDialog;
17
import org.eclipse.swt.widgets.Shell;
18

    
19
import eu.etaxonomy.taxeditor.editor.EditorUtil;
20
import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
21
import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard;
22

    
23
/**
24
 *
25
 * @author pplitzner
26
 * @date 05.09.2017
27
 *
28
 */
29
public class NewTaxonNodeHandlerE4 {
30

    
31
    public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) throws Exception {
32

    
33
		final NewTaxonNodeWizard wizard = new NewTaxonNodeWizard();
34
		wizard.init(null, null);
35
		final WizardDialog dialog = new WizardDialog(shell, wizard);
36
		wizard.addWizardPageListener(new IWizardPageListener() {
37
		    @Override
38
		    public void close() {
39
		        wizard.performFinish();
40
		        dialog.close();
41
		    }
42
		});
43
		int status = dialog.open();
44

    
45
		if(status == IStatus.OK && wizard.openInEditor()){
46
			if(wizard.openEmpty()){
47
                EditorUtil.openEmptyE4(wizard.getParentTreeNode().getUuid());
48
			}else if(wizard.getTaxonNode() != null){
49
                EditorUtil.openTaxonNodeE4(wizard.getTaxonNode().getUuid());
50
			}
51
		}
52
	}
53
}
(9-9/11)