Highlighting a class file in the package explorer in Eclipse

萝らか妹 提交于 2019-12-06 12:57:10

You should use the JDT API to get a CompilationUnit:

ICompilationUnit cu = JavaCore.create(file);

and then use this CompilationUnit object to setSelection:

ISelection selection = new StructuredSelection(cu);

And, by the way, why you want to develop this function yourself? Ctrl+Sihft+T, you can open an dialog to search class and open it in editor. And the package explorer has an "Link with editor" toolbar item that can auto select the class in the active editor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!