Search in sources :

Example 71 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class ImportProjectWizardPage2 method createBrowseBtn.

/**
	 * 创建 浏览 文件按钮
	 * @param tparent
	 */
private void createBrowseBtn(Composite tparent) {
    Composite btnCmp = new Composite(tparent, SWT.NONE);
    btnCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnCmp.setLayout(new GridLayout(3, false));
    Label lbl = new Label(btnCmp, SWT.NONE);
    lbl.setText(Messages.getString("importProjectWizardPage.selectFileLbl"));
    filePathTxt = new Text(btnCmp, SWT.BORDER);
    filePathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    browseBtn = new Button(btnCmp, SWT.NONE);
    browseBtn.setText(Messages.getString("importProjectWizardPage.broswer"));
    browseBtn.addListener(SWT.Selection, this);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 72 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class MachineTranslationPreferencePage method createBingTranslateArea.

private Composite createBingTranslateArea(Composite tparent) {
    Group apiKeySettingGroup = new Group(tparent, SWT.NONE);
    apiKeySettingGroup.setText(Messages.getString("preference.BingPreferencePage.apiKeySettingGroup"));
    apiKeySettingGroup.setLayout(new GridLayout(1, false));
    apiKeySettingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    HsImageLabel lbKeySetting = new HsImageLabel(Messages.getString("preference.BingPreferencePage.lbKeySetting"), Activator.getImageDescriptor("images/trans_bing_key_32.png"));
    Composite com = lbKeySetting.createControl(apiKeySettingGroup);
    com.setLayout(new GridLayout(3, false));
    Label lblId = new Label(com, SWT.NONE);
    lblId.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblId.setText(Messages.getString("preference.BingPreferencePage.lblId"));
    idText = new Text(com, SWT.BORDER);
    idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(com, SWT.NONE);
    Label lblApiKey = new Label(com, SWT.NONE);
    lblApiKey.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblApiKey.setText(Messages.getString("preference.BingPreferencePage.lblApiKey"));
    bingKeyText = new Text(com, SWT.BORDER);
    bingKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    bingStateLable = new Label(com, SWT.NONE);
    bingStateLable.setImage(errorImage);
    new Label(com, SWT.NONE);
    Button validateKey = new Button(com, SWT.NONE);
    validateKey.setText(Messages.getString("preference.BingPreferencePage.validateKey"));
    validateKey.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String id = idText.getText();
            String bingKey = bingKeyText.getText();
            if (id == null || id.equals("")) {
                MessageDialog.openInformation(getShell(), Messages.getString("preference.BingPreferencePage.msgTitle"), Messages.getString("preference.BingPreferencePage.msg1"));
                return;
            }
            if (bingKey == null || bingKey.equals("")) {
                MessageDialog.openInformation(getShell(), Messages.getString("preference.BingPreferencePage.msgTitle"), Messages.getString("preference.BingPreferencePage.msg2"));
                return;
            }
            bingValidator();
            setComponentsState();
            if (!bingState) {
                MessageDialog.openInformation(getShell(), Messages.getString("preference.BingPreferencePage.msgTitle"), Messages.getString("preference.BingPreferencePage.msg3"));
                return;
            }
        }
    });
    new Label(com, SWT.NONE);
    new Label(com, SWT.NONE);
    Link link = new Link(com, SWT.NONE);
    link.setText("<a>" + Messages.getString("preference.BingPreferencePage.link") + "</a>");
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Program.launch("http://msdn.microsoft.com/en-us/library/hh454950.aspx");
        }
    });
    link.setToolTipText("http://msdn.microsoft.com/en-us/library/hh454950.aspx");
    new Label(com, SWT.NONE);
    lbKeySetting.computeSize();
    return tparent;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link)

Example 73 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class AddOrEditLangRuleOfSrxDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
    Composite langCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).hint(450, 100).applyTo(langCmp);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(langCmp);
    isBreakBtn = new Button(langCmp, SWT.CHECK);
    isBreakBtn.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.isBreakBtn"));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, SWT.DEFAULT).applyTo(isBreakBtn);
    Label preLbl = new Label(langCmp, SWT.NONE);
    preLbl.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.preLbl"));
    GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    preBreakTxt = new Text(langCmp, SWT.BORDER);
    preBreakTxt.setLayoutData(textData);
    Label afterLbl = new Label(langCmp, SWT.NONE);
    afterLbl.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.afterLbl"));
    afterBreakTxt = new Text(langCmp, SWT.BORDER);
    afterBreakTxt.setLayoutData(textData);
    return tparent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 74 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class AddOrEditMapRuleOfSrxDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
    Composite langCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).hint(450, 100).applyTo(langCmp);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(langCmp);
    Label modelLbl = new Label(langCmp, SWT.NONE);
    modelLbl.setText(Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.modelLbl"));
    GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    langModelTxt = new Text(langCmp, SWT.BORDER);
    langModelTxt.setLayoutData(textData);
    Label langRuleNameLbl = new Label(langCmp, SWT.NONE);
    langRuleNameLbl.setText(Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.langRuleNameLbl"));
    langRuleNameCmb = new Combo(langCmp, SWT.BORDER | SWT.READ_ONLY);
    langRuleNameCmb.setLayoutData(textData);
    // 给语言规则名称下拉框赋值
    langRuleNameCmb.setItems(handler.getLanguageRuleNamesOfSrx_2(srxLocation).toArray(new String[] {}));
    return tparent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo)

Example 75 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class AddOrEditSrxConfigDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridDataFactory.fillDefaults().grab(true, true).hint(500, 500).minSize(500, 500).applyTo(tparent);
    Composite nameCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);
    Label nameLbl = new Label(nameCmp, SWT.NONE);
    nameLbl.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.nameLbl"));
    Text nameTxt = new Text(nameCmp, SWT.BORDER);
    nameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    nameTxt.setText(curSrxName);
    nameTxt.setEnabled(false);
    GridData groupData = new GridData(SWT.FILL, SWT.FILL, true, true);
    GridLayout groupLayout = new GridLayout(4, false);
    createLanguageGroup(tparent, groupData, groupLayout);
    createMapGroup(tparent, groupData, groupLayout);
    initListener();
    refreshLangTable(null);
    refreshMapTable(null);
    return tparent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)2054 GridData (org.eclipse.swt.layout.GridData)1441 GridLayout (org.eclipse.swt.layout.GridLayout)1419 Label (org.eclipse.swt.widgets.Label)853 Button (org.eclipse.swt.widgets.Button)694 SelectionEvent (org.eclipse.swt.events.SelectionEvent)577 Text (org.eclipse.swt.widgets.Text)519 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)463 Group (org.eclipse.swt.widgets.Group)305 Combo (org.eclipse.swt.widgets.Combo)210 Point (org.eclipse.swt.graphics.Point)198 FillLayout (org.eclipse.swt.layout.FillLayout)188 ModifyListener (org.eclipse.swt.events.ModifyListener)186 SelectionListener (org.eclipse.swt.events.SelectionListener)183 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)182 ModifyEvent (org.eclipse.swt.events.ModifyEvent)168 Table (org.eclipse.swt.widgets.Table)159 TableViewer (org.eclipse.jface.viewers.TableViewer)153 Control (org.eclipse.swt.widgets.Control)149 ArrayList (java.util.ArrayList)107