Examples of Menu


Examples of org.eclipse.swt.widgets.Menu

          }
        });
      }
    });

    Menu menu = manager.createContextMenu(fBrowser);
    fBrowser.setMenu(menu);
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

      public void run() {
        onNewFolder();
      }
    });

    Menu menu = menuManager.createContextMenu(fFolderViewer.getTree());
    fFolderViewer.getTree().setMenu(menu);

    /* Register Model Listeners */
    registerListeners();
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

    addButton.setImage(fAddIcon);
    addButton.setDisabledImage(fAddDisabledIcon);
    addButton.setToolTipText(Messages.SearchConditionList_ADD_CONDITION);

    /* Add Menu */
    final Menu conditionMenu = new Menu(buttonBar);
    createConditionMenu(conditionMenu, item);
    addButton.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        if (event.detail == SWT.ARROW) {
          Rectangle rect = item.getBounds();
          Point pt = new Point(rect.x, rect.y + rect.height);
          pt = buttonBar.toDisplay(pt);
          conditionMenu.setLocation(pt.x, pt.y);
          conditionMenu.setVisible(true);
        } else
          onAdd(item);
      }
    });

    buttonBar.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        conditionMenu.dispose();
      }
    });

    /* Button to delete Condition */
    ToolItem deleteButton = new ToolItem(buttonBar, SWT.PUSH);
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

      case NEXT: {
        return new ContextMenuCreator() {

          @Override
          public Menu createMenu(Control parent) {
            Menu menu = new Menu(parent);
            NavigationActionType defaultAction = NavigationActionType.values()[fPreferences.getInteger(DefaultPreferences.DEFAULT_NEXT_ACTION)];

            MenuItem item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.NEXT_NEWS.getCommandId(), NavigationActionType.NEXT_NEWS.getName()));
            item.setData(NavigationActionType.NEXT_NEWS);
            item.addSelectionListener(new NavigationSelectionListener(true));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.NEXT_UNREAD_NEWS.getCommandId(), NavigationActionType.NEXT_UNREAD_NEWS.getName()));
            item.setData(NavigationActionType.NEXT_UNREAD_NEWS);
            item.addSelectionListener(new NavigationSelectionListener(true));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            new MenuItem(menu, SWT.SEPARATOR);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.NEXT_FEED.getCommandId(), NavigationActionType.NEXT_FEED.getName()));
            item.setData(NavigationActionType.NEXT_FEED);
            item.addSelectionListener(new NavigationSelectionListener(true));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.NEXT_UNREAD_FEED.getCommandId(), NavigationActionType.NEXT_UNREAD_FEED.getName()));
            item.setData(NavigationActionType.NEXT_UNREAD_FEED);
            item.addSelectionListener(new NavigationSelectionListener(true));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            new MenuItem(menu, SWT.SEPARATOR);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.NEXT_TAB.getCommandId(), NavigationActionType.NEXT_TAB.getName()));
            item.setData(NavigationActionType.NEXT_TAB);
            item.addSelectionListener(new NavigationSelectionListener(true));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            return menu;
          }
        };
      }

        /* Previous News | Previous Unread News || Previous Feed | Previous Unread Feed || Previous Tab */
      case PREVIOUS: {
        return new ContextMenuCreator() {

          @Override
          public Menu createMenu(Control parent) {
            Menu menu = new Menu(parent);
            NavigationActionType defaultAction = NavigationActionType.values()[fPreferences.getInteger(DefaultPreferences.DEFAULT_PREVIOUS_ACTION)];

            MenuItem item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_NEWS.getCommandId(), NavigationActionType.PREVIOUS_NEWS.getName()));
            item.setData(NavigationActionType.PREVIOUS_NEWS);
            item.addSelectionListener(new NavigationSelectionListener(false));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_UNREAD_NEWS.getCommandId(), NavigationActionType.PREVIOUS_UNREAD_NEWS.getName()));
            item.setData(NavigationActionType.PREVIOUS_UNREAD_NEWS);
            item.addSelectionListener(new NavigationSelectionListener(false));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            new MenuItem(menu, SWT.SEPARATOR);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_FEED.getCommandId(), NavigationActionType.PREVIOUS_FEED.getName()));
            item.setData(NavigationActionType.PREVIOUS_FEED);
            item.addSelectionListener(new NavigationSelectionListener(false));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_UNREAD_FEED.getCommandId(), NavigationActionType.PREVIOUS_UNREAD_FEED.getName()));
            item.setData(NavigationActionType.PREVIOUS_UNREAD_FEED);
            item.addSelectionListener(new NavigationSelectionListener(false));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            new MenuItem(menu, SWT.SEPARATOR);

            item = new MenuItem(menu, SWT.RADIO);
            item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_TAB.getCommandId(), NavigationActionType.PREVIOUS_TAB.getName()));
            item.setData(NavigationActionType.PREVIOUS_TAB);
            item.addSelectionListener(new NavigationSelectionListener(false));
            if (item.getData().equals(defaultAction))
              item.setSelection(true);

            return menu;
          }
        };
      }

        /* History */
      case HISTORY:
        return new ContextMenuCreator() {

          @Override
          public Menu createMenu(Control parent) {
            Menu menu = new Menu(parent);
            ContributionItemFactory.REOPEN_EDITORS.create(fWindow).fill(menu, 0);
            MenuItem[] items = menu.getItems();
            if (items.length > 0 && (items[0].getStyle() & SWT.SEPARATOR) != 0)
              items[0].dispose();
            return menu;
          }
        };
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

    }

    MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
    mItem.setText(Messages.SearchConditionList_DATE);

    Menu dateMenu = new Menu(mItem);
    mItem.setMenu(dateMenu);

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.AGE_IN_DAYS)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_AGE);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.AGE_IN_DAYS, news));

      new MenuItem(dateMenu, SWT.SEPARATOR);
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.MODIFIED_DATE)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DATE_MODIFIED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.MODIFIED_DATE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.PUBLISH_DATE)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DATE_PUBLISHED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.PUBLISH_DATE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.RECEIVE_DATE)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DATE_RECEIVED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.RECEIVE_DATE, news));
    }

    mItem = new MenuItem(menu, SWT.SEPARATOR);

    mItem = new MenuItem(menu, SWT.CASCADE);
    mItem.setText(Messages.SearchConditionList_OTHER);

    Menu otherMenu = new Menu(mItem);
    mItem.setMenu(otherMenu);

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.HAS_ATTACHMENTS)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_HAS_ATTACHMENTS);
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

    Composite buttonContainer = new Composite(this, SWT.None);
    buttonContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    buttonContainer.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    /* Add */
    final Menu menu = new Menu(getShell(), SWT.POP_UP);
    menu.addMenuListener(new MenuListener() {
      public void menuShown(MenuEvent e) {
        MenuItem[] items = menu.getItems();
        for (MenuItem item : items) {
          item.dispose();
        }

        NewsColumn[] newsColumns = NewsColumn.values();
        for (final NewsColumn column : newsColumns) {
          if (column.isSelectable() && !fModel.contains(column)) {
            MenuItem item = new MenuItem(menu, SWT.PUSH);
            item.setText(column.getName());
            item.addSelectionListener(new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                fModel.addColumn(column);
                fNewsColumnViewer.add(column);
                updateRemoveEnablement();
                fNewsColumnViewer.setSelection(new StructuredSelection(column));
              }
            });
          }
        }
      }

      public void menuHidden(MenuEvent e) {}
    });

    final Button addButton = new Button(buttonContainer, SWT.DOWN);
    setButtonLayoutData(addButton);
    addButton.setText(Messages.NewsColumnSelectionControl_ADD);
    addButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Rectangle rect = addButton.getBounds();
        Point pt = new Point(rect.x, rect.y + rect.height);
        pt = addButton.toDisplay(pt);
        menu.setLocation(pt.x, pt.y);
        menu.setVisible(true);
      }
    });

    addButton.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        menu.dispose();
      }
    });

    /* Remove */
    fRemoveButton = new Button(buttonContainer, SWT.PUSH);
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

      }
    });
  }

  private void createColorMenu() {
    fColorMenu = new Menu(fParent.getShell(), SWT.POP_UP);

    /* Add some useful Colors */
    for (int i = 0; i < COLOR_LABELS.length; i++) {
      MenuItem item = new MenuItem(fColorMenu, SWT.RADIO);
      item.setText(COLOR_LABELS[i]);
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

  /**
   * @param action the dropdown action.
   * @param manager the toolbar containing the action.
   */
  public static void positionDropDownMenu(Action action, ToolBarManager manager) {
    Menu menu = action.getMenuCreator().getMenu(manager.getControl());
    if (menu != null) {

      /* Adjust Location */
      IContributionItem contributionItem = manager.find(action.getId());
      if (contributionItem != null && contributionItem instanceof ActionContributionItem) {
        Widget widget = ((ActionContributionItem) contributionItem).getWidget();
        if (widget != null && widget instanceof ToolItem) {
          ToolItem item = (ToolItem) widget;
          Rectangle rect = item.getBounds();
          Point pt = new Point(rect.x, rect.y + rect.height);
          pt = manager.getControl().toDisplay(pt);
          if (Application.IS_MAC)
            pt.y += 5;
          menu.setLocation(pt.x, pt.y);
        }
      }

      /* Set Visible */
      menu.setVisible(true);
    }
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

   */
  public Menu getMenu(Control parent) {
    if (fMenu != null)
      fMenu.dispose();

    fMenu = new Menu(parent);

    MenuItem newBookMark = new MenuItem(fMenu, SWT.PUSH);
    newBookMark.setText(getLabelWithBinding("org.rssowl.ui.actions.NewBookMark", Messages.NewTypeDropdownAction_BOOKMARK)); //$NON-NLS-1$
    newBookMark.setImage(OwlUI.getImage(fResources, OwlUI.BOOKMARK));
    newBookMark.addSelectionListener(new SelectionAdapter() {
View Full Code Here

Examples of org.eclipse.swt.widgets.Menu

        }
      }
    });

    /* Create and Register with Workbench */
    Menu menu = manager.createContextMenu(fViewer.getControl());
    fViewer.getControl().setMenu(menu);
    fEditorSite.registerContextMenu(manager, fViewer);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.