Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to force Direct Edit?
How to force Direct Edit? [message #211769] Wed, 15 March 2006 19:42 Go to next message
Martin Holmes is currently offline Martin HolmesFriend
Messages: 79
Registered: July 2009
Member
Hi ...
I already have direct edit by selecting and then by clicking an item.

I would also like to be able to force direct edit when I use the creation
tool. Therefore as soon as I create an item the text box I am using for
direct edit will appear .


Anyone know if this is possible?

thanks

Martin
Re: How to force Direct Edit? [message #211816 is a reply to message #211769] Thu, 16 March 2006 00:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

you coudl override performCreate(), and send a DirectEditRequest to the
selected part, or invoke the direct edit action if you can get hold of it.

"Martin Holmes" <martincanbe@hotmail.com> wrote in message
news:dv9r6d$ndv$1@utils.eclipse.org...
> Hi ...
> I already have direct edit by selecting and then by clicking an item.
>
> I would also like to be able to force direct edit when I use the creation
> tool. Therefore as soon as I create an item the text box I am using for
> direct edit will appear .
>
>
> Anyone know if this is possible?
>
> thanks
>
> Martin
>
>
Re: How to force Direct Edit? [message #211896 is a reply to message #211816] Thu, 16 March 2006 10:52 Go to previous message
Martin Holmes is currently offline Martin HolmesFriend
Messages: 79
Registered: July 2009
Member
Thanks that worked perfectly!



public class DirectEditCreationTool extends CreationTool {

private Request directEditRequest = new
Request(RequestConstants.REQ_DIRECT_EDIT);

public DirectEditCreationTool() {
super();
}

public DirectEditCreationTool(CreationFactory aFactory) {
super(aFactory);
}

protected void performCreation(int button) {
super.performCreation(button);
EditPartViewer viewer = getCurrentViewer();
final Object model = getCreateRequest().getNewObject();
if (model == null || viewer == null)
return;
Object editpart = viewer.getEditPartRegistry().get(model);
if (editpart instanceof EditPart) {
EditPart part = (EditPart)editpart;
part.performRequest(directEditRequest);
}
}

}


Martin
Previous Topic:A possibe Bug in draw2d Label
Next Topic:Selection and drag connection tool
Goto Forum:
  


Current Time: Fri Apr 19 22:53:04 GMT 2024

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

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

Back to the top