Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsRe: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425447/#msg_425447
IŽve seen that you had the same problem. I would like to know where to
create the wrapper????
Thanks in advance]]>Summer2008-11-26T14:44:52-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425449/#msg_425449
You'll find methods like createWrapper and isWrappingNeeded in
ItemProviderAdapter which is the base from which all item providers
extend. So you can override it any any of your generated item providers.
Summer wrote:
> Hello Mike,
>
> IŽve seen that you had the same problem. I would like to know where to
> create the wrapper????
>
>
> Thanks in advance
>]]>Ed Merks2008-11-26T15:07:12-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425451/#msg_425451
I know,but the problem is I canŽt override it in the edit part ->
ItemProvider
I know that I need to force wrappers to be created (override
isWrappingNeeded), which looks like this:
protected Object createWrapper(EObject object, EStructuralFeature feature,
Object value, int index)
{
if (!isWrappingNeeded(object)) return value;
if (FeatureMapUtil.isFeatureMap(feature))
{
value = new
FeatureMapEntryWrapperItemProvider((FeatureMap.Entry)value, object,
(EAttribute)feature, index, adapterFactory, getResourceLocator());
}
else if (feature instanceof EAttribute)
{
value = new AttributeValueWrapperItemProvider(value, object,
(EAttribute)feature, index, adapterFactory, getResourceLocator());
}
else if (!((EReference)feature).isContainment())
{
value = new DelegatingWrapperItemProvider(value, object, feature,
index, adapterFactory);
}
return value;
}
but I donŽt know where to put this in my EMF project.]]>Summer2008-11-26T15:23:16-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425452/#msg_425452
the generated class ItemProviderAdapter, I canŽt change anything in this
class,]]>Summer2008-11-26T15:31:27-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425454/#msg_425454
problem that by deleting the child reference the reference itself it also
deleted??
Any ideas, how to change that?]]>Summer2008-11-26T15:40:04-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425455/#msg_425455
Comments below.
Summer wrote:
> Thanks for your answer,
>
> I know,but the problem is I canŽt override it in the edit part ->
> ItemProvider
Why not?
>
> I know that I need to force wrappers to be created (override
> isWrappingNeeded), which looks like this:
>
> protected Object createWrapper(EObject object, EStructuralFeature
> feature, Object value, int index)
> {
> if (!isWrappingNeeded(object)) return value;
>
> if (FeatureMapUtil.isFeatureMap(feature))
> {
> value = new
> FeatureMapEntryWrapperItemProvider((FeatureMap.Entry)value, object,
> (EAttribute)feature, index, adapterFactory, getResourceLocator());
> }
> else if (feature instanceof EAttribute)
> {
> value = new AttributeValueWrapperItemProvider(value, object,
> (EAttribute)feature, index, adapterFactory, getResourceLocator());
> }
> else if (!((EReference)feature).isContainment())
> {
> value = new DelegatingWrapperItemProvider(value, object, feature,
> index, adapterFactory);
> }
>
> return value;
> }
>
>
> but I donŽt know where to put this in my EMF project.
In any generated AbcItemProviderAdapter, i.e., the one which has
children that are non-containment references that also appear elsewhere
in the tree, simply create a method that overrides isWrappingNeeded to
return true...]]>Ed Merks2008-11-26T15:41:07-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425456/#msg_425456
The quality of my answers will generally be directly proportional to the
information content of your question. I can only do such much to guess
what might be wrong.
Summer wrote:
> Ok, I`ve just seen, that I already have this wrapper, and still having
> the problem that by deleting the child reference the reference itself
> it also deleted??
>
> Any ideas, how to change that?
>]]>Ed Merks2008-11-26T15:42:04-00:00Re: Deleting child reference deletes referent?
https://www.eclipse.org/forums/index.php/mv/msg/135450/425487/#msg_425487
Summer2008-11-27T12:04:48-00:00