Hello everybody,
I´m currently programming a text editor based on the JFace Text framework. Syntax highlighting works just fine, my problem is the content formatting.
public IContentFormatter getContentFormatter(ISourceViewer pSourceViewer) {
ContentFormatter lFormatter = new ContentFormatter();
A4LFunctionFormattingStrategy lFunctionStrategy = new A4LFunctionFormattingStrategy();
lFormatter.setFormattingStrategy(lFunctionStrategy,
A4LPartitionScanner.A4L_FUNCTION);
return lFormatter;
}
public class A4LFunctionFormattingStrategy implements IFormattingStrategy
{
@Override
public String format(String content, boolean isLineStart, String indentation, int[] positions) {
if(indentation.length()==0){
return content;
} else {
System.out.println("test");
return content;
}
}
@Override
public void formatterStarts(String arg0) {
System.out.println("starts");
}
@Override
public void formatterStops() {
System.out.println("stops");
}
}
the function getContentFormatter is executed, the editor starts just fine. But no matter what I´m doing, the format function in A4LFunctionFormattingStrategy is never called. How can i call this method? I thought something like CTRL+SHIFT+F, just like eclipse.
I´m pretty desperate right now, so I would be greatly appreciative for all your advices.
Best regards
StefanK