Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366707 - [nls tooling] [quick assist] 'Rename in workspace' Quick Fix option for a properties editor key, only renames the java key
Summary: [nls tooling] [quick assist] 'Rename in workspace' Quick Fix option for a pro...
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M5   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-14 09:53 EST by vciontu CLA
Modified: 2011-12-15 05:25 EST (History)
2 users (show)

See Also:


Attachments
java project (2.44 KB, application/octet-stream)
2011-12-14 11:33 EST, vciontu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description vciontu CLA 2011-12-14 09:53:36 EST
Build Identifier: I20111209-1447

When having a java and properties files for NLS externalized strings, with a key-value pair synched in both files, the quick fix options are 'Rename in workspace (ALT + SHIFT + R)' and 'Remove property'. 
The 'Rename in workspace' option invokes the 'Rename field' wizard, with the new name and options to update references and textual occurrences. The preview changes only shows the java file changes and it does not rename the key in the properties file.

Reproducible: Always

Steps to Reproduce:
1.Should have a java and properties files with NLS externalized strings.
2.For an existing key, that is synched in the java file, invoke quick fix (ctrl +1)
3.The options should be to rename in workspace and to remove field. 
4.Select rename in workspace.
5.Complete the new name field
6.The key gets renamed in the java file but not in the properties file.
Comment 1 Dani Megert CLA 2011-12-14 10:09:13 EST
Sorry, but I cannot reproduce this. I assume you start the rename in the Properties File editor?

Can you attach a test plug-in which allows us to reproduce this?

Deepak, please stay tuned to this bug.
Comment 2 vciontu CLA 2011-12-14 11:33:26 EST
Created attachment 208389 [details]
java project

Import existing project from the archive; 
Open Messages.properties file;
On the first line, at the first character, invoke quick-fix (ctrl + 1) for 'key_one';
Select 'Rename in workspace';
Type in a new name and accept defaults;
The field is renamed in Messages.java but not in Messages.properties.

Also tested in Eclipse SDK, Build id: I20111028-1100.
Comment 3 Dani Megert CLA 2011-12-15 05:25:42 EST
The rename does not work because the Message.java does not conform to the proper format: it misses the initializer:

	static {
		// initialize resource bundle
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
	}

Due to this the rename fails and this is nothing new. In 3.7 it will also not rename the properties key if the rename is started on the field or on a reference to the field. Also, other NLS tooling like searching for broken externalized strings will fail (return false positives).


Do you really have NLS classes without the initializer? If so, I suggest to fix your code to conform to the proper format supported by the NLS tooling, so that it can correctly perform it's job.