您的位置:首页 > 其它

自己定义断点,重启后断点信息不存在

2014-03-06 15:14 197 查看
RCP中添加断点:在断点视图中出现新增加的断点,在Marker视图中出现自己定义的Marker信息,重启RCP后,在断点视图中未出现原先添加的断点信息。解决该方法有两种:第一种解决方法:plugin.xml 中扩展org.eclipse.core.resources.markers扩展点,必须继承父类org.eclipse.debug.core.breakpointMarker

<!-- 扩展断点类型-->
<extension
point="org.eclipse.debug.core.breakpoints">
<breakpoint
class="org.jtang.synergy.launchConfiguration.breakpoints.FlowBreakPoint"
id="org.jtang.synergy.launchConfiguration.breakpoints.FlowBreakPoint"
markerType="org.jtang.synergy.designer.flow.marker">
</breakpoint>
</extension>
<!--注册一个自定义标记,可继承已定义的父类-->
<extension
id="org.jtang.synergy.designer.flow.marker"
name="org.jtang.synergy.designer.flow.marker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.debug.core.breakpointMarker"><!--标识是断点标识-->
</super>
<!--表示文件的位置-->
<super type="org.eclipse.core.resources.textmarker">
</super>
<persistent
value="true"><!--persistent代表是否将错误保存,如果false,重启就会消失-->
</persistent>
</extension>


第二种解决方法:

在自己的插件启动类中添加代码:

public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;

// org.jtang.synergy.designer.flow.marker 是自己定义Marker的ID

IMarker[] markers =	ResourcesPlugin.getWorkspace().getRoot().findMarkers("org.jtang.synergy.designer.flow.marker", true, IResource.DEPTH_INFINITE);
System.out.println("markers 长度:" + markers.length);
for(IMarker marker:markers){
FlowBreakPoint fBreakPoint = new FlowBreakPoint();
fBreakPoint.setMarker(marker);

DebugPlugin.getDefault().addDebugEventListener(fBreakPoint);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(fBreakPoint);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐