Skip to content

Latest commit

 

History

History
200 lines (179 loc) · 7.8 KB

examples.adoc

File metadata and controls

200 lines (179 loc) · 7.8 KB

Examples

.odesign Contents

Screenshot of fowlerdsl.odesign

exampleOdesign

fowlerdsl.odesign
platform:/resource/org.eclipse.xtext.example.fowlerdsl.viewpoint/description/fowlerdsl.odesign
	+ fowlerdsl
		+ Statemachine
			+ Statemachine Diagram
				+ Default
					+ TransitionEdge                                        (2)
							domainClass=statemachine.Transition
							labelDirectEdit=TransitionEdit
						+ Edge Style solid
							+ Center Label Style 8
								labelExpression="ocl:self.event.name.concat( ' as Label')"
					+ EventsContainer
						+ EventNode                                           (1)
								domainClass=statemachine.Event
								labelDirectEdit=EventEdit
							+ Square gray
								labelExpression="ocl:self.name.concat(if(self.guard.oclIsUndefined()) then '' else ' [' + self.guard.toString() + ']' endif)"
					+ CommandsContainer
					+ StateNode
						+ description                                         (3)
								domainClass=statemachine.State
								labelDirectEdit=DescriptionEdit
							+ square gray
								labelExpression="ocl:'Desc: '.concat(self.description)"
					+ Section DefaultSection
						+ Direct Edit Label SimpleTextEdit
						+ Xtext Model Direct Edit Label EventEdit             (1)
								id=EventEdit
								mapping=EventNode
								inputLabelExpression="var:self"
								injectorId="org.eclipse.xtext.example.fowlerdsl.viewpoint.fowlerdslInjectorId"
								lines=singleLine
							+ Begin
								+ Set
									featureName=«empty»
									+ valueExpression="var:newValue"
										External Java Action
											name="MyAction"
											id="exampleAction"
							+ ignoredNestedFeatures=guard.min
							+ selectedFeatures=Event.name
						+ Xtext Edge Model Direct Edit Label TransitionEdit   (2)
								id=TransitionEdit
								mapping=TransitionEdge
								inputLabelExpression="var:self"
								injectorId="org.eclipse.xtext.example.fowlerdsl.viewpoint.inlineEditInjectorId"
								edgeLabelMappings=Center Label Style 8
								lines=singleLine
								editableFeatures=Transition.event, Transition.guard
								prefixTerminalsExpression="aql:'['"
								suffixTerminalsExpression="zxcvzxcv"
							+ Begin
								+ Set
									featureName=«empty»
									valueExpression="var:newValue"
						+ Xtext Value Direct Edit Label DescriptionEdit       (3)
								id=DescriptionEdit
								mapping=description
								inputLabelExpression="feature:description"
								injectorId="org.eclipse.xtext.example.fowlerdsl.viewpoint.htmlInjectorId"
								lines=multiLine
								prefixTextExpression="<html><head><title>t</title></head><body>"
								suffixTextExpression="</body></html>"
							+ Begin
								+ Set description
									featureName=description
									valueExpression="var:newValue"
			+ org.eclipse.xtext.example.fowlerdsl.viewpoint.Services
		+ EventProperties
			+ Default
				+ Default12369
				+ EventProperties
						domainClass=statemachine.Event
					+ Name
					+ Guard                                                 (4)
							id=EventGuardId
							labelExpression="Guard"
							valueExpression="feature:guard"
							injectorId="org.eclipse.xtext.example.fowlerdsl.viewpoint.fowlerdslInjectorId"
						+ Begin
							+ Set guard
								featureName=guard
								valueExpression="var:newValue"
		+ StateProperties
			+ Default
				+ Defaultxvsdas
				+ StateProperties
						domainClass=statemachine.State
					+ Name
					+ Description                                           (5)
							id=StateDescriptionId
							labelExpression="Description"
							valueExpression="feature:description"
							lineCount=5
							injectorId="org.eclipse.xtext.example.fowlerdsl.viewpoint.htmlInjectorId"
							prefixTextExpression="<html><head><title>t</title></head><body>"
							suffixTextExpression="</body></html>"
						+ Begin
							+ Set description
								featureName=description
								valueExpression="var:newValue"
platform:/resource/org.eclipse.xtext.example.fowlerdsl/model/generated/Statemachine.ecore
  1. Single-line direct editor of all features of Event instance of Sirius element EventNode with the injector supplied by FowlerdslLanguageInjector. Changes to the nested feature Event.guard.min will be ignored. The feature Event.name is pre-selected when showing the Xtext editor. The External Java Action exampleAction is called after the semantic element has been edited. Persisted to itself because EventEdit.Set.featureName is empty.

    Event Label (note it does not show the code)

    eventLabel

    Event Editor

    eventEditor

  2. Single-line direct editor of features {Transition.event, Transition.guard} of Transition instance of the Center Label Style 8 label of Sirius element TransitionEdge with the injector supplied by InlineEditLanguageInjector. Persisted to itself because TransitionEdit.Set.featureName is empty.

    Transition Label (note it does have additional text at the end)

    transitionLabel

    Transition Editor (note the target of the transition cannot be edited)

    transitionEditor

  3. Multi-line direct editor of description feature of State instance of Sirius element description with the injector supplied by HtmlLanguageInjector. The attribute value will be prefixed by an HTML header and suffixed by an HTML footer. Persisted to State.description because of DescriptionEdit.Set.featureName=description.

    Description Label (note it does have additional text at the front)

    descriptionLabel

    Description Editor

    descriptionEditor

  4. Single-line property editor of guard feature of Event instance of Sirius element EventGuardId with the injector supplied by FowlerdslLanguageInjector. Persisted to Event.guard because of EventGuardId.Set.featureName=guard.

    Event Guard Property Editor

    guardProperty

  5. Multi-line property editor of description feature of State instance of Sirius element StateDescriptionId with the injector supplied by HtmlLanguageInjector. The attribute value will be prefixed by an HTML header and suffixed by an HTML footer. Persisted to State.description because of StateDescriptionId.Set.featureName=description.

    State Description Property Editor

    descriptionProperty

plugin.xml Contents

plugin.xml
<extension point="com.altran.general.integration.xtextsirius.runtime.xtextLanguageInjector">
	<injector
		id="org.eclipse.xtext.example.fowlerdsl.viewpoint.fowlerdslInjectorId"
		class="org.eclipse.xtext.example.fowlerdsl.viewpoint.xtextsirius.FowlerdslLanguageInjector"
	/>
	<injector
		id="org.eclipse.xtext.example.fowlerdsl.viewpoint.inlineEditInjectorId"
		class="org.eclipse.xtext.example.fowlerdsl.viewpoint.xtextsirius.InlineEditLanguageInjector"
	/>
	<injector
		id="org.eclipse.xtext.example.fowlerdsl.viewpoint.htmlInjectorId"
		class="org.eclipse.xtext.example.fowlerdsl.viewpoint.xtextsirius.HtmlLanguageInjector"
	/>
</extension>

Properties Views

Properties View of Xtext Model Direct Edit Label EventEdit

directEditModelProperties

Properties View of Xtext Edge Model Direct Edit Label TransitionEdit

edgeModelProperties

Properties View of Xtext Value Direct Edit Label DescriptionEdit

directEditValueProperties

Properties View of Xtext Model Text EventGuardId

singleLineModelWidgetProperties

Properties View of Xtext Value Text Area StateDescriptionId

multiLineValueWidgetProperties