|
|
|
|
|
|
|
Re: Understanding the Web Services [message #1748015 is a reply to message #1747519] |
Thu, 17 November 2016 18:50   |
Karsten Wilken Messages: 59 Registered: August 2016 |
Member |
|
|
Thanks for your support.
At the moment I can't find the time to browse through the code but at least I can show you the html. I didn't change much yet.
<!DOCTYPE html>
<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="orion/code_edit/built-codeEdit.css"/>
<link rel="stylesheet" type="text/css" href="xtext/2.10.0/xtext-orion.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">
var baseUrl = window.location.pathname;
var fileIndex = baseUrl.indexOf("index.html");
if (fileIndex > 0)
baseUrl = baseUrl.slice(0, fileIndex);
require.config({
baseUrl: baseUrl,
paths: {
"text": "webjars/requirejs-text/2.0.15/text",
"jquery": "webjars/jquery/2.2.3/jquery.min",
"xtext/xtext-orion": "xtext/2.10.0/xtext-orion"
}
});
require(["orion/code_edit/built-codeEdit-amd"], function() {
require(["xtext/xtext-orion"], function(xtext) {
xtext.createEditor({
baseUrl: baseUrl,
syntaxDefinition: "xtext-resources/generated/create-syntax"
});
jQuery('#generate-button').bind("click", function(e){
jQuery('#generator-result').html('<iframe src="http://' + location.host + '/xtext-service/generate-all?resource=example1.create"></iframe>');
e.preventDefault();
});
});
});
</script>
</head>
<body>
<div class="container">
<div class="header">
<h1>Example Create Web Editor</h1>
</div>
<div class="content">
<div id="xtext-editor"
class="editor"
data-editor-xtext-lang="create"
data-editor-resource-id="example1.create"
>
</div>
<div class="button-wrapper">
<button id="generate-button" value="Generate" title="Generate">Generate</button>
<div id="generator-result">
Result
</div>
</div>
</div>
</div>
</body>
</html>
And almost the same css as the shipped example:
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: 100%;
}
#xtext-editor {
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 4px;
border: 1px solid #aaa;
width: 640px;
}
.button-wrapper {
border: 1px solid #aaa;
display: block;
left: 750px;
position: absolute;
width: 400px;
}
My problem while trying to fix the "not found" problems is that I can't place any text within the editor because it is not reachable. (most likely because of the existing errors). But therefore I can't give the editor code that could be generated.
To track down the issue I first commented the js parts and it still created the errors.
data-editor-resource-id="example1.create"
this is the central issue. As long as this snippet exists within the page, the errors occure. I haven't try to look into what orion tries to do with the tag. Maybe the orion related js already tries to "connect" or execute "something".
But that seems weird to do even before the editor could be manually written.
|
|
|
|
Re: Understanding the Web Services [message #1748022 is a reply to message #1748017] |
Thu, 17 November 2016 20:13   |
|
ps if you dont configure the editor to use a fixed content type and resource id you have to respect that in your stuff as well
require(["orion/code_edit/built-codeEdit-amd"], function() {
require(["xtext/xtext-orion"], function(xtext) {
var editor = xtext.createEditor({
baseUrl: baseUrl,
syntaxDefinition: "xtext-resources/generated/mydsl-syntax"
}).done(function(editorViewer) {
jQuery('#generate-button').bind("click", function(e){
var resource = editorViewer.xtextServices.options.resourceId;
var contentType=editorViewer.xtextServices.contentType;
jQuery('#generator-result').html('<iframe src="http://' + location.host + '/xtext-service/generate-all?resource='+resource+'&contentType='+contentType+'"></iframe>');
e.preventDefault();
});
});
});
});
Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
|
Re: Understanding the Web Services [message #1748222 is a reply to message #1748174] |
Mon, 21 November 2016 10:41   |
Karsten Wilken Messages: 59 Registered: August 2016 |
Member |
|
|
Ok. You only created a json output file to be displayed. How do I handle and pack java classes to (for example) a jar?
As far as I understand the Generator within Eclipse hierarchy it creates the java class files within the specified folder. I'm not sure how the ServiceDispatcher "connects" with the customized generator.
Edit:
And within the index.html I get a error:
ReferenceError: editorViewer is not defined
I also updated the repository.
[Updated on: Mon, 21 November 2016 12:37] Report message to a moderator
|
|
|
|
Re: Understanding the Web Services [message #1748251 is a reply to message #1748243] |
Mon, 21 November 2016 15:32   |
Karsten Wilken Messages: 59 Registered: August 2016 |
Member |
|
|
Yes I'm sure.
<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: {
"text": "webjars/requirejs-text/2.0.15/text",
"jquery": "webjars/jquery/2.2.3/jquery.min",
"xtext/xtext-orion": "xtext/2.10.0/xtext-orion"
}
});
require(["orion/code_edit/built-codeEdit-amd"], function() {
require(["xtext/xtext-orion"], function(xtext) {
var editor = xtext.createEditor({
baseUrl: baseUrl,
syntaxDefinition: "xtext-resources/generated/create-syntax"
}).done(function(editViewer) {
jQuery('#generate-button').bind("click", function(e) {
var resource = editorViewer.xtextServices.options.resourceId;
var contentType = editorViewer.xtextServices.contentType;
var fullText = editorViewer.xtextServices.editorContext.getText();
console.log(fullText);
var data = {
resource: resource,
fullText: fullText,
contextType: contentType
};
});
jQuery.post('http://localhost:8080/xtext-service/generate-all', data, function(result) {
jQuery("#generator-result").text(JSON.stringify(result));
});
});
});
});
</script>
Take a look at the respository. It is the same there.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03032 seconds