1
|
/**
|
2
|
* Copyright (C) 2016 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
|
package eu.etaxonomy.taxeditor.ui.section.vocabulary;
|
10
|
|
11
|
import org.eclipse.jface.wizard.Wizard;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.term.Representation;
|
14
|
import eu.etaxonomy.cdm.model.term.TermBase;
|
15
|
import eu.etaxonomy.taxeditor.ui.translation.TermTranslationWizardPage;
|
16
|
|
17
|
/**
|
18
|
* @author k.luther
|
19
|
* @date 22.06.2016
|
20
|
*
|
21
|
*/
|
22
|
public class TermTranslationWizard extends Wizard {
|
23
|
private TermTranslationWizardPage page;
|
24
|
|
25
|
private final TermBase term;
|
26
|
|
27
|
/**
|
28
|
* <p>Constructor for TranslationWizard.</p>
|
29
|
*
|
30
|
* @param multilanguageText a {@link java.util.Map} object.
|
31
|
*/
|
32
|
public TermTranslationWizard(TermBase term) {
|
33
|
setWindowTitle("Translation Editor");
|
34
|
this.term = term;
|
35
|
setNeedsProgressMonitor(true);
|
36
|
}
|
37
|
|
38
|
/* (non-Javadoc)
|
39
|
* @see org.eclipse.jface.wizard.Wizard#addPages()
|
40
|
*/
|
41
|
/** {@inheritDoc} */
|
42
|
@Override
|
43
|
public void addPages() {
|
44
|
page = new TermTranslationWizardPage(term);
|
45
|
addPage(page);
|
46
|
}
|
47
|
|
48
|
/* (non-Javadoc)
|
49
|
* @see org.eclipse.jface.wizard.Wizard#performFinish()
|
50
|
*/
|
51
|
/** {@inheritDoc} */
|
52
|
@Override
|
53
|
public boolean performFinish() {
|
54
|
Representation representation = page.getTargetRepresentation();
|
55
|
|
56
|
if (representation.getLanguage() == null){
|
57
|
return false;
|
58
|
}
|
59
|
if (!representation.getText().equals("") || !representation.getLabel().equals("") || !representation.getAbbreviatedLabel().equals("")) {
|
60
|
term.addRepresentation(representation);
|
61
|
}
|
62
|
|
63
|
return true;
|
64
|
}
|
65
|
}
|