IntelliJ call hierarchy of fields - eclipse

Eclipse JDT has a 'call hierarchy' feature -- start from a field/method and it recursively finds all references.
IntelliJ also implements this, but it only works from methods. For fields, you can only 'Find Usages', so if you want to dig deeper you have to do additional searches.
Tried 'Dataflow to here', but it's not what I'm looking for.
Am I missing something? Is there a better way to explore field usage in IntelliJ?

Select the method you're interested in and then use from the top menu "Navigate > Call Hierarchy" or simply Ctrl+Alt+H.
AFAIK this doesn't work for fields, because when I select a field, the "Navigate > Call Hierarchy" option becomes grayed-out. The only similar featutes I'm aware of for fields are "Edit > Find > Find Usages" (Alt+F7) and "Edit > Find > Show Usages" (Ctrl+Alt+F7).

EDIT
The issue below has been resolved and IntelliJ IDEA 2019.3 will have this feature.
EDIT 2
I downloaded:
IntelliJ IDEA 2019.3 EAP (Community Edition)
Build #IC-193.3793.14, built on September 25, 2019
But it seems this issue was not fixed correctly, the call hierarchy for fields does not take you to the actual usage of the field in the method rather to the line of the method definition.
See: https://youtrack.jetbrains.net/issue/IDEA-160274#focus=streamItem-27-3721096.0-0
Original answer
IntelliJ doesn't have this feature, however there is a feature request here:
https://youtrack.jetbrains.com/issue/IDEA-160274
If you would like the feature implemented, you can vote there.

"Dataflow to here" and "Dataflow from here" give you a recursive view of data flowing in to, and out of, fields (or local variables).
I think that these two features, in fact, are what you're after.
If not, can you rephrase the question in less IDE-specific terms? In other words: what information do you want to extract from your codebase?

Use "Find Usages" feature (Alt+F7)

Related

How to make Scala Presentation Compiler happy with Binding.scala?

I use ENSIME to deal with Scala code, and ENSIME uses official Presentation Compiler. For all Binding.scala examples I looked at #dom functions result in "all is red" decoration (that is false positive error detection) for DOM fragments. Say this one example https://github.com/Atry/Binding.scala-sample results in "all is red" starting from the first div of the table definition.
I guess Eclipse users are also affected by the issue as far as Eclipse uses PC also.
How to resolve the issue?
use addEnsimeCompilerPlugin in addition to addCompilerPlugin. This will be addressed by https://github.com/ensime/ensime-server/issues/1152

Netbeans Java code suggestion options/plugin?

If I type Car.Mile and press ctrl-spacebar to autocomplete the member name, it does not bring up matches that don't begin with Mile at all. This is pretty annoying because so many methods are prefixed with get/set/is like getMileage() and setMileage().
My code completion options look like this currently. Not seeing this as a choice. This is JMonkeyEngine's version of Netbeans, if that matters.
Anyway to get this behavior?
Don't use the settings for "All Languages" use the Java settings:

Eclipse Open Type Pick Absolute Match First

I have two classes, UserServiceDBImpl and UsergroupServiceDBImpl. When I use the "Open Type" dialog and type in 'UserServiceDBImpl' it often puts UsergroupServiceDBImpl first even though the other class is an exact match.
Is there any way to convince Eclipse to put the absolute match ahead of whatever it decides is the "best" solution according to its internal rules?
There has been a bug report open for this since 2005:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=109670
If you include the package when typing the classname into the dialog eg: "*.user.UserServiceDBImpl" it will help narrow it down, at least if the wrong options are in different packages anyway. Tedious though.

Is there a way to get eclipse code completion to filter options on text typed anywhere in a word rather than just the start?

I have just started using eclipse Indigo for Scala development. Is there a setting anywhere in eclipse to change the filter behavior to "anywhere" when I type X. and invoke completion?
If I have an object foo with a field foo.name and methods foo.fullName, foo.capAllNames I would like all three to remain in the selection list when I type foo.name.
Currently the list is filtering on the start of the word so only the foo.name property would remain in the example given. I would like the filter to be based on the text being present anywhere in the word, can this be done in eclipse?
Thanks
John
Looks like Code Recommenders as suggested by moeTi will do the job but I might have to wait for a while until the latest bug fixes filter through to a release that will play nicely with the Scala plug in (it/eclipse threw exceptions when I installed it):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=383395

In-place ("Quick-Assist" or something easier) source code modifier?

Eclipse already has very impressive and useful what I call "source code modifiers" (please suggest a better name).
For example, it has "Quick Fix", "Word Completion", "Externalize Strings" and other functions that modify source code via menu (or key-combination).
Now, I am looking to add my own "source code modifier" function: I would like to:
Highlight (select) an arbitrary string.
Right-click on it
Invoke a menu item that would "translate" that string to a different string, using a function that I wrote (preferably in Java). Similar to "Quick Fix" or "Replace With" currently on the default context menu.
Is this possible in Eclipse?
If so, what do I need to do to accomplish this?
The short answer:
The quick assist will have to modify the AST of the Java code. Essentially you will have to replace a org.eclipse.jdt.core.dom.SimpleName node with one that you want.
The long answer:
The org.eclipse.jdt.ui.quickAssistProcessors extension point enables you to contribute your own Java code quick assists.
To create a new extension for the extension point you need to first provide the required extension in the plugin.xml. For example, JDT defines the following processor
<extension
point="org.eclipse.jdt.ui.quickAssistProcessors">
<quickAssistProcessor
name="%defaultQuickAssistProcessor"
class="org.eclipse.jdt.internal.ui.text.correction.QuickAssistProcessor"
id="org.eclipse.jdt.ui.text.correction.QuickAssistProcessor">
</quickAssistProcessor>
</extension>
(For a description of the individual attributes, please refer to the extension point documentation)
Then you need to create the class that implements the org.eclipse.jdt.ui.text.java.IQuickAssistProcessor interface, and modify the AST in this class. (This class is the same as the one you specified while declaring the extension)
Supplying the right IJavaCompletionProposal
JDT provides the following default implementations for correction proposals that can be used to contribute quick fixes and quick assists.
ChangeCorrectionProposal
CUCorrectionProposal
ASTRewriteCorrectionProposal
If you use an ASTRewrite, you should create an ASTRewriteCorrectionProposal.
ASTView Plugin
This is something that will help you visualize the AST of a Java source file http://www.eclipse.org/jdt/ui/astview/index.php
The right name is 'Quick Assist'. You have to write some code to create your Quick Assists.