How to use the ext/splitview/splits.getActive function in ext

To help you get started, we’ve selected a few ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
mergeTab: function(dir) {
        var bRight   = dir == "right";
        var tabs     = tabEditors;
        var pages    = tabs.getPages();
        var curr     = tabs.getPage();
        var split    = Splits.getActive();
        var splitLen = split ? split.pairs.length : 0;
        if (split && Splits.indexOf(split, curr) > -1)
            curr = split.pairs[bRight ? splitLen - 1 : 0].page;
        if (!curr || pages.length == 1)
            return;

        var idx;
        if (splitLen == 3) {
            // if the max amount of tabs has been reached inside a split view,
            // then the user may remove the last or first tab from it.
            idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
        }
        else {
            var currIdx = pages.indexOf(curr);
            idx = currIdx + (bRight ? 1 : -1);
        }
github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
onCycleTab: function(e) {
        var pages  = e.pages;
        var split = Splits.getActive();
        if (!split)
            return;
        if (split.pairs.length == pages.length)
            return (e.returnValue = false);
        
        var maxIdx = pages.length - 1;
        var bRight = e.dir == "right";
        var idx = pages.indexOf(split.pairs[bRight ? split.pairs.length - 1 : 0].page) + (bRight ? 1 : -1);
        idx = idx < 0 ? maxIdx : idx > maxIdx ? 0 : idx;
        if (Splits.indexOf(split, pages[idx]) > -1)
            return (e.returnValue = false);
        
        // check if the next tab is inside a split as well:
        split = Splits.get(pages[idx])[0];
        if (split)
            e.returnValue = pages.indexOf(split.pairs[0].page);
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
mergeTab: function(dir) {
        var bRight   = dir == "right";
        var tabs     = tabEditors;
        var pages    = tabs.getPages();
        var curr     = tabs.getPage();
        var split    = splits.getActive();
        var splitLen = split ? split.pairs.length : 0;
        if (split && splits.indexOf(split, curr) > -1)
            curr = split.pairs[bRight ? splitLen - 1 : 0].page;
        if (!curr || pages.length == 1)
            return;

        var idx;
        if (splitLen == 3) {
            // if the max amount of tabs has been reached inside a split view,
            // then the user may remove the last or first tab from it.
            idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
        }
        else {
            var currIdx = pages.indexOf(curr);
            idx = currIdx + (bRight ? 1 : -1);
        }
github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
mergeTab: function(dir) {
        var bRight   = dir == "right";
        var tabs     = tabEditors;
        var pages    = tabs.getPages();
        var curr     = tabs.getPage();
        var split    = Splits.getActive();
        var splitLen = split ? split.pairs.length : 0;
        if (split && Splits.indexOf(split, curr) > -1)
            curr = split.pairs[bRight ? splitLen - 1 : 0].page;
        if (!curr || pages.length == 1)
            return;
        
        var idx;
        if (splitLen == 3) {
            // if the max amount of tabs has been reached inside a split view,
            // then the user may remove the last or first tab from it.
            idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
        }
        else {
            var currIdx = pages.indexOf(curr);
            idx = currIdx + (bRight ? 1 : -1);
        }
github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
else {
                    page = tabs.getPage(ids[j]);
                    if (page) {
                        if (!pageSet) {
                            tabs.set(page);
                            pageSet = true;
                        }
                        Splits.mutate(null, page);
                    }
                }
            }
            if (gridLayout)
                Splits.update(null, gridLayout);

            if (apf.isTrue(nodes[i].getAttribute("active")))
                active = Splits.getActive();
        }
        
        if (!active || Splits.indexOf(active, activePage) == -1)
            tabs.set(activePage);
        else
            Splits.show(active);
    },
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
ide.addEventListener("correctactivepage", function(e) {
            var split = splits.getActive();
            var editor = editors.currentEditor && editors.currentEditor.amlEditor;
            if (!split || !editor)
                return;
            var idx = splits.indexOf(split, editor);
            if (idx == -1)
                return;
            e.returnValue = split.pairs[idx].page;
        });
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
ide.addEventListener("correctactivepage", function(e) {
            var split = Splits.getActive();
            var editor = Editors.currentEditor && Editors.currentEditor.amlEditor;
            if (!split || !editor)
                return;
            var idx = Splits.indexOf(split, editor);
            if (idx == -1)
                return;
            e.returnValue = split.pairs[idx].page;
        });
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
cycleEditors: function(dir) {
        var split = Splits.getActive();
        if (!split)
            return;

        var bNext   = dir == "next";
        var currIdx = split.activePage;
        var idx     = currIdx + (bNext ? 1 : -1);
        if (idx < 0)
            idx = split.pairs.length - 1;
        if (idx > split.pairs.length - 1)
            idx = 0;

        Splits.setActivePage(split, split.pairs[idx].page);
        return false;
    },
github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
cycleEditors: function(dir) {
        var split = Splits.getActive();
        if (!split)
            return;

        var bNext   = dir == "next";
        var currIdx = split.activePage;
        var idx     = currIdx + (bNext ? 1 : -1);
        if (idx < 0)
            idx = split.pairs.length - 1;
        if (idx > split.pairs.length - 1)
            idx = 0;

        Splits.setActivePage(split, split.pairs[idx].page);
        return false;
    },
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
ide.addEventListener("pageswitch", function(e) {
            if (!splits.getActive())
                return;
            _self.save();

            if (typeof mnuSyntax == "undefined")
                return;

            var item;
            var syntax = mnuSyntax;
            var value = code.getContentType(e.page.$model.data);
            for (var i = 0, l = syntax.childNodes.length; i < l; ++i) {
                item = syntax.childNodes[i];
                if (!item || !item.localName || item.localName != "item")
                    continue;
                if (item.value == value) {
                    item.select();
                    break;