mirror of
https://github.com/Minres/RDL-Editor.git
synced 2025-07-01 13:33:27 +02:00
Migrated to XText 2.14 and Photon for RDL Editor RCP
This commit is contained in:
44
com.minres.rdl.parent/com.minres.rdl.web/WebRoot/index.html
Normal file
44
com.minres.rdl.parent/com.minres.rdl.web/WebRoot/index.html
Normal file
@ -0,0 +1,44 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<title>Example Web Editor</title>
|
||||
<link rel="stylesheet" type="text/css" href="xtext/2.14.0/xtext-ace.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
<script src="webjars/requirejs/2.3.2/require.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var baseUrl = window.location.pathname;
|
||||
var fileIndex = baseUrl.indexOf("index.html");
|
||||
if (fileIndex > 0)
|
||||
baseUrl = baseUrl.slice(0, fileIndex);
|
||||
require.config({
|
||||
baseUrl: baseUrl,
|
||||
paths: {
|
||||
"jquery": "webjars/jquery/2.2.4/jquery.min",
|
||||
"ace/ext/language_tools": "webjars/ace/1.2.3/src/ext-language_tools",
|
||||
"xtext/xtext-ace": "xtext/2.14.0/xtext-ace"
|
||||
}
|
||||
});
|
||||
require(["webjars/ace/1.2.3/src/ace"], function() {
|
||||
require(["xtext/xtext-ace"], function(xtext) {
|
||||
xtext.createEditor({
|
||||
baseUrl: baseUrl,
|
||||
syntaxDefinition: "xtext-resources/generated/mode-rdl"
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>Example RDL Web Editor</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div id="xtext-editor" data-editor-xtext-lang="rdl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
56
com.minres.rdl.parent/com.minres.rdl.web/WebRoot/style.css
Normal file
56
com.minres.rdl.parent/com.minres.rdl.web/WebRoot/style.css
Normal file
@ -0,0 +1,56 @@
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
font: 16px Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #22a;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: block;
|
||||
position: absolute;
|
||||
background-color: #e8e8e8;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 60px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 90px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 640px;
|
||||
}
|
||||
|
||||
#xtext-editor {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 4px;
|
||||
border: 1px solid #aaa;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
define(["ace/lib/oop", "ace/mode/text", "ace/mode/text_highlight_rules"], function(oop, mText, mTextHighlightRules) {
|
||||
var HighlightRules = function() {
|
||||
var keywords = "UNDEFINED|UNSPECIFIED|accesswidth|activehigh|activelow|addressing|addrmap|alias|alignment|all|anded|arbiter|async|bigendian|boolean|bothedge|bridge|clock|compact|component|counter|cpuif_reset|decr|decrsaturate|decrthreshold|decrvalue|decrwidth|default|desc|dontcompare|donttest|enable|encode|enum|errextbus|external|false|field|field_reset|fieldwidth|fullalign|halt|haltenable|haltmask|hw|hwclr|hwenable|hwmask|hwset|incr|incrvalue|incrwidth|internal|intr|level|littleendian|lsb0|mask|msb0|na|name|negedge|next|nonsticky|number|ored|overflow|posedge|precedence|property|r|rclr|ref|reg|regalign|regfile|regwidth|reset|resetsignal|rset|rsvdset|rsvdsetX|rw|saturate|shared|sharedextbus|signal|signalwidth|singlepulse|sticky|stickybit|string|sw|swacc|swmod|swwe|swwel|sync|threshold|true|type|underflow|w|we|wel|woclr|woset|wr|xored";
|
||||
this.$rules = {
|
||||
"start": [
|
||||
{token: "lparen", regex: "[\\[{]"},
|
||||
{token: "rparen", regex: "[\\]}]"},
|
||||
{token: "keyword", regex: "\\b(?:" + keywords + ")\\b"}
|
||||
]
|
||||
};
|
||||
};
|
||||
oop.inherits(HighlightRules, mTextHighlightRules.TextHighlightRules);
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = HighlightRules;
|
||||
};
|
||||
oop.inherits(Mode, mText.Mode);
|
||||
Mode.prototype.$id = "xtext/rdl";
|
||||
Mode.prototype.getCompletions = function(state, session, pos, prefix) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return {
|
||||
Mode: Mode
|
||||
};
|
||||
});
|
Reference in New Issue
Block a user