Community
Participate
Working Groups
Wow, you guys have really got me confused with this feature. I'm really not sure whether this is a bug or my own lack of understanding, but I can never get the Java Search to do what I'm wanting it to do. I strongly believe that the usability of this element needs to be evaluated. Take the field search for instance. I can't ever find fields that I know exist. Here's what the documentation says... "Depending on what is searched for, the search string should describe the element... ... Field: the fully qualified name of the defining type and the field name (e.g. org.eclipse.jdt.internal.core.JavaElement.name)" So unless I've misunderstood, the search string to use when trying to find a field should be the fully qualified name of the field. Is this a search? If I know exactly where to look for the field, I don't need a search. My expectation of the Java search for a field is more along the following lines. A search for a field using search string "mypackage.Foo", limiting to declarations should result in all field declarations of type "mypackage.Foo". I'm sure there are ways to combine the search options to make meaningful searches, but the search dialog certainly doesn't aid in any appreciable way.
I suspect it was talking about finding references to a specific field, not its declaration. If you search for references to a field 'foo' you could find many more references than 'p1.A.foo'.
Unfortunately, I agree that documentation is a little bit confusing here. It's absolutely not mandatory to specify the fully qualified name to be able to find a field. Same thing for types, methods and constructors. It should write for field: "the field name and eventually the fully qualified name of the defining type (eg. name or org.eclipse.jdt.internal.core.JavaElement.name)" The difference is in the fact that if you do not specify the fully qualified name, you could get several different matches. Imagine you're looking for field "foo" declaration and your project contains 2 classes X and Y both defining a field foo. The result of your search without qualified named will report the two declarations although a fully qualified one would report only one or zero (if the qualification matches neither X nor Y)... But this for search from Java Search tab in Search dialog. If you use the search from popup-menu directly from Hierarchy or Outline views, Editor, or Package Explorer, then you won't have any question about the search. It will work automatically :-) Just select the element you want to search (field in your example) and select Search->Declarations->Workspace in popup-menu and you'll see it appearing in Search View without having specified the fully qualified name...
Fixed and released in HEAD. Also added examples to show qualified and non-qualified strings...
Verified in I20050526-2000