Parent edit part selection [message #113048] |
Wed, 21 January 2004 12:50  |
Eclipse User |
|
|
|
How do I go about selecting the parent of an edit part if a child is
selected. For example, in the logic example, how would I select the
circuit when an element within the circuit is selected (i.e. I want to see
the handles for both the circuit and the contained element).
Thanks.
James
|
|
|
|
|
|
Re: Parent edit part selection [message #113150 is a reply to message #113126] |
Wed, 21 January 2004 16:37   |
Eclipse User |
|
|
|
Brian,
Thanks - very helpful, although I'm still not there yet. I've constructed
my own tracker which extends SelectEditPartTracker and I can force the
selection of the parent's edit part (in the tracker's constructor) using
"ep.setSelected(1)" where ep is the edit part. This works, but I'm aware
that it is not the correct way to do it (the API says that this method
should only be called by the edit part's viewer). Moreover it doesn't
loose the selection when some other edit part is selected.
I've tried using the following approach:
EditPartViewer viewer = owner.getViewer();
viewer.select(owner);
where "owner" is the owning edit part of the part owning the tracker, but
that doesn't work. Any advice on this, and loosing the selection upon
alternative selection, much appreciated.
James
Brian Fernandes wrote:
> override getDragTracker for the childs EditPart to return your own Tracker,
> mostly extended from SelectEditPartTracker. This tracker will also select
> the parents EditPart.
> Have a look at SelectEditPartTracker, implementation should be pretty
> straight forward.
> All the best,
> Brian.
|
|
|
Re: Parent edit part selection [message #113161 is a reply to message #113150] |
Wed, 21 January 2004 16:51   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
You may want to try calling
"viewer.appendSelection(getSourceEditPart().getParent())" in
performSelection(). Look in this method for the current way selection works.
"James Willans" <jwillans@cs.york.ac.uk> wrote in message
news:bumrf1$tmq$1@eclipse.org...
> Brian,
>
> Thanks - very helpful, although I'm still not there yet. I've constructed
> my own tracker which extends SelectEditPartTracker and I can force the
> selection of the parent's edit part (in the tracker's constructor) using
> "ep.setSelected(1)" where ep is the edit part. This works, but I'm aware
> that it is not the correct way to do it (the API says that this method
> should only be called by the edit part's viewer). Moreover it doesn't
> loose the selection when some other edit part is selected.
>
> I've tried using the following approach:
>
> EditPartViewer viewer = owner.getViewer();
> viewer.select(owner);
>
> where "owner" is the owning edit part of the part owning the tracker, but
> that doesn't work. Any advice on this, and loosing the selection upon
> alternative selection, much appreciated.
>
> James
>
> Brian Fernandes wrote:
>
> > override getDragTracker for the childs EditPart to return your own
Tracker,
> > mostly extended from SelectEditPartTracker. This tracker will also
select
> > the parents EditPart.
>
> > Have a look at SelectEditPartTracker, implementation should be pretty
> > straight forward.
>
> > All the best,
> > Brian.
>
>
|
|
|
Re: Parent edit part selection [message #113189 is a reply to message #113161] |
Thu, 22 January 2004 06:28  |
Eclipse User |
|
|
|
Whitney,
Many thanks - that worked well.
James
Whitney Sorenson wrote:
> You may want to try calling
> "viewer.appendSelection(getSourceEditPart().getParent())" in
> performSelection(). Look in this method for the current way selection works.
> "James Willans" <jwillans@cs.york.ac.uk> wrote in message
> news:bumrf1$tmq$1@eclipse.org...
> > Brian,
> >
> > Thanks - very helpful, although I'm still not there yet. I've constructed
> > my own tracker which extends SelectEditPartTracker and I can force the
> > selection of the parent's edit part (in the tracker's constructor) using
> > "ep.setSelected(1)" where ep is the edit part. This works, but I'm aware
> > that it is not the correct way to do it (the API says that this method
> > should only be called by the edit part's viewer). Moreover it doesn't
> > loose the selection when some other edit part is selected.
> >
> > I've tried using the following approach:
> >
> > EditPartViewer viewer = owner.getViewer();
> > viewer.select(owner);
> >
> > where "owner" is the owning edit part of the part owning the tracker, but
> > that doesn't work. Any advice on this, and loosing the selection upon
> > alternative selection, much appreciated.
> >
> > James
> >
> > Brian Fernandes wrote:
> >
> > > override getDragTracker for the childs EditPart to return your own
> Tracker,
> > > mostly extended from SelectEditPartTracker. This tracker will also
> select
> > > the parents EditPart.
> >
> > > Have a look at SelectEditPartTracker, implementation should be pretty
> > > straight forward.
> >
> > > All the best,
> > > Brian.
> >
> >
|
|
|
Powered by
FUDForum. Page generated in 0.11352 seconds