use of org.eclipse.che.ide.project.node.icon.NodeIconProvider in project che by eclipse.
the class ResourceNode method updatePresentation.
@Override
public void updatePresentation(@NotNull NodePresentation presentation) {
final StringBuilder cssBuilder = new StringBuilder();
final Optional<Marker> presentableTextMarker = getData().getMarker(PresentableTextMarker.ID);
if (presentableTextMarker.isPresent() && getData() instanceof Container) {
presentation.setPresentableText(((PresentableTextMarker) presentableTextMarker.get()).getPresentableText());
} else {
presentation.setPresentableText(getData().getName());
}
if (resourceIsCut) {
cssBuilder.append("opacity:0.5;");
} else {
cssBuilder.append("opacity:1;");
}
SVGResource icon = null;
for (NodeIconProvider iconProvider : nodeIconProviders) {
icon = iconProvider.getIcon(getData());
if (icon != null) {
break;
}
}
if (icon != null) {
presentation.setPresentableIcon(icon);
} else {
if (getData().getResourceType() == FOLDER) {
presentation.setPresentableIcon(getData().getName().startsWith(".") ? nodesResources.hiddenSimpleFolder() : nodesResources.simpleFolder());
} else if (getData().getResourceType() == PROJECT) {
presentation.setPresentableIcon(((Project) getData()).isProblem() ? nodesResources.notValidProjectFolder() : nodesResources.projectFolder());
cssBuilder.append("font-weight:bold;");
} else if (getData().getResourceType() == FILE) {
presentation.setPresentableIcon(nodesResources.file());
}
}
presentation.setPresentableTextCss(cssBuilder.toString());
}
Aggregations