Class BasicDetailViewCache
- java.lang.Object
-
- org.eclipse.emf.ecp.view.spi.swt.masterdetail.BasicDetailViewCache
-
- All Implemented Interfaces:
DetailViewCache
public class BasicDetailViewCache extends java.lang.Object implements DetailViewCache
A default implementation of theDetailViewCache
that uses theEClass
as the key.- Since:
- 1.22
-
-
Field Summary
-
Fields inherited from interface org.eclipse.emf.ecp.view.spi.swt.masterdetail.DetailViewCache
DETAIL_VIEW_CACHE_SIZE, EMPTY
-
-
Constructor Summary
Constructors Constructor Description BasicDetailViewCache()
Creates a cache with maximal 5 entries.BasicDetailViewCache(int maxEntries)
Creates a cache with a custom number of maximal entries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cacheView(ECPSWTView ecpView)
Caches the providedECPSWTView
to allow it to be reused later, if there is room for it the cache.void
clear()
Dispose all cached views, emptying the cache.ECPSWTView
getCachedView(org.eclipse.emf.ecore.EObject selection)
Returns the previously cached view for the provided selection.boolean
isCached(org.eclipse.emf.ecore.EObject selection)
Checks whether there is already a cached view available.
-
-
-
Method Detail
-
isCached
public boolean isCached(org.eclipse.emf.ecore.EObject selection)
Description copied from interface:DetailViewCache
Checks whether there is already a cached view available.- Specified by:
isCached
in interfaceDetailViewCache
- Parameters:
selection
- The new master object selection- Returns:
true
if there is a cached view for the providedselection
;false
otherwise
-
getCachedView
public ECPSWTView getCachedView(org.eclipse.emf.ecore.EObject selection)
Description copied from interface:DetailViewCache
Returns the previously cached view for the provided selection.- Specified by:
getCachedView
in interfaceDetailViewCache
- Parameters:
selection
- The new master object selection- Returns:
- the cached view, or
null
if none is cached - See Also:
DetailViewCache.isCached(EObject)
-
cacheView
public boolean cacheView(ECPSWTView ecpView)
Description copied from interface:DetailViewCache
Caches the provided
ECPSWTView
to allow it to be reused later, if there is room for it the cache.Note that a view is cached when it is no longer required, usually because another detail view is taking its place in the editor. Consequently, if the cache is size-limited and cannot actually cache the view, it must dispose that view.
- Specified by:
cacheView
in interfaceDetailViewCache
- Parameters:
ecpView
- theECPSWTView
to cache- Returns:
true
if the view was added to the cache;false
otherwise (in which case it would be disposed)
-
clear
public void clear()
Description copied from interface:DetailViewCache
Dispose all cached views, emptying the cache. The cache must still be in a state to be used (this is not a "dispose" operation).- Specified by:
clear
in interfaceDetailViewCache
-
-