A source locator locates source elements for stack frames. A launch (optionally) specifies a source locator which is used to locate source for that debug session. If a launch does not provide a source locator, source cannot be displayed. Abstraction of source lookup allows clients to hide implementation details of source location and representation.
资源定位器用于为stack frames找到源码元素。加载器会指定一个用于为debug session提供定位源的资源定位器,如果加载器没有提供,则元素不会显示。对源查找的抽象化,将允许客户端隐藏源码定位的具体实现和表达(换言之,调用者只需要知道接口)。
Generally, an implementor of a debug model will also implement launch configuration types, delegates, and source locators that work together as a whole. That is, the implementation of a source locator will have knowledge of how to locate a source element for a stack frame. For example, a Java stack frame could define API which specifies a source file name. A Java source locator would use this information to locate the associated file in the workspace.
一般来说,debug model的实现会同时伴随着launch configuration类型、授权以及源定位的实现,这些工作是一个整体。资源定位器的实现需要知道如何为一个stack frame定位它的源元素。例如,一个java stack frame会定义制定源文件名的API,一个java source locator将会使用该信息去在工作空间里定位相关的文件。
Source is displayed by the debug UI plug-in. The debug UI uses a source locator to resolve an object representing the source for a stack frame, and then uses a debug model presentation to determine the editor and editor input to use to display the actual source in an editor.
Clients may implement this interface.
源由debug UI插件显示。debug UI使用source locator来为stack frame提供一个对象来表示源,然后使用一个debug model表达来决定编辑器和编辑器输入用于展示实际的源。