// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard;
/**
* @created Sep 15, 2009
* @version 1.0
*/
-public class NewTaxonNodeHandler extends AbstractHandler implements IHandler {
+public class NewTaxonNodeHandler extends AbstractHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NewTaxonNodeWizard wizard = new NewTaxonNodeWizard();
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final NewTaxonNodeWizard wizard = new NewTaxonNodeWizard();
wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ final WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ wizard.addWizardPageListener(new IWizardPageListener() {
+
+ @Override
+ public void close() {
+ wizard.performFinish();
+ dialog.close();
+ }
+ });
int status = dialog.open();
-
+
if(status == IStatus.OK && wizard.openInEditor()){
if(wizard.openEmpty()){
NavigationUtil.openEmpty(wizard.getParentTreeNode().getUuid());
}else if(wizard.getTaxonNode() != null){
NavigationUtil.openEditor(wizard.getTaxonNode());
}
- }
+ }
return null;
}
}