Package org.rssowl.ui.internal.editors.feed

Examples of org.rssowl.ui.internal.editors.feed.FeedViewInput


  private void openAndSelect(IWorkbenchPage page, INews news, INewsMark newsmark) {
    PerformAfterInputSet perform = PerformAfterInputSet.selectNews(new NewsReference(news.getId()));
    perform.setActivate(false);

    /* Open this Bookmark */
    FeedViewInput fvInput = new FeedViewInput(newsmark, perform);
    FeedView feedview = null;

    /* First check if input already shown */
    IEditorPart existingEditor = page.findEditor(fvInput);
    if (existingEditor != null && existingEditor instanceof FeedView) {
View Full Code Here


    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));
          }

View Full Code Here

   */
  public static INewsMark getActiveFeedViewNewsMark() {
    try {
      FeedView activeFeedView = getActiveFeedView();
      if (activeFeedView != null) {
        FeedViewInput input = (FeedViewInput) activeFeedView.getEditorInput();
        return input.getMark();
      }
    } catch (Error e) {
      /* Since this method might be called from any thread, protect fully */
    }

View Full Code Here

  public static IPreferenceScope getActiveFeedViewPreferences() {
    FeedView feedView = getActiveFeedView();
    if (feedView != null) {
      IEditorInput input = feedView.getEditorInput();
      if (input instanceof FeedViewInput) {
        FeedViewInput feedViewInput = (FeedViewInput) input;
        if (feedViewInput.getMark() != null) {
          INewsMark mark = feedViewInput.getMark();
          if (mark instanceof FolderNewsMark)
            return Owl.getPreferenceService().getEntityScope(((FolderNewsMark) mark).getFolder());

          return Owl.getPreferenceService().getEntityScope(feedViewInput.getMark());
        }
      }
    }

    return null;
View Full Code Here

        object = new FolderNewsMark((IFolder) object);

      /* Only news marks supported at this point */
      if (object instanceof INewsMark) {
        INewsMark mark = ((INewsMark) object);
        FeedViewInput input = new FeedViewInput(mark, perform);

        /* Start Blocking Feed Change Events if we open more than one Feed */
        if (i == 1)
          FeedView.setBlockFeedChangeEvent(true);

View Full Code Here

  private void openAndSelect(IWorkbenchPage page, INews news, INewsMark newsmark) {
    PerformAfterInputSet perform = PerformAfterInputSet.selectNews(new NewsReference(news.getId()));
    perform.setActivate(false);

    /* Open this Bookmark */
    FeedViewInput fvInput = new FeedViewInput(newsmark, perform);
    FeedView feedview = null;

    /* First check if input already shown */
    IEditorPart existingEditor = page.findEditor(fvInput);
    if (existingEditor != null && existingEditor instanceof FeedView) {
View Full Code Here

    /* Only consider Entities */
    FeedView feedView = null;
    List<IEntity> entities;
    if (fSelection.size() == 1 && fSelection.getFirstElement() instanceof FeedView) {
      feedView = (FeedView) fSelection.getFirstElement();
      FeedViewInput input = (FeedViewInput) feedView.getEditorInput();
      entities = ModelUtils.getEntities(new StructuredSelection(input.getMark()));
    } else {
      entities = ModelUtils.getEntities(fSelection);
    }

    /* Retrieve any Folder that is to be marked read */
 
View Full Code Here

    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 = ModelUtils.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() && !OwlUI.useExternalBrowser())
            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));
          }

View Full Code Here

    /* Set Selection to Input if Empty */
    if (fSelection.isEmpty()) {
      FeedView activeFeedView = OwlUI.getActiveFeedView();
      if (activeFeedView != null) {
        FeedViewInput input = (FeedViewInput) activeFeedView.getEditorInput();
        fSelection = new StructuredSelection(input.getMark());
      }
    }

    /* Run Update */
    List<?> list = fSelection.toList();
View Full Code Here

  public static IEditorReference findEditor(IEditorReference[] editorReferences, Object input) {
    for (IEditorReference reference : editorReferences) {
      try {
        IEditorInput editorInput = reference.getEditorInput();
        if (editorInput instanceof FeedViewInput) {
          FeedViewInput feedViewInput = (FeedViewInput) editorInput;
          Object inputObj = feedViewInput.getMark();
          if (inputObj instanceof FolderNewsMark)
            inputObj = ((FolderNewsMark) inputObj).getFolder();

          if (inputObj.equals(input))
            return reference;
View Full Code Here

TOP

Related Classes of org.rssowl.ui.internal.editors.feed.FeedViewInput

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.