Re-ordering of operations and attributes in classes

Issue #568 new
Jörg Kienzle created an issue

It would be great if it were possible to re-order attributes and operations in classes. Currently, when e.g. operations are created, they are displayed in the same order as they were created in the class. Sometimes a designer would like to change the display order after the operations are created, e.g., to group all getters and setters together. Currently this is not possible.

Ideally it would be very intuitive to allow the modeller to “drag” an operation or class upwards or downwards in the operation/class compartment, and when it is released the operation / attribute would “insert” itself at the place where it was released. A similar technique is used in the sequence diagrams / message views. There it is possible to drag a message upwards or downwards to move it around.

This should be done both for the classes in RAM (i.e. in the structural view) and classes in the Classdiagram language (class diagram view).

Here is a suggested outline to solve this issue:

  • create a new controller operation “setOperationPosition” that takes an operation and an index as a parameter. The operation would use EMF commands to: a) remove the operation from the “operations” list in the classifier, and then add the operation back again at the provided index.
  • then you need to attach a drag handler to the operation view. A fancy drag handler example is the DragHandler class in ca.mcgill.sel.ram.ui.views.message.handler.impl . It actually visually updates the screen during the drag to show the moving object. Only one the drag is over (GESTURE_ENDED) it actually updates the model.

Comments (1)

  1. Log in to comment