Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to get the correct zoomManger when using a MultiPageEditorPart
How to get the correct zoomManger when using a MultiPageEditorPart [message #197089] Thu, 29 September 2005 15:22 Go to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
I have added a ZoomComboContributionItem to the ActionBarContributor for the
MultiPageEditorPart. The ZoomComboContributionItem uses a partListener to
call setZoomManager based on the partActivated call. Unfortuneatly
partActivated does not get called when page activation chnages in the
MultiPageEditorPart. So i get the last active zoomManager .

I dropped a selectListener off the ZoomComboContributionItem and this seems
to work , but seem a bit heavy for this purpose. Any other lighter ideas?

IWorkbenchPage wp = getPage();
final ZoomComboContributionItem zitem = new ZoomComboContributionItem(wp);
toolBarManager.add(zitem);
wp.addSelectionListener( new ISelectionListener()
{
// a selection listsner seems a bit heavy
// for this purpose, but it is one way to
// get the correct zoomManager after the active page
// chnages in the MultiPageEditorPart
public void selectionChanged(IWorkbenchPart part, ISelection selection)
{
zitem.setZoomManager((ZoomManager) part.getAdapter(ZoomManager.class));
}

});
Re: How to get the correct zoomManger when using a MultiPageEditorPart [message #197126 is a reply to message #197089] Thu, 29 September 2005 18:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Create your own MultiPageZoomManager, and call setPage(ZoomManager delegate)
when you switch pages. Then fire zoom level property changed event and the
combo should update.

"Drew" <drew@acm.org> wrote in message news:dhh0sb$2a4$1@news.eclipse.org...
>I have added a ZoomComboContributionItem to the ActionBarContributor for
>the
> MultiPageEditorPart. The ZoomComboContributionItem uses a partListener to
> call setZoomManager based on the partActivated call. Unfortuneatly
> partActivated does not get called when page activation chnages in the
> MultiPageEditorPart. So i get the last active zoomManager .
>
> I dropped a selectListener off the ZoomComboContributionItem and this
> seems
> to work , but seem a bit heavy for this purpose. Any other lighter ideas?
>
> IWorkbenchPage wp = getPage();
> final ZoomComboContributionItem zitem = new ZoomComboContributionItem(wp);
> toolBarManager.add(zitem);
> wp.addSelectionListener( new ISelectionListener()
> {
> // a selection listsner seems a bit heavy
> // for this purpose, but it is one way to
> // get the correct zoomManager after the active page
> // chnages in the MultiPageEditorPart
> public void selectionChanged(IWorkbenchPart part, ISelection selection)
> {
> zitem.setZoomManager((ZoomManager) part.getAdapter(ZoomManager.class));
> }
>
> });
>
>
Re: How to get the correct zoomManger when using a MultiPageEditorPart [message #197139 is a reply to message #197089] Thu, 29 September 2005 19:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Drew wrote:
> I have added a ZoomComboContributionItem to the ActionBarContributor for the
> MultiPageEditorPart. The ZoomComboContributionItem uses a partListener to
> call setZoomManager based on the partActivated call.

Your ActionBarContributor should be a
MultiPageEditorActionBarContribitor. Then you will get notified whenever
the active page changes (setActivePage() will be called). As far as I
know, this is the simplest solution.

Regards,

Martijn.
Re: How to get the correct zoomManger when using a MultiPageEditorPart [message #197273 is a reply to message #197139] Fri, 30 September 2005 15:31 Go to previous messageGo to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
This works perfectly for the ZoomComboContributionItem , but then the other
things that the GEF ActionBarContributor provides like addGlobalActionKey &
addRetargetAction no longer work since there is a bunch of action plumbing
that ActionBarContributor adds.


"Martijn van Steenbergen" <mvsteenbergen@eljakim.scratch-this.nl> wrote in
message news:dhhfcm$oed$1@news.eclipse.org...
> Drew wrote:
> > I have added a ZoomComboContributionItem to the ActionBarContributor for
the
> > MultiPageEditorPart. The ZoomComboContributionItem uses a partListener
to
> > call setZoomManager based on the partActivated call.
>
> Your ActionBarContributor should be a
> MultiPageEditorActionBarContribitor. Then you will get notified whenever
> the active page changes (setActivePage() will be called). As far as I
> know, this is the simplest solution.
>
> Regards,
>
> Martijn.
Re: How to get the correct zoomManger when using a MultiPageEditorPart [message #197289 is a reply to message #197273] Fri, 30 September 2005 16:25 Go to previous message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
I worked around by using the orignl impl of ActionBarContributor and setting
setting a reference to the ZoomComboContributionItem in

public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
if (part instanceof NotationMultiPageEditor)
{
NotationMultiPageEditor p = (NotationMultiPageEditor) part;
p.setZoomComboContributionItem(zitem);
}
}
// Then in the MPE.

protected void pageChange(int newPageIndex)
{
super.pageChange(newPageIndex);
if(myItemHack != null)
{
myItemHack.setZoomManager((ZoomManager)
this.getActiveEditor().getAdapter(ZoomManager.class));
}

}

"Drew" <drew@acm.org> wrote in message news:dhjlo4$kh2$1@news.eclipse.org...
> This works perfectly for the ZoomComboContributionItem , but then the
other
> things that the GEF ActionBarContributor provides like addGlobalActionKey
&
> addRetargetAction no longer work since there is a bunch of action plumbing
> that ActionBarContributor adds.
>
>
> "Martijn van Steenbergen" <mvsteenbergen@eljakim.scratch-this.nl> wrote in
> message news:dhhfcm$oed$1@news.eclipse.org...
> > Drew wrote:
> > > I have added a ZoomComboContributionItem to the ActionBarContributor
for
> the
> > > MultiPageEditorPart. The ZoomComboContributionItem uses a partListener
> to
> > > call setZoomManager based on the partActivated call.
> >
> > Your ActionBarContributor should be a
> > MultiPageEditorActionBarContribitor. Then you will get notified whenever
> > the active page changes (setActivePage() will be called). As far as I
> > know, this is the simplest solution.
> >
> > Regards,
> >
> > Martijn.
>
>
Previous Topic:GEF in ViewPart, TableWrapLayout
Next Topic:Draw2d FigureCanvas scrollbar visibility issue
Goto Forum:
  


Current Time: Mon Jan 20 07:20:09 GMT 2025

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

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

Back to the top