Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Sharing zoom action between different editors
Sharing zoom action between different editors [message #151907] Fri, 24 September 2004 09:28 Go to next message
kiril mitov is currently offline kiril mitovFriend
Messages: 128
Registered: July 2009
Senior Member
Hi,

I have made a MultiPageEditor and one of it`s page is a GEF editor. This
page supports the zoomIn and zoomOut actions. When I open the editor this
actions are added to the toolBar of the workbench, and there isn`t any
problem to use them.

The problem is that when I open a second file with the same editor (the
two files are now opened) the second editor adds another zoomIn and
zoomOut aciton to the toolBar. And now I have two zoomIn actions and two
zoomOut actions. The first ones are working with the first opened file and
the second ones are working with the second file.

I want to have only one zoomIn action and one zoomOut action and to share
them acrossed the opened files. I now that maybe I can put them az
globalActions, but zoom actions are constructed az follows

IAction zoomIn = new ZoomInAction(root.getZoomManager());

and here root is the rootEditPart. So if they are globalActions I must
somehow get them from the toolBar and change their zoomManagers. But I
can`t see a way to set the zoomManager of an zoomAction. The only way to
do this is to construct a new instance of the zoomAction, to remove the
old action and to put the new one. But this operations must be done not
only when I open a new file with my editor but even more - when I switch
between the open files.

The problem gets bigger becouse my editor isn`t a GraphicalEditor and
there isn`t such a thing like ActionRegistry. My editor is a MultiPage
Editor and only one of its pages is a GEF page.

I don`t know whether this is a good solution but I thought that I could
"add" the ActionRegistry to the MultiPageEditor myself but it seems to be
not so simple, and I am not sure if this will work.

Could somebody help me find a way to solve my problem, and to share the
actions between opend files.

Thank you.

Kiril Mitov
Re: Sharing zoom action between different editors [message #151988 is a reply to message #151907] Fri, 24 September 2004 22:40 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
You need to use retarget actions (ZoomInRetargetAction and
ZoomOutRetargetAction in this case).

"kiril mitov" <kiril_mitov@abv.bg> wrote in message
news:cj0pc9$q1r$1@eclipse.org...
> Hi,
>
> I have made a MultiPageEditor and one of it`s page is a GEF editor. This
> page supports the zoomIn and zoomOut actions. When I open the editor this
> actions are added to the toolBar of the workbench, and there isn`t any
> problem to use them.
>
> The problem is that when I open a second file with the same editor (the
> two files are now opened) the second editor adds another zoomIn and
> zoomOut aciton to the toolBar. And now I have two zoomIn actions and two
> zoomOut actions. The first ones are working with the first opened file and
> the second ones are working with the second file.
>
> I want to have only one zoomIn action and one zoomOut action and to share
> them acrossed the opened files. I now that maybe I can put them az
> globalActions, but zoom actions are constructed az follows
>
> IAction zoomIn = new ZoomInAction(root.getZoomManager());
>
> and here root is the rootEditPart. So if they are globalActions I must
> somehow get them from the toolBar and change their zoomManagers. But I
> can`t see a way to set the zoomManager of an zoomAction. The only way to
> do this is to construct a new instance of the zoomAction, to remove the
> old action and to put the new one. But this operations must be done not
> only when I open a new file with my editor but even more - when I switch
> between the open files.
>
> The problem gets bigger becouse my editor isn`t a GraphicalEditor and
> there isn`t such a thing like ActionRegistry. My editor is a MultiPage
> Editor and only one of its pages is a GEF page.
>
> I don`t know whether this is a good solution but I thought that I could
> "add" the ActionRegistry to the MultiPageEditor myself but it seems to be
> not so simple, and I am not sure if this will work.
>
> Could somebody help me find a way to solve my problem, and to share the
> actions between opend files.
>
> Thank you.
>
> Kiril Mitov
>
Re: Sharing zoom action between different editors [message #152228 is a reply to message #151988] Mon, 27 September 2004 21:38 Go to previous message
kiril mitov is currently offline kiril mitovFriend
Messages: 128
Registered: July 2009
Senior Member
Thanks for the hint Pratik.
I will try it.

kiril

Pratik Shah wrote:

> You need to use retarget actions (ZoomInRetargetAction and
> ZoomOutRetargetAction in this case).

> "kiril mitov" <kiril_mitov@abv.bg> wrote in message
> news:cj0pc9$q1r$1@eclipse.org...
> > Hi,
> >
> > I have made a MultiPageEditor and one of it`s page is a GEF editor. This
> > page supports the zoomIn and zoomOut actions. When I open the editor this
> > actions are added to the toolBar of the workbench, and there isn`t any
> > problem to use them.
> >
> > The problem is that when I open a second file with the same editor (the
> > two files are now opened) the second editor adds another zoomIn and
> > zoomOut aciton to the toolBar. And now I have two zoomIn actions and two
> > zoomOut actions. The first ones are working with the first opened file and
> > the second ones are working with the second file.
> >
> > I want to have only one zoomIn action and one zoomOut action and to share
> > them acrossed the opened files. I now that maybe I can put them az
> > globalActions, but zoom actions are constructed az follows
> >
> > IAction zoomIn = new ZoomInAction(root.getZoomManager());
> >
> > and here root is the rootEditPart. So if they are globalActions I must
> > somehow get them from the toolBar and change their zoomManagers. But I
> > can`t see a way to set the zoomManager of an zoomAction. The only way to
> > do this is to construct a new instance of the zoomAction, to remove the
> > old action and to put the new one. But this operations must be done not
> > only when I open a new file with my editor but even more - when I switch
> > between the open files.
> >
> > The problem gets bigger becouse my editor isn`t a GraphicalEditor and
> > there isn`t such a thing like ActionRegistry. My editor is a MultiPage
> > Editor and only one of its pages is a GEF page.
> >
> > I don`t know whether this is a good solution but I thought that I could
> > "add" the ActionRegistry to the MultiPageEditor myself but it seems to be
> > not so simple, and I am not sure if this will work.
> >
> > Could somebody help me find a way to solve my problem, and to share the
> > actions between opend files.
> >
> > Thank you.
> >
> > Kiril Mitov
> >
Previous Topic:How can i get the source codes of GEF?
Next Topic:collapse/expand nested container problem
Goto Forum:
  


Current Time: Sun Nov 23 04:47:34 GMT 2014

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

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