Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Hiding text in Editor(Hiding text in text editor, e.g. using ProjectionDocuments)
Hiding text in Editor [message #890010] Wed, 20 June 2012 14:51
Ali Pang is currently offline Ali PangFriend
Messages: 1
Registered: June 2012
Junior Member

I'm trying to create an editor where I'm hiding certain patterns, e.g. I'd like to display the document

>   Foo@1000 : ...


>  Foo : ...

i.e. hiding the pattern @1000. This might appear multiple times within a line.

I've managed to get what I want using a ProjectionDocument, but this messes up my syntax highlighting etc (still appears, but with incorrect offsets.). I'm probably setting things up wrong. Are there any code examples of doing something similar somewhere?

To clarify, I do _not_ want this to behave as the java code folding, with expansion/collapsing. I'd simply like some text completely hidden from view.

Thanks for any help! My code so far has been to simply try to create an extension of FileDocumentProvider, but this appears not to be enough.

public class MyDocumentProvider extends FileDocumentProvider {

	protected IDocument createDocument(Object element) throws CoreException {
		IDocument document = super.createDocument(element);
		ProjectionDocumentManager pMan = new ProjectionDocumentManager();
		ProjectionDocument pDoc = (ProjectionDocument) pMan.createSlaveDocument(document);

		// just remove the first 10 characters for testing 
		try {
			pDoc.addMasterDocumentRange(10, document.getLength() - 10);
		} catch (BadLocationException e)
		// set up scanners
		if (pDoc != null) {
			IDocumentPartitioner partitioner =
				new FastPartitioner(
					new MyPartitionScanner(),
					new String[] 
		return pDoc;

Any help on how to set this up properly much appreciated.
Previous Topic:RevisionInformation or ChangeInformation on LineNumberChangeRulerColumn
Next Topic:build plugin with command line
Goto Forum:

Current Time: Sun Mar 29 00:11:52 GMT 2015

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

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