aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-05-07 14:28:55 +0200
committerDan Gudmundsson <[email protected]>2012-05-08 12:36:48 +0200
commit5628fb8d88f91b3ef8e140e2658a6f61b4e42adb (patch)
tree5fd637bb062e5646cb6c70db6d564ad8d76253b7 /lib/observer
parent515e0ad4040bc50a637bb31fc33c825d41b4f0ac (diff)
downloadotp-5628fb8d88f91b3ef8e140e2658a6f61b4e42adb.tar.gz
otp-5628fb8d88f91b3ef8e140e2658a6f61b4e42adb.tar.bz2
otp-5628fb8d88f91b3ef8e140e2658a6f61b4e42adb.zip
[observer] Add more popup menus and info selected pid
Diffstat (limited to 'lib/observer')
-rw-r--r--lib/observer/src/observer_app_wx.erl8
-rw-r--r--lib/observer/src/observer_wx.erl9
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/observer/src/observer_app_wx.erl b/lib/observer/src/observer_app_wx.erl
index 4efcd44747..f9be11e05a 100644
--- a/lib/observer/src/observer_app_wx.erl
+++ b/lib/observer/src/observer_app_wx.erl
@@ -204,7 +204,7 @@ handle_event(#wx{id=?ID_PROC_MSG, event=#wxCommand{type=command_menu_selected}},
handle_event(#wx{id=?ID_PROC_KILL, event=#wxCommand{type=command_menu_selected}},
State = #state{panel=Panel, sel={#box{s1=#str{pid=Pid}},_}}) ->
- case observer_lib:user_term(Panel, "Enter Exit Reason", "") of
+ case observer_lib:user_term(Panel, "Enter Exit Reason", "kill") of
cancel -> ok;
{ok, Term} -> exit(Pid, Term);
{error, Error} -> observer_lib:display_info_dialog(Error)
@@ -276,6 +276,7 @@ handle_info({active, Node}, State = #state{parent=Parent, current=Curr}) ->
handle_info(not_active, State = #state{appmon=AppMon}) ->
appmon_info:app_ctrl(AppMon, node(AppMon), false, []),
lists:member(node(AppMon), nodes()) andalso exit(AppMon, normal),
+ observer_wx:set_status(""),
{noreply, State#state{appmon=undefined}};
handle_info({delivery, Pid, app_ctrl, _, Apps0},
State = #state{appmon=Pid, apps_w=LBox, current=Curr0}) ->
@@ -333,6 +334,7 @@ handle_mouse_click(Node = {#box{s1=#str{pid=Pid}},_}, Type,
right_down -> popup_menu(Panel);
_ -> ok
end,
+ observer_wx:set_status(io_lib:format("Pid: ~p", [Pid])),
wxWindow:refresh(AppWin),
State#state{sel=Node};
handle_mouse_click(_, _, State = #state{sel=undefined}) ->
@@ -341,6 +343,7 @@ handle_mouse_click(_, right_down, State=#state{panel=Panel}) ->
popup_menu(Panel),
State;
handle_mouse_click(_, _, State=#state{app_w=AppWin}) ->
+ observer_wx:set_status(""),
wxWindow:refresh(AppWin),
State#state{sel=undefined}.
@@ -368,10 +371,11 @@ popup_menu(Panel) ->
wxMenu:append(Menu, ?ID_TRACE_NAME, "Trace named process"),
wxMenu:append(Menu, ?ID_TRACE_TREE_PIDS, "Trace process tree"),
wxMenu:append(Menu, ?ID_TRACE_TREE_NAMES, "Trace named process tree"),
+ wxMenu:append(Menu, ?ID_PROC_MSG, "Send Msg"),
+ wxMenu:append(Menu, ?ID_PROC_KILL, "Kill process"),
wxWindow:popupMenu(Panel, Menu),
wxMenu:destroy(Menu).
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
locate_node(X, _Y, [{Box=#box{x=BX}, _Chs}|_Rest])
when X < BX ->
diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl
index cff5d08f06..ce3f48a05d 100644
--- a/lib/observer/src/observer_wx.erl
+++ b/lib/observer/src/observer_wx.erl
@@ -20,7 +20,7 @@
-behaviour(wx_object).
-export([start/0]).
--export([create_menus/2, get_attrib/1, get_tracer/0,
+-export([create_menus/2, get_attrib/1, get_tracer/0, set_status/1,
create_txt_dialog/4, try_rpc/4, return_to_localnode/2]).
-export([init/1, handle_event/2, handle_cast/2, terminate/2, code_change/3,
@@ -74,6 +74,9 @@ create_menus(Object, Menus) when is_list(Menus) ->
get_attrib(What) ->
wx_object:call(observer, {get_attrib, What}).
+set_status(What) ->
+ wx_object:cast(observer, {status_bar, What}).
+
get_tracer() ->
wx_object:call(observer, get_tracer).
@@ -290,6 +293,10 @@ handle_event(Event, State) ->
Pid ! Event,
{noreply, State}.
+handle_cast({status_bar, Msg}, State=#state{status_bar=SB}) ->
+ wxStatusBar:setStatusText(SB, Msg),
+ {noreply, State};
+
handle_cast(_Cast, State) ->
{noreply, State}.