Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » replacing editpart figure
replacing editpart figure [message #199237] Fri, 14 October 2005 12:50 Go to next message
Eclipse UserFriend
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 #199253 is a reply to message #199237] Fri, 14 October 2005 14:02 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I was able to achieve basically the same by not changing the main figure,
but only its children. The main figure had no graphical representation, and
in refreshVisuals() I would first remove all children and then add new ones.

"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 #199318 is a reply to message #199237] Fri, 14 October 2005 14:39 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>>
>>
Previous Topic:thanx for GEF and Draw2d Developer's Guide in 3.1.1 doc
Next Topic:who can i catch an addRequest on a Connection?
Goto Forum:
  


Current Time: Sat Dec 07 18:55:00 GMT 2024

Powered by FUDForum. Page generated in 0.04506 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top