以编程方式改变eclipse中的背景颜色 [英] programmatically change the background color in eclipse

查看:311
本文介绍了以编程方式改变eclipse中的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与eclipse插件开发相关的问题。有任何方式
通过它我可以在eclipse中以编程方式更改背景颜色。
我可以通过在ITextViewer
中调用
setTextColor(color,offset,length,controlRedraw)来更改文本前景色,但我没有找到任何可以更改背景的函数
文本的颜色。
如果任何人已经通过这种方式分享您的想法。



感谢
arav

解决方案

我不知道这可以做到容易,没有扩展你自己的版本的文本编辑器,这里你提供配置类内部接受 PresentationReconciler 类,类似于 Rule 类,告诉您是否需要放置前台背景颜色



请参阅此文档



PresentationReconciler




  • IPresentationDamager :定义文本更改时的脏区

  • code> IPresentationRepairer :为脏区重建演示

  • DefaultDamagerRepairer 令牌扫描器

  • ITokenScanner :将文本解析成令牌流

  • RuleBasedScanner 使用简单规则






从文本编辑器食谱,文本编辑器的季节食谱



这里,null背景颜色意味着,为该窗口小部件采用默认系统背景。 (所以这里:白色)。

但是,您可以根据文档的分区和适用的规则指定所需的任何颜色。


I have a question related to eclipse plugin development. Is there any means by which I can programmatically change the background color in eclipse. I am able to change the text foreground color by calling setTextColor(color, offset, length, controlRedraw) in ITextViewer but I don't find any function by which I can change the background color of the text. If anyone has been through this kindly share your thoughts.

Thanks arav

解决方案

I am not sure this can be done easily, short of extending your own version of a Text Editor, here you provide a Configuration Class which inturn accepts a PresentationReconciler Class which is like a Rule Class that tells you if you need to put a Foreground or a Background Color

See this document

PresentationReconciler

  • IPresentationDamager: define dirty region given a text change
  • IPresentationRepairer: recreate presentation for dirty region
  • DefaultDamagerRepairer does both, based on a token scanner
  • ITokenScanner: parse text into a token stream
  • RuleBasedScanner uses simple rules

Extract from the presentation

From Text Editor Recipes, Season’s recipes for your text editor
Tom Eicher, IBM Eclipse Team

Here, the null background color means, takes the default system background for that widget. (so here: white).
But you could specify whatever color you want, based on the partitioning of your document and on the rules that would apply.

这篇关于以编程方式改变eclipse中的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆