Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchPage


    }
  }

  public static IEditorPart openFile(IFile file) throws CoreException {
    IEditorPart result = null;
    IWorkbenchPage page = getCurrentPage();
    IMarker marker;
    marker = file.createMarker(IMarker.TEXT);
    result = IDE.openEditor(page, marker);
    marker.delete();
    return result;
View Full Code Here


    }
    FilesAccess.goToLine(editorPart, i);
  }

  public static void createAndOpen(IFile file, String content, FileType type) {
    IWorkbenchPage page = getCurrentPage();
    try {
      byte[] bytes = content.getBytes("UTF-8");
      InputStream source = new ByteArrayInputStream(bytes);
      // make sure the parents are there -- bran
      prepareFolder((IFolder) file.getParent());
View Full Code Here

  }

  private static IWorkbenchPage getCurrentPage() {
    IWorkbench wb = PlatformUI.getWorkbench();
    IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
    IWorkbenchPage page = win.getActivePage();
    return page;
  }
View Full Code Here

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    // Get the view
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
    IWorkbenchPage page = window.getActivePage();
    MeclipseView view = (MeclipseView) page.findView(MeclipseView.ID);
    // Get the selection
    IStructuredSelection selection = (IStructuredSelection) view
        .getViewer().getSelection();

    if (selection != null && selection instanceof IStructuredSelection) {
      Collection obj = (Collection) selection.getFirstElement();
      // If we had a selection lets open the editor
      if (obj != null) {
        CollectionEditorInput input = new CollectionEditorInput(obj);
        try {
          page.openEditor(input, CollectionEditor.ID);

        } catch (PartInitException e) {
          System.out.println(e.getStackTrace());
        }
      }
View Full Code Here

      if (renameAction != null) {
        renameAction.update(selection);
      }
    } else {
      if (activeWindow != null) {
        IWorkbenchPage activePage = activeWindow.getActivePage();
        if (activePage != null) {
          IWorkbenchPart activePart = activePage.getActivePart();
          if (activePart != null) {
            IWorkbenchPartSite activeSite = activePart.getSite();
            if (activeSite != null) {
              if (renameAction.getSite() != activeSite) {
                init(activeWindow);
View Full Code Here

      if (extractAction != null) {
        extractAction.update(selection);
      }
    } else {
      if (activeWindow != null) {
        IWorkbenchPage activePage = activeWindow.getActivePage();
        if (activePage != null) {
          IWorkbenchPart activePart = activePage.getActivePart();
          if (activePart != null) {
            IWorkbenchPartSite activeSite = activePart.getSite();
            if (activeSite != null) {
              if (extractAction.getSite() != activeSite) {
                init(activeWindow);
View Full Code Here

  }

  private void showTestabilityView() {
    Display.getDefault().asyncExec(new Runnable() {
      public void run() {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        try {
          IViewPart viewPart = page.showView("com.google.test.metric.eclipse.ui.testabilityView");
        } catch (PartInitException e) {
          logger.logException("Error initializing Testability View", e);
        }
      }
    });
View Full Code Here

  }

  private void showHtmlReportView(final File reportDirectory) {
    Display.getDefault().asyncExec(new Runnable() {
      public void run() {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        try {
          IViewPart viewPart = page.showView("com.google.test.metric.eclipse.ui.browserview");
          if (viewPart instanceof TestabilityReportView) {
            ((TestabilityReportView) viewPart).setUrl(reportDirectory.getAbsolutePath()
                + "/" + TestabilityConstants.HTML_REPORT_FILENAME);
          }
        } catch (PartInitException e) {
View Full Code Here

    private ISearchPageContainer getContainer() {
        return fContainer;
    }

    private IEditorPart getActiveEditor() {
        final IWorkbenchPage activePage = ErlideUIPlugin.getActivePage();
        if (activePage != null) {
            return activePage.getActiveEditor();
        }
        return null;
    }
View Full Code Here

                }
            }
            folder.refreshLocal(IResource.DEPTH_ONE, null);

            final IFile fileToOpen = header;
            final IWorkbenchPage page = PlatformUI.getWorkbench()
                    .getActiveWorkbenchWindow().getActivePage();
            IDE.openEditor(page, fileToOpen);
        } catch (final CoreException e) {
            ErlLogger.error(e);
        }
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.