Search in sources :

Example 1 with IResolvedFeature

use of org.eclipse.xtext.xbase.typesystem.override.IResolvedFeature in project xtext-xtend by eclipse.

the class AbstractMultiModeOutlineTreeProvider method computeDecoratedText.

protected Object computeDecoratedText(final Object modelElement, final int inheritanceDepth) {
    Object supertext = super.getText(modelElement);
    if (!(supertext instanceof StyledString)) {
        return supertext;
    }
    StyledString styledText = (StyledString) supertext;
    if (inheritanceDepth > 0) {
        styledText = applyStylerToFirstSegment(styledText, ColoringLabelProvider.INHERITED_STYLER);
    }
    if (modelElement instanceof JvmIdentifiableElement) {
        JvmIdentifiableElement jvmElement = (JvmIdentifiableElement) modelElement;
        if (!getAssociations().getSourceElements(jvmElement).isEmpty() && !getAssociations().isPrimaryJvmElement(jvmElement)) {
            styledText = applyStylerToFirstSegment(styledText, StyledString.QUALIFIER_STYLER);
        }
    }
    if (isShowInherited()) {
        if (modelElement instanceof IResolvedFeature) {
            String qualifier = createQualifier((IResolvedFeature) modelElement);
            appendQualifier(styledText, qualifier);
        } else if (modelElement instanceof JvmMember) {
            String qualifier = createQualifier((JvmMember) modelElement);
            appendQualifier(styledText, qualifier);
        } else if (modelElement instanceof XtendMember) {
            XtendMember xtendMember = (XtendMember) modelElement;
            if (xtendMember.eContainer() instanceof XtendTypeDeclaration) {
                String qualifiedName = createQualifier((XtendTypeDeclaration) xtendMember.eContainer(), '.');
                appendQualifier(styledText, qualifiedName);
            } else if (xtendMember instanceof XtendTypeDeclaration) {
                XtendFile xtendFile = EcoreUtil2.getContainerOfType(xtendMember, XtendFile.class);
                String qualifiedName = xtendFile.getPackage() == null ? "(default package)" : xtendFile.getPackage();
                appendQualifier(styledText, qualifiedName);
            }
        }
    }
    return styledText;
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) JvmIdentifiableElement(org.eclipse.xtext.common.types.JvmIdentifiableElement) XtendMember(org.eclipse.xtend.core.xtend.XtendMember) XtendTypeDeclaration(org.eclipse.xtend.core.xtend.XtendTypeDeclaration) EObject(org.eclipse.emf.ecore.EObject) JvmMember(org.eclipse.xtext.common.types.JvmMember) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) IResolvedFeature(org.eclipse.xtext.xbase.typesystem.override.IResolvedFeature)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 StyledString (org.eclipse.jface.viewers.StyledString)1 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)1 XtendTypeDeclaration (org.eclipse.xtend.core.xtend.XtendTypeDeclaration)1 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)1 JvmMember (org.eclipse.xtext.common.types.JvmMember)1 IResolvedFeature (org.eclipse.xtext.xbase.typesystem.override.IResolvedFeature)1