Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Finding the active IViewReference in an IViewPart
Finding the active IViewReference in an IViewPart [message #314571] Tue, 17 April 2007 19:48 Go to next message
Eclipse UserFriend
Originally posted by: abc.123.com

I'm trying to find a way to get the active IViewReference from a
IViewPart when the IViewReference gets selected. I've been trying to
work with the IPartListener2 interface to trap the selection on a
partActivated() even for an IViewPart, but I'm not sure if this is the
way to go.

The problem is that the IPartListener2.partActivated() event will trap
the selected (activated) IViewReference when you click on it, but the
IPartListener2.partActivated() will also fire for every IViewReferences
thatis currently opened for an IViewPart. In other words, if the first
of ten active IViewReferences in an IViewPart is selected, then
partActivated() will fire ten times with the same results
(i.e. the first IViewReference is now active).

Is there better way of doing this?

Thanks in advance.
DW
Re: Finding the active IViewReference in an IViewPart [message #314678 is a reply to message #314571] Thu, 19 April 2007 08:38 Go to previous message
Eclipse UserFriend
uh, that doesn't quite make sense.

IPartListener2#partActivated(*) will fire for each part that is activated.

The *last* fired event will be the active IWorkbenchPartReference
(IViewReference or IEditorReference).

You can also ask the IWorkbenchPage to return the current active part
ref via getActivePartReference()

Later,
PW
Previous Topic:How to enable/disable a menu with the new org.eclipse.ui.menus extension point?
Next Topic:Can I add toolbaritems defind by a plugin(in plugin.xml) anywhere I want in the eclipse-coolbar??
Goto Forum:
  


Current Time: Fri May 09 22:57:12 EDT 2025

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

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

Back to the top