2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.navigation
.navigator
.e4
.handler
;
12 import javax
.inject
.Named
;
14 import org
.eclipse
.core
.runtime
.IStatus
;
15 import org
.eclipse
.e4
.core
.di
.annotations
.CanExecute
;
16 import org
.eclipse
.e4
.core
.di
.annotations
.Execute
;
17 import org
.eclipse
.e4
.ui
.services
.IServiceConstants
;
18 import org
.eclipse
.jface
.viewers
.TreeSelection
;
19 import org
.eclipse
.jface
.wizard
.WizardDialog
;
20 import org
.eclipse
.swt
.widgets
.Shell
;
22 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
23 import eu
.etaxonomy
.taxeditor
.newWizard
.IWizardPageListener
;
24 import eu
.etaxonomy
.taxeditor
.newWizard
.NewTaxonNodeWizard
;
32 public class NewTaxonNodeHandlerE4
{
35 public void execute(@Named(IServiceConstants
.ACTIVE_SHELL
)Shell shell
) throws Exception
{
37 final NewTaxonNodeWizard wizard
= new NewTaxonNodeWizard();
38 wizard
.init(null, null);
39 final WizardDialog dialog
= new WizardDialog(shell
, wizard
);
40 wizard
.addWizardPageListener(new IWizardPageListener() {
43 wizard
.performFinish();
47 int status
= dialog
.open();
49 if(status
== IStatus
.OK
&& wizard
.openInEditor()){
50 if(wizard
.openEmpty()){
51 EditorUtil
.openEmptyE4(wizard
.getParentTreeNode().getUuid());
52 }else if(wizard
.getTaxonNode() != null){
53 EditorUtil
.openTaxonNodeE4(wizard
.getTaxonNode().getUuid());
59 private boolean canExecute(@Named(IServiceConstants
.ACTIVE_SELECTION
)TreeSelection selection
){
60 return selection
!=null && !selection
.isEmpty();