Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Add/Remove Edit Parts Based On Selection
Add/Remove Edit Parts Based On Selection [message #220273] Thu, 27 July 2006 17:44 Go to next message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

Hi there,

I'm currently working on something where I have a container (A) that has
a number of children, which in turn have children, etc... Basically I would
like to show additional things on-screen when the user is editing A or any
of its descendants. What's the best way to do this? Currently I can add
the extra stuff by modfiying getModelChildren() on A to return dummy model
components for the additional figures, but is this the best approach? How
else should I go about dynamically adding and removing these figures? On a
related note, is it good practice to have an edit part always add a
particular figure to its figure's children? If so, how does one prevent GEF
from moving this figure around in the children list or removing it on
refreshes? Thanks in advance.

- Daniel
Re: Add/Remove Edit Parts Based On Selection [message #220894 is a reply to message #220273] Mon, 07 August 2006 17:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

Just bumping this in case anyone has some helpful advice. I've implemented
a basic version of this that works, except now I am concerned about adding
and removing edit parts (and their figures) with such great frequency.
Namely, it looks to me like the default behavior for constraints (storing
them in a map) will leave the constraints hanging around for a lot of
figures that will never be recovered. Any tips on how to accomplish this
dynamic edit part enablement would be awesome - thanks.

- Daniel

"Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
news:eaau1l$3rg$1@utils.eclipse.org...
> Hi there,
>
> I'm currently working on something where I have a container (A) that
> has a number of children, which in turn have children, etc... Basically I
> would like to show additional things on-screen when the user is editing A
> or any of its descendants. What's the best way to do this? Currently I
> can add the extra stuff by modfiying getModelChildren() on A to return
> dummy model components for the additional figures, but is this the best
> approach? How else should I go about dynamically adding and removing
> these figures? On a related note, is it good practice to have an edit
> part always add a particular figure to its figure's children? If so, how
> does one prevent GEF from moving this figure around in the children list
> or removing it on refreshes? Thanks in advance.
>
> - Daniel
>
Re: Add/Remove Edit Parts Based On Selection [message #220948 is a reply to message #220894] Tue, 08 August 2006 13:33 Go to previous messageGo to next message
Marcel is currently offline MarcelFriend
Messages: 11
Registered: July 2009
Junior Member
Daniel,

I find adding custom interaction on the canvas a bit of a pain too. I
needed what amounted to a dropdown, and did it by working only in the
figure - essentially what you are presently doing, but only modifying
the figure, not adding model elements. I feel that is legitimate since
the information that is being displayed in my case actually comes from
the figure's existing model. That may not be true for you; but you may
be able to make it true by providing the figure with more information
via the existing model.

If you come up with a better way, please do post it.

Marcel

Daniel Rozeboom wrote:
> Just bumping this in case anyone has some helpful advice. I've implemented
> a basic version of this that works, except now I am concerned about adding
> and removing edit parts (and their figures) with such great frequency.
> Namely, it looks to me like the default behavior for constraints (storing
> them in a map) will leave the constraints hanging around for a lot of
> figures that will never be recovered. Any tips on how to accomplish this
> dynamic edit part enablement would be awesome - thanks.
>
> - Daniel
>
> "Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
> news:eaau1l$3rg$1@utils.eclipse.org...
>> Hi there,
>>
>> I'm currently working on something where I have a container (A) that
>> has a number of children, which in turn have children, etc... Basically I
>> would like to show additional things on-screen when the user is editing A
>> or any of its descendants. What's the best way to do this? Currently I
>> can add the extra stuff by modfiying getModelChildren() on A to return
>> dummy model components for the additional figures, but is this the best
>> approach? How else should I go about dynamically adding and removing
>> these figures? On a related note, is it good practice to have an edit
>> part always add a particular figure to its figure's children? If so, how
>> does one prevent GEF from moving this figure around in the children list
>> or removing it on refreshes? Thanks in advance.
>>
>> - Daniel
>>
>
>
Re: Add/Remove Edit Parts Based On Selection [message #220976 is a reply to message #220948] Tue, 08 August 2006 16:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

Hi Marcel,

Thanks for getting back to me on this. I guess the reason reflecting
the editing state by modifying the figure seems tricky here is that I'm
using a complex layout for the model components in this edit part. What
happens is that when editing is occurring on the edit part or one of its
children, I have to throw in these additional figures/edit parts, but they
share the layout with those sourced from the model. You're not talking
about adding figures directly, but just modifying a pre-existing figure,
right? I tried adding other figures on my own at one point but I think I
read that there should be a 1-to-1 mapping between edit parts and figures,
and I think GEF does weird stuff if you start adding figures yourself. But
I suppose that might be feasible in terms of the layout; perhaps I could
somehow add the figures when editing occurs and update the layout (which
shouldn't care about the model or the edit parts). I'm not sure that would
afford me many advantages over what I'm doing now though, unless it's a much
better GEF practice. Let me know if you have any comments or further
suggestions - thanks a lot.

- Daniel

P.S.: Do you know how the EditPart#activate() and EditPart#deactivate()
methods fit into this scenario?

"Marcel" <emmpeegee@gmail.com> wrote in message
news:eba3rb$kqj$1@utils.eclipse.org...
> Daniel,
>
> I find adding custom interaction on the canvas a bit of a pain too. I
> needed what amounted to a dropdown, and did it by working only in the
> figure - essentially what you are presently doing, but only modifying the
> figure, not adding model elements. I feel that is legitimate since the
> information that is being displayed in my case actually comes from the
> figure's existing model. That may not be true for you; but you may be able
> to make it true by providing the figure with more information via the
> existing model.
>
> If you come up with a better way, please do post it.
>
> Marcel
>
> Daniel Rozeboom wrote:
>> Just bumping this in case anyone has some helpful advice. I've
>> implemented a basic version of this that works, except now I am concerned
>> about adding and removing edit parts (and their figures) with such great
>> frequency. Namely, it looks to me like the default behavior for
>> constraints (storing them in a map) will leave the constraints hanging
>> around for a lot of figures that will never be recovered. Any tips on
>> how to accomplish this dynamic edit part enablement would be awesome -
>> thanks.
>>
>> - Daniel
>>
>> "Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
>> news:eaau1l$3rg$1@utils.eclipse.org...
>>> Hi there,
>>>
>>> I'm currently working on something where I have a container (A) that
>>> has a number of children, which in turn have children, etc... Basically
>>> I would like to show additional things on-screen when the user is
>>> editing A or any of its descendants. What's the best way to do this?
>>> Currently I can add the extra stuff by modfiying getModelChildren() on A
>>> to return dummy model components for the additional figures, but is this
>>> the best approach? How else should I go about dynamically adding and
>>> removing these figures? On a related note, is it good practice to have
>>> an edit part always add a particular figure to its figure's children?
>>> If so, how does one prevent GEF from moving this figure around in the
>>> children list or removing it on refreshes? Thanks in advance.
>>>
>>> - Daniel
>>>
>>
Re: Add/Remove Edit Parts Based On Selection [message #221049 is a reply to message #220976] Wed, 09 August 2006 06:21 Go to previous messageGo to next message
Marcel is currently offline MarcelFriend
Messages: 11
Registered: July 2009
Junior Member
Daniel,

Re activate and deactivate, my understanding is that they are pretty
close to constructors and destructors for the part, so they don't help
too much with this.

I was indeed talking about modifying a pre-existing figure, in fact the
one that is selected. I have a figure which includes an empty
sub-figure, and when the selection occurs I fill the empty sub-figure
with the information that I need to display, and hide it again
afterwards. If you can allow space in the figure for the insertion in
advance, that may work; but of course depending on the complexity of the
layout that may not be possible.

As for best practice, I'm fairly new to this as well, so I'm no
authority. To me though, modifying the figure on selection seems to be a
valid practice - it is after all only the view, and what I am doing is
akin to adding selection handles, just feedback. Which gives me an idea
- you might like to investigate the possibility of using a custom edit
policy of some sort. I'm short on details, you'll have to investigate.

Marcel

Daniel Rozeboom wrote:
> Hi Marcel,
>
> Thanks for getting back to me on this. I guess the reason reflecting
> the editing state by modifying the figure seems tricky here is that I'm
> using a complex layout for the model components in this edit part. What
> happens is that when editing is occurring on the edit part or one of its
> children, I have to throw in these additional figures/edit parts, but they
> share the layout with those sourced from the model. You're not talking
> about adding figures directly, but just modifying a pre-existing figure,
> right? I tried adding other figures on my own at one point but I think I
> read that there should be a 1-to-1 mapping between edit parts and figures,
> and I think GEF does weird stuff if you start adding figures yourself. But
> I suppose that might be feasible in terms of the layout; perhaps I could
> somehow add the figures when editing occurs and update the layout (which
> shouldn't care about the model or the edit parts). I'm not sure that would
> afford me many advantages over what I'm doing now though, unless it's a much
> better GEF practice. Let me know if you have any comments or further
> suggestions - thanks a lot.
>
> - Daniel
>
> P.S.: Do you know how the EditPart#activate() and EditPart#deactivate()
> methods fit into this scenario?
>
> "Marcel" <emmpeegee@gmail.com> wrote in message
> news:eba3rb$kqj$1@utils.eclipse.org...
>> Daniel,
>>
>> I find adding custom interaction on the canvas a bit of a pain too. I
>> needed what amounted to a dropdown, and did it by working only in the
>> figure - essentially what you are presently doing, but only modifying the
>> figure, not adding model elements. I feel that is legitimate since the
>> information that is being displayed in my case actually comes from the
>> figure's existing model. That may not be true for you; but you may be able
>> to make it true by providing the figure with more information via the
>> existing model.
>>
>> If you come up with a better way, please do post it.
>>
>> Marcel
>>
>> Daniel Rozeboom wrote:
>>> Just bumping this in case anyone has some helpful advice. I've
>>> implemented a basic version of this that works, except now I am concerned
>>> about adding and removing edit parts (and their figures) with such great
>>> frequency. Namely, it looks to me like the default behavior for
>>> constraints (storing them in a map) will leave the constraints hanging
>>> around for a lot of figures that will never be recovered. Any tips on
>>> how to accomplish this dynamic edit part enablement would be awesome -
>>> thanks.
>>>
>>> - Daniel
>>>
>>> "Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
>>> news:eaau1l$3rg$1@utils.eclipse.org...
>>>> Hi there,
>>>>
>>>> I'm currently working on something where I have a container (A) that
>>>> has a number of children, which in turn have children, etc... Basically
>>>> I would like to show additional things on-screen when the user is
>>>> editing A or any of its descendants. What's the best way to do this?
>>>> Currently I can add the extra stuff by modfiying getModelChildren() on A
>>>> to return dummy model components for the additional figures, but is this
>>>> the best approach? How else should I go about dynamically adding and
>>>> removing these figures? On a related note, is it good practice to have
>>>> an edit part always add a particular figure to its figure's children?
>>>> If so, how does one prevent GEF from moving this figure around in the
>>>> children list or removing it on refreshes? Thanks in advance.
>>>>
>>>> - Daniel
>>>>
>
Re: Add/Remove Edit Parts Based On Selection [message #221113 is a reply to message #221049] Wed, 09 August 2006 17:17 Go to previous message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

Hi Marcel,

Yeah, after looking into activate and deactivate I agree with your
analysis; there doesn't seem to be any functionality there that matches
these needs.

In my case, the "extra stuff" actually takes up some space that is
occupied by the original contents when editing is in progress, so I can't
allocate that space ahead of time for extra gobbledy-goop. If in the future
things change and I can move the "extra stuff" to the outside, I could see
how that method might work. But right now I think it's too complicated with
the layout and having to create/hide/rearrange all of those additional
figures.

I'll look around and see what might be possible with the custom edit
policy; I'll let you know if anything seems promising. Thanks again for
your help.

- Daniel

"Marcel" <emmpeegee@gmail.com> wrote in message
news:ebbutn$6ng$1@utils.eclipse.org...
> Daniel,
>
> Re activate and deactivate, my understanding is that they are pretty close
> to constructors and destructors for the part, so they don't help too much
> with this.
>
> I was indeed talking about modifying a pre-existing figure, in fact the
> one that is selected. I have a figure which includes an empty sub-figure,
> and when the selection occurs I fill the empty sub-figure with the
> information that I need to display, and hide it again afterwards. If you
> can allow space in the figure for the insertion in advance, that may work;
> but of course depending on the complexity of the layout that may not be
> possible.
>
> As for best practice, I'm fairly new to this as well, so I'm no authority.
> To me though, modifying the figure on selection seems to be a valid
> practice - it is after all only the view, and what I am doing is akin to
> adding selection handles, just feedback. Which gives me an idea - you
> might like to investigate the possibility of using a custom edit policy of
> some sort. I'm short on details, you'll have to investigate.
>
> Marcel
>
> Daniel Rozeboom wrote:
>> Hi Marcel,
>>
>> Thanks for getting back to me on this. I guess the reason reflecting
>> the editing state by modifying the figure seems tricky here is that I'm
>> using a complex layout for the model components in this edit part. What
>> happens is that when editing is occurring on the edit part or one of its
>> children, I have to throw in these additional figures/edit parts, but
>> they share the layout with those sourced from the model. You're not
>> talking about adding figures directly, but just modifying a pre-existing
>> figure, right? I tried adding other figures on my own at one point but I
>> think I read that there should be a 1-to-1 mapping between edit parts and
>> figures, and I think GEF does weird stuff if you start adding figures
>> yourself. But I suppose that might be feasible in terms of the layout;
>> perhaps I could somehow add the figures when editing occurs and update
>> the layout (which shouldn't care about the model or the edit parts). I'm
>> not sure that would afford me many advantages over what I'm doing now
>> though, unless it's a much better GEF practice. Let me know if you have
>> any comments or further suggestions - thanks a lot.
>>
>> - Daniel
>>
>> P.S.: Do you know how the EditPart#activate() and EditPart#deactivate()
>> methods fit into this scenario?
>>
>> "Marcel" <emmpeegee@gmail.com> wrote in message
>> news:eba3rb$kqj$1@utils.eclipse.org...
>>> Daniel,
>>>
>>> I find adding custom interaction on the canvas a bit of a pain too. I
>>> needed what amounted to a dropdown, and did it by working only in the
>>> figure - essentially what you are presently doing, but only modifying
>>> the figure, not adding model elements. I feel that is legitimate since
>>> the information that is being displayed in my case actually comes from
>>> the figure's existing model. That may not be true for you; but you may
>>> be able to make it true by providing the figure with more information
>>> via the existing model.
>>>
>>> If you come up with a better way, please do post it.
>>>
>>> Marcel
>>>
>>> Daniel Rozeboom wrote:
>>>> Just bumping this in case anyone has some helpful advice. I've
>>>> implemented a basic version of this that works, except now I am
>>>> concerned about adding and removing edit parts (and their figures) with
>>>> such great frequency. Namely, it looks to me like the default behavior
>>>> for constraints (storing them in a map) will leave the constraints
>>>> hanging around for a lot of figures that will never be recovered. Any
>>>> tips on how to accomplish this dynamic edit part enablement would be
>>>> awesome - thanks.
>>>>
>>>> - Daniel
>>>>
>>>> "Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
>>>> news:eaau1l$3rg$1@utils.eclipse.org...
>>>>> Hi there,
>>>>>
>>>>> I'm currently working on something where I have a container (A)
>>>>> that has a number of children, which in turn have children, etc...
>>>>> Basically I would like to show additional things on-screen when the
>>>>> user is editing A or any of its descendants. What's the best way to
>>>>> do this? Currently I can add the extra stuff by modfiying
>>>>> getModelChildren() on A to return dummy model components for the
>>>>> additional figures, but is this the best approach? How else should I
>>>>> go about dynamically adding and removing these figures? On a related
>>>>> note, is it good practice to have an edit part always add a particular
>>>>> figure to its figure's children? If so, how does one prevent GEF from
>>>>> moving this figure around in the children list or removing it on
>>>>> refreshes? Thanks in advance.
>>>>>
>>>>> - Daniel
>>>>>
>>
Previous Topic:Making certain figures shown in the same location
Next Topic:DND Source on PaletteViewer
Goto Forum:
  


Current Time: Thu Mar 28 20:08:32 GMT 2024

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

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

Back to the top