Permalink
Browse files

* Tweaks

* Added formatjson plugin
  • Loading branch information...
1 parent fffbe09 commit c414b0c33d2092f64c2ad27d1752fc08a8609797 @javruben javruben committed Sep 24, 2010
View
@@ -2,8 +2,8 @@
The Cloud9 IDE is an open source project developed by the skilled developers Fabian Jakobs ([fjakobs]), Ruben Daniels ([javruben]) and Mike de Boer ([mikedeboer]) from [ajax.org], built on top of [Node.JS].
-This Integrated Development Environment aim 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.
-As its main focus is on Javascript development, it is able to set a new standard for client and server development integration.
+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.
+Cloud9's main focus is on Javascript development, it is able to set a new standard for client and server development integration.
And if you find that functionality is missing? Just write a plugin and patch it yourself!
@@ -13,6 +13,7 @@ Written in Javascript, for Javascripters.
* High performance text editor with bundled syntax highlighting support for JS, HTML, CSS and mixed modes.
* Integrated debugger for [Node.JS] applications which can started, paused and stopped from within the IDE
+ * Integrated debugger for the Google Chrome browser which can started, paused and stopped from within the IDE
* Local filesystem is exposed through [WebDAV](http://en.wikipedia.org/wiki/WebDAV) to the IDE, which makes it possible to connect to remote workspaces as well
* Highly extensible through the plugin system
* Bundled plugins: browser, clipboard, code (editor), console, debugger, docs, editors, filesystem, html, keybindings, newresource, noderunner, panels, refactor, richtext, save, searchreplace, settings, tree, undo
View
@@ -14,12 +14,12 @@ require.def("core/ide",
//Set references to global elements - aka extension points
this.tbMain = tbMain;
this.mnuFile = mnuFile;
+ this.mnuEdit = mnuEdit;
this.barMenu = barMenu;
this.barTools = barTools;
this.mnuEditors = mnuEditors;
this.sbMain = sbMain;
this.vbMain = vbMain;
- this.ddModes = ddModes;
this.dispatchEvent("load");
View
@@ -37,7 +37,9 @@ return ext.register("ext/code/code", {
init : function(amlPage){
amlPage.appendChild(barEditor);
barEditor.show();
-
+
+ this.ceEditor = ceEditor;
+
this.nodes.push(
//Add a panel to the statusbar showing whether the insert button is pressed
sbMain.appendChild(new apf.section({
@@ -31,7 +31,7 @@
<a:divider visible="{tabConsole.activepagenr==0}" />
<a:button
visible = "{tabConsole.activepagenr == 0}"
- disabled = "{!txtCode.value}"
+ disabled = "{!txtConsole.value}"
onclick = "txtConsole.clear()">Clear Log</a:button>
<a:dropdown id="lstScripts"
@@ -24,7 +24,7 @@ return ext.register("ext/debugger/debugger", {
nodes : [],
hook : function(){
- this.$layoutItem = ddModes.appendChild(new apf.item({
+ this.$layoutItem = mnuModes.appendChild(new apf.item({
value : "ext/debugger/debugger",
caption : this.name
}));
@@ -0,0 +1,87 @@
+/**
+ * Extension Manager for the Ajax.org Cloud IDE
+ *
+ * @copyright 2010, Ajax.org B.V.
+ * @license GPLv3 <http://www.gnu.org/licenses/gpl.txt>
+ */
+require.def("ext/formatjson/formatjson",
+ ["core/ide",
+ "core/ext",
+ "core/util",
+ "ext/editors/editors",
+ "ace/Range",
+ "text!ext/formatjson/formatjson.xml"],
+ function(ide, ext, util, editors, Range, markup) {
+
+return ext.register("ext/formatjson/formatjson", {
+ name : "JSON Formatter",
+ dev : "Ajax.org",
+ alone : true,
+ type : ext.GENERAL,
+ markup : markup,
+
+ nodes : [],
+
+ format : function(indent){
+ var editor = editors.currentEditor;
+ var amlEditor = editor.ceEditor;
+
+ var sel = amlEditor.getSelection();
+ var doc = amlEditor.getDocument();
+ var range = sel.getRange();
+ var value = doc.getTextRange(range);
+ try{
+ value = JSON.stringify(JSON.parse(value), null, indent);
+ }
+ catch(e){
+ util.alert(
+ "Invalid Json",
+ "The selection contains an invalid or incomplete JSON string",
+ "Please correct the JSON and try again");
+ return;
+ }
+
+ var end = doc.replace(range, value);
+ sel.setSelectionRange(Range.fromPoints(range.start, end));
+ },
+
+ hook : function(){
+ var _self = this;
+ this.nodes.push(
+ ide.mnuEdit.appendChild(new apf.item({
+ caption : "Format JSON",
+ onclick : function(){
+ ext.initExtension(_self);
+ _self.winFormat.show();
+ }
+ }))
+ );
+ },
+
+ init : function(amlNode){
+ this.winFormat = winFormat;
+ },
+
+ 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 = [];
+ this.winFormat.destroy(true, true);
+ }
+});
+
+ }
+);
@@ -0,0 +1,26 @@
+<a:application xmlns:a="http://ajax.org/2005/aml">
+ <a:window
+ id = "winFormat"
+ title = "Format JSON"
+ icon = ""
+ center = "true"
+ resizable = "true"
+ buttons = "close"
+ width = "200">
+ <a:vbox>
+ <a:hbox padding="5" edge="10">
+ <a:label width="100">Indentation</a:label>
+ <a:spinner id="spIndent" flex="1" min="1" max="20" />
+ </a:hbox>
+ <a:divider />
+ <a:hbox pack="end" padding="5" edge="10 10 5 10">
+ <a:button class="ui-btn-green" default="2" caption="Format"
+ onclick = "
+ require('ext/formatjson/formatjson').format(spIndent.value);
+ winFormat.hide()
+ "/>
+ <a:button onclick="winFormat.hide()">Cancel</a:button>
+ </a:hbox>
+ </a:vbox>
+ </a:window>
+</a:application>
@@ -23,10 +23,10 @@ return ext.register("ext/newresource/newresource", {
init : function(amlNode){
var _self = this;
- ide.vbMain.selectSingleNode("a:hbox[1]/a:vbox[1]").appendChild(tbNewResource);
+ //ide.vbMain.selectSingleNode("a:hbox[1]/a:vbox[1]").appendChild(tbNewResource);
- btnNewFile.onclick = this.newfile;
- btnNewFolder.onclick = this.newfolder;
+ //btnNewFile.onclick = this.newfile;
+ //btnNewFolder.onclick = this.newfolder;
this.nodes.push(
ide.mnuFile.insertBefore(new apf.item({
@@ -40,11 +40,4 @@
</a:hbox>
</a:vbox>
</a:window>
-
- <a:toolbar id="tbNewResource" height="20">
- <a:bar>
- <a:button id="btnNewFile" icon="page_add.png" tooltip="New File" caption="New File" />
- <a:button id="btnNewFolder" icon="folder_add.png" tooltip="New Folder" caption="New Folder" />
- </a:bar>
- </a:toolbar>
</a:application>
@@ -6,6 +6,8 @@
else if (event.value == 'toolbar')
barTools.setProperty('visible', event.checked);
">
+ <a:item submenu="mnuModes">Layout</a:item>
+ <a:divider />
<a:item type="check" value='status' checked="true">Statusbar</a:item>
<a:item type="check" value='toolbar' checked="true">Toolbar</a:item>
<a:divider />
View
@@ -9,13 +9,13 @@
skin = "change_photo">
<a:vbox padding="10" edge="15 20 20 20">
<h3 class="wheader">Save this file?</h3>
- <div>This file has unsaved changes. Would you like to save the file before closing it?</div>
+ <div>This file has unsaved changes. Would you like to save the file before closing?</div>
</a:vbox>
<a:vbox edge="0 0 4 0" padding="8">
<a:divider skin="hordivider" />
<a:hbox pack="end" padding="7" edge="0 10 0 10">
- <a:button id="btnSaveYes" width="80" default="3" class="ui-btn-red" caption="Yes" />
+ <a:button id="btnSaveYes" width="80" default="3" class="ui-btn-green" caption="Yes" />
<a:button id="btnSaveNo" width="80" class="ui-btn-red" caption="No" />
<a:button id="btnSaveCancel" width="80">Cancel</a:button>
</a:hbox>
View
@@ -11,4 +11,9 @@
</a:menu>
<a:menu id="mnuEditors">
+</a:menu>
+
+<a:menu id="mnuModes"
+ onitemclick = "require('core/ext').setLayoutMode(event.value);">
+ <a:item value="default" caption="Default" />
</a:menu>
View
@@ -71,6 +71,7 @@
"ext/browser/browser",
"ext/code/code",
"ext/extmgr/extmgr",
+ "ext/formatjson/formatjson",
"ext/docs/docs",
"ext/richtext/richtext",
"ext/console/console",
@@ -248,13 +249,6 @@
<a:button submenu="mnuFile">File</a:button>
<a:button submenu="mnuEdit">Edit</a:button>
<a:button submenu="mnuView">View</a:button>
- <a:dropdown right="1" top="1" id="ddModes"
- onafterselect = "
- var ext = require('core/ext');
- ext.setLayoutMode(this.value);
- ">
- <a:item value="default" caption="Default" />
- </a:dropdown>
</a:menubar>
<a:bar id="barTools">
View
@@ -2161,8 +2161,8 @@
<a:presentation>
<a:main
collapsed-height = "26"
- minheight = "150"
- minwidth = "150"
+ minheight = "50"
+ minwidth = "50"
container = "div[1]"
drag = "div[6]"
title = "div[6]/div[2]/text()"

0 comments on commit c414b0c

Please sign in to comment.