Using PostSelectionListener in Source Editor [message #214034] |
Fri, 02 September 2005 06:47 |
Eclipse User |
|
|
|
Originally posted by: prasadmpatil.NOSPAM.gmail.com
Hi,
I have added a PostSelectionListener to the source
editor(compilationUnitEditor) to listen for cursor movements. This works
as expected i.e fires selectionChanged event with some delay if the cursor
is moved using keyboard.
However if I highlight some text & then continue with my keyboard
operations, then the selectionChanged event is fired for every key stroke(
the behavior is similar to selectionListener instead of
PostSelectionListener). There are no other listeners registered.
I am unable to figure out this strange behavior. Can somebody help me out?
~Prasad
|
|
|
|
Re: Using PostSelectionListener in Source Editor [message #214075 is a reply to message #214057] |
Fri, 02 September 2005 17:57 |
Eclipse User |
|
|
|
Originally posted by: prasadmpatil.NOSPAMgmail.com
Hi Tom,
There are no other listeners registered on the source editor.
I have registered the listener as follows
ISelectionService service =
editor.getEditorSite().getWorkbenchWindow().getSelectionServ ice();
//editor is CompilationUnitEditor
service.addPostSelectionListener(_listener);
& the listener is as follows
public class ListenerGroup implements ISelectionListener
{
/**
* see org.eclipse.jface.viewers.ISelectionListener#selectionchange d
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection)
{
// Handle listener event
}
}
There are no calls for addSelectionListener() in my code. Besides other
are no other listeners registered either.
Besides if this behavior was due to interference other listeners then this
would happen all the time & not just when I highlight some text in the
source.
~Prasad
|
|
|
Re: Using PostSelectionListener in Source Editor [message #214167 is a reply to message #214075] |
Mon, 05 September 2005 12:47 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
What kind of viewer does your source editor use and which class does
your editor extend?
Dani
Prasad wrote:
> Hi Tom,
>
> There are no other listeners registered on the source editor.
>
> I have registered the listener as follows
>
> ISelectionService service =
> editor.getEditorSite().getWorkbenchWindow().getSelectionServ ice();
> //editor is CompilationUnitEditor
> service.addPostSelectionListener(_listener);
>
>
> & the listener is as follows
>
> public class ListenerGroup implements ISelectionListener
> {
>
> /**
> * see org.eclipse.jface.viewers.ISelectionListener#selectionchange d
> */
> public void selectionChanged(IWorkbenchPart part, ISelection
> selection)
> {
> // Handle listener event
> }
>
> }
>
> There are no calls for addSelectionListener() in my code. Besides
> other are no other listeners registered either.
> Besides if this behavior was due to interference other listeners then
> this would happen all the time & not just when I highlight some text
> in the source.
>
> ~Prasad
>
>
>
>
>
>
>
|
|
|
Re: Using PostSelectionListener in Source Editor [message #214229 is a reply to message #214167] |
Tue, 06 September 2005 13:41 |
Eclipse User |
|
|
|
Originally posted by: prasadmpatil.nospamgmail.com
Hi Tom/Daniel,
Sorry for the posting. There was callback for selectionChanged()(hidden
deep inside) which was causing the problem.
~Prasad
Daniel Megert wrote:
> What kind of viewer does your source editor use and which class does
> your editor extend?
> Dani
> Prasad wrote:
>> Hi Tom,
>>
>> There are no other listeners registered on the source editor.
>>
>> I have registered the listener as follows
>>
>> ISelectionService service =
>> editor.getEditorSite().getWorkbenchWindow().getSelectionServ ice();
>> //editor is CompilationUnitEditor
>> service.addPostSelectionListener(_listener);
>>
>>
>> & the listener is as follows
>>
>> public class ListenerGroup implements ISelectionListener
>> {
>>
>> /**
>> * see org.eclipse.jface.viewers.ISelectionListener#selectionchange d
>> */
>> public void selectionChanged(IWorkbenchPart part, ISelection
>> selection)
>> {
>> // Handle listener event
>> }
>>
>> }
>>
>> There are no calls for addSelectionListener() in my code. Besides
>> other are no other listeners registered either.
>> Besides if this behavior was due to interference other listeners then
>> this would happen all the time & not just when I highlight some text
>> in the source.
>>
>> ~Prasad
>>
>>
>>
>>
>>
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03300 seconds