Community
Participate
Working Groups
While running the tool to fix bug 407432, I found that out of the 750+ reported broken strings, only a handful of them actually were unused. Most of the strings are used via the pattern: ResourceBundle.getBundle(<classname>).getString("stringname") It would be awesome if the tool could detect this usage.
(In reply to comment #0) > I found that out of the 750+ > reported broken strings, Can you please tell on which project you ran it, so that we can use it as test case?
(In reply to comment #1) > (In reply to comment #0) > > I found that out of the 750+ > > reported broken strings, > > Can you please tell on which project you ran it, so that we can use it as > test case? I guess it would help if I had mentioned that :) Try org.eclipse.jface or org.eclipse.ui.workbench
I tried several results in both projects and they are all correct. Maybe you did not have all projects in your workspace? I saw some of your changes caused compile errors in the build. Please provide some concrete wrongly reported unused string examples.
(In reply to comment #3) > Please provide some concrete wrongly reported unused string examples. Unused keys in: Theme.properties - org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes Which is in fact used in org.eclipse.ui.internal.themes.Theme.getLabel() There are more examples in platform UI and in Ant. I also found there is a method in jface: org.eclipse.jface.util.Util.translateString(ResourceBundle, String, String) used to look up strings as well, so some strings looked up via that method are also tagged as unused. Another example, the keys from: Unused keys in: ThemeRegistryReader.properties - org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes (7 matches)
Also any string accessed for a TextAction constructor. For example: org.eclipse.ant.internal.ui.editor.actions.ToggleMarkOccurrencesAction.ToggleMarkOccurrencesAction() uses the string ToggleMarkOccurrencesAction.label from org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/AntEditorActionMessages.properties but it is flagged as not used
In general we only support the patterns that are generated by our wizard. If we want to support the ResourceBundle.getString(String)) pattern, then we also have to update the NLS hyperlinks and hovers. (In reply to comment #5) > Also any string accessed for a TextAction constructor. > > For example: > > org.eclipse.ant.internal.ui.editor.actions.ToggleMarkOccurrencesAction. > ToggleMarkOccurrencesAction() > > uses the string ToggleMarkOccurrencesAction.label from > org.eclipse.ant.ui/Ant > Editor/org/eclipse/ant/internal/ui/editor/actions/AntEditorActionMessages. > properties but it is flagged as not used This one will never work, as ResourceAction computes the key in the code.