spoon.reflect.visitor.DefaultJavaPrettyPrinter Java Examples

The following examples show how to use spoon.reflect.visitor.DefaultJavaPrettyPrinter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpoonedFile.java    From nopol with GNU General Public License v2.0 6 votes vote down vote up
public SpoonedFile(File[] sourceFiles, NopolContext nopolContext) {
    this.nopolContext = nopolContext;
    this.sourceFiles = sourceFiles;
    this.projectClasspath = nopolContext.getProjectClasspath();

    factory = SpoonModelLibrary.newFactory();
    factory.getEnvironment().setComplianceLevel(nopolContext.getComplianceLevel());
    factory.getEnvironment().setCommentEnabled(false);
    factory.getEnvironment().setLevel("OFF"); // no logs

    factory = SpoonModelLibrary.modelFor(factory, sourceFiles, projectClasspath());

    compiler = new DynamicClassCompiler(compilationClasspath(), nopolContext.getComplianceLevel());
    manager = new RuntimeProcessingManager(factory);
    compiledClasses = MetaMap.newHashMap();
    prettyPrinter = new DefaultJavaPrettyPrinter(spoonEnvironment());
}
 
Example #2
Source File: OutputWritter.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void updateOutput(String output) {
	getEnvironment().setSourceOutputDirectory(new File(output));
	JavaOutputProcessor fileOutput = new JavaOutputProcessor(new DefaultJavaPrettyPrinter(getEnvironment()));
	fileOutput.setFactory(getFactory());

	this.javaPrinter = fileOutput;
}
 
Example #3
Source File: Operation.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
private String partialElementPrint(CtElement element) {
	DefaultJavaPrettyPrinter print = new DefaultJavaPrettyPrinter(element.getFactory().getEnvironment()) {
		@Override
		public DefaultJavaPrettyPrinter scan(CtElement e) {
			if (e != null && e.getMetadata("isMoved") == null) {
				return super.scan(e);
			}
			return this;
		}
	};

	print.scan(element);
	return print.getResult();
}
 
Example #4
Source File: SpoonedFile.java    From nopol with GNU General Public License v2.0 4 votes vote down vote up
protected DefaultJavaPrettyPrinter prettyPrinter() {
    return prettyPrinter;
}