Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.Separator


  private void createToolsMenu(IMenuManager menuBar) {
    MenuManager toolsMenu = new MenuManager("&Tools", OwlUI.M_TOOLS);
    menuBar.add(toolsMenu);

    toolsMenu.add(new GroupMarker("begin"));
    toolsMenu.add(new Separator());
    toolsMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    toolsMenu.add(new Separator());

    toolsMenu.add(getAction(ActionFactory.PREFERENCES.getId()));
  }
View Full Code Here


  private void createWindowMenu(IMenuManager menuBar) {
    MenuManager windowMenu = new MenuManager("&Window", IWorkbenchActionConstants.M_WINDOW);
    menuBar.add(windowMenu);

    windowMenu.add(getAction(ActionFactory.OPEN_NEW_WINDOW.getId()));
    windowMenu.add(new Separator());

    MenuManager showViewMenu = new MenuManager("&Show View");
    windowMenu.add(showViewMenu);
    showViewMenu.add(fShowViewMenu);
    //    windowMenu.add(new Separator());
View Full Code Here

      public ImageDescriptor getImageDescriptor() {
        return OwlUI.getImageDescriptor("icons/elcl16/help.gif");
      }
    });

    helpMenu.add(new Separator());

    /* Report Bugs */
    helpMenu.add(new Action("&Report Bugs") {
      @Override
      public void run() {
        BrowserUtils.openLink("http://dev.rssowl.org");
      }

      @Override
      public ImageDescriptor getImageDescriptor() {
        return OwlUI.getImageDescriptor("icons/elcl16/bug.gif");
      }
    });

    /* Homepage */
    helpMenu.add(new Action("&Homepage") {
      @Override
      public void run() {
        BrowserUtils.openLink("http://www.rssowl.org");
      }
    });

    /* Mailing List */
    helpMenu.add(new Action("&Mailinglist") {
      @Override
      public void run() {
        BrowserUtils.openLink("https://lists.sourceforge.net/lists/listinfo/rssowl-boreal");
      }
    });

    // helpMenu.add(getAction(ActionFactory.INTRO.getId())); TODO Enable
    helpMenu.add(new Separator());

    helpMenu.add(new Separator());
    helpMenu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
    helpMenu.add(new Separator());

    helpMenu.add(getAction(ActionFactory.ABOUT.getId()));
  }
View Full Code Here

  /**
   * @param trayItem
   */
  protected void fillTrayItem(IMenuManager trayItem) {
    trayItem.add(new ReloadAllAction());
    trayItem.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    trayItem.add(getAction(ActionFactory.QUIT.getId()));
  }
View Full Code Here

          }
        };
        manager.add(manageSets);

        /* Available Bookmark Sets */
        manager.add(new Separator());
        for (final IFolder rootFolder : fRootFolders) {
          IAction selectBookMarkSet = new Action(rootFolder.getName(), IAction.AS_RADIO_BUTTON) {
            @Override
            public void run() {
              if (!fSelectedBookMarkSet.equals(rootFolder) && isChecked())
                changeSet(rootFolder);
            }
          };
          selectBookMarkSet.setImageDescriptor(OwlUI.BOOKMARK_SET); //$NON-NLS-1$

          if (fSelectedBookMarkSet.equals(rootFolder))
            selectBookMarkSet.setChecked(true);

          manager.add(selectBookMarkSet);
        }

        /* Search Bar */
        manager.add(new Separator());
        MenuManager searchMenu = new MenuManager("Search");
        manager.add(searchMenu);

        /* Search Bar - Always Show Bar */
        IAction alwaysShow = new Action("Always Show", IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            fAlwaysShowSearch = !fAlwaysShowSearch;

            /* Only Update if the Filter is not Active */
            if (fSearchBar.getControl().getText().length() == 0)
              setSearchBarVisible(fAlwaysShowSearch);
          }
        };
        alwaysShow.setChecked(fAlwaysShowSearch);
        searchMenu.add(alwaysShow);

        /* Search Bar - Begin Search when Typing */
        IAction beginWhenTyping = new Action("Begin When Typing", IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            fBeginSearchOnTyping = !fBeginSearchOnTyping;
          }
        };
        beginWhenTyping.setChecked(fBeginSearchOnTyping);
        searchMenu.add(beginWhenTyping);

        /* Misc. Settings */
        manager.add(new Separator());
        IAction sortByName = new Action("Sort By Name", IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            fSortByName = !fSortByName;
            if (fSortByName)
              fBookMarkComparator.setType(BookMarkSorter.Type.SORT_BY_NAME);
            else
              fBookMarkComparator.setType(BookMarkSorter.Type.DEFAULT_SORTING);
            fViewer.refresh(false);

            /* Save directly to global scope */
            fGlobalPreferences.putBoolean(DefaultPreferences.BE_SORT_BY_NAME, fSortByName);
          }
        };
        sortByName.setImageDescriptor(OwlUI.getImageDescriptor("icons/elcl16/sort_alpha.gif")); //$NON-NLS-1$
        sortByName.setChecked(fSortByName);
        manager.add(sortByName);

        IAction linkFeedView = new Action("Link with Feed-View", IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            fLinkingEnabled = isChecked();

            /* Link if enabled */
            if (fLinkingEnabled) {
              IEditorPart editor = fViewSite.getPage().getActiveEditor();
              if (editor != null)
                editorActivated(editor);
            }
          }
        };
        linkFeedView.setChecked(fLinkingEnabled);
        linkFeedView.setImageDescriptor(OwlUI.getImageDescriptor("icons/etool16/synced.gif"));
        manager.add(linkFeedView);

        /* Allow Contributions */
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
      }
    });

    /* Dummy Entry to show Menu in View */
    menuManager.add(new Action("") {}); //$NON-NLS-1$
View Full Code Here

    });

    fToolBarManager.add(bookmarkFilter);

    /* Bookmark Group */
    fToolBarManager.add(new Separator());
    final IAction bookmarkGroup = new Action("Group Bookmarks", IAction.AS_DROP_DOWN_MENU) {
      @Override
      public void run() {

        /* Restore Default */
        if (fBookMarkGrouping.getType() != BookMarkGrouping.Type.NO_GROUPING)
          doGrouping(BookMarkGrouping.Type.NO_GROUPING);

        /* Show Menu */
        else
          getMenuCreator().getMenu(fToolBarManager.getControl()).setVisible(true);
      }

      @Override
      public ImageDescriptor getImageDescriptor() {
        if (fBookMarkGrouping.getType() == BookMarkGrouping.Type.NO_GROUPING)
          return OwlUI.getImageDescriptor("icons/etool16/group.gif"); //$NON-NLS-1$

        return OwlUI.getImageDescriptor("icons/etool16/group_active.gif"); //$NON-NLS-1$
      }
    };
    bookmarkGroup.setId(GROUP_ACTION);

    bookmarkGroup.setMenuCreator(new IMenuCreator() {
      public void dispose() {}

      public Menu getMenu(Control parent) {
        Menu menu = new Menu(parent);

        /* Group: None */
        final MenuItem noGrouping = new MenuItem(menu, SWT.RADIO);
        noGrouping.setText("No Grouping");
        noGrouping.setSelection(BookMarkGrouping.Type.NO_GROUPING == fBookMarkGrouping.getType());
        menu.setDefaultItem(noGrouping);
        noGrouping.addSelectionListener(new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (noGrouping.getSelection() && fBookMarkGrouping.getType() != BookMarkGrouping.Type.NO_GROUPING)
              doGrouping(BookMarkGrouping.Type.NO_GROUPING);
          }
        });

        /* Separator */
        new MenuItem(menu, SWT.SEPARATOR);

        /* Group: By Last Visit */
        final MenuItem groupByLastVisit = new MenuItem(menu, SWT.RADIO);
        groupByLastVisit.setText("Group by Last Visit");
        groupByLastVisit.setSelection(BookMarkGrouping.Type.GROUP_BY_LAST_VISIT == fBookMarkGrouping.getType());
        groupByLastVisit.addSelectionListener(new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (groupByLastVisit.getSelection() && fBookMarkGrouping.getType() != BookMarkGrouping.Type.GROUP_BY_LAST_VISIT)
              doGrouping(BookMarkGrouping.Type.GROUP_BY_LAST_VISIT);
          }
        });

        /* Group: By Popularity */
        final MenuItem groupByPopularity = new MenuItem(menu, SWT.RADIO);
        groupByPopularity.setText("Group by Popularity");
        groupByPopularity.setSelection(BookMarkGrouping.Type.GROUP_BY_POPULARITY == fBookMarkGrouping.getType());
        groupByPopularity.addSelectionListener(new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (groupByPopularity.getSelection() && fBookMarkGrouping.getType() != BookMarkGrouping.Type.GROUP_BY_POPULARITY)
              doGrouping(BookMarkGrouping.Type.GROUP_BY_POPULARITY);
          }
        });

        return menu;
      }

      public Menu getMenu(Menu parent) {
        return null;
      }
    });

    fToolBarManager.add(bookmarkGroup);

    /* BookmarkSet Navigation - TODO Consider showing dynamically */
    fToolBarManager.add(new Separator());
    IAction previousSet = new Action("Previous Bookmark-Set") {
      @Override
      public void run() {
        int index = getIndexOfRootFolder(fSelectedBookMarkSet);
        changeSet(getRootFolderAt(index - 1));
      }

      @Override
      public boolean isEnabled() {
        int index = getIndexOfRootFolder(fSelectedBookMarkSet);
        return index > 0 && fRootFolders.size() > 1;
      }
    };
    previousSet.setId(PREVIOUS_SET_ACTION);
    previousSet.setImageDescriptor(OwlUI.getImageDescriptor("icons/etool16/backward.gif")); //$NON-NLS-1$
    previousSet.setDisabledImageDescriptor(OwlUI.getImageDescriptor("icons/dtool16/backward.gif")); //$NON-NLS-1$
    fToolBarManager.add(previousSet);

    IAction nextSet = new Action("Next Bookmark-Set") {
      @Override
      public void run() {
        int index = getIndexOfRootFolder(fSelectedBookMarkSet);
        changeSet(getRootFolderAt(index + 1));
      }

      @Override
      public boolean isEnabled() {
        int index = getIndexOfRootFolder(fSelectedBookMarkSet);
        return index < (fRootFolders.size() - 1) && fRootFolders.size() > 1;
      }
    };
    nextSet.setId(NEXT_SET_ACTION);
    nextSet.setImageDescriptor(OwlUI.getImageDescriptor("icons/etool16/forward.gif")); //$NON-NLS-1$
    nextSet.setDisabledImageDescriptor(OwlUI.getImageDescriptor("icons/dtool16/forward.gif")); //$NON-NLS-1$
    fToolBarManager.add(nextSet);

    /* Allow Contributions */
    fToolBarManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  }
View Full Code Here

        return OwlUI.SEARCHMARK;
      }
    });

    /* New Folder */
    newMenu.add(new Separator());
    newMenu.add(new Action("Folder") {
      @Override
      public void run() {
        IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
        IFolder parent = getParent(selection);
        IMark position = (IMark) ((selection.getFirstElement() instanceof IMark) ? selection.getFirstElement() : null);
        new NewFolderAction(fViewSite.getShell(), parent, position).run(null);
      }

      @Override
      public ImageDescriptor getImageDescriptor() {
        return OwlUI.FOLDER;
      }
    });

    /* Allow Contributions */
    manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

    /* Create and Register with Workbench */
    Menu menu = manager.createContextMenu(fViewer.getControl());
    fViewer.getControl().setMenu(menu);
    fViewSite.registerContextMenu(manager, fViewer);
View Full Code Here

      public void menuAboutToShow(IMenuManager manager) {
        final IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();

        /* Open */
        {
          manager.add(new Separator("open"));

          /* Show only when internal browser is used */
          if (!selection.isEmpty() && !fPreferences.getBoolean(DefaultPreferences.USE_CUSTOM_EXTERNAL_BROWSER) && !fPreferences.getBoolean(DefaultPreferences.USE_DEFAULT_EXTERNAL_BROWSER))
            manager.add(new OpenInExternalBrowserAction(selection));
        }

        /* Mark / Label */
        {
          manager.add(new Separator("mark"));

          /* Mark */
          MenuManager markMenu = new MenuManager("Mark", "mark");
          manager.add(markMenu);

          /* Mark as Read */
          IAction action = new MarkNewsReadAction(selection);
          action.setEnabled(!selection.isEmpty());
          markMenu.add(action);

          /* Mark All Read */
          action = new MarkAllNewsReadAction();
          markMenu.add(action);

          /* Sticky */
          markMenu.add(new Separator());
          action = new MakeNewsStickyAction(selection);
          action.setEnabled(!selection.isEmpty());
          markMenu.add(action);

          /* Label */
          if (!selection.isEmpty()) {
            Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);

            /* Label */
            MenuManager labelMenu = new MenuManager("Label");
            manager.appendToGroup("mark", labelMenu);

            /* Retrieve Labels that all selected News contain */
            Set<ILabel> selectedLabels = ModelUtils.getLabelsForAll(selection);

            IAction removeAllLabels = new Action("Remove All Labels") {
              @Override
              public void run() {
                Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
                new LabelAction(labels, selection, false).run();
              }
            };

            removeAllLabels.setEnabled(!labels.isEmpty());
            labelMenu.add(removeAllLabels);
            labelMenu.add(new Separator());

            for (final ILabel label : labels) {
              IAction labelAction = new Action(label.getName(), IAction.AS_CHECK_BOX) {
                @Override
                public void run() {
                  Set<ILabel> labels = new HashSet<ILabel>(1);
                  labels.add(label);
                  new LabelAction(labels, selection, isChecked()).run();
                }
              };

              labelAction.setChecked(selectedLabels.contains(label));
              labelMenu.add(labelAction);
            }

            labelMenu.add(new Separator());
            labelMenu.add(new Action("Organize...") {
              @Override
              public void run() {
                PreferencesUtil.createPreferenceDialogOn(fViewer.getTree().getShell(), ManageLabelsPreferencePage.ID, null, null).open();
              }
            });
          }
        }

        manager.add(new Separator("edit"));
        manager.add(new Separator("copy"));
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

        /* Need a good Selection here */
        if (selection.isEmpty() || (selection.size() == 1 && selection.getFirstElement() instanceof EntityGroup))
          return;

View Full Code Here

  private void hookContextualMenu() {
    MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        manager.add(new Separator("internalopen"));
        manager.add(new GroupMarker("open"));
        manager.add(new Separator("mark"));
        manager.add(new Separator("edit"));
        manager.add(new Separator("copy"));
        manager.add(new Separator("label"));

        IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();

        /* Need a Selection here */
        if (selection.isEmpty())
          return;

        /* Open in FeedView */
        manager.appendToGroup("internalopen", new OpenNewsAction(selection, getShell()));

        /* Sticky */
        manager.appendToGroup("label", new MakeTypesStickyAction(selection));

        /* Label */
        MenuManager labelMenu = new MenuManager("Label");
        manager.appendToGroup("label", labelMenu);

        /* Retrieve selected Labels from Selection (including NULL!) */
        Set<ILabel> selectedLabels = ModelUtils.getLabels(selection);
        ILabel commonLabel = null;
        if (selectedLabels.size() == 1)
          commonLabel = selectedLabels.iterator().next();

        IAction labelNone = new Action("None", IAction.AS_RADIO_BUTTON) {
          @Override
          public void run() {
            new LabelAction(null, (IStructuredSelection) fViewer.getSelection()).run();
          }
        };
        labelNone.setChecked(selectedLabels.size() == 0 || (selectedLabels.size() == 1 && commonLabel == null));

        labelMenu.add(labelNone);
        labelMenu.add(new Separator());

        Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
        for (final ILabel label : labels) {
          IAction labelAction = new Action(label.getName(), IAction.AS_RADIO_BUTTON) {
            @Override
View Full Code Here

        /* Open */
        {

          /* Open in FeedView */
          manager.add(new Separator("internalopen"));
          if (!selection.isEmpty())
            manager.appendToGroup("internalopen", new OpenNewsAction(selection, getShell()));

          manager.add(new GroupMarker("open"));

          /* Show only when internal browser is used */
          if (!selection.isEmpty() && !fPreferences.getBoolean(DefaultPreferences.USE_CUSTOM_EXTERNAL_BROWSER) && !fPreferences.getBoolean(DefaultPreferences.USE_DEFAULT_EXTERNAL_BROWSER))
            manager.add(new OpenInExternalBrowserAction(selection));
        }

        /* Mark / Label */
        if (!selection.isEmpty()) {
          manager.add(new Separator("mark"));

          /* Mark */
          MenuManager markMenu = new MenuManager("Mark", "mark");
          manager.add(markMenu);

          /* Mark as Read */
          IAction action = new MarkNewsReadAction(selection);
          action.setEnabled(!selection.isEmpty());
          markMenu.add(action);

          /* Sticky */
          markMenu.add(new Separator());
          action = new MakeNewsStickyAction(selection);
          action.setEnabled(!selection.isEmpty());
          markMenu.add(action);

          /* Label */
          if (!selection.isEmpty()) {
            Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);

            /* Label */
            MenuManager labelMenu = new MenuManager("Label");
            manager.appendToGroup("mark", labelMenu);

            /* Retrieve Labels that all selected News contain */
            Set<ILabel> selectedLabels = ModelUtils.getLabelsForAll(selection);

            IAction removeAllLabels = new Action("Remove All Labels") {
              @Override
              public void run() {
                Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
                new LabelAction(labels, (IStructuredSelection) fResultViewer.getSelection(), false).run();
              }
            };

            removeAllLabels.setEnabled(!labels.isEmpty());
            labelMenu.add(removeAllLabels);
            labelMenu.add(new Separator());

            for (final ILabel label : labels) {
              IAction labelAction = new Action(label.getName(), IAction.AS_CHECK_BOX) {
                @Override
                public void run() {
                  Set<ILabel> labels = new HashSet<ILabel>(1);
                  labels.add(label);
                  new LabelAction(labels, (IStructuredSelection) fResultViewer.getSelection(), isChecked()).run();
                }
              };

              labelAction.setChecked(selectedLabels.contains(label));
              labelMenu.add(labelAction);
            }

            labelMenu.add(new Separator());
            labelMenu.add(new Action("Organize...") {
              @Override
              public void run() {
                PreferencesUtil.createPreferenceDialogOn(fResultViewer.getTable().getShell(), ManageLabelsPreferencePage.ID, null, null).open();
              }
            });
          }
        }

        manager.add(new Separator("edit"));
        manager.add(new Separator("copy"));
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
      }
    });

    /* Create and Register with Workbench */
    Menu menu = manager.createContextMenu(fResultViewer.getControl());
View Full Code Here

TOP

Related Classes of org.eclipse.jface.action.Separator

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.