Opened 7 years ago
Closed 6 years ago
#4799 closed defect (fixed)
Duplicate of packages is not working if not saved in one file
Reported by: | Owned by: | Adeel Asghar | |
---|---|---|---|
Priority: | high | Milestone: | 1.14.0 |
Component: | OMEdit | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: | Per Östlund |
Description
Please consider the following example. In OMEdit make a right click on Modelica.UsersGuide and pick Duplicate.
Name: UsersGuide
Path: (blank)
Uncheck: "Save contents in one file" in order to save folders and files.
Make a double click on the duplicate UsersGuide. When hitting CTRL+S to store the duplicated UsersGuide, nothing happens. One can even not select save from the File menu. By applying a right click on the duplicate UsersGuide, you can select save and that then saves UsersGuide. Select a directory to store the files...
After saving the UsersGuide, have a look at the stored code:
- In package.mo all underlying classes are stored (which was not intended by unchecking "Save contents in one file")
- In addition, folders and files have been created, mapping the structure of UsersGuide
Note: If the same procedure is performed when keeping "Save contents in one file" checked, the file seems to be stored correctly, but the following behavior remains...
Some more strange effects (which may be related to the fact that Modelica is a read only System Library and the duplicate may be assumed the be read only as well):
- Switch to Modeling with the intention to see Modelica code -- but there is no Text View to see the code of the duplicate UsersGuide...
- Make a right click on the duplicate UsersGuide and pick "View Text". Then the Text View of UsersGuide appears.
- Now try to edit code line in the Text View of UsersGuide. You get then the message:
Warning: You are changing a read-only class.
Attachments (2)
Change History (12)
comment:1 by , 7 years ago
Version: | → v1.13.0-dev-nightly |
---|
comment:2 by , 6 years ago
Milestone: | Future → 2.0.0 |
---|
comment:3 by , 6 years ago
Cc: | added |
---|
by , 6 years ago
comment:4 by , 6 years ago
I have tried to make a small example of the problem.
It seems the issue is when making a copy of the class the directory structure is not maintained.
comment:5 by , 6 years ago
Milestone: | 2.0.0 → 1.14.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in ed41047/OMEdit.
follow-up: 8 comment:6 by , 6 years ago
I have two additional comment to make on this ticket:
Issue 1
I duplicated Modelica.UsersGuide
selecting the option Directories for all. After the copy UsersGuide
is created I can save the package by making a right click on the package and picking Save.
When performing a double click on the copy of UsersGuide
Save is disabled from the file menu and the save button is disabled as well.
Tested on
OMEdit 1.14.0~dev-56-ge76522f Connected to OpenModelica 1.14.0~dev-387-g16b0256 Connected to OMSimulator unknown-linux
Issue 2
If I pick Keep structure when applying the copy, then some of the icons of the copied Modelica classes are not shown (see attachment), even thought the class names are all correct.
One more comment here: I am not sure if I understand Keep structure in this context correctly. What does that mean? If I make a copy then I will get a working copy which I can check with no errors, such that all class names are adapted, where necessary? If so, why is this Keep structure an alternative to
- One file,
- Directory and
- Directories for all?
In other words: Why can the user not pick whether he wants to store the copy in a directory structure or as a single file, if the structure is maintained?
This issue seems to be related with #5346.
by , 6 years ago
Attachment: | KeepStructure.png added |
---|
Keep structure causes not all icons to be shown
comment:7 by , 6 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:8 by , 6 years ago
Replying to Christian Kral <dr.christian.kral@…>:
I have two additional comment to make on this ticket:
Issue 1
I duplicated
Modelica.UsersGuide
selecting the option Directories for all. After the copyUsersGuide
is created I can save the package by making a right click on the package and picking Save.
When performing a double click on the copy of
UsersGuide
Save is disabled from the file menu and the save button is disabled as well.
Tested on
OMEdit 1.14.0~dev-56-ge76522f Connected to OpenModelica 1.14.0~dev-387-g16b0256 Connected to OMSimulator unknown-linux
This issue is related to #5337. It has nothing to do with the duplicate functionality. Double clicking on UsersGuide
will only show the documentation and doesn't open the class that is why the save buttons are disabled.
Issue 2
If I pick Keep structure when applying the copy, then some of the icons of the copied Modelica classes are not shown (see attachment), even thought the class names are all correct.
This issue will only happen when you first duplicate using Directories for all
and then unload the class and duplicate again with Keep structure
. It works fine if you restart OMEdit and duplicate with Keep structure
. Anyway I have fixed the issue in 888930a/OMEdit so it should work with the new nightly.
One more comment here: I am not sure if I understand Keep structure in this context correctly. What does that mean? If I make a copy then I will get a working copy which I can check with no errors, such that all class names are adapted, where necessary? If so, why is this Keep structure an alternative to
- One file,
- Directory and
- Directories for all?
In other words: Why can the user not pick whether he wants to store the copy in a directory structure or as a single file, if the structure is maintained?
This issue seems to be related with #5346.
Keep structure
maintains the file type (one file or directory) recursively. Consider the following package to understand it,
Package P => saved in P/package.mo Model M => saved in P/M.mo Package P1 => saved in P/P1.mo Model M1 => saved in P/P1.mo
If you choose Keep structure
you will get the same save structure.
If you choose Directories for all
when duplicating P
you will get,
Package P => saved in P/package.mo Model M => saved in P/M.mo Package P1 => saved in P/P1/package.mo Model M1 => saved in P/P1/M1.mo
comment:9 by , 6 years ago
Thanks for clarifying my questions. I also tested the icon issue and this is working OK now. So I think we can close this ticket.
comment:10 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This issue applies to
on a 64 bit Linux machine.