Visual Studio DSL entry 10-complete state machine case study

Source: Internet
Author: User

In the first two sections, we have completed metadata creation and partial graphical representation of the state machine. If you have used a running state machine designer, you will find many problems. in this section, we mainly improve our state machine instances, including metadata and graphical symbols.

Complete
1. in the running environment, you will find that the selected item text displayed in the left-side toolbox is still automatically generated lanaguesm, and we need to change it to statemachine. enable dsldefinition. after the DSL file is opened, open DSL explorer and find the languagesm/Editor/toolbox tabs/languagesm node. Modify the tab text value in the languagesm attribute to statemachine.

2. view the transition attribute in the running environment and you will find that all attributes belong to the miscellaneous (MISC) group, which is generated by default and has no practical significance. modify the value of the four domain attributes event, condition, action, and label of the domain class transition to transition. run the command again to view the effect. You can also classify the State attributes.

3. In the state machine debugging environment, you will find the languagesm explorer on the right side, which is the same as our DSL explorer.

We need to change the languagesm here to state machine explorer. Open our DSL file and then open DSL explorer. Modify the attribute value of the explorer behavior node as follows:

 

Let's take a closer look at the modified state machine explorer.

How does one display entry action and exit action under entry actions and exit actions of state2? They are not switchon and switchoff in our class diagram, that is, they are not the values of our label attribute, you also need to set here, find the domain action, and modify the value of the attribute "is element name" of the domain attribute label to true. [for each domain class, it is best to set the is element name = true of an attribute, which plays a role in display and serialization]. run the command again to view the effect:


Now, you can generate the entire file to check the running effect:

However, after running the tool, you can find that the Toolbox on the left still contains javasagesm. There are two solutions:
1. Right-click Export agesm and choose delete from the shortcut menu.
2. find your vs SDK from the beginning -- program, and there is a reset the Microsoft Visual Studio 2008 SP1 experimental hive under tools to reset the lab environment. This function is frequently used in DSL development, you can reset the vs.net lab environment so that you can register information again.

Code download

 

Reference resources
1. Development Guide for specific fields of visual stuido DSL tools
2. dsl tools lab http://code.msdn.microsoft.com/DSLToolsLab series tutorial [this series of entry cases of the main reference]

Author: lone knight (like a year of water)
Source: http://lonely7345.cnblogs.com/
The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.