Skip to content

Commit

Permalink
Merge branch 'release/v0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
sergi committed Jun 7, 2011
2 parents e4b47b7 + 8c2f925 commit dc52b62
Show file tree
Hide file tree
Showing 101 changed files with 65,524 additions and 113,702 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Expand Up @@ -4,9 +4,9 @@
[submodule "support/connect"]
path = support/connect
url = http://github.com/senchalabs/connect.git
[submodule "support/async"]
path = support/async
url = http://github.com/ajaxorg/async.js.git
[submodule "support/asyncjs"]
path = support/asyncjs
url = git://github.com/ajaxorg/async.js.git
[submodule "support/jsdav"]
path = support/jsdav
url = http://github.com/ajaxorg/jsDAV.git
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
# Cloud9 IDE

test
The Cloud9 IDE is an open source project started by [ajax.org], built on top of [Node.JS].

This Integrated Development Environment aims to bring all great features from other existing IDE's and source code editors like Eclipse, Netbeans, Textmate, and many others together, bundled as plugins.
Expand Down
2 changes: 1 addition & 1 deletion bin/cloud9.js
Expand Up @@ -75,5 +75,5 @@ if (options.action) {
require("child_process").spawn(options.action[0], options.action.slice(1));
}
else {
Sys.puts("Point you browser to " + url);
Sys.puts("Point your browser to " + url);
}
12 changes: 12 additions & 0 deletions client/core/util.js
Expand Up @@ -135,4 +135,16 @@ exports.getContentType = function(filename) {
return contentTypes[type] || "text/plain";
};

/*
* JavaScript Linkify - v0.3 - 6/27/2009
* http://benalman.com/projects/javascript-linkify/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Some regexps adapted from http://userscripts.org/scripts/review/7122
*/
exports.linkify=function(){var k="[a-z\\d.-]+://",h="(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",c="(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",n="(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",f="(?:"+c+n+"|"+h+")",o="(?:[;/][^#?<>\\s]*)?",e="(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",d="\\b"+k+"[^<>\\s]+",a="\\b"+f+o+e+"(?!\\w)",m="mailto:",j="(?:"+m+")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"+f+e+"(?!\\w)",l=new RegExp("(?:"+d+"|"+a+"|"+j+")","ig"),g=new RegExp("^"+k,"i"),b={"'":"`",">":"<",")":"(","]":"[","}":"{","B;":"B+","b:":"b9"},i={callback:function(q,p){return p?'<a href="'+p+'" title="'+p+'">'+q+"</a>":q},punct_regexp:/(?:[!?.,:;'"]|(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/};return function(u,z){z=z||{};var w,v,A,p,x="",t=[],s,E,C,y,q,D,B,r;for(v in i){if(z[v]===undefined){z[v]=i[v]}}while(w=l.exec(u)){A=w[0];E=l.lastIndex;C=E-A.length;if(/[\/:]/.test(u.charAt(C-1))){continue}do{y=A;r=A.substr(-1);B=b[r];if(B){q=A.match(new RegExp("\\"+B+"(?!$)","g"));D=A.match(new RegExp("\\"+r,"g"));if((q?q.length:0)<(D?D.length:0)){A=A.substr(0,A.length-1);E--}}if(z.punct_regexp){A=A.replace(z.punct_regexp,function(F){E-=F.length;return""})}}while(A.length&&A!==y);p=A;if(!g.test(p)){p=(p.indexOf("@")!==-1?(!p.indexOf(m)?"":m):!p.indexOf("irc.")?"irc://":!p.indexOf("ftp.")?"ftp://":"http://")+p}if(s!=C){t.push([u.slice(s,C)]);s=E}t.push([A,p])}t.push([u.substr(s)]);for(v=0;v<t.length;v++){x+=z.callback.apply(window,t[v])}return x||u}}();

});
123 changes: 123 additions & 0 deletions client/ext/beautify/beautify.js
@@ -0,0 +1,123 @@
/**
* Beautify extension for the Cloud9 IDE client
*
* Reformats the selected code in the current document
*
* Processing/formatting code from https://github.com/einars/js-beautify
*
* @copyright 2011, Ajax.org B.V.
* @license GPLv3 <http://www.gnu.org/licenses/gpl.txt>
*/

define(function(require, exports, module) {

var ext = require("core/ext");
var ide = require("core/ide");
var util = require("core/util");
var canon = require("pilot/canon");
var editors = require("ext/editors/editors");
var Range = require("ace/range").Range;
var jsbeautify = require("ext/beautify/res/jsbeautify/jsbeautify");
var settings = require("text!ext/beautify/settings.xml");
var extSettings = require("ext/settings/settings");

return ext.register("ext/beautify/beautify", {
name: "JS Beautify",
dev: "Ajax.org",
alone: true,
type: ext.GENERAL,

commands: {
"beautify": {
hint: "reformat selected JavaScript code in the editor"
}
},

nodes: [],
hotitems: {},

beautify: function() {
var editor = editors.currentEditor;

var sel = editor.getSelection();
var doc = editor.getDocument();
var range = sel.getRange();
var value = doc.getTextRange(range);

// Load up current settings data
var preserveEmpty = extSettings.model.queryValue("beautify/jsbeautify/@preserveempty") == "true" ? true : false;
var keepIndentation = extSettings.model.queryValue("beautify/jsbeautify/@keeparrayindentation") == "true" ? true : false;
var braces = extSettings.model.queryValue("beautify/jsbeautify/@braces") || "end-expand";
var indentSize = extSettings.model.queryValue("editors/code/@tabsize") || "4";
var indentTab = extSettings.model.queryValue("editors/code/@softtabs") == "true" ? " " : "\t";

if (indentTab == "\t") indentSize = 1;

try {
value = jsbeautify.js_beautify(value, {
indent_size: indentSize,
indent_char: indentTab,
preserve_newlines: preserveEmpty,
keep_array_indentation: keepIndentation,
brace_style: braces
});
}
catch (e) {
util.alert("Error", "This code could not be beautified", "Please correct any JavaScript errors and try again");
return;
}

var end = doc.replace(range, value);
sel.setSelectionRange(Range.fromPoints(range.start, end));
},

init: function() {

},

hook: function() {
var _self = this;
this.nodes.push(
ide.mnuEdit.appendChild(new apf.divider()), ide.mnuEdit.appendChild(new apf.item({
caption: "Beautify Selection",
onclick: function() {
ext.initExtension(_self);
_self.beautify();
}
})));

this.hotitems["beautify"] = [this.nodes[1]];
canon.addCommand({
name: "beautify",
exec: function(env, args, request) {
_self.beautify();
}
});

ide.addEventListener("init.ext/settings/settings", function(e) {
e.ext.addSection("jsbeautify", _self.name, "beautify", function() {});
barSettings.insertMarkup(settings);
});
},

enable: function() {
this.nodes.each(function(item) {
item.enable();
});
},

disable: function() {
this.nodes.each(function(item) {
item.disable();
});
},

destroy: function() {
this.nodes.each(function(item) {
item.destroy(true, true);
});
this.nodes = [];
}
});

});

0 comments on commit dc52b62

Please sign in to comment.