[eclipse] Open type (Ctrl-Shift-T)找不到类

来源:互联网 发布:Knn算法预测天气预报 编辑:程序博客网 时间:2024/06/04 18:54

转自:《http://www.eoeandroid.com/blog-91715-5053.html》


有时(我极少遇到),通过ctrl + shift + t找对应的类时,类明明存在,并且也在编译路径下,但就是查找不到,一个可能的原因就是eclipse为类建立的索引出了问题。

      解决的方法是:找到项目所在工作空间下的.metadata/.plugins/org.eclipse.jdt.core文件夹,将里面的*.index文件和savedIndexNames.txt文件删除,重启eclipse,然后eclipse会重建索引,这时问题就可以解决了。
 
解决方法来自这里: http://www.java-forums.org/eclipse/6513-open-type-ctrl-shift-t-does-not-find-types.html 
 
Sometimes, the indexes that Eclipse use for searching the types, get corrupted. You can clear the Open Type indexes by going to <Workspace>/.metadata/.plugins/org.eclipse.jdt.core and deleting all files there. The indexes will be re-built the next time you use open type.

Note that this is a empirical observation, and you may delete some JDT saved data that you don't want to delete. I observed no ill effects, but for safety you could try deleting just the *.index files and the "savedIndexNames.txt", and see if it works. 
原创粉丝点击