Examples of imports()


Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

            if (transform) {
                ImportDeclaration importDeclaration = ast
                        .newImportDeclaration();
                importDeclaration.setName(AbstractTransformer.createName(ast,
                        fullName));
                root.imports().add(importDeclaration);
                loader.importClass(fullName);
            }
        }
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

    String snippet = getSourceViewer().getDocument().get();
    ASTParser newParser = ASTParser.newParser(AST.JLS3);
    newParser.setSource(snippet.toCharArray());
    CompilationUnit createAST = (CompilationUnit) newParser.createAST(null);
    ArrayList<String> results = new ArrayList<String>();
    for (Object n : createAST.imports()) {
      ImportDeclaration decl = (ImportDeclaration) n;
      String name = decl.getName().getFullyQualifiedName();
      if (decl.isOnDemand()) {
        results.add(name + ".*");
      } else {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

    cu.setPackage(p1);

    ImportDeclaration id = ast.newImportDeclaration();
    id.setName(ast.newName(new String[] {
        "java", "util", "Set" }));
    cu.imports().add(id);

    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("Foo"));
    TypeParameter tp = ast.newTypeParameter();
    tp.setName(ast.newSimpleName("X"));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

    ImportDeclaration importDeclaration = ast.newImportDeclaration();
    importDeclaration
        .setName(ast.newName("org.junit.Assert.assertNotNull"));
    importDeclaration.setStatic(true);
    cu.imports().add(importDeclaration);

    logger.info(cu.toString());
    new ImportPacker(cu).pack();

    logger.info(cu.toString());
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

    cu.setPackage(p1);

    ImportDeclaration id = ast.newImportDeclaration();
    id.setName(ast.newName(new String[] {
        "java", "util", "Set" }));
    cu.imports().add(id);

    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("Foo"));
    TypeParameter tp = ast.newTypeParameter();
    tp.setName(ast.newSimpleName("X"));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

          "org.eclim.java.import.package_separation_level");
    CompilationUnit astRoot = SharedASTProvider
      .getAST(src, SharedASTProvider.WAIT_YES, null);

    @SuppressWarnings("unchecked")
    List<ImportDeclaration> imports = astRoot.imports();
    String lineDelim = src.findRecommendedLineSeparator();
    MultiTextEdit edit = new MultiTextEdit();
    ImportDeclaration next = null;
    for (int i = imports.size() - 1; i >= 0; i--){
      ImportDeclaration imprt = imports.get(i);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

        } else {
            typeDeclaration.setInterface(false);
        }

        // reconcile the imports
        List<ImportDeclaration> newImports = getNewImports(cu.imports(), newJavaFileVisitor);
        for (ImportDeclaration newImport : newImports) {
            Name name = ast.newName(newImport.getName().getFullyQualifiedName());
            ImportDeclaration newId = ast.newImportDeclaration();
            newId.setName(name);
            cu.imports().add(newId);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

        List<ImportDeclaration> newImports = getNewImports(cu.imports(), newJavaFileVisitor);
        for (ImportDeclaration newImport : newImports) {
            Name name = ast.newName(newImport.getName().getFullyQualifiedName());
            ImportDeclaration newId = ast.newImportDeclaration();
            newId.setName(name);
            cu.imports().add(newId);
        }

        TextEdit textEdit = cu.rewrite(document, null);
        try {
            textEdit.apply(document);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

        } else {
            typeDeclaration.setInterface(false);
        }

        // reconcile the imports
        List<ImportDeclaration> newImports = getNewImports(cu.imports(),
                newJavaFileVisitor);
        for (ImportDeclaration newImport : newImports) {
            Name name = ast
                    .newName(newImport.getName().getFullyQualifiedName());
            ImportDeclaration newId = ast.newImportDeclaration();
View Full Code Here

Examples of org.eclipse.jdt.core.dom.CompilationUnit.imports()

        for (ImportDeclaration newImport : newImports) {
            Name name = ast
                    .newName(newImport.getName().getFullyQualifiedName());
            ImportDeclaration newId = ast.newImportDeclaration();
            newId.setName(name);
            cu.imports().add(newId);
        }

        TextEdit textEdit = cu.rewrite(document, null);
        try {
            textEdit.apply(document);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.