Opened 7 years ago
Last modified 7 years ago
#4536 assigned defect
OMEdit fails to update relative class names to absolute ones upon duplicate
Reported by: | Dietmar Winkler | Owned by: | Per Östlund |
---|---|---|---|
Priority: | blocker | Milestone: | 2.0.0 |
Component: | Interactive Environment | Version: | |
Keywords: | Cc: | Adrian Pop |
Description
I noticed that when one duplicates a class or package of classes and the new location is outside the current level, OMEdit will not update the class references contained in the classes to be duplicated. This renders them simply useless.
Example:
- Create a new package "Test" on top level. This actually is another bug that one needs a top-level package. Normally one should be able to create a new model/package also on top-level via duplicate
- Right click on
Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_DOL
and choose "duplicate" - Select the "Test" package and click OK.
- Open the newly duplicated package and notice that several components are broken since they were originally using relative references that are not updated when duplicating them.
This is actually quite sever since I teach beginners to play around with existing examples from the MSL. And the only way to do changes to them is to duplicate them and then change parameters etc.
Attachments (1)
Change History (12)
comment:1 by , 7 years ago
follow-up: 3 comment:2 by , 7 years ago
Cc: | added |
---|---|
Component: | OMEdit → Interactive Environment |
Owner: | changed from | to
Status: | new → assigned |
- It is possible to leave the
Path
empty and OMEdit will create a new model/package but unfortunately it is not working sincecopyClass
API is failing. I got this,
copyClass(Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_DOL,"AIMC_DOL",TopLevel) false errors:=getMessagesStringInternal() {}
@Per Can you test why its failing. Also can we update the relative class names or is it too difficult?
comment:3 by , 7 years ago
Replying to adeas31:
@Per Can you test why its failing. Also can we update the relative class names or is it too difficult?
Your copyClass call works fine for me (after loading Modelica of course), so I can't replicate that. And yes, updating relative class names is very difficult (and very slow) with the current frontend, but should be much easier with the new frontend.
comment:4 by , 7 years ago
Note that one needs to warn the user when a relative path loses modifiers if it becomes absolute. This can happen rather easily with relative replaceable classes.
by , 7 years ago
Attachment: | copyClass.mos added |
---|
follow-up: 6 comment:5 by , 7 years ago
The output of attached script is,
$ /c/OpenModelica/build/bin/omc.exe copyClass.mos true "" {ModelicaServices,Complex,Modelica} "" false "" {ModelicaServices,Complex,Modelica} ""
Unfortunately it is not working on my machine.
comment:6 by , 7 years ago
Replying to adeas31:
The output of attached script is, ...
I get the following:
true "" {ModelicaServices,Complex,Modelica} "" true "" {AIMC_DOL,ModelicaServices,Complex,Modelica} ""
So I've got no clue why it's not working for you.
comment:7 by , 7 years ago
Hi I got the same not working example as @adeas31. On Ubuntu 16.04 running nightly
follow-up: 11 comment:10 by , 7 years ago
The creation of Top-level classes works fine, the updating of relative class links upon duplication is still not working as of
OMEdit 1.13.0~dev-12-gbc6e188
Connected to OpenModelica 1.13.0~dev-152-gcaa7ad4
Which is today's nightly build. I'm not sure if the "fix" commit is supposed to be already part of that.
comment:11 by , 7 years ago
Milestone: | 1.12.0 → 2.0.0 |
---|
Replying to dietmarw:
The creation of Top-level classes works fine, the updating of relative class links upon duplication is still not working as of
OMEdit 1.13.0~dev-12-gbc6e188
Connected to OpenModelica 1.13.0~dev-152-gcaa7ad4
Which is today's nightly build. I'm not sure if the "fix" commit is supposed to be already part of that.
The commit is a fix for duplicating the classes on Top-level.
For updating the relative class links we need to wait for the new frontend so I am changing the milestone of this ticket.
A simple and universally working solution would be to always replace the class references with absolute ones. Best starting with
.Modelica
in case of MSL. Not the nicest in the code but at least it works and beginners don't get scared off.