Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338537

Summary: [nls tooling] Make String Externalization wizard work on context smaller than the whole java file
Product: [Eclipse Project] JDT Reporter: Ankur Sharma <ankur_sharma>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, deepakazad
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Ankur Sharma CLA 2011-03-01 09:30:32 EST
Provide a way to run the String Externalization on a smaller context.

I would prefer it to be possible to select a portion in Java file and run the String Externalization on only the selection. If no selection is made, the wizard can continue to run as it does now. The selected context can be shown in the context section of the wizard.
Comment 1 Dani Megert CLA 2011-03-01 09:43:57 EST
What's the use case for this?
Comment 2 Ankur Sharma CLA 2011-03-01 09:48:21 EST
It gets bit difficult when one has to externalize or internalize the strings for one method and the whole class contains lot of strings.

Such a feature comes handy when you are writing a new class and do not wish to touch the unfinished portions yet.
Comment 3 Dani Megert CLA 2011-03-01 09:56:15 EST
(In reply to comment #2)
> It gets bit difficult when one has to externalize or internalize the strings
> for one method and the whole class contains lot of strings.
Either the product and hence your whole class is externalized or it fails regarding this. I don't think it's smart to encourage people to only partially externalize their code. Either externalize everything at the point when you touch it or do it when finished with the whole class.

What's the befit of externalizing parts of an unfinished class given you have to visit the class again later to complete the externalization?
Comment 4 Ankur Sharma CLA 2011-03-01 10:06:34 EST
My argument is not based on best practice for string externalization.

My problem is very elementary. I have a unfinished class and I want to do some internalization (why? well say I copied it from some where and want to modify it).

Currently, its almost impossible to achieve this using the wizard. It does not show the strings in any order (say order of appearance). Can not even sort the table. Context section is not of much use when the class has lots of such Strings as it can only show a small snippet only.

My request is to help automate a small trivial mundane task.
Comment 5 Deepak Azad CLA 2011-03-01 10:16:21 EST
See also Bug 183334 for the string internalization case. 

At times even I have wanted to internalize a 'few strings', when I want to copy/move some code.
Comment 6 Ankur Sharma CLA 2011-03-02 03:50:53 EST
If you decide to provide a way to internalize, please keep a way which does not delete the keys. When the keys are used in other Java files, they throw compiler errors all over the place.
Comment 7 Dani Megert CLA 2011-03-02 04:05:24 EST
(In reply to comment #6)
> If you decide to provide a way to internalize, please keep a way which does 
> not delete the keys. When the keys are used in other Java files, they throw
> compiler errors all over the place.
Interalize can already be done. This request is to scope the wizard to the selection. And of course it should not delete the key if it's still used. If that's the case then please file a separate bug report.