use of org.vectomatic.dom.svg.ui.SVGResource 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());
}
use of org.vectomatic.dom.svg.ui.SVGResource in project che by eclipse.
the class FieldNode method updatePresentation.
/** {@inheritDoc} */
@Override
public void updatePresentation(@NotNull NodePresentation presentation) {
StringBuilder presentableName = new StringBuilder(field.getElementName());
if (isShowInheritedMembers) {
String path = field.getRootPath();
String className = field.isBinary() ? path.substring(path.lastIndexOf('.') + 1) : path.substring(path.lastIndexOf('/') + 1, path.indexOf('.'));
presentableName.append(" -> ").append(className);
}
updatePresentationField(isFromSuper, presentation, presentableName.toString(), resources);
int flag = field.getFlags();
SVGResource icon;
if (Flags.isPublic(flag)) {
icon = resources.publicMethod();
} else if (Flags.isPrivate(flag)) {
icon = resources.privateMethod();
} else if (Flags.isProtected(flag)) {
icon = resources.protectedMethod();
} else {
icon = resources.publicMethod();
}
presentation.setPresentableIcon(icon);
}
use of org.vectomatic.dom.svg.ui.SVGResource in project che by eclipse.
the class InitializerNode method updatePresentation.
/** {@inheritDoc} */
@Override
public void updatePresentation(@NotNull NodePresentation presentation) {
updatePresentationField(isFromSuper, presentation, initializer.getLabel(), resources);
SVGResource icon;
int flag = initializer.getFlags();
if (Flags.isPublic(flag)) {
icon = resources.publicMethod();
} else if (Flags.isPrivate(flag)) {
icon = resources.privateMethod();
} else if (Flags.isProtected(flag)) {
icon = resources.protectedMethod();
} else {
icon = resources.publicMethod();
}
presentation.setPresentableIcon(icon);
}
use of org.vectomatic.dom.svg.ui.SVGResource in project che by eclipse.
the class TypeNode method updatePresentation.
/** {@inheritDoc} */
@Override
public void updatePresentation(@NotNull NodePresentation presentation) {
StringBuilder presentableName = new StringBuilder(type.getLabel());
if (isShowInheritedMembers && !type.isPrimary()) {
String path = type.getRootPath();
String className = type.isBinary() ? path.substring(path.lastIndexOf('.') + 1) : path.substring(path.lastIndexOf('/') + 1, path.indexOf('.'));
presentableName.append(" -> ").append(className);
}
updatePresentationField(isFromSuper, presentation, presentableName.toString(), resources);
int flags = type.getFlags();
SVGResource icon;
if (Flags.isInterface(flags)) {
icon = resources.interfaceItem();
} else if (Flags.isEnum(flags)) {
icon = resources.enumItem();
} else if (Flags.isAnnotation(flags)) {
icon = resources.annotationItem();
} else {
icon = resources.javaFile();
}
presentation.setPresentableIcon(icon);
}
use of org.vectomatic.dom.svg.ui.SVGResource in project che by eclipse.
the class NotificationContainerItem method getIconBaseOnStatus.
/**
* Return an icon based on {@link org.eclipse.che.ide.api.notification.StatusNotification.Status}.
*
* @return SVG image that represents icon status
*/
private SVGImage getIconBaseOnStatus() {
final SVGResource icon;
final String status;
switch(((StatusNotification) notification).getStatus()) {
case PROGRESS:
icon = resources.progress();
status = "progress";
break;
case SUCCESS:
icon = resources.success();
status = "success";
break;
case FAIL:
icon = resources.fail();
status = "fail";
break;
case WARNING:
icon = resources.warning();
status = "warning";
break;
default:
throw new IllegalArgumentException("Can't determine notification icon");
}
SVGImage image = new SVGImage(icon);
image.getElement().setAttribute("name", status);
return image;
}
Aggregations