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

Is the IVersionableHandle return by IChange.item() constant?

Des IChange.item() means the same IVersionableHandle as the corresponding IShareable.getRemote()?

My understanding is IChange.item() is a constant IVersionalbleHandle that identifies the corresponding IShareable in the local workspace. But not for IChange.afterState() and IChange.beforeState(). So we can always find the local IShareable using IShareableManager.findShareable(IChange.item()). Correct?

1

0 votes



7 answers

Permanent link
jingweno wrote:
Des IShareable.getRemote() means the same IVersionableHandle as
IChange.item()?

My understanding is IChange.item() is a constant IVersionalbleHandle
that identifies the corresponding IShareable in the local workspace.
But not for IChange.afterState() and IChange.beforeState(). So we can
always find the local IShareable using
IShareableManager.findShareable(IChange.item()). Correct?


IChange.item() identifies the item for which the change describes.
IChange.beforeState() and IChange.afterState() can both be null, so
IChange.item() identifies the versionable item in all cases.

JohnC
SCM Server

0 votes


Permanent link
But can you always get a local copy (IShareable) by using IShareableManager.findShareable(IChange.item())? Or it depends on what version you have on your local workspace. Will the IVersionables returned by IChange.item() be the same if two changes are made to the same file? If not, how could I get the IShareable (still exists in current workspace) when I only have the IChange that is 3 months old (not the latest change) on hand?

jingweno wrote:
Des IShareable.getRemote() means the same IVersionableHandle as
IChange.item()?

My understanding is IChange.item() is a constant IVersionalbleHandle
that identifies the corresponding IShareable in the local workspace.
But not for IChange.afterState() and IChange.beforeState(). So we can
always find the local IShareable using
IShareableManager.findShareable(IChange.item()). Correct?


IChange.item() identifies the item for which the change describes.
IChange.beforeState() and IChange.afterState() can both be null, so
IChange.item() identifies the versionable item in all cases.

JohnC
SCM Server

0 votes


Permanent link
You may get a sharable, but not necessarily the same state, as the
configuration may have moved on. What exactly are you trying to build?

JohnC

jingweno wrote:
But can you always get a local copy (IShareable) by using
IShareableManager.findShareable(IChange.item())? Or it depends on
what version you have on your local workspace. Will the IVersionables
returned by IChange.item() be the same if two changes are made to the
same file?

John Camelonwrote:
jingweno wrote:
Des IShareable.getRemote() means the same IVersionableHandle as
IChange.item()?

My understanding is IChange.item() is a constant
IVersionalbleHandle
that identifies the corresponding IShareable in the local
workspace.
But not for IChange.afterState() and IChange.beforeState(). So we
can
always find the local IShareable using
IShareableManager.findShareable(IChange.item()). Correct?


IChange.item() identifies the item for which the change describes.
IChange.beforeState() and IChange.afterState() can both be null, so
IChange.item() identifies the versionable item in all cases.

JohnC
SCM Server

0 votes


Permanent link
I try to get all the changed methods (IMethod) in a specific IChangeSet (using diff). Getting the IShareable enables me to get the IType and use the IType.getMethod(String name, String[] parameterTypeSignatures). I am not sure whether this is the best way, but the only way I can come up with.


You may get a sharable, but not necessarily the same state, as the
configuration may have moved on. What exactly are you trying to build?

JohnC

jingweno wrote:
But can you always get a local copy (IShareable) by using
IShareableManager.findShareable(IChange.item())? Or it depends on
what version you have on your local workspace. Will the IVersionables
returned by IChange.item() be the same if two changes are made to the
same file?

John Camelonwrote:
jingweno wrote:
Des IShareable.getRemote() means the same IVersionableHandle as
IChange.item()?

My understanding is IChange.item() is a constant
IVersionalbleHandle
that identifies the corresponding IShareable in the local
workspace.
But not for IChange.afterState() and IChange.beforeState(). So we
can
always find the local IShareable using
IShareableManager.findShareable(IChange.item()). Correct?


IChange.item() identifies the item for which the change describes.
IChange.beforeState() and IChange.afterState() can both be null, so
IChange.item() identifies the versionable item in all cases.

JohnC
SCM Server

0 votes


Permanent link
I try to get all the changed methods (IMethod) in a specific IChangeSet
(using diff). Getting the IShareable enables me to get the
IType and use the IType.getMethod(String name, String[]
parameterTypeSignatures). I am not sure whether this is the best way,
but this is the only way I can come up with.

This will give you methods that are in the file on disk (assuming the
file even exists on disk) not the ones that are in the version that you
are looking at in the changeset.

To do this right you call ASTParser.newParser(), then ASParser.createAST
().

- Dmitry

0 votes


Permanent link
yes, i did it this way for the diff. But the diff only gets back the
method name. I need a IMethod object (its ok that it doesn't exist in
the workspace) to get the its ID, e.g.
IJavaElement.getHandleIdentifier(). Any better solution?

You could create something like RemoteFileEditorInput and do the
following:

ICompilationUnitDocumentProvider provider =
(ICompilationUnitDocumentProvider)JavaUI.getDocumentProvider();
provider.connect(input);
ICompilationUnit cu = (ICompilationUnit)provider.getWorkingCopy(input);

- Dmitry

0 votes


Permanent link
yes, i did it this way for the diff. But the diff only gets back the method name. I need a IMethod object (its ok that it doesn't exist in the workspace) to get the its ID, e.g. IJavaElement.getHandleIdentifier(). Any better solution?

I try to get all the changed methods (IMethod) in a specific IChangeSet
(using diff). Getting the IShareable enables me to get the
IType and use the IType.getMethod(String name, String[]
parameterTypeSignatures). I am not sure whether this is the best way,
but this is the only way I can come up with.

This will give you methods that are in the file on disk (assuming the
file even exists on disk) not the ones that are in the version that you
are looking at in the changeset.

To do this right you call ASTParser.newParser(), then ASParser.createAST
().

- Dmitry

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,938

Question asked: Sep 29 '08, 1:33 a.m.

Question was seen: 7,898 times

Last updated: Sep 29 '08, 1:33 a.m.

Confirmation Cancel Confirm