Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / translation / TranslationWizard.java
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.translation;
11
12 import java.util.Map;
13
14 import org.eclipse.jface.wizard.Wizard;
15
16 import eu.etaxonomy.cdm.model.common.Language;
17 import eu.etaxonomy.cdm.model.common.LanguageString;
18
19 /**
20 * <p>TranslationWizard class.</p>
21 *
22 * @author n.hoffmann
23 * @created Sep 29, 2010
24 * @version 1.0
25 */
26 public class TranslationWizard extends Wizard {
27
28 private TranslationWizardPage page;
29
30 private Map<Language, LanguageString> multilanguageText;
31
32 /**
33 * <p>Constructor for TranslationWizard.</p>
34 *
35 * @param multilanguageText a {@link java.util.Map} object.
36 */
37 public TranslationWizard(Map<Language, LanguageString> multilanguageText) {
38 setWindowTitle("Translation Editor");
39 this.multilanguageText = multilanguageText;
40 setNeedsProgressMonitor(true);
41 }
42
43 /* (non-Javadoc)
44 * @see org.eclipse.jface.wizard.Wizard#addPages()
45 */
46 /** {@inheritDoc} */
47 @Override
48 public void addPages() {
49 page = new TranslationWizardPage(multilanguageText);
50 addPage(page);
51 }
52
53 /* (non-Javadoc)
54 * @see org.eclipse.jface.wizard.Wizard#performFinish()
55 */
56 /** {@inheritDoc} */
57 @Override
58 public boolean performFinish() {
59 LanguageString languageString = page.getTargetLanguageString();
60
61 if (languageString.getLanguage() == null){
62 return false;
63 }
64 if (!languageString.getText().equals("")) {
65 multilanguageText.put(languageString.getLanguage(), languageString);
66 }
67
68 return true;
69 }
70
71
72 }