Home » Eclipse Projects » GEF » Enabling Undo of GEF commands from a view
Enabling Undo of GEF commands from a view [message #118454] |
Thu, 19 February 2004 16:17 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: phil.williams.toadmail.com
I have a view that is essentially tied to my editor and allows the user
to edit various properties of the model. I want to be able to mark the
editor as dirty when anything is changed, so I encapsulate the change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part. Currently,
the only way to get the undo to activate once a change has been made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118537 is a reply to message #118454] |
Fri, 20 February 2004 14:33 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your view. It
is the same as for editorparts.
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c12nd4$6lo$1@eclipse.org...
> I have a view that is essentially tied to my editor and allows the user
> to edit various properties of the model. I want to be able to mark the
> editor as dirty when anything is changed, so I encapsulate the change as
> a command and put it on the stack.
>
> Everything is working fine, but I want to have the Eclipse menu
> Edit->Undo to be activated when the view is the active part. Currently,
> the only way to get the undo to activate once a change has been made is
> to make the editor active and then I see the "Undo my model change"
> activate in the edit menu of the workbench.
>
> How can I tie the activation of undo and redo in the edit menu when
> another view is active to the GEF actions/command stack?
>
> TIA,
> Phil
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118563 is a reply to message #118537] |
Fri, 20 February 2004 15:39 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: phil.williams.toadmail.com
This is a multi-part message in MIME format.
--------------070801050705020701040304
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Once again, thanks. And while it is related it was really two separate
issues. The other post is how to get a custom action to enable and
disable based on the state of the editor. This is how to tie a view to
the undo/redo actions.
Phil
Randy Hudson wrote:
>Is this related to the post which came after?
>It sounds like you aren't hooking the global undo action from your view. It
>is the same as for editorparts.
>
>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>news:c12nd4$6lo$1@eclipse.org...
>
>
>>I have a view that is essentially tied to my editor and allows the user
>>to edit various properties of the model. I want to be able to mark the
>>editor as dirty when anything is changed, so I encapsulate the change as
>>a command and put it on the stack.
>>
>>Everything is working fine, but I want to have the Eclipse menu
>>Edit->Undo to be activated when the view is the active part. Currently,
>>the only way to get the undo to activate once a change has been made is
>>to make the editor active and then I see the "Undo my model change"
>>activate in the edit menu of the workbench.
>>
>>How can I tie the activation of undo and redo in the edit menu when
>>another view is active to the GEF actions/command stack?
>>
>>TIA,
>>Phil
>>
>>
>
>
>
>
--------------070801050705020701040304
Content-Type: text/html; charset=us-ascii
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">
<title></title>
</head>
<body>
Once again, thanks. And while it is related it was really two separate
issues. The other post is how to get a custom action to enable and
disable based on the state of the editor. This is how to tie a view to
the undo/redo actions.<br>
<br>
Phil<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc155m0$us3$1@eclipse.org" type="cite">
<pre wrap="">Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your view. It
is the same as for editorparts.
"Phil Williams" <a class="moz-txt-link-rfc2396E" href="mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:c12nd4$6lo$1@eclipse.org">news:c12nd4$6lo$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">I have a view that is essentially tied to my editor and allows the user
to edit various properties of the model. I want to be able to mark the
editor as dirty when anything is changed, so I encapsulate the change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part. Currently,
the only way to get the undo to activate once a change has been made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>
--------------070801050705020701040304--
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118568 is a reply to message #118563] |
Fri, 20 February 2004 15:49 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: phil.williams.toadmail.com
This is a multi-part message in MIME format.
--------------030105060401050101050002
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
ok, next question, how do I get a handle to the action registry to hook
into the undo, redo commands. This is what I thought I needed to add to
my view's init() method:
ActionRegistry registry = viewSite.getActionRegistry();
IActionBars bars = viewSite.getActionBars();
String id = IWorkbenchActionConstants.UNDO;
bars.setGlobalActionHandler(id, registry.getAction(id));
id = IWorkbenchActionConstants.REDO;
bars.setGlobalActionHandler(id, registry.getAction(id));
but a IViewSite does not have an action registry as a page site does.
Thanks again,
Phil
Phil Williams wrote:
> Once again, thanks. And while it is related it was really two
> separate issues. The other post is how to get a custom action to
> enable and disable based on the state of the editor. This is how to
> tie a view to the undo/redo actions.
>
> Phil
>
> Randy Hudson wrote:
>
>>Is this related to the post which came after?
>>It sounds like you aren't hooking the global undo action from your view. It
>>is the same as for editorparts.
>>
>>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>>news:c12nd4$6lo$1@eclipse.org...
>>
>>
>>>I have a view that is essentially tied to my editor and allows the user
>>>to edit various properties of the model. I want to be able to mark the
>>>editor as dirty when anything is changed, so I encapsulate the change as
>>>a command and put it on the stack.
>>>
>>>Everything is working fine, but I want to have the Eclipse menu
>>>Edit->Undo to be activated when the view is the active part. Currently,
>>>the only way to get the undo to activate once a change has been made is
>>>to make the editor active and then I see the "Undo my model change"
>>>activate in the edit menu of the workbench.
>>>
>>>How can I tie the activation of undo and redo in the edit menu when
>>>another view is active to the GEF actions/command stack?
>>>
>>>TIA,
>>>Phil
>>>
>>>
>>
>>
>>
>>
--------------030105060401050101050002
Content-Type: text/html; charset=us-ascii
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">
<title></title>
</head>
<body>
ok, next question, how do I get a handle to the action registry to hook
into the undo, redo commands. This is what I thought I needed to add
to my view's init() method:<br>
<br>
ActionRegistry registry = viewSite.getActionRegistry();<br>
IActionBars bars = viewSite.getActionBars();<br>
String id = IWorkbenchActionConstants.UNDO;<br>
bars.setGlobalActionHandler(id, registry.getAction(id));<br>
id = IWorkbenchActionConstants.REDO;<br>
bars.setGlobalActionHandler(id, registry.getAction(id));<br>
<br>
but a IViewSite does not have an action registry as a page site does.<br>
<br>
Thanks again,<br>
Phil<br>
Phil Williams wrote:<br>
<blockquote cite="midc159i4$4c2$1@eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Once again, thanks. And while it is related it was really two separate
issues. The other post is how to get a custom action to enable and
disable based on the state of the editor. This is how to tie a view to
the undo/redo actions.<br>
<br>
Phil<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc155m0$us3$1@eclipse.org" type="cite">
<pre wrap="">Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your view. It
is the same as for editorparts.
"Phil Williams" <a class="moz-txt-link-rfc2396E"
href="mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:c12nd4$6lo$1@eclipse.org">news:c12nd4$6lo$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">I have a view that is essentially tied to my editor and allows the user
to edit various properties of the model. I want to be able to mark the
editor as dirty when anything is changed, so I encapsulate the change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part. Currently,
the only way to get the undo to activate once a change has been made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</blockquote>
</body>
</html>
--------------030105060401050101050002--
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118598 is a reply to message #118568] |
Fri, 20 February 2004 16:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
This is a multi-part message in MIME format.
------=_NextPart_000_0087_01C3F7A4.DCEEA370
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Take a look at createActions() in GraphicalEditor/LogicEditor.
"Phil Williams" <phil.williams@toadmail.com> wrote in message =
news:c15a3o$54n$1@eclipse.org...
ok, next question, how do I get a handle to the action registry to =
hook into the undo, redo commands. This is what I thought I needed to =
add to my view's init() method:
ActionRegistry registry =3D viewSite.getActionRegistry();
IActionBars bars =3D viewSite.getActionBars();
String id =3D IWorkbenchActionConstants.UNDO;
bars.setGlobalActionHandler(id, registry.getAction(id));
id =3D IWorkbenchActionConstants.REDO;
bars.setGlobalActionHandler(id, registry.getAction(id));
but a IViewSite does not have an action registry as a page site does.
Thanks again,
Phil
Phil Williams wrote:
Once again, thanks. And while it is related it was really two =
separate issues. The other post is how to get a custom action to enable =
and disable based on the state of the editor. This is how to tie a view =
to the undo/redo actions.
Phil
Randy Hudson wrote:
Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your view. =
It
is the same as for editorparts.
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c12nd4$6lo$1@eclipse.org...
I have a view that is essentially tied to my editor and allows the =
user
to edit various properties of the model. I want to be able to mark the
editor as dirty when anything is changed, so I encapsulate the change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part. Currently,
the only way to get the undo to activate once a change has been made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
=20
------=_NextPart_000_0087_01C3F7A4.DCEEA370
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><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Take a look at createActions() in=20
GraphicalEditor/LogicEditor.</FONT></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>"Phil Williams" <<A=20
=
href=3D"mailto:phil.williams@toadmail.com">phil.williams@toadmail.com</A>=
>=20
wrote in message <A=20
=
href=3D"news:c15a3o$54n$1@eclipse.org">news:c15a3o$54n$1@eclipse.org</A>.=
...</DIV>ok,=20
next question, how do I get a handle to the action registry to hook =
into the=20
undo, redo commands. This is what I thought I needed to add to =
my view's=20
init() method:<BR><BR> =
ActionRegistry=20
registry =3D viewSite.getActionRegistry();<BR> =20
IActionBars bars =3D=20
viewSite.getActionBars();<BR> =
String id =3D=20
IWorkbenchActionConstants.UNDO;<BR> =
=20
bars.setGlobalActionHandler(id, =
registry.getAction(id));<BR> =20
id =3D =
IWorkbenchActionConstants.REDO;<BR> =20
bars.setGlobalActionHandler(id,=20
registry.getAction(id));<BR><BR>but a IViewSite does not have an =
action=20
registry as a page site does.<BR><BR>Thanks again,<BR>Phil<BR>Phil =
Williams=20
wrote:<BR>
<BLOCKQUOTE cite=3Dmidc159i4$4c2$1@eclipse.org type=3D"cite">Once =
again,=20
thanks. And while it is related it was really two separate=20
issues. The other post is how to get a custom action to enable =
and=20
disable based on the state of the editor. This is how to tie a =
view to=20
the undo/redo actions.<BR><BR>Phil<BR><BR>Randy Hudson wrote:<BR>
<BLOCKQUOTE cite=3Dmidc155m0$us3$1@eclipse.org type=3D"cite"><PRE =
wrap=3D"">Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your view. =
It
is the same as for editorparts.
"Phil Williams" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com=
></A> wrote in message
<A class=3Dmoz-txt-link-freetext =
href=3D"news:c12nd4$6lo$1@eclipse.org">news:c12nd4$6lo$1@eclipse.org</A>.=
...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">I have a view that is =
essentially tied to my editor and allows the user
to edit various properties of the model. I want to be able to mark the
editor as dirty when anything is changed, so I encapsulate the change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part. =
Currently,
the only way to get the undo to activate once a change has been made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
</PRE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML >
------=_NextPart_000_0087_01C3F7A4.DCEEA370--
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118606 is a reply to message #118598] |
Fri, 20 February 2004 16:50 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: phil.williams.toadmail.com
This is a multi-part message in MIME format.
--------------030908030702080802070402
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
I have and still don't see how I can get the actionRegistry from the
editor to get the undo/redo commands to add to the action bars on the
view. getActionRegistry() is protected on the GraphicalEditor class.
This is gotten around in the context menu of the Logic example by simply
passing the action registry into the constructor for the context menu,
but since this is in a view that could be launch by a user showing it, I
won't have a handle to the editor at the time the view is created and
therefore, can not get its action registry to grab to the UNDO/REDO
commands and put them in the view's action bars.
Or am I missing the nose that is on my face?
Thanks again,
Phil
Whitney Sorenson wrote:
> Take a look at createActions() in GraphicalEditor/LogicEditor.
>
> "Phil Williams" <phil.williams@toadmail.com
> <mailto:phil.williams@toadmail.com>> wrote in message
> news:c15a3o$54n$1@eclipse.org...
> ok, next question, how do I get a handle to the action registry to
> hook into the undo, redo commands. This is what I thought I
> needed to add to my view's init() method:
>
> ActionRegistry registry = viewSite.getActionRegistry();
> IActionBars bars = viewSite.getActionBars();
> String id = IWorkbenchActionConstants.UNDO;
> bars.setGlobalActionHandler(id, registry.getAction(id));
> id = IWorkbenchActionConstants.REDO;
> bars.setGlobalActionHandler(id, registry.getAction(id));
>
> but a IViewSite does not have an action registry as a page site does.
>
> Thanks again,
> Phil
> Phil Williams wrote:
>
>> Once again, thanks. And while it is related it was really two
>> separate issues. The other post is how to get a custom action to
>> enable and disable based on the state of the editor. This is how
>> to tie a view to the undo/redo actions.
>>
>> Phil
>>
>> Randy Hudson wrote:
>>
>>>Is this related to the post which came after?
>>>It sounds like you aren't hooking the global undo action from your view. It
>>>is the same as for editorparts.
>>>
>>>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>>>news:c12nd4$6lo$1@eclipse.org...
>>>
>>>
>>>>I have a view that is essentially tied to my editor and allows the user
>>>>to edit various properties of the model. I want to be able to mark the
>>>>editor as dirty when anything is changed, so I encapsulate the change as
>>>>a command and put it on the stack.
>>>>
>>>>Everything is working fine, but I want to have the Eclipse menu
>>>>Edit->Undo to be activated when the view is the active part. Currently,
>>>>the only way to get the undo to activate once a change has been made is
>>>>to make the editor active and then I see the "Undo my model change"
>>>>activate in the edit menu of the workbench.
>>>>
>>>>How can I tie the activation of undo and redo in the edit menu when
>>>>another view is active to the GEF actions/command stack?
>>>>
>>>>TIA,
>>>>Phil
>>>>
>>>>
>>>
>>>
>>>
>>>
--------------030908030702080802070402
Content-Type: text/html; charset=us-ascii
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">
<title></title>
</head>
<body>
I have and still don't see how I can get the actionRegistry from the
editor to get the undo/redo commands to add to the action bars on the
view. getActionRegistry() is protected on the GraphicalEditor class. <br>
<br>
This is gotten around in the context menu of the Logic example by
simply passing the action registry into the constructor for the context
menu, but since this is in a view that could be launch by a user
showing it, I won't have a handle to the editor at the time the view is
created and therefore, can not get its action registry to grab to the
UNDO/REDO commands and put them in the view's action bars.<br>
<br>
Or am I missing the nose that is on my face?<br>
<br>
Thanks again,<br>
Phil<br>
<br>
<br>
Whitney Sorenson wrote:<br>
<blockquote cite="midc15cdi$8lb$1@eclipse.org" type="cite">
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2800.1276" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Take a look at createActions() in
GraphicalEditor/LogicEditor.</font></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>"Phil Williams" <<a href="mailto:phil.williams@toadmail.com">phil.williams@toadmail.com</a>>
wrote in message <a href="news:c15a3o$54n$1@eclipse.org">news:c15a3o$54n$1@eclipse.org</a>...</div>
ok, next question, how do I get a handle to the action registry to hook
into the undo, redo commands. This is what I thought I needed to add
to my view's init() method:<br>
<br>
ActionRegistry registry = viewSite.getActionRegistry();<br>
IActionBars bars = viewSite.getActionBars();<br>
String id = IWorkbenchActionConstants.UNDO;<br>
bars.setGlobalActionHandler(id, registry.getAction(id));<br>
id = IWorkbenchActionConstants.REDO;<br>
bars.setGlobalActionHandler(id, registry.getAction(id));<br>
<br>
but a IViewSite does not have an action registry as a page site does.<br>
<br>
Thanks again,<br>
Phil<br>
Phil Williams wrote:<br>
<blockquote cite="midc159i4$4c2$1@eclipse.org" type="cite">Once
again, thanks. And while it is related it was really two separate
issues. The other post is how to get a custom action to enable and
disable based on the state of the editor. This is how to tie a view to
the undo/redo actions.<br>
<br>
Phil<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc155m0$us3$1@eclipse.org" type="cite">
<pre wrap="">Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your view. It
is the same as for editorparts.
"Phil Williams" <a class="moz-txt-link-rfc2396E"
href="mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:c12nd4$6lo$1@eclipse.org">news:c12nd4$6lo$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">I have a view that is essentially tied to my editor and allows the user
to edit various properties of the model. I want to be able to mark the
editor as dirty when anything is changed, so I encapsulate the change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part. Currently,
the only way to get the undo to activate once a change has been made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>
--------------030908030702080802070402--
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118625 is a reply to message #118606] |
Fri, 20 February 2004 17:40 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: gaslade.yahoo.com
The GraphicalEditor class implements IAdaptable. So you should use....
editor.getAdapter(ActionRegistry.class); to get a hook on the action
registry.
Your nose is in between your eyes. :-)
Guy
Phil Williams wrote:
> I have and still don't see how I can get the actionRegistry from the
> editor to get the undo/redo commands to add to the action bars on the
> view. getActionRegistry() is protected on the GraphicalEditor class.
>
> This is gotten around in the context menu of the Logic example by simply
> passing the action registry into the constructor for the context menu,
> but since this is in a view that could be launch by a user showing it, I
> won't have a handle to the editor at the time the view is created and
> therefore, can not get its action registry to grab to the UNDO/REDO
> commands and put them in the view's action bars.
>
> Or am I missing the nose that is on my face?
>
> Thanks again,
> Phil
>
>
> Whitney Sorenson wrote:
>
>> Take a look at createActions() in GraphicalEditor/LogicEditor.
>>
>> "Phil Williams" <phil.williams@toadmail.com
>> <mailto:phil.williams@toadmail.com>> wrote in message
>> news:c15a3o$54n$1@eclipse.org...
>> ok, next question, how do I get a handle to the action registry to
>> hook into the undo, redo commands. This is what I thought I
>> needed to add to my view's init() method:
>>
>> ActionRegistry registry = viewSite.getActionRegistry();
>> IActionBars bars = viewSite.getActionBars();
>> String id = IWorkbenchActionConstants.UNDO;
>> bars.setGlobalActionHandler(id, registry.getAction(id));
>> id = IWorkbenchActionConstants.REDO;
>> bars.setGlobalActionHandler(id, registry.getAction(id));
>>
>> but a IViewSite does not have an action registry as a page site does.
>>
>> Thanks again,
>> Phil
>> Phil Williams wrote:
>>
>>> Once again, thanks. And while it is related it was really two
>>> separate issues. The other post is how to get a custom action to
>>> enable and disable based on the state of the editor. This is how
>>> to tie a view to the undo/redo actions.
>>>
>>> Phil
>>>
>>> Randy Hudson wrote:
>>>
>>>>Is this related to the post which came after?
>>>>It sounds like you aren't hooking the global undo action from your view. It
>>>>is the same as for editorparts.
>>>>
>>>>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>>>>news:c12nd4$6lo$1@eclipse.org...
>>>>
>>>>
>>>>>I have a view that is essentially tied to my editor and allows the user
>>>>>to edit various properties of the model. I want to be able to mark the
>>>>>editor as dirty when anything is changed, so I encapsulate the change as
>>>>>a command and put it on the stack.
>>>>>
>>>>>Everything is working fine, but I want to have the Eclipse menu
>>>>>Edit->Undo to be activated when the view is the active part. Currently,
>>>>>the only way to get the undo to activate once a change has been made is
>>>>>to make the editor active and then I see the "Undo my model change"
>>>>>activate in the edit menu of the workbench.
>>>>>
>>>>>How can I tie the activation of undo and redo in the edit menu when
>>>>>another view is active to the GEF actions/command stack?
>>>>>
>>>>>TIA,
>>>>>Phil
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118662 is a reply to message #118625] |
Fri, 20 February 2004 19:08 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: phil.williams.toadmail.com
ok, so I guess that I am learning to walk again.... :-)
I am now able to get the action registry from within my view. During
the doCreatePage I call hookActions() which uses the getAdaptor on the
edit part that was selected to get a handle to the action registry. The
code below is essentially what hookActions() does. What I though would
happen is that this would enable the undo/redo from the main Eclipse
edit menu. But alas, it does not.
I have verified that the hookActions() method is being called.
Thanks again,
Phil
Guy Slade wrote:
> The GraphicalEditor class implements IAdaptable. So you should use....
> editor.getAdapter(ActionRegistry.class); to get a hook on the action
> registry.
>
> Your nose is in between your eyes. :-)
>
> Guy
>
> Phil Williams wrote:
>
>> I have and still don't see how I can get the actionRegistry from the
>> editor to get the undo/redo commands to add to the action bars on the
>> view. getActionRegistry() is protected on the GraphicalEditor class.
>> This is gotten around in the context menu of the Logic example by
>> simply passing the action registry into the constructor for the
>> context menu, but since this is in a view that could be launch by a
>> user showing it, I won't have a handle to the editor at the time the
>> view is created and therefore, can not get its action registry to
>> grab to the UNDO/REDO commands and put them in the view's action bars.
>>
>> Or am I missing the nose that is on my face?
>>
>> Thanks again,
>> Phil
>>
>>
>> Whitney Sorenson wrote:
>>
>>> Take a look at createActions() in GraphicalEditor/LogicEditor.
>>>
>>> "Phil Williams" <phil.williams@toadmail.com
>>> <mailto:phil.williams@toadmail.com>> wrote in message
>>> news:c15a3o$54n$1@eclipse.org...
>>> ok, next question, how do I get a handle to the action registry to
>>> hook into the undo, redo commands. This is what I thought I
>>> needed to add to my view's init() method:
>>>
>>> ActionRegistry registry = viewSite.getActionRegistry();
>>> IActionBars bars = viewSite.getActionBars();
>>> String id = IWorkbenchActionConstants.UNDO;
>>> bars.setGlobalActionHandler(id, registry.getAction(id));
>>> id = IWorkbenchActionConstants.REDO;
>>> bars.setGlobalActionHandler(id, registry.getAction(id));
>>>
>>> but a IViewSite does not have an action registry as a page site
>>> does.
>>>
>>> Thanks again,
>>> Phil
>>> Phil Williams wrote:
>>>
>>>> Once again, thanks. And while it is related it was really two
>>>> separate issues. The other post is how to get a custom action to
>>>> enable and disable based on the state of the editor. This is how
>>>> to tie a view to the undo/redo actions.
>>>>
>>>> Phil
>>>>
>>>> Randy Hudson wrote:
>>>>
>>>>> Is this related to the post which came after?
>>>>> It sounds like you aren't hooking the global undo action from your
>>>>> view. It
>>>>> is the same as for editorparts.
>>>>>
>>>>> "Phil Williams" <phil.williams@toadmail.com> wrote in message
>>>>> news:c12nd4$6lo$1@eclipse.org...
>>>>>
>>>>>
>>>>>> I have a view that is essentially tied to my editor and allows
>>>>>> the user
>>>>>> to edit various properties of the model. I want to be able to
>>>>>> mark the
>>>>>> editor as dirty when anything is changed, so I encapsulate the
>>>>>> change as
>>>>>> a command and put it on the stack.
>>>>>>
>>>>>> Everything is working fine, but I want to have the Eclipse menu
>>>>>> Edit->Undo to be activated when the view is the active part.
>>>>>> Currently,
>>>>>> the only way to get the undo to activate once a change has been
>>>>>> made is
>>>>>> to make the editor active and then I see the "Undo my model change"
>>>>>> activate in the edit menu of the workbench.
>>>>>>
>>>>>> How can I tie the activation of undo and redo in the edit menu when
>>>>>> another view is active to the GEF actions/command stack?
>>>>>>
>>>>>> TIA,
>>>>>> Phil
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>
|
|
|
Re: Enabling Undo of GEF commands from a view [message #118978 is a reply to message #118662] |
Mon, 23 February 2004 16:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
Is your view a PageBookView? The Outline is a PageBookView, and each
outline page in the logic example is providing Undo and Redo action
handlers. The best way to find out how this works is to open up the class
RetargetAction and put a *conditional breakpoint* in setActionHandler. Make
the conditional test for the UNDO constant.
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c15los$ksi$1@eclipse.org...
> ok, so I guess that I am learning to walk again.... :-)
>
> I am now able to get the action registry from within my view. During
> the doCreatePage I call hookActions() which uses the getAdaptor on the
> edit part that was selected to get a handle to the action registry. The
> code below is essentially what hookActions() does. What I though would
> happen is that this would enable the undo/redo from the main Eclipse
> edit menu. But alas, it does not.
>
> I have verified that the hookActions() method is being called.
>
> Thanks again,
> Phil
>
> Guy Slade wrote:
>
> > The GraphicalEditor class implements IAdaptable. So you should use....
> > editor.getAdapter(ActionRegistry.class); to get a hook on the action
> > registry.
> >
> > Your nose is in between your eyes. :-)
> >
> > Guy
> >
> > Phil Williams wrote:
> >
> >> I have and still don't see how I can get the actionRegistry from the
> >> editor to get the undo/redo commands to add to the action bars on the
> >> view. getActionRegistry() is protected on the GraphicalEditor class.
> >> This is gotten around in the context menu of the Logic example by
> >> simply passing the action registry into the constructor for the
> >> context menu, but since this is in a view that could be launch by a
> >> user showing it, I won't have a handle to the editor at the time the
> >> view is created and therefore, can not get its action registry to
> >> grab to the UNDO/REDO commands and put them in the view's action bars.
> >>
> >> Or am I missing the nose that is on my face?
> >>
> >> Thanks again,
> >> Phil
> >>
> >>
> >> Whitney Sorenson wrote:
> >>
> >>> Take a look at createActions() in GraphicalEditor/LogicEditor.
> >>>
> >>> "Phil Williams" <phil.williams@toadmail.com
> >>> <mailto:phil.williams@toadmail.com>> wrote in message
> >>> news:c15a3o$54n$1@eclipse.org...
> >>> ok, next question, how do I get a handle to the action registry to
> >>> hook into the undo, redo commands. This is what I thought I
> >>> needed to add to my view's init() method:
> >>>
> >>> ActionRegistry registry = viewSite.getActionRegistry();
> >>> IActionBars bars = viewSite.getActionBars();
> >>> String id = IWorkbenchActionConstants.UNDO;
> >>> bars.setGlobalActionHandler(id, registry.getAction(id));
> >>> id = IWorkbenchActionConstants.REDO;
> >>> bars.setGlobalActionHandler(id, registry.getAction(id));
> >>>
> >>> but a IViewSite does not have an action registry as a page site
> >>> does.
> >>>
> >>> Thanks again,
> >>> Phil
> >>> Phil Williams wrote:
> >>>
> >>>> Once again, thanks. And while it is related it was really two
> >>>> separate issues. The other post is how to get a custom action to
> >>>> enable and disable based on the state of the editor. This is how
> >>>> to tie a view to the undo/redo actions.
> >>>>
> >>>> Phil
> >>>>
> >>>> Randy Hudson wrote:
> >>>>
> >>>>> Is this related to the post which came after?
> >>>>> It sounds like you aren't hooking the global undo action from your
> >>>>> view. It
> >>>>> is the same as for editorparts.
> >>>>>
> >>>>> "Phil Williams" <phil.williams@toadmail.com> wrote in message
> >>>>> news:c12nd4$6lo$1@eclipse.org...
> >>>>>
> >>>>>
> >>>>>> I have a view that is essentially tied to my editor and allows
> >>>>>> the user
> >>>>>> to edit various properties of the model. I want to be able to
> >>>>>> mark the
> >>>>>> editor as dirty when anything is changed, so I encapsulate the
> >>>>>> change as
> >>>>>> a command and put it on the stack.
> >>>>>>
> >>>>>> Everything is working fine, but I want to have the Eclipse menu
> >>>>>> Edit->Undo to be activated when the view is the active part.
> >>>>>> Currently,
> >>>>>> the only way to get the undo to activate once a change has been
> >>>>>> made is
> >>>>>> to make the editor active and then I see the "Undo my model change"
> >>>>>> activate in the edit menu of the workbench.
> >>>>>>
> >>>>>> How can I tie the activation of undo and redo in the edit menu when
> >>>>>> another view is active to the GEF actions/command stack?
> >>>>>>
> >>>>>> TIA,
> >>>>>> Phil
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >
|
|
|
Re: Enabling Undo of GEF commands from a view [message #119121 is a reply to message #118978] |
Mon, 23 February 2004 19:14 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: phil.williams.toadmail.com
This is a multi-part message in MIME format.
--------------040907040305040705090505
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Thanks for the pointer. I am implementing a PageBookView and I tracked
the problem down to not calling the init() method on my Page in the
doCreatePage() of the view.
Thanks to all for the help.
Phil
Randy Hudson wrote:
>Is your view a PageBookView? The Outline is a PageBookView, and each
>outline page in the logic example is providing Undo and Redo action
>handlers. The best way to find out how this works is to open up the class
>RetargetAction and put a *conditional breakpoint* in setActionHandler. Make
>the conditional test for the UNDO constant.
>
>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>news:c15los$ksi$1@eclipse.org...
>
>
>>ok, so I guess that I am learning to walk again.... :-)
>>
>>I am now able to get the action registry from within my view. During
>>the doCreatePage I call hookActions() which uses the getAdaptor on the
>>edit part that was selected to get a handle to the action registry. The
>>code below is essentially what hookActions() does. What I though would
>>happen is that this would enable the undo/redo from the main Eclipse
>>edit menu. But alas, it does not.
>>
>>I have verified that the hookActions() method is being called.
>>
>>Thanks again,
>>Phil
>>
>>Guy Slade wrote:
>>
>>
>>
>>>The GraphicalEditor class implements IAdaptable. So you should use....
>>>editor.getAdapter(ActionRegistry.class); to get a hook on the action
>>>registry.
>>>
>>>Your nose is in between your eyes. :-)
>>>
>>>Guy
>>>
>>>Phil Williams wrote:
>>>
>>>
>>>
>>>>I have and still don't see how I can get the actionRegistry from the
>>>>editor to get the undo/redo commands to add to the action bars on the
>>>>view. getActionRegistry() is protected on the GraphicalEditor class.
>>>>This is gotten around in the context menu of the Logic example by
>>>>simply passing the action registry into the constructor for the
>>>>context menu, but since this is in a view that could be launch by a
>>>>user showing it, I won't have a handle to the editor at the time the
>>>>view is created and therefore, can not get its action registry to
>>>>grab to the UNDO/REDO commands and put them in the view's action bars.
>>>>
>>>>Or am I missing the nose that is on my face?
>>>>
>>>>Thanks again,
>>>>Phil
>>>>
>>>>
>>>>Whitney Sorenson wrote:
>>>>
>>>>
>>>>
>>>>>Take a look at createActions() in GraphicalEditor/LogicEditor.
>>>>>
>>>>> "Phil Williams" <phil.williams@toadmail.com
>>>>> <mailto:phil.williams@toadmail.com>> wrote in message
>>>>> news:c15a3o$54n$1@eclipse.org...
>>>>> ok, next question, how do I get a handle to the action registry to
>>>>> hook into the undo, redo commands. This is what I thought I
>>>>> needed to add to my view's init() method:
>>>>>
>>>>> ActionRegistry registry = viewSite.getActionRegistry();
>>>>> IActionBars bars = viewSite.getActionBars();
>>>>> String id = IWorkbenchActionConstants.UNDO;
>>>>> bars.setGlobalActionHandler(id, registry.getAction(id));
>>>>> id = IWorkbenchActionConstants.REDO;
>>>>> bars.setGlobalActionHandler(id, registry.getAction(id));
>>>>>
>>>>> but a IViewSite does not have an action registry as a page site
>>>>>does.
>>>>>
>>>>> Thanks again,
>>>>> Phil
>>>>> Phil Williams wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Once again, thanks. And while it is related it was really two
>>>>>> separate issues. The other post is how to get a custom action to
>>>>>> enable and disable based on the state of the editor. This is how
>>>>>> to tie a view to the undo/redo actions.
>>>>>>
>>>>>> Phil
>>>>>>
>>>>>> Randy Hudson wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Is this related to the post which came after?
>>>>>>>It sounds like you aren't hooking the global undo action from your
>>>>>>>view. It
>>>>>>>is the same as for editorparts.
>>>>>>>
>>>>>>>"Phil Williams" <phil.williams@toadmail.com> wrote in message
>>>>>>>news:c12nd4$6lo$1@eclipse.org...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>I have a view that is essentially tied to my editor and allows
>>>>>>>>the user
>>>>>>>>to edit various properties of the model. I want to be able to
>>>>>>>>mark the
>>>>>>>>editor as dirty when anything is changed, so I encapsulate the
>>>>>>>>change as
>>>>>>>>a command and put it on the stack.
>>>>>>>>
>>>>>>>>Everything is working fine, but I want to have the Eclipse menu
>>>>>>>>Edit->Undo to be activated when the view is the active part.
>>>>>>>>Currently,
>>>>>>>>the only way to get the undo to activate once a change has been
>>>>>>>>made is
>>>>>>>>to make the editor active and then I see the "Undo my model change"
>>>>>>>>activate in the edit menu of the workbench.
>>>>>>>>
>>>>>>>>How can I tie the activation of undo and redo in the edit menu when
>>>>>>>>another view is active to the GEF actions/command stack?
>>>>>>>>
>>>>>>>>TIA,
>>>>>>>>Phil
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>
>
>
>
--------------040907040305040705090505
Content-Type: text/html; charset=us-ascii
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">
<title></title>
</head>
<body>
Thanks for the pointer. I am implementing a PageBookView and I tracked
the problem down to not calling the init() method on my Page in the
doCreatePage() of the view.<br>
<br>
Thanks to all for the help.<br>
<br>
Phil<br>
<br>
Randy Hudson wrote:<br>
<blockquote cite="midc1d9iq$cag$1@eclipse.org" type="cite">
<pre wrap="">Is your view a PageBookView? The Outline is a PageBookView, and each
outline page in the logic example is providing Undo and Redo action
handlers. The best way to find out how this works is to open up the class
RetargetAction and put a *conditional breakpoint* in setActionHandler. Make
the conditional test for the UNDO constant.
"Phil Williams" <a class="moz-txt-link-rfc2396E" href="mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:c15los$ksi$1@eclipse.org">news:c15los$ksi$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">ok, so I guess that I am learning to walk again.... :-)
I am now able to get the action registry from within my view. During
the doCreatePage I call hookActions() which uses the getAdaptor on the
edit part that was selected to get a handle to the action registry. The
code below is essentially what hookActions() does. What I though would
happen is that this would enable the undo/redo from the main Eclipse
edit menu. But alas, it does not.
I have verified that the hookActions() method is being called.
Thanks again,
Phil
Guy Slade wrote:
</pre>
<blockquote type="cite">
<pre wrap="">The GraphicalEditor class implements IAdaptable. So you should use....
editor.getAdapter(ActionRegistry.class); to get a hook on the action
registry.
Your nose is in between your eyes. :-)
Guy
Phil Williams wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I have and still don't see how I can get the actionRegistry from the
editor to get the undo/redo commands to add to the action bars on the
view. getActionRegistry() is protected on the GraphicalEditor class.
This is gotten around in the context menu of the Logic example by
simply passing the action registry into the constructor for the
context menu, but since this is in a view that could be launch by a
user showing it, I won't have a handle to the editor at the time the
view is created and therefore, can not get its action registry to
grab to the UNDO/REDO commands and put them in the view's action bars.
Or am I missing the nose that is on my face?
Thanks again,
Phil
Whitney Sorenson wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Take a look at createActions() in GraphicalEditor/LogicEditor.
"Phil Williams" <<a class="moz-txt-link-abbreviated" href="mailto:phil.williams@toadmail.com">phil.williams@toadmail.com</a>
<a class="moz-txt-link-rfc2396E" href="mailto:phil.williams@toadmail.com"><mailto:phil.williams@toadmail.com></a>> wrote in message
<a class="moz-txt-link-freetext" href="news:c15a3o$54n$1@eclipse.org">news:c15a3o$54n$1@eclipse.org</a>...
ok, next question, how do I get a handle to the action registry to
hook into the undo, redo commands. This is what I thought I
needed to add to my view's init() method:
ActionRegistry registry = viewSite.getActionRegistry();
IActionBars bars = viewSite.getActionBars();
String id = IWorkbenchActionConstants.UNDO;
bars.setGlobalActionHandler(id, registry.getAction(id));
id = IWorkbenchActionConstants.REDO;
bars.setGlobalActionHandler(id, registry.getAction(id));
but a IViewSite does not have an action registry as a page site
does.
Thanks again,
Phil
Phil Williams wrote:
</pre>
<blockquote type="cite">
<pre wrap=""> Once again, thanks. And while it is related it was really two
separate issues. The other post is how to get a custom action to
enable and disable based on the state of the editor. This is how
to tie a view to the undo/redo actions.
Phil
Randy Hudson wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Is this related to the post which came after?
It sounds like you aren't hooking the global undo action from your
view. It
is the same as for editorparts.
"Phil Williams" <a class="moz-txt-link-rfc2396E" href="mailto:phil.williams@toadmail.com"><phil.williams@toadmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:c12nd4$6lo$1@eclipse.org">news:c12nd4$6lo$1@eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">I have a view that is essentially tied to my editor and allows
the user
to edit various properties of the model. I want to be able to
mark the
editor as dirty when anything is changed, so I encapsulate the
change as
a command and put it on the stack.
Everything is working fine, but I want to have the Eclipse menu
Edit->Undo to be activated when the view is the active part.
Currently,
the only way to get the undo to activate once a change has been
made is
to make the editor active and then I see the "Undo my model change"
activate in the edit menu of the workbench.
How can I tie the activation of undo and redo in the edit menu when
another view is active to the GEF actions/command stack?
TIA,
Phil
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>
--------------040907040305040705090505--
|
|
|
Goto Forum:
Current Time: Sun Sep 01 06:30:34 GMT 2024
Powered by FUDForum. Page generated in 0.04394 seconds
|