CommonTemplate(
http://www.commontemplate.org)的
Debug单步跟踪初始版完成, 可下载每日构建版本试用. (
http://commontemplate.googlecode.com/svn/trunk/commontemplate/dist/)
将在后期TemplateEditor的eclipse插件中集成此Debug功能, 并做成策略接口,
当在eclipse环境中时自动适用插件集成,
在非图形系统中(纯文本模式,AWT未加载时)自动适用命令行,
否则使用swing图形界面. (现完成版为swing图形界面)
测试代码:
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.commontemplate.core.Context;
import org.commontemplate.core.Factory;
import org.commontemplate.engine.Engine;
import org.commontemplate.standard.ConfigurationSettings;
import org.commontemplate.tools.PropertiesConfigurationLoader;
public class OutTester {
public static void main(String[] args) {
// 定义数据
Map model = new HashMap();
model.put("allow", Boolean.valueOf(false));
List users = new ArrayList();
model.put("users", users);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
try {
users.add(new User(12, "liangfei", "liangfei0201@163.com", 10000, df.parse("2007-08-09")));
users.add(new User(15, "zhangyong", "zhangyong@aaa.com", 25000, df.parse("2007-08-10")));
users.add(new User(17, "bobo", "bobo@bbb.com", 95010, df.parse("2007-08-11")));
users.add(new User(17, "lixudong", null, 25000, df.parse("2007-09-11")));
} catch (ParseException e) {
e.printStackTrace();
}
// 配置
ConfigurationSettings config = PropertiesConfigurationLoader.loadConfiguration("commontemplate.properties");
Factory factory = new Engine(config);
// 执行模板
Writer output = null;
try {
output = new OutputStreamWriter(System.out);
Context context = factory.createContext(output);
context.pushLocalContext(model);
factory.getTemplate("out.ctl").render(context);
context.clear();
output.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
测试配置: commontemplate.properties
@extends=org/commontemplate/tools/commontemplate.properties
debug=true
测试模板: out.ctl
ttttt
${allow}
$breakpoint
$if{users != null && users.size > 0}
<table>
$for{user: users}
<tr>
<td>${user.name}</td>
</tr>
$end
</table>
$end
$for{num: 1..3}
${num}
$end
引擎遇到$breakpoint指令时, 弹出附件所示界面.
高亮显示当前运行的指令, 上下文中的变量.
点击"Step"单步运行,
点击"Step Over"单步越过块指令的内部指令运行(非块指令此按钮不可用),
点击"Resume"恢复正常运行(直到下一$breakpoint),
点击"Terminate"终止运行.
注: 当commontemplate.properties配置: debug=true 时才启用调试, 否则忽略$breakpoint指令以及其它debug指令.
尚未美化界面, 暂先保证功能实现.
JFrame未重用(每一步都创建窗口), 所以调试时会出现窗口闪动, 待完善.
- 描述: 指令跟踪
- 大小: 65.3 KB
分享到:
相关推荐
Eclipse的单步调试说明文档,使用eclipse
主要介绍了Intellij idea远程debug连接tomcat实现单步调试,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
本文档是自己一边实际操作一边记录完成,每一关键步骤都有截图与详细...方法2的缺点是首次配置复杂,优点是不必每次调试都重新在目标机安装app,并可以在目标程序运行过程中随时开始调试。文档完成时间是2014年10月。
DebugView 调试工具 DebugView 调试工具 DebugView 调试工具
汇编debug调试命令汇编debug调试命令汇编debug调试命令汇编debug调试命令汇编debug调试命令
若函数A内存在子函数a时,不会进入子函数a内执行单步调试,而是把子函数a当作一个整体,一步执行。 step into(F7) 单步调试。 若函数A内存在子函数a时,会进入子函数a内执行单步调试。 step out(Shift+F8)当目前...
Eclipse 调试器; Debug 视图;调试 Java 语言程序;远程调试;Eclipse快捷键调试
java语法 调试 马克-to-win java视频 数组 debug 单步调试加断点
myeclipse插件jsdt JSDeBug工具可以单步调试
RISC-V debug 中文调试说明
用这个工具就可以看见Outputdebugstring 的输出。经测试在win7下可以正常使用。
eclipse debug (调试) 学习心得
debugview调试工具的使用,可以看到输出的所有控制台信息
debug 调试包 jar包
Android Studio debug调试
java_debug调试.java_debug调试.java_debug调试.java_debug调试.java_debug调试.java_debug调试.
ie插件- flashplayer debug 10.1 调试版 天涯浪子
firefox - flashplayer debug 10.1 调试版 天涯浪子 for windows
debug调试