diff options
author | Dan Gudmundsson <[email protected]> | 2011-11-30 16:31:45 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2011-12-02 17:07:24 +0100 |
commit | 6bbe0512b1686f06489893479ae1d14ef15d004a (patch) | |
tree | 009e16f0debb9dd2aa8532a3daa5e9705df2c343 /lib/observer/src/observer_wx.erl | |
parent | 69445197463ee031864b70f2b5618013461b2df0 (diff) | |
download | otp-6bbe0512b1686f06489893479ae1d14ef15d004a.tar.gz otp-6bbe0512b1686f06489893479ae1d14ef15d004a.tar.bz2 otp-6bbe0512b1686f06489893479ae1d14ef15d004a.zip |
[observer] Added an application viewer
Diffstat (limited to 'lib/observer/src/observer_wx.erl')
-rw-r--r-- | lib/observer/src/observer_wx.erl | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl index 5586cfcb9a..89f4afdba0 100644 --- a/lib/observer/src/observer_wx.erl +++ b/lib/observer/src/observer_wx.erl @@ -54,6 +54,7 @@ tv_panel, sys_panel, trace_panel, + app_panel, active_tab, node, nodes @@ -137,6 +138,10 @@ setup(#state{frame = Frame} = State) -> TracePanel = observer_trace_wx:start_link(Notebook, self()), wxNotebook:addPage(Notebook, TracePanel, ?TRACE_STR, []), + %% App Viewer Panel + AppPanel = observer_app_wx:start_link(Notebook, self()), + wxNotebook:addPage(Notebook, AppPanel, "Applications", []), + %% Force redraw (window needs it) wxWindow:refresh(Panel), @@ -150,6 +155,7 @@ setup(#state{frame = Frame} = State) -> pro_panel = ProPanel, tv_panel = TVPanel, trace_panel = TracePanel, + app_panel = AppPanel, active_tab = SysPid, node = node(), nodes = Nodes @@ -277,10 +283,13 @@ handle_cast(_Cast, State) -> handle_call({create_menus, TabMenus}, _From, State = #state{menubar=MenuBar, menus=PrevTabMenus}) -> - wx:batch(fun() -> - clean_menus(PrevTabMenus, MenuBar), - observer_lib:create_menus(TabMenus, MenuBar, plugin) - end), + if TabMenus == PrevTabMenus -> ignore; + true -> + wx:batch(fun() -> + clean_menus(PrevTabMenus, MenuBar), + observer_lib:create_menus(TabMenus, MenuBar, plugin) + end) + end, {reply, ok, State#state{menus=TabMenus}}; handle_call({get_attrib, Attrib}, _From, State) -> @@ -379,9 +388,8 @@ connect2(NodeName, Opts, Cookie) -> {error, net_kernel, Reason} end. -change_node_view(Node, State = #state{pro_panel=Pro, sys_panel=Sys, tv_panel=Tv}) -> - lists:foreach(fun(Pid) -> wx_object:get_pid(Pid) ! {node, Node} end, - [Pro, Sys, Tv]), +change_node_view(Node, State) -> + get_active_pid(State) ! {active, Node}, StatusText = ["Observer - " | atom_to_list(Node)], wxFrame:setTitle(State#state.frame, StatusText), wxStatusBar:setStatusText(State#state.status_bar, StatusText), @@ -391,12 +399,14 @@ check_page_title(Notebook) -> Selection = wxNotebook:getSelection(Notebook), wxNotebook:getPageText(Notebook, Selection). -get_active_pid(#state{notebook=Notebook, pro_panel=Pro, sys_panel=Sys, tv_panel=Tv, trace_panel=Trace}) -> +get_active_pid(#state{notebook=Notebook, pro_panel=Pro, sys_panel=Sys, + tv_panel=Tv, trace_panel=Trace, app_panel=App}) -> Panel = case check_page_title(Notebook) of "Processes" -> Pro; "System" -> Sys; "Table Viewer" -> Tv; - ?TRACE_STR -> Trace + ?TRACE_STR -> Trace; + "Applications" -> App end, wx_object:get_pid(Panel). |