Added a bunch of functionality that will be needed when opening the editor with an...
[taxeditor.git] / taxeditor-navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / handler / NewTaxonomicTreeWizard.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.navigation.handler;
12
13 import org.apache.log4j.Logger;
14 import org.eclipse.core.commands.common.NotDefinedException;
15 import org.eclipse.core.commands.operations.AbstractOperation;
16 import org.eclipse.jface.viewers.IStructuredSelection;
17 import org.eclipse.jface.wizard.Wizard;
18 import org.eclipse.ui.INewWizard;
19 import org.eclipse.ui.IWorkbench;
20
21 import eu.etaxonomy.taxeditor.editor.EditorUtil;
22 import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
23 import eu.etaxonomy.taxeditor.operations.CreateTaxonomicTreeOperation;
24
25 /**
26 * @author n.hoffmann
27 * @created 23.06.2009
28 * @version 1.0
29 */
30 public class NewTaxonomicTreeWizard extends Wizard implements INewWizard {
31 private static final Logger logger = Logger
32 .getLogger(NewTaxonomicTreeWizard.class);
33
34 public static final String NEW_TAXONOMIC_TREE = "NEW_TAXONOMIC_TREE";
35
36 private NewTaxonomicTreeWizadPage page;
37
38 /**
39 *
40 */
41 public NewTaxonomicTreeWizard() {
42 // TODO Auto-generated constructor stub
43 }
44
45 /* (non-Javadoc)
46 * @see org.eclipse.jface.wizard.Wizard#addPages()
47 */
48 @Override
49 public void addPages() {
50 super.addPages();
51
52 page = new NewTaxonomicTreeWizadPage(NEW_TAXONOMIC_TREE);
53
54 addPage(page);
55 }
56
57 /* (non-Javadoc)
58 * @see org.eclipse.jface.wizard.Wizard#performFinish()
59 */
60 @Override
61 public boolean performFinish() {
62
63 AbstractOperation operation = new CreateTaxonomicTreeOperation("Create Taxonomic Tree",
64 NavigationUtil.getUndoContext(), page.getTreeLabel());
65 NavigationUtil.executeOperation(operation);
66
67 NavigationUtil.getNavigator().getCommonViewer().refresh();
68
69 return true;
70 }
71
72 /* (non-Javadoc)
73 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
74 */
75 public void init(IWorkbench workbench, IStructuredSelection selection) {
76 // TODO Auto-generated method stub
77
78 }
79 }