Undo/Redo [message #208347] |
Tue, 31 January 2006 17:02 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03559 seconds