本文整理匯總了Java中org.eclipse.uml2.common.util.CacheAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java CacheAdapter類的具體用法?Java CacheAdapter怎麽用?Java CacheAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CacheAdapter類屬於org.eclipse.uml2.common.util包,在下文中一共展示了CacheAdapter類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: releaseResourceSet
import org.eclipse.uml2.common.util.CacheAdapter; //導入依賴的package包/類
private void releaseResourceSet(ResourceSet resourceSet) {
for (Iterator<Resource> i = resourceSet.getResources().iterator(); i.hasNext();) {
Resource resource = i.next();
resource.unload();
// Use the UML2 modified API
CacheAdapter.getInstance().getProxyMap().clear();
// Use the UML2 modified API
CacheAdapter.getInstance().clear(resource);
i.remove();
}
resourceSet.eAdapters().clear();
}
示例2: ExplorerSaveablesProvider
import org.eclipse.uml2.common.util.CacheAdapter; //導入依賴的package包/類
/**
* ExplorerSaveablesProvider
*/
public ExplorerSaveablesProvider() {
saveablesMap = new Hashtable<String, ExplorerSaveable>();
UMLLoginController.addLoginListener(new UMLNexcoreLoginListener() {
@Override
public void changed(UMLNexcoreLoginEvent event) {
synchronized (this) {
if (event.getType() == UMLNexcoreLoginEvent.LOG_IN) {
// do nothing
} else if (event.getType() == UMLNexcoreLoginEvent.LOG_OUT) {
if (saveablesMap != null) {
saveablesMap.clear();
}
fireSaveablesClosed(getSaveables());
}
}
}
});
EList<Adapter> cacheAdapters = DomainRegistry.getUMLDomain().getResourceSet().eAdapters();
cacheAdapters.add(new CacheAdapter(){
@Override
public void notifyChanged(Notification msg) {
super.notifyChanged(msg);
final Object notifier = msg.getNotifier();
if (notifier instanceof Resource) {
Resource r = (Resource) notifier;
switch (msg.getFeatureID(Resource.class)) {
// resourceset.getResources().remove(r) 될 때 실행됨.
case Resource.RESOURCE__RESOURCE_SET: {
if (saveablesMap != null) {
if (saveablesMap.containsKey(r.getURI().toString())) {
ExplorerSaveable saveable = saveablesMap.get(r.getURI().toString());
fireSaveablesClosed(new Saveable[] { saveable });
saveablesMap.remove(r.getURI().toString());
}
}
break;
}
}
}
}
});
}
示例3: isEnabled
import org.eclipse.uml2.common.util.CacheAdapter; //導入依賴的package包/類
public static boolean isEnabled() {
return CacheAdapter.THREAD_LOCAL != null;
}
示例4: setAdapter
import org.eclipse.uml2.common.util.CacheAdapter; //導入依賴的package包/類
private static void setAdapter(CacheHolder toRestore) {
if (!isEnabled())
return;
CustomCacheAdapter newAdapter = toRestore != null ? toRestore.getAdapter() : null;
CacheAdapter.THREAD_LOCAL.set(newAdapter);
}