Search in sources :

Example 1 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project spoon by INRIA.

the class JDTBasedSpoonCompiler method instantiateAndProcess.

@Override
public void instantiateAndProcess(List<String> processors) {
    // processing (consume all the processors)
    ProcessingManager processing = new QueueProcessingManager(factory);
    for (String processorName : processors) {
        processing.addProcessor(processorName);
        factory.getEnvironment().debugMessage("Loaded processor " + processorName + ".");
    }
    processing.process(factory.Package().getRootPackage());
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager) ProcessingManager(spoon.processing.ProcessingManager) QueueProcessingManager(spoon.support.QueueProcessingManager)

Example 2 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project spoon by INRIA.

the class JDTBasedSpoonCompiler method generateProcessedSourceFilesUsingTypes.

protected void generateProcessedSourceFilesUsingTypes(Filter<CtType<?>> typeFilter) {
    if (factory.getEnvironment().getDefaultFileGenerator() != null) {
        factory.getEnvironment().debugMessage("Generating source using types...");
        ProcessingManager processing = new QueueProcessingManager(factory);
        processing.addProcessor(factory.getEnvironment().getDefaultFileGenerator());
        if (typeFilter != null) {
            processing.process(Query.getElements(factory.getModel().getUnnamedModule(), typeFilter));
        } else {
            processing.process(factory.getModel().getAllModules());
        }
    }
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager) ProcessingManager(spoon.processing.ProcessingManager) QueueProcessingManager(spoon.support.QueueProcessingManager)

Example 3 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project spoon by INRIA.

the class AnnotationTest method testAbstractAllAnnotationProcessorWithGlobalAnnotation.

@Test
public void testAbstractAllAnnotationProcessorWithGlobalAnnotation() throws Exception {
    Launcher spoon = new Launcher();
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/ClassProcessed.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/TypeAnnotation.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/AnnotParamTypeEnum.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/InnerAnnot.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/Inception.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/GlobalAnnotation.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/TestAnnotation.java");
    Factory factory = spoon.getFactory();
    spoon.buildModel();
    // create the processor
    final ProcessingManager p = new QueueProcessingManager(factory);
    final GlobalProcessor processor = new GlobalProcessor();
    p.addProcessor(processor);
    final TypeAnnotationMethodProcessor methodProcessor = new TypeAnnotationMethodProcessor();
    p.addProcessor(methodProcessor);
    p.process(factory.Class().getAll());
    // GlobalAnnotation is also attached to the type
    assertEquals(7, processor.elements.size());
    assertEquals(2, methodProcessor.elements.size());
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager) ProcessingManager(spoon.processing.ProcessingManager) QueueProcessingManager(spoon.support.QueueProcessingManager) Launcher(spoon.Launcher) Factory(spoon.reflect.factory.Factory) Test(org.junit.Test)

Example 4 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project dspot by STAMP-project.

the class DSpotUtils method applyProcessor.

private static void applyProcessor(Factory factory, Processor processor) {
    QueueProcessingManager pm = new QueueProcessingManager(factory);
    pm.addProcessor(processor);
    pm.process(factory.Package().getRootPackage());
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager)

Example 5 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project spoon by INRIA.

the class CtModelImpl method processWith.

@Override
public void processWith(Processor<?> processor) {
    QueueProcessingManager processingManager = new QueueProcessingManager(getUnnamedModule().getFactory());
    processingManager.addProcessor(processor);
    processingManager.process(getAllModules());
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager)

Aggregations

QueueProcessingManager (spoon.support.QueueProcessingManager)7 ProcessingManager (spoon.processing.ProcessingManager)5 Test (org.junit.Test)2 Launcher (spoon.Launcher)2 Factory (spoon.reflect.factory.Factory)2