Opened 6 years ago

Last modified 6 years ago

#4536 assigned defect

OMEdit fails to update relative class names to absolute ones upon duplicate

Reported by: dietmarw Owned by: perost
Priority: blocker Milestone: 2.0.0
Component: Interactive Environment Version:
Keywords: Cc: adrpo

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:

  1. 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
  2. Right click on Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_DOL and choose "duplicate"
  3. Select the "Test" package and click OK.
  4. 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)

copyClass.mos (235 bytes) - added by adeas31 6 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by dietmarw

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.

comment:2 follow-up: Changed 6 years ago by adeas31

  • Cc adrpo added
  • Component changed from OMEdit to Interactive Environment
  • Owner changed from adeas31 to perost
  • Status changed from new to assigned
  1. It is possible to leave the Path empty and OMEdit will create a new model/package but unfortunately it is not working since copyClass 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 in reply to: ↑ 2 Changed 6 years ago by perost

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 Changed 6 years ago by adrpo

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. See also #4372.

Last edited 6 years ago by adrpo (previous) (diff)

Changed 6 years ago by adeas31

comment:5 follow-up: Changed 6 years ago by adeas31

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 in reply to: ↑ 5 Changed 6 years ago by perost

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 Changed 6 years ago by dietmarw

Hi I got the same not working example as @adeas31. On Ubuntu 16.04 running nightly

comment:8 Changed 6 years ago by adeas31

@Per I will try to debug and see where it is failing.

comment:9 Changed 6 years ago by adeas31

It should work fine with 3d141a/OMCompiler.

comment:10 follow-up: Changed 6 years ago by 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.

Last edited 6 years ago by dietmarw (previous) (diff)

comment:11 in reply to: ↑ 10 Changed 6 years ago by adeas31

  • Milestone changed from 1.12.0 to 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.

Note: See TracTickets for help on using tickets.