简体   繁体   English

如何在Eclipse Kepler中撰写图像?

[英]How to compose images in Eclipse Kepler?

This is a followup to Items decorations in a TreeViewer : I have a TreeView with my own Objects. 这是TreeViewer中Items装饰的后续步骤:我有一个带有自己的Objects的TreeView。 I already have a LabelProvider that supplies Icons and Texts. 我已经有提供图标和文本的LabelProvider Now I want to decorate the images with other images depending on some conditions. 现在,我想根据某些条件用其他图像来装饰图像。 How can I do this? 我怎样才能做到这一点? The referenced question uses ComposedImage , which I suppose is org.eclipse.emf.edit.provider . 引用的问题使用ComposedImage ,我想是org.eclipse.emf.edit.provider

Is there a way to do this with SWT/JFace in Eclipse 4.3? 有没有办法在Eclipse 4.3中使用SWT / JFace做到这一点?

I already tried using a ILightweightLabelDecorator (using the idea from the FAQ ), but gave up wrapping that round my LabelProvider . 我已经尝试过使用ILightweightLabelDecorator (使用FAQ中的想法),但是放弃了将它包装在LabelProvider周围。

ILightweightLabelDecorator is really the best way to do this. ILightweightLabelDecorator实际上是执行此操作的最佳方法。 Wrap your label provider with a DecoratingLabelProvider as described in this answer: Using a ILightweightLabelDecorator decorator Use the org.eclipse.ui.decorators extension point to declare your lightweight decorator. 按照此答案中的描述,用DecoratingLabelProvider包装标签提供者: 使用ILightweightLabelDecorator装饰器使用org.eclipse.ui.decorators扩展点来声明您的轻量装饰器。

您可能需要查看org.eclipse.jface.viewers.DecorationOverlayIcon ,它基本上由装饰提供程序使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM