Opened 12 years ago

Closed 9 years ago

Last modified 7 years ago

#2190 closed enhancement (fixed)

Rename / Copy features missing in OMEdit

Reported by: Francesco Casella Owned by: Adrian Pop
Priority: critical Milestone:
Component: New Instantiation Version: trunk
Keywords: Cc: m.ceraolo@…, Adrian Pop, Per Östlund, Adeel Asghar, dersh@…

Description

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 by Adrian Pop, 12 years ago

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 by Adrian Pop, 12 years ago

Cc: Adrian Pop Per Östlund added
Owner: changed from Adeel Asghar to Adrian Pop
Status: newaccepted

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

comment:3 by Adrian Pop, 12 years ago

Component: OMEditNew Instantiation

comment:4 by Martin Sjölund, 12 years ago

Renaming is fine if you assume the user fixes the dependencies

comment:5 by Francesco Casella, 12 years ago

Cc: Adeel Asghar 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 by Francesco Casella, 11 years ago

Milestone: Future1.9.1

comment:7 by Francesco Casella, 10 years ago

Milestone: 1.9.11.9.2

comment:8 by Adam Dershowitz <dersh@…>, 10 years ago

Cc: dersh@… added

comment:9 by Adeel Asghar, 10 years ago

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 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:11 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:12 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:13 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:14 by Francesco Casella, 9 years ago

Resolution: fixed
Status: acceptedclosed

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

comment:15 by Martin Sjölund, 7 years ago

Milestone: 1.10.0

Milestone deleted

Note: See TracTickets for help on using tickets.