Search in sources :

Example 1 with HsImageLabel

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

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

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

Example 4 with HsImageLabel

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

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

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