Eclipe PDE:跳转到 X 行并突出显示它
关于Eclipse PDE开发的问题:我为Eclipse写了一个小插件,有以下内容 * org.eclipse.ui.texteditor.ITextEditor * 行号
如何自动跳转到该行并标记它?遗憾的是,API 似乎只支持文档内的偏移量(参见:ITextEditor.selectAndReveal()),但不支持行号。
最好的办法是 - 尽管这不起作用:
ITextEditor editor = (ITextEditor)IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, true );
editor.goto(line);
editor.markLine(line);
这可能以某种方式实现吗?我没有找到解决方案
A qustion about Eclipse PDE development: I write a small plugin for Eclipse and have the following
* an org.eclipse.ui.texteditor.ITextEditor
* a line number
How can I automatically jump to that line and mark it? It's a pity that the API seems only to support offsets (see: ITextEditor.selectAndReveal()) within the document but no line numbers.
The best would be - although this doesn't work:
ITextEditor editor = (ITextEditor)IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, true );
editor.goto(line);
editor.markLine(line);
It this possible in some way? I did not find a solution
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在类DetailsView 我找到了以下方法。
on the class DetailsView I found the following method.
即使 org.eclipse.ui.texteditor.ITextEditor 处理偏移量,它应该能够使用
selectAndReveal()
方法获取行号。请参阅此线程和此线程。
Even though org.eclipse.ui.texteditor.ITextEditor deals wiith offset, it should be able to take your line number with the
selectAndReveal()
method.See this thread and this thread.