Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchPage


    if (win == null) {
      win = getWorkbench().getWorkbenchWindows()[0];
    }

    IWorkbenchPage page = win.getActivePage();
    String id = perspectiveId;
    if (id == null) {
      id = getWorkbench().getPerspectiveRegistry()
          .getDefaultPerspective();
    }

    if (page == null) {
      try {
        page = win.openPage(id, wbAdvisor.getDefaultPageInput());
      } catch (WorkbenchException e) {
        ErrorDialog.openError(win.getShell(),
            IDEWorkbenchMessages.Problems_Opening_Page, e
                .getMessage(), e.getStatus());
      }
    }
    if (page == null) {
      return;
    }

    if (page.getPerspective() == null) {
      try {
        page = getWorkbench().showPerspective(id, win);
      } catch (WorkbenchException e) {
        ErrorDialog
            .openError(
                win.getShell(),
                IDEWorkbenchMessages.Workbench_openEditorErrorDialogTitle,
                IDEWorkbenchMessages.Workbench_openEditorErrorDialogMessage,
                e.getStatus());
        return;
      }
    }

    page.setEditorAreaVisible(true);

    // see if we already have an editor
    IEditorPart editor = page.findEditor(input);
    if (editor != null) {
      page.activate(editor);
      return;
    }

    try {
      page.openEditor(input, WELCOME_EDITOR_ID);
    } catch (PartInitException e) {
      ErrorDialog
          .openError(
              win.getShell(),
              IDEWorkbenchMessages.Workbench_openEditorErrorDialogTitle,
View Full Code Here


        if (window == null)
          return;
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(path));
        IFileInfo fetchInfo = fileStore.fetchInfo();
        if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
          IWorkbenchPage page = window.getActivePage();
          if (page == null) {
            String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_noWindow, path);
            MessageDialog.open(MessageDialog.ERROR, window.getShell(),
                IDEWorkbenchMessages.OpenDelayedFileAction_title,
                msg, SWT.SHEET);
View Full Code Here

    private static IStatusLineManager getStatusLineManager() {
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (activeWorkbenchWindow==null) {
            return null;
        }
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage==null) {
            return null;
        }
        IEditorPart activeEditor = activePage.getActiveEditor();
        if (activeEditor!=null) {
            return activeEditor.getEditorSite().getActionBars().getStatusLineManager();
        }
        IViewReference[] viewRefs = activePage.getViewReferences();
        if (viewRefs!=null) {
            for (int i = 0; i < viewRefs.length; i++) {
                IViewReference aViewRef = viewRefs[i];
                IViewPart view = aViewRef.getView(false);
                if (view!=null) {
                    return view.getViewSite().getActionBars().getStatusLineManager();
                }
            }
        }
        IEditorReference[] editorRefs = activePage.getEditorReferences();
        if (editorRefs!=null) {
            for (int i = 0; i < editorRefs.length; i++) {
                IEditorReference anEditorRef = editorRefs[i];
                IEditorPart editor = anEditorRef.getEditor(false);
                if (editor!=null) {
                    return editor.getEditorSite().getActionBars().getStatusLineManager();
                }
            }
        }
        IWorkbenchPart activePart = activePage.getActivePart();
        if (activePart==null) {
            return null;
        }
        IWorkbenchPartSite site = activePart.getSite();
        if (site instanceof IEditorSite) {
View Full Code Here

                    String editorId = LdifEditor.getId();

                    try
                    {
                        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                        IWorkbenchPage page = window.getActivePage();
                        IEditorPart editor = page.openEditor( input, editorId );
                        IDocumentProvider documentProvider = ( ( LdifEditor ) editor ).getDocumentProvider();
                        if ( documentProvider != null && input != null )
                        {
                            IDocument document = documentProvider.getDocument( input );
                            if ( document != null )
View Full Code Here

    {
        IEditorInput input = new NonExistingLdifEditorInput();
        String editorId = LdifEditor.getId();
        try
        {
            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
            page.openEditor( input, editorId );
        }
        catch ( PartInitException e )
        {
        }
    }
View Full Code Here

    if( getWorkbenchWindow() == null )
    {
      return null;
    }

    IWorkbenchPage activePage= getWorkbenchWindow().getActivePage();
    if (activePage != null)
    {
      IEditorPart activeEditor = activePage.getActiveEditor();

      return activeEditor;
    }

    return null;
View Full Code Here

        public void linkActivated(HyperlinkEvent e) {
            IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
            FileEditorInput input = new FileEditorInput(file);

            try {
                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                page.openEditor(input, "bndtools.bndWorkspaceConfigEditor", true);
            } catch (PartInitException ex) {
                ErrorDialog.openError(getSection().getShell(), "Error", "Unable to open editor", ex.getStatus());
            }
        }
View Full Code Here

        // Open editor on new file.
        IWorkbenchWindow dw = workbench.getActiveWorkbenchWindow();
        try {
            if (dw != null) {
                IWorkbenchPage page = dw.getActivePage();
                if (page != null) {
                    IDE.openEditor(page, file, true);
                }
            }
        } catch (PartInitException e) {
View Full Code Here

        theController);
    addListeners();
  }

  private void addListeners() {
    IWorkbenchPage page = getWorkbenchPage();
    page.addSelectionListener(selectionListener);
    page.addPartListener(partListener);
  }
View Full Code Here

  public void dispose() {
      removeListeners();
  }

  private void removeListeners() {
    IWorkbenchPage page = getWorkbenchPage();
    page.removePostSelectionListener(selectionListener);
    page.removePartListener(partListener);
  }   
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.