Project

General

Profile

Download (2.48 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
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.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.ui.section.classification;
11

    
12
import javax.inject.Inject;
13

    
14
import org.eclipse.e4.core.contexts.IEclipseContext;
15
import org.eclipse.jface.wizard.Wizard;
16
import org.eclipse.swt.widgets.Shell;
17

    
18
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
19
import eu.etaxonomy.cdm.model.reference.Reference;
20
import eu.etaxonomy.cdm.model.taxon.Classification;
21
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
22
import eu.etaxonomy.taxeditor.store.CdmStore;
23
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
24

    
25
/**
26
 *
27
 * @author pplitzner
28
 * @date Nov 6, 2016
29
 *
30
 */
31

    
32
public class CloneClassificationWizard extends Wizard{
33

    
34
	private CloneClassificationWizardPage cloneClassificationWizardPage;
35

    
36
    private ConversationHolder conversationHolder;
37

    
38
    private CdmFormFactory formFactory;
39

    
40
    private String classificationName;
41

    
42
    private TaxonRelationshipType relationType;
43

    
44
    private Reference reference;
45

    
46
    @Inject
47
    private IEclipseContext context;
48

    
49
    @Inject
50
    public CloneClassificationWizard() {
51
        super();
52
        conversationHolder = CdmStore.createConversation();
53

    
54
    }
55

    
56
    public void init(Classification classification){
57
        formFactory = new CdmFormFactory(context.get(Shell.class).getDisplay());
58
        cloneClassificationWizardPage = new CloneClassificationWizardPage(formFactory, conversationHolder, classification);
59
        addPage(cloneClassificationWizardPage);
60
    }
61

    
62

    
63
    @Override
64
    public boolean canFinish() {
65
        return cloneClassificationWizardPage.getClassificationName()!=null
66
                && cloneClassificationWizardPage.getRelationType()!=null &&
67
                        cloneClassificationWizardPage.getReference()!=null;
68
    }
69

    
70
    @Override
71
    public boolean performFinish() {
72
        classificationName = cloneClassificationWizardPage.getClassificationName();
73
        relationType = cloneClassificationWizardPage.getRelationType();
74
        reference = cloneClassificationWizardPage.getReference();
75
        return true;
76
    }
77

    
78

    
79
    public String getClassificationName(){
80
        return classificationName;
81
    }
82

    
83
    public TaxonRelationshipType getRelationType(){
84
        return relationType;
85
    }
86

    
87
    public Reference getReference(){
88
        return reference;
89
    }
90

    
91
}
(5-5/12)