Eclipse's code automatically prompts and modifies spaces and "=" automatically on the screen (self-test passed)

JAVA code automatic prompt

Eclipse has a code prompt function, but the default prompt will only prompt when you enter ".". If you want to enter any letter, you can automatically prompt, and you can modify it as follows: 

1. "window" -> "Preferences"
2. Select "java", expand, "Editor", and select "Content Assist".
3. Select "Content Assist" and see the option "Auto Activation triggers for java" under "Auto-Activation" on the right. In fact, it refers to the "." symbol that triggers the code prompt.
4. For the option of "Auto Activation triggers for java", add abcdefghijklmnopqrstuvwxyz( letter after "." to facilitate later search and modification. Then "apply", click "OK".

 

The space bar "=" key is automatically on the screen

The default setting of eclipse is not very good. The space bar and = sign will automatically display the content of the first line on the screen. In fact, many times I just want to enter a space or = sign. There is no way to set this in the settings. Fortunately, eclipse has it. The plug-in mechanism can be handled by modifying the source code of the plug-in, exporting it as a plug-in, and then replacing the original plug-in.

1. Download the corresponding eclipse for rcp and rap developers version of the current version of eclipse (this version comes with the source code of the eclipse plugin)  reference address

2. Open eclipse rcp

Import the plug-in org.eclipse.jface.text. source code project through file->import->plug-in development->plug-ins and fragments.



 

 

 2. Modify the source code

File Location: org.eclipse.jface.text.contentassist.CompletionProposalPopup
Method name: public boolean verifyKey(VerifyEvent e)
default:
	ICompletionProposal p= getSelectedProposal();
	if (p instanceof ICompletionProposalExtension) {
		ICompletionProposalExtension t=(ICompletionProposalExtension) p;
		char[] triggers= t.getTriggerCharacters();
                //Modify and add key!='='&&key!=0x20&&
		if (key!='='&&key!=0x20&&contains(triggers, key)) {
			e.doit = ​​false;
			hide();
			insertProposal(p, key, e.stateMask, fContentAssistSubjectControlAdapter.getSelectedRange().x);
		}
}

 3. Project export, the exported plug-in, modify the name to cover the original plugins\org.eclipse.jface.text_3.11.0.v20160505-1301.jar file, restart eclipse to complete



 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326642680&siteId=291194637