Netbeans Java code suggestion options/plugin? - netbeans

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:

Related

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

Auto fix common typo in eclipse

Lets say for example I write many times priavte instead private.
Is there a way to let Eclipse automatically fix my common typo?
Something like construct a map of my common typo to its desire fix,
and then just let Eclipse fix it without asking me about that.
Are there any other IDE\editors that have such support?
There is no builtin support for automatically changing strings. The closest to your request are the templates of the Java editor, but even those must explicitly be activated using CtrlSpace.
To get around your problem, I suggest simply not to write that much yourself. If you want to declare a private field, type just "pr" and hit CtrlSpace to invoke code completion. Eclipse can do code completion quite well, often even without any trigger characters (try it with an empty class file).

Eclipse caret jumps to constructor while typing

While typing in Eclipse (Java) I often have the problem that when I begin to type accessors, the caret jumps down to the beginning of the constructor definition. So in a document like this:
private int mSomeInt;
public
in|public MyClass(){
}
I would like to manually type out the accessor (getter/setter) for mSomeInt, but when I press space after 'public' above, the caret jumps to the beginning of 'public MyClass'.
I often type complete lines to look up and find my methods jumbled with the constructor (like above).
Any help would be appreciated.
Note - this isn't only with accessors but rather any access modifiers that I define before the constructor or another method.
Edit
After unsuccessfully trying Deco's solution below, I've managed to narrow it down a little further.
The problem only happens if I have all the blocks in the file in a collapsed state (ctrl+shift+numPadDivide). I can see the problem is now that the new access modifier I type is then (quickly) collapsed into the below method. i.e. Eclipse is actually taking the first accessor modifier and collapsing everything from there, even though my intention is actually to write a new method.
The only solution I've been able to find is to only edit the source with all the 'fold' elements unfolded.
Under Window -> Preferences -> <Language> (e.g. Java) -> Editor there is a Content Assist menu item where you can configure auto completion and caret placement as well as auto-activation of it and the delay it uses.
Edit:
After your update to the original question I was able to successfully replicate this in Eclipse Indigo. When you have all of the code blocks collapsed it looks like Eclipse assumes that the code you are writing needs to be in that block (rather than as a variable declaration). I'm not sure if this is expected behaviour or not - but the only way around it I've found is to edit the code with the main block open, and then close it after the fact - or turn folding off altogether.
From what I can tell there are various folding plugins/addons that you can get for Eclipse which override the default behaviour and might function better? A quick Google search will be able to get you a list of them quickly.
I'd probably also suggest posting this as an issue on the Eclipse support site for their official answer.
Unfortunately this issue still exists for me in the latest Elcipse version (Kepler).
As the issue only occurs when the document is 'folded', the work around this is to either disable folding in the editor - or disable folding on 'Members' from the :
Preferences -> Java -> Editor -> Folding

IntelliJ call hierarchy of fields

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)