use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class MachineTranslationPreferencePage method createGoogleTranslateArea.
private Composite createGoogleTranslateArea(Composite tparent) {
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));
googleStateLabel = new Label(com, SWT.NONE);
googleStateLabel.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;
}
googleValidator();
setComponentsState();
if (!googleState) {
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();
return tparent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class MachineTranslationPreferencePage method createTranslateSettingArea.
private Composite createTranslateSettingArea(Composite tparent) {
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.machinetranslattionPage.accessMachineServer"));
HsImageLabel accessibility = new HsImageLabel(Messages.getString("preference.machinetranslattionPage.accessMachineServer.msg"), Activator.getImageDescriptor("images/trans_google_set_32.png"));
Composite accessibilityComp = accessibility.createControl(apiAccessibilityGroup);
accessibilityComp.setLayout(new GridLayout());
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();
return tparent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class FrameMakerPreferencePage 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.FrameMakerPreferencePage.groupCommon"));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preference.FrameMakerPreferencePage.imageLabel"), Activator.getImageDescriptor(Constants.PREFERENCE_FRAMEMAKER_32));
Composite cmpCommon = imageLabel.createControl(groupCommon);
cmpCommon.setLayout(new GridLayout());
cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnMaster = new Button(cmpCommon, SWT.CHECK);
btnMaster.setText(Messages.getString("preference.FrameMakerPreferencePage.btnMaster"));
GridDataFactory.fillDefaults().applyTo(btnMaster);
imageLabel.computeSize();
btnMaster.setSelection(preferenceStore.getBoolean(Constants.FRAMEMAKER_FILTER));
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class BingPreferencePage 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.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));
stateLabel = new Label(com, SWT.NONE);
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;
}
validator();
enableComponent(state);
if (!state) {
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();
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.BingPreferencePage.apiAccessibilityGroup"));
HsImageLabel accessibility = new HsImageLabel(Messages.getString("preference.BingPreferencePage.accessibility"), Activator.getImageDescriptor("images/trans_bing_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.BingPreferencePage.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.BingPreferencePage.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.BingPreferencePage.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.BingPreferencePage.preTransGroup"));
HsImageLabel preTrans = new HsImageLabel(Messages.getString("preference.BingPreferencePage.preTrans"), Activator.getImageDescriptor("images/trans_bing_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.BingPreferencePage.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 WebSearchPreferencePage method createTitleArea.
private Composite createTitleArea(Composite parent) {
HsImageLabel paraConsisLbl = new HsImageLabel(Messages.getString("Websearch.WebSearcPreferencePage.setInfo"), Activator.getImageDescriptor("image/websearch32.png"));
paraConsisLbl.createControl(parent);
paraConsisLbl.computeSize();
return parent;
}
Aggregations