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

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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值