Пример #1
0
        hook: function() {

            // Prepare the menu.
            this.nodes.push(menus.addItemByPath('Tools/Emmet/', new apf.menu(), 900));

            // Emmet > Expand Abbreviation
            var mnuItemExpand = new apf.item({
                command: 'expand',
                onclick: function(editor) {
                    runEmmetAction('expand_abbreviation', editor);
                }
            });

            this.nodes.push(menus.addItemByPath('Tools/Emmet/Expand Abbreviation', mnuItemExpand, 910));

            commands.addCommand({
                name: 'expand',
                hint: 'expands CSS-like abbreviations into HTML/XML/CSS code, depending on current document’s syntax.',
                msg: 'Expanding abbreviation.',
                bindKey: {
                    mac: 'Command-Ctrl-Enter',
                    win: 'Shift-Ctrl-E'
                },
                isAvailable: function(editor) {
                    return true;
                },
                exec: function(editor) {
                    runEmmetAction('expand_abbreviation', editor);
                }
            });

            ext.initExtension(this);
        },
Пример #2
0
 hook : function(){
     var _self = this;        
     menus.addItemByPath("Tools/Git/Blame", new apf.item({
         // @TODO: Support more CVSs? Just "Blame this File"
         onclick : function(){
             _self.startBlame();
         },
         isAvailable : function(editor){
             return editor && editor.ceEditor;
         }
     }), 500);
     
     menus.addItemByPath("File/Git Blame", new apf.item({
         onclick : function() {
             _self.startBlame();
         },
         isAvailable : function(editor){
             return editor && editor.ceEditor;
         }
     }), 909);
     
     menus.addItemByPath("File/Git Blame", new apf.item({
         onclick : function() {
             _self.startBlame();
         }
     }), 909);
 },
Пример #3
0
    hook: function(ext, worker) {
        var _self = this;
        this.worker = worker;
        
        worker.on("enableRefactorings", function(event) {
            _self.enableRefactorings(event);
        });
        
        worker.on("variableLocations", function(event) {
            _self.enableVariableRefactor(event.data);
        });

        this.refactorItem = new apf.item({
            disabled: true,
            onclick: function() {
                _self.renameVariable();
            }
        });

        var nodes = [];
        nodes.push(
            menus.addItemByPath("Tools/~", new apf.divider(), 10000),
            menus.addItemByPath("Tools/Rename Variable", _self.refactorItem, 20000)
        );

        code.commandManager.addCommand({
            name: "renameVar",
            exec: function(editor) {
                _self.renameVariable();
            }
        });
        
        ext.hotitems.renameVar = [nodes[1]];
        ext.nodes.push(nodes[0], nodes[1]);
    },
Пример #4
0
 hook: function(ext, worker) {
     var _self = complete = this;
     language = ext;
     worker.on("complete", function(event) {
         if(ext.disabled) return;
         _self.onComplete(event);
     });
     this.$onChange = this.onChange.bind(this);
     
     ext.nodes.push(
         menus.addItemByPath("Edit/~", new apf.divider(), 2000),
         menus.addItemByPath("Edit/Show Autocomplete", new apf.item({
             command : "complete"
         }), 2100)
     );
     
     commands.addCommand({
         name: "complete",
         hint: "code complete",
         bindKey: {mac: "Ctrl-Space|Alt-Space", win: "Ctrl-Space|Alt-Space"},
         isAvailable : function(editor){
             return apf.activeElement.localName == "codeeditor";
         },
         exec: function(editor) {
             _self.invoke();
         }
     });
     
     this.ext = ext;
 },
Пример #5
0
     ide.addEventListener("loadsettings", function(e) {            
         var model = e && e.model || settings.model;
     
         var sessions = model.queryNodes("auto/sessions/session");
     
         menus.addItemByPath("View/Tabs/~", new apf.divider(), 700);
         
         menus.addItemByPath("View/Tabs/Load Tab Session", {
             menu : _self.mnuTabLoadSessions = new apf.menu({
                 onitemclick : function(e){
                     _self.loadSession(e.relatedNode.value);
                 }
             }),
             item : _self.mnuFileLoadSession = new apf.item({
                 disabled: !sessions.length
             })
         }, 800);
             
         var itmSaveSessions = menus.addItemByPath("View/Tabs/Save Tab Session", new apf.item({
             caption : "Save Tab Session",
             onclick : function(){
                 ext.initExtension(_self);
                 winSaveSessionAs.show();
             },
             disabled : "{!!!tabEditors.activepage}"
         }), 900);
             
         menus.addItemByPath("View/Tabs/Delete Tab Session", {    
             menu : _self.mnuTabDeleteSessions = new apf.menu({
                 onitemclick : function(e){
                     _self.removeSession(e.relatedNode.value);
                 }
             }), 
             item : _self.mnuFileDeleteSession = new apf.item({
                 disabled: !sessions.length
             })
         }, 1000);
         
         // get sessionnames to order alfabetically
         var sessionnames = [];
         for (var i = 0, l = sessions.length; i < l; i++){ 
             sessionnames.push(sessions[i].getAttribute("name"));
         }
         sessionnames.sort();
         
         sessionnames.forEach(function(name) {
             _self.mnuTabLoadSessions.appendChild(new apf.item({
                 caption : name,
                 //type    : "radio",
                 value   : name
             }));
             _self.mnuTabDeleteSessions.appendChild(new apf.item({
                 caption : name,
                 //type    : "radio",
                 value   : name
             }));
         });
 
         _self.hotitems["savetabsession"] = [itmSaveSessions];
     });
Пример #6
0
    hook : function(){
        var _self = this;

        var mnuItem = new apf.item({
        	command : "gotofile"
	    });
        
        commands.addCommand({
            name: "gotofile",
            hint: "search for a filename and jump to it",
            bindKey: {mac: "Command-E", win: "Ctrl-E"},
            exec: function () {
                _self.toggleDialog(1);
            }
        });

        this.nodes.push(
            menus.addItemByPath("File/Open...", mnuItem, 500),
            menus.addItemByPath("Goto/Goto File...", mnuItem.cloneNode(false), 100),
    
            this.model = new apf.model(),
            this.modelCache = new apf.model()
        );
                
        ide.addEventListener("init.ext/editors/editors", function(){
            _self.markupInsertionPoint = tabEditors;
            //tabEditors.appendChild(winGoToFile);
        });
        
        ide.addEventListener("extload", function(){
            _self.updateFileCache();
        });
    },
Пример #7
0
 hook : function(){
     var _self = this;
     
     var isAvailable = function(){
         if (apf.activeElement && apf.activeElement.localName == "codeeditor")
             return !(window.event instanceof KeyboardEvent);
         
         return self.trFiles && apf.activeElement == trFiles;
     };
     
     commands.addCommand({
         name: "cut",
         bindKey: {mac: "Command-X", win: "Ctrl-X"},
         isAvailable : isAvailable,
         exec: function(){ _self.cut(); }
     });
     
     commands.addCommand({
         name: "copy",
         bindKey: {mac: "Command-C", win: "Ctrl-C"},
         isAvailable : isAvailable,
         exec: function(){ _self.copy(); }
     });
     
     commands.addCommand({
         name: "paste",
         bindKey: {mac: "Command-V", win: "Ctrl-V"},
         isAvailable : isAvailable,
         exec: function(){ _self.paste(); }
     });
     
     commands.addCommand({
         name: "clearcut",
         bindKey: {mac: "ESC", win: "ESC"},
         isAvailable : function(){
             return self.trFiles && apf.activeElement == trFiles;
         },
         exec: function(){ 
             var nodes = apf.clipboard.store;
             if (!nodes) return;
             
             apf.clipboard.$highlightSelection(trFiles, nodes, true);
             apf.clipboard.clear();
         }
     });
     
     this.nodes.push(
         menus.addItemByPath("Edit/~", new apf.divider(), 300),
         menus.addItemByPath("Edit/Cut", new apf.item({
             command : "cut"
         }), 400),
         menus.addItemByPath("Edit/Copy", new apf.item({
             command : "copy"
         }), 500),
         menus.addItemByPath("Edit/Paste", new apf.item({
             command : "paste"
         }), 600)
     );
 },
Пример #8
0
    hook : function(){
        var _self = this;

        var mnuItem = new apf.item({
            command : "gotofile"
        });

        commands.addCommand({
            name: "gotofile",
            hint: "search for a filename and jump to it",
            bindKey: {mac: "Command-E", win: "Ctrl-E"},
            exec: function () {
                if (!_self.isGeneric)
                    _self.toggleDialog(1);
                else {
                    ext.initExtension(_self);
                    winGoToFile.visible = true;
                    winGoToFile.hide();
                    winBlockGotoFile.show();
                }
            }
        });

        this.nodes.push(
            menus.addItemByPath("File/Open...", mnuItem, 500),
            menus.addItemByPath("Goto/Goto File...", mnuItem.cloneNode(false), 100),

            this.model = new apf.model()
        );

        ide.addEventListener("init.ext/editors/editors", this.$initEditorExt = function(){
            _self.markupInsertionPoint = tabEditors;
            //tabEditors.appendChild(winGoToFile);
        });

        ide.addEventListener("extload", this.$extLoad = function(){
            if (!_self.isGeneric) {
                _self.updateFileCache();
            }
        });
        
        ide.addEventListener("closefile", this.$closeFile = function() {
            setTimeout(function(){
                _self.updateWinPos();
            });
        });
        
        ide.addEventListener("newfile", this.$newFile = function() {
            _self.updateFileCache(true);
        });
        
        ide.addEventListener("removefile", this.$removeFile = function() {
            _self.updateFileCache(true);
        });
    },
Пример #9
0
 init : function(){
     var _self = this;
     this.winExtensionTemplate = winExtensionTemplate;
     
     commands.addCommand({
         name: "insertIf",
         hint: "I'll say something",
         msg: "Popping window!",
         bindKey: {mac: "Ctrl-i", win: "Ctrl-2"},
         isAvailable : function() {
             
             return true;    
         },
         exec: function() {
             //This calls the insertIf function.
             _self.insertIf();
             //_self.winExtensionTemplate.show()
         }
     });
     
     this.nodes.push(
         menus.addItemByPath("Edit/Insert If Statement", new apf.item({
             command : "insertIf"
         }), 5400)
     ); 
     commands.addCommand({
         name: "insertIfElse",
         hint: "I'll say something",
         msg: "Popping window!",
         bindKey: {mac: "Ctrl-Shift+i", win: "Ctrl-2"},
         isAvailable : function() {
             
             return true;    
         },
         exec: function() {
             //This calls the insertIfElse function.
             _self.insertIfElse();
             //_self.winExtensionTemplate.show()
         }
     });
     
     this.nodes.push(
         menus.addItemByPath("Edit/Insert If Else Statement", new apf.item({
             command : "insertIfElse"
         }), 5400)
     ); 
    /* Just a plain menu...
     this.nodes.push(
         menus.addItemByPath("Edit/Extension Template", new apf.item({
             onclick : function(){
                 _self.winExtensionTemplate.show();
             }
         }), 5400)
     ); */
 },
Пример #10
0
    hook : function(amlNode){
        var _self = this;

        var readonly = ide.readonly;

        commands.addCommand({
            name: "newfile",
            hint: "create a new file resource",
            msg: "New file created.",
            bindKey: {mac: "Option-Shift-N", win: "Ctrl-N"},
            exec: function () {
                _self.newfile();
            }
        });

        commands.addCommand({
            name: "newfiletemplate",
            hint: "create a new directory resource",
            msg: "New directory created.",
            bindKey: {mac: "Option-Ctrl-N", win: "Ctrl-Alt-N"},
            exec: function () {
                _self.newfiletemplate();
            }
        });

        commands.addCommand({
            name: "newfolder",
            hint: "open the new file template dialog",
            bindKey: {mac: "Option-Ctrl-Shift-N", win: "Ctrl-N"},
            exec: function () {
                _self.newfolder();
            }
        });

        this.nodes.push(
            menus.addItemByPath("File/New File", new apf.item({
                disabled: readonly,
                command : "newfile",
            }), 100),
            menus.addItemByPath("File/New From Template...", new apf.item({
                disabled: readonly,
                command : "newfiletemplate"
            }), 200),
            menus.addItemByPath("File/New Folder", new apf.item({
                disabled: readonly,
                command : "newfolder"
            }), 300),
            menus.addItemByPath("File/~", new apf.divider(), 400)
        );
    },
Пример #11
0
 init : function(amlNode){
     var _self = this;
     
     this.nodes.push(
         this.group = apf.document.documentElement.appendChild(new apf.group({
             value : "[{req" + "uire('core/settings').model}::auto/panels/@active]"
         })),
         
         menus.addItemByPath("View/Side Bar/", null, 100),
         menus.addItemByPath("View/~", new apf.divider(), 200),
         
         this.mnuPanelsNone = 
           menus.addItemByPath("View/Side Bar/None", new apf.item({
             type: "radio",
             selected : "true",
             group: this.group,
             "onclick": function(e){
                 _self.deactivate(null, true);
             }
           }), 100),
         menus.addItemByPath("View/Side Bar/~", new apf.divider(), 200)
     );
     
     var timer;
     colLeft.addEventListener("resize", function(){
         if (!_self.currentPanel || _self.animating)
             return;
         
         clearTimeout(timer);
         timer = setTimeout(function(){
             if (!_self.currentPanel)
                 return;
             
             var query = "auto/panels/panel[@path='" 
                 + _self.currentPanel.path + "']/@width";
                 
             if (settings.model.queryValue(query) != colLeft.getWidth())
                 settings.model.setQueryValue(query, colLeft.getWidth());
         }, 500);
     });
     
     /**** Support for state preservation ****/
     
     var _self = this;
     ide.addEventListener("settings.load", function(e){
         settings.setDefaults("general", [["animateui", apf.isGecko ? false : true]]);
     });
 },
Пример #12
0
        ide.addEventListener("init.ext/code/code", function() {
            _self.nodes.push(
                mnuCtxEditor.insertBefore(new apf.divider({
                    visible : "{mnuCtxEditorJumpToDef.visible}"
                }), mnuCtxEditor.firstChild),
                mnuCtxEditor.insertBefore(new apf.item({
                    id : "mnuCtxEditorJumpToDef",
                    caption : "Jump to Definition",
                    command: "jumptodef"
                }), mnuCtxEditor.firstChild),
                menus.addItemByPath("Goto/Jump to Definition", new apf.item({
                    caption : "Jump to Definition",
                    command: "jumptodef"
                }), 899)
            );

            // when the context menu pops up we'll ask the worker whether we've
            // jumptodef available here
            apf.addListener(mnuCtxEditor, "prop.visible", function(ev) {
                // only fire when visibility is set to true
                if (ev.value) {
                    // because of delays we'll enable by default
                    mnuCtxEditorJumpToDef.enable();
                    _self.checkIsJumpToDefAvailable();
                }
            });
        });
Пример #13
0
    init : function(){
        var _self = this;
        this.winExtensionTemplate = winExtensionTemplate;
        
        commands.addCommand({
            name: "AutoGen",
            hint: "I'll say something to main",
            msg: "Popping window! Now",
            bindKey: {mac: "Shift-1", win: "Ctrl-1"},
            isAvailable : function() {
                return true;    
            },
            exec: function() {
                _self.winExtensionTemplate.show()
            }
        });
        
        this.nodes.push(
            menus.addItemByPath("Edit/Auto Main Template", new apf.item({
                command : "AutoGen"
            }), 5400)
        ); 

       /* Just a plain menu...
        this.nodes.push(
            menus.addItemByPath("Edit/Extension Template", new apf.item({
                onclick : function(){
                    _self.winExtensionTemplate.show();
                }
            }), 5400)
        ); */
    },
Пример #14
0
        function themeMenuCreator(name, path) {
            menus.addItemByPath("View/Themes/" + name, new apf.item({
                type    : "radio",
                value   : path || themes[name],
                
                onmouseover: function(e) {
                    var value = this.value;
                    
                    clearTimeout(timer);
                    timer = setTimeout(function(){
                        _self.set(value, true);
                    }, 200);
                },
                
                onmouseout: function(e) {
                    clearTimeout(timer);
                    
                    if (!_self.saved) {
                        timer = setTimeout(function(){
                            _self.set(_self.currTheme);
                        }, 200);
                    }
                },

                onclick : function(e) {
                    var path = e.currentTarget.value;
                    _self.set(path);
                    ide.dispatchEvent("track_action", {type: "theme change", theme: path});
                }
            }));
        }
Пример #15
0
    hook : function(){
        var _self = this;

        ide.addEventListener("settings.load", function(e){
            if (!e.model.queryNode("auto/statusbar/@show"))
                e.model.setQueryValue("auto/statusbar/@show", "true");
            
            if (apf.isTrue(e.model.queryValue("auto/statusbar/@show")))
                _self.preinit();
        });
        
        this.viewStatusBarMenuItem = new apf.item({
            test : "1",
            type : "check",
            checked : "[{require('ext/settings/settings').model}::auto/statusbar/@show]",
            // -> if you're looking for disabled, check the init function :-)
            // the moment that someone clicks this thing well call preinit 
            // (its already called if the user has it checked on IDE load)
            "onprop.checked": function (ev) {
                if (ev.value) {
                    _self.preinit();
                }
                // if weve already been loaded, then update the status here
                // otherwise it'll be done in init
                if (window.mdlStatusBar) {
                    apf.xmldb.setAttribute(mdlStatusBar.data.selectSingleNode("//state"), "showStatusbar", ev.value);
                }
            }
        });
        
        this.nodes.push(menus.addItemByPath("View/Status Bar", this.viewStatusBarMenuItem, 600));
    },
Пример #16
0
 register : function(themes){
     var _self = this;
     
     for (var name in themes) {
         menus.addItemByPath("View/Themes/" + name, new apf.item({
             type    : "radio",
             value   : themes[name],
             //group   : this.group
             
             onmouseover: function(e) {
                 //_self.currTheme = settings.model.queryValue("editors/code/@theme");
                 //settings.model.setQueryValue("editors/code/@theme", this.value);
                 _self.set(this.value);
                 _self.saved = false;
             },
             
             onmouseout: function(e) {
                 if (!_self.saved) {
                     settings.model.setQueryValue("editors/code/@theme", _self.currTheme);
                     _self.saved = false;
                 }
             }
         }));
     }
     
     this.themes = themes;
 },
Пример #17
0
 register : function(themes){
     var _self = this;
     
     var timer;
     
     for (var name in themes) {
         menus.addItemByPath("View/Themes/" + name, new apf.item({
             type    : "radio",
             value   : themes[name],
             
             onmouseover: function(e) {
                 var value = this.value;
                 
                 clearTimeout(timer);
                 timer = setTimeout(function(){
                     _self.set(value, true);
                 }, 200);
             },
             
             onmouseout: function(e) {
                 clearTimeout(timer);
                 
                 if (!_self.saved) {
                     timer = setTimeout(function(){
                         _self.set(_self.currTheme);
                     }, 200);
                 }
             }
         }));
     }
     
     this.themes = themes;
 },
Пример #18
0
 hook : function(){
     var _self = this;
     
     commands.addCommand({
         name : "formatjson",
         bindKey : {mac: "Shift-Command-J", win: "Ctrl-Shift-J"},
         hint: "reformat the current JSON document",
         isAvailable : function(editor){
             if (editor && editor.ceEditor) {
                 var range = editor.ceEditor.$editor.getSelectionRange();
                 return range.start.row == range.end.row 
                   && range.start.column == range.end.column
             }
             return false;
         },
         exec : function(){
             ext.initExtension(_self);
             _self.winFormat.show();
         }
     });
     
     var mnuItem;
     this.nodes.push(
         mnuItem = menus.addItemByPath("Tools/Format JSON", new apf.item({
             command : "formatjson"
         }), 500)
     );
 },
Пример #19
0
    hook : function(){
        var _self = this;
        this.nodes.push(
            menus.addItemByPath("Tools/Log...", new apf.item({
                onclick : function(){
                    ext.initExtension(_self);
                    winLog.show();
                }
            }), 1500000)
        );
        
        var send = ide.send;
        ide.send = function(msg){
            _self.log(null, "websocket", msg);
                
            send.apply(ide, arguments);
        }

        ide.addEventListener("socketMessage", function(e){
            _self.log(null, "websocket_receive", null, e.message);
        });

        this.wrapHttp("apf.http", "http");
        this.wrapHttp("apf.webdav", "webdav");
        this.wrapInstance("require('ext/filesystem/filesystem').webdav", "fswebdav");
    },
Пример #20
0
 hook : function(){
     var _self = this;
     
     this.nodes.push(
         menus.addItemByPath("View/Project Bar", new apf.item({
             type: "check",
             checked : "[{require('ext/settings/settings').model}::auto/sidebar/@show]",
             "onprop.checked" : function(e) {
                 ext.initExtension(_self);
                 
                 if (apf.isTrue(e.value))
                     navbar.show();
                 else
                     navbar.hide();
             }
         }), 400)
     );
     
     ide.addEventListener("loadsettings", function(e){
         if (apf.isTrue(e.model.queryValue("auto/sidebar/@show"))) {
             ext.initExtension(_self);
             navbar.show();
         }
     });
 },
Пример #21
0
    hook : function(){
        var _self = this;

        this.nodes.push(
            menus.addItemByPath("Goto/Goto Line...", new apf.item({
                caption : "Goto Line...",
                hint: "enter a linenumber and jump to it in the active document",
                command : "gotoline"
            }), 200)
        );

        ide.addEventListener("gotoline", function() {
            _self.gotoline();
        });

        commands.addCommand({
            name: "gotoline",
            bindKey: {mac: "Command-L", win: "Ctrl-G"},
            isAvailable : function(editor){
                return editor && editor.ceEditor;
            },
            exec: function() {
                _self.gotoline();
            }
        });
    },
Пример #22
0
    hook: function() {
        var mnuView = menus.addItemByPath("View");

        this.nodes.push(mnuView.appendChild(new apf.item({
            caption: 'GPanel',
            onclick: __bind(function() {
                this.gpanel();
            }, this)
        })));

        // Trying this location as well
        commands.addCommand({
            name: "gpanelShow",
            bindKey : { mac : "Ctrl-Shift-G", win : "Ctrl-Shift-G" },
            exec: function(e){
                gpanelWindow.show();
            }
        });
        commands.addCommand({
            name: "studentBuild",
            exec: __bind(function() {
                this.nativeCompile();
            }, this)
        });

        ext.initExtension(this);
    },
Пример #23
0
    hook : function(){
        var _self = this;

        ide.addEventListener("settings.load", function(e){
            if (!e.model.queryNode("auto/statusbar/@show"))
                e.model.setQueryValue("auto/statusbar/@show", "true");

            var codeSettings = e.model.queryNode("//editors/code");
            if (codeSettings && codeSettings.hasAttribute("autohidehorscrollbar")) {
                _self.horScrollAutoHide = codeSettings.getAttribute("autohidehorscrollbar");
            }
            
            if (apf.isTrue(e.model.queryValue("auto/statusbar/@show")))
                _self.preinit();
        });

        this.nodes.push(
            menus.addItemByPath("View/Status Bar", new apf.item({
                test : "1",
                type : "check",
                checked : "[{require('ext/settings/settings').model}::auto/statusbar/@show]",
                "onprop.checked" : function(e){
                    if (apf.isTrue(e.value))
                        _self.preinit();
                }
            }), 600)
        );
    },
Пример #24
0
    init : function(){
        var _self = this;
        
        this.stylesheet = apf.createStylesheet();
        
        this.nodes.push(
            this.group = new apf.group()
        );
        
        var mnuThemes = menus.addItemByPath("View/Themes/", new apf.menu({
            "onprop.visible" : function(e){
                if (e.value) {
                    mnuThemes.select(null, 
                      settings.model.queryValue("editors/code/@theme") 
                        || _self.defaultTheme);
                }
            }
        }), 350000);

        ide.addEventListener("init.ext/code/code", function(e) {
            if (e.ext.amlEditor && e.ext.amlEditor.$editor)
                mnuThemes.select(null, _self.defaultTheme);
        });
        
        ide.addEventListener("settings.load", function(e){
            var theme = _self.currTheme = e.model.queryValue("editors/code/@theme")
                || _self.defaultTheme;
            
            _self.setThemedGUI(theme);
        });
    },
Пример #25
0
 init : function(){
     var _self = this;
     var drupalMenu = new apf.menu();
     this.nodes.push(
         menus.addItemByPath("Drupal/", drupalMenu, 90000)
     );
 },
Пример #26
0
    register : function(oExtension){
        /*var id = "rb" + oExtension.path.replace(/\//g, "_");

        oExtension.$rbEditor = barButtons.appendChild(new apf.radiobutton({
            id        : id,
            label     : oExtension.name,
            value     : oExtension.path,
            margin    : "0 -1 0 0",
            visible   : "{require('ext/editors/editors').isEditorAvailable(tabEditors.activepage, '" + oExtension.path + "')}",
            onclick   : function(){
                require('ext/editors/editors').switchEditor(this.value);
            }
        }));*/

        var _self = this;

        //Add a menu item to the list of editors
        oExtension.$itmEditor = menus.addItemByPath("View/Editors/" + oExtension.name, new apf.item({
            type     : "radio",
            value    : oExtension.path,
            group    : this.$itmGroup,
            onclick  : function(){
                _self.switchEditor(this.value);
            }
        }), 40000);

        var _self = this;
        oExtension.fileExtensions.each(function(mime){
            (_self.fileExtensions[mime] || (_self.fileExtensions[mime] = [])).push(oExtension);
        });

        if (!this.fileExtensions["default"] || (oExtension.name && oExtension.name == "Code Editor"))
            this.fileExtensions["default"] = oExtension;
    },
Пример #27
0
    register : function(name, type, options, getPage){
        var panel = this.dockpanels[name] || (this.dockpanels[name] = {});
        panel[type] = {
            options : options,
            getPage : getPage
        };
        var layout = this.layout, _self = this;

        panel[type].mnuItem = menus.addItemByPath(
          "View/Dock Panels/" + options.menu.split("/").pop(),
          new apf.item({
            id      : "mnu" + type,
            type    : "check",
            onclick : function(){
                var page = getPage();

                var uId = _self.getButtons(name, type)[0].uniqueId;
                layout.show(uId, true);
                if (layout.isExpanded(uId) < 0)
                    layout.showMenu(uId);

                page.parentNode.set(page);
            }
        }));
    },
Пример #28
0
        hook : function(){
            var _self = this;

            var mnuHelp = new apf.menu();

            this.nodes.push(
                menus.addItemByPath("Help/", mnuHelp, 100000)
            );


            var c = 0;
            menus.addItemByPath("Help/About", new apf.item({ onclick : function(){ _self.showAbout(); }}), c += 100);
            //menus.addItemByPath("Help/IDE Status", new apf.item({ onclick : function(){window.open('http://status.c9.io'); }}), c += 100);
            //mnuChangelog = menus.addItemByPath("Help/Changelog", new apf.item({ onclick : function(){ window.open('http://c9.io/site/tag/changelog/'); }}), c += 100);

            menus.addItemByPath("Help/~", new apf.divider(), c += 100);
            //menus.addItemByPath("Help/Documentation", new apf.item({ onclick : function(){ window.open('https://docs.c9.io') }}), c += 100);
            ide.addEventListener("hook.ext/keybindings_default/keybindings_default", function(c, e) {
                menus.addItemByPath("Help/Keyboard Shortcuts", new apf.item({ onclick : function(){ e.ext.keybindings(); }}), c);
            }.bind(this, c += 100));
            ide.addEventListener("hook.ext/quickstart/quickstart", function(c, e) {
                menus.addItemByPath("Help/Quick Start", new apf.item({ onclick : function(){ e.ext.launchQS(); }}), c);
            }.bind(this, c += 100));
            ide.addEventListener("hook.ext/guidedtour/guidedtour", function(c, e) {
                menus.addItemByPath("Help/Take a Guided Tour", new apf.item({ onclick : function(){ e.ext.launchGT(); }}), c);
            }.bind(this, c += 100));
            /*menus.addItemByPath("Help/~", new apf.divider(), c += 100);

            menus.addItemByPath("Help/Support/", null, c += 100);
            menus.addItemByPath("Help/~", new apf.divider(), c += 100);
            menus.addItemByPath("Help/Learning/", null, c += 100);
            menus.addItemByPath("Help/~", new apf.divider(), c += 100);
            menus.addItemByPath("Help/Get in Touch/", null, c += 100);

            c = 0;
            menus.addItemByPath("Help/Support/FAQ", new apf.item({ onclick : function(){ window.open('http://support.c9.io/forums/20346041-frequently-asked-questions'); }}), c += 100);
            menus.addItemByPath("Help/Support/Troubleshooting Tips", new apf.item({ onclick : function(){ window.open('http://support.c9.io/forums/20329737-troubleshooting'); }}), c += 100);

            c = 0;
            menus.addItemByPath("Help/Learning/YouTube Channel for Cloud9 IDE", new apf.item({ onclick : function(){ window.open('http://www.youtube.com/user/c9ide/videos?view=pl'); }}), c += 100);

            c = 0;
            menus.addItemByPath("Help/Get in Touch/Blog", new apf.item({ onclick : function(){ window.open('http://blog.c9.io/'); }}), c += 100);
            menus.addItemByPath("Help/Get in Touch/Twitter (for Cloud9 IDE support)", new apf.item({ onclick : function(){ window.open('https://twitter.com/#!/C9Support'); }}), c += 100);
            menus.addItemByPath("Help/Get in Touch/Twitter (for general Cloud9 tweets)", new apf.item({ onclick : function(){ window.open('https://twitter.com/#!/cloud9ide'); }}), c += 100);
            menus.addItemByPath("Help/Get in Touch/Facebook", new apf.item({ onclick : function(){ window.open('https://www.facebook.com/Cloud9IDE'); }}), c += 100);*/
        },
Пример #29
0
 ide.addEventListener("init.ext/code/code", function() {
     ext.nodes.push(
         menus.addItemByPath("Tools/Quickfix", new apf.item({
             caption: "Quickfix",
             command: "quickfix"
         }), 20001)
     );
 });
Пример #30
0
    hook : function(){
        var _self = this;
        
        commands.commands["findnext"].hint = "search for the next occurrence of the search query your entered last";
        commands.commands["findnext"].msg = "Navigating to next match.";
        commands.commands["findprevious"].hint = "search for the previous occurrence of the search query your entered last";
        commands.commands["findprevious"].msg = "Navigating to previous match.";
        
        commands.addCommand({
            name: "find",
            hint: "open the quicksearch dialog to quickly search for a phrase",
            bindKey: {mac: "Command-F", win: "Ctrl-F"},
            isAvailable : function(editor){
                return editor && editor.ceEditor;
            },
            exec: function(env, args, request) {
                _self.toggleDialog(1);
            }
        });

        ide.addEventListener("minimap.visibility", function(e) {
            if (e.visibility === "shown")
                _self.offsetWidth = _self.defaultOffset + e.width;
            else
                _self.offsetWidth = _self.defaultOffset;

            _self.updateBarPosition();
        });

        ide.addEventListener("revisions.visibility", function(e) {
            if (e.visibility === "shown")
                _self.offsetWidth = _self.defaultOffset + e.width;
            else
                _self.offsetWidth = _self.defaultOffset;

            _self.updateBarPosition();
        });
        
        this.nodes.push(
            menus.addItemByPath("Find/~", new apf.divider(), 1000),

            menus.addItemByPath("Find/Quick Find", new apf.item({
                command : "find"
            }), 1100)
        );
    },