eclipse debug

JDIModelPresentation

IDebugModelPresentation #getEditorInput方法得到editinput

 

org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility#lookup方法里通过

 

if (presentation != null) {
     editorInput= presentation.getEditorInput(sourceElement);
    }
    if (editorInput != null) {
     editorId= presentation.getEditorId(editorInput, sourceElement);
    } 

 

然后都设置到SourceLookupResult里

 

org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility#display方法里

得到editor,如果

editorPresentation.addAnnotations(editor, frame)的值为true(非文本的的不过调试),这需要我们的IDebugModelPresentation同时也是IDebugEditorPresentation而且需要方法addAnnotations返回true,图形定位就是在这里完成的。

然后调用如下代码:

    Decoration decoration = new StandardDecoration(editorPresentation, editor, frame.getThread());
    DecorationManager.addDecoration(decoration);

 

如果addAnnotations返回false,这个时候编辑器应该是ITextEditor类型或这个可以被adapt到ITextEditor,然后根据IStackFrame得到行数,然后再得到IRegion,从而调用:

editor.selectAndReveal(region.getOffset(), 0);

来定位到当前行。

 

 

断点是在ToggleBreakpointAdapter#toggleBreakpoints中创建的,比如JavaLineBreakpoint是在toggleLineBreakpoints方法中创建的,在这个方法中有如下判断:

IJavaLineBreakpoint existingBreakpoint = JDIDebugModel.lineBreakpointExists(resource, tname, lnumber);
       if (existingBreakpoint != null) {
        DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(existingBreakpoint, true);
        return Status.OK_STATUS;
       }

 

也就是如果存在了就删除。

 

 

 

为特定的modelId定制变量值修改及保存功能

 <extension
       point="org.eclipse.debug.ui.variableValueEditors">
    <variableValueEditor
          modelId="org.eclipse.jdt.debug"
          class="org.eclipse.jdt.internal.debug.ui.actions.JavaVariableValueEditor"/>
 </extension>

 

 

扩展点org.eclipse.jdt.launching.vmInstallTypes,是在installed jres 点add按钮出现的jre类型。

可以通过如下扩展点给对应的vmtype添加下一页的ui内容

 

 <extension
       point="org.eclipse.jdt.debug.ui.vmInstallPages">
    <vmInstallPage
          class="org.eclipse.jdt.internal.debug.ui.jres.EEVMPage"
          vmInstallType="org.eclipse.jdt.launching.EEVMType">
    </vmInstallPage>
 </extension>

 

如果没给对应的vmInstallType添加对应的page则使用默认的StandardVMPage

 

 

TreeModelContentProvider是变量视图的ContentProvider,会委托给具体的类来做,比如jdt中是通过JavaStackFrameContentProvider(通过JDIStackFrame adapt 而来)来完成的,labelprovider是JavaVariableLabelProvider来完成的。

 

InternalTreeModelViewer#CellModifierProxy变量值修改。

 

而点完某个变量,如果这个变量是Object,会调用对象的toString()方法,显示在变量下面的文本区域。这是通过JDIThread的invokeMethod(ClassType, ObjectReference, Method, List, boolean)方法完成的

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值