protected void checkConflicts(XImportSection importSection, final Map<String, List<XImportDeclaration>> imports, final Map<String, JvmType> importedNames) { for (JvmDeclaredType declaredType : importsConfiguration.getLocallyDefinedTypes((XtextResource)importSection.eResource())) { if(importedNames.containsKey(declaredType.getSimpleName())){ JvmType importedType = importedNames.get(declaredType.getSimpleName()); if (importedType != declaredType && importedType.eResource() != importSection.eResource()) { List<XImportDeclaration> list = imports.get(importedType.getIdentifier()); if (list != null) { for (XImportDeclaration importDeclaration: list ) { error("The import '" + importedType.getIdentifier() + "' conflicts with a type defined in the same file", importDeclaration, null, IssueCodes.IMPORT_CONFLICT); } } } } } }
public ITextRegion computeRegion(XtextResource resource) { XImportSection xImportSection = config.getImportSection(resource); // try to obtain the region from the text if it is not a synthetic region. if (xImportSection != null && xImportSection.eResource() != null) { INode node = NodeModelUtils.findActualNodeFor(xImportSection); if(node == null) LOG.error("Cannot detect node for original import section"); else return node.getTextRegion(); } return new TextRegion(config.getImportSectionOffset(resource), 0); }
checkConflicts(importSection, imports, importedNames); if (!isIgnored(IMPORT_UNUSED)) { XtextResource xtextResource = (XtextResource) importSection.eResource();