Skip to main content

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 Go to next message
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.
Re: Hiding text in Editor [message #1700649 is a reply to message #890010] Mon, 06 July 2015 08:44 Go to previous message
Hasan Emre Kirmizi is currently offline Hasan Emre KirmiziFriend
Messages: 2
Registered: July 2015
Junior Member
Hi, I have a same problem now, I saw that you posted it in 2012, Did you solve the problem?
Previous Topic:Export Eclipse Plugin Jar through command Line is not working
Next Topic:OSGi (Equinox) going forward... or not?
Goto Forum:

Current Time: Mon May 21 15:05:56 GMT 2018

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

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

Back to the top