2017.4.17 Custom Eclipse Content Assist (code completion), such as the spacebar "=" key not on the screen

Source: Internet
Author: User

Eclipse has the code hint feature, but the default hint is only the input "." , we want eclipse to be able to automatically prompt you to enter any letter, as in Visual Studio, and modify it as follows:

1. "Window" → "Preferences" 2. Select Java, expand, Editor, and select Content Assist. 3. Select "Content Assist" and see the "Auto Activation triggers for Java" option under "Auto-activation" on the right and right. Actually, it means "." is the trigger code hint. This symbol. 4. "Auto Activation triggers for Java" option in "." After adding abcdefghijklmnopqrstuvwxyz letters, easy to find the following changes. Then "Apply" and click "OK".

According to the above method to write code can be implemented at any time code hints and complete function, but in the use of the problem comes again, when the space bar will be the first line of content automatically screen, in fact, many times is to lose a space. How to solve, search on the internet a bit, sure enough someone encountered the same problem, refer to the following solution, successfully in Eclipse 3.7 to solve the problem.

Reference article:

Citation: http://johnlxj.blog.163.com/blog/static/16586556420117175344712/previously only knewalt+/PullAssistLater found that all letters can be activatedContent Assist (Method Baidu has,It's not going to be written here.).It's really cool to use..ButEclipseThere are some default settings that are not very good,such as the space bar and=Number will automatically screen the contents of the first line,In fact, many times I just want to lose a space or=Number..There's no way to set this up..FortunatelyEclipseThere's a plug-in mechanism.,Can be modified by the plugin source code,Then export to plug-ins,Then replace the original plugin to handle 1.Find the relevant plugin to open it firstPlug-ins ViewFind PluginsOrg.eclipse.jface.text,Right-click,ChooseImport as Source Project,After the import is complete,In yourWorkspaceYou'll see this.ProjectThe 2.Modify the code inSrc/org/eclipse/jface/text/contentassist/completionproposalpopup.javaIn the file,Find such a line of code char triggers = T.gettriggercharacter (); If (contains (Triggers,key)) on that lineif judged , Eclipse will determine if key ( the key you pressed) is in triggers, and if so, That triggers the code on the upper screen to prompt the first line below . So all we have to do is to exclude the space and the = number : if (key!= ' = ' &&key!=0x20&&contains (triggers,key))

3.To change the goodOrg.eclipse.jface.textExport Right click on yourworkspace Org.eclipse.jface.text, select export-->deployable  plugins and fragments, next,destination  select archive file, then finish.< Span style= "font-family: Arial" > You can see the generated in the zip file. Span style= "font-family:arial" >jar , replace inside the same name jar package , you can

How can I not find src This folder of UM may be related to the source , you find your Eclipse IDE for Java EE developers Plugins directory below there is no source code of org.eclipse.jface.text

Eclipse 's Plug-in development environment (PDE) plugin URL: http://www.eclipse.org/pde/

I have also installed Eclipse 3.5 and Eclipse 3.7, as instructed in the above article, the plugin source code cannot be modified under Eclipse 3.5 , and in Eclipse 3.7 Can be modified successfully .

The "Plug-in development" option is not available under the Eclipse 3.5 Galileo "Import" dialog box , and cannot be on the plugin under Eclipse 3.5 " Org.eclipse.jface.text " source code to modify .

The Eclipse 3.7 "Import" dialog box has the "plug-in development" option, which can be used for plugins under Eclipse 3.7 " Org.eclipse.jface.text " source code to modify .

"Import as" needs to select "Projects with Source folders"

[Java]View Plaincopy print
Make the following modifications to the source code default:icompletionproposal p= getselectedproposal (); if (P instanceof icompletionproposalextension) { Icompletionproposalextension t= (icompletionproposalextension) p;char[] triggers= t.gettriggercharacters ();//HF modify//Eclipse close space, equal sign auto-complete (on screen) function//if (contains (triggers, key)) {if (key!= ' = ' &&key!=0x20&&contains ( Triggers,key) {e.doit= false;hide (); Insertproposal (P, key, E.statemask, Fcontentassistsubjectcontroladapter.getselectedrange (). x);}}

Make the following modifications to the source code default:icompletionproposal p= getselectedproposal (); if (P instanceof icompletionproposalextension) { Icompletionproposalextension t= (icompletionproposalextension) p;char[] triggers= t.gettriggercharacters ();//HF modify//Eclipse close space, equal sign auto-complete (on screen) function//if (contains (triggers, key)) {if (key!= ' = ' &&key!=0x20&&contains ( Triggers,key) {e.doit= false;hide (); Insertproposal (P, key, E.statemask, Fcontentassistsubjectcontroladapter.getselectedrange (). x);}}

Export the modified project, and then use the exported "Org.eclipse.jface.text_3.7.1.r371_v20110825-0800.jar" plug-in to overwrite the original corresponding plug-in is good .

has been modified "Org.eclipse.jface.text_3.7.1.r371_v20110825-0800.jar" I have uploaded to my resources, need to download.

2017.4.17 Custom Eclipse Content Assist (code completion), such as the spacebar "=" key not on the screen

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.