From 364000ba78c7f292b1b8c1d07e1cb1c7b911aeb8 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Sun, 8 Mar 2015 22:25:47 +0000 Subject: [PATCH 1/3] Enable the SDK by default --- plugins/c9.core/ext.js | 2 +- plugins/c9.ide.plugins/debug.js | 2 +- plugins/c9.ide.plugins/installer.js | 2 +- plugins/c9.ide.plugins/loader.js | 2 +- plugins/c9.ide.plugins/manager.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/c9.core/ext.js b/plugins/c9.core/ext.js index fe7d79c9..5d613650 100644 --- a/plugins/c9.core/ext.js +++ b/plugins/c9.core/ext.js @@ -689,7 +689,7 @@ define(function(require, exports, module) { * plugin.freezePublicAPI({ * doSomething : doSomething * }); - * }); + * } * }); * * @class Plugin diff --git a/plugins/c9.ide.plugins/debug.js b/plugins/c9.ide.plugins/debug.js index a3fb632b..f2b6ff30 100644 --- a/plugins/c9.ide.plugins/debug.js +++ b/plugins/c9.ide.plugins/debug.js @@ -33,7 +33,7 @@ define(function(require, exports, module) { // var emit = plugin.getEmitter(); var ENABLED = c9.location.indexOf("debug=2") > -1; - var HASSDK = c9.location.indexOf("sdk=1") > -1; + var HASSDK = c9.location.indexOf("sdk=0") === -1; var loaded = false; function load() { diff --git a/plugins/c9.ide.plugins/installer.js b/plugins/c9.ide.plugins/installer.js index 27526d2e..dbe02907 100644 --- a/plugins/c9.ide.plugins/installer.js +++ b/plugins/c9.ide.plugins/installer.js @@ -20,7 +20,7 @@ define(function(require, exports, module) { var plugin = new Plugin("Ajax.org", main.consumes); // var emit = plugin.getEmitter(); - var HASSDK = c9.location.indexOf("sdk=1") > -1; + var HASSDK = c9.location.indexOf("sdk=0") === -1; var queue = []; var installing; diff --git a/plugins/c9.ide.plugins/loader.js b/plugins/c9.ide.plugins/loader.js index 03a523fb..78455b7f 100644 --- a/plugins/c9.ide.plugins/loader.js +++ b/plugins/c9.ide.plugins/loader.js @@ -23,7 +23,7 @@ define(function(require, exports, module) { // var emit = plugin.getEmitter(); var ENABLED = c9.location.indexOf("plugins=0") == -1; - var HASSDK = c9.location.indexOf("sdk=1") > -1; + var HASSDK = c9.location.indexOf("sdk=0") === -1; var plugins = options.plugins; var names = []; diff --git a/plugins/c9.ide.plugins/manager.js b/plugins/c9.ide.plugins/manager.js index f306fe76..89aa6516 100644 --- a/plugins/c9.ide.plugins/manager.js +++ b/plugins/c9.ide.plugins/manager.js @@ -99,7 +99,7 @@ define(function(require, exports, module) { }); // var emit = plugin.getEmitter(); - var HASSDK = c9.location.indexOf("sdk=1") > -1; + var HASSDK = c9.location.indexOf("sdk=0") === -1; var model, datagrid, filterbox; var btnUninstall, btnReport, btnReadme, btnCloud9; From bc2af84013785e83e744a906d01f94646eb969fe Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Tue, 10 Mar 2015 01:46:07 +0000 Subject: [PATCH 2/3] Simplify the panel api by having the panel object create the bar element --- package.json | 6 ++--- plugins/c9.ide.keys/panel.js | 3 +-- plugins/c9.ide.keys/panel.xml | 8 +++--- plugins/c9.ide.panels/panel.js | 48 ++++++++++++++++++---------------- plugins/c9.ide.tree/tree.js | 4 +-- plugins/c9.ide.tree/tree.xml | 18 ++++++------- 6 files changed, 42 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 8b40c569..c0e0d2e7 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ }, "licenses": [], "c9plugins": { - "c9.ide.language": "#a6b859c38e", + "c9.ide.language": "#1ec8e1fa35", "c9.ide.language.css": "#afda1f867c", "c9.ide.language.generic": "#87a4a44671", "c9.ide.language.html": "#fa4833e117", @@ -65,7 +65,7 @@ "c9.ide.find": "#989c06e6a7", "c9.ide.find.infiles": "#f98dfef554", "c9.ide.find.replace": "#e4daf722b8", - "c9.ide.run.debug": "#df6615768a", + "c9.ide.run.debug": "#cb3d2e8a44", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", "c9.ide.ace.keymaps": "#6c4bb65b1f", @@ -84,7 +84,7 @@ "c9.ide.immediate": "#e9ba147cc2", "c9.ide.installer": "#24e7d6f399", "c9.ide.mount": "#32e79866ee", - "c9.ide.navigate": "#eab638cc2f", + "c9.ide.navigate": "#c2b2a7ba7b", "c9.ide.newresource": "#9a7464cc47", "c9.ide.openfiles": "#28a4f5af16", "c9.ide.preview": "#3c4dded23f", diff --git a/plugins/c9.ide.keys/panel.js b/plugins/c9.ide.keys/panel.js index f11bc665..4fe0a554 100644 --- a/plugins/c9.ide.keys/panel.js +++ b/plugins/c9.ide.keys/panel.js @@ -24,7 +24,6 @@ define(function(require, exports, module) { var plugin = new Panel("Ajax.org", main.consumes, { index: options.index || 300, caption: "Commands", - elementName: "winCommands", minWidth: 150, autohide: true, where: options.where || "left" @@ -69,7 +68,7 @@ define(function(require, exports, module) { var treeParent = plugin.getElement("commandsList"); txtFilter = plugin.getElement("txtFilter"); - winCommands = plugin.getElement("winCommands"); + winCommands = options.aml; // Create the Ace Tree tree = new Tree(treeParent.$int); diff --git a/plugins/c9.ide.keys/panel.xml b/plugins/c9.ide.keys/panel.xml index 84982a9e..36a61e18 100644 --- a/plugins/c9.ide.keys/panel.xml +++ b/plugins/c9.ide.keys/panel.xml @@ -1,7 +1,5 @@ - - - - + + \ No newline at end of file diff --git a/plugins/c9.ide.panels/panel.js b/plugins/c9.ide.panels/panel.js index 065f4dff..149e0638 100644 --- a/plugins/c9.ide.panels/panel.js +++ b/plugins/c9.ide.panels/panel.js @@ -17,19 +17,18 @@ define(function(require, module, exports) { var uCaseFirst = require("c9/string").uCaseFirst; function Panel(developer, deps, options) { - // Panel extends ext.Plugin var plugin = new Plugin(developer, deps); var emit = plugin.getEmitter(); var autohide = options.autohide || false; var index = options.index || 100; - var className = options.className; + var buttonCSSClass = options.buttonCSSClass; + var panelCSSClass = options.panelCSSClass; var caption = options.caption; - var elementName = options.elementName; var width = options.width; var minWidth = options.minWidth; - var mnuItem, button, area, lastPanel, xpath, where; + var mnuItem, button, area, lastPanel, xpath, where, aml; plugin.on("load", function(){ xpath = "state/panels/" + plugin.name; @@ -153,23 +152,27 @@ define(function(require, module, exports) { if (drawn) return false; drawn = true; + aml = area.aml.appendChild(new ui.bar({ + "skin": "panel-bar", + "class" : panelCSSClass || "", + "visible": false + })); + plugin.addElement(aml); + emit.sticky("draw", { - html: area.container, - aml: area.aml + html: aml.$int, + aml: aml }); - var aml = plugin.getElement(elementName); - if (aml) { - aml.$ext.style.zIndex = 100; - aml.$ext.style.minWidth = ""; //Needed for the anims - aml.$ext.style.position = "absolute"; - aml.$ext.style.left = where == "left" ? area.width + "px" : 0; - aml.$ext.style.top = 0; - aml.$ext.style.right = where == "right" ? area.width + "px" : 0; - aml.$ext.style.bottom = 0; - - aml.$display = apf.CSSPREFIX + "Flex"; - } + aml.$ext.style.zIndex = 100; + aml.$ext.style.minWidth = ""; //Needed for the anims + aml.$ext.style.position = "absolute"; + aml.$ext.style.left = where == "left" ? area.width + "px" : 0; + aml.$ext.style.top = 0; + aml.$ext.style.right = where == "right" ? area.width + "px" : 0; + aml.$ext.style.bottom = 0; + + aml.$display = apf.CSSPREFIX + "Flex"; return true; } @@ -178,7 +181,6 @@ define(function(require, module, exports) { area = toArea; try { - var aml = plugin.getElement(elementName); if (aml) area.aml.appendChild(aml); } catch (e) {} @@ -203,7 +205,7 @@ define(function(require, module, exports) { state: true, caption: caption, auto: false, - "class" : className || "", + "class" : buttonCSSClass || "", onmousedown: function(){ panels.areas[where].toggle(plugin.name, autohide, true); }, @@ -312,8 +314,8 @@ define(function(require, module, exports) { * autohiding panel. The developer is responsible for hiding * the panel. This behavior will animate the panel during * @param hide and show over other panels, if there are any. - * @param {String} [options.elementName] Specifies the name of the aml element that renders the panel - * @param {String} [options.className] Specifies the name of the css class that is applied to the panel + * @param {String} [options.buttonCSSClass] Specifies the name of the css class that is applied to the button + * @param {String} [options.panelCSSClass] Specifies the name of the css class that is applied to the panel * @param {Number} [options.width] Specifies the default width of the panel * @param {Number} [options.minWidth] Specifies the minimal width of the panel * @param {String} [options.where] Accepts "left" or "right" to determine where the panel is added @@ -350,7 +352,7 @@ define(function(require, module, exports) { * @private * @readonly */ - get aml(){ return plugin.getElement(elementName); }, + get aml(){ return aml; }, /** * The area that this panel is a part of. diff --git a/plugins/c9.ide.tree/tree.js b/plugins/c9.ide.tree/tree.js index 08481212..995ff049 100644 --- a/plugins/c9.ide.tree/tree.js +++ b/plugins/c9.ide.tree/tree.js @@ -43,7 +43,7 @@ define(function(require, exports, module) { var plugin = new Panel("Ajax.org", main.consumes, { index: options.index || 100, caption: "Workspace", - elementName: "winFilesViewer", + panelCSSClass: "workspace_files", minWidth: 130, where: options.where || "left" }); @@ -217,7 +217,7 @@ define(function(require, exports, module) { // Fetch UI elements container = plugin.getElement("container"); - winFilesViewer = plugin.getElement("winFilesViewer"); + winFilesViewer = options.aml // Create the Ace Tree tree = new Tree(container.$int); diff --git a/plugins/c9.ide.tree/tree.xml b/plugins/c9.ide.tree/tree.xml index 7728e596..6197f861 100644 --- a/plugins/c9.ide.tree/tree.xml +++ b/plugins/c9.ide.tree/tree.xml @@ -1,12 +1,10 @@ - - - - - - - - + + + + + + \ No newline at end of file From 9c6188fd38a9e76e6e7247072dc8e83cdcafd75a Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Wed, 11 Mar 2015 16:29:50 +0000 Subject: [PATCH 3/3] Disable new plugin menu item when not sdk=1 --- plugins/c9.ide.panels/panel.js | 4 ++++ plugins/c9.ide.plugins/manager.js | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/c9.ide.panels/panel.js b/plugins/c9.ide.panels/panel.js index 149e0638..588da214 100644 --- a/plugins/c9.ide.panels/panel.js +++ b/plugins/c9.ide.panels/panel.js @@ -353,6 +353,10 @@ define(function(require, module, exports) { * @readonly */ get aml(){ return aml; }, + /** + * @property {HTMLElement} container + */ + get container(){ return aml.$ext; }, /** * The area that this panel is a part of. diff --git a/plugins/c9.ide.plugins/manager.js b/plugins/c9.ide.plugins/manager.js index 89aa6516..ec27acfd 100644 --- a/plugins/c9.ide.plugins/manager.js +++ b/plugins/c9.ide.plugins/manager.js @@ -100,6 +100,7 @@ define(function(require, exports, module) { // var emit = plugin.getEmitter(); var HASSDK = c9.location.indexOf("sdk=0") === -1; + var ENABLED = c9.location.indexOf("sdk=1") > -1; var model, datagrid, filterbox; var btnUninstall, btnReport, btnReadme, btnCloud9; @@ -122,14 +123,16 @@ define(function(require, exports, module) { // updateCommandsFromSettings(); // }, plugin); - menus.addItemByPath("File/New Plugin", null, 210, plugin); - Object.keys(TEMPLATES).forEach(function(name){ - menus.addItemByPath("File/New Plugin/" + TEMPLATES[name], new ui.item({ - onclick: function(){ - createNewPlugin(name); - } - }), 210, plugin); - }); + if (ENABLED) { + menus.addItemByPath("File/New Plugin", null, 210, plugin); + Object.keys(TEMPLATES).forEach(function(name){ + menus.addItemByPath("File/New Plugin/" + TEMPLATES[name], new ui.item({ + onclick: function(){ + createNewPlugin(name); + } + }), 210, plugin); + }); + } } var drawn;