Search in sources :

Example 1 with IndexElementsGenerator

use of org.kie.workbench.common.services.refactoring.IndexElementsGenerator in project drools-wb by kiegroup.

the class DslFileIndexer method getIndexBuilder.

@Override
protected DefaultIndexBuilder getIndexBuilder(Path path) {
    final Module module = moduleService.resolveModule(Paths.convert(path));
    if (module == null) {
        logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved.");
        return null;
    }
    final Package pkg = moduleService.resolvePackage(Paths.convert(path));
    if (pkg == null) {
        logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved.");
        return null;
    }
    // responsible for basic index info: module name, branch, etc
    return new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg) {

        @Override
        public DefaultIndexBuilder addGenerator(final IndexElementsGenerator generator) {
            // Don't include the rule created to parse DSL
            if (generator instanceof Resource && ((Resource) generator).getResourceFQN().endsWith(MOCK_RULE_NAME)) {
                return this;
            }
            return super.addGenerator(generator);
        }
    };
}
Also used : IndexElementsGenerator(org.kie.workbench.common.services.refactoring.IndexElementsGenerator) Resource(org.kie.workbench.common.services.refactoring.Resource) Package(org.guvnor.common.services.project.model.Package) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder) Module(org.guvnor.common.services.project.model.Module)

Aggregations

Module (org.guvnor.common.services.project.model.Module)1 Package (org.guvnor.common.services.project.model.Package)1 IndexElementsGenerator (org.kie.workbench.common.services.refactoring.IndexElementsGenerator)1 Resource (org.kie.workbench.common.services.refactoring.Resource)1 DefaultIndexBuilder (org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)1