Can I merge Syntax coloring and Folding? OR Projection colored from master document info

让人想犯罪 __ 提交于 2019-12-25 04:37:21

问题


Example. I have an XML document:

<document>
<region type="type1">text of region1
</region>
some simple text
<region type="type2">text of region2
</region>

And I want it to be presented as

text of region1
some simple text
text of region2

The basic Eclipse coloring works independent from folding, as I know. But I need text to be colored depending on the xml info. Or maybe I need something other, than folding? It's probably easier to just manipulate StyledText, but I need other Eclipse Editor functions to continue working.

=========
upd: Still no suggestions? Is it at least possible?
I've looked at projection, but... does text attributes directly accessible from this branch of editor?
upd: Maybe at least some thoughts/articles about custom projections?


回答1:


I've implementet it via document listener service, ProjectionDocument.removeMasterDocumentRange and ProjectionDocument.getDocumentInformationMapping(). Coloring by SourceViewer.getTextWidget().setStyleRange(). There is a little problem if PresentationReconciler will be added, but since I know it, its safe.



来源:https://stackoverflow.com/questions/1017375/can-i-merge-syntax-coloring-and-folding-or-projection-colored-from-master-docum

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!