public abstract class AbstractWorkingSetElementAdapter
extends java.lang.Object
implements 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 and Description |
---|
AbstractWorkingSetElementAdapter() |
Modifier and Type | Method and Description |
---|---|
org.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(java.util.Collection<org.eclipse.core.runtime.IAdaptable> result)
Post-processes the collection of elements to be returned from
the
adaptElements(IWorkingSet, IAdaptable[]) method. |
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 an IResource
, the resource is passed to the adaptFromResource(IResource)
method and the result is then added to
the result set. Lastly, this implementation post-processes
the result set before returning it.
adaptElements
in interface org.eclipse.ui.IWorkingSetElementAdapter
public void dispose()
dispose
in interface org.eclipse.ui.IWorkingSetElementAdapter
protected abstract boolean isModelElement(org.eclipse.core.runtime.IAdaptable element)
element
- never null
true
if the given element is native to the model,
and false
otherwiseprotected abstract org.eclipse.core.runtime.IAdaptable adaptFromResource(org.eclipse.core.resources.IResource resource)
resource
- never null
protected void postProcess(java.util.Collection<org.eclipse.core.runtime.IAdaptable> result)
adaptElements(IWorkingSet, IAdaptable[])
method.
Default implementation does nothing. Subclasses may override.
result
- the collection of elements to post-process
(never null
)Copyright (c) 2014, 2019 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0