简体   繁体   English

如何在Eclipse中按方法的全限定名搜索

[英]How to search by method's fully qualified name in Eclipse

I need to search by method's qualified name in Eclipse (Luna) 我需要在Eclipse(Luna)中按方法的限定名称搜索

I've tried to find myMethod using qualified name (copied with right click > Copy Qualified Name ) and then Ctrl+V in Eclipse's search box myproject.core.services.MyClass.myMethod(P) 我试图使用限定名称(用右键单击> 复制限定名称复制 )找到myMethod ,然后在Eclipse的搜索框myproject.core.services.MyClass.myMethod(P)按Ctrl + V

this way: 这条路:

eclipseSearchBox

The code is like this: 代码是这样的:

public class MyClass extends AnotherClass {
    @Override
    public void myMethod(P p) {
        // code
    }
}

When I search as shown in the above image, I'm getting as search result the method from the parent class (AnotherClass) 当如上图所示进行搜索时,从父类(AnotherClass)获得该方法作为搜索结果

I want MyClass's overridden method as search result. 我想要MyClass的重写方法作为搜索结果。

Instead of limiting the query to qualified references , choose in the Limit To section Declaration to find the method declaration. 而不是将查询限制为合格的引用而是在“ 限制到”部分的“声明”中选择以找到方法声明。

The match location Qualified references is for static methods. 匹配位置合格的引用适用于静态方法。 For example, in the following main method, there are one non-qualified and two qualified references to the com.example.Foo.foo() method: 例如,在以下主要方法中,对com.example.Foo.foo()方法有一个非限定引用和两个限定引用:

package com.example;
public class Foo {

    public static void main(String[] args) {
        foo(); // non-qualified reference
        Foo.foo(); // qualified reference
        com.example.Foo.foo(); // (full) qualified reference
    }

    static void foo() {}

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM