ツリーの子だけを閉じる機能が働かなくなっていた
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5680 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
ee71505b0f
commit
47826d2029
@ -1279,43 +1279,30 @@ catch(e) {
|
|||||||
|
|
||||||
removeTabSubtree : function TSTService_removeTabSubtree(aTabOrTabs, aOnlyChildren)
|
removeTabSubtree : function TSTService_removeTabSubtree(aTabOrTabs, aOnlyChildren)
|
||||||
{
|
{
|
||||||
var tabs = this.gatherSubtreeMemberTabs(aTabOrTabs, aOnlyChildren);
|
var tabs = this.gatherSubtreeMemberTabs(aTabOrTabs);
|
||||||
if (!this.warnAboutClosingTabs(tabs.length))
|
if (!this.warnAboutClosingTabs(tabs.length))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.splitTabsToSubtrees(tabs).forEach(function(aTabs) {
|
this.splitTabsToSubtrees(tabs).forEach(function(aTabs) {
|
||||||
if (!this.fireTabSubtreeClosingEvent(aTabs[0], aTabs))
|
if (!this.fireTabSubtreeClosingEvent(aTabs[0], aTabs))
|
||||||
return;
|
return;
|
||||||
this.markAsClosedSet(aTabs);
|
|
||||||
var b = this.getTabBrowserFromChild(aTabs[0]);
|
var b = this.getTabBrowserFromChild(aTabs[0]);
|
||||||
for (var i = tabs.length-1; i > -1; i--)
|
if (aOnlyChildren)
|
||||||
|
aTabs = aTabs.slice(1);
|
||||||
|
if (!aTabs.length)
|
||||||
|
return;
|
||||||
|
this.stopRendering();
|
||||||
|
this.markAsClosedSet(aTabs);
|
||||||
|
for (var i = aTabs.length-1; i > -1; i--)
|
||||||
{
|
{
|
||||||
b.removeTab(aTabs[i]);
|
b.removeTab(aTabs[i]);
|
||||||
}
|
}
|
||||||
|
this.startRendering();
|
||||||
this.fireTabSubtreeClosedEvent(b, aTabs[0], aTabs)
|
this.fireTabSubtreeClosedEvent(b, aTabs[0], aTabs)
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
removeTabSubTree : function() { return this.removeTabSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
|
removeTabSubTree : function() { return this.removeTabSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
|
||||||
|
|
||||||
splitTabsToSubtrees : function TSTService_splitTabsToSubtrees(aTabs) /* PUBLIC API */
|
|
||||||
{
|
|
||||||
var groups = [];
|
|
||||||
var group = [];
|
|
||||||
this.cleanUpTabsArray(aTabs)
|
|
||||||
.forEach(function(aTab) {
|
|
||||||
var parent = this.getParentTab(aTab);
|
|
||||||
if (group.indexOf(parent) < 0) {
|
|
||||||
groups.push(group);
|
|
||||||
group = [aTab];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
group.push(aTab);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
groups.push(group);
|
|
||||||
return groups;
|
|
||||||
},
|
|
||||||
|
|
||||||
fireTabSubtreeClosingEvent : function TSTService_fireTabSubtreeClosingEvent(aParentTab, aClosedTabs)
|
fireTabSubtreeClosingEvent : function TSTService_fireTabSubtreeClosingEvent(aParentTab, aClosedTabs)
|
||||||
{
|
{
|
||||||
/* PUBLIC API */
|
/* PUBLIC API */
|
||||||
|
@ -726,7 +726,7 @@ var TreeStyleTabUtils = {
|
|||||||
return aA._tPos - aB._tPos;
|
return aA._tPos - aB._tPos;
|
||||||
},
|
},
|
||||||
|
|
||||||
gatherSubtreeMemberTabs : function TSTUtils_gatherSubtreeMemberTabs(aTabOrTabs, aOnlyChildren)
|
gatherSubtreeMemberTabs : function TSTUtils_gatherSubtreeMemberTabs(aTabOrTabs)
|
||||||
{
|
{
|
||||||
var tabs = aTabOrTabs;
|
var tabs = aTabOrTabs;
|
||||||
if (!(tabs instanceof Array)) {
|
if (!(tabs instanceof Array)) {
|
||||||
@ -740,14 +740,30 @@ var TreeStyleTabUtils = {
|
|||||||
descendant = descendant.concat(b.treeStyleTab.getDescendantTabs(tabs[i]));
|
descendant = descendant.concat(b.treeStyleTab.getDescendantTabs(tabs[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aOnlyChildren)
|
|
||||||
tabs = this.cleanUpTabsArray(descendant);
|
|
||||||
else
|
|
||||||
tabs = this.cleanUpTabsArray(tabs.concat(descendant));
|
tabs = this.cleanUpTabsArray(tabs.concat(descendant));
|
||||||
|
|
||||||
return tabs;
|
return tabs;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
splitTabsToSubtrees : function TSTUtils_splitTabsToSubtrees(aTabs) /* PUBLIC API */
|
||||||
|
{
|
||||||
|
var groups = [];
|
||||||
|
var group = [];
|
||||||
|
this.cleanUpTabsArray(aTabs)
|
||||||
|
.forEach(function(aTab) {
|
||||||
|
var parent = this.getParentTab(aTab);
|
||||||
|
if (!parent || group.indexOf(parent) < 0) {
|
||||||
|
if (group.length) groups.push(group);
|
||||||
|
group = [aTab];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
group.push(aTab);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
if (group.length) groups.push(group);
|
||||||
|
return groups;
|
||||||
|
},
|
||||||
|
|
||||||
// tabbrowser
|
// tabbrowser
|
||||||
|
|
||||||
getTabBrowserFromChild : function TSTUtils_getTabBrowserFromChild(aTabBrowserChild)
|
getTabBrowserFromChild : function TSTUtils_getTabBrowserFromChild(aTabBrowserChild)
|
||||||
|
Loading…
Reference in New Issue
Block a user