Search in sources :

Example 6 with ToolBar

use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.

the class PreMachineTranslationDialog method createHelpControl.

// TODO :帮助按钮URL需要修改
/**
	 * 添加帮助按钮 robert 2012-09-06
	 */
@Override
protected Control createHelpControl(Composite parent) {
    // ROBERTHELP 预翻译
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html?#prestore-mt", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 7 with ToolBar

use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.

the class SrxConfigurationDialog method createHelpToolItem.

/**
	 * 添加帮助按钮,备注,这里的配置与其他的不一样
	 * robert	2012-09-06
	 */
protected Control createHelpToolItem(Composite parent) {
    // ROBERTHELP 分段规则管理器
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03#segmentation-rule-manager", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 8 with ToolBar

use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.

the class XmlConverterConfigurationDialog method createHelpToolItem.

/**
	 * 添加帮助按钮,备注,这里的配置与其他的不一样
	 * robert	2012-09-06
	 */
protected Control createHelpToolItem(Composite parent) {
    // ROBERTHELP xml 转换器配置
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch08.html#configure-xml-converter", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 9 with ToolBar

use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.

the class RTFCleanerDialog method createToolBar.

/**
	 * 创建工具栏
	 * @param parent
	 *            父控件
	 */
private void createToolBar(Composite parent) {
    ToolBar toolBar = new ToolBar(parent, SWT.NO_FOCUS | SWT.None);
    toolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ToolItem addStyleItem = new ToolItem(toolBar, SWT.PUSH);
    addStyleItem.setToolTipText(Messages.getString("dialog.RTFCleanerDialog.addStyleItem"));
    addStyleItem.setImage(new Image(Display.getDefault(), PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH)));
    addStyleItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            handleFile();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) ToolItem(org.eclipse.swt.widgets.ToolItem) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 10 with ToolBar

use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.

the class JavaPropertiesViewerDialog method createToolBar.

private void createToolBar(Composite tparent) {
    Composite toolBarCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(toolBarCmp);
    GridLayoutFactory.fillDefaults().numColumns(1).applyTo(toolBarCmp);
    ToolBar toolBar = new ToolBar(toolBarCmp, SWT.NO_FOCUS | SWT.FLAT);
    ToolItem openItem = new ToolItem(toolBar, SWT.PUSH);
    openItem.setToolTipText(Messages.getString("dialog.JavaPropertiesViewerDialog.toolBar"));
    openItem.setImage(new Image(Display.getDefault(), openFilePath));
    openItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            openFile();
        }
    });
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

ToolBar (org.eclipse.swt.widgets.ToolBar)92 ToolItem (org.eclipse.swt.widgets.ToolItem)85 SelectionEvent (org.eclipse.swt.events.SelectionEvent)76 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)68 GridData (org.eclipse.swt.layout.GridData)63 GridLayout (org.eclipse.swt.layout.GridLayout)50 Composite (org.eclipse.swt.widgets.Composite)48 Image (org.eclipse.swt.graphics.Image)27 DisposeEvent (org.eclipse.swt.events.DisposeEvent)26 DisposeListener (org.eclipse.swt.events.DisposeListener)26 Cursor (org.eclipse.swt.graphics.Cursor)22 Label (org.eclipse.swt.widgets.Label)22 TableViewer (org.eclipse.jface.viewers.TableViewer)18 SashForm (org.eclipse.swt.custom.SashForm)11 SelectionListener (org.eclipse.swt.events.SelectionListener)10 FillLayout (org.eclipse.swt.layout.FillLayout)10 ArrayList (java.util.ArrayList)9 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)9 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)9 KeyAdapter (org.eclipse.swt.events.KeyAdapter)9