|
Re: Catching key pressing [message #458891 is a reply to message #458875] |
Mon, 25 July 2005 16:46 |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
"Alex" <rashevsky@gmail.com> wrote in message
news:651a2d9a2f7a7db70288b1ff9c24299e$1@www.eclipse.org...
> Hello. Please, tell me, how can I catch Enter key pressing in my
> TextEditor class? I'm try to add auto indent to my editor.
>
>
To add auto indent, you don't need to catch key presses yourself.
Consider using the org.eclipse.jface.text.IAutoEditStrategy interface
instead.
Specifically, you could extend
org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy
(org.eclipse.jface.text.DefaultAutoIndentStrategy in Eclipse 3.0).
You can then call prependAutoEditStrategy() on your TextViewer to install
your strategy.
---
Sunil
|
|
|
|
Re: Catching key pressing [message #458925 is a reply to message #458910] |
Tue, 26 July 2005 17:05 |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
"Alex" <rashevsky@gmail.com> wrote in message
news:bc7296c2153a2994745037ace78c6597$1@www.eclipse.org...
> Tnx.
> So, I wrote XMLAutoIndentStrategy class, register it in the
> XMLSourceViewerConfiguration class:
> public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer
> sourceViewer,
> String contentType)
> {
> return new
> XMLAutoIndentStrategy(UIPlugin.getDefault().getPreferenceSto re());
> }
>
> Then, I set configuration in the Editor class:
> setSourceViewerConfiguration(new XMLConfiguration(colorManager));
>
> But when I press "Enter" key method
> XMLAutoIndentStrategy.customizeDocumentCommand does'n calls...
>
> Sorry for my english...
>
Have you set up document partitioning?
Without document partitioning, auto indent will not work.
If you have, then all I can recommend is debugging to make sure your auto
indent strategy is being installed, and then check what happens when a key
is pressed on the editor styledtext widget.
---
Sunil
|
|
|
Powered by
FUDForum. Page generated in 0.04116 seconds