Clear Read Only Status (w/Custom VCS)
I am currently finishing up a Custom VCS plugin, and I have come across an annoyance of sorts.
When a user attempts to edit a read-only file, the Clear Read Only Status dialog pops up and allows the user to select the Custom VCS (the plugin provides an EditFileProvider). Once a user selects 'Okay', the dialog does not close. Every time a user presses a key, the Dialog will show that same number of times.
I assume there is something missing in my AbstractVcs and/or EditFileProvider implementations.
Also, I would like to buffer any input the user has provided (ie: pressed keys) so that once the file is checked out, I could apply them at that time. Any ideas?
Thanks in Advance!
Steve
Please sign in to leave a comment.
Hello Steven,
Please make sure that your EditFileProvider actually clears the read-only
attribute of the file. You may need to call VirtualFile.refresh() on the
files passed to your provider to make sure that the IDEA VFS picks up the
changes.
This should be handled by IDEA - I don't think it's possible to do anything
about that in a VCS plugin.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hmm. It does. The only complication I can think of, is I have to run the checkout command in a separate thread (the API uses a GUI interface which if it is run as a part of the dispatch thread, can lock up IDEA). Is there a way to programmatically close the dialog? Any other ideas?
Gotcha. I have a feeling this is probably caused by the same issue as above.
Thanks!
Steve
Hello Steven,
>> Please make sure that your EditFileProvider actually
>> clears the read-only
>> attribute of the file. You may need to call
>> VirtualFile.refresh() on the
>> files passed to your provider to make sure that the
>> IDEA VFS picks up the
>> changes.
You should return from your editFiles() call only after your checkout thread
has completed and you have refreshed the VFS to ensure that IDEA has picked
up the changes.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Okay. Is there anyway that I can programmatically repaint/refresh the Editor? Basically, I can block until the thread completes, but I would like to keep from having screen artifacts.
For example:
public void editFiles(final VirtualFile[] files) throws VcsException {
active = true;
// do something in a separate thread
while (active) {
Thread.yield();
//Repaint Screen
}
}