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 java.lang.Object implements org.eclipse.ui.IWorkingSetUpdaterAn almost complete implementation ofIWorkingSetUpdaterfor 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 Classes Modifier and Type Class Description protected static classAbstractWorkingSetUpdater.WorkingSetDeltaUtility class used to help process element change events.
-
Constructor Summary
Constructors Constructor Description AbstractWorkingSetUpdater()Creates a new instance of the working set updater.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(org.eclipse.ui.IWorkingSet workingSet)protected abstract voidaddElementChangeListener(IElementChangeListener listener)Registers 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 IContentAdaptergetContentAdapter()Returns the content adapter that defines a mapping between elements of a Handly-based model and the working set's content.protected voidprocessElementDelta(IElementDelta delta, AbstractWorkingSetUpdater.WorkingSetDelta result)Builds 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 voidremoveElementChangeListener(IElementChangeListener listener)Removes the given element change listener from the underlying model.
-
-
-
Constructor Detail
-
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 Detail
-
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
protected abstract void addElementChangeListener(IElementChangeListener listener)
Registers the given element change listener with the underlying model.- Parameters:
listener- nevernull
-
removeElementChangeListener
protected abstract void removeElementChangeListener(IElementChangeListener listener)
Removes the given element change listener from the underlying model.- Parameters:
listener- nevernull
-
getContentAdapter
protected IContentAdapter 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
-
-