我想以编程方式跳转到文本编辑器中的某个位置并突出显示代码。
我没能得到安德鲁的回答 https://stackoverflow.com/a/8775795/105137在 Eclipse 3.7 中工作。编译器给出了这个错误:
The method getSourceViewer() from the type AbstractTextEditor is not visible.
但是,我能够让它与selectAndReveal()
method:
IFile myfile = ...
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
ITextEditor editor = (ITextEditor) IDE.openEditor(page, myfile);
editor.selectAndReveal(offset, length);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)