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);
}
}