Reputation: 15855
In Intellij IDEA 11.1.2, when using the refactor shortcut to Introduce a Constant, it always makes public static final constant, whereas I generally prefer to default to private. In older versions of Intellij, I'm pretty sure that I had the option of setting private as the default. Does anyone know if there still exists an option to default to private for the Introduce Constant refactor option rather than having to afterwards go to the declaration and edit the public to private?
Upvotes: 14
Views: 2658
Reputation: 11
I know this thread is quite old, but as of now there is an easier way to get the desired result than the accepted Answer:
You can simply press the shortcut to introduce a constant twice to get refactoring dialog and select private there once.
From now on pressing the shortcut will always introduce a private constant.
The same procedure can then be used to switch back to public. No need to click through the setting each time.
Upvotes: 1
Reputation: 1788
I had the same problem and solved it (idea 12).
To introduce private constants by default do the following:
Upvotes: 17
Reputation: 15855
ah, never mind, I see. You have to press command-alt-C again to get the old dialog. Grrr. The short cut is getting longer....
Upvotes: 4