Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to checkout files from source control programmatically
How to checkout files from source control programmatically [message #480039] Thu, 13 August 2009 14:40 Go to next message
Yigal Spinner is currently offline Yigal SpinnerFriend
Messages: 127
Registered: July 2009
Senior Member
I'm new to PDE development.
Assuming the target current project is checked in into one of the
supported source control.
I want to write a plugin with an action to modify one of the files.
How can I programmatically find if the target file (i.e. IFile selected in
the action right click) is under source control and checked in?
How can I force a checkout so I can modify the file in the action code?

Thanks
Yigal
Re: How to checkout files from source control programmatically [message #480396 is a reply to message #480039] Sun, 16 August 2009 18:17 Go to previous message
Yigal Spinner is currently offline Yigal SpinnerFriend
Messages: 127
Registered: July 2009
Senior Member
I looked at the EMF generation code and found the solution:

IFile file = <get the IFile of target resource>;
if (file.exists()) {
IStatus status = file.getWorkspace().validateEdit(new IFile [] {
file}, IWorkspace.VALIDATE_PROMPT)
if (status.isOK()) {
// The file can be overwritten, it will be checked out or made
read/write
}
}

Simple!

Yigal Spinner wrote:
> I'm new to PDE development.
> Assuming the target current project is checked in into one of the
> supported source control.
> I want to write a plugin with an action to modify one of the files.
> How can I programmatically find if the target file (i.e. IFile selected
> in the action right click) is under source control and checked in?
> How can I force a checkout so I can modify the file in the action code?
>
> Thanks
> Yigal
>
Re: How to checkout files from source control programmatically [message #600713 is a reply to message #480039] Sun, 16 August 2009 18:17 Go to previous message
Yigal Spinner is currently offline Yigal SpinnerFriend
Messages: 127
Registered: July 2009
Senior Member
I looked at the EMF generation code and found the solution:

IFile file = <get the IFile of target resource>;
if (file.exists()) {
IStatus status = file.getWorkspace().validateEdit(new IFile [] {
file}, IWorkspace.VALIDATE_PROMPT)
if (status.isOK()) {
// The file can be overwritten, it will be checked out or made
read/write
}
}

Simple!

Yigal Spinner wrote:
> I'm new to PDE development.
> Assuming the target current project is checked in into one of the
> supported source control.
> I want to write a plugin with an action to modify one of the files.
> How can I programmatically find if the target file (i.e. IFile selected
> in the action right click) is under source control and checked in?
> How can I force a checkout so I can modify the file in the action code?
>
> Thanks
> Yigal
>
Previous Topic:Set Selection of the Package Explorer
Next Topic:Categories in the site.xml are not visible in the update dialog
Goto Forum:
  


Current Time: Thu Apr 25 09:50:02 GMT 2024

Powered by FUDForum. Page generated in 0.02497 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top