protected List<XImportDeclaration> findOriginalImports(JvmDeclaredType type, String memberName, Collection<XImportDeclaration> list, boolean isStatic, boolean isExtension) { List<XImportDeclaration> result = newArrayList(); for (XImportDeclaration importDeclaration : list) { if (!(isStatic ^ importDeclaration.isStatic()) && !(isExtension ^ importDeclaration.isExtension()) && importDeclaration.getImportedType() == type && (memberName == null || memberName.equals(importDeclaration.getMemberName()))) { result.add(importDeclaration); } } return result; }
/** Check that import mapping are known. * * @param importDeclaration the declaration. */ @Check public void checkImportsMapping(XImportDeclaration importDeclaration) { final JvmDeclaredType type = importDeclaration.getImportedType(); doTypeMappingCheck(importDeclaration, type, this.typeErrorHandler1); }
protected boolean isImportDeclarationRequired(final ITypeDescriptor typeDesc, final String qualifiedName, final ContentAssistContext context, final XImportSection importSection) { return ((!(typeDesc.getName().startsWith("java.lang") && (typeDesc.getName().lastIndexOf(".") == 9))) && ((importSection == null) || (!IterableExtensions.<XImportDeclaration>exists(importSection.getImportDeclarations(), ((Function1<XImportDeclaration, Boolean>) (XImportDeclaration it) -> { JvmDeclaredType _importedType = it.getImportedType(); String _qualifiedName = null; if (_importedType!=null) { _qualifiedName=_importedType.getQualifiedName(); } return Boolean.valueOf(Objects.equal(_qualifiedName, qualifiedName)); }))))); }
private Iterable<JvmEnumerationLiteral> getEnumLiterals(final Iterable<XImportDeclaration> imports) { final Function1<XImportDeclaration, JvmEnumerationType> _function = (XImportDeclaration it) -> { JvmDeclaredType _importedType = it.getImportedType(); return ((JvmEnumerationType) _importedType); }; final Function1<JvmEnumerationType, EList<JvmEnumerationLiteral>> _function_1 = (JvmEnumerationType it) -> { return it.getLiterals(); }; return Iterables.<JvmEnumerationLiteral>concat(IterableExtensions.<JvmEnumerationType, EList<JvmEnumerationLiteral>>map(IterableExtensions.<XImportDeclaration, JvmEnumerationType>map(imports, _function), _function_1)); } }
@Check public void checkDeprecated(XImportDeclaration decl) { if (!isIgnored(DEPRECATED_MEMBER_REFERENCE)) { JvmType jvmType = decl.getImportedType(); checkDeprecated( jvmType, decl, XtypePackage.Literals.XIMPORT_DECLARATION__IMPORTED_TYPE); } }
protected void appendImport(StringBuilder builder, XImportDeclaration newImportDeclaration) { builder.append("import "); if (newImportDeclaration.isStatic()) { builder.append("static "); if (newImportDeclaration.isExtension()) { builder.append("extension "); } } String qualifiedTypeName = newImportDeclaration.getImportedNamespace(); if (newImportDeclaration.getImportedType() != null) { qualifiedTypeName = serializeType(newImportDeclaration.getImportedType()); } String escapedTypeName = nameValueConverter.toString(qualifiedTypeName); builder.append(escapedTypeName); if (newImportDeclaration.isStatic()) { builder.append("."); if (newImportDeclaration.isWildcard()) { builder.append("*"); } else { builder.append(newImportDeclaration.getMemberName()); } } builder.append(lineSeparator); }
@Override public void doAddImports(ITypeImporter importer) { List<XImportDeclaration> imports = importSection.getImportDeclarations(); for(XImportDeclaration _import: imports) { if (_import.isStatic()) { if (_import.isWildcard()) { if (_import.isExtension()) { importer.importStaticExtension(_import.getImportedType(), false); } else { importer.importStatic(_import.getImportedType()); } } else { if (_import.isExtension()) { importer.importStaticExtension(_import.getImportedType(), _import.getMemberName(), false); } else { importer.importStatic(_import.getImportedType(), _import.getMemberName()); } } } } }
private Iterable<XImportDeclaration> getEnumImports(final EObject eObject) { EObject _rootContainer = EcoreUtil2.getRootContainer(eObject); final AmlModel rootElement = ((AmlModel) _rootContainer); final XImportSection importSection = rootElement.getImportSection(); if ((importSection != null)) { final Function1<XImportDeclaration, Boolean> _function = (XImportDeclaration it) -> { JvmDeclaredType _importedType = it.getImportedType(); return Boolean.valueOf((_importedType instanceof JvmEnumerationType)); }; return IterableExtensions.<XImportDeclaration>filter(rootElement.getImportSection().getImportDeclarations(), _function); } else { return Collections.<XImportDeclaration>unmodifiableList(CollectionLiterals.<XImportDeclaration>newArrayList()); } }
wildcardImports.add(AbstractNestedTypeAwareImportNormalizer.createNestedTypeAwareImportNormalizer(qualifiedImportedNamespace, true, false)); } else { JvmDeclaredType importedType = importDeclaration.getImportedType(); if (importedType != null && !importedType.eIsProxy()) { if (concreteImports == null || importedNames == null /* to make JDT happy */) {
public Iterable<JvmFeature> getAllFeatures(final XImportDeclaration it) { return this.getAllFeatures(it.eResource(), it.getImportedType(), it.isStatic(), it.isExtension(), it.getMemberName()); }
public Iterable<JvmFeature> findAllFeatures(final XImportDeclaration it) { Iterable<JvmFeature> _xblockexpression = null; { final JvmDeclaredType importedType = it.getImportedType(); if (((!it.isStatic()) || (importedType == null))) { return CollectionLiterals.<JvmFeature>emptyList(); } final IVisibilityHelper visibilityHelper = this.getVisibilityHelper(it.eResource()); final IResolvedFeatures resolvedFeatures = this._provider.getResolvedFeatures(importedType); final Function1<JvmFeature, Boolean> _function = (JvmFeature feature) -> { return Boolean.valueOf(((feature.isStatic() && visibilityHelper.isVisible(feature)) && ((it.getMemberName() == null) || feature.getSimpleName().startsWith(it.getMemberName())))); }; _xblockexpression = IterableExtensions.<JvmFeature>filter(resolvedFeatures.getAllFeatures(), _function); } return _xblockexpression; }
JvmType importedType = imp.getImportedType(); if (importedType == null || importedType.eIsProxy()) { continue;
public RewritableImportSection(XtextResource resource, IImportsConfiguration importsConfiguration, XImportSection originalImportSection, String lineSeparator, ImportSectionRegionUtil regionUtil, IValueConverter<String> nameConverter) { this.importsConfiguration = importsConfiguration; this.resource = resource; this.lineSeparator = lineSeparator; this.regionUtil = regionUtil; this.nameValueConverter = nameConverter; this.implicitlyImportedPackages = importsConfiguration.getImplicitlyImportedPackages(resource); this.importRegion = regionUtil.computeRegion(resource); if (originalImportSection != null) { for (XImportDeclaration originalImportDeclaration : originalImportSection.getImportDeclarations()) { this.originalImportDeclarations.add(originalImportDeclaration); JvmDeclaredType importedType = originalImportDeclaration.getImportedType(); if (originalImportDeclaration.isStatic()) { String memberName = originalImportDeclaration.getMemberName(); if (originalImportDeclaration.isExtension()) { Maps2.putIntoSetMap(importedType, memberName, staticExtensionImports); } else { Maps2.putIntoSetMap(importedType, memberName, staticImports); } } else if (importedType != null) { Maps2.putIntoListMap(importedType.getSimpleName(), importedType, plainImports); } } } }
for(XImportDeclaration importDeclaration: importDeclarations) { if (!importDeclaration.isStatic() && !importDeclaration.isWildcard() && !importDeclaration.isExtension()) { JvmDeclaredType importedType = importDeclaration.getImportedType(); if (importedType == type) { String syntax = importsConfiguration.getLegacyImportSyntax(importDeclaration);
if (importSection != null) { for (XImportDeclaration decl : importSection.getImportDeclarations()) { concreteImports.addImportFor(decl.getImportedType());