Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Deferring editing to a different part
Deferring editing to a different part [message #181595] Tue, 17 May 2005 22:44 Go to next message
Eclipse UserFriend
Originally posted by: freddie_nurke.hotmail.com

Hi folks,

I'm implementing a text box. I have my drawing object underneath,
covered in one or more text objects for the paragraphs and other textual
components. I want the text objects' parts to defer to their parent
drawing object's part for most operations (resizing, moving), except
when I enter edit mode. In edit mode I want the text part's edit policy
to take effect.

I understand generally how the edit policies work but not how to control
them dynamically. How can I make the text parts "invisible" most of the
time so clicks and drag operations fall through to the parent part?

Thanks,

Fred
Re: Deferring editing to a different part [message #181706 is a reply to message #181595] Wed, 18 May 2005 17:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: freddie_nurke.hotmail.com

I've overridden findFigureAt for the text object's figure so that in
read-only mode it doesn't search its children. I can now interact with
the object as a whole rather than the text contents of the object.

Now I need to figure out how to enter edit mode...

Thanks,

Fred

Fred Nurke wrote:
> Hi folks,
>
> I'm implementing a text box. I have my drawing object underneath,
> covered in one or more text objects for the paragraphs and other textual
> components. I want the text objects' parts to defer to their parent
> drawing object's part for most operations (resizing, moving), except
> when I enter edit mode. In edit mode I want the text part's edit policy
> to take effect.
>
> I understand generally how the edit policies work but not how to control
> them dynamically. How can I make the text parts "invisible" most of the
> time so clicks and drag operations fall through to the parent part?
>
> Thanks,
>
> Fred
Re: Deferring editing to a different part [message #181709 is a reply to message #181706] Wed, 18 May 2005 23:46 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Instead, your EditPart should override getTargetEditPart() and return its
parent when in read-only mode.

"Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
news:d6fu2l$e55$1@news.eclipse.org...
> I've overridden findFigureAt for the text object's figure so that in
> read-only mode it doesn't search its children. I can now interact with
> the object as a whole rather than the text contents of the object.
>
> Now I need to figure out how to enter edit mode...
>
> Thanks,
>
> Fred
>
> Fred Nurke wrote:
> > Hi folks,
> >
> > I'm implementing a text box. I have my drawing object underneath,
> > covered in one or more text objects for the paragraphs and other textual
> > components. I want the text objects' parts to defer to their parent
> > drawing object's part for most operations (resizing, moving), except
> > when I enter edit mode. In edit mode I want the text part's edit policy
> > to take effect.
> >
> > I understand generally how the edit policies work but not how to control
> > them dynamically. How can I make the text parts "invisible" most of the
> > time so clicks and drag operations fall through to the parent part?
> >
> > Thanks,
> >
> > Fred
Re: Deferring editing to a different part [message #181712 is a reply to message #181709] Thu, 19 May 2005 00:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: freddie_nurke.hotmail.com

To clarify: the edit parts for the contents of the text box should
override getTargetEditPart (as opposed to the container's edit part)?

Thanks for your help,

Fred


Pratik Shah wrote:
> Instead, your EditPart should override getTargetEditPart() and return its
> parent when in read-only mode.
>
> "Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
> news:d6fu2l$e55$1@news.eclipse.org...
>
>>I've overridden findFigureAt for the text object's figure so that in
>>read-only mode it doesn't search its children. I can now interact with
>>the object as a whole rather than the text contents of the object.
>>
>>Now I need to figure out how to enter edit mode...
>>
>>Thanks,
>>
>>Fred
>>
>>Fred Nurke wrote:
>>
>>>Hi folks,
>>>
>>>I'm implementing a text box. I have my drawing object underneath,
>>>covered in one or more text objects for the paragraphs and other textual
>>>components. I want the text objects' parts to defer to their parent
>>>drawing object's part for most operations (resizing, moving), except
>>>when I enter edit mode. In edit mode I want the text part's edit policy
>>>to take effect.
>>>
>>>I understand generally how the edit policies work but not how to control
>>>them dynamically. How can I make the text parts "invisible" most of the
>>>time so clicks and drag operations fall through to the parent part?
>>>
>>>Thanks,
>>>
>>>Fred
>
>
>
Re: Deferring editing to a different part [message #181797 is a reply to message #181712] Thu, 19 May 2005 15:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Actually, if the child simply does not identify itself as the target, then
the targeting will fall through and the parent can identify itself as the
target insted.

So, you should return NULL if you are not targetable.

"Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
news:d6gmhq$b6o$1@news.eclipse.org...
> To clarify: the edit parts for the contents of the text box should
> override getTargetEditPart (as opposed to the container's edit part)?
>
> Thanks for your help,
>
> Fred
>
>
> Pratik Shah wrote:
>> Instead, your EditPart should override getTargetEditPart() and return its
>> parent when in read-only mode.
>>
>> "Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
>> news:d6fu2l$e55$1@news.eclipse.org...
>>
>>>I've overridden findFigureAt for the text object's figure so that in
>>>read-only mode it doesn't search its children. I can now interact with
>>>the object as a whole rather than the text contents of the object.
>>>
>>>Now I need to figure out how to enter edit mode...
>>>
>>>Thanks,
>>>
>>>Fred
>>>
>>>Fred Nurke wrote:
>>>
>>>>Hi folks,
>>>>
>>>>I'm implementing a text box. I have my drawing object underneath,
>>>>covered in one or more text objects for the paragraphs and other textual
>>>>components. I want the text objects' parts to defer to their parent
>>>>drawing object's part for most operations (resizing, moving), except
>>>>when I enter edit mode. In edit mode I want the text part's edit policy
>>>>to take effect.
>>>>
>>>>I understand generally how the edit policies work but not how to control
>>>>them dynamically. How can I make the text parts "invisible" most of the
>>>>time so clicks and drag operations fall through to the parent part?
>>>>
>>>>Thanks,
>>>>
>>>>Fred
>>
>>
Re: Deferring editing to a different part [message #181874 is a reply to message #181797] Thu, 19 May 2005 18:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: freddie_nurke.hotmail.com

Hi Randy,

Unfortunately it doesn't seem to work that way. I overrode
getTargetEditPart in AbstractTextualPart, which is the top of the
hierarchy for the text parts. It now returns null. However, the
TargetingTool's updateTargetUnderMouse doesn't search deeply for the
target under the mouse:

protected boolean updateTargetUnderMouse() {
if (!isTargetLocked()) {
Collection exclude = getExclusionSet();
EditPart editPart = getCurrentViewer().findObjectAtExcluding(
getLocation(),
exclude,
getTargetingConditional());
if (editPart != null)
editPart = editPart.getTargetEditPart(getTargetRequest());
boolean changed = getTargetEditPart() != editPart;
setTargetEditPart(editPart);
return changed;
} else
return false;
}

As you can see, if getTargetEditPart for the editPart under the mouse
returns null, the target edit part is simply set to null, not to that
part's parent (or nth grandparent as appropriate).

If instead I make getTargetEditPart return
getParent().getTargetEditPart(), it seems to work. That's a lot cleaner
than overriding the Figure's findFigureAt, so I'll use it instead.

Thanks,

Fred

Randy Hudson wrote:
> Actually, if the child simply does not identify itself as the target, then
> the targeting will fall through and the parent can identify itself as the
> target insted.
>
> So, you should return NULL if you are not targetable.
>
> "Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
> news:d6gmhq$b6o$1@news.eclipse.org...
>
>>To clarify: the edit parts for the contents of the text box should
>>override getTargetEditPart (as opposed to the container's edit part)?
>>
>>Thanks for your help,
>>
>>Fred
>>
>>
>>Pratik Shah wrote:
>>
>>>Instead, your EditPart should override getTargetEditPart() and return its
>>>parent when in read-only mode.
>>>
>>>"Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
>>>news:d6fu2l$e55$1@news.eclipse.org...
>>>
>>>
>>>>I've overridden findFigureAt for the text object's figure so that in
>>>>read-only mode it doesn't search its children. I can now interact with
>>>>the object as a whole rather than the text contents of the object.
>>>>
>>>>Now I need to figure out how to enter edit mode...
>>>>
>>>>Thanks,
>>>>
>>>>Fred
>>>>
>>>>Fred Nurke wrote:
>>>>
>>>>
>>>>>Hi folks,
>>>>>
>>>>>I'm implementing a text box. I have my drawing object underneath,
>>>>>covered in one or more text objects for the paragraphs and other textual
>>>>>components. I want the text objects' parts to defer to their parent
>>>>>drawing object's part for most operations (resizing, moving), except
>>>>>when I enter edit mode. In edit mode I want the text part's edit policy
>>>>>to take effect.
>>>>>
>>>>>I understand generally how the edit policies work but not how to control
>>>>>them dynamically. How can I make the text parts "invisible" most of the
>>>>>time so clicks and drag operations fall through to the parent part?
>>>>>
>>>>>Thanks,
>>>>>
>>>>>Fred
>>>
>>>
>
Re: Deferring editing to a different part [message #182251 is a reply to message #181874] Mon, 23 May 2005 20:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

It does search deeply. In fact, it searches deepest figures first.
Returning NULL higher up in the editpart parent chain does not prevent the
children from being seen. You need to dive into findObjectAtExcluding to
appreciate the targeting ;-)

For an example of how returning NULL works, try dragging a logic part on top
of another GATE or LED object. Those objects are not containers, so they
return NULL as the target of an ADD operations, which allows the parent to
be targeted. In fact, it doesn't even have to be a parent. It could be a
sibling which is behind the non-container in the Z-order.


"Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
news:d6imsc$ker$1@news.eclipse.org...
> Hi Randy,
>
> Unfortunately it doesn't seem to work that way. I overrode
> getTargetEditPart in AbstractTextualPart, which is the top of the
> hierarchy for the text parts. It now returns null. However, the
> TargetingTool's updateTargetUnderMouse doesn't search deeply for the
> target under the mouse:
>
> protected boolean updateTargetUnderMouse() {
> if (!isTargetLocked()) {
> Collection exclude = getExclusionSet();
> EditPart editPart = getCurrentViewer().findObjectAtExcluding(
> getLocation(),
> exclude,
> getTargetingConditional());
> if (editPart != null)
> editPart = editPart.getTargetEditPart(getTargetRequest());
> boolean changed = getTargetEditPart() != editPart;
> setTargetEditPart(editPart);
> return changed;
> } else
> return false;
> }
>
> As you can see, if getTargetEditPart for the editPart under the mouse
> returns null, the target edit part is simply set to null, not to that
> part's parent (or nth grandparent as appropriate).
>
> If instead I make getTargetEditPart return
> getParent().getTargetEditPart(), it seems to work. That's a lot cleaner
> than overriding the Figure's findFigureAt, so I'll use it instead.
>
Re: Deferring editing to a different part [message #182546 is a reply to message #182251] Wed, 25 May 2005 22:41 Go to previous message
Eclipse UserFriend
Originally posted by: freddie_nurke.hotmail.com

Hi Randy,

Thanks for your help. I ended up following through most of that code
and found the correct place to override getTargetEditPart. It's working
now.

Thanks,

Fred


Randy Hudson wrote:
> It does search deeply. In fact, it searches deepest figures first.
> Returning NULL higher up in the editpart parent chain does not prevent the
> children from being seen. You need to dive into findObjectAtExcluding to
> appreciate the targeting ;-)
>
> For an example of how returning NULL works, try dragging a logic part on top
> of another GATE or LED object. Those objects are not containers, so they
> return NULL as the target of an ADD operations, which allows the parent to
> be targeted. In fact, it doesn't even have to be a parent. It could be a
> sibling which is behind the non-container in the Z-order.
>
>
> "Fred Nurke" <freddie_nurke@hotmail.com> wrote in message
> news:d6imsc$ker$1@news.eclipse.org...
>
>>Hi Randy,
>>
>>Unfortunately it doesn't seem to work that way. I overrode
>>getTargetEditPart in AbstractTextualPart, which is the top of the
>>hierarchy for the text parts. It now returns null. However, the
>>TargetingTool's updateTargetUnderMouse doesn't search deeply for the
>>target under the mouse:
>>
>>protected boolean updateTargetUnderMouse() {
>>if (!isTargetLocked()) {
>>Collection exclude = getExclusionSet();
>>EditPart editPart = getCurrentViewer().findObjectAtExcluding(
>>getLocation(),
>>exclude,
>>getTargetingConditional());
>>if (editPart != null)
>>editPart = editPart.getTargetEditPart(getTargetRequest());
>>boolean changed = getTargetEditPart() != editPart;
>>setTargetEditPart(editPart);
>>return changed;
>>} else
>>return false;
>>}
>>
>>As you can see, if getTargetEditPart for the editPart under the mouse
>>returns null, the target edit part is simply set to null, not to that
>>part's parent (or nth grandparent as appropriate).
>>
>>If instead I make getTargetEditPart return
>>getParent().getTargetEditPart(), it seems to work. That's a lot cleaner
>>than overriding the Figure's findFigureAt, so I'll use it instead.
>>
>
>
Previous Topic:Lost focus
Next Topic:DirectEditManager
Goto Forum:
  


Current Time: Fri Dec 13 03:04:06 GMT 2024

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

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

Back to the top