It's all about the answers!

Ask a question

Extract Change Set's files informations (path,name,new files, etc) in RTC 3.0


Andrea Vencato (15123) | asked Mar 13 '13, 11:01 a.m.
edited Mar 14 '13, 7:24 a.m.
Hi,

I've developed an eclipse plugin that creates an action in the "Pending Changes" view that analyses my selected outgoing change sets gathering informations about modified files and modified time.
I've been able only to get these simple informations, but now I need some more, specially if a file is new or only modified.

I retrieve informations from the LocalWorkspaceChangesView class cycling on the viewer selection.

My outgoing changes come out switching my workspace target from default Stream to another one.

I looked for many examples but none fits my needs.
Ask me if you need more informations,

Thanks

Comments
Ralph Schoon commented Mar 14 '13, 7:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi Andrea, I am not sure if this is a question or an offer to provide help. In the latter case, a good way to help would be to blog your examples.


Andrea Vencato commented Mar 14 '13, 10:28 a.m.

Mine is a question,
i couldn't write code because I'm still working on it but I'm thinking about change approach to my problem.

I'll soon write about what I'm saying


Jürgen Kienoller commented Aug 09 '13, 4:12 a.m.

Hey, thanks for your help so far.

But i have two questions.

Where did you implement this code? And what is IRemoteActivity, IRemoteChangeSummary etc? It's marked as ...cannot be resolved to a type.

An answer would be nice. Thx


Andrea Vencato commented Oct 08 '13, 3:51 a.m.

I added a command to the context menu on Pending change view as i wrote in my first post.

You can easily use IRemoteActivity and IRemoteChangeSummary setting RTC 3.0 SDK as target platform for your eclipse

2 answers



permanent link
Andrea Vencato (15123) | answered Mar 14 '13, 12:16 p.m.
edited Mar 14 '13, 1:35 p.m.

Here's my case:

I have 2 Streams (A and B) and a workspace (W) that targets on Stram A.
Once a week i accept all pending changes on W and switch flow target from A to B.
All accepted changesets now become outgoing changeSets and that's ok.

With this situation, i need to analyze all chageSets gathering information about which workItem are associated to each changeSet, when it has been delivered and for each file in a changeset, i need to know name, path and if it's new or only modified.

My first approach was to manualy select all outgoing changeSets in the treeViewer displayed in Pending change view and cycle on it.
Now i know that this is not a good solution, but at that moment was the shorter and faster way.

Here the code:

private void retrieveChangeSets() {
    changeSetList.clear();
    ISelection selection = viewer.getSelection();
    if (selection instanceof IStructuredSelection) {
        findChangeSet(((IStructuredSelection) selection).toList());
    }
}
@SuppressWarnings("unchecked")
private void findChangeSet(List<Object> list) {
    for (Object o : list) {
        if (o instanceof IRemoteActivity)
            addChangeSet((IRemoteActivity) o);
        if (o instanceof IRemoteChangeSummary)
            addChangeSet(((IRemoteChangeSummary) o).getActivity());
        if (o instanceof IFileSystemWorkItem)
            addChangeSet(((IFileSystemWorkItem) o).getActivity());
        if (o instanceof IActivityFolder)
            addChangeSet(((IActivityFolder) o).getActivity());
        if (o instanceof IActivitySource) {
            findChangeSet(((IActivitySource) o).getActivities());
            findChangeSet(((IActivitySource) o).getBaselines());
        }
        if (o instanceof IMultiComponentSyncContext) {
            viewer.expandToLevel(o, 1);
            IComponentSyncContext[] components = ((IMultiComponentSyncContext) o).getComponentSyncContexts();
            for (IComponentSyncContext c : components) {
                viewer.expandToLevel(c, 1);
                findChangeSet(c.getActivitySources());
            }
        }
        if (o instanceof IComponentSyncContext) {
            viewer.expandToLevel(o, 1);
            findChangeSet(((IComponentSyncContext) o).getActivitySources());
        }
        if (o instanceof IBaselineGroup) {
            viewer.expandToLevel(o, 1);
            IBaselineGroup base = ((IBaselineGroup) o);
            ComponentSyncContext context = ((ComponentSyncContext) base.getActivitySource().getModel());
            while (context.getEventManager().internalIsBusy()) {
                Display.getDefault().readAndDispatch();
            }
            findChangeSet(((IBaselineGroup) o).getActivities());
        }
    }
}
@SuppressWarnings("unchecked")
private void addChangeSet(IRemoteActivity activity) {
    if (activity instanceof ChangeSetNode) {
        ChangeSetNode changeNode = (ChangeSetNode) activity;
        chgSet = new ChangeSetModel();
        changeSetList.add(chgSet);
        for (IFileSystemWorkItem wi : changeNode.getWorkItems()) {
            chgSet.addWorkItem(getWorkItemDetail(wi));
        }
        List<IRemoteChangeSummary> changelist = changeNode.getChanges();
        for (IRemoteChangeSummary changeSummary : changelist) {
            chgSet.addChangeSummary(changeSummary);
        }
    }
}




Reanding around the forum and documentation, now I'm contemplating the chance to convert this manual work with a scheduled procedure but I'm basically not sure if it's doable and where to start.


EDIT1: i dont know how to highlight my java code quote
EDIT2: highlighted

permanent link
Andrea Vencato (15123) | answered Apr 03 '13, 3:27 a.m.
edited Apr 03 '13, 3:28 a.m.
Finally i found out how to know if a resource is being added:


private void addChangeSet(IRemoteActivity activity) {
    if (activity instanceof ChangeSetNode) {
        ChangeSetNode changeNode = (ChangeSetNode) activity;
        chgSet = new ChangeSetModel();
        changeSetList.add(chgSet);
        for (IFileSystemWorkItem wi : changeNode.getWorkItems()) {
            chgSet.addWorkItem(getWorkItemDetail(wi));
        }
        List<iremotechangesummary> changelist = changeNode.getChanges();
        for (IRemoteChangeSummary changeSummary : changelist) {
            IChangeSummary summary = changeSummary.getChangeSummary();
            if (summary.isChangeType(IChangeSummary.ADD))
                System.out.println("new Resource: "+changeSummary.getAfterPath());
            chgSet.addChangeSummary(changeSummary);
        }
    }
}

Your answer


Register or to post your answer.