Opened 12 years ago

Closed 7 years ago

#1857 closed enhancement (fixed)

Simplify adding new models

Reported by: Per Östlund Owned by: Adeel Asghar
Priority: low Milestone: 1.12.0
Component: OMEdit Version: trunk
Keywords: Cc: Per Östlund

Description

Right now it's a bit clunky when adding new classes, where you have to select which package to add it to. It would be easier for users to be able to just add classes to whatever class they select. One way of doing this is by extending the right-click menu with a submenu from which you can choose the type of class to add, so that a user can just right-click on any class in the list and choose to add a new class in it.

Also, it's not only package that may contain other classes, so we have to check what kind of class we're trying to add to so that we know what we're allowed to add to it. See section 4.6 in the Modelica specification for what the different classes are allowed to contain.

Change History (13)

comment:1 by Adeel Asghar, 12 years ago

Resolution: fixed
Status: newclosed

Now you can add new models/classes by right clicking the existing classes.

comment:2 by Per Östlund, 12 years ago

Resolution: fixed
Status: closedreopened

That's great, but it only solves the first part of the issue. Adding a class to another non-package class results in that class being added to the top scope instead of to the non-package class. I.e. if you have a package P which contains a class C, then right-clicking on C and adding a new class will add it to the top-scope instead of to P.C.

It's possible to manually fill in the "Insert in class" field with the appropriate class though. So manually filling in P.C will actually work as intended, even if P.C is not in the drop-down list. So a simple soluation is to have OMEdit fill in this field with the path of the class the user right-clicked on. It might also be a good idea to hide this field from the user to avoid confusion in this case.

OMEdit should probably also enforce the class restriction rules in section 4.6 of the specification. For example, operators may only contain functions and no other type of class.

in reply to:  2 comment:3 by Adeel Asghar, 12 years ago

Replying to perost:

That's great, but it only solves the first part of the issue. Adding a class to another non-package class results in that class being added to the top scope instead of to the non-package class. I.e. if you have a package P which contains a class C, then right-clicking on C and adding a new class will add it to the top-scope instead of to P.C.

It's possible to manually fill in the "Insert in class" field with the appropriate class though. So manually filling in P.C will actually work as intended, even if P.C is not in the drop-down list. So a simple soluation is to have OMEdit fill in this field with the path of the class the user right-clicked on. It might also be a good idea to hide this field from the user to avoid confusion in this case.

It should work fine now with r15689.

OMEdit should probably also enforce the class restriction rules in section 4.6 of the specification. For example, operators may only contain functions and no other type of class.

Yes, we can follow the rules defined in Modelica specificaiton but for now its fine. You are literally allowed to insert anything within anything.

comment:4 by Per Östlund, 12 years ago

Priority: highlow

Yes, I think it works fine now. There's a couple of things that could be improved, so let's keep the ticket open for now but with lower priority.

Also, it would be nice to be able to right-click on an empty spot in the library list and be able to add a new class. It's not really important since you can just click on the "New Modelica Class" icon instead, but I kind of expected that to work.

comment:5 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:6 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:7 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:8 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:9 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:10 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:11 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:12 by Adeel Asghar, 8 years ago

Milestone: 1.11.01.12.0

Milestone changed to 1.12.0 since 1.11.0 was released.

in reply to:  4 comment:13 by Adeel Asghar, 7 years ago

Resolution: fixed
Status: reopenedclosed

Replying to perost:

Yes, I think it works fine now. There's a couple of things that could be improved, so let's keep the ticket open for now but with lower priority.

Also, it would be nice to be able to right-click on an empty spot in the library list and be able to add a new class. It's not really important since you can just click on the "New Modelica Class" icon instead, but I kind of expected that to work.

Its possible now to right click on an empty spot and be able to create new class. 095b0e/OMEdit.

Note: See TracTickets for help on using tickets.