Project: JDT
Bug 57883 mysterious results for NLS search [nls search]
Reported: 2004-04-08 09:24:47 | Status: resolved fixed

Build id: 200404070800 From a fresh workspace I did the following: - checked out the org.eclipse.ui.ide project - did an NLS search with the following value: Resource bundle accessor class: org.eclipse.ui.internal.ide. IDEWorkbenchMessages Property file name: /org.eclipse.ui. ide/src/org/eclipse/ui/internal/ide/messages.properties Scope: Workspace I haven't found documentation for this search so its quite possible that I'm using it incorrectly. However, I don't understand some of the results such as: 1) In this code (from the FeatureSelectionDialog ctor): if (name1 == null) -> name1 = ""; //$NON-NLS-1$ if (name2 == null) name2 = ""; //$NON-NLS-1$ The search results complain about the line marked with ->, but not about what looks to be the same case right after it. I'm not sure why the first line is flagged to begin with, but its even more mysterious to me that the second line doesn't produce the same result. 2) There are several lines (perhaps 35 files?) that are marked in the search. I would expect these to be cases of a string being used that doesn't exist in the file. However, when I do a manual search, I found that in most cases (all but one so far) the string does exist in my messages.properties file. The search seems to get confused if the string is on a line other than the class name, e.g. (from AboutDialog.createButtonsForButtonBar), -> createButton(parent, FEATURES_ID, IDEWorkbenchMessages .getString("AboutDialog.featureInfo"), false); //$NON-NLS-1$ But some cases do work, such as (from ChooseWorkspaceDialog. createWorkspaceBrowseRow): label.setText(IDEWorkbenchMessages .getString("ChooseWorkspaceDialog.workspaceEntryLabel")); //$NON-NLS-1$ 3) Finally, there are many lines (~80%) marked in the messages.properties file. I would expect that to indicate unused strings. However, when I do my own search I see that the strings are used. There were no related errors in my .log file.

Files changed in fix:
org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/search/NLSSearchPage.java org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/search/NLSSearchResultCollector2.java