java类org.eclipse.swt.widgets.ToolBar的实例源码

OpenGLToolbarMenu.java 文件源码 项目:gama 阅读 20 收藏 0 点赞 0 评论 0
/**
 * @param tb
 * @param view
 */
public void createItem(final GamaToolbar2 tb, final OpenGLDisplayView view) {

    tb.menu("display.presentation2", "Presentation", "OpenGL options", trigger -> {
        final boolean asMenu = trigger.detail == SWT.ARROW;
        if (!asMenu) { return; }
        final ToolItem target = (ToolItem) trigger.widget;
        final ToolBar toolBar = target.getParent();
        if (menu != null) {
            menu.dispose();
        }
        menu = new Menu(toolBar.getShell(), SWT.POP_UP);
        fillMenu(menu, view);
        final Point point = toolBar.toDisplay(new Point(trigger.x, trigger.y));
        menu.setLocation(point.x, point.y);
        menu.setVisible(true);

    }, SWT.LEFT);

}
WebBrowserViewer4Mac.java 文件源码 项目:APICloud-Studio 阅读 24 收藏 0 点赞 0 评论 0
private void createNavigationBar(Composite parent) {
    toolBarManager = new ToolBarManager(SWT.FLAT);
    // toolBarManager.add(consoleAction);
    toolBarManager.add(backAction);
    toolBarManager.add(forwardAction);
    toolBarManager.add(stopAction);
    toolBarManager.add(refreshAction);
    ToolBar toolbar = toolBarManager.createControl(parent);
    toolbar.setLayoutData(GridDataFactory.fillDefaults().create());

    urlCombo = new Combo(parent, SWT.DROP_DOWN);
    urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
            .create());

    urlCombo.addListener(SWT.DefaultSelection, new Listener() {
        public void handleEvent(Event e) {
            setURL(urlCombo.getText());
        }
    });

    ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT);
    toolBarManager2.add(goAction);
    toolbar = toolBarManager2.createControl(parent);
    toolbar.setLayoutData(GridDataFactory.fillDefaults().create());
}
PortMonitor.java 文件源码 项目:ecle 阅读 22 收藏 0 点赞 0 评论 0
public void createUI(Composite parent) {
    ToolBar tbMonitor = new ToolBar(parent, SWT.FLAT | SWT.RIGHT | SWT.VERTICAL);
    tbMonitor.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));

    fClearOnStart = createButton(tbMonitor, Action.CLEARONSTART, "Clear on session start (port opened or RTS pin twitched)", "terminal-clear");
    createButton(tbMonitor, Action.CLEAR, "Clear", "eraser");

    // ToolItem save = createButton(tbMonitor, Action.SAVE,
    // "Save content to file...", "disk");
    // save.setEnabled(false);

    createButton(tbMonitor, Action.HOME, "Scroll to home", "atop");
    ToolItem se = createButton(tbMonitor, Action.END, "Scroll to end", "abottom");

    eMonitor = new StyledText(parent, SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    eMonitor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    eMonitor.setRightMargin(3);
    eMonitor.setBottomMargin(3);
    eMonitor.setTopMargin(3);
    eMonitor.setLeftMargin(3);
    eMonitor.setText("Embed plugin serial terminal\r\n");

    se.setSelection(true);
    doMonitorAction(Action.END, true);
}
PortMonitor.java 文件源码 项目:ecle 阅读 20 收藏 0 点赞 0 评论 0
private ToolItem createButton(ToolBar tb, final Action action, String tip, String ico) {
    int style = SWT.NONE;

    switch (action) {
    case CLEARONSTART:
    case END:
        style = SWT.CHECK;
        break;
    }

    final ToolItem tbItem = new ToolItem(tb, style);

    tbItem.setToolTipText(tip);
    tbItem.setImage(Icons.ico(ico));
    tbItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            doMonitorAction(action, tbItem.getSelection());
        }
    });

    return tbItem;
}
DashboardComposite.java 文件源码 项目:n4js 阅读 112 收藏 0 点赞 0 评论 0
private void createToolbarActions(ToolBar bar) {
    createAction(bar, SWT.PUSH,
            "Snapshot",
            "Take a data snapshot.",
            Activator.getInstance().ICON_SNAPSHOT,
            this::takeSnapshot);
    createAction(bar, SWT.PUSH,
            "Delete",
            "Delete selected snapshots from history.",
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE),
            this::deleteCurrentSelection);
}
UiAutomatorViewer.java 文件源码 项目:android-uiautomatorviewer 阅读 24 收藏 0 点赞 0 评论 0
@Override
protected Control createContents(Composite parent) {
  Composite c = new Composite(parent, SWT.BORDER);

  GridLayout gridLayout = new GridLayout(1, false);
  gridLayout.marginWidth = 0;
  gridLayout.marginHeight = 0;
  gridLayout.horizontalSpacing = 0;
  gridLayout.verticalSpacing = 0;
  c.setLayout(gridLayout);

  GridData gd = new GridData(GridData.FILL_HORIZONTAL);
  c.setLayoutData(gd);

  ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
  toolBarManager.add(new OpenFilesAction(this));
  toolBarManager.add(new ScreenshotAction(this, false));
  toolBarManager.add(new ScreenshotAction(this, true));
  toolBarManager.add(new SaveScreenShotAction(this));
  ToolBar tb = toolBarManager.createControl(c);
  tb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  mUiAutomatorView = new UiAutomatorView(c, SWT.BORDER);
  mUiAutomatorView.setLayoutData(new GridData(GridData.FILL_BOTH));

  return parent;
}
BarManager.java 文件源码 项目:pmTrans 阅读 23 收藏 0 点赞 0 评论 0
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
        int type) {
    ToolItem cit = new ToolItem(bar, type);
    if (text != null)
        cit.setText(text);
    if (toolTip != null)
        cit.setToolTipText(toolTip);

    return cit;
}
BarManager.java 文件源码 项目:pmTrans 阅读 21 收藏 0 点赞 0 评论 0
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
        int type, Listener listener, Image icon) {
    ToolItem item = addItemToToolBar(bar, text, toolTip, type);

    if (listener != null)
        item.addListener(SWT.Selection, listener);
    if (icon != null)
        item.setImage(icon);

    return item;
}
BarManager.java 文件源码 项目:pmTrans 阅读 24 收藏 0 点赞 0 评论 0
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
        int type, SelectionAdapter listener, Image icon) {
    ToolItem item = addItemToToolBar(bar, text, toolTip, type);

    if (listener != null)
        item.addSelectionListener(listener);
    if (icon != null)
        item.setImage(icon);

    return item;
}
FileViewerWindow.java 文件源码 项目:AppleCommander 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Creates the toolbar.
 */
private void createToolBar(Composite composite, Object layoutData) {
    toolBar = new ToolBar(composite, SWT.FLAT);
    toolBar.addListener(SWT.KeyUp, createToolbarCommandHandler());
    if (layoutData != null) toolBar.setLayoutData(layoutData);

    if (nativeFilter != null) {
        nativeFilterAdapter = (FilterAdapter) nativeFilterAdapterMap.get(nativeFilter.getClass());
        if (nativeFilterAdapter != null) {
            nativeToolItem = nativeFilterAdapter.create(toolBar);
            nativeToolItem.setSelection(true);
        } 
    }
    hexDumpToolItem = createHexDumpToolItem();
    if (nativeFilterAdapter == null) {
        // Default button changes for these instances.
        hexDumpToolItem.setSelection(true);
        // Prevent NullPointerExceptions if the nativeFilterAdapter does not apply.
        nativeFilterAdapter = hexFilterAdapter;
    }
    rawDumpToolItem = createRawDumpToolItem();
    new ToolItem(toolBar, SWT.SEPARATOR);
    copyToolItem = createCopyToolItem();
    new ToolItem(toolBar, SWT.SEPARATOR);
    createPrintToolItem();
    toolBar.pack();
}


问题


面经


文章

微信
公众号

扫码关注公众号