This repository has been archived by the owner on Apr 21, 2023. It is now read-only.
/
ace-statemachine-static-multi.html
71 lines (67 loc) · 1.98 KB
/
ace-statemachine-static-multi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="en-us">
<title>Xtext-Web State Machine Example (Multiple Resources)</title>
<link rel="stylesheet" type="text/css" href="xtext/xtext-ace.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="webjars/requirejs/2.2.0/require.min.js"></script>
<script type="text/javascript">
require.config({
paths: {
"jquery": "webjars/jquery/2.2.3/jquery.min",
"ace/ext/language_tools": "webjars/ace/1.2.2/src/ext-language_tools"
}
});
require(["webjars/ace/1.2.2/src/ace"], function() {
require(["xtext/xtext-ace"], function(xtext) {
var editors = xtext.createEditor({
position: "absolute",
syntaxDefinition: "xtext/ace-mode-statemachine",
loadFromServer: false,
enableFormattingAction: true
});
var leftServices = editors[0].xtextServices;
var rightServices = editors[1].xtextServices;
leftServices.editorContext.addServerStateListener(function(params) {
if (!params.forceUpdate)
rightServices.update({forceUpdate: true});
});
rightServices.editorContext.addServerStateListener(function(params) {
if (!params.forceUpdate)
leftServices.update({forceUpdate: true});
});
});
});
</script>
</head>
<body>
<div class="container-left">
<div class="xtext-editor"
data-editor-resource-id="multi-resource-static/left-dummy.statemachine"
><pre>
/*
* A first State Machine resource.
*/
input signal x
input signal y
state State1
set z = false
if x == true goto State2
end</pre></div>
</div>
<div class="container-right">
<div class="xtext-editor"
data-editor-resource-id="multi-resource-static/right-dummy.statemachine"
><pre>
/*
* A second State Machine resource.
*/
output signal z
state State2
if x == false and y == true goto State1
end</pre></div>
</div>
</body>
</html>