Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.MenuManager


    fileMenu.add(getAction(ActionFactory.QUIT.getId()));
  }

  /* Menu: Edit */
  private void createEditMenu(IMenuManager menuBar) {
    MenuManager editMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_EDIT, IWorkbenchActionConstants.M_EDIT);
    editMenu.add(getAction(ActionFactory.COPY.getId())); //Dummy action
    menuBar.add(editMenu);

    editMenu.setRemoveAllWhenShown(true);
    editMenu.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager editMenu) {
        editMenu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
        editMenu.add(new Separator());

        editMenu.add(new UndoAction());
        editMenu.add(new RedoAction());
        editMenu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
        editMenu.add(new Separator());

        editMenu.add(getAction(ActionFactory.CUT.getId()));
        editMenu.add(getAction(ActionFactory.COPY.getId()));
        editMenu.add(new CopyLinkAction());
        editMenu.add(getAction(ActionFactory.PASTE.getId()));
        editMenu.add(new Separator());
        editMenu.add(getAction(ActionFactory.DELETE.getId()));
        editMenu.add(getAction(ActionFactory.SELECT_ALL.getId()));

        editMenu.add(new Separator());

        editMenu.add(new SearchNewsAction(OwlUI.getWindow()));
        editMenu.add(fFindAction);

        editMenu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
        editMenu.add(new Separator());

        if (Application.IS_LINUX) {
          IAction preferences = getAction(ActionFactory.PREFERENCES.getId());
          preferences.setImageDescriptor(OwlUI.getImageDescriptor("icons/elcl16/preferences.gif")); //$NON-NLS-1$
          editMenu.add(preferences);
        } else
          editMenu.add(getAction(ActionFactory.PROPERTIES.getId()));
      }
    });
  }
View Full Code Here


  /* Menu: View */
  private void createViewMenu(IMenuManager menuBar) {
    final IPreferenceScope preferences = Owl.getPreferenceService().getGlobalScope();
    final IPreferenceScope eclipsePrefs = Owl.getPreferenceService().getEclipseScope();

    MenuManager viewMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_VIEW, M_VIEW);
    viewMenu.setRemoveAllWhenShown(true);
    menuBar.add(viewMenu);

    /* Add dummy action to show the top level menu */
    viewMenu.add(new Action("") { //$NON-NLS-1$
          @Override
          public void run() {}
        });

    /* Build Menu dynamically */
    viewMenu.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        manager.add(new GroupMarker(M_VIEW_START));

        /* Layout */
        MenuManager layoutMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_LAYOUT);
        layoutMenu.add(new Action(Messages.ApplicationActionBarAdvisor_CLASSIC_VIEW, IAction.AS_RADIO_BUTTON) {
          @Override
          public void run() {
            preferences.putBoolean(DefaultPreferences.FV_LAYOUT_CLASSIC, true);
            preferences.putBoolean(DefaultPreferences.FV_BROWSER_MAXIMIZED, false);
            List<FeedView> feedViews = OwlUI.getFeedViews();
            for (FeedView feedView : feedViews) {
              feedView.updateLayout();
            }
          }

          @Override
          public boolean isChecked() {
            return preferences.getBoolean(DefaultPreferences.FV_LAYOUT_CLASSIC) && !preferences.getBoolean(DefaultPreferences.FV_BROWSER_MAXIMIZED);
          }
        });

        layoutMenu.add(new Action(Messages.ApplicationActionBarAdvisor_VERTICAL_VIEW, IAction.AS_RADIO_BUTTON) {
          @Override
          public void run() {
            preferences.putBoolean(DefaultPreferences.FV_LAYOUT_CLASSIC, false);
            preferences.putBoolean(DefaultPreferences.FV_BROWSER_MAXIMIZED, false);
            List<FeedView> feedViews = OwlUI.getFeedViews();
            for (FeedView feedView : feedViews) {
              feedView.updateLayout();
            }
          }

          @Override
          public boolean isChecked() {
            return !preferences.getBoolean(DefaultPreferences.FV_LAYOUT_CLASSIC) && !preferences.getBoolean(DefaultPreferences.FV_BROWSER_MAXIMIZED);
          }
        });

        layoutMenu.add(new Action(Messages.ApplicationActionBarAdvisor_NEWSPAPER_VIEW, IAction.AS_RADIO_BUTTON) {
          @Override
          public void run() {
            preferences.putBoolean(DefaultPreferences.FV_BROWSER_MAXIMIZED, true);
            List<FeedView> feedViews = OwlUI.getFeedViews();
            for (FeedView feedView : feedViews) {
              feedView.updateLayout();
            }
          }

          @Override
          public boolean isChecked() {
            return preferences.getBoolean(DefaultPreferences.FV_BROWSER_MAXIMIZED);
          }
        });

        layoutMenu.add(new Separator());
        layoutMenu.add(new Action(Messages.ApplicationActionBarAdvisor_TABBED_BROWSING, IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            boolean tabbedBrowsingEnabled = isChecked();

            /* Disable Tabbed Browsing */
            if (tabbedBrowsingEnabled) {

              /* Close other Tabs if necessary */
              boolean doit = true;
              IWorkbenchPage page = OwlUI.getPage();
              if (page != null) {
                IEditorReference[] editorReferences = page.getEditorReferences();
                if (editorReferences.length > 1) {
                  MessageBox confirmDialog = new MessageBox(page.getWorkbenchWindow().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                  confirmDialog.setText(Messages.ApplicationActionBarAdvisor_DISABLE_TABBED_BROWSING);
                  confirmDialog.setMessage(NLS.bind(Messages.ApplicationActionBarAdvisor_TABS_MESSAGE, editorReferences.length));
                  if (confirmDialog.open() == SWT.YES)
                    OwlUI.closeOtherEditors();
                  else
                    doit = false;
                }
              }

              /* Update Preferences */
              if (doit) {
                eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_MULTIPLE_TABS, false);
                eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS, true);
                eclipsePrefs.putInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD, 1);
              }
            }

            /* Enable Tabbed Browsing */
            else {
              eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_MULTIPLE_TABS, true);
              eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS, false);
              eclipsePrefs.putInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD, 5);
            }
          }

          @Override
          public boolean isChecked() {
            boolean autoCloseTabs = eclipsePrefs.getBoolean(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS);
            int autoCloseTabsThreshold = eclipsePrefs.getInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD);
            return !autoCloseTabs || autoCloseTabsThreshold > 1;
          }
        });

        manager.add(layoutMenu);

        /* Zoom (In, Out, Reset) */
        final MenuManager zoomMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_ZOOM);
        zoomMenu.setRemoveAllWhenShown(true);
        zoomMenu.addMenuListener(new IMenuListener() {
          public void menuAboutToShow(IMenuManager manager) {
            FeedView activeFeedView = OwlUI.getActiveFeedView();
            final boolean isZoomingEnabled = (activeFeedView != null && activeFeedView.isBrowserShowingNews());

            /* Zoom In */
            zoomMenu.add(new Action(Messages.ApplicationActionBarAdvisor_ZOOM_IN) {
              @Override
              public void run() {
                OwlUI.zoomNewsText(true, false);
              }

              @Override
              public String getId() {
                return "org.rssowl.ui.ZoomInCommand"; //$NON-NLS-1$
              }

              @Override
              public String getActionDefinitionId() {
                return "org.rssowl.ui.ZoomInCommand"; //$NON-NLS-1$
              }

              @Override
              public boolean isEnabled() {
                return isZoomingEnabled;
              }
            });

            /* Zoom Out */
            zoomMenu.add(new Action(Messages.ApplicationActionBarAdvisor_ZOOM_OUT) {
              @Override
              public void run() {
                OwlUI.zoomNewsText(false, false);
              }

              @Override
              public String getId() {
                return "org.rssowl.ui.ZoomOutCommand"; //$NON-NLS-1$
              }

              @Override
              public String getActionDefinitionId() {
                return "org.rssowl.ui.ZoomOutCommand"; //$NON-NLS-1$
              }

              @Override
              public boolean isEnabled() {
                return isZoomingEnabled;
              }
            });

            /* Reset */
            zoomMenu.add(new Separator());
            zoomMenu.add(new Action(Messages.ApplicationActionBarAdvisor_RESET) {
              @Override
              public void run() {
                OwlUI.zoomNewsText(false, true);
              }

View Full Code Here

    });
  }

  /* Menu: Go */
  private void createGoMenu(IMenuManager menuBar) {
    MenuManager goMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_GO, IWorkbenchActionConstants.M_NAVIGATE);
    menuBar.add(goMenu);

    goMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    goMenu.add(fReopenEditors);
  }
View Full Code Here

    goMenu.add(fReopenEditors);
  }

  /* Menu: Bookmarks */
  private void createBookMarksMenu(IMenuManager menuBar) {
    MenuManager bmMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_BOOKMARKS, "bookmarks"); //$NON-NLS-1$
    bmMenu.setRemoveAllWhenShown(true);
    bmMenu.add(new Action("") {}); //Dummy Action //$NON-NLS-1$
    bmMenu.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        fillBookMarksMenu(manager, getActionBarConfigurer().getWindowConfigurer().getWindow());
        manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
      }
    });
View Full Code Here

  /* Menu News */
  private void createNewsMenu(IMenuManager menuBar) {
    final IPreferenceScope preferences = Owl.getPreferenceService().getGlobalScope();

    final MenuManager newsMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_NEWS, "news"); //$NON-NLS-1$
    menuBar.add(newsMenu);
    newsMenu.setRemoveAllWhenShown(true);

    newsMenu.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        final IStructuredSelection selection;

        FeedView activeFeedView = OwlUI.getActiveFeedView();
        FeedViewInput activeInput = null;
        if (activeFeedView != null) {
          selection = (IStructuredSelection) activeFeedView.getSite().getSelectionProvider().getSelection();
          activeInput = (FeedViewInput) activeFeedView.getEditorInput();
        } else
          selection = StructuredSelection.EMPTY;

        boolean isEntityGroupSelected = OwlUI.isEntityGroupSelected(selection);

        /* Open */
        if (!isEntityGroupSelected) {
          manager.add(new Separator("open")); //$NON-NLS-1$

          /* Open News in Browser */
          manager.add(new OpenInBrowserAction(selection, WebBrowserContext.createFrom(selection, activeFeedView)) {
            @Override
            public boolean isEnabled() {
              return !selection.isEmpty();
            }
          });

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

        /* Attachments */
        {
          fillAttachmentsMenu(manager, selection, getActionBarConfigurer().getWindowConfigurer().getWindow(), false);
        }

        /* Mark / Label */
        {
          manager.add(new Separator("mark")); //$NON-NLS-1$

          /* Mark */
          {
            MenuManager markMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_MARK, "mark"); //$NON-NLS-1$
            manager.add(markMenu);

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

            /* Mark All Read */
            action = new MarkAllNewsReadAction();
            action.setEnabled(activeFeedView != null);
            markMenu.add(action);

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

          /* Label */
          fillLabelMenu(manager, selection, getActionBarConfigurer().getWindowConfigurer().getWindow(), false);
        }

        /* Move To / Copy To */
        if (!selection.isEmpty()) {
          manager.add(new Separator("movecopy")); //$NON-NLS-1$

          /* Load all news bins and sort by name */
          List<INewsBin> newsbins = new ArrayList<INewsBin>(DynamicDAO.loadAll(INewsBin.class));

          Comparator<INewsBin> comparator = new Comparator<INewsBin>() {
            public int compare(INewsBin o1, INewsBin o2) {
              return o1.getName().compareTo(o2.getName());
            };
          };

          Collections.sort(newsbins, comparator);

          /* Move To */
          MenuManager moveMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_MOVE_TO, "moveto"); //$NON-NLS-1$
          manager.add(moveMenu);

          for (INewsBin bin : newsbins) {
            if (activeInput != null && activeInput.getMark().equals(bin))
              continue;

            moveMenu.add(new MoveCopyNewsToBinAction(selection, bin, true));
          }

          moveMenu.add(new MoveCopyNewsToBinAction(selection, null, true));
          moveMenu.add(new Separator());
          moveMenu.add(new AutomateFilterAction(PresetAction.MOVE, selection));

          /* Copy To */
          MenuManager copyMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_COPY_TO, "copyto"); //$NON-NLS-1$
          manager.add(copyMenu);

          for (INewsBin bin : newsbins) {
            if (activeInput != null && activeInput.getMark().equals(bin))
              continue;

            copyMenu.add(new MoveCopyNewsToBinAction(selection, bin, false));
          }

          copyMenu.add(new MoveCopyNewsToBinAction(selection, null, false));
          copyMenu.add(new Separator());
          copyMenu.add(new AutomateFilterAction(PresetAction.COPY, selection));
        }

        /* Share */
        fillShareMenu(manager, selection, getActionBarConfigurer().getWindowConfigurer().getWindow(), false);

View Full Code Here

    boolean useSystemProxy = fEclipsePreferences.getBoolean(DefaultPreferences.ECLIPSE_USE_SYSTEM_PROXY);
    return useProxy && !useSystemProxy;
  }

  private void hookMenu() {
    MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {

        /* Back */
        manager.add(new Action(Messages.CBrowser_BACK) {
          @Override
          public void run() {
            fBrowser.back();
          }

          @Override
          public boolean isEnabled() {
            return fBrowser.isBackEnabled();
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.getImageDescriptor("icons/etool16/backward.gif"); //$NON-NLS-1$
          }
        });

        /* Forward */
        manager.add(new Action(Messages.CBrowser_FORWARD) {
          @Override
          public void run() {
            fBrowser.forward();
          }

          @Override
          public boolean isEnabled() {
            return fBrowser.isForwardEnabled();
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.getImageDescriptor("icons/etool16/forward.gif"); //$NON-NLS-1$
          }
        });

        /* Reload */
        manager.add(new Separator());
        manager.add(new Action(Messages.CBrowser_RELOAD) {
          @Override
          public void run() {
            refresh();
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.getImageDescriptor("icons/elcl16/reload.gif"); //$NON-NLS-1$
          }
        });

        /* Stop */
        manager.add(new Action(Messages.CBrowser_STOP) {
          @Override
          public void run() {
            fBrowser.stop();
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.getImageDescriptor("icons/etool16/cancel.gif"); //$NON-NLS-1$
          }
        });
      }
    });

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

    });
  }

  /* Menu: Tools */
  private void createToolsMenu(IMenuManager menuBar) {
    MenuManager toolsMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_TOOLS, OwlUI.M_TOOLS);
    menuBar.add(toolsMenu);

    /* Contributions */
    toolsMenu.add(new GroupMarker("begin")); //$NON-NLS-1$
    toolsMenu.add(new Separator());
    toolsMenu.add(new GroupMarker("middle")); //$NON-NLS-1$
    toolsMenu.add(new Separator("addons")); //$NON-NLS-1$
    toolsMenu.add(new Separator());
    toolsMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    toolsMenu.add(new Separator());
    toolsMenu.add(new GroupMarker("end")); //$NON-NLS-1$

    /* Preferences (Windows, Mac) */
    if (!Application.IS_LINUX) {
      toolsMenu.add(new Separator());
      IAction preferences = getAction(ActionFactory.PREFERENCES.getId());
      preferences.setImageDescriptor(OwlUI.getImageDescriptor("icons/elcl16/preferences.gif")); //$NON-NLS-1$
      toolsMenu.add(preferences);
      if (Application.IS_MAC) {
        IContributionItem item = toolsMenu.find(ActionFactory.PREFERENCES.getId());
        if (item != null)
          item.setVisible(false);
      }
    }
  }
View Full Code Here

    }
  }

  /* Menu: Window */
  private void createWindowMenu(IMenuManager menuBar) {
    MenuManager windowMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_WINDOW, IWorkbenchActionConstants.M_WINDOW);
    menuBar.add(windowMenu);

    IAction openNewWindowAction = getAction(ActionFactory.OPEN_NEW_WINDOW.getId());
    openNewWindowAction.setImageDescriptor(OwlUI.getImageDescriptor("icons/elcl16/newwindow.gif")); //$NON-NLS-1$
    windowMenu.add(openNewWindowAction);

    windowMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    windowMenu.add(fOpenWindowsItem);

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

    //    navigationMenu.add(getAction(ActionFactory.PREVIOUS_PART.getId()));
  }

  /* Menu: Help */
  private void createHelpMenu(IMenuManager menuBar) {
    MenuManager helpMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_HELP, IWorkbenchActionConstants.M_HELP);
    menuBar.add(helpMenu);

    helpMenu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));

    /* Tutorial Wizard */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_TUTORIAL) {
      @Override
      public void run() {
        TutorialWizard wizard = new TutorialWizard();
        OwlUI.openWizard(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell(), wizard, false, false, null);
      }

      @Override
      public ImageDescriptor getImageDescriptor() {
        return OwlUI.getImageDescriptor("icons/elcl16/help.gif"); //$NON-NLS-1$
      }

      @Override
      public String getId() {
        return TutorialHandler.ID;
      }

      @Override
      public String getActionDefinitionId() {
        return TutorialHandler.ID;
      }
    });

    /* Link to Help */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_FAQ) {
      @Override
      public void run() {
        BrowserUtils.openLinkExternal("http://www.rssowl.org/help"); //$NON-NLS-1$
      }
    });

    /* Link to Forum */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_VISIT_FORUM) {
      @Override
      public void run() {
        BrowserUtils.openLinkExternal("http://sourceforge.net/projects/rssowl/forums/forum/296910"); //$NON-NLS-1$
      }

      @Override
      public ImageDescriptor getImageDescriptor() {
        return OwlUI.getImageDescriptor("icons/obj16/forum.gif"); //$NON-NLS-1$
      }
    });

    /* Show Key Bindings */
    helpMenu.add(new Separator());
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_SHOW_KEY_BINDINGS) {
      @Override
      public void run() {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
        bindingService.openKeyAssistDialog();
      }
    });

    helpMenu.add(new Separator());

    /* Report Bugs */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_REPORT_PROBLEMS) {
      @Override
      public void run() {
        BrowserUtils.openLinkExternal("http://dev.rssowl.org"); //$NON-NLS-1$
      }

      @Override
      public ImageDescriptor getImageDescriptor() {
        return OwlUI.getImageDescriptor("icons/elcl16/bug.gif"); //$NON-NLS-1$
      }
    });

    /* Export Log to File */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_EXPORT_LOGFILE) {
      @Override
      public void run() {
        FileDialog dialog = new FileDialog(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell(), SWT.SAVE);
        dialog.setText(Messages.ApplicationActionBarAdvisor_EXPORT_LOGFILE_DIALOG);
        dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
        dialog.setFileName("rssowl.log"); //$NON-NLS-1$
        dialog.setOverwrite(true);

        String file = dialog.open();
        if (StringUtils.isSet(file)) {
          try {

            /* Check for Log Message from Core to have a complete log */
            String logMessages = CoreUtils.getAndFlushLogMessages();
            if (logMessages != null && logMessages.length() > 0)
              Activator.safeLogError(logMessages, null);

            /* Help to find out where the log is coming from */
            Activator.safeLogInfo("Error Log Exported"); //$NON-NLS-1$

            /* Export Log File */
            File logFile = Platform.getLogFileLocation().toFile();
            InputStream inS;
            if (logFile.exists())
              inS = new FileInputStream(logFile);
            else
              inS = new ByteArrayInputStream(new byte[0]);
            FileOutputStream outS = new FileOutputStream(new File(file));
            CoreUtils.copy(inS, outS);

            /* Append a Report of Feeds that are not loading if any */
            String nl = System.getProperty("line.separator"); //$NON-NLS-1$
            if (!StringUtils.isSet(nl))
              nl= "\n"; //$NON-NLS-1$

            StringBuilder errorReport = new StringBuilder();
            Collection<IBookMark> bookmarks = DynamicDAO.getDAO(IBookMarkDAO.class).loadAll();
            for (IBookMark bookmark : bookmarks) {
              if (bookmark.isErrorLoading()) {
                Object errorObj = bookmark.getProperty(Controller.LOAD_ERROR_KEY);
                if (errorObj != null && errorObj instanceof String) {
                  errorReport.append(Controller.getDefault().createLogEntry(bookmark, null, (String) errorObj));
                  errorReport.append(nl).append(nl);
                }
              }
            }

            if (errorReport.length() > 0) {
              FileWriter writer = new FileWriter(new File(file), true);
              try {
                writer.append(nl).append(nl).append(nl);
                writer.write("--- Summary of Feeds that are not Loading -----------------------------------------------"); //$NON-NLS-1$
                writer.append(nl).append(nl);
                writer.write(errorReport.toString());
                writer.close();
              } finally {
                writer.close();
              }
            }
          } catch (FileNotFoundException e) {
            Activator.getDefault().logError(e.getMessage(), e);
          } catch (IOException e) {
            Activator.getDefault().logError(e.getMessage(), e);
          }
        }
      }
    });

    helpMenu.add(new Separator());

    /* Homepage */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_HOMEPAGE) {
      @Override
      public void run() {
        BrowserUtils.openLinkExternal("http://www.rssowl.org"); //$NON-NLS-1$
      }
    });

    /* License */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_LICENSE) {
      @Override
      public void run() {
        BrowserUtils.openLinkExternal("http://www.rssowl.org/legal/epl-v10.html"); //$NON-NLS-1$
      }
    });

    // helpMenu.add(getAction(ActionFactory.INTRO.getId()));
    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()));
    if (Application.IS_MAC) {
      IContributionItem item = helpMenu.find(ActionFactory.ABOUT.getId());
      if (item != null)
        item.setVisible(false);
    }
  }
View Full Code Here

   */
  @Override
  protected void fillCoolBar(ICoolBarManager coolBar) {

    /* CoolBar Context Menu */
    MenuManager coolBarContextMenuManager = new MenuManager(null, "org.rssowl.ui.CoolBarContextMenu"); //$NON-NLS-1$
    coolBar.setContextMenuManager(coolBarContextMenuManager);

    /* Customize Coolbar */
    coolBarContextMenuManager.add(new Action(Messages.ApplicationActionBarAdvisor_CUSTOMIZE_TOOLBAR) {
      @Override
      public void run() {
        CustomizeToolbarDialog dialog = new CustomizeToolbarDialog(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell());
        if (dialog.open() == IDialogConstants.OK_ID)
          fCoolBarAdvisor.advise(true);
      }
    });

    /* Lock Coolbar  */
    coolBarContextMenuManager.add(new Separator());
    IAction lockToolbarAction = getAction(ActionFactory.LOCK_TOOL_BAR.getId());
    lockToolbarAction.setText(Messages.ApplicationActionBarAdvisor_LOCK_TOOLBAR);
    coolBarContextMenuManager.add(lockToolbarAction);

    /* Toggle State of Toolbar Visibility */
    coolBarContextMenuManager.add(new Action(Messages.ApplicationActionBarAdvisor_HIDE_TOOLBAR) {
      @Override
      public void run() {
        ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.fgPrimaryApplicationWorkbenchWindowAdvisor;
        configurer.setToolBarVisible(false, true);
        Owl.getPreferenceService().getGlobalScope().putBoolean(DefaultPreferences.SHOW_TOOLBAR, false);
      }
    });

    /* Support for more Contributions */
    coolBarContextMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    /* Coolbar Advisor */
    fCoolBarAdvisor = new CoolBarAdvisor(coolBar, getActionBarConfigurer().getWindowConfigurer().getWindow());
    fCoolBarAdvisor.advise();
  }
View Full Code Here

TOP

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

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.