Skip to main content



      Home
Home » Eclipse Projects » GEF » loss of focus on drag and drop from palette
loss of focus on drag and drop from palette [message #124639] Fri, 26 March 2004 16:59 Go to next message
Eclipse UserFriend
Originally posted by: felipeg.us.ibm.com

I have implemented a DirectEditManager within an EditPart to provide direct
editing on the canvas. The problem I am having is that when the user drags
and drops the object from the palette, the drop causes the control to loose
focus. This works well when the user clicks the palette and then clicks the
canvas to create the object. Any ideas? I saw some code related to OS
specific ctrl unfocus. Any ideas? Randy?

Thanks,

Felipe
Re: loss of focus on drag and drop from palette [message #124814 is a reply to message #124639] Mon, 29 March 2004 09:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Which control is losing focus? Are you activating the directeditmanager
immediately after creation?

"Felipe Gomez" <felipeg@us.ibm.com> wrote in message
news:c428kh$s4u$1@eclipse.org...
> I have implemented a DirectEditManager within an EditPart to provide
direct
> editing on the canvas. The problem I am having is that when the user drags
> and drops the object from the palette, the drop causes the control to
loose
> focus. This works well when the user clicks the palette and then clicks
the
> canvas to create the object. Any ideas? I saw some code related to OS
> specific ctrl unfocus. Any ideas? Randy?
>
> Thanks,
>
> Felipe
>
>
Re: loss of focus on drag and drop from palette [message #124940 is a reply to message #124814] Tue, 30 March 2004 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: felipeg.us.ibm.com

The edit text control inside the edit part is losing focus, and yes, I am
activating the directeditmanager immed after creation That way, the user
creates an object and the edit box appears allowing the user to name the
object.

Thanks,

Felipe

"Randy Hudson" <none@us.ibm.com> wrote in message
news:c49asr$e0a$1@eclipse.org...
> Which control is losing focus? Are you activating the directeditmanager
> immediately after creation?
>
> "Felipe Gomez" <felipeg@us.ibm.com> wrote in message
> news:c428kh$s4u$1@eclipse.org...
> > I have implemented a DirectEditManager within an EditPart to provide
> direct
> > editing on the canvas. The problem I am having is that when the user
drags
> > and drops the object from the palette, the drop causes the control to
> loose
> > focus. This works well when the user clicks the palette and then clicks
> the
> > canvas to create the object. Any ideas? I saw some code related to OS
> > specific ctrl unfocus. Any ideas? Randy?
> >
> > Thanks,
> >
> > Felipe
> >
> >
>
>
Re: loss of focus on drag and drop from palette [message #124951 is a reply to message #124940] Tue, 30 March 2004 16:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

Well, for what it's worth... this all works ok for me, both for a DND
from the palette and from a select from the palette and a click on the FFS.
In my CreateCommand, once the new part has been added to it parent
(parent.addChild()) the new child part fires off a "ForcedDirectEdit"
event ( my event ). The edit part for this new child is listening to it
model part and catches this event. This is how I handle this caught
event....

public void modelUpdate(ForcedDirectEditEvent event) {
request = new DirectEditRequest();
request.setDirectEditFeature
(IBaseProvidersConstants.DIRECTEDITGRAPHICALLABEL);
/**
* need to async this off to allow current UI work to complete
* before this request is handled. If this is not done then you *
will get unpredictable results
*/
Display display = Display.getDefault();
if (display != null) {
display.asyncExec(new Runnable() {
public void run() {
performDirectEdit(request);
}
});
}
}

I think I had to async it off because some weird things were happening
on Linux but it maybe the solution to your problem as well.

Guy

Felipe Gomez wrote:
> The edit text control inside the edit part is losing focus, and yes, I am
> activating the directeditmanager immed after creation That way, the user
> creates an object and the edit box appears allowing the user to name the
> object.
>
> Thanks,
>
> Felipe
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:c49asr$e0a$1@eclipse.org...
>
>>Which control is losing focus? Are you activating the directeditmanager
>>immediately after creation?
>>
>>"Felipe Gomez" <felipeg@us.ibm.com> wrote in message
>>news:c428kh$s4u$1@eclipse.org...
>>
>>>I have implemented a DirectEditManager within an EditPart to provide
>>
>>direct
>>
>>>editing on the canvas. The problem I am having is that when the user
>
> drags
>
>>>and drops the object from the palette, the drop causes the control to
>>
>>loose
>>
>>>focus. This works well when the user clicks the palette and then clicks
>>
>>the
>>
>>>canvas to create the object. Any ideas? I saw some code related to OS
>>>specific ctrl unfocus. Any ideas? Randy?
>>>
>>>Thanks,
>>>
>>>Felipe
>>>
>>>
>>
>>
>
>
Re: loss of focus on drag and drop from palette [message #125001 is a reply to message #124951] Tue, 30 March 2004 23:07 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Any time you use async you need to be careful. It sounds like a fine way to
workaround the problem, which might be that SWT is setting focus back to the
originiating control for the drag source (the palette)? With async, it is
possible that the user invokes Undo between the time the editpart is
created, and the time the direct edit request is sent. THis would mean the
editpart no longer exists in the diagram. A paranoid person like myself
would put a check in like:
> Display display = Display.getDefault();
> if (display != null) {
> display.asyncExec(new Runnable() {
> public void run() {
if (!editpart.isActive())
return; //Editpart was deleted for some reason before editing
> performDirectEdit(request);
> }
> });
> }
> }


"Guy Slade" <gaslade@yahoo.com> wrote in message
news:c4cp7d$qrd$1@eclipse.org...
> Well, for what it's worth... this all works ok for me, both for a DND
> from the palette and from a select from the palette and a click on the
FFS.
> In my CreateCommand, once the new part has been added to it parent
> (parent.addChild()) the new child part fires off a "ForcedDirectEdit"
> event ( my event ). The edit part for this new child is listening to it
> model part and catches this event. This is how I handle this caught
> event....
>
> public void modelUpdate(ForcedDirectEditEvent event) {
> request = new DirectEditRequest();
> request.setDirectEditFeature
> (IBaseProvidersConstants.DIRECTEDITGRAPHICALLABEL);
> /**
> * need to async this off to allow current UI work to complete
> * before this request is handled. If this is not done then you *
> will get unpredictable results
> */
> Display display = Display.getDefault();
> if (display != null) {
> display.asyncExec(new Runnable() {
> public void run() {
> performDirectEdit(request);
> }
> });
> }
> }
>
> I think I had to async it off because some weird things were happening
> on Linux but it maybe the solution to your problem as well.
>
> Guy
>
> Felipe Gomez wrote:
> > The edit text control inside the edit part is losing focus, and yes, I
am
> > activating the directeditmanager immed after creation That way, the user
> > creates an object and the edit box appears allowing the user to name the
> > object.
> >
> > Thanks,
> >
> > Felipe
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:c49asr$e0a$1@eclipse.org...
> >
> >>Which control is losing focus? Are you activating the directeditmanager
> >>immediately after creation?
> >>
> >>"Felipe Gomez" <felipeg@us.ibm.com> wrote in message
> >>news:c428kh$s4u$1@eclipse.org...
> >>
> >>>I have implemented a DirectEditManager within an EditPart to provide
> >>
> >>direct
> >>
> >>>editing on the canvas. The problem I am having is that when the user
> >
> > drags
> >
> >>>and drops the object from the palette, the drop causes the control to
> >>
> >>loose
> >>
> >>>focus. This works well when the user clicks the palette and then clicks
> >>
> >>the
> >>
> >>>canvas to create the object. Any ideas? I saw some code related to OS
> >>>specific ctrl unfocus. Any ideas? Randy?
> >>>
> >>>Thanks,
> >>>
> >>>Felipe
> >>>
> >>>
> >>
> >>
> >
> >
>
Previous Topic:Perplexing trouble in importing packages
Next Topic:How can I run a swt example with no entry class
Goto Forum:
  


Current Time: Thu May 08 08:46:39 EDT 2025

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

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

Back to the top