import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
private CdmFormFactory formFactory;
- private TermComboElement combo_sourceLanguage;
+ private TermComboElement<Language> combo_sourceLanguage;
private LanguageStringWithLabelElement text_source;
public void createControl(Composite parent) {
Composite control = formFactory.createComposite(parent);
// control.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN));
- control.setLayout(CdmFormFactory.LAYOUT(2, true));
+ control.setLayout(LayoutConstants.LAYOUT(2, true));
Composite leftContainer = formFactory.createComposite(control);
- leftContainer.setLayoutData(CdmFormFactory.FILL());
- leftContainer.setLayout(CdmFormFactory.LAYOUT(1, false));
+ leftContainer.setLayoutData(LayoutConstants.FILL());
+ leftContainer.setLayout(LayoutConstants.LAYOUT(1, false));
// leftContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
RootElement leftRoot = new RootElement(formFactory, leftContainer);
Composite rightContainer = formFactory.createComposite(control);
- rightContainer.setLayoutData(CdmFormFactory.FILL());
- rightContainer.setLayout(CdmFormFactory.LAYOUT(1, false));
+ rightContainer.setLayoutData(LayoutConstants.FILL());
+ rightContainer.setLayout(LayoutConstants.LAYOUT(1, false));
// rightContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
RootElement rightRoot = new RootElement(formFactory, rightContainer);
Language sourceLanguage = text_source.getLanguageString().getLanguage();
Language targetLanguage = combo_targetLanguage.getSelection();
+ if(targetLanguage == null){
+ StoreUtil.warningDialog("Please select a target language", TranslationWizardPage.class, "Please select a language from the combo box at the right.");
+ return;
+ }
+
translatedText = service.translate(text, sourceLanguage, targetLanguage);
text_target.setText(translatedText);
} catch (LanguageNotSupportedException e) {
- StoreUtil.warningDialog("Language not supported", TranslationWizardPage.class, e.getMessage());
+ StoreUtil.warningDialog("Language not supported", TranslationWizardPage.class, "The chosen language is not supported by the translation service.");
} catch (Exception e){
StoreUtil.warningDialog("Error translating text", TranslationWizardPage.class, e.getMessage());
}