Eclipse can add unambiguous classes with an "on-save" action, but it will not resolve static functions. I don't always use autocomplete, and going back to trigger it is cumbersome.
e.g. I often write code like
printDebug("my value", my_obj);
and I want it to automatically add
import static util.DebugOut.printDebug;
NOTE: To reiterate, I'm not looking for (a) anything that requires ctrl+space
, (b) automatic import of a class
I know this doesn't exactly supply what you asked for, but I thought I'd post it anyway. I would suggest using an Eclipse template to do what you are trying to accomplish. For instance, if I were to want to use Math.sin()
as if it were statically imported, I would use the following template:
${:importStatic(java.lang.Math.sin)}sin(${cursor});
For you, you want to follow these steps:
Pattern:
${:importStatic(util.DebugOut.printDebug)}printDebug(${someString},${someObject});
Explanation: The importStatic
variable will add the specified static import if it can be resolved and doesn't conflict with an existing import. someString
and someObject
prompt the user (you) to replace those values with real expressions and allow you to tab to the next one.
With this, you'll probably find it much faster than an automatic import in the end.
As for your "actual" question, you might find the following to be relevant. It's essentially a duplicate.
See Window->Preferences->Java->Editor->Content Assist->Favorites.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With