This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 209494 - Find Usages doesn't work when looking for a text selection
Summary: Find Usages doesn't work when looking for a text selection
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1.1
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-13 01:57 UTC by steeltoad
Modified: 2012-04-06 08:50 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description steeltoad 2012-03-13 01:57:25 UTC
Product Version = NetBeans IDE 7.1.1 (Build 201203012225)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_02
Runtime = Java HotSpot(TM) 64-Bit Server VM 22.0-b10


In the editor, double click on some text within quotes
right click and select 'Find Usages'

Rather than getting a list of where that text occurs in the project you instead get the error message "Cannot refactor here"
Comment 1 Ralph Ruijs 2012-03-14 13:23:04 UTC
(In reply to comment #0)
> Product Version = NetBeans IDE 7.1.1 (Build 201203012225)
> Operating System = Windows 7 version 6.1 running on amd64
> Java; VM; Vendor = 1.7.0_02
> Runtime = Java HotSpot(TM) 64-Bit Server VM 22.0-b10
> 
> 
> In the editor, double click on some text within quotes
> right click and select 'Find Usages'
> 
> Rather than getting a list of where that text occurs in the project you instead
> get the error message "Cannot refactor here"

I'm sorry but I cannot reproduce, maybe because I do not really understand the report. Find usages works on program elements, like a variable or a method invocation. Searching for text occurrence can be done by using Find, or Find in Projects.

Could you provide steps to reproduce?
Comment 2 Ralph Ruijs 2012-03-14 14:25:54 UTC
Reassigning to php. See email from the reporter below.

To reproduce, double click some text between quotes in a section of php code and right click, then select Find Usages.

I realize that the correct thing to do is to Find or Find in Projects, but ...


- selecting text and then using Find Usages in a section of Javascript code offers the option of continuing the Find Usages, and then proceeds to correctly find the usages of the variable of function that is using the quoted text  (ie  foo('quoted text') finds usages of foo

- there is no context menu to find or find in projects (I know it's under 'Edit') but if text has been selected it would seem that it should be an option when the context menu is rendered

- the error message returned indicates a problem with refactoring when no refactoring was being attempted. Even if the refactoring engine is being used to perform the Find Usages, it would seem that a more accurate/descriptive error message would be useful ("hey doofus, you're trying to find usages for something other than a program element" :)

- if the active selection is surrounded by quotes and can reasonably be determined to be text, then Find Usages could be disabled, Find could be made an context option, or Find Usages could offer to use Find/Find in Project instead in a similar manner to what Find Usages does when the text selection is in JavaScript code (offers find in comments or find usages)

My submission was more about the error message seeming to be of the wrong type for the action requested, and the difference in functionality between performing the same function between javascript code and php
Comment 3 Ondrej Brejla 2012-04-06 08:50:52 UTC
Functionality is not broken -> enhancement.