From e3043fddcaf5e3ea4beb022c04d411661a3499bd Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Tue, 14 Mar 2017 14:27:13 +0000 Subject: [PATCH] Syntax-Check fuer Java, Gutter Marker fuer Fehler, Tooltips fuer Fehlermeldungen --- web/ui/ui.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/web/ui/ui.js b/web/ui/ui.js index 6e52b6a..997e9ee 100644 --- a/web/ui/ui.js +++ b/web/ui/ui.js @@ -31,6 +31,7 @@ var loc; var PERS_DIR = "Persoenlich"; var PUB_DIR = "Oeffentlich"; +var compilerIssues; function fm_init() { $("#mce-editor").hide(); @@ -57,6 +58,7 @@ $('#m-paste').on('click', fm_menu_paste); $('#m-shrink').on('click', fm_menu_shrink); $('#m-test').on('click', fm_menu_test); + $('#m-test-2').on('click', fm_menu_test_2); $('#saveModal').on('hidden.bs.modal', function (e) { $('#modal_ok').attr('onclick','').unbind('click'); }); @@ -139,6 +141,7 @@ */ tinymce.init({ content_css : "/file-cms/ui/mce.css", + //content_css: "/jslib/bootstrap/css/bootstrap.min.css", selector: "textarea.text-editor", statusbar: false, menubar: false, @@ -273,6 +276,31 @@ $('.ost').empty(); $('.ost').width(0); } +} + +function fm_menu_test_2() { + var liste = fm_gewaehlte_dateien(); + var m = '?c=de.uhilger.filecms.api.CompileService&m=compile&p=' + pfad + '&p=' + encodeURIComponent(liste); + var u = '../svc' + m; + fm_get(u, "json", function(resp) { + cm.clearGutter("breakpoints"); + + if(resp.List[0].CompilerIssue !== undefined) { + if(resp.List[0].CompilerIssue instanceof Array) { + var issueNo = 0; + while(issueNo < resp.List[0].CompilerIssue.length) { + // console.log(resp.List[0].CompilerIssue[issueNo].kind); + // console.log(resp.List[0].CompilerIssue[issueNo].lineNumber); + // console.log(resp.List[0].CompilerIssue[issueNo].sourceName); + // console.log(resp.List[0].CompilerIssue[issueNo].message); + fm_set_code_marker(resp.List[0].CompilerIssue[issueNo].lineNumber, resp.List[0].CompilerIssue[issueNo].kind + ' ' + resp.List[0].CompilerIssue[issueNo].message); + issueNo++; + } + } else { + fm_set_code_marker(resp.List[0].CompilerIssue.lineNumber, resp.List[0].CompilerIssue.kind + ' ' + resp.List[0].CompilerIssue.message); + } + } + }); } function fm_ansicht_umschalten() { @@ -831,8 +859,10 @@ function fm_code_edit(content, m) { cm = CodeMirror.fromTextArea(document.getElementById("editspace"), { lineNumbers: true, + gutters: ["CodeMirror-linenumbers", "breakpoints"], mode: m, viewportMargin : Infinity, + tabSize: 2, extraKeys: { "F9": function(cm) { cm.setOption("fullScreen", !cm.getOption("fullScreen")); @@ -846,6 +876,30 @@ //cm.setValue(content); cm.setValue(unescapeHtml(content)); cm.getDoc().markClean(); + cm.on("gutterClick", function(theEditor, lineNumber) { + var info = theEditor.lineInfo(lineNumber); + //--lineNumber; + //console.log(info.gutterMarkers.breakpoints.message); + //var marker = info.gutterMarkers.breakpoints; + //$(marker).tooltip('toggle'); + }); +} + +function fm_set_code_marker(lineNumber, message) { + cm.setGutterMarker(lineNumber-1, "breakpoints", makeMarker(message)); +} + +function makeMarker(msg) { + var marker = document.createElement("div"); + marker.style.color = "#822"; + marker.innerHTML = "●"; + //marker.message = msg; + $(marker).tooltip({ + placement: 'right', + title: msg, + offset: '10 -10' + }); + return marker; } -- Gitblit v1.9.3