Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Undo/Redo
Undo/Redo [message #208347] Tue, 31 January 2006 17:02 Go to next message
Eclipse UserFriend
Originally posted by: gmittendorferREMOVETHISTEXT.web.de

Hi,

I am trying to connect my GEF editor with the RCP application wide
Undo/Redo support.

Do you have an idea how to do this or can you point me to a working example?

Kind regards,

Georg
Re: Undo/Redo [message #208397 is a reply to message #208347] Wed, 01 February 2006 22:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

I havent done anything with RCP specifically, but if you are referring
to the new IUndoableOperation stuff that appeared in eclipse 3.1, I
remember hearing that there were plans to migrate the GEF undo support
to that API.

Until that is done, I can say that integration is possible, but involves
some hacks when it comes to intercepting the operations built into the
graphical editor infrastructure (figure move, resize etc.)

regards,
Christian

Georg Mittendorfer wrote:
> Hi,
>
> I am trying to connect my GEF editor with the RCP application wide
> Undo/Redo support.
>
> Do you have an idea how to do this or can you point me to a working
> example?
>
> Kind regards,
>
> Georg
Re: Undo/Redo [message #209594 is a reply to message #208347] Thu, 16 February 2006 16:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cmvp.tragsatec.es

Hi Georg!
I read your interesting question and I wonder if you ever got the answer to connect a GEF editor with RCP.

Please let me know.
Kind regards
Cristina
my email!! cmvp@tragsatec.es
Re: Undo/Redo [message #210451 is a reply to message #209594] Tue, 28 February 2006 10:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gmittendorferREMOVETHISTEXT.web.de

cristina wrote:
> Hi Georg!
> I read your interesting question and I wonder if you ever got the answer to connect a GEF editor with RCP.
>
> Please let me know.
> Kind regards
> Cristina
> my email!! cmvp@tragsatec.es

Hi Christina,

I didn't get an answer but here is my solution. In my GraphicalEditor in
createPartControl I hooked into the global redo/undo actions like this:

@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
IActionBars actionBars = getEditorSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId() ,
new Action() {
@Override
public void run() {
if (getEditDomain().getCommandStack().canUndo()) {
getEditDomain().getCommandStack().undo();
}
}
});
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId() ,
new Action() {
@Override
public void run() {
if (getEditDomain().getCommandStack().canRedo()) {
getEditDomain().getCommandStack().redo();
}
}
});
}

Kind regards,

Georg
Re: Undo/Redo [message #210686 is a reply to message #210451] Fri, 03 March 2006 08:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gmittendorferREMOVETHISTEXT.web.de

Georg Mittendorfer wrote:
> cristina wrote:
>> Hi Georg!
>> I read your interesting question and I wonder if you ever got the
>> answer to connect a GEF editor with RCP.
>> Please let me know.
>> Kind regards
>> Cristina
>> my email!! cmvp@tragsatec.es
>
> Hi Christina,
>
> I didn't get an answer but here is my solution. In my GraphicalEditor in
> createPartControl I hooked into the global redo/undo actions like this:
>
> @Override
> public void createPartControl(Composite parent) {
> super.createPartControl(parent);
> IActionBars actionBars = getEditorSite().getActionBars();
> actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId() ,
> new Action() {
> @Override
> public void run() {
> if (getEditDomain().getCommandStack().canUndo()) {
> getEditDomain().getCommandStack().undo();
> }
> }
> });
> actionBars.setGlobalActionHandler(ActionFactory.REDO.getId() ,
> new Action() {
> @Override
> public void run() {
> if (getEditDomain().getCommandStack().canRedo()) {
> getEditDomain().getCommandStack().redo();
> }
> }
> });
> }
>
> Kind regards,
>
> Georg

Hi again,

update: the above solution is not correct (although it works in some cases).

I solved the problem by hooking into the global actions by creating an
action bar contributor (adding RetargetActions in the buildActions
method) like in the GEF shape example. See classes ShapesEditor and
ShapesEditorActionBarContributor there.

Kind regards,

Georg
Re: Undo/Redo [message #211019 is a reply to message #210686] Tue, 07 March 2006 18:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cmvp.tragsatec.es

Hi again,
danke für deine Hilfe.Ich versuchte deine erste lösung in meinem PC und es hat funktioniert.
Vielen dank!
(Hab gesehen,ich kann dir auf Deutsch schreiben.Ich hab an der uni in Klagenfurt (Ö) studiert).
Bis bald,
Cristina
Re: Undo/Redo [message #211278 is a reply to message #210451] Thu, 09 March 2006 08:22 Go to previous message
Eclipse UserFriend
Originally posted by: cmvp.tragsatec.es

Hola!
Wirklich wohnst du in Graz?
Hier über 20ºC...;)
Zufall!
Previous Topic:How to add feedback to a XYAnchor connection?
Next Topic:Flashplayer
Goto Forum:
  


Current Time: Mon Jan 20 05:22:11 GMT 2025

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

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

Back to the top