Prevent creating same operation twice

Issue #33 resolved
Matthias Schoettle created an issue

There should be a check when a) changing an operations name and b) when creating a new operation to ensure that an operation with the same signature doesn't already exist.

Comments (7)

  1. Laura Martellotto

    Finally, I moved the call to uniqueness checking methods in the ClassController because I think it is more logical to check attributes and operations uniqueness for all added attributes and operations (and not only those which are written from the GUI). In this way, for example it becomes impossible to duplicate getter and setter methods after having tap and hold event on the attribute name.

    Moreover, I commented all the createGetterAndSetterOperation() method body in the ClassController, to just call the createGetterOperation() and the createSetterOperation() methods, what it is more logical than rewrite what other methods already do. (And I added the parameter in the creation of setter method from attributes)

  2. Matthias Schoettle reporter

    Finally, I moved the call to uniqueness checking methods in the ClassController because I think it is more logical to check attributes and operations uniqueness for all added attributes and operations (and not only those which are written from the GUI). In this way, for example it becomes impossible to duplicate getter and setter methods after having tap and hold event on the attribute name.

    That's a good point. So far we have only done these check in the UI, but you are right. If another UI is used this will be missing. The IllegalArgumentException was initially thought for being able to tell the user the reason, but I am not sure if that's the best way. If you have a better idea how this could be done, feel free to tell us :)

    Moreover, I commented all the createGetterAndSetterOperation() method body in the ClassController, to just call the createGetterOperation() and the createSetterOperation() methods, what it is more logical than rewrite what other methods already do. (And I added the parameter in the creation of setter method from attributes)

    The reason why it was separated was that when you press "Create Getter and Setter" and then undo, it will only undo one, so you have to undo twice to actually undo it. But maybe its not really a big problem for the user and it is definitely nicer/cleaner code :) I think you can remove the code you commented out completely, though.

    Thanks!

  3. Log in to comment