Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » going from a create request directly to a direct edit
going from a create request directly to a direct edit [message #249260] Fri, 12 June 2009 16:17 Go to next message
John Bradley is currently offline John BradleyFriend
Messages: 14
Registered: July 2009
Junior Member
It would be useful if, immediately after a new object has been created in
response to a create request by the user, the user was put in a state
where they could enter data into one of the newly created object's text
fields (via, I assume, starting a direct edit without the user then having
to ask for one).

The code currently creates the new object by invoking a GEF Command to
create the new model data via an Edit Policy, and in the usual way of
things this triggers the appropriate EditPart to add the new object on the
user's screen. So far, so good. I don't know, however, how to follow this
up automatically with a request to invoke the Direct Edit mechanism to
allow the user to begin typing into the field right away.

Is this possible under GEF? If so how? Alternatively, is it a bad idea
user interface-wise?

Many thanks. Hope this is clear. I've been away from development using
GEF for some time.

... john bradley
Re: going from a create request directly to a direct edit [message #249273 is a reply to message #249260] Sun, 14 June 2009 10:34 Go to previous message
Eclipse UserFriend
Originally posted by: modica.cs.tu-berlin.deNOSPAM

John Bradley schrieb:
> It would be useful if, immediately after a new object has been created
> in response to a create request by the user, the user was put in a state
> where they could enter data into one of the newly created object's text
> fields (via, I assume, starting a direct edit without the user then
> having to ask for one).
>
> The code currently creates the new object by invoking a GEF Command to
> create the new model data via an Edit Policy, and in the usual way of
> things this triggers the appropriate EditPart to add the new object on
> the user's screen. So far, so good. I don't know, however, how to follow
> this up automatically with a request to invoke the Direct Edit mechanism
> to allow the user to begin typing into the field right away.
>
> Is this possible under GEF? If so how? Alternatively, is it a bad idea
> user interface-wise?

Hi John,

I always wanted such a feature as well and the best way I found to hook
in is the corresponding creation tool, e.g.:

public class ObjectNetCreationTool extends CreationTool {

@Override
protected void executeCurrentCommand() {
// Store current command
final Command command = getCurrentCommand();

super.executeCurrentCommand();

if (command instanceof CreateNodeCommand) {
final ONNode node = ((CreateNodeCommand) command).getONNode();
final Map<?, ?> reg = getCurrentViewer().getEditPartRegistry();
final EditPart editPart = (EditPart) reg.get(node);
final Request request = new Request(
RequestConstants.REQ_DIRECT_EDIT);
editPart.performRequest(request);
command.setLabel(command.getLabel() + node.getName());
}
}
}

Cheers,

Tony
Previous Topic:[zest] Network with pre-defined coordinates
Next Topic:Problem with mouse hover in draw2d figure
Goto Forum:
  


Current Time: Fri Mar 29 15:41:32 GMT 2024

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

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

Back to the top