我可以合并语法着色和折叠吗?或从主文档信息中着色的投影 [英] Can I merge Syntax coloring and Folding? OR Projection colored from master document info
问题描述
示例.我有一个XML文档:
Example. I have an XML document:
<document>
<region type="type1">text of region1
</region>
some simple text
<region type="type2">text of region2
</region>
我希望它显示为
region1的文本
一些简单的文字
region2的文本
text of region1
some simple text
text of region2
据我所知,基本的Eclipse着色与折叠无关.但是我需要根据xml信息对文本进行着色.或者也许我需要其他东西,而不是折叠?仅操作StyledText可能会更容易,但是我需要其他Eclipse Editor函数才能继续工作.
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?
推荐答案
我已经通过文档侦听器服务ProjectionDocument.removeMasterDocumentRange和ProjectionDocument.getDocumentInformationMapping()实现了它.通过SourceViewer.getTextWidget().setStyleRange()进行着色.如果要添加PresentationReconciler会有一点问题,但是据我所知,它是安全的.
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.
这篇关于我可以合并语法着色和折叠吗?或从主文档信息中着色的投影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!