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
        OwlUI.openInFeedView(page, new StructuredSelection(fSearchmark));
View Full Code Here


            /* Disable Tabbed Browsing */
            if (tabbedBrowsingEnabled) {

              /* Close other Tabs if necessary */
              boolean doit = true;
              IWorkbenchPage page = OwlUI.getPage();
              if (page != null) {
                IEditorReference[] editorReferences = page.getEditorReferences();
                if (editorReferences.length > 1) {
                  MessageBox confirmDialog = new MessageBox(page.getWorkbenchWindow().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                  confirmDialog.setText(Messages.ApplicationActionBarAdvisor_DISABLE_TABBED_BROWSING);
                  confirmDialog.setMessage(NLS.bind(Messages.ApplicationActionBarAdvisor_TABS_MESSAGE, editorReferences.length));
                  if (confirmDialog.open() == SWT.YES)
                    OwlUI.closeOtherEditors();
                  else
                    doit = false;
                }
              }

              /* Update Preferences */
              if (doit) {
                eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_MULTIPLE_TABS, false);
                eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS, true);
                eclipsePrefs.putInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD, 1);
              }
            }

            /* Enable Tabbed Browsing */
            else {
              eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_MULTIPLE_TABS, true);
              eclipsePrefs.putBoolean(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS, false);
              eclipsePrefs.putInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD, 5);
            }
          }

          @Override
          public boolean isChecked() {
            boolean autoCloseTabs = eclipsePrefs.getBoolean(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS);
            int autoCloseTabsThreshold = eclipsePrefs.getInteger(DefaultPreferences.ECLIPSE_AUTOCLOSE_TABS_THRESHOLD);
            return !autoCloseTabs || autoCloseTabsThreshold > 1;
          }
        });

        manager.add(layoutMenu);

        /* Zoom (In, Out, Reset) */
        final MenuManager zoomMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_ZOOM);
        zoomMenu.setRemoveAllWhenShown(true);
        zoomMenu.addMenuListener(new IMenuListener() {
          public void menuAboutToShow(IMenuManager manager) {
            FeedView activeFeedView = OwlUI.getActiveFeedView();
            final boolean isZoomingEnabled = (activeFeedView != null && activeFeedView.isBrowserShowingNews());

            /* Zoom In */
            zoomMenu.add(new Action(Messages.ApplicationActionBarAdvisor_ZOOM_IN) {
              @Override
              public void run() {
                OwlUI.zoomNewsText(true, false);
              }

              @Override
              public String getId() {
                return "org.rssowl.ui.ZoomInCommand"; //$NON-NLS-1$
              }

              @Override
              public String getActionDefinitionId() {
                return "org.rssowl.ui.ZoomInCommand"; //$NON-NLS-1$
              }

              @Override
              public boolean isEnabled() {
                return isZoomingEnabled;
              }
            });

            /* Zoom Out */
            zoomMenu.add(new Action(Messages.ApplicationActionBarAdvisor_ZOOM_OUT) {
              @Override
              public void run() {
                OwlUI.zoomNewsText(false, false);
              }

              @Override
              public String getId() {
                return "org.rssowl.ui.ZoomOutCommand"; //$NON-NLS-1$
              }

              @Override
              public String getActionDefinitionId() {
                return "org.rssowl.ui.ZoomOutCommand"; //$NON-NLS-1$
              }

              @Override
              public boolean isEnabled() {
                return isZoomingEnabled;
              }
            });

            /* Reset */
            zoomMenu.add(new Separator());
            zoomMenu.add(new Action(Messages.ApplicationActionBarAdvisor_RESET) {
              @Override
              public void run() {
                OwlUI.zoomNewsText(false, true);
              }

              @Override
              public String getId() {
                return "org.rssowl.ui.ZoomResetCommand"; //$NON-NLS-1$
              }

              @Override
              public String getActionDefinitionId() {
                return "org.rssowl.ui.ZoomResetCommand"; //$NON-NLS-1$
              }

              @Override
              public boolean isEnabled() {
                return isZoomingEnabled;
              }
            });
          }
        });

        manager.add(zoomMenu);

        /* Toggle State of Toolbar Visibility */
        manager.add(new Separator());
        manager.add(new Action(Messages.ApplicationActionBarAdvisor_TOOLBAR, IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.fgPrimaryApplicationWorkbenchWindowAdvisor;

            boolean isToolBarVisible = preferences.getBoolean(DefaultPreferences.SHOW_TOOLBAR);
            configurer.setToolBarVisible(!isToolBarVisible, true);
            preferences.putBoolean(DefaultPreferences.SHOW_TOOLBAR, !isToolBarVisible);
          }

          @Override
          public boolean isChecked() {
            return preferences.getBoolean(DefaultPreferences.SHOW_TOOLBAR);
          }
        });

        /* Toggle State of Status Bar Visibility */
        manager.add(new Action(Messages.ApplicationActionBarAdvisor_STATUS, IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.fgPrimaryApplicationWorkbenchWindowAdvisor;

            boolean isStatusVisible = preferences.getBoolean(DefaultPreferences.SHOW_STATUS);
            configurer.setStatusVisible(!isStatusVisible, true);
            preferences.putBoolean(DefaultPreferences.SHOW_STATUS, !isStatusVisible);
          }

          @Override
          public boolean isChecked() {
            return preferences.getBoolean(DefaultPreferences.SHOW_STATUS);
          }
        });

        /* Toggle State of Bookmarks Visibility */
        manager.add(new Action(Messages.ApplicationActionBarAdvisor_BOOKMARKS, IAction.AS_CHECK_BOX) {
          @Override
          public void run() {
            OwlUI.toggleBookmarks();
          }

          @Override
          public String getActionDefinitionId() {
            return "org.rssowl.ui.ToggleBookmarksCommand"; //$NON-NLS-1$
          }

          @Override
          public String getId() {
            return "org.rssowl.ui.ToggleBookmarksCommand"; //$NON-NLS-1$
          }

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

            return false;
          }
        });

View Full Code Here

     */
    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

     *      <code>true</code> if one or more single-tab entry editor is (are) open,
     *      <code>false</code> if not.
     */
    private boolean isOneOrMoreOpenSingleTabEntryEditors()
    {
        IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        for ( IEditorReference ref : activePage.getEditorReferences() )
        {
            IWorkbenchPart part = ref.getPart( false );
            if ( part != null && part instanceof IEntryEditor )
            {
                IEntryEditor editor = ( IEntryEditor ) part;
View Full Code Here

     */
    private void closeEditorsBelongingToConnection( Connection connection )
    {
        if ( connection != null )
        {
            IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

            // Collecting editor references to close
            List<IEditorReference> editorReferences = new ArrayList<IEditorReference>();
            for ( IEditorReference ref : activePage.getEditorReferences() )
            {
                IEntryEditor editor = getEntryEditor( ref );
                if ( editor != null && editor.getEntryEditorInput().getResolvedEntry() != null )
                {
                    IBrowserConnection bc = editor.getEntryEditorInput().getResolvedEntry().getBrowserConnection();
                    if ( connection.equals( bc.getConnection() ) )
                    {
                        editorReferences.add( ref );
                    }
                }
            }

            // Closing the corresponding editor references
            if ( editorReferences.size() > 0 )
            {
                activePage.closeEditors( editorReferences.toArray( new IEditorReference[0] ), false );
            }
        }
    }
View Full Code Here

                    serverConfiguration = serverXmlIO.parse( ApacheDSConfigurationPlugin.class
                        .getResourceAsStream( "default-server-1.5.5.xml" ) ); //$NON-NLS-1$
                    break;
            }

            IWorkbenchPage page = window.getActivePage();
            page.openEditor( new NonExistingServerConfigurationInput( serverConfiguration ),
                ServerConfigurationEditor.ID );
        }
        catch ( PartInitException e )
        {
            return false;
View Full Code Here

                    IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                    Object element = selection.getFirstElement();
                    if (element instanceof IAdaptable) {
                        URI uri = (URI) ((IAdaptable) element).getAdapter(URI.class);
                        if (uri != null) {
                            IWorkbenchPage page = getSite().getPage();
                            try {
                                IFileStore fileStore = EFS.getLocalFileSystem().getStore(uri);
                                IDE.openEditorOnFileStore(page, fileStore);
                            } catch (PartInitException e) {
                                logger.logError("Error opening editor for " + uri, e);
View Full Code Here

        .addPropertyChangeListener(propertyChangeListener);
  }

  private String computeTitle() {
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    IWorkbenchPage currentPage = configurer.getWindow().getActivePage();
    IEditorPart activeEditor = null;
    if (currentPage != null) {
      activeEditor = lastActiveEditor;
    }

    String title = null;
    IProduct product = Platform.getProduct();
    if (product != null) {
      title = product.getName();
    }
    if (title == null) {
      title = ""; //$NON-NLS-1$
    }

    if (currentPage != null) {
      if (activeEditor != null) {
        lastEditorTitle = activeEditor.getTitleToolTip();
        title = NLS.bind(
            IDEWorkbenchMessages.WorkbenchWindow_shellTitle,
            lastEditorTitle, title);
      }
      IPerspectiveDescriptor persp = currentPage.getPerspective();
      String label = ""; //$NON-NLS-1$
      if (persp != null) {
        label = persp.getLabel();
      }
      IAdaptable input = currentPage.getInput();
      if (input != null && !input.equals(wbAdvisor.getDefaultPageInput())) {
        label = currentPage.getLabel();
      }
      if (label != null && !label.equals("")) { //$NON-NLS-1$
        title = NLS.bind(
            IDEWorkbenchMessages.WorkbenchWindow_shellTitle, label,
            title);
View Full Code Here

   */
  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();
      persp = currentPage.getPerspective();
      input = currentPage.getInput();
    }
   
    if (editorHidden) {
      activeEditor = null;
    }
View Full Code Here

    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

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.