Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » OutlinePage
OutlinePage [message #242601] Mon, 09 April 2007 07:28 Go to next message
Eclipse UserFriend
I have an Eclipse plugin that is basically a selectionListener which
listens to selection changes in the Ouline View.
How can I get my plugin to work even if the user closes the Outline View ?
I've tried getting the content Outline Page from the active editor and
adding the listener to that page but this doesn't work with the Outline
View closed:

IEditorPart editor = page.getActiveEditor();
IContentOutlinePage outlinePage = (IContentOutlinePage)
editor.getAdapter(IContentOutlinePage.class);
outlinePage.addSelectionChangedListener(selectionListener);

Or is there any other way of getting the IJavaElement that the user is
reading/writing at any givent moment ?
Re: OutlinePage [message #242630 is a reply to message #242601] Tue, 10 April 2007 08:15 Go to previous messageGo to next message
Eclipse UserFriend
George Ganea wrote:

> I have an Eclipse plugin that is basically a selectionListener which
> listens to selection changes in the Ouline View.
> How can I get my plugin to work even if the user closes the Outline
> View ?
> I've tried getting the content Outline Page from the active editor and
> adding the listener to that page but this doesn't work with the
> Outline View closed:
>
> IEditorPart editor = page.getActiveEditor(); IContentOutlinePage
> outlinePage = (IContentOutlinePage)
> editor.getAdapter(IContentOutlinePage.class);
> outlinePage.addSelectionChangedListener(selectionListener);
>
> Or is there any other way of getting the IJavaElement that the user is
> reading/writing at any givent moment ?
>
Listen to post selection events of the editor and then find the Java
element(s) for the current selection.

Dani
Re: OutlinePage [message #242679 is a reply to message #242630] Tue, 10 April 2007 19:17 Go to previous messageGo to next message
Eclipse UserFriend
Daniel Megert wrote:

> George Ganea wrote:

>> I have an Eclipse plugin that is basically a selectionListener which
>> listens to selection changes in the Ouline View.
>> How can I get my plugin to work even if the user closes the Outline
>> View ?
>> I've tried getting the content Outline Page from the active editor and
>> adding the listener to that page but this doesn't work with the
>> Outline View closed:
>>
>> IEditorPart editor = page.getActiveEditor(); IContentOutlinePage
>> outlinePage = (IContentOutlinePage)
>> editor.getAdapter(IContentOutlinePage.class);
>> outlinePage.addSelectionChangedListener(selectionListener);
>>
>> Or is there any other way of getting the IJavaElement that the user is
>> reading/writing at any givent moment ?
>>
> Listen to post selection events of the editor and then find the Java
> element(s) for the current selection.

> Dani

An Editor fires a selection Change only when some text is (de)selected
(e.g. when the user drags the mouse pointer over some text), it doesn't
work if the user only moves the cursor...

I've tried getting the current cursor position but then I need the
underlying JavaElement (e.g. IMethod)

thank you very much
Re: OutlinePage [message #242697 is a reply to message #242679] Wed, 11 April 2007 04:05 Go to previous messageGo to next message
Eclipse UserFriend
George Ganea wrote:

> Daniel Megert wrote:
>
>> George Ganea wrote:
>
>
>>> I have an Eclipse plugin that is basically a selectionListener which
>>> listens to selection changes in the Ouline View.
>>> How can I get my plugin to work even if the user closes the Outline
>>> View ?
>>> I've tried getting the content Outline Page from the active editor
>>> and adding the listener to that page but this doesn't work with the
>>> Outline View closed:
>>>
>>> IEditorPart editor = page.getActiveEditor();
>>> IContentOutlinePage outlinePage = (IContentOutlinePage)
>>> editor.getAdapter(IContentOutlinePage.class);
>>> outlinePage.addSelectionChangedListener(selectionListener);
>>>
>>> Or is there any other way of getting the IJavaElement that the user
>>> is reading/writing at any givent moment ?
>>>
>> Listen to post selection events of the editor and then find the Java
>> element(s) for the current selection.
>
>
>> Dani
>
>
> An Editor fires a selection Change only when some text is (de)selected
> (e.g. when the user drags the mouse pointer over some text), it
> doesn't work if the user only moves the cursor...

Please read my post again. I said POST selection listener.

Dani

>
> I've tried getting the current cursor position but then I need the
> underlying JavaElement (e.g. IMethod)
>
> thank you very much
>
Re: OutlinePage [message #242896 is a reply to message #242697] Sat, 14 April 2007 12:35 Go to previous message
Eclipse UserFriend
You were right, it now works...
Thank you very much
Previous Topic:apt ant task error output
Next Topic:Suppressing custom warnings
Goto Forum:
  


Current Time: Mon Jul 14 07:21:21 EDT 2025

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

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

Back to the top