Skip to main content


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 15:07
StefanK  is currently offline StefanK Friend
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: Sat Apr 27 03:34:33 GMT 2024

Powered by FUDForum. Page generated in 0.03208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top