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.IWorkingSetElementAdapterA 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
elementAdapterClassattribute of theorg.eclipse.ui.workingSetsextension 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.IAdaptableadaptFromResource(org.eclipse.core.resources.IResource resource)Attempts to adapt the given resource to the corresponding element of the underlying model.voiddispose()protected abstract booleanisModelElement(org.eclipse.core.runtime.IAdaptable element)Returns whether the given element is native to the underlying model.protected voidpostProcess(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
nativeto 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-processesthe result set before returning it.- Specified by:
adaptElementsin interfaceorg.eclipse.ui.IWorkingSetElementAdapter
-
dispose
public void dispose()
- Specified by:
disposein 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:
trueif the given element is native to the model, andfalseotherwise
-
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)
-
-