【问题标题】:Can I merge Syntax coloring and Folding? OR Projection colored from master document info我可以合并语法着色和折叠吗?或从主文档信息着色的投影
【发布时间】:2010-11-04 06:43:40
【问题描述】:

示例。我有一个 XML 文档:

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

我希望它显示为

区域 1 的文本
一些简单的文本
region2的文本

据我所知,基本的 Eclipse 着色工作独立于折叠。但我需要根据 xml 信息对文本进行着色。或者也许我需要其他东西,而不是折叠?只操作 StyledText 可能更容易,但我需要其他 Eclipse 编辑器功能才能继续工作。

=========
更新: 仍然没有建议?至少有可能吗?
我看过投影,但是...是否可以从编辑器的这个分支直接访问文本属性?
upd:也许至少有一些关于自定义投影的想法/文章?

【问题讨论】:

  • 我的意思是,我需要“着色投影”
  • 更准确地说,“从主文档信息中着色的投影”

标签: syntax-highlighting eclipse-rcp projection text-coloring


【解决方案1】:

我已经通过文档侦听器服务 ProjectionDocument.removeMasterDocumentRange 和 ProjectionDocument.getDocumentInformationMapping() 实现了它。通过 SourceViewer.getTextWidget().setStyleRange() 着色。如果添加 PresentationReconciler 会有点问题,但我知道,它是安全的。

【讨论】:

    猜你喜欢
    • 2017-06-03
    • 1970-01-01
    • 1970-01-01
    • 2021-09-06
    • 2011-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-14
    相关资源
    最近更新 更多