public class BasicDetailViewCache extends Object implements DetailViewCache
DetailViewCache
that uses the EClass
as the key.DETAIL_VIEW_CACHE_SIZE, EMPTY
Constructor and Description |
---|
BasicDetailViewCache()
Creates a cache with maximal 5 entries.
|
BasicDetailViewCache(int maxEntries)
Creates a cache with a custom number of maximal entries.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cacheView(ECPSWTView ecpView)
Caches the provided
ECPSWTView 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createCache
public BasicDetailViewCache()
public BasicDetailViewCache(int maxEntries)
maxEntries
- The number of maximal entries to cachepublic boolean isCached(org.eclipse.emf.ecore.EObject selection)
DetailViewCache
isCached
in interface DetailViewCache
selection
- The new master object selectiontrue
if there is a cached view for the provided selection
; false
otherwisepublic ECPSWTView getCachedView(org.eclipse.emf.ecore.EObject selection)
DetailViewCache
getCachedView
in interface DetailViewCache
selection
- The new master object selectionnull
if none is cachedDetailViewCache.isCached(EObject)
public boolean cacheView(ECPSWTView ecpView)
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.
cacheView
in interface DetailViewCache
ecpView
- the ECPSWTView
to cachetrue
if the view was added to the cache; false
otherwise (in which
case it would be disposed)public void clear()
DetailViewCache
clear
in interface DetailViewCache
Copyright © 2019. All rights reserved.