JDIModelPresentation
#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)方法完成的
分享到:
相关推荐
eclipse debug (调试) 学习心得
Eclipse Debug的Flash教程
"Eclipse Debug 调试技巧入门" Eclipse Debug 是一个功能强大且灵活的调试工具,提供了多种调试功能,包括分步执行、设置断点和值、检查变量和值、挂起和恢复线程的功能。Eclipse 平台很健壮,因为其他编程语言可以...
Eclipse Debug不为人知的秘密
eclipse debug (调试) 技巧
java的调试技巧,应该很实用的,主要是针对Eclipse的操作讲述,讲述了多种调试技巧
Android 开发之Eclipse Debug调试详解
Eclipse Debug介绍,实习期间接触Debug,一直只会F5,F6,F7,F8,刚好要求做个ppt演示任何东西,总结了一下刚学的,带给和我一样只会F5,F6,F7,F8的朋友
NULL 博文链接:https://gdmao.iteye.com/blog/1159580
在Eclipse中使用debug(Eclipse调试常用技巧)
计算机后端-Java-Java核心基础-第13章 面向对象05 06. Eclipse Debug的使用.avi
Eclipse debug技术,非常具有实际的操作意义1
这份文档详细介绍了android开发过程中使用eclipse的调试方法和非常实用的eclipse快捷键。很好的文档
eclipse中debug技巧,实用技巧。
主要介绍了Eclipse Debug模式的开启与关闭问题简析,同时向大家介绍了一个简单的debug模式启动不起来的解决方法,希望对大家有所帮助。
在Eclipse中使用debug(Eclipse调试常用技巧)
Eclipse_debug技
Eclipse调试Debug的常用技巧,所有的调试方式.
全面包括所有快捷键