@Override
protected IStatus run( IProgressMonitor monitor ) {
if (parent instanceof Map) {
Map map = (Map) parent;
boolean found = false;
SynchronizedEList adapters = (SynchronizedEList) map.getContextModel()
.eAdapters();
adapters.lock();
try {
for( Iterator<Adapter> iter = adapters.iterator(); iter.hasNext(); ) {
Adapter next = iter.next();
if (next instanceof ContextModelItemProvider
&& ((ContextModelItemProvider) next).getAdapterFactory() == getAdapterFactory())
found = true;
}
} finally {
adapters.unlock();
}
if (!found) {
ContextModelItemProvider provider = new ContextModelItemProvider(
getAdapterFactory());
adapters.add(provider);
}
}
IStatus result = super.run(monitor);
return result;