Add AutoEditStrategy to my Source Viewer [message #492817] |
Wed, 21 October 2009 16:43  |
Eclipse User |
|
|
|
Hi, I am trying to change the default auto-indent behavior of an AbstractDecoratedTextEditor. I need to do things like increasing the indentation when the cursor is after an opening bracket { and the user inserts a new line.
To do this I implemented my own IAutoEditStrategy and added the following code in the method createSourceViewer in my subclass of AbstractDecoratedTextEditor:
ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
ITextViewerExtension2 viewerExt2 = (ITextViewerExtension2) viewer;
viewerExt2.prependAutoEditStrategy(new TestScriptAutoIndentStrategy(), IDocument.DEFAULT_CONTENT_TYPE);
return viewer;
Nevertheless this is not working. Method customizeDocumentCommand in my IAutoEditStrategy is never called. I tried to search through Eclipse source code to determine how is the default IAutoEditStrategy created and/or assigned to the viewer but couldn't find anything.
Thanks.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04360 seconds