機能を利用する意味がない時は項目を無効化
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4788 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
3cb53596ac
commit
cbf1095d49
@ -2266,20 +2266,43 @@ catch(e) {
|
|||||||
|
|
||||||
createSubTree : function(aTabs)
|
createSubTree : function(aTabs)
|
||||||
{
|
{
|
||||||
if (!aTabs || !aTabs.length) return;
|
aTabs = this.getRootTabs(aTabs);
|
||||||
|
if (!aTabs.length) return;
|
||||||
aTabs = this.cleanUpTabsArray(aTabs);
|
|
||||||
|
|
||||||
var b = this.getTabBrowserFromChild(aTabs[0]);
|
var b = this.getTabBrowserFromChild(aTabs[0]);
|
||||||
var root = b.addTab(this.getGroupTabURI());
|
var root = b.addTab(this.getGroupTabURI());
|
||||||
|
|
||||||
|
window.setTimeout(function(aSelf) {
|
||||||
|
aTabs.forEach(function(aTab) {
|
||||||
|
b.treeStyleTab.attachTabTo(aTab, root);
|
||||||
|
}, aSelf);
|
||||||
|
}, 0, this);
|
||||||
|
},
|
||||||
|
canCreateSubTree : function(aTabs)
|
||||||
|
{
|
||||||
|
aTabs = this.getRootTabs(aTabs);
|
||||||
|
if (aTabs.length < 2) return false;
|
||||||
|
|
||||||
|
var lastParent = this.getParentTab(aTabs[0]);
|
||||||
|
for (let i = 1, maxi = aTabs.length-1; i < maxi; i++)
|
||||||
|
{
|
||||||
|
let parent = this.getParentTab(aTabs[i]);
|
||||||
|
if (!lastParent || parent != lastParent) return true;
|
||||||
|
lastParent = parent;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
getRootTabs : function(aTabs)
|
||||||
|
{
|
||||||
|
var roots = [];
|
||||||
|
if (!aTabs || !aTabs.length) return roots;
|
||||||
|
aTabs = this.cleanUpTabsArray(aTabs);
|
||||||
aTabs.forEach(function(aTab) {
|
aTabs.forEach(function(aTab) {
|
||||||
var parent = aTab;
|
var parent = this.getParentTab(aTab);
|
||||||
while (parent = this.getParentTab(parent))
|
if (parent && aTabs.indexOf(parent) > -1) return;
|
||||||
{
|
roots.push(aTab);
|
||||||
if (aTabs.indexOf(parent) > -1) return;
|
|
||||||
}
|
|
||||||
b.treeStyleTab.attachTabTo(aTab, root);
|
|
||||||
}, this);
|
}, this);
|
||||||
|
return roots;
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkTabSubTree : function(aTabOrTabs)
|
bookmarkTabSubTree : function(aTabOrTabs)
|
||||||
|
@ -48,7 +48,8 @@
|
|||||||
insertafter="multipletab-selection-splitWindow"
|
insertafter="multipletab-selection-splitWindow"
|
||||||
label="&selection.createSubTree.label;"
|
label="&selection.createSubTree.label;"
|
||||||
accesskey="&selection.createSubTree.accesskey;"
|
accesskey="&selection.createSubTree.accesskey;"
|
||||||
oncommand="TreeStyleTabService.createSubTree(MultipleTabService.getSelectedTabs());"/>
|
oncommand="TreeStyleTabService.createSubTree(MultipleTabService.getSelectedTabs());"
|
||||||
|
multipletab-enabled="TreeStyleTabService.canCreateSubTree(MultipleTabService.getSelectedTabs())"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
|
|
||||||
<stringbundleset id="stringbundleset">
|
<stringbundleset id="stringbundleset">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user