It's all about the answers!

Ask a question

Getting from a IResource in Eclipse to an IVersionableHandle


Peter Moogk (611) | asked Jan 17 '11, 4:25 p.m.
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

2 answers



permanent link
Michael Valenta (3.7k3) | answered Jan 18 '11, 9:46 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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.

permanent link
Peter Moogk (611) | answered Jan 18 '11, 11:11 a.m.
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.

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.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.