|
Re: Explain ItemProviderAdapter.getTypeText implementation [message #1743179 is a reply to message #1743167] |
Tue, 13 September 2016 05:30 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Felix,
Yes, the resource locator might attach a new adapter, potentially one from a different factory.
protected ResourceLocator getResourceLocator(Object anyObject)
{
if (adapterFactory instanceof ComposeableAdapterFactory)
{
Object adapter = ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory().adapt(anyObject, IItemLabelProvider.class);
if (adapter instanceof ResourceLocator)
{
return (ResourceLocator)adapter;
}
}
return getResourceLocator();
}
The getTypeText method is called on new children in org.eclipse.emf.edit.provider.ItemProviderAdapter.getCreateChildDescription(Object, Object, Object, Collection<?>) so all children ever created for each create child command (and that happens each time the selection is changed) would tend to leak until the editor itself is disposed. The code as written avoids that problem.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03152 seconds