Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Custom icons for workbench content
Custom icons for workbench content [message #34178] Sat, 22 November 2008 09:29
Eclipse UserFriend
Originally posted by: jkan.tzi.de

Hi,

For a custom project nature, i have to replace the default icon of
certain folders in the project explorer view, depending on its contents
(files und subfolders).

My current approach is to extend org.eclipse.ui.decorators using a
ILightweightLabelDecorator to add a replace overlay to the respective
icons:


public class ProjectLabelDecorator extends LabelProvider
implements ILightweightLabelDecorator {

...

public void decorate(Object element, IDecoration decoration) {
if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
try {
if (folder.getProject().hasNature("rttdt.nature")) {
if (ProjectNature.isTestcase(folder)) {
IDecorationContext context =
decoration.getDecorationContext();
if (context instanceof DecorationContext) {
((DecorationContext) context).putProperty(
IDecoration.ENABLE_REPLACE, Boolean.TRUE);
}
decoration.addOverlay(fTestcaseOverlay,
IDecoration.REPLACE);
}
} catch (CoreException e) {
}
}
}

...
}

I'm not happy with this solution, since there is a delay between the
expansion of a folder and the display of the custom icon.

My question: is there a better way for conditionally replacing resource
icons, without the need for extending
org.eclipse.ui.navigator.navigatorContent and providing a custom content
provider?


Johannes
Previous Topic:Eclipse Events
Next Topic:Custom icons for workbench content
Goto Forum:
  


Current Time: Fri Mar 14 01:22:26 EDT 2025

Powered by FUDForum. Page generated in 0.02972 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top