Search in sources :

Example 21 with HsImageLabel

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;
}
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 22 with HsImageLabel

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 23 with HsImageLabel

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 24 with HsImageLabel

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;
}
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 25 with HsImageLabel

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;
}
Also used : HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel)

Aggregations

HsImageLabel (net.heartsome.cat.common.ui.HsImageLabel)28 GridData (org.eclipse.swt.layout.GridData)27 GridLayout (org.eclipse.swt.layout.GridLayout)27 Composite (org.eclipse.swt.widgets.Composite)27 Group (org.eclipse.swt.widgets.Group)24 Button (org.eclipse.swt.widgets.Button)23 Label (org.eclipse.swt.widgets.Label)13 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 Text (org.eclipse.swt.widgets.Text)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 SelectionListener (org.eclipse.swt.events.SelectionListener)5 Link (org.eclipse.swt.widgets.Link)4 Point (org.eclipse.swt.graphics.Point)3 Spinner (org.eclipse.swt.widgets.Spinner)3 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 ComboViewer (org.eclipse.jface.viewers.ComboViewer)2 TableComboViewer (org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 Table (org.eclipse.swt.widgets.Table)2