Package org.eclipse.handly.ui.workingset
Class AbstractWorkingSetUpdater
java.lang.Object
org.eclipse.handly.ui.workingset.AbstractWorkingSetUpdater
- All Implemented Interfaces:
org.eclipse.ui.IWorkingSetUpdater
public abstract class AbstractWorkingSetUpdater
extends Object
implements org.eclipse.ui.IWorkingSetUpdater
An almost complete implementation of
IWorkingSetUpdater
for Handly-based models. Updates element working sets on
element change events. Subclasses need to implement a couple
of abstract methods for subscription to change notifications
in the underlying model.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classUtility class used to help process element change events. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of the working set updater. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.eclipse.ui.IWorkingSet workingSet) protected abstract voidRegisters the given element change listener with the underlying model.protected voidcheckElementExistence(org.eclipse.ui.IWorkingSet workingSet) Removes elements that do not exist anymore from the given working set, except for elements under closed projects.booleancontains(org.eclipse.ui.IWorkingSet workingSet) voiddispose()protected IContentAdapterReturns the content adapter that defines a mapping between elements of a Handly-based model and the working set's content.protected voidBuilds a working set delta by recursively processing the given element delta.protected voidprocessResourceDelta(org.eclipse.core.resources.IResourceDelta delta, AbstractWorkingSetUpdater.WorkingSetDelta result) Builds a working set delta by recursively processing the given resource delta.booleanremove(org.eclipse.ui.IWorkingSet workingSet) protected abstract voidRemoves the given element change listener from the underlying model.
-
Constructor Details
-
AbstractWorkingSetUpdater
public AbstractWorkingSetUpdater()Creates a new instance of the working set updater. This constructorregistersan element change listener that updates the content of each of thecontainedworking sets bybuildingand applying a working set delta.It is the client responsibility to
disposethe created instance after it is no longer needed.
-
-
Method Details
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.eclipse.ui.IWorkingSetUpdater
-
add
public void add(org.eclipse.ui.IWorkingSet workingSet) This implementation invokes
checkElementExistence(IWorkingSet)before adding the working set to this updater.- Specified by:
addin interfaceorg.eclipse.ui.IWorkingSetUpdater
-
remove
public boolean remove(org.eclipse.ui.IWorkingSet workingSet) - Specified by:
removein interfaceorg.eclipse.ui.IWorkingSetUpdater
-
contains
public boolean contains(org.eclipse.ui.IWorkingSet workingSet) - Specified by:
containsin interfaceorg.eclipse.ui.IWorkingSetUpdater
-
addElementChangeListener
Registers the given element change listener with the underlying model.- Parameters:
listener- nevernull
-
removeElementChangeListener
Removes the given element change listener from the underlying model.- Parameters:
listener- nevernull
-
getContentAdapter
Returns the content adapter that defines a mapping between elements of a Handly-based model and the working set's content.Default implementation returns a
NullContentAdapter. Subclasses may override.- Returns:
- an
IContentAdapter(nevernull)
-
processElementDelta
protected void processElementDelta(IElementDelta delta, AbstractWorkingSetUpdater.WorkingSetDelta result) Builds a working set delta by recursively processing the given element delta. Delegates the processing of resource deltas contained in the element delta toprocessResourceDelta(IResourceDelta, WorkingSetDelta). Uses thecontent adapterto convertIElements to working set elements.- Parameters:
delta- an element delta (nevernull)result- the working set delta being built (nevernull)
-
processResourceDelta
protected void processResourceDelta(org.eclipse.core.resources.IResourceDelta delta, AbstractWorkingSetUpdater.WorkingSetDelta result) Builds a working set delta by recursively processing the given resource delta.- Parameters:
delta- a resource delta (nevernull)result- the working set delta being built (nevernull)
-
checkElementExistence
protected void checkElementExistence(org.eclipse.ui.IWorkingSet workingSet) Removes elements that do not exist anymore from the given working set, except for elements under closed projects. Uses thecontent adapterto adapt working set elements that are notIResources toIElements.- Parameters:
workingSet- nevernull
-