Class PageSwitcher


  • public abstract class PageSwitcher
    extends java.lang.Object
    Provides the implementation for switching pages in a view. A view may track pages however it wishes. The view should subclass PageSwitcher to provide the abstract methods, and then instantiate their page switcher once.
    Since:
    3.4
    • Constructor Summary

      Constructors 
      Constructor Description
      PageSwitcher​(IWorkbenchPart part)
      Register the handlers for page switching with this view or editor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void activatePage​(java.lang.Object page)
      Displays the given page in the view.
      int getCurrentPageIndex()
      Returns the index of the currently active page.
      abstract ImageDescriptor getImageDescriptor​(java.lang.Object page)
      Returns an ImageDescriptor for the page.
      abstract java.lang.String getName​(java.lang.Object page)
      Returns a readable name to identify the page.
      abstract java.lang.Object[] getPages()
      Returns the pages available in the view.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PageSwitcher

        public PageSwitcher​(IWorkbenchPart part)
        Register the handlers for page switching with this view or editor.
        Parameters:
        part - The part to register against.
    • Method Detail

      • activatePage

        public abstract void activatePage​(java.lang.Object page)
        Displays the given page in the view. The page must already exist in the view.
        Parameters:
        page - the page to display, never null.
      • getName

        public abstract java.lang.String getName​(java.lang.Object page)
        Returns a readable name to identify the page.
        Parameters:
        page - the page to get the name
        Returns:
        the name of the page
      • getPages

        public abstract java.lang.Object[] getPages()
        Returns the pages available in the view. These may be used for populating the pop-up dialog when switching pages. These are the objects that will be used in activatePage(Object).
        Returns:
        an array of pages
      • getCurrentPageIndex

        public int getCurrentPageIndex()
        Returns the index of the currently active page. The default implementation returns 0. Subclasses can override.
        Returns:
        the 0-based index of the currently active page from getPages(), or an arbitrary value if getPages() is an empty array.