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 interface
DiagnosticCache.ValidationListener
Notified 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.void
deregisterValidationListener(DiagnosticCache.ValidationListener listener)
void
dispose()
Disposes this cache.org.eclipse.emf.common.util.Diagnostic
getDefaultValue()
Returns the default value for a cached node.
The root value will be initialized with this value, tooprotected static org.eclipse.emf.common.util.Diagnostic
getDiagnostic(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.Diagnostic
getOwnValue(java.lang.Object o)
protected void
handleRemove(org.eclipse.emf.ecore.EObject object, DiagnosticCache cache)
Remove the given object from the cache.protected boolean
isInitializing()
Queries whether the cache is in the process of initializing itself.protected void
notifyValidationListeners(java.util.Set<org.eclipse.emf.ecore.EObject> updatedObjects, boolean potentialStructuralChange)
Notify the registered validation listeners that a validation occurred.void
registerValidationListener(DiagnosticCache.ValidationListener listener)
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.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.protected void
updateCache(org.eclipse.emf.ecore.EObject element, DiagnosticCache cache)
Deprecated.please useupdateCache(Set, DiagnosticCache)
insteadprotected 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.protected void
updateCacheWithoutRefresh(org.eclipse.emf.ecore.EObject element, DiagnosticCache cache)
Deprecated.please useupdateCacheWithoutRefresh(Set, DiagnosticCache)
insteadprotected void
updateParentNode(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:AbstractCachedTree
Returns the default value for a cached node.
The root value will be initialized with this value, too- Specified by:
getDefaultValue
in 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:AbstractCachedTree
Creates a cached tree node.- Specified by:
createdCachedTreeNode
in 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:AbstractCachedTree
Updates the passed parent nodes cached value.- Overrides:
updateParentNode
in 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.ValidationListener
to register
-
deregisterValidationListener
public void deregisterValidationListener(DiagnosticCache.ValidationListener listener)
- Parameters:
listener
- theDiagnosticCache.ValidationListener
to 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
-
-