How to listen to [Rename] ?


The only way I can think of is to capture the Rename action, and examine
the element at the caret position.
Is there a simpler way (listener)?

Alain

8 comments

From PerfDirect:

final VirtualFileManager vfMgr = VirtualFileManager.getInstance();
vfMgr.addVirtualFileListener(new VirtualFileAdapter()
{
public void beforePropertyChange(final VirtualFilePropertyEvent event)
{
if (event.getPropertyName().equalsIgnoreCase("name")) {



r.


Alain Ravet wrote:


The only way I can think of is to capture the Rename action, and examine
the element at the caret position.
Is there a simpler way (listener)?

Alain

0

Richard Nemec wrote:

vfMgr.addVirtualFileListener(new VirtualFileAdapter() {
public void beforePropertyChange(final VirtualFilePropertyEvent
event) {
if (event.getPropertyName().equalsIgnoreCase("name")) {




It looks like it's listening for a file rename.
What I need is to capture /rename/ on java elements (variable,
reference, ..)

Alain

0

Alain Ravet wrote:

It looks like it's listening for a file rename.
What I need is to capture /rename/ on java elements (variable,
reference, ..)


That I don't know. Sorry.
r.

0

Alain Ravet wrote:


The only way I can think of is to capture the Rename action, and examine
the element at the caret position.
Is there a simpler way (listener)?

Alain


com.intellij.refactoring.listeners.*
This will work only if changes are made throuigh refactoring though.

Friendly,
Dmitry
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Dmitry ,

>com.intellij.refactoring.listeners.*
>


Thanks.
Sorry for asking basic questions like these, but IDEA doesn't help us
finding the proper info in such cases.
This is a killer usability problem/weakness.
I filed 2 bugs and 1 request to help it, but I didn't get much success :(
I wonder why? I seriously find they should all 3 be set to "high
priority, planned for Aurora"

BUGS
- (!! not assigned)
with very long list : the more symbol ("...") is inactive
http://www.intellij.net/tracker/idea/viewSCR?publicId=14096

- (!! not planned for Aurora)
Ctrl-n : no indication that the list can scroll (see ..)
http://www.intellij.net/tracker/idea/viewSCR?publicId=18723

FEATURE
- (to be discussed)
Ctrl-N : accept package in pattern.
http://www.intellij.net/tracker/idea/viewSCR?publicId=19948



Alain

0

Actually, it's:

if (event.getPropertyName().equals(VirtualFile.PROP_NAME))

Richard Nemec wrote:

From PerfDirect:

final VirtualFileManager vfMgr = VirtualFileManager.getInstance();
vfMgr.addVirtualFileListener(new VirtualFileAdapter()
{
public void beforePropertyChange(final VirtualFilePropertyEvent event)
{
if (event.getPropertyName().equalsIgnoreCase("name")) {



r.


Alain Ravet wrote:

>>
>>
>> The only way I can think of is to capture the Rename action, and
>> examine the element at the caret position.
>> Is there a simpler way (listener)?
>>
>> Alain
>>

--

Erb

==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================

0

+1000

BTW Alain I added my votes.
I supposed you got tired of waiting and are starting your own plugin... looking forward to using it. The JUnitTestPlugin has an example of listening for renames and moves.

I have also submitted one of my own http://www.intellij.net/tracker/idea/viewSCR?publicId=20998 that most likely you already thought of.

Jacques

0

Please sign in to leave a comment.