引入:
前面揭示了JDI的Debugger如何建立连接,发送和处理请求,这里我们专注于人机交互部分,Debugger的UI,它主要负责如何把人发出的操作转为请求,以及把请求操作反映在调试器的界面上。
分析:
这个插件主要都定义在org.eclipse.jdt.debug.ui_<Version>.jar中的plugin.xml中,它提供了各种人机交互的插件功能。打的比方,我们看编辑器功能:
<extension point="org.eclipse.ui.editorActions"> <editorContribution targetID="org.eclipse.jdt.ui.CompilationUnitEditor" id="org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions"> <action label="%AddBreakpoint.label" class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate" actionID="RulerDoubleClick" id="org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction"> </action> </editorContribution> <editorContribution targetID="org.eclipse.jdt.ui.ClassFileEditor" id="org.eclipse.jdt.debug.ClassFileEditor.BreakpointRulerActions"> <action label="%AddBreakpoint.label" class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate" actionID="RulerDoubleClick" id="org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction"> </action> </editorContribution> <editorContribution targetID="org.eclipse.jdt.debug.ui.SnippetEditor" id="org.eclipse.jdt.debug.ui.JavaSnippetToolbarActions"> <action toolbarPath="evaluationGroup" id="org.eclipse.jdt.debug.ui.SnippetExecute" hoverIcon="$nl$/icons/full/etool16/run_sbook.gif" class="org.eclipse.jdt.internal.debug.ui.actions.ExecuteAction" disabledIcon="$nl$/icons/full/dtool16/run_sbook.gif" enablesFor="+" icon="$nl$/icons/full/etool16/run_sbook.gif" helpContextId="execute_action_context" label="%Execute.label" tooltip="%Execute.tooltip"> <selection class="org.eclipse.jface.text.ITextSelection"> </selection> </action> <action toolbarPath="evaluationGroup" id="org.eclipse.jdt.debug.ui.SnippetDisplay" hoverIcon="$nl$/icons/full/etool16/disp_sbook.gif" class="org.eclipse.jdt.internal.debug.ui.actions.PopupDisplayAction" disabledIcon="$nl$/icons/full/dtool16/disp_sbook.gif" enablesFor="+" icon="$nl$/icons/full/etool16/disp_sbook.gif" helpContextId="display_action_context" label="%Display.label" tooltip="%Display.tooltip"> <selection class="org.eclipse.jface.text.ITextSelection"> </selection> </action> <action toolbarPath="evaluationGroup" id="org.eclipse.jdt.debug.ui.SnippetInspect" hoverIcon="$nl$/icons/full/etool16/insp_sbook.gif" class="org.eclipse.jdt.internal.debug.ui.actions.PopupInspectAction" disabledIcon="$nl$/icons/full/dtool16/insp_sbook.gif" enablesFor="+" icon="$nl$/icons/full/etool16/insp_sbook.gif" helpContextId="inspect_action_context" label="%Inspect.label" tooltip="%Inspect.tooltip"> <selection class="org.eclipse.jface.text.ITextSelection"> </selection> </action> </editorContribution> </extension>
从这里看出,它支持好几个操作:如CompilationUnitEditor的打断点 ,ClassFileEditor的打断点等。
每个操作都有用到的图标,用到的action响应类等,有兴趣的可以看下。
本文出自 “平行线的凝聚” 博客,请务必保留此出处http://supercharles888.blog.51cto.com/609344/1588681
JDI 架构研究21 - JDI的Debugger的UI部分
原文地址:http://supercharles888.blog.51cto.com/609344/1588681