There were good code hints when writing code with VisualStudio and Sublime, but it was not customary to find code hints when I recently started using Eclipse to get java. Surf the internet to find some information, modify the way code hints, recorded in the blog for everyone to check.
This article mainly refers to the following articles
Http://www.cnblogs.com/a-zx/p/3388041.html
This article is based
Eclipse Java EE IDE for WEB developers.
Version:luna Service Release 2 (4.4.2)
Build id:20150219-0600
To explain.
Set Code hints
Open Eclipse, select Windows, Perferences, Java, Editor, Content assist,auto activation triggers for Java: Settings The default in the box is "."
Now change it to:
. abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz_
There are older versions of Eclipse that do not support defining so many triggers, and can be implemented by modifying configuration files, many of which are available online.
Then you'll see that eclipse can use more intelligent code hints. But the big question now is that Eclipse is too smart, and it's always trying to help us complete some of the code we don't want. For example, press "=" and the space will automatically complete the code, which many people really can not endure.
Fortunately Eclipse is open source software, the solution is to directly modify the code hint function source code to complete the function we need.
First Open window->show view, select Plug-ins, then find Org.eclipse.jface.text, right click, select Import as-> Source Project, after the import is complete, You can see this project in your workspace. If there is no SRC folder, it means that the version you are using does not have the source code, which is exactly the case for me.
Source code can go to this address download (find me for a long time)
http://archive.eclipse.org/eclipse/downloads/
Select your eclipse version of the connection on the page (I'm using 4.4.2), and then download the eclipse-sdk-(*************). zip in the new page and choose the right version to download, about 200M. Unzip after download is complete, find Org.eclipse.jface.text.source_3.9.2.v20141003-1326.jar under the. \eclipse\plugins\ folder (This is the file that corresponds to the version of Eclipse that I used , actually choose according to your own version), copy this file into your own Eclipse installation directory under the. \eclipse\plugins\ folder, and then restart Eclipse. Repeat the above operation import Org.eclipse.jface.text, you can see the SRC folder now.
In the SRC folder, there is a section of code in the Org.eclipse.jface.text.contentassist.completionproposalpopup#verifykey () "function:
If(contains(triggers, key)){
...
}
Change this code to
If(key! =0x20&& key!= ' = '&& key! = '; ') && contains(triggers, key)){
...
}
And the code on top of this piece of code.
Case' \ t ':
E. Doit=false;
Fproposalshell. SetFocus();
returnfalse;
Revision changed to
Case' \ t ':
E. Doit=false;
Insertselectedproposalwithmask(e. Statemask);
break;
Revision changed to
After the above operation, this auxiliary input plug-in has ruled out the space and the "=" check function, added the TAB key check function. The last is to export the modified plug-in, right-click on the project in your workspace, select Export->deployable Plugins and Fragments, click Next, select the Destination tab, Select Directory, select a catalog where you want to save the plugin, and then finish. You will then create a new plugins directory in your chosen directory, with a jar file that replaces the org.eclipse.jface.text inside the eclipse/plugins, remembering to back up the original file before overwriting. Then restart Eclipse.
If you do not want to download and modify the file, I directly provide a modified jar package, directly to cover the good. My version is Org.eclipse.jface.text.source_3.9.2.v20141003-1326.jar.
Baidu Cloud Disk Http://pan.baidu.com/s/1kTl8r2J
Eclipse Auto-complete settings and Eclipse source code download