2 * Copyright (C) 2009 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
.propertysheet
.type
.wizard
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.core
.databinding
.observable
.list
.WritableList
;
14 import org
.eclipse
.jface
.wizard
.Wizard
;
15 import org
.eclipse
.jface
.wizard
.WizardPage
;
17 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
25 public class TypeDesignationWizard
extends Wizard
{
27 private static Logger logger
= Logger
28 .getLogger(TypeDesignationWizard
.class);
30 private SpecimenTypeDesignation typeDesignation
;
31 private TaxonNameBase name
;
32 private WritableList typeDesignationsList
;
34 public class TemporarySpecimenTypeDesignation
extends
35 SpecimenTypeDesignation
{
36 TemporarySpecimenTypeDesignation() {
41 private WizardPage chooseNamePage
;
44 * @param typeDesignation
45 * @param typeDesignationsList
47 public TypeDesignationWizard(SpecimenTypeDesignation typeDesignation
, TaxonNameBase name
, WritableList typeDesignationsList
) {
50 if (typeDesignation
== null) {
51 createEmptyTypeDesignation();
53 this.typeDesignation
= typeDesignation
;
55 this.typeDesignationsList
= typeDesignationsList
;
61 private void createEmptyTypeDesignation() {
62 typeDesignation
= new TemporarySpecimenTypeDesignation();
66 * @see org.eclipse.jface.wizard.Wizard#addPages()
68 public void addPages() {
69 chooseNamePage
= new ChooseTypeDesignationWizardPage(typeDesignation
, name
);
70 addPage(chooseNamePage
);
74 * @see org.eclipse.jface.wizard.Wizard#performFinish()
77 public boolean performFinish() {
79 chooseNamePage
.setPageComplete(true);
81 // Remove then re-add in case any name editing has taken place
82 typeDesignationsList
.remove(typeDesignation
);
83 typeDesignationsList
.add(typeDesignation
);