Opened 6 years ago
Last modified 3 years ago
#5175 new defect
OMEdit cannot create models as separate .mo files
Reported by: | Francesco Casella | Owned by: | Adeel Asghar |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | OMEdit | Version: | |
Keywords: | Cc: | albertoleva |
Description
Steps to replicate the issue:
- open the attached package
- right-click on TestPackage, select New Modelica class
- create a Model
Unfortunately there is no way to select whether you want the model to be saved as a separate .mo file or within the existing (package.mo) file. This is only possible with Packages.
Ditto for other types of classes like function, connector, etc.
Of course you can create a package as a separate file, then edit its code and change the package
keyword into model
or other types of classes, but that's more like a hack.
Attachments (1)
Change History (10)
comment:1 by , 6 years ago
Milestone: | 1.13.0 → 1.14.0 |
---|
follow-up: 3 comment:2 by , 6 years ago
There is not attachment.
How the things are stored is driven by the package.
- If the package is created with option
Save contents in one file
then all the nested classes are stored inside it and you can't choose to save as separate .mo file since the directory structure doesn't make sense then. - If the package is created without option
Save contents in one file
then the nested classes are saved as separate.mo but you can have a nested package with optionSave contents in one file
and then for its all nested classes rule 1 will apply.
Unfortunately there is no way to select whether you want the model to be saved as a separate .mo file or within the existing (package.mo) file. This is only possible with Packages.
In this case how the model is saved depends on how the package was created. If it was created with option Save contents in one file
then its the model is saved in the same .mo file otherwise its saved in a separate .mo file.
comment:3 by , 6 years ago
Replying to adeas31:
There is not attachment.
Sorry about that, please find it attached.
How the things are stored is driven by the package.
- If the package is created with option
Save contents in one file
then all the nested classes are stored inside it and you can't choose to save as separate .mo file since the directory structure doesn't make sense then.
Sure, but that's not the case here. An empty package was created without that option, resulting in a directory with the package name, containing a package.mo file with the package declaration and nothing else.
- If the package is created without option
Save contents in one file
then the nested classes are saved as separate.mo but you can have a nested package with optionSave contents in one file
and then for its all nested classes rule 1 will apply.
Exactly.
Unfortunately there is no way to select whether you want the model to be saved as a separate .mo file or within the existing (package.mo) file. This is only possible with Packages.
That's precisely the point of this ticket. I don't see any reason for this restriction, and I actually found myself in a use case where I had to do this manually, which is kind of awkward. I then propose to make this possible with the GUI. Is there any technical reason why this should be hard or impossible to implement?
comment:4 by , 6 years ago
In fact, my original description of the issue was inaccurate and misleading, sorry about that. I try once more.
When you create a new package P
in TestPackage
, you can indeed decide to put it in a single file P.mo
inside the TestPackage
directory, or to put it in a directory TestPackage/P
containing a package.mo
file. What you can't do with both with a new package and with a new model, is to put them inside package.mo. I understand this maybe considere as a somewhat odd practice, but it is nevertheless allowed by the specification, which reads
13.2.2.1 Mapping a Package/Class Hierarchy into a Directory Hierarchy (Structured Entity)
A directory shall contain a node, the file package.mo . The node shall contain a stored-definition that defines a class [A] with a name matching the name of the structured entity. [The node typically contains documentation and graphical information for a package, but may also contain additional elements of the class A.]
Maybe this is not a feature required by many users, but it would be nevertheless nice if one had the option of storing new classes (of any kind, including package, class, function, type, etc.) in the package.mo file, when the package in which you want to create the new class is stored in a directory.
comment:5 by , 6 years ago
Aha, at least its now clear for me what you want :)
I will see how this can be achieved.
comment:6 by , 5 years ago
Milestone: | 1.14.0 → 1.16.0 |
---|
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0
comment:8 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
Rescheduled to 1.14.0 after 1.13.0 releasee