Search in sources :

Example 6 with TableComboViewer

use of org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer 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

TableComboViewer (org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer)6 GridData (org.eclipse.swt.layout.GridData)6 Composite (org.eclipse.swt.widgets.Composite)6 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 LanguageLabelProvider (net.heartsome.cat.ts.ui.composite.LanguageLabelProvider)4 TableCombo (org.eclipse.nebula.widgets.tablecombo.TableCombo)4 Label (org.eclipse.swt.widgets.Label)4 Button (org.eclipse.swt.widgets.Button)3 Group (org.eclipse.swt.widgets.Group)3 Text (org.eclipse.swt.widgets.Text)3 Language (net.heartsome.cat.common.locale.Language)2 HsImageLabel (net.heartsome.cat.common.ui.HsImageLabel)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1