Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchWindow


    /**
     * @return current active editor in workbench
     */
    public static IEditorPart getActiveEditor() {
        IWorkbenchWindow window = BytecodeOutlinePlugin.getDefault()
            .getWorkbench().getActiveWorkbenchWindow();
        if (window != null) {
            IWorkbenchPage page = window.getActivePage();
            if (page != null) {
                return page.getActiveEditor();
            }
        }
        return null;
View Full Code Here


        }
        org.eclipse.core.resources.IFile newFile = createNewFile();
        if (newFile == null)
            return false;
        try {
            IWorkbenchWindow dwindow = workbench.getActiveWorkbenchWindow();
            org.eclipse.ui.IWorkbenchPage page = dwindow.getActivePage();
            if (page != null)
                IDE.openEditor(page, newFile, true);
        } catch (PartInitException e) {
            DroolsIDEPlugin.log(e);
            return false;
View Full Code Here

    }


    public void dispose()
    {
        IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if ( ww != null )
        {
            ww.getPartService().removePartListener( partListener );
            EventRegistry.removeEntryUpdateListener( entryUpdateListener );
        }
    }
View Full Code Here

                return true;
            }
        };

        IFormPage page = (IFormPage) getManagedForm().getContainer();
        IWorkbenchWindow window = page.getEditorSite().getWorkbenchWindow();

        // Prepare the package lister from the Java project
        IProject project = ResourceUtil.getResource(page.getEditorInput()).getProject();
        IJavaProject javaProject = JavaCore.create(project);

        IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] {
            javaProject
        });
        JavaSearchScopePackageLister packageLister = new JavaSearchScopePackageLister(searchScope, window);

        // Create and open the dialog
        PackageSelectionDialog dialog = new PackageSelectionDialog(window.getShell(), packageLister, filter, "Select new packages to export from the bundle.");
        dialog.setSourceOnly(true);
        dialog.setMultipleSelection(true);
        if (dialog.open() == Window.OK) {
            Object[] results = dialog.getResult();
            added = new LinkedList<ExportedPackage>();
View Full Code Here

   *
   * @see org.eclipse.ui.application.WorkbenchAdvisor#createEmptyWindowContents(org.eclipse.ui.application.IWorkbenchWindowConfigurer,
   *      org.eclipse.swt.widgets.Composite)
   */
  public Control createEmptyWindowContents(Composite parent) {
    final IWorkbenchWindow window = getWindowConfigurer().getWindow();
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    Display display = composite.getDisplay();
    Color bgCol = display
        .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
View Full Code Here

                            throw new InvocationTargetException(e);
                        }
                    }
                };

                IWorkbenchWindow window = ((IFormPage) getManagedForm().getContainer()).getEditorSite().getWorkbenchWindow();
                window.run(false, false, runnable);
                return result;
            } catch (InvocationTargetException e) {
                logger.logError("Error searching for BundleActivator types", e.getTargetException());
                return Collections.emptyList();
            } catch (InterruptedException e) {
View Full Code Here

    boolean promptOnExit = store
        .getBoolean(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW);

    if (promptOnExit) {
      if (parentShell == null) {
        IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (workbenchWindow != null) {
          parentShell = workbenchWindow.getShell();
        }
      }
      if (parentShell != null) {
        parentShell.setMinimized(false);
        parentShell.forceActive();
View Full Code Here

   * [currentPerspective -] [editorInput -] [workspaceLocation -] productName
   * @param editorHidden TODO
   */
  private void updateTitle(boolean editorHidden) {
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    IWorkbenchWindow window = configurer.getWindow();
    IEditorPart activeEditor = null;
    IWorkbenchPage currentPage = window.getActivePage();
    IPerspectiveDescriptor persp = null;
    IAdaptable input = null;

    if (currentPage != null) {
      activeEditor = currentPage.getActiveEditor();
View Full Code Here

   *
   * @see org.eclipse.ui.application.WorkbenchAdvisor#postWindowRestore
   */
  public void postWindowRestore() throws WorkbenchException {
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    IWorkbenchWindow window = configurer.getWindow();

    int index = getWorkbench().getWorkbenchWindowCount() - 1;

    AboutInfo[] welcomePerspectiveInfos = wbAdvisor
        .getWelcomePerspectiveInfos();
    if (index >= 0 && welcomePerspectiveInfos != null
        && index < welcomePerspectiveInfos.length) {
      // find a page that exist in the window
      IWorkbenchPage page = window.getActivePage();
      if (page == null) {
        IWorkbenchPage[] pages = window.getPages();
        if (pages != null && pages.length > 0) {
          page = pages[0];
        }
      }

      // if the window does not contain a page, create one
      String perspectiveId = welcomePerspectiveInfos[index]
          .getWelcomePerspectiveId();
      if (page == null) {
        IAdaptable root = wbAdvisor.getDefaultPageInput();
        page = window.openPage(perspectiveId, root);
      } else {
        IPerspectiveRegistry reg = getWorkbench()
            .getPerspectiveRegistry();
        IPerspectiveDescriptor desc = reg
            .findPerspectiveWithId(perspectiveId);
        if (desc != null) {
          page.setPerspective(desc);
        }
      }

      // set the active page and open the welcome editor
      window.setActivePage(page);
      page.openEditor(new WelcomeEditorInput(
          welcomePerspectiveInfos[index]), WELCOME_EDITOR_ID, true);
    }
    cleanUpEditorArea();
  }
View Full Code Here

      // Something is wrong, there should be at least
      // one workbench window open by now.
      return;
    }

    IWorkbenchWindow win = window;
    if (perspectiveId != null) {
      try {
        win = getWorkbench().openWorkbenchWindow(perspectiveId,
            wbAdvisor.getDefaultPageInput());
        if (win == null) {
          win = window;
        }
      } catch (WorkbenchException e) {
        IDEWorkbenchPlugin
            .log(
                "Error opening window with welcome perspective.", e.getStatus()); //$NON-NLS-1$
        return;
      }
    }

    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,
              IDEWorkbenchMessages.Workbench_openEditorErrorDialogMessage,
              e.getStatus());
    }
    return;
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IWorkbenchWindow

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.