It's all about the answers!

Ask a question

How to construct an Aspect Editor with an SWT Tree?

Cliff Gardiner (92418) | asked Feb 08, 11:02 a.m.
edited Feb 08, 11:02 a.m.

Hi all,

for RTC 6.0.6 I'd like to build an aspect editor with a tree, broadly similar to Required Attributes For Type and State.  I'm aiming to add more granularity to the precondition All Children Resolved and have it configurable for type and state, like this:

<precondition description="Verifies that a work item that matches the selected type and state can only be saved if all its children are resolved" 
id="com.nbs.workitem.all_children_resolved_type_state" name="All Children Resolved For Type and State">
<condition workItemTypeId="com.nbs.workitem.type.ida" >
<workflow workflowTargetStateId="" />
<condition workItemTypeId="com.nbs.workitem.type.someOrOther">
<workflow workflowTargetStateId="" />
<workflow workflowTargetStateId="" />

I can't see how this can be done via the combobox approach in the extension workshop, not least because comboboxes are not multi-select, and I think Tree/TreeViewer is the way to go.  I see a checkbox where the Attributes are in Required Attributes For Type and State; I think this will be achievable using this approach.

Now this is really stretching my Java knowledge, perhaps past breaking point, so I'd like to know if anyone has done something like this and if they can share some wisdom.  I think I understand the Model well enough, but handling a Tree in the AspectEditor class will be a challenge for which any help will be very welcome.

Thanks -

One answer

permanent link
Ralph Schoon (54.0k13641) | answered Feb 12, 8:32 a.m.

 Cliff, there are good tutorials on the pages. You need to implement label and tree node provider.

The SDK ships the code so you can actually try look into that code. I am not totally sure it is shipped, but worth trying to look for it.

Cliff Gardiner commented Feb 12, 8:51 a.m.

Thanks Ralph, 

I have looked at the examples from but I think I'm making things harder for myself because I only want the checkbox on the leaf node, and none of the examples are close to that.  I've also searched the SDK but have to rely on a decompiler as the source doesn't seem to be available (unless I've missed something), and that seems to be abstracted to be a generalised as possible.  I find it hard to follow.

I'll look into your comment about label and tree node, but I'm sure I won't find this easy!  It's going to be an interesting challenge.

Thanks -

Ralph Schoon commented Feb 12, 9:07 a.m.

If you setup your environment following the Extensions Workshop you have the code and do not need a decompiler. 

Your answer

Register or to post your answer.