Changeset 52165 in webkit


Ignore:
Timestamp:
Dec 15, 2009 11:51:27 AM (14 years ago)
Author:
bweinstein@apple.com
Message:

Part of <http://webkit.org/b/32568>.
New Web Inspector: The Context Menu should be used in more places.

Reviewed by Timothy Hatcher.

Add support for context menu entries for editing and deleting elements
in the datagrid. This gives support to deleting cookies, and editing and
deleting session storage and local storage.

  • English.lproj/localizedStrings.js: Added "Edit" and "Add New" entries (delete was already there)
  • inspector/front-end/DataGrid.js:

(WebInspector.DataGrid): Added context menu listener.
(WebInspector.DataGrid.prototype._contextMenuInDataTable):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52164 r52165  
     12009-12-15  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Part of <http://webkit.org/b/32568>.
     6        New Web Inspector: The Context Menu should be used in more places.
     7       
     8        Add support for context menu entries for editing and deleting elements
     9        in the datagrid. This gives support to deleting cookies, and editing and
     10        deleting session storage and local storage.
     11
     12        * English.lproj/localizedStrings.js: Added "Edit" and "Add New" entries (delete was already there)
     13        * inspector/front-end/DataGrid.js:
     14        (WebInspector.DataGrid): Added context menu listener.
     15        (WebInspector.DataGrid.prototype._contextMenuInDataTable):
     16
    1172009-12-15  Kenneth Russell  <kbr@google.com>
    218
  • trunk/WebCore/inspector/front-end/DataGrid.js

    r52099 r52165  
    3939    this._dataTable.addEventListener("mousedown", this._mouseDownInDataTable.bind(this), true);
    4040    this._dataTable.addEventListener("click", this._clickInDataTable.bind(this), true);
     41   
     42    this._dataTable.addEventListener("contextmenu", this._contextMenuInDataTable.bind(this), true);
    4143   
    4244    // FIXME: Add a createCallback which is different from editCallback and has different
     
    616618            gridNode.select();
    617619    },
     620   
     621    _contextMenuInDataTable: function(event)
     622    {
     623        var gridNode = this.dataGridNodeFromNode(event.target);
     624        if (!gridNode || !gridNode.selectable)
     625            return;
     626       
     627        if (gridNode.isEventWithinDisclosureTriangle(event))
     628            return;
     629     
     630        var contextMenu = new WebInspector.ContextMenu();
     631       
     632        // FIXME: Use the column names for Editing, instead of just "Edit".
     633        if (this.dataGrid._editCallback) {
     634            if (gridNode === this.creationNode)
     635                contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
     636            else
     637                contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
     638        }
     639        if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
     640            contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
     641       
     642        contextMenu.show(event);
     643    },
    618644
    619645    _clickInDataTable: function(event)
Note: See TracChangeset for help on using the changeset viewer.