| KeyListener [message #185462] | 
Tue, 27 January 2004 10:21   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: mckeoghjohn.hotmail.com 
 
Hi, 
 
Does anyone know how to add a KeyListener to an 
AbstractTextEditor or is there another level where 
it can be done? 
 
Thanks, 
John.
 |  
 |  
  | 
 | 
 | 
| Re: KeyListener [message #185592 is a reply to message #185506] | 
Tue, 27 January 2004 13:00   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: daniel.megert.gmx.net 
 
John McKeogh wrote: 
 
>Daniel Megert wrote: 
> 
>   
> 
>>john mckeogh wrote: 
>>     
>> 
> 
>   
> 
>>>Hi, 
>>> 
>>>Does anyone know how to add a KeyListener to an 
>>>AbstractTextEditor or is there another level where 
>>>it can be done? 
>>>  
>>> 
>>>       
>>> 
>>You can append it to its viewer (see ITextViewerExtension for more info)  
>>but this is only possible inside a subclass i.e. it's not public. 
>>     
>> 
> 
>   
> 
>>Dani 
>>     
>> 
> 
>   
> 
>>>Thanks, 
>>>John. 
>>> 
>>>  
>>> 
>>>       
>>> 
> 
>Thanks Dani, 
>I got an AbstractTextEditor with the following code: 
> 
>			theEd =(AbstractTextEditor) window.getActivePage().getActiveEditor(); 
> 
>I tried to get the viewer but it keeps coming up null. 
>theViewer = (ITextViewer) 
> window.getActivePage().getActivePart().getAdapter(ITextViewe r.class); 
> 
>Am I doing something wrong.  
>   
> 
Yes ;-) 
As said before, you can only do this inside subclasses of  
AbstractTextEditor, e.g. in your own editor. You cannot do this from  
outside. 
 
Dani 
 
>Your help is greatly appreciated. 
> 
>Thanks again, 
>John. 
> 
>   
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03742 seconds