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
        formFactory = new CdmFormFactory(context.get(Shell.class).getDisplay());
54
    }
55

    
56
    public void init(Classification classification){
57
        cloneClassificationWizardPage = new CloneClassificationWizardPage(formFactory, conversationHolder, classification);
58
        addPage(cloneClassificationWizardPage);
59
    }
60

    
61

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

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

    
77

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

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

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

    
90
}
(5-5/12)