public abstract class NavigatorSelectionComposite
extends java.lang.Object
implements java.beans.PropertyChangeListener
Modifier | Constructor and Description |
---|---|
|
NavigatorSelectionComposite(java.lang.String aSelectionTitle,
boolean multiselectable,
java.util.List<?> initialSelectedElements)
Constructs a new instance that will create the new composite.
|
protected |
NavigatorSelectionComposite(java.lang.String aSelectionTitle,
NavigatorSelectionModel selectionModel)
Constructs a new instance that will create the new composite.
|
Modifier and Type | Method and Description |
---|---|
void |
addTreeViewerHint(java.lang.String hintKey,
java.lang.Object hintValue)
Adds the hint to the TreeViewer.
|
org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent)
Creates the composite.
|
org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent,
org.eclipse.core.runtime.IAdaptable context)
Creates the composite.
|
protected void |
createCompositeAdditions(org.eclipse.swt.widgets.Composite parent)
The method is provided so that clients can add additional fields to the
bottom of the selection composite.
|
protected java.util.List<java.lang.String> |
getContentProviders()
To minimize the number of content providers the service uses to find
content for a particular dialog, implementations of this composite
must provider a list of ids corresponding to the extensions of
org.eclipse.wst.common.navigator.views.navigatorContent.
|
protected abstract java.lang.Object |
getInput()
Implement to provider the input for the TreeViewer.
|
int |
getLabelStyle() |
<T> java.util.List<T> |
getSelectedElements()
Gets the user selected elements.
|
NavigatorSelectionModel |
getSelectionModel()
Returns the selection model to the client if there is a selection model.
|
int |
getTreeAutoExpandLevel() |
NavigatorTreeViewer |
getTreeViewer()
Gets the navigator tree viewer.
|
org.eclipse.jface.viewers.TreeViewer |
getViewer()
Gets the tree viewer
|
void |
handleSelection(boolean isValid)
Handle a selection change, where the validity of the new selection is
encoded in
isValid . |
void |
handleSelectionChange()
Handles a selection change and validates the new selection.
|
boolean |
hasNoSelectableElements()
Tests if nothing is selectable in the tree
This method must be called after the SelectionComposite's controls have
been initialized
|
protected boolean |
isClosedResourceExpandSupported() |
protected boolean |
isDisplayable(java.lang.Object element)
Determines if the element is displayable.
|
protected boolean |
isDisplayableRuleRecursive(java.lang.Object element)
Determines if the displayable rule for the element is recursive.
|
protected boolean |
isValidSelection(java.util.List<?> currentSelectedElements)
Determines if the selected elements are a valid selection.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt) |
void |
setContextObject(java.lang.Object context)
Sets the context Object.
|
void |
setLabelStyle(int labelStyle) |
protected void |
setSelectionContext(java.lang.String context)
Set the selection context field.
|
void |
setShowTreeAlways(boolean newShowTreeAlways)
Set this to 'true' to inhibit the 'dispose' of empty trees
|
void |
setTopRightCornerControl(org.eclipse.swt.widgets.Control control)
Method used to set the top right corner control in this composite.
|
protected void |
setTreeViewerFocus() |
protected void |
setViewerEnabled()
Sets the viewer enablement to reflect the read only state in the model.
|
void |
setViewerSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
Method used to set the ViewerSorter of the tree viewer in this composite.
|
void |
updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection)
Update the selection of the viewer manually
|
public NavigatorSelectionComposite(java.lang.String aSelectionTitle, boolean multiselectable, java.util.List<?> initialSelectedElements)
aSelectionTitle
- the selection titlemultiselectable
- true
if more than one thing can be selected in
the tree, false
otherwise.initialSelectedElements
- the initial selectionprotected NavigatorSelectionComposite(java.lang.String aSelectionTitle, NavigatorSelectionModel selectionModel)
aSelectionTitle
- the selection titleselectionModel
- the Model with the initial selectionpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public NavigatorSelectionModel getSelectionModel()
public int getLabelStyle()
public void setLabelStyle(int labelStyle)
protected boolean isDisplayableRuleRecursive(java.lang.Object element)
element
- The element to testedprotected boolean isValidSelection(java.util.List<?> currentSelectedElements)
NavigatorSelectionModel.isValid()
is called.currentSelectedElements
- the selected list of Elementstrue
if the selected elements are a valid
selectionpublic void handleSelection(boolean isValid)
isValid
.isValid
- true
if the new selection is valid,
false
otherwise.protected abstract java.lang.Object getInput()
Viewer.setInput(java.lang.Object)
public void setContextObject(java.lang.Object context)
context
- protected java.util.List<java.lang.String> getContentProviders()
protected boolean isDisplayable(java.lang.Object element)
element
- The element to testedtrue
if the element is displayable; otherwise
false
public org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent)
parent
- the parent compositepublic org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.runtime.IAdaptable context)
parent
- the parent compositecontext
- the context of the compositeprotected void setTreeViewerFocus()
protected boolean isClosedResourceExpandSupported()
protected void setViewerEnabled()
protected void createCompositeAdditions(org.eclipse.swt.widgets.Composite parent)
parent
- the parent compositepublic void handleSelectionChange()
public NavigatorTreeViewer getTreeViewer()
public org.eclipse.jface.viewers.TreeViewer getViewer()
public <T> java.util.List<T> getSelectedElements()
getSelectionModel()
,
NavigatorSelectionModel.getSelection()
public void updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection)
selection
- to update the viewer withpublic boolean hasNoSelectableElements()
true
if nothing is selectablepublic void setShowTreeAlways(boolean newShowTreeAlways)
newShowTreeAlways
- public int getTreeAutoExpandLevel()
int
that is the level of auto expansion desired
by the tree control. AbstractTreeViewer.setAutoExpandLevel(int)
By default returns an exansion level of 0.public void addTreeViewerHint(java.lang.String hintKey, java.lang.Object hintValue)
hintKey
- The key of the hinthintValue
- The value of the hintprotected void setSelectionContext(java.lang.String context)
context
- The String to put in the selection context field.public void setViewerSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
sorter
- A ViewerSorter used to sort the elements in the tree.public void setTopRightCornerControl(org.eclipse.swt.widgets.Control control)
control
- A Control that will appear in the top right hand corner of this composite.