clearwing

changeset 153:247a3397e065 1.3.3-stv-gwt

..
author Stelios <stv@roe.ac.uk>
date Fri Apr 08 15:17:43 2016 +0300 (2016-04-08)
parents 9899f9900ad2
children 4ff34b27b051
files src/GENIUS-gwt-app/public/adql_syntax/adql.js src/GENIUS-gwt-app/public/adql_syntax/tap-autocomplete.js src/GENIUS-gwt-app/public/adql_syntax/tap-hint.js src/GENIUS-gwt-app/war/WEB-INF/classes/adql_syntax/tap-autocomplete.js src/GENIUS-gwt-app/war/WEB-INF/classes/adql_syntax/tap-hint.js src/GENIUS-gwt-app/war/WEB-INF/classes/com/genius/uk/Genius.gwt.xml src/GENIUS-gwt-app/war/WEB-INF/classes/com/genius/uk/server/GreetingServiceImplAsync.class src/GENIUS-gwt-app/war/WEB-INF/web.xml src/GENIUS-gwt-app/war/genius/adql_syntax/adql.js src/GENIUS-gwt-app/war/genius/adql_syntax/tap-autocomplete.js src/GENIUS-gwt-app/war/genius/adql_syntax/tap-hint.js
line diff
     1.1 --- a/src/GENIUS-gwt-app/public/adql_syntax/adql.js	Thu Apr 07 02:35:42 2016 +0300
     1.2 +++ b/src/GENIUS-gwt-app/public/adql_syntax/adql.js	Fri Apr 08 15:17:43 2016 +0300
     1.3 @@ -107,6 +107,7 @@
     1.4    }
     1.5  
     1.6    return {
     1.7 +	 
     1.8      startState: function(base) {
     1.9        return {tokenize: tokenBase,
    1.10                context: null,
     2.1 --- a/src/GENIUS-gwt-app/public/adql_syntax/tap-autocomplete.js	Thu Apr 07 02:35:42 2016 +0300
     2.2 +++ b/src/GENIUS-gwt-app/public/adql_syntax/tap-autocomplete.js	Fri Apr 08 15:17:43 2016 +0300
     2.3 @@ -29,24 +29,19 @@
     2.4      this.istap = true;
     2.5    }
     2.6  
     2.7 -  if (typeof availableTags !== 'undefined') {
     2.8 -    availableTags = [];
     2.9 -  }
    2.10  
    2.11 -
    2.12 -  if (editor == null && !jQuery('.CodeMirror').length > 0) {
    2.13 +  if (this.editor == null && !jQuery('.CodeMirror').length > 0) {
    2.14      CodeMirror.commands.autocomplete = function(cm) {
    2.15        CodeMirror.tapHint(cm, CodeMirror.adqlHint, {
    2.16          webServicePath: params.web_service_path,
    2.17          tapResource: params.tap_resource,
    2.18          useAutocompleteService: (params.servicemode.toLowerCase() == "tap"),
    2.19 -	autocompleteLoader: params.autocomplete_loader_id,
    2.20 +	    autocompleteLoader: params.autocomplete_loader_id,
    2.21          autocompleteInfo: params.autocomplete_info_id,
    2.22 -       
    2.23        });
    2.24      }
    2.25  
    2.26 -    var editor = CodeMirror.fromTextArea(document.getElementById(params.textfieldid), {
    2.27 +   this.editor = CodeMirror.fromTextArea(document.getElementById(params.textfieldid), {
    2.28        mode: "text/x-adql",
    2.29        tabMode: "indent",
    2.30        lineNumbers: true,
    2.31 @@ -60,6 +55,13 @@
    2.32      });
    2.33    }
    2.34  
    2.35 +  if (typeof this.editor.availableTags == 'undefined') {
    2.36 +	  this.editor.availableTags = [
    2.37 +     		"SELECT", "FROM", "ORDER BY","WHERE", "TOP","IN", "AND", "OR", "WITH", "DESC", "ASC", "JOIN", "AS", "HAVING", "ABS",
    2.38 + 			"GROUP","BY", "INNER","OUTER","CROSS","LEFT","RIGHT","FULL","ON","USING","MIN","MAX","COUNT","DISTINCT","ALL","LIKE","ACOS","ASIN","ATAN","ATAN2","COS","SIN","TAN","COT","IS","NOT","NULL","NATURAL","EXISTS","BETWEEN","AREA","BOX","CENTROID","CIRCLE","CONTAINS","COORD1","COORD2","COORDSYS","DISTANCE","INTERSECTS","POINT","POLYGON","REGION"
    2.39 + 		];
    2.40 +  }
    2.41 +
    2.42    if (params.servicemode.toLowerCase() == "tap") {
    2.43      this.load_metadata_for_autocomplete(this.initial_catalogues);
    2.44    } else {
    2.45 @@ -74,9 +76,6 @@
    2.46   *
    2.47   */
    2.48  TapAutocomplete.prototype.push_metadata_content_html = function(data) {
    2.49 -  if (typeof availableTags !== 'undefined') {
    2.50 -    availableTags = [];
    2.51 -  }
    2.52  
    2.53    var content = document.createElement('div');
    2.54    content.innerHTML = data;
    2.55 @@ -86,12 +85,12 @@
    2.56      var str = jQuery.trim(jQuery(tr[i]).justtext());
    2.57      var arr = str.split(".");
    2.58      for (var y = 0; y < arr.length; y++) {
    2.59 -      availableTags.push(arr[y]);
    2.60 +    	this.editor.availableTags.push(arr[y]);
    2.61      }
    2.62    }
    2.63    for (var i = 0; i < tr2.length; i++) {
    2.64 -    if (!contains(availableTags, tr2[i].innerHTML)) {
    2.65 -      availableTags.push(tr2[i].innerHTML);
    2.66 +    if (!contains(this.editor.availableTags, tr2[i].innerHTML)) {
    2.67 +    	this.editor.availableTags.push(tr2[i].innerHTML);
    2.68      }
    2.69    }
    2.70  
    2.71 @@ -105,15 +104,13 @@
    2.72   */
    2.73  
    2.74  TapAutocomplete.prototype.push_metadata_json = function(data) {
    2.75 -  if (typeof availableTags !== 'undefined') {
    2.76 -    availableTags = [];
    2.77 -  }
    2.78 +  
    2.79    if (data.length > 0) {
    2.80      for (var i = 0; i < data.length; i++) {
    2.81        var str = jQuery.trim(data[i]);
    2.82        var arr = str.split(".");
    2.83        for (var y = 0; y < arr.length; y++) {
    2.84 -        availableTags.push(arr[y]);
    2.85 +    	  this.editor.availableTags.push(arr[y]);
    2.86        }
    2.87      }
    2.88    }
    2.89 @@ -193,8 +190,8 @@
    2.90    }
    2.91  
    2.92    function push_metadata_content_html(data) {
    2.93 -    if (typeof availableTags !== 'undefined') {
    2.94 -       availableTags = [];
    2.95 +	if (!_this.editor.availableTags) {
    2.96 +		_this.editor.availableTags = [];
    2.97      }
    2.98  
    2.99      var content = document.createElement('div');
   2.100 @@ -205,13 +202,13 @@
   2.101        var str = jQuery.trim(jQuery(tr[i]).text());
   2.102        var arr = str.split(".");
   2.103        for (var y = 0; y < arr.length; y++) {
   2.104 -       availableTags.push(arr[y]);
   2.105 +    	  _this.editor.availableTags.push(arr[y]);
   2.106        }
   2.107      }
   2.108  
   2.109      for (var i = 0; i < tr2.length; i++) {
   2.110 -      if (!contains(availableTags, tr2[i].innerHTML)) {
   2.111 -        availableTags.push(tr2[i].innerHTML);
   2.112 +      if (!contains(_this.editor.availableTags, tr2[i].innerHTML)) {
   2.113 +    	  _this.editor.availableTags.push(tr2[i].innerHTML);
   2.114        }
   2.115      }
   2.116  
   2.117 @@ -233,6 +230,7 @@
   2.118  
   2.119      },
   2.120      success: function(data) {
   2.121 +
   2.122        if (data != "") {
   2.123         push_metadata_content_html(data);
   2.124        }
   2.125 @@ -259,19 +257,17 @@
   2.126  
   2.127  
   2.128    function push_metadata_json(data) {
   2.129 -    if (typeof availableTags !== 'undefined') {
   2.130 -       availableTags = [];
   2.131 -    }
   2.132      if (data.length > 0) {
   2.133        for (var i = 0; i < data.length; i++) {
   2.134          var str = jQuery.trim(data[i]);
   2.135          var arr = str.split(".");
   2.136          for (var y = 0; y < arr.length; y++) {
   2.137 -          availableTags.push(arr[y]);
   2.138 +        	_this.editor.availableTags.push(arr[y]);
   2.139          }
   2.140        }
   2.141      }
   2.142  
   2.143 +
   2.144    }
   2.145  
   2.146    optional_catalogues=JSON.stringify(optional_catalogues);
   2.147 @@ -286,18 +282,16 @@
   2.148      },
   2.149      url: _this.web_service_path,
   2.150      timeout: 1000000,
   2.151 -    error: function() {
   2.152 +    error: function(e) {
   2.153        if (_this.autocomplete_info) jQuery("#" + _this.autocomplete_info).html("CTRL + Space to activate auto-complete");
   2.154        if (_this.autocomplete_loader) jQuery("#" + _this.autocomplete_loader).hide();
   2.155 -
   2.156      },
   2.157      success: function(data) {
   2.158 +
   2.159 +
   2.160        if (data != "") {
   2.161 -        var temparray = jQuery.parseJSON(data);
   2.162 -        push_metadata_json(temparray);
   2.163 -
   2.164 +        push_metadata_json(data);
   2.165        }
   2.166 -
   2.167        if (_this.autocomplete_info) jQuery("#" + _this.autocomplete_info).html("CTRL + Space to activate auto-complete");
   2.168        if (_this.autocomplete_loader) jQuery("#" + _this.autocomplete_loader).hide();
   2.169      }
     3.1 --- a/src/GENIUS-gwt-app/public/adql_syntax/tap-hint.js	Thu Apr 07 02:35:42 2016 +0300
     3.2 +++ b/src/GENIUS-gwt-app/public/adql_syntax/tap-hint.js	Fri Apr 08 15:17:43 2016 +0300
     3.3 @@ -41,6 +41,16 @@
     3.4      if (givenOptions["autocompleteLoader"]) editor.autocompleteLoader = givenOptions["autocompleteLoader"];
     3.5      if (givenOptions["autocompleteInfo"]) editor.autocompleteInfo = givenOptions["autocompleteInfo"];
     3.6      if (givenOptions["useAutocompleteService"]) editor.useAutocompleteService = givenOptions["useAutocompleteService"];
     3.7 +    if (givenOptions["availableTags"]){
     3.8 +    	editor.availableTags = givenOptions["availableTags"];
     3.9 +    } else {
    3.10 +    	if (!editor.availableTags){
    3.11 +    	    editor.availableTags = [
    3.12 +    	              		"SELECT", "FROM", "ORDER BY","WHERE", "TOP","IN", "AND", "OR", "WITH", "DESC", "ASC", "JOIN", "AS", "HAVING", "ABS",
    3.13 +    	          			"GROUP","BY", "INNER","OUTER","CROSS","LEFT","RIGHT","FULL","ON","USING","MIN","MAX","COUNT","DISTINCT","ALL","LIKE","ACOS","ASIN","ATAN","ATAN2","COS","SIN","TAN","COT","IS","NOT","NULL","NATURAL","EXISTS","BETWEEN","AREA","BOX","CENTROID","CIRCLE","CONTAINS","COORD1","COORD2","COORDSYS","DISTANCE","INTERSECTS","POINT","POLYGON","REGION"
    3.14 +    	          		];
    3.15 +    	}
    3.16 +    }
    3.17  
    3.18      for (var opt in defaults)
    3.19        if (defaults.hasOwnProperty(opt)) {
    3.20 @@ -49,6 +59,7 @@
    3.21  
    3.22  
    3.23      function collectHints(previousToken) {
    3.24 +
    3.25        // We want a single cursor position.
    3.26        if (editor.somethingSelected()) return;
    3.27  
    3.28 @@ -59,8 +70,8 @@
    3.29          (tempToken.start != previousToken.start || tempToken.type != previousToken.type)) {
    3.30          return;
    3.31        }
    3.32 -
    3.33        var result = getHints(editor, givenOptions);
    3.34 +      console.log(result);
    3.35        if (!result || !result.list.length) return;
    3.36        var completions = result.list;
    3.37  
    3.38 @@ -176,7 +187,6 @@
    3.39    function getCompletionsAdql(token, context, keywords, options, editor, optional_keyword) {
    3.40  
    3.41      optional_keyword = (typeof optional_keyword === 'undefined') ? '' : optional_keyword;
    3.42 -
    3.43      var found = [],
    3.44        start = token.string;
    3.45  
    3.46 @@ -186,9 +196,9 @@
    3.47      }
    3.48  
    3.49      function gatherCompletions(obj) {
    3.50 -      if (typeof obj == "string") forEach(availableTags, maybeAdd);
    3.51 -      else if (obj instanceof Array) forEach(availableTags, maybeAdd);
    3.52 -      else if (obj instanceof Function) forEach(availableTags, maybeAdd);
    3.53 +      if (typeof obj == "string") forEach(editor.availableTags, maybeAdd);
    3.54 +      else if (obj instanceof Array) forEach(editor.availableTags, maybeAdd);
    3.55 +      else if (obj instanceof Function) forEach(editor.availableTags, maybeAdd);
    3.56        for (var name in obj) maybeAdd(name);
    3.57      }
    3.58  
    3.59 @@ -268,8 +278,7 @@
    3.60        },
    3.61        success: function(data) {
    3.62          if (data != "") {
    3.63 -          var tables = jQuery.parseJSON(data);
    3.64 -          pushMetadataJson(tables, tags, parentText, keyword);
    3.65 +          pushMetadataJson(data, tags, parentText, keyword);
    3.66          }
    3.67  
    3.68          if (editor.autocompleteInfo) jQuery("#" + editor.autocompleteInfo).html("CTRL + Space to activate auto-complete");
    3.69 @@ -291,11 +300,10 @@
    3.70  
    3.71        if (str.toLowerCase().indexOf(start.toLowerCase()) == 0 && !jsArrayContains(found, str)) found.push(str);
    3.72      }
    3.73 -
    3.74      function gatherCompletions(obj) {
    3.75 -      if (typeof obj == "string") forEach(availableTags, maybeAdd);
    3.76 -      else if (obj instanceof Array) forEach(availableTags, maybeAdd);
    3.77 -      else if (obj instanceof Function) forEach(availableTags, maybeAdd);
    3.78 +      if (typeof obj == "string") forEach(editor.availableTags, maybeAdd);
    3.79 +      else if (obj instanceof Array) forEach(editor.availableTags, maybeAdd);
    3.80 +      else if (obj instanceof Function) forEach(editor.availableTags, maybeAdd);
    3.81        for (var name in obj) maybeAdd(name);
    3.82      }
    3.83  
    3.84 @@ -337,6 +345,7 @@
    3.85  
    3.86  
    3.87    function scriptHint(editor, keywords, getToken, options) {
    3.88 +
    3.89      // Find the token at the cursor
    3.90      var cur = editor.getCursor(),
    3.91      token = getToken(editor, cur),
    3.92 @@ -418,7 +427,6 @@
    3.93        context.push(tprop);
    3.94  
    3.95      }
    3.96 -
    3.97      if (editor.useAutocompleteService != true) {
    3.98  
    3.99        return {
   3.100 @@ -451,7 +459,7 @@
   3.101    }
   3.102  
   3.103    CodeMirror.adqlHint = function(editor, options) {
   3.104 -    return scriptHint(editor, availableTags,
   3.105 +    return scriptHint(editor, editor.availableTags,
   3.106        function(e, cur) {
   3.107          return e.getTokenAt(cur);
   3.108        },
     4.1 --- a/src/GENIUS-gwt-app/war/WEB-INF/classes/adql_syntax/tap-autocomplete.js	Thu Apr 07 02:35:42 2016 +0300
     4.2 +++ b/src/GENIUS-gwt-app/war/WEB-INF/classes/adql_syntax/tap-autocomplete.js	Fri Apr 08 15:17:43 2016 +0300
     4.3 @@ -29,7 +29,7 @@
     4.4      this.istap = true;
     4.5    }
     4.6  
     4.7 -  if (typeof availableTags !== 'undefined') {
     4.8 +  if (typeof availableTags == 'undefined') {
     4.9      availableTags = [];
    4.10    }
    4.11  
    4.12 @@ -74,7 +74,7 @@
    4.13   *
    4.14   */
    4.15  TapAutocomplete.prototype.push_metadata_content_html = function(data) {
    4.16 -  if (typeof availableTags !== 'undefined') {
    4.17 +  if (typeof availableTags == 'undefined') {
    4.18      availableTags = [];
    4.19    }
    4.20  
    4.21 @@ -105,7 +105,8 @@
    4.22   */
    4.23  
    4.24  TapAutocomplete.prototype.push_metadata_json = function(data) {
    4.25 -  if (typeof availableTags !== 'undefined') {
    4.26 +  
    4.27 +  if (typeof availableTags == 'undefined') {
    4.28      availableTags = [];
    4.29    }
    4.30    if (data.length > 0) {
    4.31 @@ -193,7 +194,7 @@
    4.32    }
    4.33  
    4.34    function push_metadata_content_html(data) {
    4.35 -    if (typeof availableTags !== 'undefined') {
    4.36 +    if (typeof availableTags == 'undefined') {
    4.37         availableTags = [];
    4.38      }
    4.39  
    4.40 @@ -233,6 +234,7 @@
    4.41  
    4.42      },
    4.43      success: function(data) {
    4.44 +
    4.45        if (data != "") {
    4.46         push_metadata_content_html(data);
    4.47        }
    4.48 @@ -259,7 +261,7 @@
    4.49  
    4.50  
    4.51    function push_metadata_json(data) {
    4.52 -    if (typeof availableTags !== 'undefined') {
    4.53 +    if (typeof availableTags == 'undefined') {
    4.54         availableTags = [];
    4.55      }
    4.56      if (data.length > 0) {
    4.57 @@ -286,16 +288,14 @@
    4.58      },
    4.59      url: _this.web_service_path,
    4.60      timeout: 1000000,
    4.61 -    error: function() {
    4.62 +    error: function(e) {
    4.63        if (_this.autocomplete_info) jQuery("#" + _this.autocomplete_info).html("CTRL + Space to activate auto-complete");
    4.64        if (_this.autocomplete_loader) jQuery("#" + _this.autocomplete_loader).hide();
    4.65 -
    4.66      },
    4.67      success: function(data) {
    4.68 +
    4.69        if (data != "") {
    4.70 -        var temparray = jQuery.parseJSON(data);
    4.71 -        push_metadata_json(temparray);
    4.72 -
    4.73 +        push_metadata_json(data);
    4.74        }
    4.75  
    4.76        if (_this.autocomplete_info) jQuery("#" + _this.autocomplete_info).html("CTRL + Space to activate auto-complete");
     5.1 --- a/src/GENIUS-gwt-app/war/WEB-INF/classes/adql_syntax/tap-hint.js	Thu Apr 07 02:35:42 2016 +0300
     5.2 +++ b/src/GENIUS-gwt-app/war/WEB-INF/classes/adql_syntax/tap-hint.js	Fri Apr 08 15:17:43 2016 +0300
     5.3 @@ -267,8 +267,9 @@
     5.4          if (editor.autocompleteLoader) jQuery("#" + editor.autocompleteLoader).hide();
     5.5        },
     5.6        success: function(data) {
     5.7 +
     5.8          if (data != "") {
     5.9 -          var tables = jQuery.parseJSON(data);
    5.10 +          //var tables = jQuery.parseJSON(data);
    5.11            pushMetadataJson(tables, tags, parentText, keyword);
    5.12          }
    5.13  
     6.1 --- a/src/GENIUS-gwt-app/war/WEB-INF/classes/com/genius/uk/Genius.gwt.xml	Thu Apr 07 02:35:42 2016 +0300
     6.2 +++ b/src/GENIUS-gwt-app/war/WEB-INF/classes/com/genius/uk/Genius.gwt.xml	Fri Apr 08 15:17:43 2016 +0300
     6.3 @@ -28,4 +28,5 @@
     6.4  
     6.5    <!-- allow Super Dev Mode -->
     6.6    <add-linker name="xsiframe"/>
     6.7 +  
     6.8  </module>
     7.1 Binary file src/GENIUS-gwt-app/war/WEB-INF/classes/com/genius/uk/server/GreetingServiceImplAsync.class has changed
     8.1 --- a/src/GENIUS-gwt-app/war/WEB-INF/web.xml	Thu Apr 07 02:35:42 2016 +0300
     8.2 +++ b/src/GENIUS-gwt-app/war/WEB-INF/web.xml	Fri Apr 08 15:17:43 2016 +0300
     8.3 @@ -30,5 +30,6 @@
     8.4    <welcome-file-list>
     8.5      <welcome-file>Genius.html</welcome-file>
     8.6    </welcome-file-list>
     8.7 +  
     8.8  
     8.9  </web-app>
     9.1 --- a/src/GENIUS-gwt-app/war/genius/adql_syntax/adql.js	Thu Apr 07 02:35:42 2016 +0300
     9.2 +++ b/src/GENIUS-gwt-app/war/genius/adql_syntax/adql.js	Fri Apr 08 15:17:43 2016 +0300
     9.3 @@ -107,6 +107,7 @@
     9.4    }
     9.5  
     9.6    return {
     9.7 +	 
     9.8      startState: function(base) {
     9.9        return {tokenize: tokenBase,
    9.10                context: null,
    10.1 --- a/src/GENIUS-gwt-app/war/genius/adql_syntax/tap-autocomplete.js	Thu Apr 07 02:35:42 2016 +0300
    10.2 +++ b/src/GENIUS-gwt-app/war/genius/adql_syntax/tap-autocomplete.js	Fri Apr 08 15:17:43 2016 +0300
    10.3 @@ -29,24 +29,19 @@
    10.4      this.istap = true;
    10.5    }
    10.6  
    10.7 -  if (typeof availableTags !== 'undefined') {
    10.8 -    availableTags = [];
    10.9 -  }
   10.10  
   10.11 -
   10.12 -  if (editor == null && !jQuery('.CodeMirror').length > 0) {
   10.13 +  if (this.editor == null && !jQuery('.CodeMirror').length > 0) {
   10.14      CodeMirror.commands.autocomplete = function(cm) {
   10.15        CodeMirror.tapHint(cm, CodeMirror.adqlHint, {
   10.16          webServicePath: params.web_service_path,
   10.17          tapResource: params.tap_resource,
   10.18          useAutocompleteService: (params.servicemode.toLowerCase() == "tap"),
   10.19 -	autocompleteLoader: params.autocomplete_loader_id,
   10.20 +	    autocompleteLoader: params.autocomplete_loader_id,
   10.21          autocompleteInfo: params.autocomplete_info_id,
   10.22 -       
   10.23        });
   10.24      }
   10.25  
   10.26 -    var editor = CodeMirror.fromTextArea(document.getElementById(params.textfieldid), {
   10.27 +   this.editor = CodeMirror.fromTextArea(document.getElementById(params.textfieldid), {
   10.28        mode: "text/x-adql",
   10.29        tabMode: "indent",
   10.30        lineNumbers: true,
   10.31 @@ -60,6 +55,13 @@
   10.32      });
   10.33    }
   10.34  
   10.35 +  if (typeof this.editor.availableTags == 'undefined') {
   10.36 +	  this.editor.availableTags = [
   10.37 +     		"SELECT", "FROM", "ORDER BY","WHERE", "TOP","IN", "AND", "OR", "WITH", "DESC", "ASC", "JOIN", "AS", "HAVING", "ABS",
   10.38 + 			"GROUP","BY", "INNER","OUTER","CROSS","LEFT","RIGHT","FULL","ON","USING","MIN","MAX","COUNT","DISTINCT","ALL","LIKE","ACOS","ASIN","ATAN","ATAN2","COS","SIN","TAN","COT","IS","NOT","NULL","NATURAL","EXISTS","BETWEEN","AREA","BOX","CENTROID","CIRCLE","CONTAINS","COORD1","COORD2","COORDSYS","DISTANCE","INTERSECTS","POINT","POLYGON","REGION"
   10.39 + 		];
   10.40 +  }
   10.41 +
   10.42    if (params.servicemode.toLowerCase() == "tap") {
   10.43      this.load_metadata_for_autocomplete(this.initial_catalogues);
   10.44    } else {
   10.45 @@ -74,9 +76,6 @@
   10.46   *
   10.47   */
   10.48  TapAutocomplete.prototype.push_metadata_content_html = function(data) {
   10.49 -  if (typeof availableTags !== 'undefined') {
   10.50 -    availableTags = [];
   10.51 -  }
   10.52  
   10.53    var content = document.createElement('div');
   10.54    content.innerHTML = data;
   10.55 @@ -86,12 +85,12 @@
   10.56      var str = jQuery.trim(jQuery(tr[i]).justtext());
   10.57      var arr = str.split(".");
   10.58      for (var y = 0; y < arr.length; y++) {
   10.59 -      availableTags.push(arr[y]);
   10.60 +    	this.editor.availableTags.push(arr[y]);
   10.61      }
   10.62    }
   10.63    for (var i = 0; i < tr2.length; i++) {
   10.64 -    if (!contains(availableTags, tr2[i].innerHTML)) {
   10.65 -      availableTags.push(tr2[i].innerHTML);
   10.66 +    if (!contains(this.editor.availableTags, tr2[i].innerHTML)) {
   10.67 +    	this.editor.availableTags.push(tr2[i].innerHTML);
   10.68      }
   10.69    }
   10.70  
   10.71 @@ -105,15 +104,13 @@
   10.72   */
   10.73  
   10.74  TapAutocomplete.prototype.push_metadata_json = function(data) {
   10.75 -  if (typeof availableTags !== 'undefined') {
   10.76 -    availableTags = [];
   10.77 -  }
   10.78 +  
   10.79    if (data.length > 0) {
   10.80      for (var i = 0; i < data.length; i++) {
   10.81        var str = jQuery.trim(data[i]);
   10.82        var arr = str.split(".");
   10.83        for (var y = 0; y < arr.length; y++) {
   10.84 -        availableTags.push(arr[y]);
   10.85 +    	  this.editor.availableTags.push(arr[y]);
   10.86        }
   10.87      }
   10.88    }
   10.89 @@ -193,8 +190,8 @@
   10.90    }
   10.91  
   10.92    function push_metadata_content_html(data) {
   10.93 -    if (typeof availableTags !== 'undefined') {
   10.94 -       availableTags = [];
   10.95 +	if (!_this.editor.availableTags) {
   10.96 +		_this.editor.availableTags = [];
   10.97      }
   10.98  
   10.99      var content = document.createElement('div');
  10.100 @@ -205,13 +202,13 @@
  10.101        var str = jQuery.trim(jQuery(tr[i]).text());
  10.102        var arr = str.split(".");
  10.103        for (var y = 0; y < arr.length; y++) {
  10.104 -       availableTags.push(arr[y]);
  10.105 +    	  _this.editor.availableTags.push(arr[y]);
  10.106        }
  10.107      }
  10.108  
  10.109      for (var i = 0; i < tr2.length; i++) {
  10.110 -      if (!contains(availableTags, tr2[i].innerHTML)) {
  10.111 -        availableTags.push(tr2[i].innerHTML);
  10.112 +      if (!contains(_this.editor.availableTags, tr2[i].innerHTML)) {
  10.113 +    	  _this.editor.availableTags.push(tr2[i].innerHTML);
  10.114        }
  10.115      }
  10.116  
  10.117 @@ -233,6 +230,7 @@
  10.118  
  10.119      },
  10.120      success: function(data) {
  10.121 +
  10.122        if (data != "") {
  10.123         push_metadata_content_html(data);
  10.124        }
  10.125 @@ -259,19 +257,17 @@
  10.126  
  10.127  
  10.128    function push_metadata_json(data) {
  10.129 -    if (typeof availableTags !== 'undefined') {
  10.130 -       availableTags = [];
  10.131 -    }
  10.132      if (data.length > 0) {
  10.133        for (var i = 0; i < data.length; i++) {
  10.134          var str = jQuery.trim(data[i]);
  10.135          var arr = str.split(".");
  10.136          for (var y = 0; y < arr.length; y++) {
  10.137 -          availableTags.push(arr[y]);
  10.138 +        	_this.editor.availableTags.push(arr[y]);
  10.139          }
  10.140        }
  10.141      }
  10.142  
  10.143 +
  10.144    }
  10.145  
  10.146    optional_catalogues=JSON.stringify(optional_catalogues);
  10.147 @@ -286,18 +282,16 @@
  10.148      },
  10.149      url: _this.web_service_path,
  10.150      timeout: 1000000,
  10.151 -    error: function() {
  10.152 +    error: function(e) {
  10.153        if (_this.autocomplete_info) jQuery("#" + _this.autocomplete_info).html("CTRL + Space to activate auto-complete");
  10.154        if (_this.autocomplete_loader) jQuery("#" + _this.autocomplete_loader).hide();
  10.155 -
  10.156      },
  10.157      success: function(data) {
  10.158 +
  10.159 +
  10.160        if (data != "") {
  10.161 -        var temparray = jQuery.parseJSON(data);
  10.162 -        push_metadata_json(temparray);
  10.163 -
  10.164 +        push_metadata_json(data);
  10.165        }
  10.166 -
  10.167        if (_this.autocomplete_info) jQuery("#" + _this.autocomplete_info).html("CTRL + Space to activate auto-complete");
  10.168        if (_this.autocomplete_loader) jQuery("#" + _this.autocomplete_loader).hide();
  10.169      }
    11.1 --- a/src/GENIUS-gwt-app/war/genius/adql_syntax/tap-hint.js	Thu Apr 07 02:35:42 2016 +0300
    11.2 +++ b/src/GENIUS-gwt-app/war/genius/adql_syntax/tap-hint.js	Fri Apr 08 15:17:43 2016 +0300
    11.3 @@ -41,6 +41,16 @@
    11.4      if (givenOptions["autocompleteLoader"]) editor.autocompleteLoader = givenOptions["autocompleteLoader"];
    11.5      if (givenOptions["autocompleteInfo"]) editor.autocompleteInfo = givenOptions["autocompleteInfo"];
    11.6      if (givenOptions["useAutocompleteService"]) editor.useAutocompleteService = givenOptions["useAutocompleteService"];
    11.7 +    if (givenOptions["availableTags"]){
    11.8 +    	editor.availableTags = givenOptions["availableTags"];
    11.9 +    } else {
   11.10 +    	if (!editor.availableTags){
   11.11 +    	    editor.availableTags = [
   11.12 +    	              		"SELECT", "FROM", "ORDER BY","WHERE", "TOP","IN", "AND", "OR", "WITH", "DESC", "ASC", "JOIN", "AS", "HAVING", "ABS",
   11.13 +    	          			"GROUP","BY", "INNER","OUTER","CROSS","LEFT","RIGHT","FULL","ON","USING","MIN","MAX","COUNT","DISTINCT","ALL","LIKE","ACOS","ASIN","ATAN","ATAN2","COS","SIN","TAN","COT","IS","NOT","NULL","NATURAL","EXISTS","BETWEEN","AREA","BOX","CENTROID","CIRCLE","CONTAINS","COORD1","COORD2","COORDSYS","DISTANCE","INTERSECTS","POINT","POLYGON","REGION"
   11.14 +    	          		];
   11.15 +    	}
   11.16 +    }
   11.17  
   11.18      for (var opt in defaults)
   11.19        if (defaults.hasOwnProperty(opt)) {
   11.20 @@ -49,6 +59,7 @@
   11.21  
   11.22  
   11.23      function collectHints(previousToken) {
   11.24 +
   11.25        // We want a single cursor position.
   11.26        if (editor.somethingSelected()) return;
   11.27  
   11.28 @@ -59,8 +70,8 @@
   11.29          (tempToken.start != previousToken.start || tempToken.type != previousToken.type)) {
   11.30          return;
   11.31        }
   11.32 -
   11.33        var result = getHints(editor, givenOptions);
   11.34 +      console.log(result);
   11.35        if (!result || !result.list.length) return;
   11.36        var completions = result.list;
   11.37  
   11.38 @@ -176,7 +187,6 @@
   11.39    function getCompletionsAdql(token, context, keywords, options, editor, optional_keyword) {
   11.40  
   11.41      optional_keyword = (typeof optional_keyword === 'undefined') ? '' : optional_keyword;
   11.42 -
   11.43      var found = [],
   11.44        start = token.string;
   11.45  
   11.46 @@ -186,9 +196,9 @@
   11.47      }
   11.48  
   11.49      function gatherCompletions(obj) {
   11.50 -      if (typeof obj == "string") forEach(availableTags, maybeAdd);
   11.51 -      else if (obj instanceof Array) forEach(availableTags, maybeAdd);
   11.52 -      else if (obj instanceof Function) forEach(availableTags, maybeAdd);
   11.53 +      if (typeof obj == "string") forEach(editor.availableTags, maybeAdd);
   11.54 +      else if (obj instanceof Array) forEach(editor.availableTags, maybeAdd);
   11.55 +      else if (obj instanceof Function) forEach(editor.availableTags, maybeAdd);
   11.56        for (var name in obj) maybeAdd(name);
   11.57      }
   11.58  
   11.59 @@ -268,8 +278,7 @@
   11.60        },
   11.61        success: function(data) {
   11.62          if (data != "") {
   11.63 -          var tables = jQuery.parseJSON(data);
   11.64 -          pushMetadataJson(tables, tags, parentText, keyword);
   11.65 +          pushMetadataJson(data, tags, parentText, keyword);
   11.66          }
   11.67  
   11.68          if (editor.autocompleteInfo) jQuery("#" + editor.autocompleteInfo).html("CTRL + Space to activate auto-complete");
   11.69 @@ -291,11 +300,10 @@
   11.70  
   11.71        if (str.toLowerCase().indexOf(start.toLowerCase()) == 0 && !jsArrayContains(found, str)) found.push(str);
   11.72      }
   11.73 -
   11.74      function gatherCompletions(obj) {
   11.75 -      if (typeof obj == "string") forEach(availableTags, maybeAdd);
   11.76 -      else if (obj instanceof Array) forEach(availableTags, maybeAdd);
   11.77 -      else if (obj instanceof Function) forEach(availableTags, maybeAdd);
   11.78 +      if (typeof obj == "string") forEach(editor.availableTags, maybeAdd);
   11.79 +      else if (obj instanceof Array) forEach(editor.availableTags, maybeAdd);
   11.80 +      else if (obj instanceof Function) forEach(editor.availableTags, maybeAdd);
   11.81        for (var name in obj) maybeAdd(name);
   11.82      }
   11.83  
   11.84 @@ -337,6 +345,7 @@
   11.85  
   11.86  
   11.87    function scriptHint(editor, keywords, getToken, options) {
   11.88 +
   11.89      // Find the token at the cursor
   11.90      var cur = editor.getCursor(),
   11.91      token = getToken(editor, cur),
   11.92 @@ -418,7 +427,6 @@
   11.93        context.push(tprop);
   11.94  
   11.95      }
   11.96 -
   11.97      if (editor.useAutocompleteService != true) {
   11.98  
   11.99        return {
  11.100 @@ -451,7 +459,7 @@
  11.101    }
  11.102  
  11.103    CodeMirror.adqlHint = function(editor, options) {
  11.104 -    return scriptHint(editor, availableTags,
  11.105 +    return scriptHint(editor, editor.availableTags,
  11.106        function(e, cur) {
  11.107          return e.getTokenAt(cur);
  11.108        },