| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 * @param {!TreeElement} treeElement | 84 * @param {!TreeElement} treeElement |
| 85 */ | 85 */ |
| 86 static _treeElementOrder(treeElement) { | 86 static _treeElementOrder(treeElement) { |
| 87 if (treeElement._boostOrder) | 87 if (treeElement._boostOrder) |
| 88 return 0; | 88 return 0; |
| 89 | 89 |
| 90 if (!Sources.NavigatorView._typeOrders) { | 90 if (!Sources.NavigatorView._typeOrders) { |
| 91 var weights = {}; | 91 var weights = {}; |
| 92 var types = Sources.NavigatorView.Types; | 92 var types = Sources.NavigatorView.Types; |
| 93 weights[types.Root] = 1; | 93 weights[types.Root] = 1; |
| 94 weights[types.Category] = 1; | |
| 95 weights[types.Domain] = 10; | 94 weights[types.Domain] = 10; |
| 96 weights[types.FileSystemFolder] = 1; | 95 weights[types.FileSystemFolder] = 1; |
| 97 weights[types.NetworkFolder] = 1; | 96 weights[types.NetworkFolder] = 1; |
| 98 weights[types.SourceMapFolder] = 2; | 97 weights[types.SourceMapFolder] = 2; |
| 99 weights[types.File] = 10; | 98 weights[types.File] = 10; |
| 100 weights[types.Frame] = 70; | 99 weights[types.Frame] = 70; |
| 101 weights[types.Worker] = 90; | 100 weights[types.Worker] = 90; |
| 102 weights[types.FileSystem] = 100; | 101 weights[types.FileSystem] = 100; |
| 103 Sources.NavigatorView._typeOrders = weights; | 102 Sources.NavigatorView._typeOrders = weights; |
| 104 } | 103 } |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 */ | 814 */ |
| 816 _targetNameChanged(event) { | 815 _targetNameChanged(event) { |
| 817 var target = /** @type {!SDK.Target} */ (event.data); | 816 var target = /** @type {!SDK.Target} */ (event.data); |
| 818 var targetNode = this._rootNode.child('target:' + target.id()); | 817 var targetNode = this._rootNode.child('target:' + target.id()); |
| 819 if (targetNode) | 818 if (targetNode) |
| 820 targetNode.setTitle(target.name()); | 819 targetNode.setTitle(target.name()); |
| 821 } | 820 } |
| 822 }; | 821 }; |
| 823 | 822 |
| 824 Sources.NavigatorView.Types = { | 823 Sources.NavigatorView.Types = { |
| 825 Category: 'category', | |
| 826 Domain: 'domain', | 824 Domain: 'domain', |
| 827 File: 'file', | 825 File: 'file', |
| 828 FileSystem: 'fs', | 826 FileSystem: 'fs', |
| 829 FileSystemFolder: 'fs-folder', | 827 FileSystemFolder: 'fs-folder', |
| 830 Frame: 'frame', | 828 Frame: 'frame', |
| 831 NetworkFolder: 'nw-folder', | 829 NetworkFolder: 'nw-folder', |
| 832 Root: 'root', | 830 Root: 'root', |
| 833 SourceMapFolder: 'sm-folder', | 831 SourceMapFolder: 'sm-folder', |
| 834 Worker: 'worker' | 832 Worker: 'worker' |
| 835 }; | 833 }; |
| 836 | 834 |
| 837 | |
| 838 /** | 835 /** |
| 839 * @unrestricted | 836 * @unrestricted |
| 840 */ | 837 */ |
| 841 Sources.NavigatorFolderTreeElement = class extends TreeElement { | 838 Sources.NavigatorFolderTreeElement = class extends TreeElement { |
| 842 /** | 839 /** |
| 843 * @param {!Sources.NavigatorView} navigatorView | 840 * @param {!Sources.NavigatorView} navigatorView |
| 844 * @param {string} type | 841 * @param {string} type |
| 845 * @param {string} title | 842 * @param {string} title |
| 846 * @param {function(boolean)=} hoverCallback | 843 * @param {function(boolean)=} hoverCallback |
| 847 */ | 844 */ |
| 848 constructor(navigatorView, type, title, hoverCallback) { | 845 constructor(navigatorView, type, title, hoverCallback) { |
| 849 super('', true); | 846 super('', true); |
| 850 this.listItemElement.classList.add('navigator-' + type + '-tree-item', 'navi
gator-folder-tree-item'); | 847 this.listItemElement.classList.add('navigator-' + type + '-tree-item', 'navi
gator-folder-tree-item'); |
| 851 this._nodeType = type; | 848 this._nodeType = type; |
| 852 this.title = title; | 849 this.title = title; |
| 853 this.tooltip = title; | 850 this.tooltip = title; |
| 854 this.createIcon(); | |
| 855 this._navigatorView = navigatorView; | 851 this._navigatorView = navigatorView; |
| 856 this._hoverCallback = hoverCallback; | 852 this._hoverCallback = hoverCallback; |
| 853 var iconType = 'largeicon-navigator-folder'; |
| 854 if (type === Sources.NavigatorView.Types.Domain) |
| 855 iconType = 'largeicon-navigator-domain'; |
| 856 else if (type === Sources.NavigatorView.Types.Frame) |
| 857 iconType = 'largeicon-navigator-frame'; |
| 858 else if (type === Sources.NavigatorView.Types.Worker) |
| 859 iconType = 'largeicon-navigator-worker'; |
| 860 this.setLeadingIcons([UI.Icon.create(iconType, 'icon')]); |
| 857 } | 861 } |
| 858 | 862 |
| 859 /** | 863 /** |
| 860 * @override | 864 * @override |
| 861 */ | 865 */ |
| 862 onpopulate() { | 866 onpopulate() { |
| 863 this._node.populate(); | 867 this._node.populate(); |
| 864 } | 868 } |
| 865 | 869 |
| 866 /** | 870 /** |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 * @param {!Sources.NavigatorUISourceCodeTreeNode} node | 934 * @param {!Sources.NavigatorUISourceCodeTreeNode} node |
| 931 */ | 935 */ |
| 932 constructor(navigatorView, uiSourceCode, title, node) { | 936 constructor(navigatorView, uiSourceCode, title, node) { |
| 933 super('', false); | 937 super('', false); |
| 934 this._nodeType = Sources.NavigatorView.Types.File; | 938 this._nodeType = Sources.NavigatorView.Types.File; |
| 935 this._node = node; | 939 this._node = node; |
| 936 this.title = title; | 940 this.title = title; |
| 937 this.listItemElement.classList.add( | 941 this.listItemElement.classList.add( |
| 938 'navigator-' + uiSourceCode.contentType().name() + '-tree-item', 'naviga
tor-file-tree-item'); | 942 'navigator-' + uiSourceCode.contentType().name() + '-tree-item', 'naviga
tor-file-tree-item'); |
| 939 this.tooltip = uiSourceCode.url(); | 943 this.tooltip = uiSourceCode.url(); |
| 940 this.createIcon(); | 944 var iconType = 'largeicon-navigator-file'; |
| 945 if (uiSourceCode.contentType() === Common.resourceTypes.Snippet) |
| 946 iconType = 'largeicon-navigator-snippet'; |
| 947 this.setLeadingIcons([UI.Icon.create(iconType, 'icon')]); |
| 941 | 948 |
| 942 this._navigatorView = navigatorView; | 949 this._navigatorView = navigatorView; |
| 943 this._uiSourceCode = uiSourceCode; | 950 this._uiSourceCode = uiSourceCode; |
| 944 } | 951 } |
| 945 | 952 |
| 946 /** | 953 /** |
| 947 * @return {!Workspace.UISourceCode} | 954 * @return {!Workspace.UISourceCode} |
| 948 */ | 955 */ |
| 949 get uiSourceCode() { | 956 get uiSourceCode() { |
| 950 return this._uiSourceCode; | 957 return this._uiSourceCode; |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 /** | 1603 /** |
| 1597 * @param {string} title | 1604 * @param {string} title |
| 1598 * @override | 1605 * @override |
| 1599 */ | 1606 */ |
| 1600 setTitle(title) { | 1607 setTitle(title) { |
| 1601 this._title = title; | 1608 this._title = title; |
| 1602 if (this._treeElement) | 1609 if (this._treeElement) |
| 1603 this._treeElement.title = this._title; | 1610 this._treeElement.title = this._title; |
| 1604 } | 1611 } |
| 1605 }; | 1612 }; |
| OLD | NEW |