Class AbstractWorkingSetPage

java.lang.Object
org.eclipse.jface.dialogs.DialogPage
org.eclipse.jface.wizard.WizardPage
org.eclipse.handly.ui.workingset.AbstractWorkingSetPage
All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.wizard.IWizardPage, org.eclipse.ui.dialogs.IWorkingSetPage

public abstract class AbstractWorkingSetPage extends org.eclipse.jface.wizard.WizardPage implements org.eclipse.ui.dialogs.IWorkingSetPage
A partial implementation of IWorkingSetPage. A tree viewer on the left is used to show the workspace content, a table viewer on the right is used to show the working set content. Buttons to move content from right to left and vice versa are available between the two viewers. A text field allows to set/change the working set name.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final org.eclipse.core.runtime.IAdaptable[]
    A zero-length array of the runtime type IAdaptable[].

    Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider

    ERROR, INFORMATION, NONE, WARNING
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractWorkingSetPage(String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage)
    Creates a new wizard page with the given name, title, and image.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.eclipse.core.runtime.IAdaptable[]
    adaptElements(org.eclipse.core.runtime.IAdaptable[] objects)
    Transforms the supplied elements into elements that are suitable for containment in the working set configured by this page.
    protected abstract void
    configureTable(org.eclipse.jface.viewers.TableViewer table)
    Configures the table viewer on the right side of this page.
    protected abstract void
    configureTree(org.eclipse.jface.viewers.TreeViewer tree)
    Configures the tree viewer on the left side of this page.
    void
    createControl(org.eclipse.swt.widgets.Composite parent)
     
    void
     
    protected static org.eclipse.core.runtime.IAdaptable[]
    getAdaptables(Object[] elements)
    Given an array, selects the IAdaptable elements.
    protected org.eclipse.core.runtime.IAdaptable[]
    getFinalWorkingSetElements(org.eclipse.ui.IWorkingSet workingSet, org.eclipse.core.runtime.IAdaptable[] elements)
    Returns the elements that are to be set into the working set configured by this page.
    protected final org.eclipse.jface.viewers.IStructuredSelection
    Returns the selection used as a basis for the initial state of this page.
    protected org.eclipse.core.runtime.IAdaptable[]
    getInitialWorkingSetElements(org.eclipse.ui.IWorkingSet workingSet)
    Returns the elements that are to be shown in the table viewer initially.
    protected abstract String
    Returns the page id as specified in the extension point org.eclipse.ui.workingSets.
    org.eclipse.ui.IWorkingSet
     
    protected void
    initializeTreeSelection(org.eclipse.jface.viewers.TreeViewer tree)
    Computes and sets the initial selection for the tree viewer.
    void
    setInitialSelection(org.eclipse.jface.viewers.IStructuredSelection selection)
    Sets the selection used as a basis for the initial state of this page.
    void
    setSelection(org.eclipse.ui.IWorkingSet workingSet)
     

    Methods inherited from class org.eclipse.jface.wizard.WizardPage

    canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString

    Methods inherited from class org.eclipse.jface.dialogs.DialogPage

    convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessage, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage

    dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible

    Methods inherited from interface org.eclipse.jface.wizard.IWizardPage

    canFlipToNextPage, getMinimumPageSize, getName, getNextPage, getPreviousPage, getWizard, isPageComplete, setPreviousPage, setWizard
  • Field Details

    • NO_ELEMENTS

      protected static final org.eclipse.core.runtime.IAdaptable[] NO_ELEMENTS
      A zero-length array of the runtime type IAdaptable[].
  • Constructor Details

    • AbstractWorkingSetPage

      public AbstractWorkingSetPage(String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage)
      Creates a new wizard page with the given name, title, and image.
      Parameters:
      pageName - the name of the page (not null)
      title - the title for this wizard page, or null if none
      titleImage - the image descriptor for the title of this wizard page, or null if none
  • Method Details

    • setInitialSelection

      public void setInitialSelection(org.eclipse.jface.viewers.IStructuredSelection selection)
      Sets the selection used as a basis for the initial state of this page.
      Parameters:
      selection - may be null or empty
    • createControl

      public void createControl(org.eclipse.swt.widgets.Composite parent)
      Specified by:
      createControl in interface org.eclipse.jface.dialogs.IDialogPage
    • finish

      public void finish()
      Specified by:
      finish in interface org.eclipse.ui.dialogs.IWorkingSetPage
    • getSelection

      public org.eclipse.ui.IWorkingSet getSelection()
      Specified by:
      getSelection in interface org.eclipse.ui.dialogs.IWorkingSetPage
    • setSelection

      public void setSelection(org.eclipse.ui.IWorkingSet workingSet)
      Specified by:
      setSelection in interface org.eclipse.ui.dialogs.IWorkingSetPage
    • getPageId

      protected abstract String getPageId()
      Returns the page id as specified in the extension point org.eclipse.ui.workingSets.
      Returns:
      the page id
    • configureTree

      protected abstract void configureTree(org.eclipse.jface.viewers.TreeViewer tree)
      Configures the tree viewer on the left side of this page.

      Implementors must set:

      • The content provider
      • The label provider
      • The viewer input

      They may also set:

      • The viewer comparator
      • Any viewer filter

      Note that the initial selection is set in initializeTreeSelection(TreeViewer), which is called right after this method.

      Parameters:
      tree - the tree viewer to configure (never null)
    • configureTable

      protected abstract void configureTable(org.eclipse.jface.viewers.TableViewer table)
      Configures the table viewer on the right side of this page.

      Implementors must set:

      • The label provider

      They may also set:

      • The viewer comparator

      They must not set:

      • The content provider
      • The viewer input
      • Any viewer filter
      Parameters:
      table - the table viewer to configure (never null)
    • getInitialSelection

      protected final org.eclipse.jface.viewers.IStructuredSelection getInitialSelection()
      Returns the selection used as a basis for the initial state of this page.
      Returns:
      a selection (may be null or empty)
    • initializeTreeSelection

      protected void initializeTreeSelection(org.eclipse.jface.viewers.TreeViewer tree)
      Computes and sets the initial selection for the tree viewer.

      If the working set that will be configured by this page exists, this implementation adapts the elements from getInitialSelection() using adaptElements(IAdaptable[]) and sets the result as the current selection for the tree viewer.

      Parameters:
      tree - the tree viewer (never null)
    • adaptElements

      protected org.eclipse.core.runtime.IAdaptable[] adaptElements(org.eclipse.core.runtime.IAdaptable[] objects)
      Transforms the supplied elements into elements that are suitable for containment in the working set configured by this page.

      This implementation creates a temporary working set, sets its id to getPageId(), and delegates to IWorkingSet.adaptElements(IAdaptable[]).

      Parameters:
      objects - the objects to transform (never null)
      Returns:
      an array of transformed elements that may be empty if no elements from the original array are suitable (not null)
    • getAdaptables

      protected static org.eclipse.core.runtime.IAdaptable[] getAdaptables(Object[] elements)
      Given an array, selects the IAdaptable elements.
      Parameters:
      elements - not null
      Returns:
      an array of the IAdaptable elements selected from the given array (never null)
    • getInitialWorkingSetElements

      protected org.eclipse.core.runtime.IAdaptable[] getInitialWorkingSetElements(org.eclipse.ui.IWorkingSet workingSet)
      Returns the elements that are to be shown in the table viewer initially. Returns an empty array if the table viewer should be initially empty. The given working set is the working set that will be configured by this page, or null if it does not yet exist.

      This implementation returns the elements contained in the working set or, if the working set does not yet exist, the elements adapted from getInitialSelection() using adaptElements(IAdaptable[]).

      Parameters:
      workingSet - the working set to configure, or null if it does not yet exist
      Returns:
      the elements to show in the table viewer (not null)
    • getFinalWorkingSetElements

      protected org.eclipse.core.runtime.IAdaptable[] getFinalWorkingSetElements(org.eclipse.ui.IWorkingSet workingSet, org.eclipse.core.runtime.IAdaptable[] elements)
      Returns the elements that are to be set into the working set configured by this page.

      This implementation returns the given elements unchanged.

      Parameters:
      workingSet - the working set to configure, or null if it does not yet exist
      elements - the elements explicitly selected by the user (never null)
      Returns:
      the elements to ultimately set into the working set (not null)