|
| 1 | +window.cls || (window.cls = {}); |
| 2 | + |
| 3 | +/** |
| 4 | + * @constructor |
| 5 | + * @extends ViewBase |
| 6 | + */ |
| 7 | + |
| 8 | +cls.ReturnValuesView = function(id, name, container_class) |
| 9 | +{ |
| 10 | + this.createView = function(container) |
| 11 | + { |
| 12 | + this._container = container; |
| 13 | + var return_values = stop_at.get_return_values(); |
| 14 | + if (return_values.length) |
| 15 | + { |
| 16 | + return_values.forEach(function(retval) |
| 17 | + { |
| 18 | + var object = retval.value[3/*OBJECT*/]; |
| 19 | + if (object) |
| 20 | + { |
| 21 | + var name = object[4/*CLASS_NAME*/] === "Function" && !object[5] |
| 22 | + ? ui_strings.S_ANONYMOUS_FUNCTION_NAME |
| 23 | + : object[5]; |
| 24 | + retval.model = new cls.InspectableJSObject(retval.rt_id, |
| 25 | + object[0/*OBJECT_ID*/], |
| 26 | + name, |
| 27 | + object[4/*CLASS_NAME*/]); |
| 28 | + } |
| 29 | + }); |
| 30 | + this._create_view_bound = this._create_view.bind(this, container, return_values); |
| 31 | + this._create_view_bound(); |
| 32 | + } |
| 33 | + else |
| 34 | + { |
| 35 | + this._create_view_bound = null; |
| 36 | + container.clearAndRender(this._return_values_no_content()); |
| 37 | + } |
| 38 | + }; |
| 39 | + |
| 40 | + this._create_view = function(container, return_values) |
| 41 | + { |
| 42 | + container.clearAndRender(templates.return_values(return_values, this._search_term)); |
| 43 | + }; |
| 44 | + |
| 45 | + this._return_values_no_content = function() |
| 46 | + { |
| 47 | + return ( |
| 48 | + ["div", |
| 49 | + "No return values", |
| 50 | + "class", "not-content inspection" |
| 51 | + ] |
| 52 | + ); |
| 53 | + }; |
| 54 | + |
| 55 | + this.onbeforesearch = function(msg) |
| 56 | + { |
| 57 | + if (this._create_view_bound && this.isvisible()) |
| 58 | + { |
| 59 | + this._search_term = msg.search_term; |
| 60 | + this._create_view_bound(); |
| 61 | + } |
| 62 | + }.bind(this); |
| 63 | + |
| 64 | + // TODO: CLEAN UP!!! |
| 65 | + |
| 66 | + this._init = function(id, name, container_class) |
| 67 | + { |
| 68 | + View.prototype.init.call(this, id, name, container_class); |
| 69 | + this.required_services = ["ecmascript-debugger"]; |
| 70 | + this._container = null; |
| 71 | + this._models = []; |
| 72 | + this._search_term = ""; |
| 73 | + } |
| 74 | + |
| 75 | + this._init(id, name, container_class); |
| 76 | +}; |
| 77 | + |
| 78 | +cls.ReturnValuesView.create_ui_widgets = function() |
| 79 | +{ |
| 80 | + new ToolbarConfig |
| 81 | + ( |
| 82 | + "return-values", |
| 83 | + null, |
| 84 | + [ |
| 85 | + { |
| 86 | + handler: "return-values-text-search", |
| 87 | + shortcuts: "return-values-text-search", |
| 88 | + title: ui_strings.S_INPUT_DEFAULT_TEXT_FILTER, |
| 89 | + label: ui_strings.S_INPUT_DEFAULT_TEXT_FILTER, |
| 90 | + type: "filter" |
| 91 | + } |
| 92 | + ] |
| 93 | + ); |
| 94 | + var text_search = new TextSearch(1); |
| 95 | + text_search.add_listener("onbeforesearch", |
| 96 | + window.views["return-values"].onbeforesearch); |
| 97 | + |
| 98 | + var onViewCreated = function(msg) |
| 99 | + { |
| 100 | + if (msg.id == "return-values") |
| 101 | + { |
| 102 | + text_search.setContainer(msg.container); |
| 103 | + text_search.setFormInput(views.inspection.getToolbarControl(msg.container, "return-values-text-search")); |
| 104 | + } |
| 105 | + }; |
| 106 | + |
| 107 | + var onViewDestroyed = function(msg) |
| 108 | + { |
| 109 | + if (msg.id == "return-values") |
| 110 | + { |
| 111 | + text_search.cleanup(); |
| 112 | + } |
| 113 | + }; |
| 114 | + |
| 115 | + messages.addListener("view-created", onViewCreated); |
| 116 | + messages.addListener("view-destroyed", onViewDestroyed); |
| 117 | + |
| 118 | + eventHandlers.input["return-values-text-search"] = function(event, target) |
| 119 | + { |
| 120 | + text_search.searchDelayed(target.value); |
| 121 | + }; |
| 122 | + |
| 123 | + ActionBroker.get_instance().get_global_handler(). |
| 124 | + register_shortcut_listener("return-values-text-search", |
| 125 | + cls.Helpers.shortcut_search_cb.bind(text_search)); |
| 126 | + |
| 127 | + var broker = ActionBroker.get_instance(); |
| 128 | +}; |
| 129 | + |
0 commit comments