コード例 #1
0
 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);
       }
     }
   }
 }