Sample code to implement powerful Light Weight Decorator to
paint tree and XXX nodes.
I used it to paint tree nodes in my project to show different images on top
of standard tree folder,+,- signs.
1) plugin.xml add the following node.
decorator
adaptable="true"
label="%plugin.my_label"
state="false"
lightweight="true"
location="BOTTOM_RIGHT"
class="com.xxx.TreeLabelProvider"
id="com.xxx.views"
enablement
objectClass
name="com.xxx.TreeObject"
objectClass
enablement
decorator
extension
stpid tool is not allowing me enter comple xml syntax.
2) open tree object class & add/ implement the following.
TreeLabelProvider extends LabelProvider
implements ILightweightLabelDecorer
implement
public Image getImage(Object element)
public String getText(Object element)
and
public void decorate(Object element, IDecoration decoration)
{
if (element instanceof TreeObject)
decoration.addOverlay(error,IDecoration.BOTTOM_RIGHT);
}
catch relation between TreeLabelProvider & TreeObject.
U are done. enjoy.
No comments:
Post a Comment