Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Editor with JFace Text
Editor with JFace Text [message #490157] Wed, 07 October 2009 11:07
StefanK  is currently offline StefanK
Messages: 25
Registered: July 2009
Junior Member
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
Previous Topic:StringFieldEditor & conditional errorMessages
Next Topic:TitleAreaDialog: Widgets disposed after click on the OK-Button
Goto Forum:
  


Current Time: Wed Aug 27 21:29:42 EDT 2014

Powered by FUDForum. Page generated in 0.02045 seconds