Package org.eclipse.jdt.internal.corext.codemanipulation

Examples of org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings


        IMethod[] typeMethods = type.getMethods();
        Set<String> handleIds = new HashSet<String>(typeMethods.length);
        for (int index = 0; index < typeMethods.length; index++)
            handleIds.add(typeMethods[index].getHandleIdentifier());
        ArrayList<IMethod> newMethods = new ArrayList<IMethod>();
        CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(type.getJavaProject());
        settings.createComments = isAddComments();
        ASTParser parser = ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL);
        parser.setResolveBindings(true);
        parser.setSource(cu);
        CompilationUnit unit = (CompilationUnit) parser.createAST(new SubProgressMonitor(monitor, 1));
View Full Code Here


      ASTNode node = NodeFinder.perform(unit, offset, 1);
      AST ast = unit.getAST();
      ASTRewrite rewrite = ASTRewrite.create(ast);

      CodeGenerationSettings settings = getCodeGenSettings();

      MethodDeclaration stub = createMockMethodStub(ast, rewrite, settings);

      String methodDeclarationText = generateMethodDeclaration(document, recoveredDocument,
          node, rewrite, settings, stub);
View Full Code Here

    }
  }

  private CodeGenerationSettings getCodeGenSettings()
  {
    CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(fJavaProject);
    settings.overrideAnnotation = false;
    settings.createComments = false;

    return settings;
  }
View Full Code Here

        IMethod[] typeMethods = type.getMethods();
        Set<String> handleIds = new HashSet<String>(typeMethods.length);
        for (int index = 0; index < typeMethods.length; index++)
            handleIds.add(typeMethods[index].getHandleIdentifier());
        ArrayList<IMethod> newMethods = new ArrayList<IMethod>();
        CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(type.getJavaProject());
        settings.createComments = isAddComments();
        ASTParser parser = ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL);
        parser.setResolveBindings(true);
        parser.setSource(cu);
        CompilationUnit unit = (CompilationUnit) parser.createAST(new SubProgressMonitor(monitor, 1));
View Full Code Here

    ICompilationUnit src = JavaUtils.getCompilationUnit(project, file);
    IType type = TypeUtils.getType(src, offset);
    List<IField> fields = Arrays.asList(type.getFields());

    CodeGenerationSettings settings =
        JavaPreferencesSettings.getCodeGenerationSettings(src.getJavaProject());
    settings.createComments = true;

    for(String property : properties){
      IField field = type.getField(property);
View Full Code Here

        delegate.add(entry);
      }
    }

    if (delegate.size() > 0){
      CodeGenerationSettings settings =
          JavaPreferencesSettings.getCodeGenerationSettings(src.getJavaProject());
      settings.createComments = true;
      return new AddDelegateMethodsOperation(
          cu, delegate.toArray(new DelegateEntry[delegate.size()]),
          sibling, settings, true, true);
View Full Code Here

      IVariableBinding[] variables,
      IMethodBinding constructor,
      CommandLine commandLine)
    throws Exception
  {
    CodeGenerationSettings settings = JavaPreferencesSettings
      .getCodeGenerationSettings(src.getJavaProject());
    settings.createComments = true;
    boolean isDefault = constructor.getDeclaringClass()
      .getQualifiedName().equals("java.lang.Object") ||
      constructor.isDefaultConstructor();
View Full Code Here

    CompilationUnit astRoot = SharedASTProvider
      .getAST(src, SharedASTProvider.WAIT_YES, null);

    String[] typeNames = types != null ? StringUtils.split(types, ',') : null;
    ChooseImports query = new ChooseImports(project, typeNames);
    CodeGenerationSettings settings = JavaPreferencesSettings
      .getCodeGenerationSettings(src.getJavaProject());
    OrganizeImportsOperation op = new OrganizeImportsOperation(
       src, astRoot, settings.importIgnoreLowercase, true /* save */, true, query);

    TextEdit edit = op.createTextEdit(null);
View Full Code Here

    ImportRewrite importRewrite = StubUtility.createImportRewrite(astRoot, true);
    ListRewrite listRewriter = astRewrite.getListRewrite(typeDecl, (typeDecl).getBodyDeclarationsProperty());

    if (listRewriter != null) {
      IJavaProject javaProject = compilationUnit.getJavaProject();
      CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(javaProject);
      MethodDeclaration methodDecl = createNewConstructor(typeDecl, ast);
      IMethodBinding constructorBinding = ASTNodes.getMethodBinding(methodDecl.getName());
      ITypeBinding typeBinding = ASTNodes.getTypeBinding(typeDecl.getName());
      ImportRewriteContext context = new ContextSensitiveImportRewriteContext(typeDecl, importRewrite);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings

Copyright © 2018 www.massapicom. 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.