Book a Demo

Author Topic: Cannot add a statemachine to a class  (Read 7457 times)

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Cannot add a statemachine to a class
« on: April 15, 2008, 06:30:41 pm »
Hi,

I cannot add a statemachine to a class, i.e. in the project browser I cannot drag the statemachine over a class. I receive an error message: "The requested move is not supported".
Is this a bug?

According to the UML Superstructure Specification, v2.1.2 (07-11-02), p.432, Class (from Communications) has an association to Behavior (from basicBehavior) that subsets Namespace::ownedElement. Since Statemachine specialises Behavior (from basicBehavior) it should be possible in my opinion.

Any hint/comment will be appreciated.

Thanks in advance,
Torsten

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #1 on: April 15, 2008, 09:44:07 pm »
Hi Torsten,

I think this is yet another EAUI situation, at least to a point. You have to do it the way EA wants, but you should be able to get the result you need.

Instead of dragging a state machine - or state chart, the phrasing will be clear in a moment - onto a class, EA 'adds' the chart in a different fashion.

Right-click the class, and from the context menu choose Add. You'll get a sub-menu. The bottom partition of the sub-menu will offer you a set of diagrams that can be added as 'children' of a class. State Machine is one of the options. When you click State Machine a new diagram is created 'below' the class (which you'll see in the Project Browser tree). You can now build your 'inner' state model for the class.

This paradigm is used throughout EA, with the lower partition of the Add sub-menu offering one or more options where EA 'thinks' the diagrams are relevant to the classifier you double-click. [Or no lower partition appearing if EA has no child diagram types to offer.]

You can also 'trick' EA into allowing other diagram types. Go through the above procedure - assuming EA will let you add a diagram at all - and then open the child diagram. From the main menu - there is no context menu for this - choose Diagram | Change Type, and you can now make the diagram anything you like.

HTH, David
No, you can't have it!

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #2 on: April 16, 2008, 05:57:11 am »
Hi David,

thanks for the quick response!
Unfortunately I do not want to add a state chart (which is a StateMachine Diagram according to title of the property dialog) but a StateMachine.
You can create a state machine by pressing ctrl+M on a diagram and then choosing “state machine” from the drop down box “Type”.

Best regards,
Torsten

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #3 on: April 16, 2008, 08:18:21 am »
Oops, my bad.

I'll leave the post up so people will know how to add a state chart if they want.
No, you can't have it!

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #4 on: April 16, 2008, 03:24:56 pm »
Maybe you got me wrong. I still don't know how to add the StateMachine to a class. I just explained how to create one.
My problem is that EA inserts the StateMachine into the package in which the diagram is contained but I want it to be "inside" a class (if that is possible).

Best regards,
Torsten

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #5 on: April 16, 2008, 03:29:53 pm »
The following worked for me:

1. Add a diagram to the class (Select it in the Project Browser and then click on the New Diagram button on the Project Browser Toolbar)
2. From the New Diagram dialog, select State Machine from the UML Behavioural section
3. Open the new diagram, and drag a State Machine onto it from the toolbox.
4. In the Project Browser, drag the newly created state machine from under the diagram, onto the class.
« Last Edit: April 16, 2008, 03:32:05 pm by mfraser »
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #6 on: April 16, 2008, 04:42:11 pm »
Hello Michael,

thanks for your reply.
I cannot drag a state machine onto the diagram (step 3), because there is no state machine button in the folder "State" of the toolbox. If I add the state machine using Ctrl+M, EA inserts the state machine next to the class but not under the diagram (which is under the class).

Package1
   !
   +-- Class1
   !     !
   !     +-- Diagram1
   !
   +-- StateMachine1


If I drag the state machine onto the class (step 4) I receive an error message: "The requested move is not supported".
I am using EA, version 6.5.804.

Essentially I want to create an extended state machine for a Class2 (which specializes Class1) as shown in figure 15.43 of the UML specification (formal/2007-11-02). Maybe I am on the wrong track.

Thanks in advance and best regards,
Torsten

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #7 on: April 16, 2008, 05:15:22 pm »
Hi again Torsten,

The problem must have been fixed in a later build of EA. I am able to get the following hierachy

Package1
  !
  +-- Class1
  !     !
  !     +-- Diagram1
  !     !
  !     +-- StateMachine

I'd reccomend trying this with a more recent build of Enterprise Architect (the latest build 828 is available from http://www.sparxsystems.com/registered/reg_ea_down.html). If you're not a registered user, then please feel free to download a trial version of EA build 828 and see if that fixes your problems.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Cannot add a statemachine to a class
« Reply #8 on: April 16, 2008, 05:54:30 pm »
Okay!

Thanks for your help,
Torsten