Is it possible to show only a part of a document in a (possible custom) Eclipse editor? There is ITextViewer#setVisibleRegion, but this only scrolls the viewport. I'd like to show only a partition of a given document or (alternatively) lock everything but a given region (i.e. make parts outside of this region non-editable).
Asked
Active
Viewed 151 times
1
-
It sounds like you might want an equivalent for Emacs' narrow-to-region. Are you including approaches like programmatically editing the document (probably the copy you're displaying, not the original), say by including text-cookies to trigger folding, or does it need to be strictly the original data, using buffer positions for folding (like narrow-to-region)? – Alex North-Keys Jul 19 '13 at 06:20
-
Programmatic editing is part of the task at hand. – pmf Jul 19 '13 at 07:32
1 Answers
2
You might try the Eclipse folding plugin at:
http://kosiara87.blogspot.com/2011/12/how-to-install-coffee-bytes-plugin-in.html
With a download at:
http://sites.google.com/site/bkosarzyckistorage1/eclipse-folding-plugin.tar.gz
It lets you define identifiers for start and end region, and then put them in your document to control visibility by region (apparently line based, rather than finer-grained, but that what most people tend to want).
In the "User Defined Regions" tab use e.g.:
Start identifier: region End identifier: endregion
In code:
//region SomeName
your code
//endregion SomeName
There's a thread on this in What code folding plugins work on Eclipse 3.6?
I haven't used it myself but it might fit your needs. It might also be incompatible with current versions of Eclipse - the page describing it is from about a year and a half ago.

Community
- 1
- 1

Alex North-Keys
- 4,200
- 1
- 20
- 22