public abstract class AbstractCachingStructuredReferenceProvider extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider implements IStructuredReferenceProvider
IStructuredReferenceProvider
, which supports
caching of StructuredReference per Referenced Context.Constructor and Description |
---|
AbstractCachingStructuredReferenceProvider()
Constructor
|
AbstractCachingStructuredReferenceProvider(boolean useFastCompareForSupportingSRefs)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addSupportingStructuredReference(java.lang.Object referencedContext,
StructuredReference structRef,
StructuredReference supportingStructRef) |
protected void |
cleanup()
Perform a cleanup by polling the reference queue.
|
protected abstract StructuredReference |
constructStructuredReference(java.lang.Object referencedContext,
java.lang.Object domainElement)
Constructs a new StructuredReference for the specified
domainElement |
protected StructuredReference |
constructStructuredReference(java.lang.Object referencedContext,
java.lang.String sRefFragment)
Construct a StructuredReference for the specified serialized form of the StructuredReference.
|
protected IStructuredReferenceModifier |
getModifier()
Returns the IStructuredReferenceModifier for this StructuredReferenceHandler.
|
StructuredReference |
getStructuredReference(java.lang.Object referencedContext,
java.lang.Object domainElement)
Gets the StructuredReference for the specified domain element.
|
StructuredReference |
getStructuredReference(java.lang.Object referencedContext,
java.lang.String structRefString)
Gets the StructuredReference for the specified serialized form of the StructuredReference.
|
protected StructuredReference |
getStructuredReference(java.lang.Object referencedContext,
StructuredReference newStructRef)
Returns the StructuredReference from the cache if one exists, else returns
newStructRef |
protected java.util.Map |
getStructuredReferencesCache(java.lang.Object referencedContext)
Returns the cache of Structured References given a
referencedContext |
boolean |
provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) |
protected void |
putStructuredReferencesCache(java.lang.Object referencedContext,
java.util.Map referenceCache)
Puts a new Structured Reference in the cache for specified
referencedContext |
protected void |
removeSupportingStructuredReference(java.lang.Object referencedContext,
StructuredReference structRef,
int index) |
protected void |
removeSupportingStructuredReference(java.lang.Object referencedContext,
StructuredReference structRef,
StructuredReference supportingStructRef) |
protected void |
setProperty(java.lang.Object referencedContext,
StructuredReference structRef,
java.lang.String name,
java.lang.String value) |
void |
setStructuredReferenceModifier(IStructuredReferenceModifier modifier)
Sets the
IStructuredReferenceModifier |
protected void |
uncache(java.lang.Object referencedContext,
StructuredReference structRefKey)
Removes the specified
StructuredReference from the cache corresponding to referencedContext |
protected void |
verifyCache(java.lang.Object referencedContext,
StructuredReference newStructRef,
java.lang.String oldKey)
Verifies the consistency of the cache
|
addProviderChangeListener, fireProviderChange, removeProviderChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addProviderChangeListener, removeProviderChangeListener
getInfo, resolveToDomainElement
public AbstractCachingStructuredReferenceProvider()
public AbstractCachingStructuredReferenceProvider(boolean useFastCompareForSupportingSRefs)
useFastCompareForSupportingSRefs
- true to enable fast comparison,
supported when supporting SRef list is ordered and would contain
identical objects, i.e. supporting SRefs must be of the same instance.
When false, default collection comparison, typically the equals() method,
will take place.protected java.util.Map getStructuredReferencesCache(java.lang.Object referencedContext)
referencedContext
referencedContext
- Context in which this reference will be used, usually an instance of TransactionalEditingDomainprotected void putStructuredReferencesCache(java.lang.Object referencedContext, java.util.Map referenceCache)
referencedContext
referencedContext
- Context in which this reference will be used, usually an instance of TransactionalEditingDomainreferenceCache
- A new cache for specified referencedContext
public StructuredReference getStructuredReference(java.lang.Object referencedContext, java.lang.Object domainElement)
StructuredReference
by invoking
constructStructuredReference(Object, Object)
, and returns the newly created StructuredReference
or an equal one from the cache.getStructuredReference
in interface IStructuredReferenceHandler
referencedContext
- Context in which this reference will be used, usually an instance of TransactionalEditingDomaindomainElement
- Domain Element for which the StructuredReference is requesteddomainElement
public StructuredReference getStructuredReference(java.lang.Object referencedContext, java.lang.String structRefString)
StructuredReference
if one already exists in the cachegetStructuredReference
in interface IStructuredReferenceHandler
referencedContext
- Context in which this reference will be used, usually an instance of TransactionalEditingDomainstructRefString
- serialized form of the StructuredReferencesRefString
protected StructuredReference getStructuredReference(java.lang.Object referencedContext, StructuredReference newStructRef)
newStructRef
newStructRef
- corresponding to the structRefStringStructuredReference
equal to specified StructuredReference or the specified StructuredReference.protected abstract StructuredReference constructStructuredReference(java.lang.Object referencedContext, java.lang.Object domainElement)
domainElement
domainElement
- Domain Element for which the StructuredReference is requested.public void setStructuredReferenceModifier(IStructuredReferenceModifier modifier)
IStructuredReferenceModifier
setStructuredReferenceModifier
in interface IStructuredReferenceHandler
modifier
- the IStructuredReferenceModifier to setprotected IStructuredReferenceModifier getModifier()
protected void uncache(java.lang.Object referencedContext, StructuredReference structRefKey)
StructuredReference
from the cache corresponding to referencedContext
referencedContext
- Context in which this reference will be used, usually an instance of TransactionalEditingDomainstructRefKey
- StructuredReference to be removed from the cacheprotected final StructuredReference constructStructuredReference(java.lang.Object referencedContext, java.lang.String sRefFragment)
sRefFragment
- serialized form of the StructuredReferenceprotected void cleanup()
protected void verifyCache(java.lang.Object referencedContext, StructuredReference newStructRef, java.lang.String oldKey)
protected void addSupportingStructuredReference(java.lang.Object referencedContext, StructuredReference structRef, StructuredReference supportingStructRef)
protected void removeSupportingStructuredReference(java.lang.Object referencedContext, StructuredReference structRef, int index)
protected void removeSupportingStructuredReference(java.lang.Object referencedContext, StructuredReference structRef, StructuredReference supportingStructRef)
protected void setProperty(java.lang.Object referencedContext, StructuredReference structRef, java.lang.String name, java.lang.String value)
public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation)
provides
in interface org.eclipse.gmf.runtime.common.core.service.IProvider