Search in sources :

Example 1 with LanguageLabelProvider

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

the class CSVSettingDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(5, 5, 5, 5).applyTo(tparent);
    int height = 160;
    if (isTBXConverter) {
        height = 230;
    }
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(320, height).grab(true, true).applyTo(tparent);
    Composite cmpSelFile = new Composite(tparent, SWT.None);
    GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).extendedMargins(0, 0, 0, 0).applyTo(cmpSelFile);
    GridDataFactory.fillDefaults().applyTo(cmpSelFile);
    new Label(cmpSelFile, SWT.None).setText(Messages.getString("dialog.CSVSettingDialog.lblFile"));
    txtCSV = new Text(cmpSelFile, SWT.BORDER);
    txtCSV.setEditable(false);
    txtCSV.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnBrowse = new Button(cmpSelFile, SWT.None);
    btnBrowse.setText(Messages.getString("dialog.CSVSettingDialog.btnBrowse"));
    btnBrowse.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent arg0) {
            FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
            dialog.setText(Messages.getString("dialog.CSVSettingDialog.dialogTitle"));
            String[] extensions = { "*.csv", "*.txt", "*" };
            String[] filters = { Messages.getString("dialog.CSVSettingDialog.filters1"), Messages.getString("dialog.CSVSettingDialog.filters2"), Messages.getString("dialog.CSVSettingDialog.filters3") };
            dialog.setFilterExtensions(extensions);
            dialog.setFilterNames(filters);
            String fileSep = System.getProperty("file.separator");
            if (txtCSV.getText() != null && !txtCSV.getText().trim().equals("")) {
                dialog.setFilterPath(txtCSV.getText().substring(0, txtCSV.getText().lastIndexOf(fileSep)));
                dialog.setFileName(txtCSV.getText().substring(txtCSV.getText().lastIndexOf(fileSep) + 1));
            } else {
                dialog.setFilterPath(System.getProperty("user.home"));
            }
            String name = dialog.open();
            if (name != null) {
                txtCSV.setText(name);
            }
        }

        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
    Composite cmpContent = new Composite(tparent, SWT.NONE);
    cmpContent.setLayout(new GridLayout(2, false));
    cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH));
    createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbColSeparator"));
    cmbColSeparator = new Combo(cmpContent, SWT.NONE);
    cmbColSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbColSeparator.setItems(arrColSeparator);
    cmbColSeparator.select(1);
    createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbTextDelimiter"));
    cmbTextDelimiter = new Combo(cmpContent, SWT.NONE);
    cmbTextDelimiter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbTextDelimiter.setItems(arrTextDelimiter);
    cmbTextDelimiter.setText("\"");
    cmbTextDelimiter.setTextLimit(1);
    createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbEncoding"));
    cmbEncoding = new Combo(cmpContent, SWT.READ_ONLY);
    cmbEncoding.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    String[] arrEncoding = LocaleService.getPageCodes();
    cmbEncoding.setItems(arrEncoding);
    cmbEncoding.select(indexOf(arrEncoding, "UTF-8"));
    if (isTBXConverter) {
        createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbLang"));
        cmbLang = new TableComboViewer(cmpContent, SWT.READ_ONLY | SWT.BORDER);
        TableCombo tableCombo = cmbLang.getTableCombo();
        tableCombo.setShowTableLines(false);
        tableCombo.setShowTableHeader(false);
        tableCombo.setDisplayColumnIndex(-1);
        tableCombo.setShowImageWithinSelection(true);
        tableCombo.setShowColorWithinSelection(false);
        tableCombo.setShowFontWithinSelection(false);
        tableCombo.setVisibleItemCount(20);
        cmbLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        ArrayList<Language> languages = new ArrayList<Language>(LocaleService.getDefaultLanguage().values());
        Collections.sort(languages, new Comparator<Language>() {

            public int compare(Language o1, Language o2) {
                return o1.toString().compareTo(o2.toString());
            }
        });
        cmbLang.setContentProvider(new ArrayContentProvider());
        cmbLang.setLabelProvider(new LanguageLabelProvider());
        cmbLang.setInput(languages);
        cmbLang.getTableCombo().select(0);
        createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbXCSTemplate"));
        cmbXCSTemplate = new Combo(cmpContent, SWT.READ_ONLY);
        cmbXCSTemplate.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        if (xcsTemplates.length > 0) {
            cmbXCSTemplate.setItems(xcsTemplates);
            cmbXCSTemplate.select(0);
        }
    }
    return tparent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo) Combo(org.eclipse.swt.widgets.Combo) TableComboViewer(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer) GridLayout(org.eclipse.swt.layout.GridLayout) Language(net.heartsome.cat.common.locale.Language) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo) FileDialog(org.eclipse.swt.widgets.FileDialog) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with LanguageLabelProvider

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

the class SpellPage method createAspellCmp.

/**
	 * 创建 aspell 的配置界面
	 */
private void createAspellCmp() {
    isInit = true;
    Composite groupParent = new Composite(tabFolder, SWT.NONE);
    groupParent.setLayout(new GridLayout());
    groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
    //		Group groupParent = new Group(tparent, SWT.None);
    //		groupParent.setLayout(new GridLayout());
    //		groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
    //		groupParent.setText(Messages.getString("qa.preference.SpellPage.groupParent"));
    HsImageLabel imageLabel = new HsImageLabel(Messages.getString("qa.preference.SpellPage.imageLabel"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_ASPELL_DIC));
    Composite cmp = imageLabel.createControl(groupParent);
    cmp.setLayout(new GridLayout());
    Composite cmpTemp = (Composite) imageLabel.getControl();
    cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite cmpContent = new Composite(cmpTemp, SWT.None);
    cmpContent.setLayout(new GridLayout(3, false));
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    cmpContent.setLayoutData(data);
    Label lbl = new Label(cmpContent, SWT.NONE);
    lbl.setText(Messages.getString("qa.preference.SpellPage.lblPath"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
    txtCommandPath = new Text(cmpContent, SWT.BORDER);
    txtCommandPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    txtCommandPath.setEditable(false);
    btnBrowse = new Button(cmpContent, SWT.NONE);
    btnBrowse.setText(Messages.getString("qa.preference.SpellPage.btnBrowse"));
    //		GridData btnData = new GridData();
    //		btnData.widthHint = 70;
    //		btnBrowse.setLayoutData(btnData);
    new Label(cmpContent, SWT.NONE);
    btnUTF8 = new Button(cmpContent, SWT.CHECK);
    btnUTF8.setText(Messages.getString("qa.preference.SpellPage.btnUTF8"));
    new Label(cmpContent, SWT.NONE);
    lbl = new Label(cmpContent, SWT.NONE);
    lbl.setText(Messages.getString("qa.preference.SpellPage.lblDic"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
    cmbDefaultDic = new ComboViewer(cmpContent);
    cmbDefaultDic.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    btnRefresh = new Button(cmpContent, SWT.NONE);
    btnRefresh.setText(Messages.getString("qa.preference.SpellPage.btnRefresh"));
    lbl = new Label(cmpContent, SWT.NONE);
    lbl.setText(Messages.getString("qa.preference.SpellPage.lblLang"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
    cmbLang = new TableComboViewer(cmpContent, SWT.READ_ONLY | SWT.BORDER);
    TableCombo tableCombo = cmbLang.getTableCombo();
    tableCombo.setShowTableLines(false);
    tableCombo.setShowTableHeader(false);
    tableCombo.setDisplayColumnIndex(-1);
    tableCombo.setShowImageWithinSelection(true);
    tableCombo.setShowColorWithinSelection(false);
    tableCombo.setShowFontWithinSelection(false);
    tableCombo.setVisibleItemCount(20);
    cmbLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    cmbLang.setLabelProvider(new LanguageLabelProvider());
    cmbLang.setContentProvider(new ArrayContentProvider());
    cmbLang.setInput(languages);
    cmbLang.getTableCombo().select(0);
    new Label(cmpContent, SWT.NONE);
    Composite cmpTableBtn = new Composite(cmpContent, SWT.NONE);
    GridLayout btnLayout = new GridLayout(2, false);
    btnLayout.marginWidth = 0;
    cmpTableBtn.setLayout(btnLayout);
    GridData btnData1 = new GridData(GridData.FILL_BOTH);
    btnData1.horizontalSpan = 3;
    cmpTableBtn.setLayoutData(btnData1);
    btnAdd = new Button(cmpTableBtn, SWT.NONE);
    btnAdd.setText(Messages.getString("qa.preference.SpellPage.btnAdd"));
    btnRemove = new Button(cmpTableBtn, SWT.NONE);
    btnRemove.setText(Messages.getString("qa.preference.SpellPage.btnRemove"));
    Point browsePoint = btnBrowse.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    Point refreshPoint = btnRefresh.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    Point addPoint = btnAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    Point remPoint = btnRemove.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    GridData btnData = new GridData();
    int width = Math.max(refreshPoint.x, Math.max(browsePoint.x, Math.max(addPoint.x, remPoint.x)));
    btnData.widthHint = width + 10;
    btnBrowse.setLayoutData(btnData);
    btnRefresh.setLayoutData(btnData);
    btnAdd.setLayoutData(btnData);
    btnRemove.setLayoutData(btnData);
    table = new Table(cmpTableBtn, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    String[] arrTableHeader = new String[] { Messages.getString("qa.preference.SpellPage.arrTableHeader1"), "", Messages.getString("qa.preference.SpellPage.arrTableHeader2") };
    int[] arrWidth = new int[] { 195, 40, 195 };
    for (int i = 0; i < arrTableHeader.length; i++) {
        int style = SWT.NONE;
        if (i == 1) {
            style = SWT.CENTER;
        }
        TableColumn col = new TableColumn(table, style);
        col.setText(arrTableHeader[i]);
        col.setWidth(arrWidth[i]);
    }
    GridData dataTable = new GridData(GridData.FILL_BOTH);
    dataTable.horizontalSpan = 2;
    table.setLayoutData(dataTable);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    initProperty();
    initListener();
    imageLabel.computeSize();
    aspellTabItem.setControl(groupParent);
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) Label(org.eclipse.swt.widgets.Label) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Text(org.eclipse.swt.widgets.Text) TableComboViewer(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer) Point(org.eclipse.swt.graphics.Point) TableColumn(org.eclipse.swt.widgets.TableColumn) Point(org.eclipse.swt.graphics.Point) GridLayout(org.eclipse.swt.layout.GridLayout) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) TableComboViewer(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo)

Example 3 with LanguageLabelProvider

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

the class AddTermToTBDialog method initProperty.

/**
	 * 初始化各个控件的值 ;
	 */
public void initProperty() {
    if (srcText != null && !srcText.equals("")) {
        txtSrc.setText(srcText);
        txtSrc.setSelection(0, srcText.length());
        txtSrc.setFocus();
    }
    if (tgtText != null && !tgtText.equals("")) {
        txtTgt.setText(tgtText);
        txtTgt.setSelection(0, tgtText.length());
        txtTgt.setFocus();
    }
    if (getPropertyValue() != null) {
        txtProperty.setText(getPropertyValue());
    }
    ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(project);
    List<Language> rsLstSrcLangs = new ArrayList<Language>();
    List<Language> rsLstTgtLangs = null;
    try {
        rsLstSrcLangs.add(projectConfig.getSourceLanguage());
        rsLstTgtLangs = projectConfig.getTargetlanguages();
    } catch (XPathParseException e) {
        LOGGER.error(Messages.getString("dialog.AddTermToTBDialog.logger"), e);
    } catch (NavException e) {
        LOGGER.error(Messages.getString("dialog.AddTermToTBDialog.logger"), e);
    } catch (XPathEvalException e) {
        LOGGER.error(Messages.getString("dialog.AddTermToTBDialog.logger"), e);
    }
    ArrayList<String> lstTgtLangs = new ArrayList<String>();
    if (rsLstTgtLangs != null) {
        for (Language lang : rsLstTgtLangs) {
            lstTgtLangs.add(lang.getCode());
        }
    }
    cmbSrcLang.setLabelProvider(new LanguageLabelProvider());
    cmbSrcLang.setInput(rsLstSrcLangs);
    cmbSrcLang.getTableCombo().select(0);
    cmbTgtLang.setLabelProvider(new LanguageLabelProvider());
    cmbTgtLang.setInput(rsLstTgtLangs);
    if (tgtLang != null) {
        cmbTgtLang.getTableCombo().select(lstTgtLangs.indexOf(tgtLang));
    }
}
Also used : XPathParseException(com.ximpleware.XPathParseException) Language(net.heartsome.cat.common.locale.Language) ProjectConfiger(net.heartsome.cat.ts.core.file.ProjectConfiger) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) ArrayList(java.util.ArrayList) NavException(com.ximpleware.NavException) XPathEvalException(com.ximpleware.XPathEvalException)

Example 4 with LanguageLabelProvider

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

the class NewProjectWizardLanguagePage method createControl.

/**
	 * Create contents of the wizard.
	 * @param parent
	 */
public void createControl(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("wizard.NewProjectWizardLanguagePage.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.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            srcLanguage = (Language) selection.getFirstElement();
            validator.update();
        }
    });
    // initialization remember value
    String rmSrcLangCode = ps.getString(IPreferenceConstants.NEW_PROJECT_SRC_LANG);
    if (rmSrcLangCode != null && !rmSrcLangCode.equals("")) {
        for (Language srcLang : languages) {
            if (srcLang.getCode().equals(rmSrcLangCode)) {
                srcLangComboViewer.setSelection(new StructuredSelection(srcLang));
                break;
            }
        }
    }
    // 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("wizard.NewProjectWizardLanguagePage.targetLanguageGrp"));
    targetLangControl.createControl(targetLanguageGrp);
    // end Target language
    setControl(container);
    validator.update();
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableComboViewer(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Language(net.heartsome.cat.common.locale.Language) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo)

Example 5 with LanguageLabelProvider

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

the class ConversionWizardPage method createConversionOptionsGroup.

/**
	 * 转换选项组
	 * @param contents
	 *            ;
	 */
private void createConversionOptionsGroup(Composite contents) {
    Group options = new Group(contents, SWT.NONE);
    //$NON-NLS-1$
    options.setText(Messages.getString("wizard.ConversionWizardPage.options"));
    options.setLayout(new GridLayout(1, false));
    options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    /* 如果已经存在,是否要替换 */
    final Button btnReplaceTarget = new Button(options, SWT.CHECK);
    //$NON-NLS-1$
    btnReplaceTarget.setText(Messages.getString("wizard.ConversionWizardPage.btnReplaceTarget"));
    btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnReplaceTarget.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            isReplaceTarget = btnReplaceTarget.getSelection();
            for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
                conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection());
            }
            validate();
        }
    });
    final Button btnOpenPreTrans = new Button(options, SWT.CHECK);
    btnOpenPreTrans.setText(Messages.getString("wizard.ConversionWizardPage.btnOpenPreTrans"));
    btnOpenPreTrans.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnOpenPreTrans.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            isOpenPreTrans = btnOpenPreTrans.getSelection();
        }
    });
    Composite composite = new Composite(options, SWT.NONE);
    GridLayout gd = new GridLayout(1, false);
    gd.marginWidth = 0;
    gd.marginHeight = 0;
    composite.setLayout(gd);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    Label tgtLangLbl = new Label(composite, SWT.NONE);
    tgtLangLbl.setText(Messages.getString("wizard.ConversionWizardPage.tgtLangLbl"));
    tgtLangViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    Table tgtLangTable = tgtLangViewer.getTable();
    GridData gdTgtLangTable = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gdTgtLangTable.heightHint = 80;
    tgtLangTable.setLayoutData(gdTgtLangTable);
    tgtLangViewer.setLabelProvider(new LanguageLabelProvider());
    tgtLangViewer.setContentProvider(new ArrayContentProvider());
    tgtLangViewer.setInput(conversionConfigBeans.get(0).getTgtLangList());
    tgtLangViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            @SuppressWarnings("unchecked") List<Language> selectedList = sel.toList();
            for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
                conversionConfigBean.setHasSelTgtLangList(selectedList);
            }
            validate();
        }
    });
    tgtLangViewer.getTable().select(0);
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
    btnReplaceTarget.setSelection(dialogSettings.getBoolean(REPLACE_TARGET));
    btnOpenPreTrans.setSelection(dialogSettings.getBoolean(OPEN_PRE_TRANS));
    this.isOpenPreTrans = btnOpenPreTrans.getSelection();
    isReplaceTarget = btnReplaceTarget.getSelection();
    for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
        conversionConfigBean.setReplaceTarget(isReplaceTarget);
    }
    validate();
}
Also used : Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ConversionConfigBean(net.heartsome.cat.convert.ui.model.ConversionConfigBean) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) WritableList(org.eclipse.core.databinding.observable.list.WritableList) List(java.util.List) ArrayList(java.util.ArrayList) TableViewer(org.eclipse.jface.viewers.TableViewer)

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