1

In Eclipse Kepler I started externalizing strings and the wizard puts the NON-NLS behind the lines. I know the reasons why and that's great, but is there way to modify this tag to be something else?

For example for code style you can use tags to enable and disable the formater and you can define your own and I prefer much shorter ones.

If instead:

//$NON-NLS-1$

I could change it to for example something like this:

//$NX-1$

And still being properly detected by the Source -> Externalize Strings wizard.

For me it would improve my readability, it makes big lines, then it wraps them where they didn't needed to etc... And I can make sure not use NX prefix on anything else so it will not misbehave.

Is there setting/plugin/workaround which could achieve desired effect?

Thanks in advance for any hints.

UPDATE: Marked answer didn't solved it per say, because looks like mine question doesn't have solution (maybe except recompiling eclipse)

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Anton Krug
  • 1,555
  • 2
  • 19
  • 32

1 Answers1

1

You can edit the template in preferences. Go Window > Preferences > Java > Editor > Templates the editor nls template.

Change current template from //$$NON-NLS-${N}$$ to //$$NX-${N}$$ or some thing else you want.

Refer

enter image description here

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
  • Thanks for nice pictures, but looks like this setting is completely ignored by the Source -> Externalize Strings wizard, he is still using the //$$NON-NLS-${N}$$ format independently what is configured in the templates. – Anton Krug Mar 02 '15 at 11:54
  • 1
    No preferences were given to control this, but we can use search and replace dialog(you will get it by pressing Ctrl + H) to replace all `//$$NON-NLS-${N}$$` to whatever you want using regular expression. – Chandrayya G K Mar 03 '15 at 10:03
  • Is there any workaround? Or different 3rd party tool to externalize strings which would allow to change the tag itself? Is the string hardcoded into Eclipse and I would have to recompile it? – Anton Krug Mar 03 '15 at 23:36
  • IMHO no. JDT using the standard comment which is not allowed to change. IMHO is no such plugin to solve this. The best solution is to user search and replace dialog to change the existing comments and change the template as said in the answer to prevent old style commenting. – Chandrayya G K Mar 04 '15 at 05:58
  • I wouldn't mind to search & replace once, but then when I will run the tool again (to add more strings) I would have to search & replace it back so the tool would detect them. BTW how I should close this question? you helped me the most, but you didn't solve my problem. So I don't want to flag this as solved, because maybe it doesn't have a solution. But you were helpful to me. – Anton Krug Mar 04 '15 at 10:52