14
Every time I see myself putting this.
before variables that are class attributes in non-static methods.
Eclipse has some option that applies this to all source files?
14
Every time I see myself putting this.
before variables that are class attributes in non-static methods.
Eclipse has some option that applies this to all source files?
14
You can set this in Window->Preferences->Java->Code Style->Clean Up.
Create a new profile, or edit the current one.
Go on the tab Member Accesses.
Marque: Use 'this' qualifies for field Accesses ; then just dial Always.
Done all this, just go to the menu Source->Clean Up.
1
It can also be set to fix automatically when saving class through Save Actions (Window->Preferences->Java->Editor->Save Actions).
Activate the checkbox Additional actions and select Configure... .
On the tab Member Accesses, select Use 'this' Qualifier for field Accesses and activate Always.
NOTE: Can also be configured for methods.
Click OK, close the preferences screen and you will already be active while saving the files.
0
If what you want is to avoid typing this.
before each variable, just use ctrl + espaço
that the variables belonging to the scope of this.
appear for you to choose (autocomplete feature).
I wanted something like Ctrl+shift+o
Browser other questions tagged java eclipse
You are not signed in. Login or sign up in order to post.
Complementing: you can easily create a shortcut to this command, such as
Ctrl+Shift+O
– everton