Class DiagnosticCache
- java.lang.Object
-
- org.eclipse.emf.ecp.common.spi.cachetree.AbstractCachedTree<org.eclipse.emf.common.util.Diagnostic>
-
- org.eclipse.emfforms.spi.swt.treemasterdetail.diagnostic.DiagnosticCache
-
- Direct Known Subclasses:
EcoreDiagnosticCache
public class DiagnosticCache extends AbstractCachedTree<org.eclipse.emf.common.util.Diagnostic>
Cache for diagnostic results.- Since:
- 1.10
- Author:
- Johannes Faltermeier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDiagnosticCache.ValidationListenerNotified when the validation changes.
-
Constructor Summary
Constructors Constructor Description DiagnosticCache(org.eclipse.emf.common.notify.Notifier input)Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected CachedTreeNode<org.eclipse.emf.common.util.Diagnostic>createdCachedTreeNode(org.eclipse.emf.common.util.Diagnostic value)Creates a cached tree node.voidderegisterValidationListener(DiagnosticCache.ValidationListener listener)voiddispose()Disposes this cache.org.eclipse.emf.common.util.DiagnosticgetDefaultValue()Returns the default value for a cached node.
The root value will be initialized with this value, tooprotected static org.eclipse.emf.common.util.DiagnosticgetDiagnostic(java.lang.Object object)Validate given object and return the result of the validation.java.util.Set<java.lang.Object>getObjects()org.eclipse.emf.common.util.DiagnosticgetOwnValue(java.lang.Object o)protected voidhandleRemove(org.eclipse.emf.ecore.EObject object, DiagnosticCache cache)Remove the given object from the cache.protected booleanisInitializing()Queries whether the cache is in the process of initializing itself.protected voidnotifyValidationListeners(java.util.Set<org.eclipse.emf.ecore.EObject> updatedObjects, boolean potentialStructuralChange)Notify the registered validation listeners that a validation occurred.voidregisterValidationListener(DiagnosticCache.ValidationListener listener)voidreinit(org.eclipse.emf.common.notify.Notifier notifier)Does a reinit of this cache if the given notifier is different than the current one.protected voidupdateCache(java.util.Set<org.eclipse.emf.ecore.EObject> elements, DiagnosticCache cache)Updates the cache and notifies listeners that this was a potential structure change.protected voidupdateCache(org.eclipse.emf.ecore.EObject element, DiagnosticCache cache)Deprecated.please useupdateCache(Set, DiagnosticCache)insteadprotected voidupdateCacheWithoutRefresh(java.util.Set<org.eclipse.emf.ecore.EObject> elements, DiagnosticCache cache)Updates the cache and notifes listeners that this change was not a structure change.protected voidupdateCacheWithoutRefresh(org.eclipse.emf.ecore.EObject element, DiagnosticCache cache)Deprecated.please useupdateCacheWithoutRefresh(Set, DiagnosticCache)insteadprotected voidupdateParentNode(java.lang.Object parent, java.lang.Object object, org.eclipse.emf.common.util.Diagnostic value)Updates the passed parent nodes cached value.-
Methods inherited from class org.eclipse.emf.ecp.common.spi.cachetree.AbstractCachedTree
clear, getCachedValue, getNodes, getRootValue, remove, update, updateNodeObject
-
-
-
-
Method Detail
-
isInitializing
protected final boolean isInitializing()
Queries whether the cache is in the process of initializing itself. This is useful to avoid doing redundant work, such as back-tracking up an EMF containment tree to update parents that have already been covered during the initialization.- Returns:
- whether the cache is in the process of initializations
- Since:
- 1.17
-
getDefaultValue
public org.eclipse.emf.common.util.Diagnostic getDefaultValue()
Description copied from class:AbstractCachedTreeReturns the default value for a cached node.
The root value will be initialized with this value, too- Specified by:
getDefaultValuein classAbstractCachedTree<org.eclipse.emf.common.util.Diagnostic>- Returns:
- the default value for a cached tree node
-
createdCachedTreeNode
protected CachedTreeNode<org.eclipse.emf.common.util.Diagnostic> createdCachedTreeNode(org.eclipse.emf.common.util.Diagnostic value)
Description copied from class:AbstractCachedTreeCreates a cached tree node.- Specified by:
createdCachedTreeNodein classAbstractCachedTree<org.eclipse.emf.common.util.Diagnostic>- Parameters:
value- the value stored by the cached tree node- Returns:
- the created node
-
updateParentNode
protected void updateParentNode(java.lang.Object parent, java.lang.Object object, org.eclipse.emf.common.util.Diagnostic value)Description copied from class:AbstractCachedTreeUpdates the passed parent nodes cached value.- Overrides:
updateParentNodein classAbstractCachedTree<org.eclipse.emf.common.util.Diagnostic>- Parameters:
parent- the parent object to be updatedobject- the object for which the cached value should be changed.value- the the cached value for the object- Since:
- 1.17
-
getObjects
public java.util.Set<java.lang.Object> getObjects()
- Returns:
- the objects with cached values.
-
getOwnValue
public org.eclipse.emf.common.util.Diagnostic getOwnValue(java.lang.Object o)
- Parameters:
o- the object- Returns:
- the objects diagnostic
-
dispose
public void dispose()
Disposes this cache.
-
reinit
public void reinit(org.eclipse.emf.common.notify.Notifier notifier)
Does a reinit of this cache if the given notifier is different than the current one.- Parameters:
notifier- the notifier
-
registerValidationListener
public void registerValidationListener(DiagnosticCache.ValidationListener listener)
- Parameters:
listener- theDiagnosticCache.ValidationListenerto register
-
deregisterValidationListener
public void deregisterValidationListener(DiagnosticCache.ValidationListener listener)
- Parameters:
listener- theDiagnosticCache.ValidationListenerto deregister
-
updateCache
@Deprecated protected void updateCache(org.eclipse.emf.ecore.EObject element, DiagnosticCache cache)Deprecated.please useupdateCache(Set, DiagnosticCache)insteadUPdates the cache and notifies listeners that this was a potential structure change.- Parameters:
element- the changed elementcache- the cache
-
updateCache
protected void updateCache(java.util.Set<org.eclipse.emf.ecore.EObject> elements, DiagnosticCache cache)Updates the cache and notifies listeners that this was a potential structure change.- Parameters:
elements- the changed elementscache- the cache- Since:
- 1.25
-
handleRemove
protected void handleRemove(org.eclipse.emf.ecore.EObject object, DiagnosticCache cache)Remove the given object from the cache.- Parameters:
object- the EObject to removecache- the DiagnosticCache from which the object should be removed- Since:
- 1.25
-
getDiagnostic
protected static org.eclipse.emf.common.util.Diagnostic getDiagnostic(java.lang.Object object)
Validate given object and return the result of the validation.- Parameters:
object- the object to validate- Returns:
- the validation result
- Since:
- 1.25
-
notifyValidationListeners
protected void notifyValidationListeners(java.util.Set<org.eclipse.emf.ecore.EObject> updatedObjects, boolean potentialStructuralChange)Notify the registered validation listeners that a validation occurred.- Parameters:
updatedObjects- the objects that changedpotentialStructuralChange- whether the validation was caused by a structural change- Since:
- 1.25
-
updateCacheWithoutRefresh
@Deprecated protected void updateCacheWithoutRefresh(org.eclipse.emf.ecore.EObject element, DiagnosticCache cache)Deprecated.please useupdateCacheWithoutRefresh(Set, DiagnosticCache)insteadUpdates the cache and notifes listeners that this change was not a structure change.- Parameters:
element- the elementcache- the cache
-
updateCacheWithoutRefresh
protected void updateCacheWithoutRefresh(java.util.Set<org.eclipse.emf.ecore.EObject> elements, DiagnosticCache cache)Updates the cache and notifes listeners that this change was not a structure change.- Parameters:
elements- the elementscache- the cache- Since:
- 1.25
-
-