Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Ambiguous ContainerTreeEditPart Helper

Ok, that helps ... missed the significance of that activate() call.

The *actual* sequence of calls as seen in the debugger is:

treeContainerPolicy = new TreeVisualContainerEditPolicy(getContainerPolicy());
lpHelper = BeanAwtUtilities.getLayoutPolicyFactoryFromLayoutManager (layoutManager,
         EditDomain.getEditDomain(
this )).getLayoutPolicyHelper( null );
treeContainerPolicy .setPolicyHelper(lpHelper);
helper.setContainerPolicy((VisualContainerPolicy) containerPolicy);   // container object is null in the policy
containerPolicy .setContainer(getHost().getModel());

Note the order of the last two lines! 

The TreeVisualContainerEditpolicy.activate() method is called after helper#setContainerPolicy(vcp) -- actually, activate() seems to be the very last step in setting up the JavaBean view.  The container object is being set in the helper only as a distant side effect.

Somehow, though, I need to know when a valid container object has been set in order to complete initialization of my helper.

Any suggested fix or workaround?

Thanks,
Gerald


At 12:14 PM 8/15/2006, you wrote:

Hi,

If I remember correctly, your are doing Swing, and not SWT. So,

ContainerTreeEditPart.createEditPolicies() does (assign container policy to container editpolicy):

treeContainerPolicy = new TreeVisualContainerEditPolicy(getContainerPolicy());

Now in TreeVisualContainerEditpolicy.activate() does (assign the model object to the container policy):

containerPolicy .setContainer(getHost().getModel());

Then in ContainerTreeEditPart.createLayouPolicyHelper() does (assign the layout policy helper to the container editpolicy):

treeContainerPolicy .setPolicyHelper(lpHelper);

Then in TreeVisualContainerEditPolicy.setPolicyHelper() (assigns the container policy to the helper):

helper.setContainerPolicy((VisualContainerPolicy) containerPolicy);


So that is how they all hook up.

Rich
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev

Back to the top