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