use of org.eclipse.che.ide.api.resources.marker.PresentableTextMarker in project che by eclipse.
the class PomInterceptor method intercept.
/** {@inheritDoc} */
@Override
public void intercept(Resource resource) {
if (resource.isFile() && POM_XML.equals(resource.getName())) {
final Optional<Project> project = resource.getRelatedProject();
if (!project.isPresent() || !project.get().isTypeOf(MAVEN_ID)) {
return;
}
final String artifact = project.get().getAttribute(ARTIFACT_ID);
if (!isNullOrEmpty(artifact)) {
resource.addMarker(new PresentableTextMarker(artifact));
}
}
}
use of org.eclipse.che.ide.api.resources.marker.PresentableTextMarker 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