Search in sources :

Example 1 with ImportProvidedElement

use of org.eclipse.n4js.organize.imports.ImportProvidedElement in project n4js by eclipse.

the class ImportProvidedElementLabelprovider method getText.

@Override
public String getText(Object element) {
    if (element instanceof ImportableObject) {
        ImportableObject io = (ImportableObject) element;
        return getText(io.getTe());
    }
    if (element instanceof ImportProvidedElement) {
        ImportProvidedElement ele = ((ImportProvidedElement) element);
        TModule tm = ((ImportDeclaration) ele.getImportSpecifier().eContainer()).getModule();
        return ele.getLocalName() + " from " + findLocation(tm);
    }
    if (element instanceof IEObjectDescription) {
        IEObjectDescription ieod = (IEObjectDescription) element;
        EObject eo = ieod.getEObjectOrProxy();
        if (eo instanceof TExportableElement && !eo.eIsProxy()) {
            return getText(eo);
        }
        return ieod.getName().getLastSegment() + " from " + qualifiedNameConverter.toString(ieod.getName().skipLast(1));
    }
    if (element instanceof TExportableElement) {
        TExportableElement te = (TExportableElement) element;
        return te.getName() + " (exported as " + te.getExportedName() + ") from " + findLocation(te.getContainingModule());
    }
    return n4Labelprovider.getText(element);
}
Also used : ImportProvidedElement(org.eclipse.n4js.organize.imports.ImportProvidedElement) TExportableElement(org.eclipse.n4js.ts.types.TExportableElement) EObject(org.eclipse.emf.ecore.EObject) ImportDeclaration(org.eclipse.n4js.n4JS.ImportDeclaration) TModule(org.eclipse.n4js.ts.types.TModule) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 ImportDeclaration (org.eclipse.n4js.n4JS.ImportDeclaration)1 ImportProvidedElement (org.eclipse.n4js.organize.imports.ImportProvidedElement)1 TExportableElement (org.eclipse.n4js.ts.types.TExportableElement)1 TModule (org.eclipse.n4js.ts.types.TModule)1 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)1