Home » Modeling » GMF (Graphical Modeling Framework) » Removing GMF Object while keeping EMF Object
Removing GMF Object while keeping EMF Object [message #103575] |
Tue, 13 February 2007 16:16 |
Maxence VANBÉSIEN Messages: 40 Registered: July 2009 Location: Lille, France |
Member |
|
|
Hello,
I've already sent a message with this question, but I suppose it was
done in the wrong place... I apologize for it.
Here is the initial message, with more explanations about my problem :
Shortcuts provided by GMF make the referenced EObject to be deleted when
the GMF Node (Standing for the Shortcut i.e. containing the "Shortcut"
EAnnotation) is deleted.
I would like to change this behaviour by keeping the referenced EObject
while Node is removed.
I tried to override the getCommand method of the EditPart, but I don't
know which kind of Request I have to filter...
Moreover, I tried to look at EditHelpers and some EditPolicies, but when
those classes are invoked, EObject is already marked to be deleted, and
I can't find a reference to the Node anymore.
Someone already told me I could deal with the fact the shape is
Canonical, and that was why both Objects were deleted. I tried to remove
the CanonicalEditPolicy on EditPart creation, but the behaviour doesn't
change... And I don't know what I did wrong... More than that, as the
Semantic Object and the Graphical object are not in the same model file,
the graphical Object won't be recreated on next diagram startup... Am I
wrong ?
So, how can I do to change the deletion behaviour for Shortcuts ?
Thanks a lot for your help !
Maxence
|
|
|
Re: Removing GMF Object while keeping EMF Object [message #103592 is a reply to message #103575] |
Tue, 13 February 2007 17:26 |
Mohammed Mostafa Messages: 143 Registered: July 2009 |
Senior Member |
|
|
Hi ;
There are 2 delete actions. One is Delete from model the other is
delete from diagram.
what you need is a delete from diagram, to use delete from diagram you
need to do two things
1- make sure your view is not canonical
2- open you plugin XML , and make sure that the there is no entry like that
<popupStructuredContributionCriteria
objectClass=" org.eclipse.gmf.examples.library.diagram.edit.parts.XXXEditP art "/>
<popupPredefinedItem id="deleteFromDiagramAction"
remove="true"/>
because this entry will remove the delete from diagram action from your
XXXEditPart. to test is just change the value from true to false
then right click on your edit part and you should see the delete from
diagram menu item , it should be enabled if you removed the canonical
edit policy
i hope this helps
Maxence VANBESIEN wrote:
> Hello,
>
> I've already sent a message with this question, but I suppose it was
> done in the wrong place... I apologize for it.
>
> Here is the initial message, with more explanations about my problem :
>
> Shortcuts provided by GMF make the referenced EObject to be deleted when
> the GMF Node (Standing for the Shortcut i.e. containing the "Shortcut"
> EAnnotation) is deleted.
>
> I would like to change this behaviour by keeping the referenced EObject
> while Node is removed.
>
> I tried to override the getCommand method of the EditPart, but I don't
> know which kind of Request I have to filter...
>
> Moreover, I tried to look at EditHelpers and some EditPolicies, but when
> those classes are invoked, EObject is already marked to be deleted, and
> I can't find a reference to the Node anymore.
>
> Someone already told me I could deal with the fact the shape is
> Canonical, and that was why both Objects were deleted. I tried to remove
> the CanonicalEditPolicy on EditPart creation, but the behaviour doesn't
> change... And I don't know what I did wrong... More than that, as the
> Semantic Object and the Graphical object are not in the same model file,
> the graphical Object won't be recreated on next diagram startup... Am I
> wrong ?
>
> So, how can I do to change the deletion behaviour for Shortcuts ?
>
> Thanks a lot for your help !
>
> Maxence
|
|
|
Re: Removing GMF Object while keeping EMF Object [message #103655 is a reply to message #103592] |
Wed, 14 February 2007 08:52 |
Maxence VANBÉSIEN Messages: 40 Registered: July 2009 Location: Lille, France |
Member |
|
|
Hi !
The entry was present in the plugin.xml file, and changing the "remove"
value made the Action appear, but it is always disabled, even with
removing the CanonicalEditPolicy...
I was asking myself if the compartments belonging to this Shape, and all
the objects I could create in those compartments have to be initialized
without installing the CanonicalEditPolicy to make it work... Do I have
to disable it in contained Objects, and in XXXNameEditParts for example
? And in my case, semantic model and diagram are merged into a unique
file... Does this have influence on this unexpected behaviour ?
Indeed, if I understood well, doing this will make me lose "bijectivity"
between the semantic model and the diagram... If this is true, I think
this behaviour won't fit all our requirements... :( Maybe I'll have to
find another way to deal with this...
Thanks a lot for your help !
Greetings,
Maxence
Mohammed Mostafa a écrit :
> Hi ;
> There are 2 delete actions. One is Delete from model the other is
> delete from diagram.
> what you need is a delete from diagram, to use delete from diagram
> you need to do two things
>
> 1- make sure your view is not canonical
> 2- open you plugin XML , and make sure that the there is no entry like that
>
> <popupStructuredContributionCriteria
> objectClass=" org.eclipse.gmf.examples.library.diagram.edit.parts.XXXEditP art "/>
>
> <popupPredefinedItem id="deleteFromDiagramAction"
> remove="true"/>
>
> because this entry will remove the delete from diagram action from your
> XXXEditPart. to test is just change the value from true to false
>
> then right click on your edit part and you should see the delete from
> diagram menu item , it should be enabled if you removed the canonical
> edit policy
>
> i hope this helps
>
> Maxence VANBESIEN wrote:
>> Hello,
>>
>> I've already sent a message with this question, but I suppose it was
>> done in the wrong place... I apologize for it.
>>
>> Here is the initial message, with more explanations about my problem :
>>
>> Shortcuts provided by GMF make the referenced EObject to be deleted
>> when the GMF Node (Standing for the Shortcut i.e. containing the
>> "Shortcut" EAnnotation) is deleted.
>>
>> I would like to change this behaviour by keeping the referenced
>> EObject while Node is removed.
>>
>> I tried to override the getCommand method of the EditPart, but I don't
>> know which kind of Request I have to filter...
>>
>> Moreover, I tried to look at EditHelpers and some EditPolicies, but
>> when those classes are invoked, EObject is already marked to be
>> deleted, and I can't find a reference to the Node anymore.
>>
>> Someone already told me I could deal with the fact the shape is
>> Canonical, and that was why both Objects were deleted. I tried to
>> remove the CanonicalEditPolicy on EditPart creation, but the behaviour
>> doesn't change... And I don't know what I did wrong... More than that,
>> as the Semantic Object and the Graphical object are not in the same
>> model file, the graphical Object won't be recreated on next diagram
>> startup... Am I wrong ?
>>
>> So, how can I do to change the deletion behaviour for Shortcuts ?
>>
>> Thanks a lot for your help !
>>
>> Maxence
|
|
|
Goto Forum:
Current Time: Thu Dec 26 11:09:17 GMT 2024
Powered by FUDForum. Page generated in 0.03113 seconds
|