Class AbstractWorkingSetElementAdapter
- java.lang.Object
-
- org.eclipse.handly.ui.workingset.AbstractWorkingSetElementAdapter
-
- All Implemented Interfaces:
org.eclipse.ui.IWorkingSetElementAdapter
public abstract class AbstractWorkingSetElementAdapter extends java.lang.Object implements org.eclipse.ui.IWorkingSetElementAdapter
A partial implementation ofIWorkingSetElementAdapter
.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 theorg.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
Constructors Constructor Description AbstractWorkingSetElementAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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 theadaptElements(IWorkingSet, IAdaptable[])
method.
-
-
-
Method Detail
-
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
protected void postProcess(java.util.Collection<org.eclipse.core.runtime.IAdaptable> result)
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
)
-
-