Class AbstractWorkingSetElementAdapter
- All Implemented Interfaces:
org.eclipse.ui.IWorkingSetElementAdapter
IWorkingSetElementAdapter
.
Working set element adapters are capable of transforming possible working
set content into the most applicable form. Each model may opt to provide an
element adapter for its working sets via the elementAdapterClass
attribute of the org.eclipse.ui.workingSets
extension point.
The workbench will use the element adapter to help manage addition
of elements to working sets for the model.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.core.runtime.IAdaptable[]
adaptElements
(org.eclipse.ui.IWorkingSet ws, org.eclipse.core.runtime.IAdaptable[] elements) protected abstract org.eclipse.core.runtime.IAdaptable
adaptFromResource
(org.eclipse.core.resources.IResource resource) Attempts to adapt the given resource to the corresponding element of the underlying model.void
dispose()
protected abstract boolean
isModelElement
(org.eclipse.core.runtime.IAdaptable element) Returns whether the given element is native to the underlying model.protected void
postProcess
(Collection<org.eclipse.core.runtime.IAdaptable> result) Post-processes the collection of elements to be returned from theadaptElements(IWorkingSet, IAdaptable[])
method.
-
Constructor Details
-
AbstractWorkingSetElementAdapter
public AbstractWorkingSetElementAdapter()
-
-
Method Details
-
adaptElements
public org.eclipse.core.runtime.IAdaptable[] adaptElements(org.eclipse.ui.IWorkingSet ws, org.eclipse.core.runtime.IAdaptable[] elements) This implementation iterates through the given elements in order. If an element is
native
to the underlying model, it is added to a result set. Otherwise, if it could be adapted to anIResource
, the resource is passed to theadaptFromResource(IResource)
method and the result is then added to the result set. Lastly, this implementationpost-processes
the result set before returning it.- Specified by:
adaptElements
in interfaceorg.eclipse.ui.IWorkingSetElementAdapter
-
dispose
public void dispose()- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkingSetElementAdapter
-
isModelElement
protected abstract boolean isModelElement(org.eclipse.core.runtime.IAdaptable element) Returns whether the given element is native to the underlying model.- Parameters:
element
- nevernull
- Returns:
true
if the given element is native to the model, andfalse
otherwise
-
adaptFromResource
protected abstract org.eclipse.core.runtime.IAdaptable adaptFromResource(org.eclipse.core.resources.IResource resource) Attempts to adapt the given resource to the corresponding element of the underlying model.- Parameters:
resource
- nevernull
- Returns:
- the (possibly adapted) resource
-
postProcess
Post-processes the collection of elements to be returned from theadaptElements(IWorkingSet, IAdaptable[])
method.Default implementation does nothing. Subclasses may override.
- Parameters:
result
- the collection of elements to post-process (nevernull
)
-