Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Re: Refresh Editor After Executing Commands
Re: Refresh Editor After Executing Commands [message #5308] Thu, 03 August 2006 10:43 Go to next message
Eclipse UserFriend
Originally posted by: john.campaner.s1.com

This is a multi-part message in MIME format.

------=_NextPart_000_001B_01C6B6E9.A7138F70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi There,

This thread kind of died on the old newsgroup before we reached a =
conclusion. I was wondering if anyone had some suggestions on how to =
implement this use case and if it would potentially make a good =
enhancement candidate for core GMF generated editor functionality.

Thanks,

John


"John Campaner" <john.campaner@s1.com> wrote in message =
news:ea8l3h$o1k$1@utils.eclipse.org...
Thanks again for your response....good idea, lets start with the use =
case I'm trying to do: Any input as to a better way of implementing this =
use case would be greatly appreciated.

My use case in general is that I want to provide the user the ability =
to decompose a large existing model contained within a single EMF =
resource into separate, more manageable individual EMF resources. The =
idea is that the user will identify reusable components and refactor =
these components out into their own resource. Then, we will use the =
shortcut mechanism to include this component by reference in many =
models.

The driver is that this would be advantageous to us with regards to =
granularity in source controlling our models and promoting reuse of =
common components.

So, assume the user is editing a large existing model in my GMF editor =
and the destination resource already exists. The steps are as follows:
1. User right clicks on the top level node of the part of the model =
they want to separate out into another resource and selects my action =
"Refactor".
2. The user selects the destination resource from a list of resources =
in the workspace in a popup dialog then clicks on OK.

Expected result is that the submodel underneath the selected node is =
moved to the destination resource (IE is now contained in the =
destination resource and is no longer has its containment is the =
resource currently being edited). Also, on the diagram currently being =
edited, the top level node is replaced with a shortcut to the node in =
the other resource.

Essentially, this functionality is similar to a cross-resource drag =
and drop of a given model element which you can do in a default =
generated EMF tree editor for a given model.

My current implementation is an action which prepared a series of =
AddCommand and RemoveCommand instances to move the model from one =
resource to another and then perform the same functionality within an =
AddCommand as the generated CreateShortcutAction does to annotate the =
currently selected node as a shortcut (I am adding EAnnotations to the =
notation view as you suggest). All these Add and Remove commands are =
appended to a CompoundCommand and then executed using =
domain.getCommandStack().execute(command)

The code I have in place achieves the desired result except there are =
two problems:=20
1. I need to close & reopen the current diagram to observe the =
changes.
2. I get an error message "Save Failed: Attempted to beginRule: XXXX, =
does not match outer scope rule: MultiRule [yyy]" on the save unless I =
perform a "Load Resource" on the destination resource and its _diagram =
file before attempting the Refactor action.



<mmostafa@ca.ibm.com> wrote in message =
news:ea8e5v$f41$1@utils.eclipse.org...

If you are changing the semantic element the Notation view points =
to, the method GraphicalEditPart#handlMajorSemanticChange() should be =
called.=20
you can add a break point to this method check if it will be invoked =
after you run your command or not.=20
the second point is moving the semantic element from resource to =
another would fire events of the semantic element's parent not the =
semantic element itself, so the edit part pointing to the semantic =
element's parent is the one that will be refreshed (if there is any)=20
the third point, I'm not sure what you mean by saying "adding =
annotations to node edit parts" if you mean you add EAnnotaions to the =
Notation view, then you have to handle these events in your Edit part =
because we do not handle them by default, you can do that by overriding =
handleNotificationEvent() in your edit part and handle the extra events =
you are interested in=20
if you explain your use case in more details we might be able to =
suggest how you can implement it.
------=_NextPart_000_001B_01C6B6E9.A7138F70
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2912" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi There,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This thread kind of died on the old =
newsgroup=20
before we reached a conclusion. I was wondering if anyone had some =
suggestions=20
on how to implement this use case and if it would potentially make a =
good=20
enhancement candidate for core GMF generated editor =
functionality.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>John</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"John Campaner" &lt;<A=20
href=3D"mailto:john.campaner@s1.com">john.campaner@s1.com</A>&gt; =
wrote in=20
message <A=20
=
href=3D"news:ea8l3h$o1k$1@utils.eclipse.org">news:ea8l3h$o1k$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks again for your =
response....good idea, lets=20
start with the use case I'm trying to do: Any input as to a better way =
of=20
implementing this use case would be greatly appreciated.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My use case in general is that I want =
to provide=20
the user the ability to decompose a large existing model contained =
within a=20
single EMF resource into separate, more manageable&nbsp;individual EMF =

resources. The idea is that the user will identify reusable components =
and=20
refactor these components out into their own resource. Then, we will =
use the=20
shortcut mechanism to include this component by reference in many=20
models.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The driver is that this would be =
advantageous to=20
us with regards to granularity in source controlling our models and =
promoting=20
reuse of common components.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So,&nbsp;assume the user is editing a =
large=20
existing model in my GMF editor and the destination resource already =
exists.=20
The steps are as follows:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>1. User right clicks on the top level =
node of the=20
part of the model they want to separate out into another resource and =
selects=20
my action "Refactor".</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2. The user selects the destination =
resource from=20
a list of resources in the workspace in a popup dialog then clicks on=20
OK.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Expected result is that the submodel =
underneath=20
the selected node is moved to the destination resource (IE is now =
contained in=20
the destination resource&nbsp;and is no longer has its containment is =
the=20
resource currently being edited). Also, on the diagram currently being =
edited,=20
the top level node is replaced with a shortcut to the node in the =
other=20
resource.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Essentially, this functionality is =
similar to a=20
cross-resource drag and drop of a given model element which you can do =
in a=20
default generated EMF tree editor for a given model.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My current implementation is an =
action which=20
prepared a series of AddCommand and RemoveCommand instances to move =
the model=20
from one resource to another and then perform the same functionality =
within an=20
AddCommand as the generated CreateShortcutAction does to annotate the=20
currently selected node as a shortcut (I am adding EAnnotations to the =

notation view as you suggest). All these Add and Remove commands are =
appended=20
to a CompoundCommand and then executed using <FONT=20
size=3D2>domain.getCommandStack().execute(command)</FONT></FONT ></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The code I have in place achieves the =
desired=20
result except there are two problems: </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>1. I need to close &amp; reopen the =
current=20
diagram to observe the changes.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2. I get an error message "<FONT=20
face=3D"Times New Roman" size=3D3>Save Failed: Attempted to beginRule: =
XXXX, does=20
not match outer scope rule: MultiRule [yyy]" </FONT>on the save unless =
I=20
perform a "Load Resource" on the destination resource and its _diagram =
file=20
before attempting the Refactor action.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&lt;<A =
href=3D"mailto:mmostafa@ca.ibm.com">mmostafa@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:ea8e5v$f41$1@utils.eclipse.org">news:ea8e5v$f41$1@utils.ecli=
pse.org</A>...</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"><BR><FONT=20
face=3Dsans-serif size=3D2>If you are changing the semantic element =
the Notation=20
view points to, the method =
GraphicalEditPart#handlMajorSemanticChange()=20
should be called.</FONT> <BR><FONT face=3Dsans-serif size=3D2>you =
can add a=20
break point to this method check if it will be invoked after you run =
your=20
command or not.</FONT> <BR><FONT face=3Dsans-serif size=3D2>the =
second point is=20
moving the semantic element from resource to another would fire =
events of=20
the semantic element's parent not the semantic element itself, so =
the edit=20
part pointing to the semantic element's parent is the one that will =
be=20
refreshed (if there is any)</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>the=20
third point, I'm not sure what you mean by saying "</FONT><FONT =
face=3DArial=20
size=3D2>adding annotations to node edit parts</FONT><FONT =
face=3Dsans-serif=20
size=3D2>" if you mean you add EAnnotaions to the Notation view, =
then you have=20
to handle these events in your Edit part because we do not handle =
them by=20
default, you can do that by overriding handleNotificationEvent() in =
your=20
edit part and handle the extra events you are interested in</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>if you explain your use case in more =
details we might=20
be able to suggest how you can implement=20
it.</FONT></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_001B_01C6B6E9.A7138F70--
Re: Refresh Editor After Executing Commands [message #5364 is a reply to message #5308] Thu, 03 August 2006 11:09 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010408050805000300060501
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

John,

The generated EMF editors already support this type of thing for an
object held by a proxy resolving containment reference. You can see
this in action in the Ecore editor itself if you right click on an
EClass and invoke "Control...". I'm don't think this is available
directly in the generated GMF editor though...


John Campaner wrote:
> Hi There,
>
> This thread kind of died on the old newsgroup before we reached a
> conclusion. I was wondering if anyone had some suggestions on how to
> implement this use case and if it would potentially make a good
> enhancement candidate for core GMF generated editor functionality.
>
> Thanks,
>
> John
>
>
>
> "John Campaner" <john.campaner@s1.com
> <mailto:john.campaner@s1.com>> wrote in message
> news:ea8l3h$o1k$1@utils.eclipse.org...
> Thanks again for your response....good idea, lets start with the
> use case I'm trying to do: Any input as to a better way of
> implementing this use case would be greatly appreciated.
>
> My use case in general is that I want to provide the user the
> ability to decompose a large existing model contained within a
> single EMF resource into separate, more manageable individual EMF
> resources. The idea is that the user will identify reusable
> components and refactor these components out into their own
> resource. Then, we will use the shortcut mechanism to include this
> component by reference in many models.
>
> The driver is that this would be advantageous to us with regards
> to granularity in source controlling our models and promoting
> reuse of common components.
>
> So, assume the user is editing a large existing model in my GMF
> editor and the destination resource already exists. The steps are
> as follows:
> 1. User right clicks on the top level node of the part of the
> model they want to separate out into another resource and selects
> my action "Refactor".
> 2. The user selects the destination resource from a list of
> resources in the workspace in a popup dialog then clicks on OK.
>
> Expected result is that the submodel underneath the selected node
> is moved to the destination resource (IE is now contained in the
> destination resource and is no longer has its containment is the
> resource currently being edited). Also, on the diagram currently
> being edited, the top level node is replaced with a shortcut to
> the node in the other resource.
>
> Essentially, this functionality is similar to a cross-resource
> drag and drop of a given model element which you can do in a
> default generated EMF tree editor for a given model.
>
> My current implementation is an action which prepared a series of
> AddCommand and RemoveCommand instances to move the model from one
> resource to another and then perform the same functionality within
> an AddCommand as the generated CreateShortcutAction does to
> annotate the currently selected node as a shortcut (I am adding
> EAnnotations to the notation view as you suggest). All these Add
> and Remove commands are appended to a CompoundCommand and then
> executed using domain.getCommandStack().execute(command)
>
> The code I have in place achieves the desired result except there
> are two problems:
> 1. I need to close & reopen the current diagram to observe the
> changes.
> 2. I get an error message "Save Failed: Attempted to beginRule:
> XXXX, does not match outer scope rule: MultiRule [yyy]" on the
> save unless I perform a "Load Resource" on the destination
> resource and its _diagram file before attempting the Refactor action.
>
>
>
> <mmostafa@ca.ibm.com <mailto:mmostafa@ca.ibm.com>> wrote in
> message news:ea8e5v$f41$1@utils.eclipse.org...
>
>
> If you are changing the semantic element the Notation view
> points to, the method
> GraphicalEditPart#handlMajorSemanticChange() should be called.
> you can add a break point to this method check if it will be
> invoked after you run your command or not.
> the second point is moving the semantic element from resource
> to another would fire events of the semantic element's parent
> not the semantic element itself, so the edit part pointing to
> the semantic element's parent is the one that will be
> refreshed (if there is any)
> the third point, I'm not sure what you mean by saying "adding
> annotations to node edit parts" if you mean you add
> EAnnotaions to the Notation view, then you have to handle
> these events in your Edit part because we do not handle them
> by default, you can do that by overriding
> handleNotificationEvent() in your edit part and handle the
> extra events you are interested in
> if you explain your use case in more details we might be able
> to suggest how you can implement it.
>


--------------010408050805000300060501
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
John,<br>
<br>
The generated EMF editors already support this type of thing for an
object held by a proxy resolving containment reference.&nbsp; You can see
this in action in the Ecore editor itself if you right click on an
EClass and invoke "Control...".&nbsp; I'm don't think this is available
directly in the generated GMF editor though...<br>
&nbsp;<br>
<br>
John Campaner wrote:
<blockquote cite="mideat22i$19g$1@utils.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2900.2912" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Hi There,</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">This thread kind of died on the old
newsgroup before we reached a conclusion. I was wondering if anyone had
some suggestions on how to implement this use case and if it would
potentially make a good enhancement candidate for core GMF generated
editor functionality.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Thanks,</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">John</font></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<blockquote dir="ltr"
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"John Campaner" &lt;<a href="mailto:john.campaner@s1.com">john.campaner@s1.com</a>&gt;
wrote in message <a href="news:ea8l3h$o1k$1@utils.eclipse.org">news:ea8l3h$o1k$1@utils.eclipse.org</a>...</div>
<div><font face="Arial" size="2">Thanks again for your
response....good idea, lets start with the use case I'm trying to do:
Any input as to a better way of implementing this use case would be
greatly appreciated.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">My use case in general is that I
want to provide the user the ability to decompose a large existing
model contained within a single EMF resource into separate, more
manageable&nbsp;individual EMF resources. The idea is that the user will
identify reusable components and refactor these components out into
their own resource. Then, we will use the shortcut mechanism to include
this component by reference in many models.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">The driver is that this would be
advantageous to us with regards to granularity in source controlling
our models and promoting reuse of common components.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">So,&nbsp;assume the user is editing a
large existing model in my GMF editor and the destination resource
already exists. The steps are as follows:</font></div>
<div><font face="Arial" size="2">1. User right clicks on the top
level node of the part of the model they want to separate out into
another resource and selects my action "Refactor".</font></div>
<div><font face="Arial" size="2">2. The user selects the
destination resource from a list of resources in the workspace in a
popup dialog then clicks on OK.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Expected result is that the
submodel underneath the selected node is moved to the destination
resource (IE is now contained in the destination resource&nbsp;and is no
longer has its containment is the resource currently being edited).
Also, on the diagram currently being edited, the top level node is
replaced with a shortcut to the node in the other resource.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Essentially, this functionality is
similar to a cross-resource drag and drop of a given model element
which you can do in a default generated EMF tree editor for a given
model.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">My current implementation is an
action which prepared a series of AddCommand and RemoveCommand
instances to move the model from one resource to another and then
perform the same functionality within an AddCommand as the generated
CreateShortcutAction does to annotate the currently selected node as a
shortcut (I am adding EAnnotations to the notation view as you
suggest). All these Add and Remove commands are appended to a
CompoundCommand and then executed using <font size="2">domain.getCommandStack().execute(command)</font> </font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">The code I have in place achieves
the desired result except there are two problems: </font></div>
<div><font face="Arial" size="2">1. I need to close &amp; reopen
the current diagram to observe the changes.</font></div>
<div><font face="Arial" size="2">2. I get an error message "<font
face="Times New Roman" size="3">Save Failed: Attempted to beginRule:
XXXX, does not match outer scope rule: MultiRule [yyy]" </font>on the
save unless I perform a "Load Resource" on the destination resource and
its _diagram file before attempting the Refactor action.</font></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&lt;<a href="mailto:mmostafa@ca.ibm.com">mmostafa@ca.ibm.com</a>&gt;
wrote in message <a href="news:ea8e5v$f41$1@utils.eclipse.org">news:ea8e5v$f41$1@utils.eclipse.org</a>...</div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><br>
<font face="sans-serif" size="2">If you are changing the semantic
element the Notation view points to, the method
GraphicalEditPart#handlMajorSemanticChange() should be called.</font> <br>
<font face="sans-serif" size="2">you can add a break point to
this method check if it will be invoked after you run your command or
not.</font> <br>
<font face="sans-serif" size="2">the second point is moving the
semantic element from resource to another would fire events of the
semantic element's parent not the semantic element itself, so the edit
part pointing to the semantic element's parent is the one that will be
refreshed (if there is any)</font> <br>
<font face="sans-serif" size="2">the third point, I'm not sure
what you mean by saying "</font><font face="Arial" size="2">adding
annotations to node edit parts</font><font face="sans-serif" size="2">"
if you mean you add EAnnotaions to the Notation view, then you have to
handle these events in your Edit part because we do not handle them by
default, you can do that by overriding handleNotificationEvent() in
your edit part and handle the extra events you are interested in</font>
<br>
<font face="sans-serif" size="2">if you explain your use case in
more details we might be able to suggest how you can implement it.</font></blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------010408050805000300060501--
Previous Topic:Re: Add parent element programmatically
Next Topic:problem with synchronizing model changes in different Editor
Goto Forum:
  


Current Time: Sun Jul 13 19:25:02 EDT 2025

Powered by FUDForum. Page generated in 0.16665 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top