How to get the correct zoomManger when using a MultiPageEditorPart [message #197089] |
Thu, 29 September 2005 15:22 ![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=) |
|
|
|
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 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
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 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: 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 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=) |
|
|
|
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 Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03561 seconds