Class AbstractWorkingSetPage
- All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage
,org.eclipse.jface.dialogs.IMessageProvider
,org.eclipse.jface.wizard.IWizardPage
,org.eclipse.ui.dialogs.IWorkingSetPage
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
Modifier and TypeFieldDescriptionprotected static final org.eclipse.core.runtime.IAdaptable[]
A zero-length array of the runtime typeIAdaptable[]
.Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
-
Constructor Summary
ConstructorDescriptionAbstractWorkingSetPage
(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 TypeMethodDescriptionprotected 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
finish()
protected static org.eclipse.core.runtime.IAdaptable[]
getAdaptables
(Object[] elements) Given an array, selects theIAdaptable
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 pointorg.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_ELEMENTSA zero-length array of the runtime typeIAdaptable[]
.
-
-
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 (notnull
)title
- the title for this wizard page, ornull
if nonetitleImage
- the image descriptor for the title of this wizard page, ornull
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 benull
or empty
-
createControl
public void createControl(org.eclipse.swt.widgets.Composite parent) - Specified by:
createControl
in interfaceorg.eclipse.jface.dialogs.IDialogPage
-
finish
public void finish()- Specified by:
finish
in interfaceorg.eclipse.ui.dialogs.IWorkingSetPage
-
getSelection
public org.eclipse.ui.IWorkingSet getSelection()- Specified by:
getSelection
in interfaceorg.eclipse.ui.dialogs.IWorkingSetPage
-
setSelection
public void setSelection(org.eclipse.ui.IWorkingSet workingSet) - Specified by:
setSelection
in interfaceorg.eclipse.ui.dialogs.IWorkingSetPage
-
getPageId
Returns the page id as specified in the extension pointorg.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 (nevernull
)
-
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 (nevernull
)
-
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()
usingadaptElements(IAdaptable[])
and sets the result as the current selection for the tree viewer.- Parameters:
tree
- the tree viewer (nevernull
)
-
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 toIWorkingSet.adaptElements(IAdaptable[])
.- Parameters:
objects
- the objects to transform (nevernull
)- Returns:
- an array of transformed elements that may be empty if no elements
from the original array are suitable (not
null
)
-
getAdaptables
Given an array, selects theIAdaptable
elements.- Parameters:
elements
- notnull
- Returns:
- an array of the
IAdaptable
elements selected from the given array (nevernull
)
-
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, ornull
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()
usingadaptElements(IAdaptable[])
.- Parameters:
workingSet
- the working set to configure, ornull
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, ornull
if it does not yet existelements
- the elements explicitly selected by the user (nevernull
)- Returns:
- the elements to ultimately set into the working set
(not
null
)
-