|
Re: Disable edit possibility in non-containment reference [message #912883 is a reply to message #912853] |
Fri, 14 September 2012 10:33 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
That's just the start.
You should see it gets to this method:
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;
}
So it should get into "new DelegatingWrapperItemProvider". Does it?
You'll need to specialize that wrapper implementation.
On 14/09/2012 11:36 AM, Missing name Mising name wrote:
> The attached picture show my editor content. It is a part of the
> generated emf editor and you can move all around like you want.
>
>
> To show the children of a reference entry I overwrote the method
> getChildren in ReferenceContentItemProvider:
> @Override
> public Collection<?> getChildren(Object object) {
> if (object instanceof ReferenceContentImpl &&
> ((ReferenceContentImpl) object).getReference() != null) {
> return ((ReferenceContentImpl)
> object).getReference().getCommands();
> }
>
> return super.getChildren(object);
> }
>
> But I don't want that is possibility to edit the content of a included
> sequence. It is a own class.
>
>
> Ed Merks point to the wrapping functionality. I overwrote the method
> isWrappingNeeded in the ReferenceContentItemProvider and return always
> true.
> But it seems that it has no effect. I think I am missing something out.
>
> Thanks for any hints.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
Re: Disable edit possibility in non-containment reference [message #912997 is a reply to message #912985] |
Fri, 14 September 2012 15:04 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Sorry but I can't answer questions based on this tangle of details.
You've more than exhausted your quota of questions for the week.
On 14/09/2012 4:43 PM, Missing name Mising name wrote:
>>> Yeah I had done that. I overwrote the method isWrappingNeeded in the
>>> ReferenceContentItemProvider, it always return null.
>> It returns a boolean, it can't be null.
> Sorry I meant true.
>
>>> After that I set a breakpoint on createWrapper in ItemProvider and in
>>> the isWrappningNeeded to see if it is called.
>>> createWrapper is called only be the SequenceItemProvider, I explained
>>> the results above.
>> But wrap is called for all children it it always calls createWrapper.
> That is correct, but only in class SequenceItemProvider.
>
>>> The method isWrappingNeeded in the RCIP is only called by wrapCommand,
>>> when I select the Reference.
>> So that one should return true and you want to create a wrapper for the
>> "reference" feature.
> In that class I had overwritten the method.
>
>> There seems to be some confusion here and I'm making assumptions based
>> on the snippets of information you provide. Is a Sequence displayed as
>> a child of a ReferenceContent in your tree view?
> No it is another ReferenceContent, I only called them sequence to
> prevent missunderstanding.
>
> The editor gets as input a "real" Sequence object. The Sequence object
> contains SequenceContent objects, which can be ReferenceContent or
> AbstractCommandData.
> The ReferenceContent refers to a Sequence object and loads its
> commands, which are returned as children.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Disable edit possibility in non-containment reference [message #913021 is a reply to message #912997] |
Fri, 14 September 2012 16:00 |
John M. Messages: 198 Registered: July 2010 |
Senior Member |
|
|
So I think I got it working now.
The summary is I have to overwrite the method isWrappingNeeded in ReferenceContentItemProvider and specialize the method createWrapper in SequenceItemProvider.
There was for me the confusion. I have always understood that I shall specialize the createWrapper in ReferenceContentItemProvider. Why should I do that, when it is never called?
Finally I tried it in the SequenceItemProvider and it works.
If it is possibile, please add some information about the wrapper in your EMF book, I couldn't find anything.
Furthermore please tell me, where I can send information about feedback to your book.
But I think I found an abnormal behaviour for DND. The system returns always an executable command for inserting in the delegating wrapper above itself.
There is no other insert position in the delegation, where it works, only above the object itself.
You must have at least 2 elements.
I had tried to debug the DND, but you (Ed Merks) said, it is nearly impossible and I don't have the source code for doing real debugging/testing.
I will try to create a mini example, which shows the behavior and if I can proof it, I will add an entry in the tracker.
|
|
|
|
Powered by
FUDForum. Page generated in 0.05387 seconds