Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Is there a list of navigation events that affect the Java editor?
Is there a list of navigation events that affect the Java editor? [message #248498] Mon, 08 October 2007 20:41 Go to next message
Eclipse UserFriend
Originally posted by: myawn.ebay.com

I'm embedding a Java editor (CompilationUnitEditor) as one page of a
multi-page editor. I'd like to be able to listen for any events that
might be done in other views (e.g, Outline view, or various views in the
Debug perspective) that would cause navigation to a particular point in
the source page, so that I can respond accordingly.

Specifically, what's happening is that if the tab for the source view is
selected in my multi-part editor, everything works. But if a different
tab in the editor is active, the navigation event appears to have no
affect. If I manually switch tabs to the source page, I see that the
method selected from the outline view is indeed highlighted. So the
selection event was seen properly -- but it looks like I need to
eavesdrop on this event and use it to cause my editor to switch to the
source view page.

I'm not sure how best to hook into this. The JavaEditor has, for
example, an 'OutlineSelectionChangedListener', but that's only one of
the things that probably should trigger the 'move source view to the
top' behavior.

Digging into what happens on that event, it looks like perhaps
ISourceViewer.revealRange is the trigger than I want. I'm not sure if I
should be subclassing the CompilationUnitEditor simply so I can
intercept this single method invocation, or if there is a broader event
I could be listening for instead.
Re: Is there a list of navigation events that affect the Java editor? [message #248687 is a reply to message #248498] Thu, 11 October 2007 16:21 Go to previous message
Eclipse UserFriend
Originally posted by: myawn.ebay.com

Mike Yawn wrote:
> I'm embedding a Java editor (CompilationUnitEditor) as one page of a
> multi-page editor. I'd like to be able to listen for any events that
> might be done in other views (e.g, Outline view, or various views in the
> Debug perspective) that would cause navigation to a particular point in
> the source page, so that I can respond accordingly.

Still trying to find the right way to do this. I've tried registering
first an IViewportListener, and then an ISelectionChangedListener. But
I'm registering these on the JavaEditor, which means that if the editor
isn't visible, the events don't get fired, so I can't take the
appropriate action of switching to the correct page in my multi-page editor.

I guess I could instead register the listener on the Outline view, but I
was trying to come up with a generalized solution that works for any
View that might cause an interaction with the Editor. (For example, I
can select a method in either the Outline view, or in the Package
Explorer view, or in the AST view, and in each case the Editor source
scrolls to the appropriate method.) Is there some common point of
communication so that I don't have to register listeners on each of
these views to know when the editor view should be updated?

Mike
Previous Topic:Listening selection from the JDT
Next Topic:Hightlight area in editor
Goto Forum:
  


Current Time: Sat Jul 20 23:23:17 GMT 2024

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

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

Back to the top