VirtualFileListener and file renames

Hiya - using a VirtualFileListener based class, how does one handle file
renames? I had thought fileMoved() might have been the right method, but
that doesn't seem so.

Mark



--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


11 comments
Comment actions Permalink

It would be a property change, with the property name being
VirtualFile.PROP_NAME
(there is also PROP_WRITABLE for read-only state change).

Mark Derricutt wrote:

Hiya - using a VirtualFileListener based class, how does one handle file
renames? I had thought fileMoved() might have been the right method, but
that doesn't seem so.

Mark




--

Erb

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

0
Comment actions Permalink

On Sat, 24 May 2003 16:16:21 -0400, Erb wrote:

It would be a property change, with the property name being
VirtualFile.PROP_NAME
(there is also PROP_WRITABLE for read-only state change).


Excellent ;) the jsvn subversion plugin gains more usefullness ;)

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0
Comment actions Permalink

Erb wrote:

It would be a property change, with the property name being
VirtualFile.PROP_NAME
(there is also PROP_WRITABLE for read-only state change).

Mark Derricutt wrote:

>> Hiya - using a VirtualFileListener based class, how does one handle file
>> renames? I had thought fileMoved() might have been the right method, but
>> that doesn't seem so.
>>
>> Mark

On a related topic, is there way of being notified if a class has been
renamed? I suppose one could infer this from the filename changing but
that would fail if there are multiple top-level classes defined in one
file, or if it's an inner class that's being renamed.

Thanks,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919

0
Comment actions Permalink

On a related topic, is there way of being notified if a class has been
renamed?

Look at com.intellij.refactoring.listeners.RefactoringListenerManager in
idea.jar. rename and move of element only are supported right now but more
are schedule for Aurora (some more vote won't hurt
(http://www.intellij.net/tracker/idea/viewSCR?publicId=3634).

You can look at the Junit plugin if you want an example of how to use them
but it is straight forward enough anyway.

Jacques


0
Comment actions Permalink

On Mon, 26 May 2003 16:16:00 -0400, Gordon Tyler wrote:

On a related topic, is there way of being notified if a class has been
renamed? I suppose one could infer this from the filename changing but
that would fail if there are multiple top-level classes defined in one
file, or if it's an inner class that's being renamed.


I wish I could get away from using the FileListener, but for some reason
when I implement code in the addFile() method of AbstractVcs - it never
gets called. mmmm.

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0
Comment actions Permalink

That's why we had to create the PreforceDIRECT plugin (as opposed
to Perforce plugin). Using AbstractVCS is nice but almost all changes
are deferred to the submit time (add, rename, move,...).
If you want to do anything immediately, you have to ignore AbstractVCS
and do it yourself (with FileListener, ModificationAttemptListener and also
CommandListener is useful).

r.

"Mark Derricutt" <pinhead@satinism.org> wrote in message
news:pan.2003.05.28.10.47.38.51409@satinism.org...

On Mon, 26 May 2003 16:16:00 -0400, Gordon Tyler wrote:

>

On a related topic, is there way of being notified if a class has been
renamed? I suppose one could infer this from the filename changing but
that would fail if there are multiple top-level classes defined in one
file, or if it's an inner class that's being renamed.

>

I wish I could get away from using the FileListener, but for some reason
when I implement code in the addFile() method of AbstractVcs - it never
gets called. mmmm.

>

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate

>


0
Comment actions Permalink

On Wed, 28 May 2003 07:14:07 -0400, Richard Nemec wrote:

That's why we had to create the PreforceDIRECT plugin (as opposed to
Perforce plugin). Using AbstractVCS is nice but almost all changes are
deferred to the submit time (add, rename, move,...). If you want to do
anything immediately, you have to ignore AbstractVCS and do it yourself
(with FileListener, ModificationAttemptListener and also CommandListener
is useful).


I was thinking that - but one thing - how do I know if my VCS plugin is
enabled in the project options - can't seem to see anything that gives me
that info ( I only want to add those listeners if the opened project uses
them.... )

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0
Comment actions Permalink

If it's not in the dropdown list in VCS Support, it has not been correctly implemented.

Mark Derricutt wrote:

On Wed, 28 May 2003 07:14:07 -0400, Richard Nemec wrote:

I was thinking that - but one thing - how do I know if my VCS plugin is
enabled in the project options - can't seem to see anything that gives me
that info ( I only want to add those listeners if the opened project uses
them.... )



--

Erb

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

0
Comment actions Permalink

I believe he meant 'programmatically'.

Perhaps using
VscManager.getActiveVcs()
and check whether it is yours.

r.

"Erb" <dont@evenbother.com> wrote in message
news:bb2fld$lqa$1@is.intellij.net...

If it's not in the dropdown list in VCS Support, it has not been correctly

implemented.
>

Mark Derricutt wrote:

>

On Wed, 28 May 2003 07:14:07 -0400, Richard Nemec wrote:

>
>

>

I was thinking that - but one thing - how do I know if my VCS plugin is
enabled in the project options - can't seem to see anything that gives

me

that info ( I only want to add those listeners if the opened project

uses

them.... )

>

>
>

--

>

Erb

>

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

>


0
Comment actions Permalink

On Wed, 28 May 2003 10:04:28 -0400, Erb wrote:

If it's not in the dropdown list in VCS Support, it has not been correctly
implemented.


It is in the drop down list - but how, pragmatically, can I enable/disable
things -if- its selected, or not.

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0
Comment actions Permalink

On Wed, 28 May 2003 14:31:41 -0400, Richard Nemec wrote:

I believe he meant 'programmatically'.

Perhaps using
VscManager.getActiveVcs()
and check whether it is yours.


Aha! That sounds like that I want ;) Thankies :)

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0

Please sign in to leave a comment.