(no commit message)
[taxeditor.git] / taxeditor-navigation / src / main / java / eu / etaxonomy / taxeditor / newWizards / NewClassificationWizard.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.newWizards;
12
13 import org.apache.log4j.Logger;
14 import org.eclipse.core.commands.operations.AbstractOperation;
15 import org.eclipse.jface.viewers.IStructuredSelection;
16 import org.eclipse.jface.wizard.Wizard;
17 import org.eclipse.ui.INewWizard;
18 import org.eclipse.ui.IWorkbench;
19
20 import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
21 import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
22 import eu.etaxonomy.taxeditor.operations.CreateTaxonomicTreeOperation;
23
24 /**
25 * @author n.hoffmann
26 * @created 23.06.2009
27 * @version 1.0
28 */
29 public class NewClassificationWizard extends Wizard implements INewWizard {
30 private static final Logger logger = Logger
31 .getLogger(NewClassificationWizard.class);
32
33 public static final String NEW_CLASSIFICATION = "NEW_CLASSIFICATION";
34
35 private NewClassificationWizardPage page;
36
37 public NewClassificationWizard(){
38 setWindowTitle("New Classification");
39 }
40
41 /* (non-Javadoc)
42 * @see org.eclipse.jface.wizard.Wizard#addPages()
43 */
44 @Override
45 public void addPages() {
46 super.addPages();
47
48 page = new NewClassificationWizardPage(NEW_CLASSIFICATION);
49
50 addPage(page);
51 }
52
53 /* (non-Javadoc)
54 * @see org.eclipse.jface.wizard.Wizard#performFinish()
55 */
56 @Override
57 public boolean performFinish() {
58
59 TaxonNavigator taxonNavigator;
60 taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
61
62 AbstractOperation operation = new CreateTaxonomicTreeOperation("Create Classification",
63 NavigationUtil.getUndoContext(), page.getTreeLabel(), page.getReferenceUuid(), page.getMicroReference(),
64 taxonNavigator, taxonNavigator);
65 NavigationUtil.executeOperation(operation);
66
67 NavigationUtil.showNavigator().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
77 }
78 }