How to force Direct Edit? [message #211769] |
Wed, 15 March 2006 19:42  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02943 seconds