Project

General

Profile

« Previous | Next » 

Revision 23783f7a

Added by Niels Hoffmann about 12 years ago

Refactoring of selection elements. Additional minor refactoring. Fixed a bug with Translation Editor (#2752)

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/TranslationWizardPage.java
34 34
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
35 35
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
36 36
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
37
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
37 38
import eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement;
38 39
import eu.etaxonomy.taxeditor.ui.element.RootElement;
39 40

  
......
54 55
	
55 56
	private CdmFormFactory formFactory;
56 57

  
57
	private TermComboElement combo_sourceLanguage;
58
	private TermComboElement<Language> combo_sourceLanguage;
58 59

  
59 60
	private LanguageStringWithLabelElement text_source;
60 61

  
......
83 84
	public void createControl(Composite parent) {
84 85
		Composite control = formFactory.createComposite(parent);
85 86
//		control.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN));
86
		control.setLayout(CdmFormFactory.LAYOUT(2, true));
87
		control.setLayout(LayoutConstants.LAYOUT(2, true));
87 88
		
88 89
		Composite leftContainer = formFactory.createComposite(control);
89
		leftContainer.setLayoutData(CdmFormFactory.FILL());
90
		leftContainer.setLayout(CdmFormFactory.LAYOUT(1, false));
90
		leftContainer.setLayoutData(LayoutConstants.FILL());
91
		leftContainer.setLayout(LayoutConstants.LAYOUT(1, false));
91 92
//		leftContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
92 93
		RootElement leftRoot = new RootElement(formFactory, leftContainer);
93 94
		
94 95
		Composite rightContainer = formFactory.createComposite(control);
95
		rightContainer.setLayoutData(CdmFormFactory.FILL());
96
		rightContainer.setLayout(CdmFormFactory.LAYOUT(1, false));
96
		rightContainer.setLayoutData(LayoutConstants.FILL());
97
		rightContainer.setLayout(LayoutConstants.LAYOUT(1, false));
97 98
//		rightContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
98 99
		RootElement rightRoot = new RootElement(formFactory, rightContainer);
99 100
		
......
193 194
					Language sourceLanguage = text_source.getLanguageString().getLanguage();
194 195
					Language targetLanguage = combo_targetLanguage.getSelection();
195 196
					
197
					if(targetLanguage == null){
198
						StoreUtil.warningDialog("Please select a target language", TranslationWizardPage.class, "Please select a language from the combo box at the right.");
199
						return;
200
					}
201
					
196 202
					translatedText = service.translate(text, sourceLanguage, targetLanguage);
197 203
					text_target.setText(translatedText);
198 204
				} catch (LanguageNotSupportedException e) {
199
					StoreUtil.warningDialog("Language not supported", TranslationWizardPage.class, e.getMessage());
205
					StoreUtil.warningDialog("Language not supported", TranslationWizardPage.class, "The chosen language is not supported by the translation service.");
200 206
				} catch (Exception e){
201 207
					StoreUtil.warningDialog("Error translating text", TranslationWizardPage.class, e.getMessage());
202 208
				}

Also available in: Unified diff