Eclipse has always been a very popular tool in Java development, but I’ve been reading articles recently that IDEA is catching up. Indeed, I’ve used several jetBrains development tools, and I have to admit that the company makes some very useful tools that I can’t afford. But my favorite PyCharm is available in the community and is fully available. Secondly, I have applied for a student license. However, sometimes, I still feel unable to give up Eclipse. First, IDEA makes me feel very complicated, and secondly, THERE are many things I can’t adapt to. Most importantly, our data structure teacher requires us to submit the Eclipse project (IDEA supports exporting the Eclipse project, but it is very troublesome to go around). So you really can’t enjoy the smooth code completion of IDEA on Eclipse? Of course the answer is no!

To start the premise

I can only tell you that the whole process is very difficult, if you really need to continue, otherwise… I still want you to keep watching, run… In addition, the article is small white to, in fact you can find similar tutorials on the Internet, but as I am so detailed, and operational, I can only say that should not be!

Step one, you may be satisfied

By default, when we use Eclipse, we find that only when we press.Eclipse prompts for all properties or methods that the instance object can call, as shown in the figure below



However, we can enter any variable name or Java keyword to get no prompt, this IDEA is totally eclipse ah!

So first of all, we need to multiply the hints, the choicesWindows->PreferencesTo open the preferences menu, select on the rightJava->Editor->Contnet AssistFor this branch (do not select its children), see the figure



Notice that at this point in the red arrow, there was only one.This item means when to activate the completion prompt, because there is only one by default.So just fill in all the buttons you want him to activate, like

     
  1. .(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

This will activate the code completion prompt if we type in all of these characters. Look at the orange arrow, which shows how long it takes to activate the code completion prompt after we type in characters. The best option is to change it to 0, but if your machine is not performing well, I recommend not changing it to too small! And the last thing is of course apply and save! Then we can get variable names and even some code block completion



typeaCan obtainabcThe completion option for this variable!



typeifCan complete the entire logical branch code block, and even very common to determine whether empty code block!



Typing a class name inside a class prompts you to complete an entire constructor block!



You can also type in a Java keyword to get the corresponding code completion, such as the entire method body!

In short, there are a lot of uses, so enjoy!

Step two: What about cheating?

A lot of people might be satisfied with the last step, but you’ll be coding furiously for ten minutes and want to come back and scold me. What the hell? Sometimes the code prompts I don’t need ah, but I hit a space you also give me a TM screen? There is something wrong with? I’ll tell you to pressEscCan you eliminate the prompt box? At this time, the toss really began! The tutorials on the web are sure to tell you to import the XX plugin into the project directory and change the code. Of course, I did that too, but if you don’t read down, you won’t be able to import it at all!

First of all, the first step is still to import the plugin into the project directory, but you will find that you just can’t import it anyway, ha ha, it’s not that you can’t import it, neither can I! Then I started working on it for a long time, except for one article that implicitly mentioned that Eclipse needed the Classic version to have the source code, and the other distributions only included compiled files! So we need to start looking for the Classic version! It’s a tortuous process, and I’m telling you right here, right hereDownload.eclipse.org/eclipse/dow…To be clear, this is the latest version, but if you can’t trace back to the source to find your own version, consider your future! Also note that this page is very linked, please pull down toEclipse SDKThis column, download the corresponding system version! As shown in figure



Once downloaded, unzip to a directory you rarely use, and start Eclipse! Yes, you have reinstalled Eclipse! Of course, I’ll tell you that it’s temporary, because you don’t want to throw away your various personalization Settings, but I’ve tried many ways to import plug-ins that we need to change code only from within Eclipse. I don’t know why, but it turns out to be very important !!!!

After waiting for the new Eclipse to launch and choosing a workspace where you don’t use it, we’ll get started!

Click on theFile->ImportOpen the Project Import dialog box and selectPlug-in Development->Plug-ins and FragmentsThis branch, and then clickNext



And then chooseDirectoryAnd points to the new Eclipse directorypluginsDirectory, and pay attention to selectionProject with source foldersThis item, if your default Settings are not consistent with the picture, please select the same, do not ask why, first I do not know why, secondly I have tried! Click again on theNext, next step.



And then find it on the leftorg.eclipse.jface.textThis package and clickAdd->Move it to the loading area on the right, and check the box belowInclude fragments when computing required plug-ins, click on theFinishThe import is complete.



Open import project undersrc->org.org.eclipse.jface.text.contentassist->CompletionProposalPopup.javaThis file, find itverifyKey()This method (find the word, the second occurrence of the position)



The second one in this methodswitchIn the branch structure, comment itsdefaultBranch, make sure it’s the second oneswitchBranch, second!!



You can compare the code above and make sure you don’t get it wrong… Then click Save.

Next, right-click the project in package Manager and selectExportOpen the Export project dialog box and selectPlug-in Development->Deployable plug-ins and fragmentsFor this branch, clickNext.



And then checkorg.eclipse.jface.textItem (should be checked by default, if your optional item does not appear, see where you made a mistake!) And selectArchive fileIn this case, select a save path, name doesn’t matter, clickFinish.



We wait until the export is complete, and we get one*.zipFile, open it up, and you see onepluginsFolder. There’s one in thereorg.eclipse.jface.txt_*.jarFile, so the next step is obvious, replace our old Eclipse directory with this filepluginsMake a backup of the original file (if the version you downloaded is the same, the file name itself is the same, if not, you can try to change the file name, it does not test whether it works!) . Delete the new Eclipse, restart the old Eclipse, and now you can “only” press Enter to screen the code completion you need, and finally enjoy the real fun of typing code, hahaha!