本文整理汇总了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);
}