Introduction:
I write an Eclipse plugin containing an editor which I implement with GEF.
I have nodes and edges in my editor.
The nodes have names and I want to edit the name of the nodes via direct edit.
I install the direct edit policy to the node edit parts:
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new NodeNameDirectEditPolicy());
and the direct edit policy implements the direct edit command.
The problem is: To confirm the direct edit I have to press STRG + ENTER. If I only press ENTER the direct edit is expanded to a new line. Is there any way to make it possible that the direct edit can be confirmed simply with ENTER? multiline node names are not needed.
You should be able to achieve it by extending the
TextCellEditor(Composite parent, int style)
constructor in your own extension ofTextCellEditor
.Then, when calling
createCellEditorOn(Composite composite)
in yourDirectEditManager
extension class, let it returnnew YOURTextCellEditor(composite, SWT.SINGLE)
.Verbosely:
Your own implementation of
TextCellEditor
's constructorcreateCellEditorOn(Composite composite)
in your implementation of DirectEditManager`Perhaps check if you return a new instance of
YOURTextCellEditor
withSWT.MULTI
orSWT.MULTI|SWT.WRAP
or similar, this makes your text cell editor's SWT control a multi-line text widget (cf. SWT Widgets overview).