Getting from a IResource in Eclipse to an IVersionableHandle
Hi,
I'm trying to write some client side code that determines if a file in the Eclipse workspace has been changed or not. Assume here that the file is in a project that is source controlled by RTC. My starting point is an Eclipse IFile object. I believe I need to make several RTC calls to get to an IVersionableHandle. Given this intention I have a few questions:
1) Once, I have the IVersionableHandle can I indeed discover whether the file has changed relative to its associated workspace.
2) What is the sequence of calls that I need to make to get from the IFile object to the IVersionableHandle object.
3) Is there any JavaDoc for the RTC com.ibm.team.* package code.
4) Is there any RTC scm example code.
Many thanks!
Peter Moogk
I'm trying to write some client side code that determines if a file in the Eclipse workspace has been changed or not. Assume here that the file is in a project that is source controlled by RTC. My starting point is an Eclipse IFile object. I believe I need to make several RTC calls to get to an IVersionableHandle. Given this intention I have a few questions:
1) Once, I have the IVersionableHandle can I indeed discover whether the file has changed relative to its associated workspace.
2) What is the sequence of calls that I need to make to get from the IFile object to the IVersionableHandle object.
3) Is there any JavaDoc for the RTC com.ibm.team.* package code.
4) Is there any RTC scm example code.
Many thanks!
Peter Moogk
2 answers
Peter,
In order to determine whether a file has changed relative to it's workspace, you could use code something like this:
In regards to your question about javadoc, we do not have a separate drop for that but you can get the source code for various RTC builds from the download page for the build on jazz.net.
In order to determine whether a file has changed relative to it's workspace, you could use code something like this:
IFile file = ???;
IShareable shareable = (IShareable)file.getAdapter(IShareable.class);
if (shareable != null) {
ILocalChange change = shareable.getChange(monitor);
if (change != null) {
boolean changed = change.getType() != ILocalChange.NO_CHANGE;
}
}
In regards to your question about javadoc, we do not have a separate drop for that but you can get the source code for various RTC builds from the download page for the build on jazz.net.
Hi Michael,
Thanks so much for your code snippet! I tried it out and it does exactly what I wanted it to do. Thanks!
Peter Moogk
Toronto IBM Lab.
In regards to your question about javadoc, we do not have a separate drop for that but you can get the source code for various RTC builds from the download page for the build on jazz.net.
Thanks so much for your code snippet! I tried it out and it does exactly what I wanted it to do. Thanks!
Peter Moogk
Toronto IBM Lab.
Peter,
In order to determine whether a file has changed relative to it's workspace, you could use code something like this:
IFile file = ???;
IShareable shareable = (IShareable)file.getAdapter(IShareable.class);
if (shareable != null) {
ILocalChange change = shareable.getChange(monitor);
if (change != null) {
boolean changed = change.getType() != ILocalChange.NO_CHANGE;
}
}
In regards to your question about javadoc, we do not have a separate drop for that but you can get the source code for various RTC builds from the download page for the build on jazz.net.