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

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

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

0 votes

Comments

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.

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

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

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

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

0 votes


Permanent link
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);
        }
    }
}

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
× 411
× 149
× 127

Question asked: Mar 13 '13, 11:01 a.m.

Question was seen: 7,168 times

Last updated: Jun 09 '14, 3:10 p.m.

Confirmation Cancel Confirm