aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-04-28 14:46:02 +0200
committerSiri Hansen <[email protected]>2016-05-19 15:21:52 +0200
commit5ddc361d6652fb5aa7a7ac6ad06be95f16f0030d (patch)
tree064e546b1c81fca8fd7ea809ae2eaa1fc4b5c1fd /lib
parent6dfc55407493278e9875814df054de4df51e7527 (diff)
downloadotp-5ddc361d6652fb5aa7a7ac6ad06be95f16f0030d.tar.gz
otp-5ddc361d6652fb5aa7a7ac6ad06be95f16f0030d.tar.bz2
otp-5ddc361d6652fb5aa7a7ac6ad06be95f16f0030d.zip
[observer] Add right click menu in Table tab
Diffstat (limited to 'lib')
-rw-r--r--lib/observer/src/observer_tv_wx.erl33
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/observer/src/observer_tv_wx.erl b/lib/observer/src/observer_tv_wx.erl
index 6acaf4fc73..59f6443551 100644
--- a/lib/observer/src/observer_tv_wx.erl
+++ b/lib/observer/src/observer_tv_wx.erl
@@ -37,7 +37,8 @@
-define(ID_UNREADABLE, 405).
-define(ID_SYSTEM_TABLES, 406).
-define(ID_TABLE_INFO, 407).
-
+-define(ID_SHOW_TABLE, 408).
+
-record(opt, {type=ets,
sys_hidden=true,
unread_hidden=true,
@@ -49,6 +50,7 @@
{
parent,
grid,
+ panel,
node=node(),
opt=#opt{},
selected,
@@ -86,12 +88,13 @@ init([Notebook, Parent]) ->
wxListItem:destroy(Li),
wxListCtrl:connect(Grid, command_list_item_activated),
+ wxListCtrl:connect(Grid, command_list_item_right_click),
wxListCtrl:connect(Grid, command_list_item_selected),
wxListCtrl:connect(Grid, command_list_col_click),
wxListCtrl:connect(Grid, size, [{skip, true}]),
wxWindow:setFocus(Grid),
- {Panel, #state{grid=Grid, parent=Parent, timer={false, 10}}}.
+ {Panel, #state{grid=Grid, parent=Parent, panel=Panel, timer={false, 10}}}.
handle_event(#wx{id=?ID_REFRESH},
State = #state{node=Node, grid=Grid, opt=Opt}) ->
@@ -145,6 +148,16 @@ handle_event(#wx{event=#wxList{type=command_list_item_activated,
end,
{noreply, State};
+handle_event(#wx{event=#wxList{type=command_list_item_right_click}},
+ State=#state{panel=Panel}) ->
+
+ Menu = wxMenu:new(),
+ wxMenu:append(Menu, ?ID_TABLE_INFO, "Table info"),
+ wxMenu:append(Menu, ?ID_SHOW_TABLE, "Show Table Content"),
+ wxWindow:popupMenu(Panel, Menu),
+ wxMenu:destroy(Menu),
+ {noreply, State};
+
handle_event(#wx{event=#wxList{type=command_list_item_selected, itemIndex=Index}},
State) ->
{noreply, State#state{selected=Index}};
@@ -160,6 +173,22 @@ handle_event(#wx{id=?ID_TABLE_INFO},
{noreply, State}
end;
+handle_event(#wx{id=?ID_SHOW_TABLE},
+ State=#state{grid=Grid, node=Node, opt=#opt{type=Type}, tabs=Tabs, selected=Sel}) ->
+ case Sel of
+ undefined ->
+ {noreply, State};
+ R when is_integer(R) ->
+ Table = lists:nth(Sel+1, Tabs),
+ case Table#tab.protection of
+ private ->
+ self() ! {error, "Table has 'private' protection and can not be read"};
+ _ ->
+ observer_tv_table:start_link(Grid, [{node,Node}, {type,Type}, {table,Table}])
+ end,
+ {noreply, State}
+ end;
+
handle_event(#wx{id=?ID_REFRESH_INTERVAL},
State = #state{grid=Grid, timer=Timer0}) ->
Timer = observer_lib:interval_dialog(Grid, Timer0, 10, 5*60),