mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
template generation: allow to replace global macro (IDEA-198090)
This commit is contained in:
+3
-5
@@ -17,12 +17,9 @@ package org.jetbrains.java.generate.velocity;
|
||||
|
||||
import com.intellij.codeInsight.generation.VelocityIncludesClassLoader;
|
||||
import org.apache.commons.collections.ExtendedProperties;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.apache.velocity.runtime.RuntimeConstants;
|
||||
import org.apache.velocity.runtime.log.SimpleLog4JLogSystem;
|
||||
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
|
||||
import org.apache.velocity.runtime.resource.loader.FileResourceLoader;
|
||||
|
||||
/**
|
||||
* Velocity factory.
|
||||
@@ -31,7 +28,7 @@ import org.apache.velocity.runtime.resource.loader.FileResourceLoader;
|
||||
*/
|
||||
public class VelocityFactory {
|
||||
private static class Holder {
|
||||
private static final VelocityEngine engine = newVeloictyEngine();
|
||||
private static final VelocityEngine engine = newVelocityEngine();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,12 +44,13 @@ public class VelocityFactory {
|
||||
*
|
||||
* @return a new velocity engine that is initialized.
|
||||
*/
|
||||
private static VelocityEngine newVeloictyEngine() {
|
||||
private static VelocityEngine newVelocityEngine() {
|
||||
ExtendedProperties prop = new ExtendedProperties();
|
||||
prop.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName());
|
||||
prop.addProperty("runtime.log.logsystem.log4j.category", "GenerateToString");
|
||||
prop.addProperty(RuntimeConstants.RESOURCE_LOADER, "includes");
|
||||
prop.addProperty("includes.resource.loader.class", VelocityIncludesClassLoader.class.getName());
|
||||
prop.addProperty(RuntimeConstants.VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL, "true");
|
||||
VelocityEngine velocity = new VelocityEngine();
|
||||
velocity.setExtendedProperties(prop);
|
||||
velocity.init();
|
||||
|
||||
Reference in New Issue
Block a user