use of org.eclipse.n4js.ui.ImageDescriptorCache.ImageRef in project n4js by eclipse.
the class ProjectTypeLabelDecorator method decorate.
@Override
public void decorate(final Object element, final IDecoration decoration) {
try {
if (element instanceof IProject) {
final URI uri = createPlatformResourceURI(((IProject) element).getName(), true);
final IN4JSProject project = core.findProject(uri).orNull();
if (null != project) {
final ImageRef imageRef = IMAGE_REF_CACHE.get(project.getProjectType());
if (null != imageRef) {
final ImageDescriptor descriptor = imageRef.asImageDescriptor().orNull();
if (null != descriptor) {
decoration.addOverlay(descriptor);
}
}
}
}
} catch (final Exception e) {
// Exception should not propagate from here, otherwise the lightweight decorator stops working once till
// next application startup.
LOGGER.error("Error while trying to get decorator for " + element, e);
}
}
Aggregations