Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchPage


  public static List<IEditorPart> findOpenEditors(IWorkbench workbench, String id) {
    List<IEditorPart> editors = new ArrayList<IEditorPart>();
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage[] workbenchPages = window.getPages();
    for (int i = 0; i < workbenchPages.length; i++) {
      IWorkbenchPage page = workbenchPages[i];
      IEditorReference[] references = page.getEditorReferences();
      for (int j = 0; j < references.length; j++) {
        IEditorReference reference = references[j];
        IEditorPart editorPart = reference.getEditor(false);
        if (editorPart != null && reference.getId().equals(id)) {
          editors.add(editorPart);
View Full Code Here


  }

  public static IEditorPart openEditor(IWorkbench workbench, IFile file, String editorID) throws PartInitException {
    IEditorInput editorInput = new FileEditorInput(file);
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = window.getActivePage();
    return page.openEditor(editorInput, editorID);
  }
View Full Code Here

        return globalScope.getBoolean(DefaultPreferences.USE_DEFAULT_EXTERNAL_BROWSER) || globalScope.getBoolean(DefaultPreferences.USE_CUSTOM_EXTERNAL_BROWSER);
      }

      private void openInternal(URL url) throws PartInitException {
        WebBrowserInput input = new WebBrowserInput(url.toExternalForm());
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null)
          fBrowserView = page.openEditor(input, WebBrowserView.EDITOR_ID);
      }

      private void openExternal(URL url) {
        BrowserUtils.openLink(url.toExternalForm());
      }

      /*
       * @see org.eclipse.ui.browser.IWebBrowser#close()
       */
      public boolean close() {
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null && fBrowserView != null)
          page.closeEditor(fBrowserView, false);

        return true;
      }

      /*
 
View Full Code Here

      JobRunner.runInUIThread(null, new Runnable() {
        public void run() {
          boolean activateEditor = OpenStrategy.activateOnOpen();
          int openEditorLimit = EditorUtils.getOpenEditorLimit();
          IWorkbenchWindow wWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
          IWorkbenchPage page = wWindow != null ? wWindow.getActivePage() : null;

          if (page != null) {
            for (int i = 0; i < bookmarksToOpenOnStartup.size() && i < openEditorLimit; i++) {
              try {
                IBookMark bookMarkToOpen = bookmarksToOpenOnStartup.get(i);
                page.openEditor(new FeedViewInput(bookMarkToOpen), FeedView.ID, activateEditor);
              } catch (PartInitException e) {
                Activator.getDefault().getLog().log(e.getStatus());
              }
            }
          }
View Full Code Here

        return globalScope.getBoolean(DefaultPreferences.USE_DEFAULT_EXTERNAL_BROWSER) || globalScope.getBoolean(DefaultPreferences.USE_CUSTOM_EXTERNAL_BROWSER);
      }

      private void openInternal(URL url) throws PartInitException {
        WebBrowserInput input = new WebBrowserInput(url.toExternalForm());
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null)
          fBrowserView = page.openEditor(input, WebBrowserView.EDITOR_ID);
      }

      private void openExternal(URL url) {
        BrowserUtils.openLink(url.toExternalForm());
      }

      /*
       * @see org.eclipse.ui.browser.IWebBrowser#close()
       */
      public boolean close() {
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null && fBrowserView != null)
          page.closeEditor(fBrowserView, false);

        return true;
      }

      /*
 
View Full Code Here

        if (useExternalBrowser())
          return;

        /* Open Browser in new Tab */
        WebBrowserInput input = new WebBrowserInput(URIUtils.ABOUT_BLANK);
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null) {
          try {
            WebBrowserView browserView = (WebBrowserView) page.openEditor(input, WebBrowserView.EDITOR_ID, OpenStrategy.activateOnOpen());
            event.browser = browserView.getBrowser().getControl();
          } catch (PartInitException e) {
            Activator.getDefault().getLog().log(e.getStatus());
          }
        }
View Full Code Here

        if (useExternalBrowser())
          return;

        /* Open Browser in new Tab */
        WebBrowserInput input = new WebBrowserInput(URIUtils.ABOUT_BLANK);
        IWorkbenchPage page = OwlUI.getPage();
        if (page != null) {
          try {
            WebBrowserView browserView = (WebBrowserView) page.openEditor(input, WebBrowserView.EDITOR_ID, OpenStrategy.activateOnOpen());
            event.browser = browserView.getBrowser().getControl();
          } catch (PartInitException e) {
            Activator.getDefault().getLog().log(e.getStatus());
          }
        }
View Full Code Here

      close();
      return;
    }

    /* Otherwise open Feedview and select the News */
    IWorkbenchPage page = OwlUI.getPage();
    if (page != null) {
      Shell shell = page.getWorkbenchWindow().getShell();

      /* Restore from Tray or Minimization if required */
      ApplicationWorkbenchWindowAdvisor advisor = ApplicationWorkbenchAdvisor.fgPrimaryApplicationWorkbenchWindowAdvisor;
      if (advisor != null && advisor.isMinimizedToTray())
        advisor.restoreFromTray(shell);
      else if (shell.getMinimized()) {
        shell.setMinimized(false);
        shell.forceActive();
      }

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

      /* Otherwise Open */
      else {
View Full Code Here

      /* This is an IMark being dropped - display it */
      if (obj instanceof IMark) {
        IMark mark = ((IMark) obj);
        try {
          IWorkbenchPage page = OwlUI.getPageAtCursor();
          if (page != null) {
            page.openEditor(new FeedViewInput(mark), FeedView.ID, activateEditor);
            openedEditors++;
          }
        } catch (PartInitException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
View Full Code Here

      else if (fType == NavigationActionType.PREVIOUS_TAB)
        tab = editors.get(index - 1 >= 0 ? index - 1 : editors.size() - 1).getEditor(true);

      /* Activate */
      if (tab != null) {
        IWorkbenchPage page = tab.getSite().getPage();
        page.activate(tab.getSite().getPart());
        page.activate(tab);
      }
    }
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.