use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class TBDatabasePage method createContents.
@Override
protected Control createContents(Composite parent) {
// TODO Auto-generated method stub
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
// 添加术语匹配是否忽略大小写
{
Group commonGroup1 = new Group(tparent, SWT.NONE);
commonGroup1.setLayout(new GridLayout());
commonGroup1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
commonGroup1.setText(Messages.getString("preference.TBDatabasePage.commontitle"));
HsImageLabel imageLbale1 = new HsImageLabel(Messages.getString("preference.TBDatabasePage.commonsearchterm"), Activator.getImageDescriptor("images/preference/tb/tb_update_32.png"));
Composite comp1 = imageLbale1.createControl(commonGroup1);
btnCaseSensitive = new Button(comp1, SWT.CHECK);
btnCaseSensitive.setText(Messages.getString("preference.TBDatabasePage.commonCasesensitive"));
btnCaseSensitive.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
imageLbale1.computeSize();
}
Group commonGroup = new Group(tparent, SWT.NONE);
commonGroup.setLayout(new GridLayout());
commonGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
commonGroup.setText(Messages.getString("preference.TBDatabasePage.commonGroup"));
HsImageLabel imageLbale = new HsImageLabel(Messages.getString("preference.TBDatabasePage.imageLbale"), Activator.getImageDescriptor("images/preference/tb/tb_update_32.png"));
Composite comp = imageLbale.createControl(commonGroup);
btnAlwaysAdd = new Button(comp, SWT.RADIO);
btnAlwaysAdd.setText(Messages.getString("preference.TBDatabasePage.btnAlwaysAdd"));
btnAlwaysAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnRepeatOverwrite = new Button(comp, SWT.RADIO);
btnRepeatOverwrite.setText(Messages.getString("preference.TBDatabasePage.btnRepeatOverwrite"));
btnRepeatOverwrite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnRepeatMerge = new Button(comp, SWT.RADIO);
btnRepeatMerge.setText(Messages.getString("preference.TBDatabasePage.btnRepeatMerge"));
btnRepeatMerge.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnRepeatIgnore = new Button(comp, SWT.RADIO);
btnRepeatIgnore.setText(Messages.getString("preference.TBDatabasePage.btnRepeatIgnore"));
btnRepeatIgnore.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
parent.pack();
imageLbale.computeSize();
int intUpdateTB = preferenceStore.getInt(TBPreferenceConstants.TB_UPDATE);
setInitValues(intUpdateTB);
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class PPTXPreferencePage method createContents.
@Override
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group groupCommon = new Group(tparent, SWT.NONE);
groupCommon.setLayout(new GridLayout());
groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupCommon.setText(Messages.getString("preference.PPTXPreferencePage.groupCommon"));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preference.PPTXPreferencePage.imageLabel"), Activator.getImageDescriptor(Constants.PREFERENCE_PPTX_32));
Composite cmpCommon = imageLabel.createControl(groupCommon);
cmpCommon.setLayout(new GridLayout());
cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnNote = new Button(cmpCommon, SWT.CHECK);
btnNote.setText(Messages.getString("preference.PPTXPreferencePage.btnNote"));
GridDataFactory.fillDefaults().applyTo(btnNote);
imageLabel.computeSize();
btnNote.setSelection(preferenceStore.getBoolean(Constants.PPTX_FILTER));
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class FileTypePreferencePage method createContents.
@Override
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preference.FileTypePreferencePage.imageLabel"), null);
imageLabel.createControl(tparent);
imageLabel.computeSize();
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class GooglePreferencePage method createContents.
// private Label label;
/**
* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout(1, false));
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group apiKeySettingGroup = new Group(tparent, SWT.NONE);
apiKeySettingGroup.setText(Messages.getString("preference.GooglePreferencePage.apiKeySettingGroup"));
apiKeySettingGroup.setLayout(new GridLayout(1, false));
apiKeySettingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
HsImageLabel test = new HsImageLabel(Messages.getString("preference.GooglePreferencePage.lbKeySetting"), Activator.getImageDescriptor("images/trans_google_key_32.png"));
Composite com = test.createControl(apiKeySettingGroup);
com.setLayout(new GridLayout(3, false));
Label lblApiKey = new Label(com, SWT.NONE);
lblApiKey.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblApiKey.setText(Messages.getString("preference.GooglePreferencePage.lblApiKey"));
googleKeyText = new Text(com, SWT.BORDER);
googleKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
stateLabel = new Label(com, SWT.NONE);
stateLabel.setImage(errorImage);
new Label(com, SWT.NONE);
Button validateKey = new Button(com, SWT.NONE);
validateKey.setText(Messages.getString("preference.GooglePreferencePage.validateKey"));
validateKey.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String key = googleKeyText.getText();
if (key == null || key.equals("")) {
MessageDialog.openError(getShell(), Messages.getString("preference.GooglePreferencePage.msgTitle"), Messages.getString("preference.GooglePreferencePage.msg1"));
return;
}
validator();
enableComponent(state);
if (!state) {
MessageDialog.openError(getShell(), Messages.getString("preference.GooglePreferencePage.msgTitle"), Messages.getString("preference.GooglePreferencePage.msg2"));
return;
}
}
});
new Label(com, SWT.NONE);
new Label(com, SWT.NONE);
Link link = new Link(com, SWT.NONE);
link.setText("<a>" + Messages.getString("preference.GooglePreferencePage.link") + "</a>");
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch("http://code.google.com/apis/language/translate/v2/getting_started.html");
}
});
link.setToolTipText("http://code.google.com/apis/language/translate/v2/getting_started.html");
new Label(com, SWT.NONE);
test.computeSize();
Group apiAccessibilityGroup = new Group(tparent, SWT.NONE);
apiAccessibilityGroup.setLayout(new GridLayout(1, false));
apiAccessibilityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
apiAccessibilityGroup.setText(Messages.getString("preference.GooglePreferencePage.apiAccessibilityGroup"));
HsImageLabel accessibility = new HsImageLabel(Messages.getString("preference.GooglePreferencePage.accessibility"), Activator.getImageDescriptor("images/trans_google_set_32.png"));
Composite accessibilityComp = accessibility.createControl(apiAccessibilityGroup);
accessibilityComp.setLayout(new GridLayout());
noRepeatAccessBtn = new Button(accessibilityComp, SWT.RADIO);
noRepeatAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
noRepeatAccessBtn.setText(Messages.getString("preference.GooglePreferencePage.noRepeatAccessBtn"));
noRepeatAccessBtn.setEnabled(false);
noRepeatAccessBtn.setSelection(false);
alwaysAccessBtn = new Button(accessibilityComp, SWT.RADIO);
alwaysAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
alwaysAccessBtn.setText(Messages.getString("preference.GooglePreferencePage.alwaysAccessBtn"));
alwaysAccessBtn.setEnabled(false);
alwaysAccessBtn.setSelection(false);
manualAccessBtn = new Button(accessibilityComp, SWT.RADIO);
manualAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
manualAccessBtn.setText(Messages.getString("preference.GooglePreferencePage.neverAccessBtn"));
manualAccessBtn.setEnabled(false);
manualAccessBtn.setSelection(false);
accessibility.computeSize();
if (CommonFunction.checkEdition("U")) {
Group preTransGroup = new Group(tparent, SWT.NONE);
preTransGroup.setLayout(new GridLayout(1, false));
preTransGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
preTransGroup.setText(Messages.getString("preference.GooglePreferencePage.preTransGroup"));
HsImageLabel preTrans = new HsImageLabel(Messages.getString("preference.GooglePreferencePage.preTrans"), Activator.getImageDescriptor("images/trans_google_trans_32.png"));
Composite group = preTrans.createControl(preTransGroup);
group.setLayout(new GridLayout());
suportPreTransBtn = new Button(group, SWT.CHECK);
suportPreTransBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
suportPreTransBtn.setText(Messages.getString("preference.GooglePreferencePage.suportPreTransBtn"));
suportPreTransBtn.setEnabled(false);
suportPreTransBtn.setSelection(false);
preTrans.computeSize();
}
setValues(false);
return tparent;
}
use of net.heartsome.cat.common.ui.HsImageLabel 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;
}
Aggregations