public boolean removeObjectsGeneratedFromResource(Resource resource) {
List<RuleImpl> rulesToBeRemoved = removeRulesGeneratedFromResource(resource);
List<TypeDeclaration> typesToBeRemoved = getTypesGeneratedFromResource(resource);
if (!typesToBeRemoved.isEmpty()) {
JavaDialectRuntimeData dialect = (JavaDialectRuntimeData) getDialectRuntimeRegistry().getDialectData( "java" );
for (TypeDeclaration type : typesToBeRemoved) {
if ( type.getTypeClassName() != null ) {
// the type declaration might not have been built up to actual class, if an error was found first
// in this case, no accessor would have been wired
classFieldAccessorStore.removeType(type);
dialect.remove(type.getTypeClassName());
}
removeTypeDeclaration(type.getTypeName());
}
dialect.reload();
}
List<Function> functionsToBeRemoved = removeFunctionsGeneratedFromResource(resource);
return !rulesToBeRemoved.isEmpty() || !typesToBeRemoved.isEmpty() || !functionsToBeRemoved.isEmpty();