|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.dialogs.DialogPage
org.eclipse.jface.wizard.WizardPage
de.cau.cs.kieler.core.ui.wizards.ResourceTreeAndListPage
public abstract class ResourceTreeAndListPage
A wizard page that displays a checked tree and a checked list, as well as a
source group, target group and an options group. This can be seen as a more
flexible version of org.eclipse.ui.dialogs.WizardResourceImportPage
.
This class is intended to be subclassed by clients.
To customize the tree and list views, subclasses may override diverse methods
that return a content provider, label provider, comparator and filters. To
set the input that should be fed into the tree's content provider, call
setResourceTreeInput(Object)
. The list's content provider's input
is automatically set to the element currently selected in the tree.
The source group, if present, usually provides a way to select some kind of
source directory, often also providing a history of previously entered values.
You can use createDefaultSourceGroup(Composite, String, String)
to
have a default source group with a combo box and a browse button created.
The target group, if present, usually provides a way to select some kind of
target container or directory, often also providing a history of previously
selected values. As with the source group, you can use
createDefaultTargetGroup(Composite, String, String)
to have a default
target group with a combo box and a browse button created.
The button bar, if present, usually provides a way to select and deselect all
list items. By default, such a group is created. Subclasses can change this
by overriding createButtonBar(Composite)
.
Finally, the options group, if present, usually allows the user to influence some parameters of the actions to be performed. There is no way to have a default options group created, since there is no way to know which options might be needed.
There are currently two specializations of this class. FileSystemResourcesPage
specializes in file system imports while WorkspaceResourcesPage
specializes in workspace imports.
Field Summary |
---|
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider |
---|
ERROR, INFORMATION, NONE, WARNING |
Constructor Summary | |
---|---|
protected |
ResourceTreeAndListPage(String pageName)
Constructs a new instance with the given name. |
Method Summary | |
---|---|
protected void |
applyNewSource(String text)
Called when the source group combo loses focus. |
protected void |
applyNewTarget(String text)
Called when the target group combo loses focus. |
protected Composite |
createButtonBar(Composite parent)
Creates the button bar. |
void |
createControl(Composite parent)
|
protected Composite |
createDefaultSourceGroup(Composite parent,
String labelText,
String browseButtonText)
Creates a default version of the source group consisting of a label, a combo box and a browse button. |
protected Composite |
createDefaultTargetGroup(Composite parent,
String labelText,
String browseButtonText)
Creates a default version of the target group consisting of a label, a combo box and a browse button. |
protected abstract Composite |
createOptionsGroup(Composite parent)
Creates the options group. |
protected abstract Composite |
createSourceGroup(Composite parent)
Creates the source group. |
protected abstract Composite |
createTargetGroup(Composite parent)
Creates the target group. |
protected void |
deselectAllListItems()
Deselects all the list items currently shown. |
protected void |
doBrowseSource()
Called when the source group browse button is clicked. |
protected void |
doBrowseTarget()
Called when the target group browse button is clicked. |
protected boolean |
doValidate()
Validates the page. |
protected ITreeContentProvider |
getResourceListContentProvider()
Returns the content provider to be used for the resource list. |
protected ViewerFilter[] |
getResourceListFilters()
Returns the viewer filters to be used for the resource list. |
protected ILabelProvider |
getResourceListLabelProvider()
Returns the label provider to be used for the resource list. |
protected ViewerComparator |
getResourceListViewerComparator()
Returns the viewer comparator to be used for the resource list. |
protected ITreeContentProvider |
getResourceTreeContentProvider()
Returns the content provider to be used for the resource tree. |
protected ViewerFilter[] |
getResourceTreeFilters()
Returns the viewer filters to be used for the resource tree. |
protected ILabelProvider |
getResourceTreeLabelProvider()
Returns the label provider to be used for the resource tree. |
protected ViewerComparator |
getResourceTreeViewerComparator()
Returns the viewer comparator to be used for the resource tree. |
Collection<Object> |
getSelectedElements(IProgressMonitor monitor)
Returns a list of selected elements. |
protected Button |
getSourceGroupBrowseButton()
Returns the source group's browse button, if the source group was created using createDefaultSourceGroup(Composite, String, String) . |
protected Combo |
getSourceGroupCombo()
Returns the source group's combo box, if the source group was created using createDefaultSourceGroup(Composite, String, String) . |
protected Button |
getTargetGroupBrowseButton()
Returns the target group's browse button, if the target group was created using createDefaultTargetGroup(Composite, String, String) . |
protected Combo |
getTargetGroupCombo()
Returns the target group's combo box, if the target group was created using createDefaultTargetGroup(Composite, String, String) . |
protected void |
initializeControls()
Called after the controls were created and the settings restored. |
boolean |
isAnythingSelected()
Checks if there is anything selected. |
protected void |
restoreDialogSettings()
Restores the user's saved input. |
void |
saveDialogSettings()
Saves the user's input. |
protected void |
selectAllListItems()
Selects all the list items currently shown. |
protected boolean |
selectAndRevealElement(Object element,
boolean listElement)
Tries to find the given element and selects it, as well as expanding the path leading to it. |
protected void |
setResourceTreeInput(Object newInput)
Sets the resource tree's input and validates the page. |
protected void |
validate()
Validates this page. |
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, getMessage, getTitle, performHelp, setVisible |
Constructor Detail |
---|
protected ResourceTreeAndListPage(String pageName)
pageName
- the page's name.Method Detail |
---|
public final Collection<Object> getSelectedElements(IProgressMonitor monitor)
monitor
- progress monitor. May be null
.
null
is returned.public final void createControl(Composite parent)
protected void initializeControls()
protected ITreeContentProvider getResourceTreeContentProvider()
BaseWorkbenchContentProvider
.
protected ILabelProvider getResourceTreeLabelProvider()
WorkbenchLabelProvider
.
protected ViewerComparator getResourceTreeViewerComparator()
WorkbenchViewerComparator
.
protected ViewerFilter[] getResourceTreeFilters()
Note: This could be made more flexible to allow changeing the list of active filters after creation.
protected ITreeContentProvider getResourceListContentProvider()
BaseWorkbenchContentProvider
.
protected ILabelProvider getResourceListLabelProvider()
WorkbenchLabelProvider
.
protected ViewerComparator getResourceListViewerComparator()
WorkbenchViewerComparator
.
protected ViewerFilter[] getResourceListFilters()
Note: This could be made more flexible to allow changeing the list of active filters after creation.
protected final void setResourceTreeInput(Object newInput)
newInput
- the new input object for the resource tree.public final boolean isAnythingSelected()
true
if anything is selected.protected final void selectAllListItems()
protected final void deselectAllListItems()
protected abstract Composite createSourceGroup(Composite parent)
Subclasses may call createDefaultSourceGroup(Composite, String, String)
to have a default source group with a label, a combo box and a browse
button created. In this case, it should also implement applyNewSource(String)
and doBrowseSource()
. While access to the combo box and the browse
button shouldn't normally be necessary, they can be retrieved using
getSourceGroupCombo()
and getSourceGroupBrowseButton()
.
parent
- the new source group's parent.
null
if none should be shown.protected final Composite createDefaultSourceGroup(Composite parent, String labelText, String browseButtonText)
createSourceGroup(Composite)
for
further details.
parent
- the parent composite.labelText
- the label's text.browseButtonText
- the browse button's text.
protected void applyNewSource(String text)
After this method was called, validate()
is called automatically.
text
- the combo's current text.protected void doBrowseSource()
After this method was called, validate()
is called automatically.
protected final Combo getSourceGroupCombo()
createDefaultSourceGroup(Composite, String, String)
.
protected final Button getSourceGroupBrowseButton()
createDefaultSourceGroup(Composite, String, String)
.
protected Composite createButtonBar(Composite parent)
parent
- the new button bar's parent.
null
if none should be shown.protected abstract Composite createTargetGroup(Composite parent)
Subclasses may call createDefaultTargetGroup(Composite, String, String)
to have a default target group with a label, a combo box and a browse
button created. In this case, it should also implement applyNewTarget(String)
and doBrowseTarget()
. While access to the combo box and the browse
button shouldn't normally be necessary, they can be retrieved using
getTargetGroupCombo()
and getTargetGroupBrowseButton()
.
parent
- the new target group's parent.
null
if none should be shown.protected final Composite createDefaultTargetGroup(Composite parent, String labelText, String browseButtonText)
createTargetGroup(Composite)
for
further details.
parent
- the parent composite.labelText
- the label's text.browseButtonText
- the browse button's text.
protected void applyNewTarget(String text)
After this method was called, validate()
is called automatically.
text
- the combo's current text.protected void doBrowseTarget()
After this method was called, validate()
is called automatically.
protected final Combo getTargetGroupCombo()
createDefaultTargetGroup(Composite, String, String)
.
protected final Button getTargetGroupBrowseButton()
createDefaultTargetGroup(Composite, String, String)
.
protected abstract Composite createOptionsGroup(Composite parent)
parent
- the new options group's parent.
null
if none should be shown.protected final void validate()
doValidate()
. If the
page validates fine, any error message set is cleared.
protected boolean doValidate()
true
.
true
if the page validates fine and the page is complete,
false
otherwise.public void saveDialogSettings()
protected void restoreDialogSettings()
protected final boolean selectAndRevealElement(Object element, boolean listElement)
There is one condition that must be met for this to work: The tree content provider must be able to return the element's ancestors without them having been visited before. This especially means that the tree content provider must know what to do with the element.
element
- the element to select and reveal.listElement
- true
if this is an element in the resource
list, false
if it is an element in the
resource tree.
true
if the element was selected, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |