Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ToolBar


  public WebBrowser(Composite parent) {
    initResources();
    final Display display = parent.getDisplay();
    FormLayout layout = new FormLayout();
    parent.setLayout(layout);
    ToolBar toolbar = new ToolBar(parent, SWT.NONE);
    final ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
    itemBack.setText(getResourceString("Back"));
    final ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
    itemForward.setText(getResourceString("Forward"));
    final ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
    itemStop.setText(getResourceString("Stop"));
    final ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
    itemRefresh.setText(getResourceString("Refresh"));
    final ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
    itemGo.setText(getResourceString("Go"));
    location = new Text(parent, SWT.BORDER);
    final Canvas canvas = new Canvas(parent, SWT.NO_BACKGROUND);
    final Rectangle rect = images[0].getBounds();
    canvas.addListener(SWT.Paint, new Listener() {
      public void handleEvent(Event e) {
        Point pt = canvas.getSize();
        e.gc.drawImage(images[index], 0, 0, rect.width, rect.height, 0, 0,
            pt.x, pt.y);
      }
    });
    canvas.addListener(SWT.MouseDown, new Listener() {
      public void handleEvent(Event e) {
        browser.setUrl(getResourceString("Startup"));
      }
    });
    display.asyncExec(new Runnable() {
      public void run() {
        if (canvas.isDisposed())
          return;
        if (busy) {
          index++;
          if (index == images.length)
            index = 0;
          canvas.redraw();
        }
        display.timerExec(150, this);
      }
    });
    final Label status = new Label(parent, SWT.NONE);
    final ProgressBar progressBar = new ProgressBar(parent, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 5);
    toolbar.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(canvas, 5, SWT.DEFAULT);
    data.bottom = new FormAttachment(status, -5, SWT.DEFAULT);
View Full Code Here


    Table table = new Table(tableArea, SWT.BORDER | SWT.SINGLE | SWT.CHECK);

    GridDataFactory.fillDefaults().grab(true, true).applyTo(table);

    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar bar = toolBarManager.createControl(toolBarArea);
    GridDataFactory.fillDefaults().align(SWT.END, SWT.BEGINNING).grab(true, false).applyTo(bar);

    servicesViewer = new CheckboxTableViewer(table);

    servicesViewer.setContentProvider(new TreeContentProvider());
View Full Code Here

  }

  protected ToolBarManager createToolBarManager(Composite parent) {
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolBar = toolBarManager.createControl(parent);

    // Adapt it to a form if a form tool kit is specified
    adaptControl(toolBar);

    GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.BEGINNING).applyTo(toolBar);
View Full Code Here

    addScriptFolderDnD();

    addScriptPopupMenu();

    // toolbar below the script window
    wScriptToolBar = new ToolBar(wTopRight, SWT.FLAT | SWT.RIGHT);
    props.setLook(wScriptToolBar);

    itemSettings = new ToolItem(wScriptToolBar, SWT.NONE);
    itemSettings.setImage(scriptImage);
    itemSettings.setText(BaseMessages.getString(PKG, "RubyStepDialog.AdvancedSettings.Label")); //$NON-NLS-1$
View Full Code Here

                lblRoot.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1,
                        1));
                lblRoot.setText("<no function>");
            }
            {
                final ToolBar toolBar = new ToolBar(composite, SWT.FLAT);
                toolBar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1,
                        1));
                {
                    final ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE);
                    tltmRefresh.addSelectionListener(new SelectionAdapter() {
                        @Override
View Full Code Here

    /*
     * Creates a button with a help image. This is only used if there
     * is an image available.
     */
  private ToolBar createHelpImageButton(Composite parent, Image image) {
        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();
      }
    });   
        fHelpButton = new ToolItem(toolBar, SWT.CHECK);
View Full Code Here

   * @param parent
   *            The parent composite.
   */
  private void createDialogMenu(Composite parent) {

    toolBar = new ToolBar(parent, SWT.FLAT);
    ToolItem viewMenuButton = new ToolItem(toolBar, SWT.PUSH, 0);

    GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(
        toolBar);
    viewMenuButton.setImage(JFaceResources.getImage(POPUP_IMG_MENU));
View Full Code Here

    });
   
    fProgressIsVisible = false;
    fCancelEnabled = false;

    fToolBar = new ToolBar(this, SWT.FLAT);
    fCancelButton = new ToolItem(fToolBar, SWT.PUSH);
    fCancelButton.setImage(fgStopImage.createImage());
    fCancelButton.setToolTipText(JFaceResources
        .getString("Cancel_Current_Operation")); //$NON-NLS-1$
    fCancelButton.addSelectionListener(new SelectionAdapter() {
View Full Code Here

        Control control = item.getControl();
        if ((control instanceof ToolBar) == false) {
            return;
        }
        CoolBar coolBar = item.getParent();
        ToolBar toolBar = (ToolBar) control;
        Rectangle toolBarBounds = toolBar.getBounds();
        ToolItem[] items = toolBar.getItems();
        ArrayList hidden = new ArrayList();
        for (int i = 0; i < items.length; ++i) {
            Rectangle itemBounds = items[i].getBounds();
            if (!((itemBounds.x + itemBounds.width <= toolBarBounds.width) && (itemBounds.y
                    + itemBounds.height <= toolBarBounds.height))) {
View Full Code Here

     *
     * @param event
     *            the event object
     */
    private void handleContextMenu(Event event) {
        ToolBar toolBar = toolBarManager.getControl();
        // If parent has a menu then use that one
        Menu parentMenu = toolBar.getParent().getMenu();
        if ((parentMenu != null) && (!parentMenu.isDisposed())) {
            toolBar.setMenu(parentMenu);
            // Hook listener to remove menu once it has disapeared
            parentMenu.addListener(SWT.Hide, new Listener() {

                public void handleEvent(Event innerEvent) {
                    ToolBar innerToolBar = toolBarManager.getControl();
                    if (innerToolBar != null) {
                        innerToolBar.setMenu(null);
                        Menu innerParentMenu = innerToolBar.getParent()
                                .getMenu();
                        if (innerParentMenu != null) {
                            innerParentMenu.removeListener(SWT.Hide, this);
                        }
                    }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.ToolBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.