I need to add functionality to an editor created using GMF in Eclipse wherein on selection of an item in the palette, a box pops up with options to create another different item. The second item cannot be created without selecting the first one. Can someone please tell me how I would implement such a functionality? Thanks.
Asked
Active
Viewed 133 times
1 Answers
0
In the creation command execution of the first item you can nest the creation of the second item. The second item creation would prompt the user to select the item type for example via a popup menu and block the execution until user selects something on the popup menu. Undo/Redo would be working for the composite creation command. Try connection handles of the groshape example diagram Hover on a shape until connection handles next to th shape appear. Drag the connection handle to create a connection and release the mouse button on the blank space then you'd get a popup menu to select the target for the connection. This would your example. Hope this helps.

aboyko
- 1,337
- 1
- 9
- 11
-
Could you please be more specific about how to do the nesting i.e. with reference to class/package names? – Asher Jun 30 '14 at 08:29
-
Please look at the following classes: org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool, org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest and definitely look at the following method implementation: org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy#getUnspecifiedTypeCreateCommand(...) lines 381-498. Open GMF Geoshape example diagram editor. Polygon and Rectangle Types palette enyries is probably what you need to implement, which is rather straight-forward. – aboyko Jun 30 '14 at 14:12