Project

General

Profile

Download (2.13 KB) Statistics
| Branch: | Tag: | Revision:
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.featuretree;
12

    
13
import org.eclipse.jface.wizard.Wizard;
14

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
17
import eu.etaxonomy.cdm.model.description.FeatureTree;
18
import eu.etaxonomy.taxeditor.store.CdmStore;
19

    
20
/**
21
 * <p>FeatureTreeEditorWizard class.</p>
22
 *
23
 * @author n.hoffmann
24
 * @created Aug 5, 2010
25
 * @version 1.0
26
 */
27
public class FeatureTreeEditorWizard extends Wizard {
28
	
29
	private SelectFeatureTreeWizardPage selectFeatureTreePage;
30
	private EditFeatureTreeWizardPage editFeatureTreePage;
31
	
32
	private FeatureTree selectedFeatureTree;
33

    
34
	private ConversationHolder conversation;
35
	
36
	/**
37
	 * <p>Constructor for FeatureTreeEditorWizard.</p>
38
	 */
39
	public FeatureTreeEditorWizard(){
40
		conversation = CdmStore.createConversation();
41
		setWindowTitle("Feature Tree Editor");
42
	}
43
	
44
	/**
45
	 * <p>addPages</p>
46
	 */
47
	public void addPages() {
48
		selectFeatureTreePage = new SelectFeatureTreeWizardPage("SELECT");
49
		addPage(selectFeatureTreePage);
50
		
51
		editFeatureTreePage = new EditFeatureTreeWizardPage("EDIT");
52
		addPage(editFeatureTreePage);
53
	}
54

    
55

    
56

    
57
	/** {@inheritDoc} */
58
	@Override
59
	public boolean performFinish() {
60
		try{
61
			CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(selectedFeatureTree);
62
			conversation.commit();
63
		}finally{
64
			conversation.close();
65
		}
66
		
67
		return true;
68
	}
69

    
70
	/**
71
	 * <p>Setter for the field <code>selectedFeatureTree</code>.</p>
72
	 *
73
	 * @param selectedFeatureTree the selectedFeatureTree to set
74
	 */
75
	public void setSelectedFeatureTree(FeatureTree selectedFeatureTree) {
76
		this.selectedFeatureTree = selectedFeatureTree;
77
		editFeatureTreePage.setSelectedTree(selectedFeatureTree);
78
	}
79

    
80
	/**
81
	 * <p>Getter for the field <code>selectedFeatureTree</code>.</p>
82
	 *
83
	 * @return the selectedFeatureTree
84
	 */
85
	public FeatureTree getSelectedFeatureTree() {
86
		return selectedFeatureTree;
87
	}
88
	
89
}
(6-6/9)