It's all about the answers!

Ask a question

[Java] Get the full path of a file at change set

Fatla 777 (263712) | asked Feb 20 '13, 12:22 p.m.
edited Feb 21 '13, 3:30 p.m.
I am searching for a NEW CREATED ,not edited yet, .txt file that is located at change set WITHIN a specific work item.
Then I need to create locally over my pc  the full path directory of this file.

For example if there a file called"test.txt" that it's located at:

Till now I have managed to search for this file.
Now I need to fetch the full directory and create similar one over my pc:
Result at my pc:

That's what I did to search for the file within a changeset:

    public IFileItem getTextFileFile(IChangeSet changeSet, ITeamRepository repository) throws TeamRepositoryException{
        IVersionableManager vm = SCMPlatform.getWorkspaceManager(repository).versionableManager();
        List changes = changeSet.changes();
        IFileItem toReturn = null;
        for(int i=0;i<changes.size();i++) {
            Change change = (Change) changes.get(i);
            IVersionableHandle after = change.afterState();
            if( after != null && after instanceof IFileItemHandle) {
                IFileItem fileItem = (IFileItem) vm.fetchCompleteState(after, null);
                if(fileItem.getName().contains(".txt")) {
                       toReturn = fileItem;
                } else {
        if(toReturn == null){
            throw new TeamRepositoryException("Could not find the file");
        return toReturn;

Thanks in advance.

One answer

permanent link
Tim Mok (6.6k38) | answered Feb 20 '13, 3:47 p.m.
This has already been answered in other questions. I've posted a reply to your followup in one of the other questions. If you have any questions about those answers, please clarify because you haven't provided here what went wrong with your attempts given those answers.

Fatla 777 commented Feb 20 '13, 5:46 p.m.

Thanks Tim.
I have updated the other question as well.
Sorry for inconvenience.

Your answer

Register or to post your answer.