Change class element to interface element
Asked Answered
S

1

12

When modelling a class diagram the toolbox contains special objects for a class and for an interface. They differs by their icons which are shown in the Project Browser if they were added to a diagram. (Their properties seems to be the same.)

Is it possible to change an object which was created as class to an object of type interface? Or do I have to delete the class and create a new interface?

Sirotek answered 29/7, 2011 at 9:32 Comment(0)
I
26

In ancient versions of EA:

Yes, it's possible and quite simple.

Select the class and look at the Element Properties window (if it isn't visible, select it in the View menu). The Properties window has three branches: Class Settings (or Interface, etc), Project, and Advanced.

If you look under Class Settings, there's a field called Type with an ellipsis button (...). Select that, and you can change the element type to Interface or any other type you wish.

Be aware that you may need to double-check the element properties once you've changed the type. For instance, changing a simple Class to an Interface is pretty straightforward. If on the other hand you change an Interface to a Class, the class will be abstract (because an Interface is) and retain the "interface" stereotype.

In an EA available in 2023

Click on the class. On the right, there is a Properties dialog. Within this dialog is General pane with a Type line, with the value Class. Double-click on Class. A dialog pops up. In the Element Type dropdown, select Interface. Click OK. See notes above for the old EA about what to expect during the conversion process above.

screenshot illustrating the EA available in 2023 instructions

Insufficient answered 29/7, 2011 at 10:26 Comment(2)
Additionally you can also select the element in the diagram, and select the menu option Menu | Element | Advanced | Change Type... This option might be the safer one.Herbertherbicide
Moreover you go to Design tab on the ribbon → from Element section use Manage menu → select Change type.Ely

© 2022 - 2024 — McMap. All rights reserved.