Hi there,
During my work on synchronizing src and design tabs for Flow I’ve
found a little inconsistency in o.e.bpel.ui.editparts.ActivityEditPart.addAllAdapters():
protected void addAllAdapters() {
super.addAllAdapters();
Sources sources = getActivity().getSources();
if (sources != null) {
adapter.addToObject(sources);
for (Iterator it = sources.getChildren().iterator(); it.hasNext(); )
{
Source source = (Source)it.next();
// also include the link, if there is one (since we indirectly
// control the activation of the LinkEditPart)
if (source.getLink()
!= null) adapter.addToObject(source.getLink());
// Okay--the real problem here, is that the Activity might be
// referred to by a Source object, but the Activity is not going
// to find out about the creation of a new Sources that
references
// it. Therefore, our model listeners don't know what to do!
// TODO: temporarily hacked around in
FlowEditPart.FlowContentAdapter.
// TODO: also include any parent flows, and
the Links object of
// any parent flows that have one. !
// TODO: in future, use a global listener to
handle refreshing the
// correct source editpart.
}
}
Targets targets = getActivity().getTargets();
if (targets != null) {
adapter.addToObject(targets);
for (Iterator it = targets.getChildren().iterator(); it.hasNext(); )
{
adapter.addToObject((Target)it.next());
}
}
}
Please
note that if you remove all the comments then the method will look this way:
protected void addAllAdapters() {
super.addAllAdapters();
Sources sources = getActivity().getSources();
if (sources != null) {
adapter.addToObject(sources);
for (Iterator it = sources.getChildren().iterator(); it.hasNext(); )
{
Source source = (Source)it.next();
if (source.getLink()
!= null) adapter.addToObject(source.getLink());
}
}
Targets targets = getActivity().getTargets();
if (targets != null) {
adapter.addToObject(targets);
for (Iterator it = targets.getChildren().iterator(); it.hasNext(); )
{
adapter.addToObject((Target)it.next());
}
}
}
This inconsistent behavior leads to different sets of
eAdapters created for SourceImpl and TargetImpl (try to set breakpoints at the
end of SourceImpl.setActivity() and TargetImpl.setActivity() to ensure that.
The different sets of eAdapters is an obstacle for
restoring links in the design tab when editing the source tab.
The question:
is there any reason not to make the ‘sources’
part of the method be similar to the ‘target’ part, i.e. the method
will look this way:
protected void addAllAdapters() {
super.addAllAdapters();
Sources sources = getActivity().getSources();
if (sources != null) {
adapter.addToObject(sources);
for (Iterator it = sources.getChildren().iterator(); it.hasNext(); )
{
adapter.addToObject((Source)it.next());
}
}
Targets targets = getActivity().getTargets();
if (targets != null) {
adapter.addToObject(targets);
for (Iterator it = targets.getChildren().iterator(); it.hasNext(); )
{
adapter.addToObject((Target)it.next());
}
}
}
If it’s OK to rewrite the ‘source’
part of the method then I’ll file a bug and submit a patch.
Thanks,
Vitaly.