Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Start/activate label editor from custom action
Start/activate label editor from custom action [message #225111] Thu, 09 April 2009 09:23 Go to next message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Hi,

how can I activate editing a label of a figure in the diagram view
programatically from a run method of a custom action.

I have a reference to the EditPart containing the label. But I can only
call setFocus(). My guess is, there might be a command triggering the
activation, since normally the user activates the editor by clicking on
the label text.

Can anyone give me a hint or short snipped?

Thanks,
Rob
Re: Start/activate label editor from custom action [message #225164 is a reply to message #225111] Thu, 09 April 2009 12:06 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Robert,

Try sending org.eclipse.gef.requests.DirectEditRequest to the corresponding
EditPart.

-----------------
Alex Shatalin
Re: [Solved] Start/activate label editor from custom action [message #225176 is a reply to message #225111] Thu, 09 April 2009 12:17 Go to previous messageGo to next message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
This code inside my run() method does it:

Request req = new Request(RequestConstants.REQ_DIRECT_EDIT);
List children = newFigureEditPart.getChildren();
for (Object object : children) {
// FFOEP is the label EP
if (object instanceof FigureFigureObjectEditPart) {
final FigureFigureObjectEditPart oEP = (FigureFigureObjectEditPart)
object;
final Request fReq = req;
UIJob job = new UIJob("grab edit focus") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
oEP.performRequest(fReq);
return Status.OK_STATUS;
}
};
job.schedule();
break;
}
}
Re: Start/activate label editor from custom action [message #225179 is a reply to message #225164] Thu, 09 April 2009 12:18 Go to previous message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Thx, just found a solution the same time you wrote the reply. :-)
Previous Topic:Lost EditingDomain after "save"
Next Topic:DropObjectsRequest and Command to DnD from a View to diagram editor
Goto Forum:
  


Current Time: Fri Apr 19 20:08:58 GMT 2024

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

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

Back to the top