private TextEdit formatStatements(String source, int indentationLevel, String lineSeparator, IRegion[] regions, boolean includeComments) { ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false); if (constructorDeclaration.statements == null) { // a problem occured while parsing the source return null; } return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments); }
private TextEdit formatStatements(String source, int indentationLevel, String lineSeparator, IRegion[] regions, boolean includeComments) { ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false); if (constructorDeclaration.statements == null) { // a problem occured while parsing the source return null; } return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments); }
private TextEdit formatStatements(String source, int indentationLevel, String lineSeparator, IRegion[] regions, boolean includeComments) { ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false); if (constructorDeclaration.statements == null) { // a problem occured while parsing the source return null; } return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments); }
@Override public List<Problem> validateSnippet(String snippet) { CodeSnippetParsingUtil codeSnippetParsingUtil = new CodeSnippetParsingUtil(false); ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements(snippet.toCharArray(), 0, snippet.length(), JDTOptions.getJDTOptions(), true, false); CompilationResult compilationResult = constructorDeclaration.compilationResult(); List<Problem> problems = new ArrayList<>(); if (compilationResult.hasErrors()) { for (CategorizedProblem problem : compilationResult.getErrors()) { Problem p = new Problem(problem.getMessage(), problem.getSourceStart(), problem.getSourceEnd(), problem.getSourceLineNumber()); problems.add(p); } } return problems; } }
ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false); if (constructorDeclaration.statements != null) { return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments);
ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false); if (constructorDeclaration.statements != null) { return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map<String, String> settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false); if (constructorDeclaration.statements != null) { return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map<String, String> settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map<String, String> settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
public ConstructorDeclaration parseStatements( char[] source, int offset, int length, Map settings, boolean recordParsingInformation, boolean enabledStatementRecovery) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only statements final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length); ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements( this.rawSource, this.sourceOffset,
ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements( this.rawSource, this.sourceOffset,
ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements( this.rawSource, this.sourceOffset,
ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements( this.rawSource, this.sourceOffset,
ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements( this.rawSource, this.sourceOffset,
ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements( this.rawSource, this.sourceOffset,