eclipse - create a custom shortcut to generate the getter and setter -


i know traditional way in windows generate getter , setter of attributes in class: highlighting fields --> right click --> source --> generate getters , setters there anyway create own shortcut that?

what should enter name , pattern in case?

enter image description here

java editor templates aren't powerful following best pattern come with. name / description referencing template can anything.

public ${type} get${variable}() {     return this.${variable}; }  public void set${variable}(${type} ${variable}) {     this.${variable} = ${variable}; } 

to use in open java editor . . .

ctrl+space --> select name of template (or start typing template name autocomplete) --> enter variable type --> tab --> enter uppercase variable name --> tab --> enter lowercase variable name --> enter or tab

the upper/lower case names there follow java naming conventions. there no substring or default functions can find process variable text, otherwise you'd have enter variable name once. saw this answer , suggests creating custom function upper-casing variable name not trivial nor answer have complete solution.


an alternative more time consuming method create plugin (and learn eclipse plugin development) , bind plugin command key combo in windows>preferences under general>keys (or general>editors>keys)


finally if neither of these suitable implementing, minimal change of binding "generate getters , setters" command key combination make existing option faster. can go same windows>preferences under general>keys (or general>editors>keys) , search command "generate getters , setters", select binding, , hit key combination want bind to.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo