Search in sources :

Example 6 with LanguageLabelProvider

use of net.heartsome.cat.ts.ui.composite.LanguageLabelProvider in project translationstudio8 by heartsome.

the class ProjectSettingLanguagePage method createContents.

/**
	 * Create contents of the preference page.
	 * @param parent
	 */
@Override
public Control createContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    container.setLayout(new GridLayout(1, false));
    // source language control
    Group sourceLanguageGrp = new Group(container, SWT.NONE);
    sourceLanguageGrp.setLayout(new GridLayout(1, false));
    sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    sourceLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp"));
    srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
    TableCombo tableCombo = srcLangComboViewer.getTableCombo();
    // set options.
    tableCombo.setShowTableLines(false);
    tableCombo.setShowTableHeader(false);
    tableCombo.setDisplayColumnIndex(-1);
    tableCombo.setShowImageWithinSelection(true);
    tableCombo.setShowColorWithinSelection(false);
    tableCombo.setShowFontWithinSelection(false);
    tableCombo.setVisibleItemCount(20);
    srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
    srcLangComboViewer.setContentProvider(new ArrayContentProvider());
    srcLangComboViewer.setInput(languages);
    srcLangComboViewer.setComparer(elementComparer);
    initDataBindings();
    // end source language
    // target language control
    Group targetLanguageGrp = new Group(container, SWT.NONE);
    targetLanguageGrp.setLayout(new GridLayout(3, false));
    targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    targetLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.targetLanguageGrp"));
    targetLangControl.createControl(targetLanguageGrp);
    parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    return container;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo) TableComboViewer(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer)

Aggregations

LanguageLabelProvider (net.heartsome.cat.ts.ui.composite.LanguageLabelProvider)6 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)5 GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Composite (org.eclipse.swt.widgets.Composite)5 TableComboViewer (org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer)4 TableCombo (org.eclipse.nebula.widgets.tablecombo.TableCombo)4 ArrayList (java.util.ArrayList)3 Language (net.heartsome.cat.common.locale.Language)3 Button (org.eclipse.swt.widgets.Button)3 Group (org.eclipse.swt.widgets.Group)3 Label (org.eclipse.swt.widgets.Label)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Table (org.eclipse.swt.widgets.Table)2 Text (org.eclipse.swt.widgets.Text)2 NavException (com.ximpleware.NavException)1 XPathEvalException (com.ximpleware.XPathEvalException)1