replacing editpart figure [message #199237] |
Fri, 14 October 2005 12:50 |
Eclipse User |
|
|
|
Originally posted by: christian.sell.netcologne.de
Hello,
in my application I have the requirement of replacing a figure at
runtime. This is caused by a preference change that causes a change to
the representation of certain edit parts that cannot be achieved by
simply setting properties on the current figure.
After much debugging and investigation, I came up with the following
sequence:
deactivateFigure();
unregisterVisuals();
setFigure(createFigure());
activateFigure();
registerVisuals();
Because the above was so non-obvious (e.g., did not know that figures
were "registered"), I wonder if this is the right way to go, or whether
there is a better way that I missed.
thanks,
Christian
|
|
|
|
Re: replacing editpart figure [message #199318 is a reply to message #199237] |
Fri, 14 October 2005 14:39 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
What you are doing should (almost) work for connections that have no
children.
You'll probably also need to call refresh() so that the anchors and any
attributes get set on the new Connection.
"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:dio9j3$4op$1@news.eclipse.org...
> Hello,
>
> in my application I have the requirement of replacing a figure at runtime.
> This is caused by a preference change that causes a change to the
> representation of certain edit parts that cannot be achieved by simply
> setting properties on the current figure.
>
> After much debugging and investigation, I came up with the following
> sequence:
>
> deactivateFigure();
> unregisterVisuals();
> setFigure(createFigure());
> activateFigure();
> registerVisuals();
>
> Because the above was so non-obvious (e.g., did not know that figures were
> "registered"), I wonder if this is the right way to go, or whether there
> is a better way that I missed.
>
> thanks,
> Christian
|
|
|
Re: replacing editpart figure [message #199333 is a reply to message #199318] |
Fri, 14 October 2005 14:44 |
Eclipse User |
|
|
|
Originally posted by: christian.sell.netcologne.de
yes, I have calls to "refreshSourceAnchor(); refreshTargetAnchor();" in
there as well.
However, what about non-connection figures? As I now realize,
deactivateFigure() is specific to connections.
christian
Randy Hudson wrote:
> What you are doing should (almost) work for connections that have no
> children.
> You'll probably also need to call refresh() so that the anchors and any
> attributes get set on the new Connection.
>
> "Christian Sell" <christian.sell@netcologne.de> wrote in message
> news:dio9j3$4op$1@news.eclipse.org...
>
>>Hello,
>>
>>in my application I have the requirement of replacing a figure at runtime.
>>This is caused by a preference change that causes a change to the
>>representation of certain edit parts that cannot be achieved by simply
>>setting properties on the current figure.
>>
>>After much debugging and investigation, I came up with the following
>>sequence:
>>
>> deactivateFigure();
>> unregisterVisuals();
>> setFigure(createFigure());
>> activateFigure();
>> registerVisuals();
>>
>>Because the above was so non-obvious (e.g., did not know that figures were
>>"registered"), I wonder if this is the right way to go, or whether there
>>is a better way that I missed.
>>
>>thanks,
>>Christian
>
>
>
|
|
|
Re: replacing editpart figure [message #199362 is a reply to message #199333] |
Fri, 14 October 2005 15:09 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
For normal GEP's it gets trickier. You need to remove the figure yourself
and preserve the layout constraint.
If you have children, you need to add then to the new contents pane, again
preserving the layout manager and the constraints.
But, the case is rarer since borders and layoutmanagers can already be
changed without changing the figure. Also, you can compose normal figures a
lot easier than wrapping a connection inside a "fake" connection.
"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:diog96$ejf$1@news.eclipse.org...
> yes, I have calls to "refreshSourceAnchor(); refreshTargetAnchor();" in
> there as well.
>
> However, what about non-connection figures? As I now realize,
> deactivateFigure() is specific to connections.
>
> christian
>
> Randy Hudson wrote:
>> What you are doing should (almost) work for connections that have no
>> children.
>> You'll probably also need to call refresh() so that the anchors and any
>> attributes get set on the new Connection.
>>
>> "Christian Sell" <christian.sell@netcologne.de> wrote in message
>> news:dio9j3$4op$1@news.eclipse.org...
>>
>>>Hello,
>>>
>>>in my application I have the requirement of replacing a figure at
>>>runtime. This is caused by a preference change that causes a change to
>>>the representation of certain edit parts that cannot be achieved by
>>>simply setting properties on the current figure.
>>>
>>>After much debugging and investigation, I came up with the following
>>>sequence:
>>>
>>> deactivateFigure();
>>> unregisterVisuals();
>>> setFigure(createFigure());
>>> activateFigure();
>>> registerVisuals();
>>>
>>>Because the above was so non-obvious (e.g., did not know that figures
>>>were "registered"), I wonder if this is the right way to go, or whether
>>>there is a better way that I missed.
>>>
>>>thanks,
>>>Christian
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03576 seconds