Search in sources :

Example 61 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class BrowserEditorPart method initToolbar.

private void initToolbar(Composite parent) {
    Composite toolbarCom = new Composite(parent, SWT.None);
    toolbarCom.setLayoutData(createGridData(HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    toolbarCom.setLayout(new FillLayout());
    ToolBar toolBar = new ToolBar(toolbarCom, SWT.FLAT);
    goItem = new ToolItem(toolBar, SWT.CHECK);
    goItem.setImage(getImage("icons/browsereditor/go.gif"));
    goItem.setToolTipText(Messages.tooltipGo);
    goItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            go(location.getText());
        }
    });
    refreshItem = new ToolItem(toolBar, SWT.CHECK);
    refreshItem.setImage(getImage("icons/browsereditor/refresh.gif"));
    refreshItem.setToolTipText(Messages.tooltipRefresh);
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            browser.refresh();
        }
    });
    stopItem = new ToolItem(toolBar, SWT.CHECK);
    stopItem.setImage(getImage("icons/browsereditor/stop.gif"));
    stopItem.setToolTipText(Messages.tooltipStop);
    stopItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            browser.stop();
        }
    });
    backItem = new ToolItem(toolBar, SWT.CHECK);
    backItem.setImage(getImage("icons/browsereditor/back.gif"));
    backItem.setToolTipText(Messages.tooltipBack);
    backItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            browser.back();
        }
    });
    forwardItem = new ToolItem(toolBar, SWT.CHECK);
    forwardItem.setImage(getImage("icons/browsereditor/forward.gif"));
    forwardItem.setToolTipText(Messages.tooltipForward);
    forwardItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            browser.forward();
        }
    });
}
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) FillLayout(org.eclipse.swt.layout.FillLayout) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 62 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class ProxyAction method runWithEvent.

public void runWithEvent(Event event) {
    if (event.detail == SWT.ARROW) {
        Widget widget = event.widget;
        if (widget instanceof ToolItem) {
            ToolItem toolItem = (ToolItem) widget;
            Composite parent = toolItem.getParent();
            Rectangle rect = toolItem.getBounds();
            Point pt = new Point(rect.x, rect.y + rect.height);
            pt = parent.toDisplay(pt);
            MenuManager menuManager = new MenuManager();
            ActionManager.getInstance().setActionsMenu(menuManager);
            Menu contextMenu = menuManager.createContextMenu(parent);
            contextMenu.setLocation(pt.x, pt.y);
            contextMenu.setVisible(true);
        }
    } else {
        run();
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Widget(org.eclipse.swt.widgets.Widget) Rectangle(org.eclipse.swt.graphics.Rectangle) MenuManager(org.eclipse.jface.action.MenuManager) Point(org.eclipse.swt.graphics.Point) Menu(org.eclipse.swt.widgets.Menu) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 63 with ToolItem

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

the class ProjectSettingDialog method createHelpControl.

/**
	 * 添加帮助按钮
	 * 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#project-setting", 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 64 with ToolItem

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

the class TMXValidatorDialog method createToolBar.

private void createToolBar(Composite tparent) {
    Composite toolBarCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).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.TMXValidatorDialog.openItem"));
    openItem.setImage(new Image(Display.getDefault(), openFilePath));
    openItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            openFile();
        }
    });
    ToolItem clearCharsItem = new ToolItem(toolBar, SWT.PUSH);
    clearCharsItem.setImage(new Image(Display.getDefault(), clearCharPath));
    clearCharsItem.setToolTipText(Messages.getString("dialog.TMXValidatorDialog.clearCharsItem"));
    clearCharsItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            cleanCharacters();
        }
    });
}
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)

Example 65 with ToolItem

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

the class PluginHelpDialog method createToolBar.

/**
	 * 创建工具栏
	 * @param parent
	 *            ;
	 */
private void createToolBar(Composite parent) {
    Composite cmpToolBar = new Composite(parent, SWT.None);
    GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(1).applyTo(cmpToolBar);
    cmpToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ToolBar toolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT);
    ToolItem openItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT);
    //$NON-NLS-1$
    openItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_OPEN_FILE).createImage());
    openItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.openFileItem"));
    openItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            openFile();
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem backItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT);
    backItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_BACK).createImage());
    backItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.backItem"));
    backItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            goBack();
        }
    });
    ToolItem forwardItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT);
    forwardItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_FORWARD).createImage());
    forwardItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.forwardItem"));
    forwardItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            goForward();
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem searchItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT);
    searchItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_FIND).createImage());
    //$NON-NLS-1$
    searchItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.searchItem"));
    searchItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            searchText();
        }
    });
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

ToolItem (org.eclipse.swt.widgets.ToolItem)140 ToolBar (org.eclipse.swt.widgets.ToolBar)110 SelectionEvent (org.eclipse.swt.events.SelectionEvent)91 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)81 GridData (org.eclipse.swt.layout.GridData)73 Composite (org.eclipse.swt.widgets.Composite)64 GridLayout (org.eclipse.swt.layout.GridLayout)58 Image (org.eclipse.swt.graphics.Image)36 Label (org.eclipse.swt.widgets.Label)32 Point (org.eclipse.swt.graphics.Point)26 DisposeEvent (org.eclipse.swt.events.DisposeEvent)25 DisposeListener (org.eclipse.swt.events.DisposeListener)24 Cursor (org.eclipse.swt.graphics.Cursor)20 FillLayout (org.eclipse.swt.layout.FillLayout)18 SelectionListener (org.eclipse.swt.events.SelectionListener)17 TableViewer (org.eclipse.jface.viewers.TableViewer)16 Text (org.eclipse.swt.widgets.Text)16 Display (org.eclipse.swt.widgets.Display)15 ArrayList (java.util.ArrayList)14 List (java.util.List)14