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
.view
.propertysheetsupport
.namerelationswizard
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
14 import org
.eclipse
.jface
.util
.PropertyChangeEvent
;
15 import org
.eclipse
.jface
.wizard
.IWizardPage
;
16 import org
.eclipse
.jface
.wizard
.Wizard
;
18 import eu
.etaxonomy
.taxeditor
.ITaxEditorConstants
;
19 import eu
.etaxonomy
.taxeditor
.actions
.cdm
.CreateNameRelationAction
;
26 public class NameRelationWizard
extends Wizard
{
27 private static final Logger logger
= Logger
28 .getLogger(NameRelationWizard
.class);
30 public static final String ID
= "eu.etaxonomy.taxeditor.namerelationwizard";
32 private NameRelationWizardModel relationModel
;
34 public NameRelationWizard(NameRelationWizardModel relationModel
) {
37 this.relationModel
= relationModel
;
40 public void addPages() {
41 IWizardPage chooseNamePage
= new ChooseRelatedNameWizardPage(relationModel
);
42 addPage(chooseNamePage
);
43 IWizardPage chooseRelationPage
= new ChooseRelationTypeWizardPage(relationModel
);
44 addPage(chooseRelationPage
);
48 public boolean performFinish() {
49 CreateNameRelationAction nameRelationAction
= new CreateNameRelationAction(relationModel
.getFromName(),
50 relationModel
.getType(),
51 relationModel
.getToName());
52 // if (relationModel.getNameRelationsList() != null) {
54 // Action will notify when relation has been created
55 nameRelationAction
.addPropertyChangeListener(new IPropertyChangeListener() {
57 public void propertyChange(PropertyChangeEvent event
) {
58 logger
.warn(event
.getProperty());
59 if (event
.getProperty().equals(
60 ITaxEditorConstants
.NAMERELATION
)) {
61 logger
.warn("checking name relations list");
62 if (relationModel
.getNameRelationsList() != null) {
63 logger
.warn("clearing name relations");
64 relationModel
.getNameRelationsList().clear();
65 relationModel
.getNameRelationsList().addAll(relationModel
.getBaseName().getNameRelations());
72 nameRelationAction
.run();