Eclipse查找方法的引用

我想找到以下类的方法“get”的所有调用者:

package com.zzz.zzz.zzz.services; public final class EMF { private static final EntityManagerFactory emfInstance = Persistence.createEntityManagerFactory("obamaCareIsGood4U"); private EMF() {} public static EntityManagerFactory get() { return emfInstance; } } 

所以我高举文本“get”并右键单击References – project。 但是它返回了对每个名为“get”的方法的引用,而不仅仅是对com.zzz.zzz.zzz.services.EMF.get()的引用。

这是一个日食错误吗? 如何让Eclipse仅显示对com.zzz.zzz.zzz.services.EMF.get()的引用?

 Eclipse Platform Version: 4.2.0.v20120608-135145-9JF7BHV8FyMteji0Oi_ePMz0xuZ8TVo7lV0z0ecb Build id: I20120608-1400, Spring Tool Suite Version: 3.0.0.M3 Build Id: 201207050802 

参考搜索输出:

 com.google.common.base - guava-12.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\guava\guava\12.0 - PatientCare com.google.common.base - guava-gwt-12.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\guava\guava-gwt\12.0 - PatientCare com.google.gwt.junit.server - gwt-user-2.4.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-user\2.4.0 - PatientCare com.google.gwt.requestfactory.server - gwt-servlet-2.2.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-servlet\2.2.0 - PatientCare com.google.gwt.resources.rg - gwt-user-2.4.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-user\2.4.0 - PatientCare com.google.gwt.user.cellview.client - gwt-servlet-2.2.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-servlet\2.2.0 - PatientCare com.google.gwt.validation.rebind - gwt-user-2.4.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-user\2.4.0 - PatientCare com.google.web.bindery.requestfactory.apt - gwt-user-2.4.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-user\2.4.0 - PatientCare com.google.web.bindery.requestfactory.gwt.rebind.model - gwt-user-2.4.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-user\2.4.0 - PatientCare com.google.web.bindery.requestfactory.vm - gwt-user-2.4.0.jar - C:\Users\SofiaVergara\.m2\repository\com\google\gwt\gwt-user\2.4.0 - PatientCare com.zzz.zzz.zzz.PatientCare.services.impl - src/main/java/server - PatientCare com.sun.istack - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2 - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2.runtime - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2.runtime.output - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2.runtime.property - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2.runtime.reflect - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2.runtime.reflect.opt - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare com.sun.xml.bind.v2.runtime.unmarshaller - jaxb-impl-2.2.4.jar - C:\Users\SofiaVergara\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.4 - PatientCare javax.persistence.spi - hibernate-jpa-2.0-api-1.0.1.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.1.Final - PatientCare javax.xml.bind - jaxb-api-2.2.3.jar - C:\Users\SofiaVergara\.m2\repository\javax\xml\bind\jaxb-api\2.2.3 - PatientCare org.codehaus.jackson - jackson-core-asl-1.8.5.jar - C:\Users\SofiaVergara\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.8.5 - PatientCare org.codehaus.jackson.impl - jackson-core-asl-1.8.5.jar - C:\Users\SofiaVergara\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.8.5 - PatientCare org.codehaus.jackson.io - jackson-core-asl-1.8.5.jar - C:\Users\SofiaVergara\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.8.5 - PatientCare org.codehaus.jackson.map.ext - jackson-mapper-asl-1.8.5.jar - C:\Users\SofiaVergara\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.8.5 - PatientCare org.codehaus.jackson.map.ser - jackson-mapper-asl-1.8.5.jar - C:\Users\SofiaVergara\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.8.5 - PatientCare org.fusesource.restygwt.client.dispatcher - restygwt-1.3-SNAPSHOT.jar - C:\Users\SofiaVergara\.m2\repository\org\fusesource\restygwt\restygwt\1.3-SNAPSHOT - PatientCare org.hibernate.context - hibernate-core-3.6.10.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\hibernate\hibernate-core\3.6.10.Final - PatientCare org.hibernate.stat - hibernate-core-3.6.10.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\hibernate\hibernate-core\3.6.10.Final - PatientCare org.hibernate.util - hibernate-core-3.6.10.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\hibernate\hibernate-core\3.6.10.Final - PatientCare org.hibernate.validator.internal.util - hibernate-validator-4.3.0.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\hibernate\hibernate-validator\4.3.0.Final - PatientCare org.hibernate.validator.internal.util.scriptengine - hibernate-validator-4.3.0.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\hibernate\hibernate-validator\4.3.0.Final - PatientCare org.jboss.resteasy.client - resteasy-jaxrs-2.3.4.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\jboss\resteasy\resteasy-jaxrs\2.3.4.Final - PatientCare org.jboss.resteasy.client.cache - resteasy-jaxrs-2.3.4.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\jboss\resteasy\resteasy-jaxrs\2.3.4.Final - PatientCare org.jboss.resteasy.core - resteasy-jaxrs-2.3.4.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\jboss\resteasy\resteasy-jaxrs\2.3.4.Final - PatientCare org.jboss.resteasy.spi - resteasy-jaxrs-2.3.4.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\jboss\resteasy\resteasy-jaxrs\2.3.4.Final - PatientCare org.jboss.resteasy.util - resteasy-jaxrs-2.3.4.Final.jar - C:\Users\SofiaVergara\.m2\repository\org\jboss\resteasy\resteasy-jaxrs\2.3.4.Final - PatientCare 

在Project中查找引用依赖于方法名称,这就是为什么它不准确。 尝试使用呼叫层次结构。

突出显示后,按Ctrl + Shift + G. 它将在搜索选项卡/窗口中显示结果列表。 它会在您的工作区中找到所有引用。 它通过适当的引用而不是纯文本搜索来实现。

在Eclipse Kepler中,您可以配置搜索以过滤掉所有潜在匹配 (使用引用时工作区 / 项目层次结构 。要激活filter,请单击“ 搜索”视图右上角的小向下箭头并激活“ 潜在匹配”检查-框。 在此处输入图像描述