add export and import for menu

This commit is contained in:
Van 2014-12-18 16:46:38 +08:00
parent dc31495232
commit cee226e672
2 changed files with 26 additions and 9 deletions

View File

@ -237,6 +237,8 @@ var tree = {
}, },
onRightClick: function (event, treeId, treeNode) { onRightClick: function (event, treeId, treeNode) {
if (treeNode) { if (treeNode) {
menu.undisabled(['import', 'export']);
wide.curNode = treeNode; wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode); tree.fileTree.selectNode(treeNode);
@ -252,6 +254,8 @@ var tree = {
"left": event.clientX + "px", "left": event.clientX + "px",
"display": "block" "display": "block"
}).show(); }).show();
menu.disabled(['import']);
} else { // 右击了目录 } else { // 右击了目录
if (wide.curNode.removable) { if (wide.curNode.removable) {
$dirRMenu.find(".remove").removeClass("disabled"); $dirRMenu.find(".remove").removeClass("disabled");
@ -278,6 +282,12 @@ var tree = {
if (treeNode) { if (treeNode) {
wide.curNode = treeNode; wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode); tree.fileTree.selectNode(treeNode);
menu.undisabled(['import', 'export']);
if (!tree.isDir()) { // 如果右击了文件
menu.disabled(['import']);
}
$("#files").focus(); $("#files").focus();
} }
} }

View File

@ -42,7 +42,7 @@
<span>{{.i18n.file}}</span> <span>{{.i18n.file}}</span>
<div class="frame"> <div class="frame">
<ul> <ul>
<li class="save-all disabled" onclick="menu.saveAllFiles()"> <li class="save-all disabled" onclick="if (!$(this).hasClass('disabled')){menu.saveAllFiles()}">
<span class="font-ico ico-save"></span> <span class="font-ico ico-save"></span>
<span>{{.i18n.save_all_files}}</span> <span>{{.i18n.save_all_files}}</span>
<span class="fn-right ft-small">Shift-Ctrl-S</span> <span class="fn-right ft-small">Shift-Ctrl-S</span>
@ -52,6 +52,13 @@
<span>{{.i18n.close_all_files}}</span> <span>{{.i18n.close_all_files}}</span>
</li> </li>
<li class="hr"></li> <li class="hr"></li>
<li class="disabled import" onclick="if (!$(this).hasClass('disabled')){$('#importFileupload').click();}">
<span class="ico-import font-ico"></span> {{.i18n.import}}
</li>
<li class="disabled export" onclick="if (!$(this).hasClass('disabled')){tree.export(this);}">
<span class="ico-export font-ico"></span> {{.i18n.export}}
</li>
<li class="hr"></li>
<li onclick="menu.exit()"> <li onclick="menu.exit()">
<span class="font-ico ico-signout"></span> <span class="font-ico ico-signout"></span>
<span>{{.i18n.exit}}</span> <span>{{.i18n.exit}}</span>
@ -259,27 +266,27 @@
<span>{{.i18n.run}}</span> <span>{{.i18n.run}}</span>
<div class="frame"> <div class="frame">
<ul> <ul>
<li class="build disabled" onclick="menu.build()"> <li class="build disabled" onclick="if (!$(this).hasClass('disabled')){menu.build()}">
<span class="font-ico ico-build"></span> <span class="font-ico ico-build"></span>
<span>{{.i18n.build}}</span> <span>{{.i18n.build}}</span>
<span class="fn-right ft-small">F5</span> <span class="fn-right ft-small">F5</span>
</li> </li>
<li class="run disabled" onclick="menu.run()"> <li class="run disabled" onclick="if (!$(this).hasClass('disabled')){menu.run()}">
<span class="font-ico ico-buildrun"></span> <span class="font-ico ico-buildrun"></span>
<span>{{.i18n.build_n_run}}</span> <span>{{.i18n.build_n_run}}</span>
<span class="fn-right ft-small">F6</span> <span class="fn-right ft-small">F6</span>
</li> </li>
<li class="hr"></li> <li class="hr"></li>
<li class="go-test disabled" onclick="menu.test()"> <li class="go-test disabled" onclick="if (!$(this).hasClass('disabled')){menu.test()}">
<span class="space"></span> <span class="space"></span>
<span>{{.i18n.test}}</span> <span>{{.i18n.test}}</span>
</li> </li>
<li class="hr"></li> <li class="hr"></li>
<li class="go-get disabled" onclick="menu.goget()"> <li class="go-get disabled" onclick="if (!$(this).hasClass('disabled')){menu.goget()}">
<span class="space"></span> <span class="space"></span>
<span>{{.i18n.goget}}</span> <span>{{.i18n.goget}}</span>
</li> </li>
<li class="go-install disabled" onclick="menu.goinstall()"> <li class="go-install disabled" onclick="if (!$(this).hasClass('disabled')){menu.goinstall()}">
<span class="space"></span> <span class="space"></span>
<span>{{.i18n.goinstall}}</span> <span>{{.i18n.goinstall}}</span>
</li> </li>