Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchPage


   */
  @Override
  public void open(MouseEvent e) {

    /* Open Feed View with the Saved Search as input */
    IWorkbenchPage page = OwlUI.getPage();
    if (page != null) {

      /* Restore Window */
      OwlUI.restoreWindow(page);

      /* First try if the Search is already visible */
      IEditorReference editorRef = EditorUtils.findEditor(page.getEditorReferences(), fSearchmark);
      if (editorRef != null) {
        IEditorPart editor = editorRef.getEditor(false);
        if (editor instanceof FeedView)
          page.activate(editor);
      }

      /* Otherwise Open */
      else {
        boolean activateEditor = OpenStrategy.activateOnOpen();
View Full Code Here


  }

  private void internalRun() {

    /* Require a Page */
    IWorkbenchPage page = OwlUI.getPage();
    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 */
      IBookMark bookmark = fCacheService.getBookMark(news.getFeedReference());
      if (bookmark != null) {

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

        /* Open this Bookmark */
        FeedViewInput fvInput = new FeedViewInput(bookmark, 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));
          }

          /* Otherwise open the Input in a new Editor */
          else
            feedview = (FeedView) page.openEditor(fvInput, FeedView.ID, true);

          openedEditors++;
          lastOpenedEditor = feedview;
        } catch (PartInitException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
      }
    }

    /* Activate the last opened editor */
    if (lastOpenedEditor != null)
      page.activate(lastOpenedEditor);
  }
View Full Code Here

    fTitleCircleLabel.addMouseTrackListener(fMouseTrackListner);
    fTitleCircleLabel.setCursor(fShell.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    fTitleCircleLabel.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseUp(MouseEvent e) {
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null) {

          /* Restore Window */
          restoreWindow(page);

View Full Code Here

  }

  private void internalRun() {

    /* Require a Page */
    IWorkbenchPage page = OwlUI.getPage();
    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));
          }

          /* Otherwise open the Input in a new Editor */
          else
            feedview = (FeedView) page.openEditor(fvInput, FeedView.ID, true);

          openedEditors++;
          lastOpenedEditor = feedview;
        } catch (PartInitException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
      }
    }

    /* Activate the last opened editor */
    if (lastOpenedEditor != null)
      page.activate(lastOpenedEditor);
  }
View Full Code Here

        /* Toggle State of Bookmarks Visibility */
        manager.add(new Separator());
        manager.add(new Action("Bookmarks", IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            IWorkbenchPage page = OwlUI.getPage();
            if (page != null) {
              IViewPart explorerView = page.findView(BookMarkExplorer.VIEW_ID);

              /* Hide Bookmarks */
              if (explorerView != null)
                page.hideView(explorerView);

              /* Show Bookmarks */
              else {
                try {
                  page.showView(BookMarkExplorer.VIEW_ID);
                } catch (PartInitException e) {
                  Activator.getDefault().logError(e.getMessage(), e);
                }
              }
            }
          }

          @Override
          public boolean isChecked() {
            IWorkbenchPage page = OwlUI.getPage();
            if (page != null)
              return page.findView(BookMarkExplorer.VIEW_ID) != null;

            return false;
          }
        });

View Full Code Here

   *
   * @return the first active <code>IEditorPart</code> from the PlatformUI
   * facade or <code>NULL</code> if none.
   */
  public static IEditorPart getActiveEditor() {
    IWorkbenchPage page = getPage();
    if (page != null)
      return page.getActiveEditor();

    return null;
  }
View Full Code Here

   *
   * @return the first active <code>FeedView</code> from the PlatformUI facade
   * 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

   *
   * @return the first <code>FeedView</code> from the active Workbench Window
   * of the PlatformUI facade or <code>NULL</code> if none.
   */
  public static FeedView getFirstActiveFeedView() {
    IWorkbenchPage page = getPage();
    if (page != null) {
      IEditorReference[] editorReferences = page.getEditorReferences();
      for (IEditorReference editorReference : editorReferences) {
        try {
          if (editorReference.getEditorInput() instanceof FeedViewInput)
            return (FeedView) editorReference.getEditor(true);
        } catch (PartInitException e) {
View Full Code Here

   *
   * @return the <code>BookMarkExplorer</code> from the PlatformUI facade or
   * <code>NULL</code> if not opened.
   */
  public static BookMarkExplorer getOpenBookMarkExplorer() {
    IWorkbenchPage page = getPage();
    if (page != null) {
      IViewReference[] viewReferences = page.getViewReferences();
      for (IViewReference viewRef : viewReferences) {
        if (viewRef.getId().equals(BookMarkExplorer.VIEW_ID)) {
          IViewPart view = viewRef.getView(true);
          if (view instanceof BookMarkExplorer)
            return (BookMarkExplorer) view;
View Full Code Here

   * @return the current selected {@link IFolder} of the bookmark explorer or
   * the parent of the current selected {@link IMark} or <code>null</code> if
   * none.
   */
  public static IFolder getBookMarkExplorerSelection() {
    IWorkbenchPage page = getPage();
    if (page != null) {
      IViewPart viewPart = page.findView(BookMarkExplorer.VIEW_ID);
      if (viewPart != null) {
        IStructuredSelection selection = (IStructuredSelection) viewPart.getSite().getSelectionProvider().getSelection();
        if (!selection.isEmpty()) {
          Object selectedEntity = selection.iterator().next();
          if (selectedEntity instanceof IFolder)
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IWorkbenchPage

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.