Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes



2 answers

Permanent link
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.

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930

Question asked: Jan 17 '11, 4:25 p.m.

Question was seen: 6,197 times

Last updated: Jan 17 '11, 4:25 p.m.

Confirmation Cancel Confirm