機能を利用する意味がない時は項目を無効化

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4788 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-23 16:14:45 +00:00
parent 3cb53596ac
commit cbf1095d49
2 changed files with 34 additions and 10 deletions

View File

@ -2266,20 +2266,43 @@ catch(e) {
createSubTree : function(aTabs)
{
if (!aTabs || !aTabs.length) return;
aTabs = this.cleanUpTabsArray(aTabs);
aTabs = this.getRootTabs(aTabs);
if (!aTabs.length) return;
var b = this.getTabBrowserFromChild(aTabs[0]);
var root = b.addTab(this.getGroupTabURI());
window.setTimeout(function(aSelf) {
aTabs.forEach(function(aTab) {
var parent = aTab;
while (parent = this.getParentTab(parent))
{
if (aTabs.indexOf(parent) > -1) return;
}
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) {
var parent = this.getParentTab(aTab);
if (parent && aTabs.indexOf(parent) > -1) return;
roots.push(aTab);
}, this);
return roots;
},
bookmarkTabSubTree : function(aTabOrTabs)

View File

@ -48,7 +48,8 @@
insertafter="multipletab-selection-splitWindow"
label="&selection.createSubTree.label;"
accesskey="&selection.createSubTree.accesskey;"
oncommand="TreeStyleTabService.createSubTree(MultipleTabService.getSelectedTabs());"/>
oncommand="TreeStyleTabService.createSubTree(MultipleTabService.getSelectedTabs());"
multipletab-enabled="TreeStyleTabService.canCreateSubTree(MultipleTabService.getSelectedTabs())"/>
</menupopup>
<stringbundleset id="stringbundleset">