It's all about the answers!

Ask a question

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


0
1
Jingwen Ou (5610) | asked Sep 29 '08, 1:33 a.m.
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?

7 answers



permanent link
John Camelon (1.7k14) | answered Sep 29 '08, 9:19 a.m.
JAZZ DEVELOPER
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

permanent link
Jingwen Ou (5610) | answered Sep 29 '08, 3:25 p.m.
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

permanent link
John Camelon (1.7k14) | answered Sep 29 '08, 4:28 p.m.
JAZZ DEVELOPER
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


permanent link
Jingwen Ou (5610) | answered Sep 29 '08, 8:37 p.m.
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


permanent link
Dmitry Karasik (1.8k11) | answered Sep 30 '08, 5:18 a.m.
JAZZ DEVELOPER
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

permanent link
Dmitry Karasik (1.8k11) | answered Sep 30 '08, 1:15 p.m.
JAZZ DEVELOPER
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

permanent link
Jingwen Ou (5610) | answered Sep 30 '08, 2:37 p.m.
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

Your answer


Register or to post your answer.