public abstract class AbstractWorkingSetUpdater
extends java.lang.Object
implements org.eclipse.ui.IWorkingSetUpdater
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.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractWorkingSetUpdater.WorkingSetDelta
Utility class used to help process element change events.
|
| Constructor and Description |
|---|
AbstractWorkingSetUpdater()
Creates a new instance of the working set updater.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.eclipse.ui.IWorkingSet workingSet) |
protected abstract void |
addElementChangeListener(IElementChangeListener listener)
Registers the given element change listener with the underlying model.
|
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.
|
boolean |
contains(org.eclipse.ui.IWorkingSet workingSet) |
void |
dispose() |
protected IContentAdapter |
getContentAdapter()
Returns the content adapter that defines a mapping between elements
of a Handly-based model and the working set's content.
|
protected void |
processElementDelta(IElementDelta delta,
AbstractWorkingSetUpdater.WorkingSetDelta result)
Builds a working set delta by recursively processing the given
element delta.
|
protected void |
processResourceDelta(org.eclipse.core.resources.IResourceDelta delta,
AbstractWorkingSetUpdater.WorkingSetDelta result)
Builds a working set delta by recursively processing the given
resource delta.
|
boolean |
remove(org.eclipse.ui.IWorkingSet workingSet) |
protected abstract void |
removeElementChangeListener(IElementChangeListener listener)
Removes the given element change listener from the underlying model.
|
public AbstractWorkingSetUpdater()
registers an element change listener that updates the content of each
of the contained working sets by building and
applying a working set delta.
It is the client responsibility to dispose
the created instance after it is no longer needed.
public void dispose()
dispose in interface org.eclipse.ui.IWorkingSetUpdaterpublic void add(org.eclipse.ui.IWorkingSet workingSet)
This implementation invokes checkElementExistence(IWorkingSet)
before adding the working set to this updater.
add in interface org.eclipse.ui.IWorkingSetUpdaterpublic boolean remove(org.eclipse.ui.IWorkingSet workingSet)
remove in interface org.eclipse.ui.IWorkingSetUpdaterpublic boolean contains(org.eclipse.ui.IWorkingSet workingSet)
contains in interface org.eclipse.ui.IWorkingSetUpdaterprotected abstract void addElementChangeListener(IElementChangeListener listener)
listener - never nullprotected abstract void removeElementChangeListener(IElementChangeListener listener)
listener - never nullprotected IContentAdapter getContentAdapter()
Default implementation returns a NullContentAdapter.
Subclasses may override.
IContentAdapter (never null)protected void processElementDelta(IElementDelta delta, AbstractWorkingSetUpdater.WorkingSetDelta result)
processResourceDelta(IResourceDelta,
WorkingSetDelta). Uses the content adapter
to convert IElements to working set elements.delta - an element delta (never null)result - the working set delta being built (never null)protected void processResourceDelta(org.eclipse.core.resources.IResourceDelta delta,
AbstractWorkingSetUpdater.WorkingSetDelta result)
delta - a resource delta (never null)result - the working set delta being built (never null)protected void checkElementExistence(org.eclipse.ui.IWorkingSet workingSet)
content adapter to adapt working set elements
that are not IResources to IElements.workingSet - never nullCopyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0