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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations