コード例 #1
0
 public RewritableImportSection parse(XtextResource resource) {
   RewritableImportSection rewritableImportSection =
       new RewritableImportSection(
           resource,
           importsConfiguration,
           importsConfiguration.getImportSection(resource),
           whitespaceInformationProvider
               .getLineSeparatorInformation(resource.getURI())
               .getLineSeparator(),
           regionUtil,
           nameValueConverter);
   return rewritableImportSection;
 }
コード例 #2
0
  public void update() {
    XImportSection importSection = importsConfiguration.getImportSection(resource);
    if (importSection == null && importsConfiguration instanceof IMutableImportsConfiguration) {
      importSection = XtypeFactory.eINSTANCE.createXImportSection();

      IMutableImportsConfiguration mutableImportsConfiguration =
          (IMutableImportsConfiguration) importsConfiguration;
      mutableImportsConfiguration.setImportSection(resource, importSection);
    }
    if (importSection == null) {
      return;
    }
    removeObsoleteStaticImports();

    List<XImportDeclaration> allImportDeclarations = newArrayList();
    allImportDeclarations.addAll(originalImportDeclarations);
    allImportDeclarations.addAll(addedImportDeclarations);
    allImportDeclarations.removeAll(removedImportDeclarations);

    List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
    importDeclarations.clear();
    importDeclarations.addAll(allImportDeclarations);
  }