To set Custom Icon in project view

Hi ,

What I want to do?
I want to set my own icons in front of the files seen in project View.
The Icon to be displayed depends on the status of file.The status of file
can be modified or saved.

What Have I done uptil now?
1)I have implemented the TreeStructureProvider and the modify() method is
getting called.

The implemented modify method code:
public Collection modify(AbstractTreeNode abstractTreeNode, Collection
absTreeNodeCollection, ViewSettings viewSettings) {
if(abstractTreeNode instanceof ProjectViewNode)
{
ProjectViewNode node = (ProjectViewNode)abstractTreeNode;
ItemPresentation presentation =
abstractTreeNode.getPresentation();
assert presentation != null;
if(presentation instanceof PresentationData)
{
Icon icon = IconLoader.getIcon("/icon/accli16.gif");
PresentationData press =
((PresentationData)abstractTreeNode.getPresentation()).setIcons(icon);
abstractTreeNode.update();
}
}
return absTreeNodeCollection;
}


Problems????????
1) The icon which I set is not getting displayed.

Questions?
1) Do we have to extend AbstractTreeNode method and provide implementation
of update(PresentationData presentationData) method?
If we implement abstract methods of AbstractTreeNode When will this
method be called and who will call this method ?.

2) Is there any need to properly implement public getData(Collection
absTreeNodeCollection,String dataIdentifier) of TreeStructureProvider
The below given is my implementation for it::
Object getData(Collection absTreeNodeCollection,String
dataIdentifier)
{
System.out.println("Get data called");
Object node = null;
return node;
}


Please prompt me where have I gone wrong. Please help me To properly how
do I achieve this task. I am not getting anything from the documentation.
I am kind of STUCK UP at this point.Can Someone Explain we The flow of
Implementing this task to set custom icons.


Thanks for Any Solution.
Yuvraj





Please sign in to leave a comment.