| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 this.listItemElement.classList.add("navigator-" + type + "-tree-item", "navi
gator-folder-tree-item"); | 875 this.listItemElement.classList.add("navigator-" + type + "-tree-item", "navi
gator-folder-tree-item"); |
| 876 this._nodeType = type; | 876 this._nodeType = type; |
| 877 this.title = title; | 877 this.title = title; |
| 878 this.tooltip = title; | 878 this.tooltip = title; |
| 879 this.createIcon(); | 879 this.createIcon(); |
| 880 this._navigatorView = navigatorView; | 880 this._navigatorView = navigatorView; |
| 881 this._hoverCallback = hoverCallback; | 881 this._hoverCallback = hoverCallback; |
| 882 }; | 882 }; |
| 883 | 883 |
| 884 WebInspector.NavigatorFolderTreeElement.prototype = { | 884 WebInspector.NavigatorFolderTreeElement.prototype = { |
| 885 /** |
| 886 * @override |
| 887 */ |
| 885 onpopulate: function() | 888 onpopulate: function() |
| 886 { | 889 { |
| 887 this._node.populate(); | 890 this._node.populate(); |
| 888 }, | 891 }, |
| 889 | 892 |
| 893 /** |
| 894 * @override |
| 895 */ |
| 890 onattach: function() | 896 onattach: function() |
| 891 { | 897 { |
| 892 this.collapse(); | 898 this.collapse(); |
| 893 this._node.onattach(); | 899 this._node.onattach(); |
| 894 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), false); | 900 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), false); |
| 895 this.listItemElement.addEventListener("mousemove", this._mouseMove.bind(
this), false); | 901 this.listItemElement.addEventListener("mousemove", this._mouseMove.bind(
this), false); |
| 896 this.listItemElement.addEventListener("mouseleave", this._mouseLeave.bin
d(this), false); | 902 this.listItemElement.addEventListener("mouseleave", this._mouseLeave.bin
d(this), false); |
| 897 }, | 903 }, |
| 898 | 904 |
| 899 /** | 905 /** |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 | 975 |
| 970 WebInspector.NavigatorSourceTreeElement.prototype = { | 976 WebInspector.NavigatorSourceTreeElement.prototype = { |
| 971 /** | 977 /** |
| 972 * @return {!WebInspector.UISourceCode} | 978 * @return {!WebInspector.UISourceCode} |
| 973 */ | 979 */ |
| 974 get uiSourceCode() | 980 get uiSourceCode() |
| 975 { | 981 { |
| 976 return this._uiSourceCode; | 982 return this._uiSourceCode; |
| 977 }, | 983 }, |
| 978 | 984 |
| 985 /** |
| 986 * @override |
| 987 */ |
| 979 onattach: function() | 988 onattach: function() |
| 980 { | 989 { |
| 981 this.listItemElement.draggable = true; | 990 this.listItemElement.draggable = true; |
| 982 this.listItemElement.addEventListener("click", this._onclick.bind(this),
false); | 991 this.listItemElement.addEventListener("click", this._onclick.bind(this),
false); |
| 983 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), false); | 992 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), false); |
| 984 this.listItemElement.addEventListener("mousedown", this._onmousedown.bin
d(this), false); | 993 this.listItemElement.addEventListener("mousedown", this._onmousedown.bin
d(this), false); |
| 985 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin
d(this), false); | 994 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin
d(this), false); |
| 986 }, | 995 }, |
| 987 | 996 |
| 988 _onmousedown: function(event) | 997 _onmousedown: function(event) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1000 }, | 1009 }, |
| 1001 | 1010 |
| 1002 _shouldRenameOnMouseDown: function() | 1011 _shouldRenameOnMouseDown: function() |
| 1003 { | 1012 { |
| 1004 if (!this._uiSourceCode.canRename()) | 1013 if (!this._uiSourceCode.canRename()) |
| 1005 return false; | 1014 return false; |
| 1006 var isSelected = this === this.treeOutline.selectedTreeElement; | 1015 var isSelected = this === this.treeOutline.selectedTreeElement; |
| 1007 return isSelected && this.treeOutline.element.hasFocus() && !WebInspecto
r.isBeingEdited(this.treeOutline.element); | 1016 return isSelected && this.treeOutline.element.hasFocus() && !WebInspecto
r.isBeingEdited(this.treeOutline.element); |
| 1008 }, | 1017 }, |
| 1009 | 1018 |
| 1019 /** |
| 1020 * @override |
| 1021 */ |
| 1010 selectOnMouseDown: function(event) | 1022 selectOnMouseDown: function(event) |
| 1011 { | 1023 { |
| 1012 if (event.which !== 1 || !this._shouldRenameOnMouseDown()) { | 1024 if (event.which !== 1 || !this._shouldRenameOnMouseDown()) { |
| 1013 TreeElement.prototype.selectOnMouseDown.call(this, event); | 1025 TreeElement.prototype.selectOnMouseDown.call(this, event); |
| 1014 return; | 1026 return; |
| 1015 } | 1027 } |
| 1016 setTimeout(rename.bind(this), 300); | 1028 setTimeout(rename.bind(this), 300); |
| 1017 | 1029 |
| 1018 /** | 1030 /** |
| 1019 * @this {WebInspector.NavigatorSourceTreeElement} | 1031 * @this {WebInspector.NavigatorSourceTreeElement} |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 try { | 1506 try { |
| 1495 title = decodeURI(title); | 1507 title = decodeURI(title); |
| 1496 } catch (e) { | 1508 } catch (e) { |
| 1497 } | 1509 } |
| 1498 } | 1510 } |
| 1499 var treeElement = new WebInspector.NavigatorFolderTreeElement(this._navi
gatorView, this._type, title); | 1511 var treeElement = new WebInspector.NavigatorFolderTreeElement(this._navi
gatorView, this._type, title); |
| 1500 treeElement.setNode(node); | 1512 treeElement.setNode(node); |
| 1501 return treeElement; | 1513 return treeElement; |
| 1502 }, | 1514 }, |
| 1503 | 1515 |
| 1516 /** |
| 1517 * @override |
| 1518 */ |
| 1504 wasPopulated: function() | 1519 wasPopulated: function() |
| 1505 { | 1520 { |
| 1506 if (!this._treeElement || this._treeElement._node !== this) | 1521 if (!this._treeElement || this._treeElement._node !== this) |
| 1507 return; | 1522 return; |
| 1508 this._addChildrenRecursive(); | 1523 this._addChildrenRecursive(); |
| 1509 }, | 1524 }, |
| 1510 | 1525 |
| 1511 _addChildrenRecursive: function() | 1526 _addChildrenRecursive: function() |
| 1512 { | 1527 { |
| 1513 var children = this.children(); | 1528 var children = this.children(); |
| 1514 for (var i = 0; i < children.length; ++i) { | 1529 for (var i = 0; i < children.length; ++i) { |
| 1515 var child = children[i]; | 1530 var child = children[i]; |
| 1516 this.didAddChild(child); | 1531 this.didAddChild(child); |
| 1517 if (child instanceof WebInspector.NavigatorFolderTreeNode) | 1532 if (child instanceof WebInspector.NavigatorFolderTreeNode) |
| 1518 child._addChildrenRecursive(); | 1533 child._addChildrenRecursive(); |
| 1519 } | 1534 } |
| 1520 }, | 1535 }, |
| 1521 | 1536 |
| 1522 _shouldMerge: function(node) | 1537 _shouldMerge: function(node) |
| 1523 { | 1538 { |
| 1524 return this._type !== WebInspector.NavigatorView.Types.Domain && node in
stanceof WebInspector.NavigatorFolderTreeNode; | 1539 return this._type !== WebInspector.NavigatorView.Types.Domain && node in
stanceof WebInspector.NavigatorFolderTreeNode; |
| 1525 }, | 1540 }, |
| 1526 | 1541 |
| 1542 /** |
| 1543 * @param {!WebInspector.NavigatorTreeNode} node |
| 1544 * @override |
| 1545 */ |
| 1527 didAddChild: function(node) | 1546 didAddChild: function(node) |
| 1528 { | 1547 { |
| 1529 function titleForNode(node) | 1548 function titleForNode(node) |
| 1530 { | 1549 { |
| 1531 return node._title; | 1550 return node._title; |
| 1532 } | 1551 } |
| 1533 | 1552 |
| 1534 if (!this._treeElement) | 1553 if (!this._treeElement) |
| 1535 return; | 1554 return; |
| 1536 | 1555 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 */ | 1700 */ |
| 1682 setTitle: function(title) | 1701 setTitle: function(title) |
| 1683 { | 1702 { |
| 1684 this._title = title; | 1703 this._title = title; |
| 1685 if (this._treeElement) | 1704 if (this._treeElement) |
| 1686 this._treeElement.title = this._title; | 1705 this._treeElement.title = this._title; |
| 1687 }, | 1706 }, |
| 1688 | 1707 |
| 1689 __proto__: WebInspector.NavigatorTreeNode.prototype | 1708 __proto__: WebInspector.NavigatorTreeNode.prototype |
| 1690 }; | 1709 }; |
| OLD | NEW |