ElementPresentation (final DomElement element) { return new ElementPresentation() { @Override public String getElementName() { String name = ElementPresentationTemplateImpl.this.getName(element); return name == null ? ElementPresentationManager.getElementName(element) : name; } @Override public String getTypeName() { String typeName = ElementPresentationTemplateImpl.this.getTypeName(); return typeName == null ? ElementPresentationManager.getTypeNameForObject(element) : typeName; } @Override public Icon getIcon() { return ElementPresentationTemplateImpl.this.getIcon(element, 0); } @Override public String getDocumentation() { final Ref<String> result = new Ref<>(); element.acceptChildren(new DomElementVisitor() { @Override public void visitDomElement(DomElement element) { if (element instanceof GenericValue && element.getChildDescription().getAnnotation(Documentation.class) != null) { result.set(((GenericValue<?>)element).getStringValue()); } } }); return result.isNull() ? super.getDocumentation() : result.get(); //NON-NLS } }; }