如何使用 Eclipse JFace 中的 IDecorationContext api
是否有使用 IDecerationContext
进行标签装饰的示例?
从表面上看, IDecationContext
类似乎提供了某种上下文装饰支持,但在我的一生中,我找不到任何使用此功能的示例代码...
有人真正使用过装饰吗上下文功能,如果有,它解决了哪些用例?
PS:我正在寻找一种将图像装饰应用于对象标签的方法,并且根据对象的显示位置,基本图标大小会有所不同(例如,表和树项目中的传统“小”图标以及内容标题的图标更大)。
应用于原始图标的装饰应相应选择合适尺寸的装饰。
IDecerationContext
似乎符合我的需要,但文档非常稀疏,就像人们对开源库的一个小功能所期望的那样,并且没有找到任何示例。
谷歌搜索“IDecorationContext”也没有发现任何有趣的东西,所以我转向 StackOverflow 群众智慧,希望下一个得到问题的人能够更快地得到答案;)
Is there an example out there for using IDecorationContext
for label decorations?
By the looks of it, IDecorationContext
class seems to provide some sort of contextual decoration support, but for the life of me, I can not find any sample code using this feature...
Has anybody actually used decoration context feature and if so, what use cases did it solve?
PS: I am looking for a way to apply image decorations to object labels and depending on where the object is displayed, the base icon size varies (e.g. traditional "small" icons in table- and tree items and larger icons for content headers).
The decorations applied to the original icons should choose appropriate size decorations accordingly.
IDecorationContext
seems to fit the bill for what I need it for, but the documentation is as sparse as one can expect from a minor feature of an open source library and there are no examples to be found.
Googling for the "IDecorationContext" did not reveal anything interesting either, so I turn to StackOverflow crowd wisdom in hopes next guy getting the question would be able to get their answer faster ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有使用 IDecorationContext,但您可以看到它在
org.eclipse.jface.viewers.LabelDecorator
。此线程中也对此进行了讨论(即使有没有答案,这至少可以给你一个起点)
我当前的方法是使用扩展 org.eclipse.ui.decorators
ILightweightLabelDecorator 添加替换覆盖到相应的
图标:
I did not use IDecorationContext, but you can see it used in
org.eclipse.jface.viewers.LabelDecorator
.It is also discussed in this thread (even if there are no answer, that can at least give you a starting point)
My current approach is to extend org.eclipse.ui.decorators using a
ILightweightLabelDecorator to add a replace overlay to the respective
icons: