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:

  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 Adeel Asghar 7 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Dietmar Winkler, 7 years ago

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 by Adeel Asghar, 7 years ago

Cc: Adrian Pop added
Component: OMEditInteractive Environment
Owner: changed from Adeel Asghar to Per Östlund
Status: newassigned
  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?

in reply to:  2 comment:3 by Per Östlund, 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 Adrian Pop, 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.

Version 1, edited 7 years ago by Adrian Pop (previous) (next) (diff)

by Adeel Asghar, 7 years ago

Attachment: copyClass.mos added

comment:5 by Adeel Asghar, 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.

in reply to:  5 comment:6 by Per Östlund, 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 Dietmar Winkler, 7 years ago

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

comment:8 by Adeel Asghar, 7 years ago

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

comment:9 by Adeel Asghar, 7 years ago

It should work fine with 3d141a/OMCompiler.

comment:10 by Dietmar Winkler, 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.

Last edited 7 years ago by Dietmar Winkler (previous) (diff)

in reply to:  10 comment:11 by Adeel Asghar, 7 years ago

Milestone: 1.12.02.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.