Use VCS API to check out a file


I would like to check out a file that's in the current project if it has not be checkout already. How can I use the VCS api to do that?

Thanks,

-Wei

2 comments

Hello Wei,

WY> I would like to check out a file that's in the current project if it
WY> has not be checkout already. How can I use the VCS api to do that?

VirtualFile fileToCheckOut;
AbstractVcs vcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(fileToCheckOut);
if (vcs == null) return;
EditFileProvider provider = vcs.getEditFileProvider();
if (provider == null) return;
provider.editFiles(new VirtualFile[] );

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Hi,

I am doing this and when I want to write to the file it is writable false...

What could be the reason for this (I use Iltellij 5 API)

Thanks.

0

Please sign in to leave a comment.