Opened 8 years ago

Closed 5 years ago

Last modified 3 years ago

#2190 closed enhancement (fixed)

Rename / Copy features missing in OMEdit

Reported by: casella Owned by: adrpo
Priority: critical Milestone:
Component: New Instantiation Version: trunk
Keywords: Cc: m.ceraolo@…, adrpo, perost, adeas31, dersh@…


A typical development pattern in Modelica is that one starts from an existing class (e.g., from the MSL, or from one's own package), makes a copy of it, then starts modifying it. In older releases of OMEdit (e.g., r14547), one could right-click on the model icon and select Copy (though this was not possible in the MSL, for some reason), but the feature didn't work correctly and was later removed.

It would be highly recommended to have it back in OMEdit, because it can save a lot of time when developing system models.

Also the Rename feature was available in the same context menu, even though it crashed OMC (see #2001 and #2116). It was later removed, but it would be good to have it back, it would be very bad if users needed to carry out this task manually on their library.

Note that both functions require refactoring the type names in the declarations, if the new/renamed class is in a different package. This might require implementing new API functions.

Change History (15)

comment:1 Changed 8 years ago by adrpo

The problem with rename is that we had some functionality which did this at the source code level (Absyn) but you don't really have enough information there to rename everything properly. You need to do dependency analysis and some sort of partial instantiation to find out what uses what.

I agree that this is highly needed and we should have it in mind for the new instantiation because you need to somehow feed that information back to the source code so you can do these kind of things (and not only this, conditional components and redeclares are needed too).

comment:2 Changed 8 years ago by adrpo

  • Cc adrpo perost added
  • Owner changed from adeas31 to adrpo
  • Status changed from new to accepted

This is not really an issue for OMEdit, is mostly for the front-end (Interactive and instantiation).

comment:3 Changed 8 years ago by adrpo

  • Component changed from OMEdit to New Instantiation

comment:4 Changed 8 years ago by

Renaming is fine if you assume the user fixes the dependencies

comment:5 Changed 8 years ago by casella

  • Cc adeas31 added

As a temporary solution, it would already be good if OMEdit allowed to copy or rename classes within the same package, which needs no dependency fixes. I guess this can be implemented easily.

When refactoring becomes available from the front end, cross-package copy/rename could also be added to OMEdit easily.

comment:6 Changed 8 years ago by casella

  • Milestone changed from Future to 1.9.1

comment:7 Changed 7 years ago by casella

  • Milestone changed from 1.9.1 to 1.9.2

comment:8 Changed 7 years ago by Adam Dershowitz <dersh@…>

  • Cc dersh@… added

comment:9 Changed 6 years ago by adeas31

In r23234 I have added a new copyClass API. It doesn't check any dependencies. The API should work fine for copying within the same package. However, the API does provide interface for copying the class to another package but the results might be wrong if the copied class has relative components.

comment:10 Changed 6 years ago by

  • Milestone changed from 1.9.2 to 1.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:11 Changed 6 years ago by

  • Milestone changed from 1.9.3 to 1.9.4

Moved to new milestone 1.9.4

comment:12 Changed 5 years ago by

  • Milestone changed from 1.9.4 to 1.9.5

Milestone pushed to 1.9.5

comment:13 Changed 5 years ago by

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:14 Changed 5 years ago by casella

  • Resolution set to fixed
  • Status changed from accepted to closed

A Copy feature has been implemented in OMEdit long time ago. I have opened a new ticket (#3915) for the Rename feature

comment:15 Changed 3 years ago by

  • Milestone 1.10.0 deleted

Milestone deleted

Note: See TracTickets for help on using tickets.