Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorPart


    if (page == null)
      return;

    int openedEditors = 0;
    int maxOpenEditors = EditorUtils.getOpenEditorLimit();
    IEditorPart lastOpenedEditor = null;

    /* Convert selection to List of News (1 per Feed) */
    List< ? > list = fSelection.toList();
    List<FeedLinkReference> handledFeeds = new ArrayList<FeedLinkReference>(list.size());
    List<INews> newsToOpen = new ArrayList<INews>(list.size());
    for (Object selection : list) {
      if (selection instanceof INews) {
        INews news = (INews) selection;
        FeedLinkReference feedRef = news.getFeedReference();

        /* Check if already Handled */
        if (!handledFeeds.contains(feedRef)) {
          newsToOpen.add(news);
          handledFeeds.add(feedRef);
        }
      }
    }

    /* Minimize Shell if present */
    if (newsToOpen.size() > 0 && fShellToMinimize != null)
      fShellToMinimize.setMinimized(true);

    /* Open Bookmarks belonging to the News */
    for (int i = 0; i < newsToOpen.size() && openedEditors < maxOpenEditors; i++) {
      INews news = newsToOpen.get(i);

      /* Receive the first Bookmark belonging to the News and open it */
      Set<IBookMark> bookmarks = fCacheService.getBookMarks(news.getFeedReference());
      if (!bookmarks.isEmpty()) {
        IBookMark mark = bookmarks.iterator().next();

        /* Select this News in the FeedView */
        PerformAfterInputSet perform = PerformAfterInputSet.selectNews(new NewsReference(news.getId()));
        perform.setActivate(false);

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

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

            /* Set Selection */
            feedview.setSelection(new StructuredSelection(news));
View Full Code Here


   * or <code>NULL</code> if none.
   */
  public static FeedView getActiveFeedView() {
    IWorkbenchPage page = getPage();
    if (page != null) {
      IEditorPart activeEditor = page.getActiveEditor();
      if (activeEditor != null && activeEditor instanceof FeedView)
        return (FeedView) activeEditor;
    }

    return null;
View Full Code Here

  }

  private void onMinimize() {

    /* Mark displayed News as Read on Minimize if set in Preferences */
    IEditorPart activeEditor = OwlUI.getActiveEditor();
    if (activeEditor != null && activeEditor instanceof FeedView) {
      FeedView feedView = (FeedView) activeEditor;
      feedView.notifyUIEvent(FeedView.UIEvent.MINIMIZE);
    }
  }
View Full Code Here

  }

  private void onClose() {

    /* Mark new News as Unread on Close */
    IEditorPart activeEditor = OwlUI.getActiveEditor();
    if (activeEditor != null && activeEditor instanceof FeedView) {
      FeedView feedView = (FeedView) activeEditor;
      feedView.notifyUIEvent(FeedView.UIEvent.CLOSE);
    }
  }
View Full Code Here

          public void run() {
            fLinkingEnabled = isChecked();

            /* Link if enabled */
            if (fLinkingEnabled) {
              IEditorPart editor = fViewSite.getPage().getActiveEditor();
              if (editor != null)
                editorActivated(editor);
            }
          }
        };
View Full Code Here

      if (newsScoped && unread)
        perform = PerformAfterInputSet.SELECT_UNREAD_NEWS;
      else if (newsScoped)
        perform = PerformAfterInputSet.SELECT_FIRST_NEWS;

      IEditorPart feedview = fViewSite.getPage().openEditor(new FeedViewInput(mark, perform), FeedView.ID, true);
      feedview.getSite().getPage().activate(feedview.getSite().getPart());
    } catch (PartInitException e) {
      Activator.getDefault().getLog().log(e.getStatus());
    }
  }
View Full Code Here

   * or <code>NULL</code> if none.
   */
  public static FeedView getActiveFeedView() {
    IWorkbenchPage page = getPage();
    if (page != null) {
      IEditorPart activeEditor = page.getActiveEditor();
      if (activeEditor != null && activeEditor instanceof FeedView)
        return (FeedView) activeEditor;
    }

    return null;
View Full Code Here

          public void run() {
            fLinkingEnabled = isChecked();

            /* Link if enabled */
            if (fLinkingEnabled) {
              IEditorPart editor = fViewSite.getPage().getActiveEditor();
              if (editor != null)
                editorActivated(editor);
            }
          }
        };
View Full Code Here

      if (newsScoped && unread)
        perform = PerformAfterInputSet.SELECT_UNREAD_NEWS;
      else if (newsScoped)
        perform = PerformAfterInputSet.SELECT_FIRST_NEWS;

      IEditorPart feedview = fViewSite.getPage().openEditor(new FeedViewInput(mark, perform), FeedView.ID, true);
      feedview.getSite().getPage().activate(feedview.getSite().getPart());
    } catch (PartInitException e) {
      Activator.getDefault().getLog().log(e.getStatus());
    }
  }
View Full Code Here

  }

  private void onMinimize() {

    /* Mark displayed News as Read on Minimize if set in Preferences */
    IEditorPart activeEditor = OwlUI.getActiveEditor();
    if (activeEditor != null && activeEditor instanceof FeedView) {
      FeedView feedView = (FeedView) activeEditor;
      feedView.notifyUIEvent(FeedView.UIEvent.MINIMIZE);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorPart

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.