From 5bffae075897bb217494810426a58a1f42fef4b7 Mon Sep 17 00:00:00 2001 From: jsurfer Date: Sun, 5 Sep 2004 12:08:18 +0000 Subject: [PATCH] Added error log to the debug perspective --- .../icons/dlcl16/clear.gif | Bin 0 -> 328 bytes .../icons/dlcl16/collapseall.gif | Bin 0 -> 155 bytes .../icons/dlcl16/export_log.gif | Bin 0 -> 221 bytes .../icons/dlcl16/filter_ps.gif | Bin 0 -> 113 bytes .../icons/dlcl16/find_obj.gif | Bin 0 -> 331 bytes .../icons/dlcl16/import_log.gif | Bin 0 -> 219 bytes .../icons/dlcl16/open_log.gif | Bin 0 -> 223 bytes .../icons/dlcl16/properties.gif | Bin 0 -> 218 bytes .../icons/dlcl16/refresh.gif | Bin 0 -> 205 bytes .../icons/dlcl16/remove.gif | Bin 0 -> 221 bytes .../icons/dlcl16/restore_log.gif | Bin 0 -> 349 bytes .../icons/dlcl16/th_horizontal.gif | Bin 0 -> 354 bytes .../icons/dlcl16/th_vertical.gif | Bin 0 -> 221 bytes .../icons/elcl16/clear.gif | Bin 0 -> 545 bytes .../icons/elcl16/collapseall.gif | Bin 0 -> 157 bytes .../icons/elcl16/export_log.gif | Bin 0 -> 338 bytes .../icons/elcl16/filter_ps.gif | Bin 0 -> 211 bytes .../icons/elcl16/find_obj.gif | Bin 0 -> 347 bytes .../icons/elcl16/import_log.gif | Bin 0 -> 338 bytes .../icons/elcl16/open_log.gif | Bin 0 -> 359 bytes .../icons/elcl16/properties.gif | Bin 0 -> 577 bytes .../icons/elcl16/refresh.gif | Bin 0 -> 330 bytes .../icons/elcl16/remove.gif | Bin 0 -> 351 bytes .../icons/elcl16/restore_log.gif | Bin 0 -> 571 bytes .../icons/elcl16/th_horizontal.gif | Bin 0 -> 374 bytes .../icons/elcl16/th_vertical.gif | Bin 0 -> 352 bytes .../icons/eview16/error_log.gif | Bin 0 -> 601 bytes .../icons/eview16/event_next.gif | Bin 0 -> 332 bytes .../icons/eview16/event_prev.gif | Bin 0 -> 323 bytes .../icons/eview16/hide_pane.gif | Bin 0 -> 369 bytes .../icons/eview16/horizontal_view.gif | Bin 0 -> 373 bytes .../icons/eview16/registry.gif | Bin 0 -> 591 bytes .../icons/eview16/vertical_view.gif | Bin 0 -> 353 bytes .../icons/obj16/error_st_obj.gif | Bin 0 -> 339 bytes .../icons/obj16/error_stack.gif | Bin 0 -> 603 bytes .../icons/obj16/ext_point_obj.gif | Bin 0 -> 197 bytes .../icons/obj16/ext_points_obj.gif | Bin 0 -> 225 bytes .../icons/obj16/extension_obj.gif | Bin 0 -> 186 bytes .../icons/obj16/extensions_obj.gif | Bin 0 -> 205 bytes .../icons/obj16/generic_xml_obj.gif | Bin 0 -> 357 bytes .../icons/obj16/info_st_obj.gif | Bin 0 -> 121 bytes .../icons/obj16/java_lib_obj.gif | Bin 0 -> 338 bytes .../icons/obj16/ok_st_obj.gif | Bin 0 -> 343 bytes .../icons/obj16/plugin_obj.gif | Bin 0 -> 328 bytes .../icons/obj16/req_plugin_obj.gif | Bin 0 -> 349 bytes .../icons/obj16/req_plugins_obj.gif | Bin 0 -> 338 bytes .../icons/obj16/runtime_obj.gif | Bin 0 -> 361 bytes .../icons/obj16/warning_st_obj.gif | Bin 0 -> 324 bytes .../icons/ovr16/run_co.gif | Bin 0 -> 79 bytes .../icons/sample.gif | Bin 0 -> 983 bytes .../plugin.properties | 7 +- net.sourceforge.phpeclipse.debug.core/plugin.xml | 31 + .../phpdt/internal/debug/core/PHPDBGInterface.java | 4 +- .../phpdt/internal/debug/core/PHPDBGProxy.java | 852 +++++++++--------- .../internal/debug/core/PHPDebugCorePlugin.java | 84 ++- .../debug/core/PHPDegugCorePluginImages.java | 166 ++++ .../internal/debug/core/debugresources.properties | 118 +++ .../debug/core/logview/EventDetailsDialog.java | 629 +++++++++++++ .../core/logview/EventDetailsDialogAction.java | 93 ++ .../internal/debug/core/logview/FilterDialog.java | 164 ++++ .../internal/debug/core/logview/LogEntry.java | 237 +++++ .../internal/debug/core/logview/LogReader.java | 308 ++++++ .../internal/debug/core/logview/LogSession.java | 60 ++ .../phpdt/internal/debug/core/logview/LogView.java | 992 ++++++++++++++++++++ .../debug/core/logview/LogViewContentProvider.java | 43 + .../debug/core/logview/LogViewLabelProvider.java | 68 ++ .../internal/debug/core/logview/OpenLogDialog.java | 270 ++++++ 67 files changed, 3680 insertions(+), 446 deletions(-) create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/clear.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/collapseall.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/export_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/filter_ps.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/find_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/import_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/open_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/properties.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/refresh.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/remove.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/restore_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/th_horizontal.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/dlcl16/th_vertical.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/clear.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/collapseall.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/export_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/filter_ps.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/find_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/import_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/open_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/properties.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/refresh.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/remove.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/restore_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/th_horizontal.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/elcl16/th_vertical.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/error_log.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/event_next.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/event_prev.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/hide_pane.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/horizontal_view.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/registry.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/eview16/vertical_view.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/error_st_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/error_stack.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/ext_point_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/ext_points_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/extension_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/extensions_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/generic_xml_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/info_st_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/java_lib_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/ok_st_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/plugin_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/req_plugin_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/req_plugins_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/runtime_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/obj16/warning_st_obj.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/ovr16/run_co.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/icons/sample.gif create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/debugresources.properties create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/EventDetailsDialog.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/EventDetailsDialogAction.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/FilterDialog.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogEntry.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogReader.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogSession.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogView.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewContentProvider.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewLabelProvider.java create mode 100644 net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/OpenLogDialog.java diff --git a/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/clear.gif b/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/clear.gif new file mode 100644 index 0000000000000000000000000000000000000000..9ff6416063dbf6ddbe251d741830505ad6c54007 GIT binary patch literal 328 zcmZ?wbhEHb6krfwxXQrr>(|e(U%%YHcl+MmTPKbkdT{^ll}qOzJ-GYu{+%1wE?>KH z@xb1l&!0Yi`uO3KM-Lu9y#MIIy$AR1eEa(4>zB`8K7acB>EpwDcV0Yu`serW-@ktS z`2PL-H=yK~LkAE3|NsBrzkh%K{{8dk50K438=&};g^__li9rWsJjhQBY^e?t3p{kB zTIVkL)bYh)zHHia=2cBLfywM5T!~H*nj8*nBAbr-d2GI!!SbTS&1pW*qr-g9g$xD6 zDk>RyT6j1cm1Ko^`Fh%eMEEE1b9Kmy3a|?ZObrs{;1J`O>+ZFzbD5`)k0XOM0N1~S AaR2}S literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/collapseall.gif b/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/collapseall.gif new file mode 100644 index 0000000000000000000000000000000000000000..7dc0de51301371379e9e1bb713daf7273e8919a0 GIT binary patch literal 155 zcmZ?wbhEHb6krfw*v!Ci@X*m;zyJLB`K!5m(uXf!fBydc_us!ifBzmjc<|r9fB*mg zXFvstKUo+V7`Pa8K*At17+5?4PI|81EB5kipsR~UmmDio#;mN%miv}I;wteyp11J5 xl^;V(LxIK@M)ng=6cSWq;ubzj^qTufz@fQpb+4yG=LU;6Q%kL8l&~;Z0|0UNLKpx5 literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/export_log.gif b/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/export_log.gif new file mode 100644 index 0000000000000000000000000000000000000000..a5a431e974fee50064d62deef796b044400d72cf GIT binary patch literal 221 zcmZ?wbhEHb6krfwIKsei;L!1-$IrC1_nta)VdtKMTX*c;f9TlJ6KCcxTl?$xpP#>e z|M>aq{-Y<~fByRR+Z^fkBKx z2c!gKCj)EL0@c2h%&5>+>(W^Feu$nbs(j>wkNd>}h88Cm^HrP`9&#IJccq*D$4?wTdTh_G-Me<|+_P)Xo!fVA-@1L{`i<+?u3x=! z_41|57cX4AaQ?!%v**s9IeX^xnbW6EpFDB$__5=M4jx**def&*ZyrCo`uf$Q7tij! ze18AwqgxN}UOj(e@5NIG4jnxB|NsAg|Nh;(ckj-fJGXD&zIpQ|P=tYcK=CIFBLjmP zgAT|@ke?XXG8`rsc<4y=&QJMd@u$RK#^LtNq9me z|M>aq{-Y<~fByRR+Z^fkBKx z2c!gKCj)E50@c10%dm`9vqYcl%L@(bVc7pk#`Q3xK&!{QklT{whl7<2IV2i7m$a${ zM6B&^FWD7gGCx*x>+XyR+o!rMPG8`m_Gnh}yNdkfUo7XCge?70uEWvTpdqHnU=0A> CQf5v7 literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/open_log.gif b/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/open_log.gif new file mode 100644 index 0000000000000000000000000000000000000000..96d5334b7ebb947d35804c3a55d1b24381dda769 GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2`}dz;zkdJx`RnNMGpEj6`11Ap=P%zreg69K)0Z8)59~X5 z^yrB*-+%o4_Wj4#Z{NRs{dVTW{?o_z-Mn`G(z#=Y4j%mT=g>rx0hWdorQ5819!v6E1XWlLv_9II zW4JCN=c-etip+t7TQ)AW;d!XIeP}_?u5A1Hd|7N7r$l)(o#nIH(`IR53k?3dG^_p+gmm)dh_b>^QZUj+&ur_?&WJ258t?Q za`m!VE0@f;arxMTJC_a}Jox|re+E*3;!hSv2B1|sAWa}U8Cbm(RQggfC!H^z#lK)( zGPi){9~Rd*8GUUYhXsqmt5jro7C&|skqq@$FV-sErLb1*T2_Ss!`-XQ3r~MMvVVbt SbhVBQZ-;y*~!V=&CT4-&ceaL z|Ns900000000000A^8LW000~SEC2ui01yBW000GAASaGwX`bh%mg+`s&;_|7EYsW; zX<5|nJzP$L!BixbB1KrUBoI)fGpP#>e z|M>aq{-Y<~fByRRCMpvs^F zG8N<}2DYjLlL|a^dfkpbDR6Pr>kr6iyAYHm)v?J-`e|-kwrubU4D{OX<;Y+S06a03O8@`> literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/th_horizontal.gif b/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/th_horizontal.gif new file mode 100644 index 0000000000000000000000000000000000000000..ce1a29cab8d4e5e7507778224d4008f1e60b3d63 GIT binary patch literal 354 zcmZ?wbhEHb6krfwxXQqA;NX#W?>`aw*Y6)ce;qz@ z^uw30KY#!J@$1*0zkh%K`E&Tlky97W&0Dqj%FS#0j_x~g;>d{;M~@#rdhFQIQzws{ zI(hWui6dwC@4a>Y-2JOp4jnvr?AWpY|Nk@43@H9&VPs%XWY7WG0P+(9Tm69v1s*zl z_9vDYRmND%ow@w;=G?SrE7AK%h$DkF000h%4gdfE literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/th_vertical.gif b/net.sourceforge.phpeclipse.debug.core/icons/dlcl16/th_vertical.gif new file mode 100644 index 0000000000000000000000000000000000000000..a404f8d3eadabc75006ab3d5b6d6a72acd5257d1 GIT binary patch literal 221 zcmZ?wbhEHb6krfwIKsfNYtO+W$4=e6b!YRo-RCY`{`u?okDtFjeEItG_wPS{|Nj2- zXWpvCS8iV0cXZ#eV@J>K-+Sx)x%*eI96EUL|Ns9CL;%H~EQ|~c!VEefwIDkgSfd`O z^rdKeWvp7ZxMWX3jmO)AIz0>Dv(?IVA3J2gz{1fK_x6~B0+-+N{6|3%>u;>oKKQn3 vYu|>7Hy2KwOPd$hbqaZ-0IJ^!vxxKfiwb`}^na$!!lV9Q^wB z*~gcUzP)|+_097iAK!j^^Zf76@BjY%{`>papPxVe{rU6%-@pH0z%X=x;!hSv1_n0< z9gvejal*h}*WlLF+|t_C#M{}`-r?HU&)dW0;@~V`=E~L1XJ%?@@8rtgBkX9r+*p*m zoyW=6NXb@&r-#GD#@fzOnxmalSyNF#QiijKOUjfWZCs($|cfA#bKkH7!F`St(Z@BiQa{{Qv=|DXRL zz<>l4f3h$#FmN;IfW$y%FtB(Pob+71*X+evXI>YLE;&}Fj8#mRE%&W?B30shyu13% zpT6C#3k-fJGjKF52@24V6I?%GvcZa|)%y<^9(-F=IB9W`k6g3(YLhfsMh0sDZC^x! literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/export_log.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/export_log.gif new file mode 100644 index 0000000000000000000000000000000000000000..3465699bc7145c63118439064ffda48a116dedc8 GIT binary patch literal 338 zcmZ?wbhEHb6krfwxXQqg)v&s#eM4c##-ff5wUc(%PTpBJd1vR`gW^W9o%0S(TzcHD zXt{C0661o!4&}>vV`go?^yKUB{~v$-|ML6)+n@hG|Nj5&&;R$o{y+cm|HY60uYUf2 z{qz6F-~Ye<`Ty+4|Cc}izy0<9{qO&u|NNgZW8(5fZ3i}%?pRa3X+{0iCfHZ;p#K4yCFr&ajM=Ei}lA_El z7W4f>3K<<8=4&RaUkX&=VRBe*vNp`+`Dd5ZDFqf?%!&*TW}NEij+5t_+oRA}$jYoB zqFo`~CDkRZ;wC>ajzwQbPq#u+V)nEd27EmH{04GMmrZwBuvmG`+IcH^-8b=Va&}~} F1^}}Jm$3i< literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/filter_ps.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/filter_ps.gif new file mode 100644 index 0000000000000000000000000000000000000000..3d061d77cbe83a329576fa10e54a3ffafae94b98 GIT binary patch literal 211 zcmZ?wbhEHb6krfwIKsdnt7_rlA7^YA8W2}*A68(PHqAV~#jk&_wyDLxKQI2gUH|9p z#y_vu|Grc6=k><<#lln41*fD5c0}?0|NozX2%z|rg^__lm_Y}m7Gx&_Yrq4QzLZS1 z#|hIIl~z3slyFJd{XuKnq6PgLf(f50{&@AbTnxz(6FwE>vM|Cxg1hxGm!{{w1kc5a gmR(1lUe5S&^`qLp8*9pDKe?l~+j50|D+7Zy054ohcK`qY literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/find_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/find_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..d540a01f4d9eeb9d2951f30cee165c7370e9fc6a GIT binary patch literal 347 zcmZ?wbhEHb6krfwxXQq=Vd*RNf? z`oQk}`*!YKK6~ljZF_cZ+HvgAv6IJ69zSyY;J$;WPMkV&@Th0*!vFtI{{R2)-9{Q{xYzi!ojzd!Hm)rnuOPWpOf;{Cn#PZn9eTp#{=Q|#Kl_?H9)`m^Y_v_E|osjQ0xhPeU?V7 zFYefq7px@erW32aOhZI~o1e+F);Uj8NSKj>%P7ZHO;TK&kDY#h literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/import_log.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/import_log.gif new file mode 100644 index 0000000000000000000000000000000000000000..cab213ec9a45b7ad304fb471a63b678774303e34 GIT binary patch literal 338 zcmZ?wbhEHb6krfwxXQqg)v&s#eM4c##-ff5wUc(%PTpBJd1vR`gW^W9o%0S(TzcHD zXt{C0661o!4&}>vV`go?^yKUB{~v$-|ML6)+n@hG|Nj5&&;R$o{y+cm|HY60uYUf2 z{qz6F-~Ye<`Ty+4|Cc}izy0<9{qO&u|NNgZW8$Wj^(z*&?Ok87V@=KRt%XN77a!bM zwsuMLgA@H%Hf7w}Tl4J1+W-ImGmrulf3h$#Fc>iCfHZ;p#K4yCFr&ajhcEENl1mwx zR&!T8Vrr_e3O?qyWU+??OGBTR*V>LV&pJ+q+>$?E3<-# zcDZz?RHwA6oBV`W7JVH(-Ev8ZSyQLG$<1Fd&4tfddD-&0PJBFWYghBHb>-vb-{8n# F4FFv3m{$M* literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/open_log.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/open_log.gif new file mode 100644 index 0000000000000000000000000000000000000000..7e4c5830d9951a0eeb57185daee0dea5c41a2acd GIT binary patch literal 359 zcmV-t0hs(xQU&?;OY71?fUKV z`|$Mph@HWRoxqW$$KUDs;OY3~?fUKV`tGP z?eqKe_xs=K_~q{T>G1jO^ZM-b`uF+!nwpT9n30~Gjh&l~ucv{gp@*WLi=my0o0*Tj zuXwqwd#|Q}rl5$&wQB87!LfC|uXwqvdbFv2tD}VA$dA;rXwaAFU<`N}FGV;Q5g!p4 zm&7cfOD6{#K%2oN3~Dn%v~0~BBfqZB7aEEK-Kza&K^#Kp!XOvyt* F06Qbsz2g7? literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/properties.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/properties.gif new file mode 100644 index 0000000000000000000000000000000000000000..1dc19a31a0fc5eef8d55fe8a938b32d4154fb021 GIT binary patch literal 577 zcmZ?wbhEHb6krfwc*el6V#9&>{GNn@o~+6#1@$v`9K5*q=#}W4&e*)}*u1Xzf}VuJ z-sF-A$tC^i<&(0jr{>qs%&(tO+%&tSc}{uTyy~t+b-hb>9K5jS=#}H=@1$2u%B-4_ zT{Eq`eSR58c42ML;>HQfnkTL3n6`Syp^MuOUf6cv{N7_%4xPSn?EIblh8cBzOWLQe zX`Zyad)B%o8xAbnbZG648%IOZ9jD3@VVQE&fGY5;m$!2d3(Zw4gbM_VJHB_pDc_F3?2+RAjg8@ zgn@ltgGWFR7HY2~ckq`T8**Dl>A1q~Ms4O0!L>o-jmn&ftx zUDzqo#A0H?rfy;(A)(G@BB9m9ywm8(Ht8lF2UUlLm>Gdd$6A?G8cYO46sB|5x{GiG PxolkI>LS6+$Y2cs9cIBb literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/refresh.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/refresh.gif new file mode 100644 index 0000000000000000000000000000000000000000..e3831471a6592da14f53b1e7c5a2f7d6a92d9937 GIT binary patch literal 330 zcmZ?wbhEHb6krfwxXQrr@9+EHAGZ8_G3Dpu?%yxxeR;O-=iRE0x0<(4QTcee`1ifm zpO@2qo{itzBDSGSXh)sM<|^S$6~en4MRzrdZmSj9UMIS{QEXSE*vdSC6?p<{3I*2` z3$Dx)T#+ZZp;TynsnFUYp*4j44mHLpVZ-K zl_{b4!&vi3NsFvxfuFi>p>w)=5UaR2Lyxxzb4)b5h__%;3Y%bnva}Kxw?crk1h>pm LXEn6|M+R#EucKvr literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/remove.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/remove.gif new file mode 100644 index 0000000000000000000000000000000000000000..b6922ac11cf64e16a15cf2976cdaa1e40118abed GIT binary patch literal 351 zcmZ?wbhEHb6krfwxXQqA+}QL>Vab=`lFvmYpNmUxXz4%DF}bf}d|cDunVH>FGrOY- z+D{EEKZPcINzVS9ob?$uHn=&y~n$8D`1 z2l;<(sQc1T_xQ+>|Ns9p5DgT6vM@3*7&7R9bb$QCz*ci$MuCTpRKNR-^bncK1eb^v zqDfrti^MpzbSB1VUt0b}aql73M;xvKD|}WtK1fk5iV!?;_@hVR1O_f%UNKGv4?_+f zX(=fl4i6boi78XK>s@7pr?3jKN=S;#aFP{YATA>-vrJN4*4aRuZH4n{cJUaejf z{r&&f-~S(f{eSoQ+uNW2KmY#!?a%-Bzy3e}@&Cn-|F3@jfBp0S$KU_I{`vn5DDw0F z%b)+>{`&v^_y5m-{{Q~>|Ms10GiFTu_xJtp4_kh|n6hSR)9;t_e%`J6c&qvN*1{DF z+qO?p`FOeb_r2DiXX787=)bZlIh%kSkAt3#fTNy63$M612eY*;i@2>-%RwO_S=l>x6k25-Uu0r< z%&&TLh1grsw{NvtrN3~nGfFw@8ydW36A@+#x^aDdKwC41@rPiMMGFrLu!?%>h;T4i F0{|Ka#&rMy literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/th_horizontal.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/th_horizontal.gif new file mode 100644 index 0000000000000000000000000000000000000000..d590470446f37e7d83ccbcf3f3a85f82e4fc344b GIT binary patch literal 374 zcmZ?wbhEHb6krfwxXQrLHf3GM)HOZRS6zSnrGM6n@ZJ-%cHf^eXQ^f7-fw^YfBOCZ z>gWIOe*K>@f6>R^|G)nE|K`{Kx4-^>`2GLOpZ~9a{eSoS|NGznKmYmv{qO&`zyE&% z3Idh={XhBWCi58yE6#1N*-<-h(Y!@VXRlZ>eeLQg8`n+Tx}k6H*3O-qdiHPYcsFnI zgY3B16Wjj(|Ia`cQ2fcl$iSe>paaqk@)HBwT literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/elcl16/th_vertical.gif b/net.sourceforge.phpeclipse.debug.core/icons/elcl16/th_vertical.gif new file mode 100644 index 0000000000000000000000000000000000000000..50a54e0b4a7646c58f90c6a577a46e93dc7758ea GIT binary patch literal 352 zcmZ?wbhEHb6krfwxXQq=W%tF-8N27NKAv8?vZP}}+mv-3Q`huNU)4Wr#gsWq-~al5 z_4EH3^A~;n^Z&=+|6l(6fBozK```b~XC$mRx4mXZ?Yu?v7A>8WqPZmZ721N!PkPRR|F|gGhm{8!M!)1M9 ziIL?Uop~2tBpE-^QJch>a=NvkZB}cGQX>xsBO}8i$+UGhJzNy0r?<^G`uO6F-`^#i z#ku)f+uFsQ#kzZXdz?jsCW$)paL3LN;Bn^UR#1?iDZuH>F;7ljFg=q&ki(gsTYhtW X9lJAIOZ#p%XV(1(4jyoFWUvMR0IC7X{`&v@@BiQb{(t)O|JT3&PamDHE(w@e@6l81HNDAgafj2q zR+k4S`nOE5-PmWhw#Q**m*cIyHK%7eJv*`XtiIv}8@>M%JI^Z0{Ljz%pPT!C>C*oz zR{RG8hQS9Ef3h$#F!(X(fSd-369)Ee4Sr3{Ev>C?t{!e}tsdTn1jSA0a*;epY#XB_&y#W>y|%79Lg&z4sa#RxJYT3<5?nih7E=iWV(8 zDGL-HyYvXF`$(J#T*1;Iq#dz=!Es6Z1jQDugc%NtlsP5D48?*RH!bPv?#WvbQ|Y{9 IvIB!P0AcIn4FCWD literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/eview16/event_next.gif b/net.sourceforge.phpeclipse.debug.core/icons/eview16/event_next.gif new file mode 100644 index 0000000000000000000000000000000000000000..072b1844572646fdb57124b6e938a465daac8d58 GIT binary patch literal 332 zcmZ?wbhEHb6krfwxXQrr@Ar$pzh3s)RRH2yZMG-dG{LyHRvkqv*C;prFW}Cb1QH0&9u|R~HDbFBMu_B(%Cf zXj8fH`cmQLIReYF1^)m4&p+|z+lLr1JVKV69Zf3ff)rJI#S8AmOS&g!objY zXp*F{?P9eo9}@`oK{Iw9&}i^SBU4D}c3FLN?5SiQ`V!5RSYo{04T literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/eview16/event_prev.gif b/net.sourceforge.phpeclipse.debug.core/icons/eview16/event_prev.gif new file mode 100644 index 0000000000000000000000000000000000000000..07164754e5ca231666d9daf7fa4a9d12e378a52a GIT binary patch literal 323 zcmZ?wbhEHb6krfwxXQrr@9+D6zn=X4cJ<${r+>d*`SKk--`OT*-X9 literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/eview16/hide_pane.gif b/net.sourceforge.phpeclipse.debug.core/icons/eview16/hide_pane.gif new file mode 100644 index 0000000000000000000000000000000000000000..94004ffc13d5e3e99fd238161a844b0fe2a84473 GIT binary patch literal 369 zcmZ?wbhEHb6krfwxXQqg)vzYNb$wa)=9-B+nx^kYA=;tGlMJ?wzr6;;iKp zW-XsGXX%u=OFsYp|LxEJPrv_P{rvykum3aVFZ%fV|JOhNfBgOb=GXtXzy433zv#p7 z|6l(6fBozKyWjuc|Nj5^&;Rd#|G)kH|07W2pa0+f{(lYB^7sGjg$rgcoImlzI=RlE zmVGVr7tfo&c?>M5&NPW}J?KLcK%_>+Z^fx(nP2c!z* zCkD2@1G5S|bokOwEHSF=v6z41M2<)Ik`PUS6N|2%YTM9}wX{lrt%-qwMf%v98(p0t zD<}ADe5k$YNgc?4zUmM&Yy z>&)G%C?q7YUWm(?bApz{Ri;MN>xxYXI&8 BvyuP+ literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/eview16/horizontal_view.gif b/net.sourceforge.phpeclipse.debug.core/icons/eview16/horizontal_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..86bfc482ddf8323f58778f81926715518d050624 GIT binary patch literal 373 zcmZ?wbhEHb6krfwxXQqA!^!_~dBgLL32jr>bxd8;HEng*^wqsHR!*F?e8Q~dQ|2rc zh?%37y?n#T`%~sF`S$1kr{Djte*XXN*Z&#w7k&Kw|LdRsZ+`uM`|JPo`HMdM{{Q9A z|JT3%zx)0F{qO&u|NQ^{_y619|33i*fhzz0pS^Iw?1l3uo>(W>8Pu|`W&YxM^B2!u zv~>2OC9_wooW5-N%+;%=u3bH4^~$OL|Nmzo4k-R)VPs%1V$cC82l5JB*zFU%vhM|MJKGH$VSB|MCCDkN>ZJ{(t@R|GQuRzyA6E z3@GyR|I45M-~9Uj_SgUCK&fB<`zLp{G-cM52R(gse*dJzU~1OW(=H$=D4;Y&$*f;kRKVGJig{Zn7pH)e(;Um@P60_-9!UX52TwZ>50_vz zHg?86jQkcBu2$CW?!l}lBsrv{`Rwie+ TFLXWP%;40;vY;?Pfx#L8rcC6a literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/eview16/vertical_view.gif b/net.sourceforge.phpeclipse.debug.core/icons/eview16/vertical_view.gif new file mode 100644 index 0000000000000000000000000000000000000000..493c2fbd5f84568689f16ab84f6ae552bf25512d GIT binary patch literal 353 zcmZ?wbhEHb6krfwxXQqA!^!_~dBgLL30Vzm@>|!Jb#JbjxT9(M-nJ?0I;O7anzp)Y z`s&^pD<{rcK4I4KDRY)inY-luum4v+|DQ2`(bqr!fBgMFeg2{^fBwJz_5c0v|Fah^ zn7wfR#1re}I)hsFwai~UZ~o%Bi*mD86kpSgO~)U~UptX?_w|Ns9C)BuV< zSr{1@G#GS1hJpOVz*grlrNBdn&-cURaAyDZ$mk zm}a69xpAhCikv#H>!j1Ii{8I>c2*D)ZE0Q!5RP{pntdk literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/error_st_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/error_st_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..0bc60689c6dcbfb71770789a3c2e98f51f6eecd7 GIT binary patch literal 339 zcmZ?wbhEHb6krfwxXQrrHNWU4 z&?^&f5)>{J;LlXy?-r0IC7X{`&v@@BiQb{(t)O|JT3&PamDHF7fZF@tWJ}GQG)dQoYB< ze!I23_A9y^7q>e-IMKglg6)+}8MpSM%JI^Z0{Ljz%pPT!C>C*oz zR{RG8hQS9Ef3h$#F!(X(fSd-369)Dj4Sr32Zmu3~&7GYd-k$E>9%hb{r!@8WdVA0C zFqWGq=jbQE>oseJ7n8u;c{YBGf*c&az8eJ@#ie)J`mu9!F7xK(W;az$k8X8ue0_+R|MlyOvgch(a6PP5toG8gc}}AY_8p1AssR+7cEk9G!I&}hw;;r K(=Lq+4Auad*x_XW literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/ext_point_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/ext_point_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..17f771aff670221134e7f10ba0bbfe04818f3d1e GIT binary patch literal 197 zcmZ?wbhEHb6krfwIKsei;OrBV#MQQ08$C*P=k@H#>)BmCdH>AyS7xlgyky6X6}xX* z1EorLhcq0C?KoXG=T!URa~(_0bu2#Hx#aBBb(g2Ey|iTKjpe&||hddZ5;qk~uG9)wI6NUFSaUSS{>Za!ZN*?!N=wZiNd) sIZmi7WXNEWTGUu#wO7JG@>rJQ1{Id|3`>PLoK>C{{5opa%D`X^0EsGB(EtDd literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/ext_points_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/ext_points_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..52f4e5ea10077e1590d9e6311958be069088f369 GIT binary patch literal 225 zcmV<703QEGNk%w1VGsZi0K@ z*|x{zzR&8#(d0X7u}F2hRDi@?h|7MQ%7>%Qh@{Slqs@t=&6Tdxm95gGx!9+>+OELd zufg1krON;R{{R30A^8LW0015UEC2ui01yBW000GEpeK%GX`Wsbp=BgVD=S8n6_e_y zBF8f5p;8fzF^3?N5D?DIXH*opU;=~qHM<=J bCY1n5Ocsy=dL?adGHiH(g@A>N9w7ibM>%BD literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/extension_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/extension_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f3f595bc5e6335a141bcf6f760f022267a37bc0 GIT binary patch literal 186 zcmZ?wbhEHb6krfwIKsg2>-YCxzrX!|zxvtj4Szly-PFmorJH+uKhOV1_5U9={CR(L zbv^6a2DUYgZ0lRtC#EqhuVVTC|33rKK=CIFBLjmVgAPas$W8`U^8}T?l+1Y~F;9Tj9mdfG~EN$3i2aI`GVt=ykbz`-YCxzrX!|zxvtj4Szly-PFmorJH+uKhOV1_5U9={CR(L zbv^6a2DUYgZ0lRtC#EqhuVVTC|33rKK=CIFBLjmVgAPas$W8`UuLKphG_;$OaFQ4W1(Z|Nm#84N&~a!pOj&#GnH*9^@wmwtR<)1s*z5{T`25 zi#&xCxjTv@8V%YR4>klC$S^Hhs%*qE<9u3TtD>UXy@HC+OCm}lKlU&c&NR_*=4fhe zRubhEb&~Dw>6HzY@RgCCGIgqqxEQ~flAPpxsRfc!a!Rx2D6W)OSfi-0dYRaq;4L1G G4AuZ3a$RKr literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/ok_st_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/ok_st_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..9cacb96dca98b0bdcf7e7bb62e491f8760b244ce GIT binary patch literal 343 zcmZ?wbhEHb6krfwxXQq=a?`PC3wLx+TirNeg?n^`Z$foW?Q~|F3@j|LW)e*FXQi`}P0h@Bcsk{(tl9|Jz^xzx?_C z`q%$=zyH7g{r~fy|G)qJ|M=(sx4-{?{rmsx|NlS#|Ns3D0u0mxia%Kx85qF&s24FDJgfQ)BmCdH>AyS7xlgyky6X6}xX* z1EorLhcq0C?KoXG=T!URa~(_0bu2#Hx#aBBb(g2Ey|iTKjpe&klGTH(H?gyH}H{|rO}#h)yU3=D=0Iv^b&KQXYS9+*+!p(E9QBIVM< z06y7%_scIkd}Nkhy3}Z4;ju(#;>#TwBI3tAwlJ*>StijKz;J`H_w2JHFP8)vGB=5{ vNl5Z2D(Y+K>gc*~Gl_9B$;;{Kc`%BIG8!0oF$xGV`Z+N!UAAhqBZD;n+e3)m literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/req_plugin_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/req_plugin_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..c54f2b359c876b1e7ec10c25eb15d74cb8108b9d GIT binary patch literal 349 zcmZ?wbhEHb6krfwxXQqA;OrBV#MQQ08$C*P=k@H#>)BmCdH>AyS7xlgyky6X6}xX* z1EorLhcq0C?KoXG=T!URa~(_0bu2#Hx#aBBb(g2Ey|iTKjpe&klGTH*fx*@iVG4F4|F|GUueA4sk<{kzVzH$iV!mf8RR{~0iV;!hSv z1_nz89gqyjPYi5T2V(fj4|DdPQ06;kqBeQ^%$~ApwZd()&Sr*+74x~9zpSu1lDtsa zsBntcV}nNz6eiv~vElKez!({2C2a*QEj3FP7FLEH23~1tbs1SrO-tq(;%pLZ#o`QwJo%2+syS>)*ZOJ;n4ll z*I&hUoUWU5YW=}GzkdJx{N=;f*T;T;f3a)2+VA_Fe_pNs`s&!mF2xPqifdZsA6!`W z|JjCr7wZ3AX!s8#*O~rZXWE;fH!I8R|Ns9CGysY}Sr{1@lo@nDW`q31z?OgDqKAkO zXa9-C8HY{OCNJbWE?lMNx`6-0i49ua%5KeuALWjAIHd-;$=zdXn8Q%%U{G;J;{dT8P}|J LV%)UWk--`O<{5MJ literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/runtime_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/runtime_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..f159bcd92b02c685adf6627d70c69ffd82a889a3 GIT binary patch literal 361 zcmZ?wbhEHb6krfwxXQpF?q0)?x+87Ip_thx0~TF!SbB@K!9#OqlHSw==@#!_FX#RL zdgj~xY5zYS`u}?K|L+eUFX4J~vHSniCI7$Pey~8`|EW4x=n!~*^XQ2Rft__m$Ggpsc9vD-3#AnLgEas>?4IQS literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/obj16/warning_st_obj.gif b/net.sourceforge.phpeclipse.debug.core/icons/obj16/warning_st_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..2b2e50fe7cbca2cc105047ed184e3073f0c24fc3 GIT binary patch literal 324 zcmZ?wbhEHb6krfwxXQrr|8~*;dyW4e_5Od<|NqIf|Bt8te>(U7vw8pD9sGYH>i^m7 z{}+n?Uupb*wdw!W=Kpu5|Gzi)|MMOH&*W4G3O9s`Hie5dhKhAYOSDHz^u$R`Ns&F; ztb4Lu|5%IOu~xma-9{(d4NrF&pY1liGsFJ=Y^MivoF6U?J>712zT5O-ui5SC4)jB<~Eh3Ck(|MR1tY+CYw%7@BZ0uHG65^MT;^$&kcave^ j77&vV;AWL^lhtKopEXNY&Ru%J!UdsAmM(L0WUvMR>~MP$ literal 0 HcmV?d00001 diff --git a/net.sourceforge.phpeclipse.debug.core/icons/ovr16/run_co.gif b/net.sourceforge.phpeclipse.debug.core/icons/ovr16/run_co.gif new file mode 100644 index 0000000000000000000000000000000000000000..13077f940abf37bfae4b9b948dd6cca35706e695 GIT binary patch literal 79 zcmZ?wbhEHbWM|-DSj519*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java index e0e19cc..5433b6b 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java @@ -528,8 +528,8 @@ public class PHPDBGInterface { // To print errors on the console, I must execute a code in the // php context, that write the stderr... I didn't found a better way // TODO: Find a better way???? - String codeExec= ""; - codeExec= "fwrite(fopen('php://stderr', 'w'),\\\"" + error + "\\\");"; +// String codeExec= ""; +// codeExec= "fwrite(fopen('php://stderr', 'w'),\\\"" + error + "\\\");"; // try { // evalBlock("eval(\"" + codeExec + "\");"); // } catch (DebugException e) { diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java index 1c73cf9..d336d7e 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java @@ -1,445 +1,443 @@ -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation - Vicente Fernando - www.alfersoft.com.ar - Christian Perkonig - remote debug -**********************************************************************/ +/*********************************************************************************************************************************** + * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made + * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: IBM Corporation - Initial implementation Vicente Fernando - www.alfersoft.com.ar Christian Perkonig - remote debug + **********************************************************************************************************************************/ package net.sourceforge.phpdt.internal.debug.core; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; -import java.net.Socket; import java.net.ServerSocket; +import java.net.Socket; import java.net.SocketTimeoutException; +import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint; +import net.sourceforge.phpdt.internal.debug.core.logview.LogView; +import net.sourceforge.phpdt.internal.debug.core.model.IPHPDebugTarget; +import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; +import net.sourceforge.phpdt.internal.debug.core.model.PHPThread; +import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IBreakpoint; -import net.sourceforge.phpdt.internal.debug.core.model.IPHPDebugTarget; -import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; -import net.sourceforge.phpdt.internal.debug.core.model.PHPThread; -import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable; -import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; public class PHPDBGProxy { - private ServerSocket server= null; - private Socket socket; - private BufferedReader reader= null; - private PHPDBGInterface DBGInt= null; - private IPHPDebugTarget debugTarget= null; - private PHPLoop phpLoop; - private PHPThread PHPMainThread; - private PHPDBGProxy thisProxy= null; - private int port; - private boolean remote; - private IPath remoteSourcePath; - - public PHPDBGProxy() { - thisProxy= this; - } - - public PHPDBGProxy(boolean remote,String remoteSourcePath) { - thisProxy= this; - this.remote=remote; - this.remoteSourcePath= new Path(remoteSourcePath); - } - - public void start() { - createServerSocket(); - this.startPHPLoop(); - } - - public void stop() { - phpLoop.setShouldStop(); - if(DBGInt != null) DBGInt.setShouldStop(); - if (!remote) { - try { - getDebugTarget().getProcess().terminate(); - } catch (DebugException e) { - e.printStackTrace(); - } - } - phpLoop.notifyWait(); - } - - protected ServerSocket getServerSocket() throws IOException { - if (server == null) { - createServerSocket(); - } - return server; - } - - protected void createServerSocket() { -// port = SocketUtil.findUnusedLocalPort("localhost", 10001, 10101); - port = 10001; - if (port == -1) { - PHPDebugCorePlugin.log(5, "Cannot find free port!!!!"); - return; - } - try { - if (server == null) { - server = new ServerSocket(port); - //System.out.println("ServerSocket on port: " + port); - } - } catch (IOException e) { - // IO Error - PHPDebugCorePlugin.log(e); - stop(); - } - } - - public Socket getSocket() throws IOException { - return socket; - } - - protected void setDBGInterface(PHPDBGInterface DBGInt) { - this.DBGInt= DBGInt; - } - - public BufferedReader getReader() throws IOException { - if (reader == null) { - reader = new BufferedReader(new InputStreamReader(this.getSocket().getInputStream(), "ISO8859_1")); - } - return reader; - } - - public BufferedReader getReader(Socket socket) throws IOException { - if (socket != null) - return new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO8859_1")); - else - return null; - } - - public OutputStream getOutputStream() throws IOException { - return this.getSocket().getOutputStream(); - } - - protected void setBreakPoints() throws IOException, CoreException { - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); - for (int i = 0; i < breakpoints.length; i++) { - addBreakpoint(breakpoints[i]); - } - } - - public void addBreakpoint(IBreakpoint breakpoint) { - if (DBGInt == null) return; - int bpNo= 0; - try { - PHPLineBreakpoint phpLBP; - if(breakpoint.getModelIdentifier() == PHPDebugCorePlugin.getUniqueIdentifier()) { - IPath filename; - phpLBP= (PHPLineBreakpoint)breakpoint; - // bpNo= DBGInt.addBreakpoint(phpLBP.getMarker().getResource().getLocation().toOSString(), phpLBP.getLineNumber()); - if (remote) - filename=remoteSourcePath.append(phpLBP.getMarker().getResource().getProjectRelativePath()); - else - filename=phpLBP.getMarker().getResource().getLocation(); - bpNo= DBGInt.addBreakpoint(filename.toOSString(), phpLBP.getLineNumber()); - phpLBP.setDBGBpNo(bpNo); - } - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - stop(); - } catch (CoreException e) { - PHPDebugCorePlugin.log(e); - stop(); - } - } - - public void removeBreakpoint(IBreakpoint breakpoint) { - if (DBGInt == null) return; - try { - PHPLineBreakpoint phpLBP; - if(breakpoint.getModelIdentifier() == PHPDebugCorePlugin.getUniqueIdentifier()) { - phpLBP= (PHPLineBreakpoint)breakpoint; - IPath filename; - if (remote) - filename=remoteSourcePath.append(phpLBP.getMarker().getResource().getProjectRelativePath()); - else - filename=phpLBP.getMarker().getResource().getLocation(); -// bpNo= DBGInt.addBreakpoint(filename.toOSString(), phpLBP.getLineNumber()); - DBGInt.removeBreakpoint(filename.toOSString(), phpLBP.getLineNumber(), phpLBP.getDBGBpNo()); - } - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - stop(); - } catch (CoreException e) { - PHPDebugCorePlugin.log(e); - stop(); - } - } - - public void phpLoopNotify (){ - phpLoop.notifyWait(); - } - - public void startPHPLoop() { - phpLoop = new PHPLoop(); - phpLoop.start(); - } - - public void resume() { - try { - DBGInt.continueExecution(); - phpLoop.notifyWait(); - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - stop(); - } - } - - public void pause() { - try { - DBGInt.pauseExecution(); - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - stop(); - } - } - protected IPHPDebugTarget getDebugTarget() { - return debugTarget; - } - - public void setDebugTarget(IPHPDebugTarget debugTarget) { - this.debugTarget = debugTarget; - debugTarget.setPHPDBGProxy(this); - } - - public PHPVariable[] readVariables(PHPStackFrame frame) { - try { - return DBGInt.getVariables(frame); - } catch (IOException ioex) { - ioex.printStackTrace(); - throw new RuntimeException(ioex.getMessage()); - } catch (DebugException ex) { - ex.printStackTrace(); - throw new RuntimeException(ex.getMessage()); - } - } - - public PHPVariable[] eval(PHPStackFrame frame,String evalString) { - try { - return DBGInt.evalBlock(frame,evalString); - // return DBGInt.getVariables(frame); - } catch (IOException ioex) { - ioex.printStackTrace(); - throw new RuntimeException(ioex.getMessage()); - } catch (DebugException ex) { - ex.printStackTrace(); - throw new RuntimeException(ex.getMessage()); - } - } - - public void readStepOverEnd(PHPStackFrame stackFrame) { - try { - DBGInt.stepOver(); - phpLoop.notifyWait(); - } catch (Exception e) { - PHPDebugCorePlugin.log(e); - } - } - - public void readStepReturnEnd(PHPStackFrame stackFrame) { - try { - DBGInt.stepOut(); - phpLoop.notifyWait(); - } catch (Exception e) { - PHPDebugCorePlugin.log(e); - } - } - - public void readStepIntoEnd(PHPStackFrame stackFrame) { - try { - DBGInt.stepInto(); - phpLoop.notifyWait(); - } catch (Exception e) { - PHPDebugCorePlugin.log(e); - } - } - -/* - public PHPStackFrame[] readFrames(PHPThread thread) { - //try { - //this.println("th " + thread.getId() + " ; f "); - //return new FramesReader(getMultiReaderStrategy()).readFrames(thread); - return null; - //} catch (IOException e) { - // PHPDebugCorePlugin.log(e); - // return null; - //} - - } -*/ - - public void closeSocket() throws IOException { - if (socket != null) { - socket.close(); - } - } - - public void closeServerSocket() throws IOException { - if (server != null) { - server.close(); - } - } - - public int getPort() { - return port; - } - - class PHPLoop extends Thread { - private boolean shouldStop; - - public PHPLoop() { - shouldStop = false; - this.setName("PHPDebuggerLoop"); - } - - public synchronized void setShouldStop() { - shouldStop = true; - } - - public synchronized void notifyWait() { - notify(); - } - - public void run() { - try { - char[] buf= new char[16]; - int i, pos, timeout; - long interval= 200; // 200ms - String line; - PHPStackFrame[] StackList; - boolean endFile=false; - boolean newconnect=false; - Socket newSocket=null; - PHPDBGInterface newDBGInt; - int sid=-1; - -// synchronized (this) { -// wait(); -// } - - PHPMainThread = new PHPThread(getDebugTarget(), getPort()); - PHPMainThread.setName("Thread [main]"); - timeout = 0; - -// while ((getDebugTarget() == null) && (timeout < 100)) { -// sleep(100); -// timeout++; -// } - // Be sure debug target is set -// PHPMainThread.setDebugTarget(getDebugTarget()); - getDebugTarget().addThread(PHPMainThread); - - //System.out.println("Waiting for breakpoints."); - while (!shouldStop) - { - newconnect=true; - try { - newSocket = server.accept(); - //System.out.println("Accepted! : " + socket.toString()); - } catch (SocketTimeoutException e) { - // no one wants to connect - newconnect=false; - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - return; - } - - if (newconnect) - { - if (DBGInt==null) - server.setSoTimeout(1); - newDBGInt= new PHPDBGInterface(getReader(newSocket), newSocket.getOutputStream(), thisProxy); - newDBGInt.waitResponse(1000); - newDBGInt.flushAllPackets(); - // Check version and session ID - if ((DBGInt==null) || (DBGInt.getSID()==newDBGInt.getSID())) - { - DBGInt=newDBGInt; - try { - closeSocket(); - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - shouldStop=true; - } - socket=newSocket; - setBreakPoints(); - DBGInt.continueExecution(); - } else - { - newDBGInt.continueExecution(); - newSocket.close(); - } - } - - if(DBGInt.waitResponse(interval)) - { - - DBGInt.flushAllPackets(); - - if (DBGInt.BPUnderHit != 0) { - StackList = DBGInt.getStackList(); - if (StackList.length > 0) { - for (i = 0; i < StackList.length; i++) { - StackList[i].setThread(PHPMainThread); - if (DBGInt.getModByNo(StackList[i].getModNo()).equals("")) { - DBGInt.getSourceTree(); - } - StackList[i].setFile( - DBGInt.getModByNo(StackList[i].getModNo())); - } - PHPMainThread.setStackFrames(StackList); - } - // Fire debug event - PHPMainThread.suspend(); - - synchronized (this) { - wait(); - } - } - } - if (remote) { - if (PHPMainThread.isTerminated()) { - shouldStop=true; - break; - } - } else { - if (PHPMainThread.isTerminated() || getDebugTarget().getProcess().isTerminated()) { - shouldStop=true; - break; - } - } - } - } - catch (Exception ex) { - PHPDebugCorePlugin.log(ex); - System.out.println(ex); - } - finally { - try { - getDebugTarget().terminate(); - closeSocket(); - closeServerSocket(); - } catch (IOException e) { - PHPDebugCorePlugin.log(e); - return; - } + private ServerSocket server = null; + + private Socket socket; + + private BufferedReader reader = null; + + private PHPDBGInterface DBGInt = null; + + private IPHPDebugTarget debugTarget = null; + + private PHPLoop phpLoop; + + private PHPThread PHPMainThread; + + private PHPDBGProxy thisProxy = null; + + private int port; + + private boolean remote; + + private IPath remoteSourcePath; + + public PHPDBGProxy() { + thisProxy = this; + } + + public PHPDBGProxy(boolean remote, String remoteSourcePath) { + thisProxy = this; + this.remote = remote; + this.remoteSourcePath = new Path(remoteSourcePath); + } + + public void start() { + createServerSocket(); + this.startPHPLoop(); + } + + public void stop() { + phpLoop.setShouldStop(); + if (DBGInt != null) + DBGInt.setShouldStop(); + if (!remote) { + try { + getDebugTarget().getProcess().terminate(); + } catch (DebugException e) { + e.printStackTrace(); + } + } + phpLoop.notifyWait(); + } + + protected ServerSocket getServerSocket() throws IOException { + if (server == null) { + createServerSocket(); + } + return server; + } + + protected void createServerSocket() { + // port = SocketUtil.findUnusedLocalPort("localhost", 10001, 10101); + port = 10001; + if (port == -1) { + PHPDebugCorePlugin.log(5, "Cannot find free port!!!!"); + return; + } + try { + if (server == null) { + server = new ServerSocket(port); + //System.out.println("ServerSocket on port: " + port); + } + } catch (IOException e) { + // IO Error + PHPDebugCorePlugin.log(e); + stop(); + } + } + + public Socket getSocket() throws IOException { + return socket; + } + + protected void setDBGInterface(PHPDBGInterface DBGInt) { + this.DBGInt = DBGInt; + } + + public BufferedReader getReader() throws IOException { + if (reader == null) { + reader = new BufferedReader(new InputStreamReader(this.getSocket().getInputStream(), "ISO8859_1")); + } + return reader; + } + + public BufferedReader getReader(Socket socket) throws IOException { + if (socket != null) + return new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO8859_1")); + else + return null; + } + + public OutputStream getOutputStream() throws IOException { + return this.getSocket().getOutputStream(); + } + + protected void setBreakPoints() throws IOException, CoreException { + IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); + for (int i = 0; i < breakpoints.length; i++) { + addBreakpoint(breakpoints[i]); + } + } + + public void addBreakpoint(IBreakpoint breakpoint) { + if (DBGInt == null) + return; + int bpNo = 0; + try { + PHPLineBreakpoint phpLBP; + if (breakpoint.getModelIdentifier() == PHPDebugCorePlugin.getUniqueIdentifier()) { + IPath filename; + phpLBP = (PHPLineBreakpoint) breakpoint; + // bpNo= DBGInt.addBreakpoint(phpLBP.getMarker().getResource().getLocation().toOSString(), phpLBP.getLineNumber()); + if (remote) + filename = remoteSourcePath.append(phpLBP.getMarker().getResource().getProjectRelativePath()); + else + filename = phpLBP.getMarker().getResource().getLocation(); + bpNo = DBGInt.addBreakpoint(filename.toOSString(), phpLBP.getLineNumber()); + phpLBP.setDBGBpNo(bpNo); + } + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + stop(); + } catch (CoreException e) { + PHPDebugCorePlugin.log(e); + stop(); + } + } + + public void removeBreakpoint(IBreakpoint breakpoint) { + if (DBGInt == null) + return; + try { + PHPLineBreakpoint phpLBP; + if (breakpoint.getModelIdentifier() == PHPDebugCorePlugin.getUniqueIdentifier()) { + phpLBP = (PHPLineBreakpoint) breakpoint; + IPath filename; + if (remote) + filename = remoteSourcePath.append(phpLBP.getMarker().getResource().getProjectRelativePath()); + else + filename = phpLBP.getMarker().getResource().getLocation(); + // bpNo= DBGInt.addBreakpoint(filename.toOSString(), phpLBP.getLineNumber()); + DBGInt.removeBreakpoint(filename.toOSString(), phpLBP.getLineNumber(), phpLBP.getDBGBpNo()); + } + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + stop(); + } catch (CoreException e) { + PHPDebugCorePlugin.log(e); + stop(); + } + } + + public void phpLoopNotify() { + phpLoop.notifyWait(); + } + + public void startPHPLoop() { + phpLoop = new PHPLoop(); + phpLoop.start(); + } + + public void resume() { + try { + DBGInt.continueExecution(); + phpLoop.notifyWait(); + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + stop(); + } + } + + public void pause() { + try { + DBGInt.pauseExecution(); + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + stop(); + } + } + + protected IPHPDebugTarget getDebugTarget() { + return debugTarget; + } + + public void setDebugTarget(IPHPDebugTarget debugTarget) { + this.debugTarget = debugTarget; + debugTarget.setPHPDBGProxy(this); + } + + public PHPVariable[] readVariables(PHPStackFrame frame) { + try { + return DBGInt.getVariables(frame); + } catch (IOException ioex) { + ioex.printStackTrace(); + throw new RuntimeException(ioex.getMessage()); + } catch (DebugException ex) { + ex.printStackTrace(); + throw new RuntimeException(ex.getMessage()); + } + } + + public PHPVariable[] eval(PHPStackFrame frame, String evalString) { + try { + return DBGInt.evalBlock(frame, evalString); + // return DBGInt.getVariables(frame); + } catch (IOException ioex) { + ioex.printStackTrace(); + throw new RuntimeException(ioex.getMessage()); + } catch (DebugException ex) { + ex.printStackTrace(); + throw new RuntimeException(ex.getMessage()); + } + } + + public void readStepOverEnd(PHPStackFrame stackFrame) { + try { + DBGInt.stepOver(); + phpLoop.notifyWait(); + } catch (Exception e) { + PHPDebugCorePlugin.log(e); + } + } + + public void readStepReturnEnd(PHPStackFrame stackFrame) { + try { + DBGInt.stepOut(); + phpLoop.notifyWait(); + } catch (Exception e) { + PHPDebugCorePlugin.log(e); + } + } + + public void readStepIntoEnd(PHPStackFrame stackFrame) { + try { + DBGInt.stepInto(); + phpLoop.notifyWait(); + } catch (Exception e) { + PHPDebugCorePlugin.log(e); + } + } + + /* + * public PHPStackFrame[] readFrames(PHPThread thread) { //try { //this.println("th " + thread.getId() + " ; f "); //return new + * FramesReader(getMultiReaderStrategy()).readFrames(thread); return null; //} catch (IOException e) { // + * PHPDebugCorePlugin.log(e); // return null; //} + * } + */ + + public void closeSocket() throws IOException { + if (socket != null) { + socket.close(); + } + } + + public void closeServerSocket() throws IOException { + if (server != null) { + server.close(); + } + } + + public int getPort() { + return port; + } + + class PHPLoop extends Thread { + private boolean shouldStop; + + public PHPLoop() { + shouldStop = false; + this.setName("PHPDebuggerLoop"); + } + + public synchronized void setShouldStop() { + shouldStop = true; + } + + public synchronized void notifyWait() { + notify(); + } + + public void run() { + try { + char[] buf = new char[16]; + int i, pos, timeout; + long interval = 200; // 200ms + String line; + PHPStackFrame[] StackList; + boolean endFile = false; + boolean newconnect = false; + Socket newSocket = null; + PHPDBGInterface newDBGInt; + int sid = -1; + + // synchronized (this) { + // wait(); + // } + + PHPMainThread = new PHPThread(getDebugTarget(), getPort()); + PHPMainThread.setName("Thread [main]"); + timeout = 0; + + // while ((getDebugTarget() == null) && (timeout < 100)) { + // sleep(100); + // timeout++; + // } + // Be sure debug target is set + // PHPMainThread.setDebugTarget(getDebugTarget()); + getDebugTarget().addThread(PHPMainThread); + + //System.out.println("Waiting for breakpoints."); + while (!shouldStop) { + newconnect = true; + try { + newSocket = server.accept(); + //System.out.println("Accepted! : " + socket.toString()); + } catch (SocketTimeoutException e) { + // no one wants to connect + newconnect = false; + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + return; + } + + if (newconnect) { + if (DBGInt == null) + server.setSoTimeout(1); + newDBGInt = new PHPDBGInterface(getReader(newSocket), newSocket.getOutputStream(), thisProxy); + newDBGInt.waitResponse(1000); + newDBGInt.flushAllPackets(); + // Check version and session ID + if ((DBGInt == null) || (DBGInt.getSID() == newDBGInt.getSID())) { + DBGInt = newDBGInt; + try { + closeSocket(); + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + shouldStop = true; + } + socket = newSocket; + setBreakPoints(); + DBGInt.continueExecution(); + } else { + newDBGInt.continueExecution(); + newSocket.close(); + } + } + + if (DBGInt.waitResponse(interval)) { + + DBGInt.flushAllPackets(); + + if (DBGInt.BPUnderHit != 0) { + StackList = DBGInt.getStackList(); + if (StackList.length > 0) { + for (i = 0; i < StackList.length; i++) { + StackList[i].setThread(PHPMainThread); + if (DBGInt.getModByNo(StackList[i].getModNo()).equals("")) { + DBGInt.getSourceTree(); + } + StackList[i].setFile(DBGInt.getModByNo(StackList[i].getModNo())); + } + PHPMainThread.setStackFrames(StackList); + } + // Fire debug event + PHPMainThread.suspend(); + + synchronized (this) { + wait(); + } + } + } + if (remote) { + if (PHPMainThread.isTerminated()) { + shouldStop = true; + break; + } + } else { + if (PHPMainThread.isTerminated() || getDebugTarget().getProcess().isTerminated()) { + shouldStop = true; + break; + } + } + } + } catch (Exception ex) { + PHPDebugCorePlugin.log(ex); + System.out.println(ex); + } finally { + try { + getDebugTarget().terminate(); + closeSocket(); + closeServerSocket(); + } catch (IOException e) { + PHPDebugCorePlugin.log(e); + return; + } //System.out.println("Socket loop finished."); - } - } - } -} + } + } + } +} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java index 137b708..6fd64ee 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java @@ -1,34 +1,70 @@ package net.sourceforge.phpdt.internal.debug.core; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import net.sourceforge.phpdt.internal.debug.core.logview.LogView; import net.sourceforge.phpeclipse.PHPeclipsePlugin; + import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; -//import org.eclipse.core.runtime.*; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; /** * The main plugin class to be used in the desktop. */ -public class PHPDebugCorePlugin extends Plugin { - public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$ +public class PHPDebugCorePlugin extends AbstractUIPlugin { // The shared instance. protected static PHPDebugCorePlugin plugin; + public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$ + + public static IWorkbenchPage getActivePage() { + return getDefault().internalGetActivePage(); + } + public static Shell getActiveWorkbenchShell() { + return getActiveWorkbenchWindow().getShell(); + } + public static IWorkbenchWindow getActiveWorkbenchWindow() { + return getDefault().getWorkbench().getActiveWorkbenchWindow(); + } /** - * The constructor. + * Returns the shared instance. */ - public PHPDebugCorePlugin() { - super(); - plugin = this; - } + public static PHPDebugCorePlugin getDefault() { + return plugin; + } + + public static String getFormattedMessage(String key, String arg) { + String text = getResourceString(key); + return java.text.MessageFormat.format(text, new Object[] { arg }); + } + public static String getResourceString(String key) { + ResourceBundle bundle = plugin.getResourceBundle(); + if (bundle != null) { + try { + String bundleString = bundle.getString(key); + //return "$"+bundleString; + return bundleString; + } catch (MissingResourceException e) { + // default actions is to return key, which is OK + } + } + return key; + } /** - * Returns the shared instance. + * Convenience method which returns the unique identifier of this plugin. */ - public static PHPDebugCorePlugin getDefault() { - return plugin; + public static String getUniqueIdentifier() { + return PLUGIN_ID; } /** @@ -50,12 +86,28 @@ public class PHPDebugCorePlugin extends Plugin { public static void log(Throwable e) { log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$ } - + private ResourceBundle resourceBundle; /** - * Convenience method which returns the unique identifier of this plugin. + * The constructor. */ - public static String getUniqueIdentifier() { - return PLUGIN_ID; + public PHPDebugCorePlugin() { + super(); + plugin = this; + try { + resourceBundle = + ResourceBundle.getBundle( + "net.sourceforge.phpdt.internal.debug.core.debugresources"); //$NON-NLS-1$ + } catch (MissingResourceException x) { + resourceBundle = null; + } + } + + public java.util.ResourceBundle getResourceBundle() { + return resourceBundle; + } + + private IWorkbenchPage internalGetActivePage() { + return getWorkbench().getActiveWorkbenchWindow().getActivePage(); } /** diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java new file mode 100644 index 0000000..7e48417 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.core; + +import java.net.*; + +import org.eclipse.jface.resource.*; +import org.eclipse.swt.graphics.Image; + +public class PHPDegugCorePluginImages { + + private final static URL BASE_URL = + PHPDebugCorePlugin.getDefault().getDescriptor().getInstallURL(); + private final static ImageRegistry PLUGIN_REGISTRY = + PHPDebugCorePlugin.getDefault().getImageRegistry(); + + public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$ + + private static final String PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$ + private static final String PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$ + private static final String PATH_LCL_DISABLED = ICONS_PATH + "dlcl16/"; //$NON-NLS-1$ + private static final String PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$ + private static final String PATH_EVENTS = ICONS_PATH + "eview16/"; //$NON-NLS-1$ + + + public static final ImageDescriptor DESC_ERROR_ST_OBJ = + create(PATH_OBJ, "error_st_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_ERROR_STACK_OBJ = + create(PATH_OBJ, "error_stack.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_EXT_POINT_OBJ = + create(PATH_OBJ, "ext_point_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_EXT_POINTS_OBJ = + create(PATH_OBJ, "ext_points_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_EXTENSION_OBJ = + create(PATH_OBJ, "extension_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_EXTENSIONS_OBJ = + create(PATH_OBJ, "extensions_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_GENERIC_XML_OBJ = + create(PATH_OBJ, "generic_xml_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_INFO_ST_OBJ = + create(PATH_OBJ, "info_st_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_JAVA_LIB_OBJ = + create(PATH_OBJ, "java_lib_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_NATIVE_LIB_OBJ = + create(PATH_OBJ, "native_lib_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_OK_ST_OBJ = + create(PATH_OBJ, "ok_st_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_PLUGIN_OBJ = + create(PATH_OBJ, "plugin_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ = + create(PATH_OBJ, "req_plugin_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ = + create(PATH_OBJ, "req_plugins_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_RUNTIME_OBJ = + create(PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_WARNING_ST_OBJ = + create(PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$ + + /* + * Local tool bar image descriptors + */ + + public static final ImageDescriptor DESC_PROPERTIES = + create(PATH_LCL, "properties.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_OPEN_LOG = + create(PATH_LCL, "open_log.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_OPEN_LOG_DISABLED = + create(PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_PROPERTIES_DISABLED = + create(PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_REFRESH = + create(PATH_LCL, "refresh.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_REFRESH_DISABLED = + create(PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL, "clear.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_CLEAR_DISABLED = + create(PATH_LCL_DISABLED, "clear.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_READ_LOG = + create(PATH_LCL, "restore_log.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_READ_LOG_DISABLED = + create(PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_REMOVE_LOG = + create(PATH_LCL, "remove.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED = + create(PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_FILTER = + create(PATH_LCL, "filter_ps.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_FILTER_DISABLED = + create(PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_EXPORT = + create(PATH_LCL, "export_log.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_EXPORT_DISABLED = + create(PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_IMPORT = + create(PATH_LCL, "import_log.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_IMPORT_DISABLED = + create(PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_COLLAPSE_ALL = + create(PATH_LCL, "collapseall.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_HORIZONTAL_VIEW = + create(PATH_LCL, "th_horizontal.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED = + create(PATH_LCL_DISABLED, "th_horizontal.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_VERTICAL_VIEW = + create(PATH_LCL, "th_vertical.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED = + create(PATH_LCL_DISABLED, "th_vertical.gif"); //$NON-NLS-1$ + + public static final ImageDescriptor DESC_HIDE_PANE = + create(PATH_EVENTS, "hide_pane.gif"); //$NON-NLS-1$ + + /* + * Event Details + */ + public static final ImageDescriptor DESC_PREV_EVENT = + create(PATH_EVENTS, "event_prev.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_NEXT_EVENT = + create(PATH_EVENTS, "event_next.gif"); //$NON-NLS-1$ + /* + * Overlays + */ + public static final ImageDescriptor DESC_RUN_CO = + create(PATH_OVR, "run_co.gif"); //$NON-NLS-1$ + + private static ImageDescriptor create(String prefix, String name) { + return ImageDescriptor.createFromURL(makeIconURL(prefix, name)); + } + + public static Image get(String key) { + return PLUGIN_REGISTRY.get(key); + } + private static URL makeIconURL(String prefix, String name) { + String path = prefix + name; + URL url = null; + try { + url = new URL(BASE_URL, path); + } catch (MalformedURLException e) { + return null; + } + return url; + } + public static Image manage(String key, ImageDescriptor desc) { + Image image = desc.createImage(); + PLUGIN_REGISTRY.put(key, image); + return image; + } +} diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/debugresources.properties b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/debugresources.properties new file mode 100644 index 0000000..702aa2a --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/debugresources.properties @@ -0,0 +1,118 @@ +############################################################################### +# Copyright (c) 2000, 2004 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Common Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/cpl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# +# PDE Runtime resources +# + +LogView.column.severity = ! +LogView.column.message = Message +LogView.column.plugin = Plug-in +LogView.column.date = Date +LogView.clear = C&lear log viewer +LogView.clear.tooltip = Clear log viewer +LogView.copy = &Copy +LogView.delete = &Delete log +LogView.delete.tooltip = Delete log +LogView.export = &Export log... +LogView.export.tooltip = Export log +LogView.import = &Import log... +LogView.import.tooltip = Import log +LogView.filter = &Filters... +LogView.readLog.reload = Re&load this workspace's log +LogView.readLog.restore = &Restore log +LogView.readLog.restore.tooltip = Restore log +LogView.severity.error = Error +LogView.severity.warning = Warning +LogView.severity.info = Info +LogView.confirmDelete.title = Confirm Delete +LogView.confirmDelete.message = Are you sure you want to permanently delete all logged events? +LogView.confirmOverwrite.message = File " {0}" exists. Would you like to overwrite it? +LogView.operation.importing = Importing log... +LogView.operation.reloading = Reloading... +LogView.activate = &Activate on new events +LogView.view.currentLog = &Open log +LogView.view.currentLog.tooltip = Open log + +LogView.FilterDialog.title = Log Filters +LogView.FilterDialog.eventTypes = Event Types +LogView.FilterDialog.information = &Information +LogView.FilterDialog.warning = &Warning +LogView.FilterDialog.error = &Error +LogView.FilterDialog.limitTo = &Limit visible events to: +LogView.FilterDialog.eventsLogged = Show events logged during: +LogView.FilterDialog.allSessions = &All sessions +LogView.FilterDialog.recentSession = &Most recent session + +RegistryView.extensionPointPR.id = Id +RegistryView.extensionPointPR.name = Name + +RegistryView.extensionPR.id = Id +RegistryView.extensionPR.name = Name +RegistryView.extensionPR.point = Point + +RegistryView.libraryPR.path = Path +RegistryView.libraryPR.exported = Exported +RegistryView.libraryPR.fullyExported = Fully Exported + +RegistryView.pluginPR.installURL = Install URL +RegistryView.pluginPR.name = Name +RegistryView.pluginPR.id = Unique ID +RegistryView.pluginPR.providerName = Provider Name +RegistryView.pluginPR.version = Version +RegistryView.pluginPR.activated = Activated + +RegistryView.prerequisitePR.exported = Exported +RegistryView.prerequisitePR.id = Unique Id +RegistryView.prerequisitePR.version = Required Version +RegistryView.prerequisitePR.optional = Optional +RegistryView.prerequisitePR.match = Match Rule +RegistryView.prerequisitePR.matchedCompatible = Compatible +RegistryView.prerequisitePR.matchedExact = Exact +RegistryView.prerequisitePR.matchedEquivalent = Equivalent +RegistryView.prerequisitePR.matchedGreaterOrEqual = Greater or Equal +RegistryView.prerequisitePR.matchedPerfect = Perfect + +RegistryView.refresh.label=&Refresh +RegistryView.refresh.tooltip=Refresh +RegistryView.collapseAll.label = &Collapse All +RegistryView.collapseAll.tooltip = Collapse All + +RegistryView.folders.imports = Prerequisites +RegistryView.folders.libraries = Run-time Libraries +RegistryView.folders.extensionPoints = Extension Points +RegistryView.folders.extensions = Extensions +EventDetailsDialog.title= Event Details +EventDetailsDialog.date=Date: +EventDetailsDialog.severity=Severity: +EventDetailsDialog.message=Message: +EventDetailsDialog.exception=Exception Stack Trace: +EventDetailsDialog.session=Session Data: +EventDetailsDialog.noStack = An exception stack trace could not be found. +EventDetailsDialog.previous=View details of previous event +EventDetailsDialog.next=View details of next event +EventDetailsDialog.copy=Copy event details to clipboard + +RegistryView.showRunning.label = &Show Active Plug-ins Only + +RegistryView.showPropertiesSheet.label = S&how Registry Only +RegistryView.showPropertiesSheet.tooltip = Show Plug-in Registry Only +RegistryView.showPropertiesSheet.desc = Hide registry properties + +RegistryView.verticalOrientation.label = &Vertical View Orientation +RegistryView.verticalOrientation.tooltip = Vertical View Orientation +RegistryView.verticalOrientation.desc = Tile vertically + +RegistryView.horizontalOrientation.label = &Horizontal View Orientation +RegistryView.horizontalOrientation.tooltip = Horizontal View Orientation +RegistryView.horizontalOrientation.desc = Tile horizontally +OpenLogDialog.title=Error Log +OpenLogDialog.message=Opening log... +OpenLogDialog.cannotDisplay=Log file cannot be displayed. diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/EventDetailsDialog.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/EventDetailsDialog.java new file mode 100644 index 0000000..8736c10 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/EventDetailsDialog.java @@ -0,0 +1,629 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.core.logview; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.Collator; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; + +import net.sourceforge.phpdt.internal.debug.core.PHPDegugCorePluginImages; +import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableTreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +public class EventDetailsDialog extends Dialog { + private LogEntry entry, parentEntry; + private LogViewLabelProvider labelProvider; + private static int COPY_ID = 22; + private TableTreeViewer provider; + private int elementNum, totalElementCount; + private LogEntry[] entryChildren; + private int childIndex = 0; + private boolean isOpen; + + private Label dateLabel; + private Label severityImageLabel; + private Label severityLabel; + private Text msgText; + private Text stackTraceText; + private Text sessionDataText; + private Clipboard clipboard; + private Button copyButton; + private Button backButton; + private Button nextButton; + private Image imgNextEnabled; + private Image imgPrevEnabled; + private Image imgCopyEnabled; + private SashForm sashForm; + + // sorting + private static int ASCENDING = 1; + private Comparator comparator = null; + private Collator collator; + + // location configuration + private IDialogSettings dialogSettings; + private Point dialogLocation; + private Point dialogSize; + private int[] sashWeights; + + // externalize strings + private String EVENT_NO_STACK = "EventDetailsDialog.noStack"; //$NON-NLS-1$ + private String EVENT_PREVIOUS = "EventDetailsDialog.previous"; //$NON-NLS-1$ + private String EVENT_NEXT = "EventDetailsDialog.next"; //$NON-NLS-1$ + private String EVENT_COPY = "EventDetailsDialog.copy"; //$NON-NLS-1$ + + /** + * @param parentShell + * shell in which dialog is displayed + */ + protected EventDetailsDialog(Shell parentShell, IAdaptable selection, ISelectionProvider provider) { + super(parentShell); + labelProvider = new LogViewLabelProvider(); + this.provider = (TableTreeViewer) provider; + this.entry = (LogEntry)selection; + setShellStyle(SWT.MODELESS | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.CLOSE | SWT.BORDER | SWT.TITLE); + clipboard = new Clipboard(parentShell.getDisplay()); + initialize(); + createImages(); + collator = Collator.getInstance(); + readConfiguration(); + } + + private void initialize() { + elementNum = getParentElementNum(); + totalElementCount = provider.getTableTree().getTable().getItemCount() - getVisibleChildrenCount(); + parentEntry = (LogEntry) entry.getParent(entry); + if (isChild(entry)){ + setEntryChildren(parentEntry); + resetChildIndex(); + } + } + + private void resetChildIndex(){ + for (int i = 0; i 0) + width -= 100; + else + width = width/2; + sashWeights = new int[]{width, getSashForm().getClientArea().width-width}; + } + getSashForm().setWeights(sashWeights); + return super.open(); + } + + public boolean close() { + storeSettings(); + isOpen = false; + imgCopyEnabled.dispose(); + imgNextEnabled.dispose(); + imgPrevEnabled.dispose(); + return super.close(); + } + + public void create() { + super.create(); + + // dialog location + if (dialogLocation != null) + getShell().setLocation(dialogLocation); + + // dialog size + if (dialogSize != null) + getShell().setSize(dialogSize); + else + getShell().setSize(500,550); + + + applyDialogFont(buttonBar); + getButton(IDialogConstants.OK_ID).setFocus(); + } + + protected void buttonPressed(int buttonId) { + if (IDialogConstants.OK_ID == buttonId) + okPressed(); + else if (IDialogConstants.CANCEL_ID == buttonId) + cancelPressed(); + else if (IDialogConstants.BACK_ID == buttonId) + backPressed(); + else if (IDialogConstants.NEXT_ID == buttonId) + nextPressed(); + else if (COPY_ID == buttonId) + copyPressed(); + } + + protected void backPressed() { + if (isChild(entry)) { + if (childIndex > 0) { + childIndex--; + entry = entryChildren[childIndex]; + } else + entry = parentEntry; + } else { + if (elementNum - 1 >= 0) + elementNum -= 1; + entry = (LogEntry) provider.getElementAt(elementNum); + } + setEntrySelectionInTable(); + } + + protected void nextPressed() { + if (isChild(entry) && childIndex < entryChildren.length-1) { + childIndex++; + entry = entryChildren[childIndex]; + } else if (elementNum + 1 < totalElementCount){ + elementNum += 1; + entry = (LogEntry) provider.getElementAt(elementNum); + } else { // at end of list but can branch into child elements - bug 58083 + setEntryChildren(entry); + entry = entryChildren[0]; + } + setEntrySelectionInTable(); + } + + protected void copyPressed() { + StringWriter writer = new StringWriter(); + PrintWriter pwriter = new PrintWriter(writer); + + entry.write(pwriter); + pwriter.flush(); + String textVersion = writer.toString(); + try { + pwriter.close(); + writer.close(); + } catch (IOException e) { + } + // set the clipboard contents + clipboard.setContents(new Object[] { textVersion }, new Transfer[] { TextTransfer.getInstance()}); + } + + public void setComparator(Comparator comparator){ + this.comparator = comparator; + updateProperties(); + } + private void setComparator(byte sortType, final int sortOrder){ + if (sortType == LogView.DATE){ + comparator = new Comparator(){ + public int compare(Object e1, Object e2) { + try { + SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$ + Date date1 = formatter.parse(((LogEntry)e1).getDate()); + Date date2 = formatter.parse(((LogEntry)e2).getDate()); + if (sortOrder == ASCENDING) + return date1.before(date2) ? -1 : 1; + return date1.after(date2) ? -1 : 1; + } catch (ParseException e) { + } + return 0; + } + }; + } else if (sortType == LogView.PLUGIN){ + comparator = new Comparator(){ + public int compare(Object e1, Object e2) { + LogEntry entry1 = (LogEntry)e1; + LogEntry entry2 = (LogEntry)e2; + return collator.compare(entry1.getPluginId(), entry2.getPluginId()) * sortOrder; + } + }; + } else { + comparator = new Comparator(){ + public int compare(Object e1, Object e2) { + LogEntry entry1 = (LogEntry)e1; + LogEntry entry2 = (LogEntry)e2; + return collator.compare(entry1.getMessage(), entry2.getMessage()) * sortOrder; + } + }; + } + } + + public void resetSelection(IAdaptable selectedEntry, byte sortType, int sortOrder){ + setComparator(sortType, sortOrder); + resetSelection(selectedEntry); + } + + public void resetSelection(IAdaptable selectedEntry){ + if (entry.equals(selectedEntry) && + elementNum == getParentElementNum()){ + updateProperties(); + return; + } + entry = (LogEntry)selectedEntry; + initialize(); + updateProperties(); + } + + public void resetButtons(){ + backButton.setEnabled(false); + nextButton.setEnabled(false); + } + + private void setEntrySelectionInTable(){ + ISelection selection = new StructuredSelection(entry); + provider.setSelection(selection); + } + + public void updateProperties() { + if (isChild(entry)){ + parentEntry = (LogEntry) entry.getParent(entry); + setEntryChildren(parentEntry); + resetChildIndex(); + } + + + totalElementCount = provider.getTableTree().getTable().getItemCount() - getVisibleChildrenCount(); + dateLabel.setText(entry.getDate()); + severityImageLabel.setImage(labelProvider.getColumnImage(entry, 1)); + severityLabel.setText(entry.getSeverityText()); + msgText.setText(entry.getMessage()); + String stack = entry.getStack(); + if (stack != null) { + stackTraceText.setText(stack); + } else { + stackTraceText.setText(PHPDebugCorePlugin.getResourceString(EVENT_NO_STACK)); + } + LogSession session = entry.getSession(); + if (session != null && session.getSessionData() != null) + sessionDataText.setText(session.getSessionData()); + + updateButtons(); + } + + private void updateButtons(){ + boolean isAtEnd = elementNum == totalElementCount - 1; + if (isChild(entry)){ + backButton.setEnabled(true); + boolean isLastChild = childIndex == entryChildren.length-1; + nextButton.setEnabled(!isLastChild || !isAtEnd || entry.hasChildren()); + } else { + backButton.setEnabled(elementNum != 0); + nextButton.setEnabled(!isAtEnd || entry.hasChildren()); + } + } + + private void setEntryChildren(LogEntry parent){ + Object[] children = parent.getChildren(parent); + if (comparator != null) + Arrays.sort(children, comparator); + entryChildren = new LogEntry[children.length]; + + System.arraycopy(children,0,entryChildren,0,children.length); + } + + private int getParentElementNum(){ + LogEntry itemEntry = (LogEntry)((IStructuredSelection)provider.getSelection()).getFirstElement(); + itemEntry = getRootEntry(itemEntry); + + for (int i = 0; i 0; + } + public String toString() { + return getSeverityText(); + } + /** + * @see IWorkbenchAdapter#getChildren(Object) + */ + public Object[] getChildren(Object parent) { + if (children == null) + return new Object[0]; + return children.toArray(); + } + + /** + * @see IWorkbenchAdapter#getImageDescriptor(Object) + */ + public ImageDescriptor getImageDescriptor(Object arg0) { + return null; + } + + /** + * @see IWorkbenchAdapter#getLabel(Object) + */ + public String getLabel(Object obj) { + return getSeverityText(); + } + + /** + * @see IWorkbenchAdapter#getParent(Object) + */ + public Object getParent(Object obj) { + return parent; + } + + void setParent(LogEntry parent) { + this.parent = parent; + } + + private String getSeverityText(int severity) { + switch (severity) { + case IStatus.ERROR : + return PHPDebugCorePlugin.getResourceString(KEY_ERROR); + case IStatus.WARNING : + return PHPDebugCorePlugin.getResourceString(KEY_WARNING); + case IStatus.INFO : + return PHPDebugCorePlugin.getResourceString(KEY_INFO); + } + return "?"; //$NON-NLS-1$ + } + + int processLogLine(String line, boolean root) { + //!ENTRY + //!SUBENTRY + StringTokenizer stok = new StringTokenizer(line, " ", true); //$NON-NLS-1$ + StringBuffer dateBuffer = new StringBuffer(); + + int dateCount = 5; + int depth = 0; + for (int i = 0; stok.hasMoreTokens();) { + String token = stok.nextToken(); + if (i >= dateCount) { + dateBuffer.append(token); + continue; + } else if (token.equals(" ")) //$NON-NLS-1$ + continue; + switch (i) { + case 0 : // entry or subentry + if (root) + i += 2; + else + i++; + break; + case 1 : // depth + depth = parseInteger(token); + i++; + break; + case 2 : + pluginId = token; + i++; + break; + case 3 : // severity + severity = parseInteger(token); + i++; + break; + case 4 : // code + code = parseInteger(token); + i++; + break; + } + } + date = dateBuffer.toString().trim(); + return depth; + } + + private int parseInteger(String token) { + try { + return Integer.parseInt(token); + } catch (NumberFormatException e) { + return 0; + } + } + + void setStack(String stack) { + this.stack = stack; + } + void setMessage(String message) { + this.message = message; + } + + private void processStatus(IStatus status) { + pluginId = status.getPlugin(); + severity = status.getSeverity(); + code = status.getCode(); + DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$ + date = formatter.format(new Date()); + message = status.getMessage(); + Throwable throwable = status.getException(); + if (throwable != null) { + StringWriter swriter = new StringWriter(); + PrintWriter pwriter = new PrintWriter(swriter); + throwable.printStackTrace(pwriter); + pwriter.flush(); + pwriter.close(); + stack = swriter.toString(); + } + IStatus[] schildren = status.getChildren(); + if (schildren.length > 0) { + children = new ArrayList(); + for (int i = 0; i < schildren.length; i++) { + LogEntry child = new LogEntry(schildren[i]); + addChild(child); + } + } + } + void addChild(LogEntry child) { + if (children == null) + children = new ArrayList(); + children.add(child); + child.setParent(this); + } + public void write(PrintWriter writer) { + writer.print(getSeverityText()); + if (date != null) { + writer.print(" "); //$NON-NLS-1$ + writer.print(getDate()); + } + if (message != null) { + writer.print(" "); //$NON-NLS-1$ + writer.print(getMessage()); + } + writer.println(); + if (stack != null) + writer.println(stack); + } +} diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogReader.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogReader.java new file mode 100644 index 0000000..b5f5405 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogReader.java @@ -0,0 +1,308 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.core.logview; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.RandomAccessFile; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Date; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.ui.IMemento; + +class LogReader { + private static final int SESSION_STATE = 10; + public static final long MAX_FILE_LENGTH = 1024*1024; + private static final int ENTRY_STATE = 20; + private static final int SUBENTRY_STATE = 30; + private static final int MESSAGE_STATE = 40; + private static final int STACK_STATE = 50; + private static final int TEXT_STATE = 60; + private static final int UNKNOWN_STATE = 70; + + private static LogSession currentSession; + + public static void parseLargeFile(File file, ArrayList entries, IMemento memento) { + ArrayList parents = new ArrayList(); + LogEntry current = null; + LogSession session = null; + int writerState = UNKNOWN_STATE; + StringWriter swriter = null; + PrintWriter writer = null; + int state = UNKNOWN_STATE; + currentSession = null; + RandomAccessFile random = null; + try { + random = new RandomAccessFile(file, "r"); //$NON-NLS-1$ + random.seek(file.length() - MAX_FILE_LENGTH); + for (;;) { + String line = random.readLine(); + if (line == null) + break; + + line = line.trim(); + if (line.length() == 0) + continue; + + if (line.startsWith("!SESSION")) { //$NON-NLS-1$ + state = SESSION_STATE; + } else if (line.startsWith("!ENTRY")) { //$NON-NLS-1$ + state = ENTRY_STATE; + } else if (line.startsWith("!SUBENTRY")) { //$NON-NLS-1$ + state = SUBENTRY_STATE; + } else if (line.startsWith("!MESSAGE")) { //$NON-NLS-1$ + state = MESSAGE_STATE; + } else if (line.startsWith("!STACK")) { //$NON-NLS-1$ + state = STACK_STATE; + } else + state = TEXT_STATE; + + if (state == TEXT_STATE) { + if (writer != null) + writer.println(line); + continue; + } + + if (writer != null) { + if (writerState == STACK_STATE && current != null) { + current.setStack(swriter.toString()); + } else if (writerState == SESSION_STATE && session != null) { + session.setSessionData(swriter.toString()); + } else if (writerState == MESSAGE_STATE && current != null){ + String message = current.getMessage() + swriter.toString(); + message = message.trim(); + current.setMessage(message); + } + writerState = UNKNOWN_STATE; + swriter = null; + writer.close(); + writer = null; + } + + if (state == STACK_STATE) { + swriter = new StringWriter(); + writer = new PrintWriter(swriter, true); + writerState = STACK_STATE; + } else if (state == SESSION_STATE) { + session = new LogSession(); + session.processLogLine(line); + swriter = new StringWriter(); + writer = new PrintWriter(swriter, true); + writerState = SESSION_STATE; + updateCurrentSession(session); + if (currentSession.equals(session) && !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")) //$NON-NLS-1$ + entries.clear(); + } else if (state == ENTRY_STATE) { + LogEntry entry = new LogEntry(); + entry.setSession(session); + entry.processLogLine(line, true); + setNewParent(parents, entry, 0); + current = entry; + addEntry(current, entries, memento, false); + } else if (state == SUBENTRY_STATE) { + LogEntry entry = new LogEntry(); + entry.setSession(session); + int depth = entry.processLogLine(line, false); + setNewParent(parents, entry, depth); + current = entry; + LogEntry parent = (LogEntry) parents.get(depth - 1); + parent.addChild(entry); + } else if (state == MESSAGE_STATE) { + swriter = new StringWriter(); + writer = new PrintWriter(swriter, true); + String message = ""; //$NON-NLS-1$ + if (line.length() > 8) + message = line.substring(9).trim(); + message = message.trim(); + if (current != null) + current.setMessage(message); + writerState = MESSAGE_STATE; + } + } + } catch (FileNotFoundException e) { + } catch (IOException e) { + } finally { + try { + if (random != null) + random.close(); + } catch (IOException e1) { + } + } + } + + public static void parseLogFile(File file, ArrayList entries, IMemento memento) { + ArrayList parents = new ArrayList(); + LogEntry current = null; + LogSession session = null; + int writerState = UNKNOWN_STATE; + StringWriter swriter = null; + PrintWriter writer = null; + int state = UNKNOWN_STATE; + currentSession = null; + BufferedReader reader = null; + try { + + reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); //$NON-NLS-1$ + while(reader.ready()) { + String line = reader.readLine(); + if (line == null) + continue; + line = line.trim(); + if (line.length() == 0) + continue; + + if (line.startsWith("!SESSION")) { //$NON-NLS-1$ + state = SESSION_STATE; + } else if (line.startsWith("!ENTRY")) { //$NON-NLS-1$ + state = ENTRY_STATE; + } else if (line.startsWith("!SUBENTRY")) { //$NON-NLS-1$ + state = SUBENTRY_STATE; + } else if (line.startsWith("!MESSAGE")) { //$NON-NLS-1$ + state = MESSAGE_STATE; + } else if (line.startsWith("!STACK")) { //$NON-NLS-1$ + state = STACK_STATE; + } else + state = TEXT_STATE; + + if (state == TEXT_STATE) { + if (writer != null) + writer.println(line); + continue; + } + + if (writer != null) { + if (writerState == STACK_STATE && current != null) { + current.setStack(swriter.toString()); + } else if (writerState == SESSION_STATE && session != null) { + session.setSessionData(swriter.toString()); + } else if (writerState == MESSAGE_STATE && current != null){ + String message = current.getMessage() + swriter.toString(); + message = message.trim(); + current.setMessage(message); + } + writerState = UNKNOWN_STATE; + swriter = null; + writer.close(); + writer = null; + } + + if (state == STACK_STATE) { + swriter = new StringWriter(); + writer = new PrintWriter(swriter, true); + writerState = STACK_STATE; + } else if (state == SESSION_STATE) { + session = new LogSession(); + session.processLogLine(line); + swriter = new StringWriter(); + writer = new PrintWriter(swriter, true); + writerState = SESSION_STATE; + updateCurrentSession(session); + if (currentSession.equals(session) && !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")) //$NON-NLS-1$ + entries.clear(); + } else if (state == ENTRY_STATE) { + LogEntry entry = new LogEntry(); + entry.setSession(session); + entry.processLogLine(line, true); + setNewParent(parents, entry, 0); + current = entry; + addEntry(current, entries, memento, false); + } else if (state == SUBENTRY_STATE) { + LogEntry entry = new LogEntry(); + entry.setSession(session); + int depth = entry.processLogLine(line, false); + setNewParent(parents, entry, depth); + current = entry; + LogEntry parent = (LogEntry) parents.get(depth - 1); + parent.addChild(entry); + } else if (state == MESSAGE_STATE) { + swriter = new StringWriter(); + writer = new PrintWriter(swriter, true); + String message = ""; //$NON-NLS-1$ + if (line.length() > 8) + message = line.substring(9).trim(); + message = message.trim(); + if (current != null) + current.setMessage(message); + writerState = MESSAGE_STATE; + } + } + } catch (FileNotFoundException e) { + } catch (IOException e) { + } finally { + try { + if (reader != null) + reader.close(); + } catch (IOException e1) { + } + } + } + + private static void updateCurrentSession(LogSession session) { + if (currentSession == null) { + currentSession = session; + return; + } + Date currentDate = currentSession.getDate(); + Date sessionDate = session.getDate(); + if (currentDate == null && sessionDate != null) + currentSession = session; + else if (currentDate != null && sessionDate == null) + currentSession = session; + else if (currentDate != null && sessionDate != null && sessionDate.after(currentDate)) + currentSession = session; + } + + public static void addEntry(LogEntry current, ArrayList entries, IMemento memento, boolean useCurrentSession) { + int severity = current.getSeverity(); + boolean doAdd = true; + switch(severity) { + case IStatus.INFO: + doAdd = memento.getString(LogView.P_LOG_INFO).equals("true"); //$NON-NLS-1$ + break; + case IStatus.WARNING: + doAdd = memento.getString(LogView.P_LOG_WARNING).equals("true"); //$NON-NLS-1$ + break; + case IStatus.ERROR: + doAdd = memento.getString(LogView.P_LOG_ERROR).equals("true"); //$NON-NLS-1$ + break; + } + if (doAdd) { + if (useCurrentSession) + current.setSession(currentSession); + entries.add(0, current); + + if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$ + && entries.size() > memento.getInteger(LogView.P_LOG_LIMIT).intValue()) + entries.remove(entries.size() - 1); + } + } + + private static void setNewParent( + ArrayList parents, + LogEntry entry, + int depth) { + if (depth + 1 > parents.size()) + parents.add(entry); + else + parents.set(depth, entry); + } + + public static void reset() { + currentSession = null; + } +} diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogSession.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogSession.java new file mode 100644 index 0000000..43b2dc5 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogSession.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.core.logview; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.StringTokenizer; + +public class LogSession { + private String sessionData; + private Date date; + + /** + * Constructor for LogSession. + */ + public LogSession() { + } + + public Date getDate() { + return date; + } + + public void setDate(String dateString) { + SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$ + try { + date = formatter.parse(dateString); + } catch (ParseException e) { + } + } + + public String getSessionData() { + return sessionData; + } + + void setSessionData(String data) { + this.sessionData = data; + } + + public void processLogLine(String line) { + StringTokenizer tokenizer = new StringTokenizer(line); + if (tokenizer.countTokens() == 6) { + tokenizer.nextToken(); + StringBuffer dateBuffer = new StringBuffer(); + for (int i = 0; i < 4; i++) { + dateBuffer.append(tokenizer.nextToken()); + dateBuffer.append(" "); //$NON-NLS-1$ + } + setDate(dateBuffer.toString().trim()); + } + } +} diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogView.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogView.java new file mode 100644 index 0000000..c31a2f4 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogView.java @@ -0,0 +1,992 @@ +/*********************************************************************************************************************************** + * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made + * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + **********************************************************************************************************************************/ + +package net.sourceforge.phpdt.internal.debug.core.logview; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.text.Collator; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; + +import net.sourceforge.phpdt.internal.debug.core.PHPDegugCorePluginImages; +import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; + +import org.eclipse.core.runtime.ILogListener; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ColumnPixelData; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeViewerListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableTreeViewer; +import org.eclipse.jface.viewers.TreeExpansionEvent; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.custom.TableTree; +import org.eclipse.swt.custom.TableTreeItem; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.XMLMemento; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.part.ViewPart; + +public class LogView extends ViewPart implements ILogListener { + public final static String ID_LOGVIEW = "net.sourceforge.phpdt.internal.debug.core.logview.LogView"; + + private TableTreeViewer tableTreeViewer; + + private ArrayList logs = new ArrayList(); + + public static final String P_LOG_WARNING = "warning"; //$NON-NLS-1$ + + public static final String P_LOG_ERROR = "error"; //$NON-NLS-1$ + + public static final String P_LOG_INFO = "info"; //$NON-NLS-1$ + + public static final String P_LOG_LIMIT = "limit"; //$NON-NLS-1$ + + public static final String P_USE_LIMIT = "useLimit"; //$NON-NLS-1$ + + public static final String P_SHOW_ALL_SESSIONS = "allSessions"; //$NON-NLS-1$ + + private static final String P_COLUMN_1 = "column1"; //$NON-NLS-1$ + + private static final String P_COLUMN_2 = "column2"; //$NON-NLS-1$ + + private static final String P_COLUMN_3 = "column3"; //$NON-NLS-1$ + + private static final String P_COLUMN_4 = "column4"; //$NON-NLS-1$ + + public static final String P_ACTIVATE = "activate"; //$NON-NLS-1$ + + private int MESSAGE_ORDER = -1; + + private int PLUGIN_ORDER = -1; + + private int DATE_ORDER = -1; + + public static byte MESSAGE = 0x0; + + public static byte PLUGIN = 0x1; + + public static byte DATE = 0x2; + + private static int ASCENDING = 1; + + private static int DESCENDING = -1; + + private Action clearAction; + + private Action copyAction; + + private Action readLogAction; + + private Action deleteLogAction; + + private Action exportAction; + + private Action importAction; + + private Action activateViewAction; + + private Action propertiesAction; + + private Action viewLogAction; + + private Action filterAction; + + private Clipboard clipboard; + + private IMemento memento; + + private File inputFile; + + private String directory; + + private TableColumn column0; + + private TableColumn column1; + + private TableColumn column2; + + private TableColumn column3; + + private TableColumn column4; + + private static Font boldFont; + + private Comparator comparator; + + private Collator collator; + + // hover text + private boolean canOpenTextShell; + + private Text textLabel; + + private Shell textShell; + + private boolean firstEvent = true; + + public LogView() { + logs = new ArrayList(); + inputFile = Platform.getLogFileLocation().toFile(); + } + + public void createPartControl(Composite parent) { + readLogFile(); + TableTree tableTree = new TableTree(parent, SWT.FULL_SELECTION); + tableTree.setLayoutData(new GridData(GridData.FILL_BOTH)); + createColumns(tableTree.getTable()); + createViewer(tableTree); + createPopupMenuManager(tableTree); + makeActions(tableTree.getTable()); + fillToolBar(); + Platform.addLogListener(this); + getSite().setSelectionProvider(tableTreeViewer); + clipboard = new Clipboard(tableTree.getDisplay()); + // WorkbenchHelp.setHelp(tableTree, IHelpContextIds.LOG_VIEW); + tableTreeViewer.getTableTree().getTable().setToolTipText(""); //$NON-NLS-1$ + initializeFonts(); + applyFonts(); + } + + private void initializeFonts() { + Font tableFont = tableTreeViewer.getTableTree().getFont(); + FontData[] fontDataList = tableFont.getFontData(); + FontData fontData; + if (fontDataList.length > 0) + fontData = fontDataList[0]; + else + fontData = new FontData(); + fontData.setStyle(SWT.BOLD); + boldFont = new Font(tableTreeViewer.getTableTree().getDisplay(), fontData); + } + + /* + * Set all rows where the tableTreeItem has children to have a bold font. + */ + private void applyFonts() { + if (tableTreeViewer == null || tableTreeViewer.getTableTree().isDisposed()) + return; + int max = tableTreeViewer.getTableTree().getItemCount(); + int index = 0, tableIndex = 0; + while (index < max) { + LogEntry entry = (LogEntry) tableTreeViewer.getElementAt(index); + if (entry == null) + return; + if (entry.hasChildren()) { + tableTreeViewer.getTableTree().getItems()[index].setFont(boldFont); + tableIndex = applyChildFonts(entry, tableIndex); + } else { + tableTreeViewer.getTableTree().getItems()[index].setFont(tableTreeViewer.getTableTree().getFont()); + } + index++; + tableIndex++; + } + } + + private int applyChildFonts(LogEntry parent, int index) { + if (!tableTreeViewer.getExpandedState(parent) || !parent.hasChildren()) + return index; + LogEntry[] children = getEntryChildren(parent); + for (int i = 0; i < children.length; i++) { + index++; + if (children[i].hasChildren()) { + TableItem tableItem = getTableItem(index); + if (tableItem != null) { + tableItem.setFont(boldFont); + } + index = applyChildFonts(children[i], index); + } else { + TableItem tableItem = getTableItem(index); + if (tableItem != null) { + tableItem.setFont(tableTreeViewer.getTableTree().getFont()); + } + } + } + return index; + } + + private LogEntry[] getEntryChildren(LogEntry parent) { + Object[] entryChildren = parent.getChildren(parent); + if (comparator != null) + Arrays.sort(entryChildren, comparator); + LogEntry[] children = new LogEntry[entryChildren.length]; + System.arraycopy(entryChildren, 0, children, 0, entryChildren.length); + return children; + } + + private TableItem getTableItem(int index) { + TableItem[] tableItems = tableTreeViewer.getTableTree().getTable().getItems(); + if (index > tableItems.length - 1) + return null; + return tableItems[index]; + } + + private void fillToolBar() { + IActionBars bars = getViewSite().getActionBars(); + bars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); + IToolBarManager toolBarManager = bars.getToolBarManager(); + toolBarManager.add(exportAction); + toolBarManager.add(importAction); + toolBarManager.add(new Separator()); + toolBarManager.add(clearAction); + toolBarManager.add(deleteLogAction); + toolBarManager.add(viewLogAction); + toolBarManager.add(readLogAction); + toolBarManager.add(new Separator()); + IMenuManager mgr = bars.getMenuManager(); + mgr.add(filterAction); + mgr.add(new Separator()); + mgr.add(activateViewAction); + } + + private void createViewer(TableTree tableTree) { + tableTreeViewer = new TableTreeViewer(tableTree); + tableTreeViewer.setContentProvider(new LogViewContentProvider(this)); + tableTreeViewer.setLabelProvider(new LogViewLabelProvider()); + tableTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent e) { + handleSelectionChanged(e.getSelection()); + if (propertiesAction.isEnabled()) + ((EventDetailsDialogAction) propertiesAction).resetSelection(); + } + }); + tableTreeViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + ((EventDetailsDialogAction) propertiesAction).setComparator(comparator); + propertiesAction.run(); + } + }); + tableTreeViewer.addTreeListener(new ITreeViewerListener() { + public void treeCollapsed(TreeExpansionEvent event) { + applyFonts(); + } + + public void treeExpanded(TreeExpansionEvent event) { + applyFonts(); + } + }); + addMouseListeners(); + tableTreeViewer.setInput(Platform.class); + } + + private void createPopupMenuManager(TableTree tableTree) { + MenuManager popupMenuManager = new MenuManager(); + IMenuListener listener = new IMenuListener() { + public void menuAboutToShow(IMenuManager mng) { + fillContextMenu(mng); + } + }; + popupMenuManager.addMenuListener(listener); + popupMenuManager.setRemoveAllWhenShown(true); + Menu menu = popupMenuManager.createContextMenu(tableTree); + tableTree.setMenu(menu); + } + + private void createColumns(Table table) { + column0 = new TableColumn(table, SWT.NULL); + column0.setText(""); //$NON-NLS-1$ + column1 = new TableColumn(table, SWT.NULL); + column1.setText(PHPDebugCorePlugin.getResourceString("LogView.column.severity")); //$NON-NLS-1$ + column2 = new TableColumn(table, SWT.NULL); + column2.setText(PHPDebugCorePlugin.getResourceString("LogView.column.message")); //$NON-NLS-1$ + column2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + MESSAGE_ORDER *= -1; + ViewerSorter sorter = getViewerSorter(MESSAGE); + tableTreeViewer.setSorter(sorter); + collator = sorter.getCollator(); + boolean isComparatorSet = ((EventDetailsDialogAction) propertiesAction).resetSelection(MESSAGE, MESSAGE_ORDER); + setComparator(MESSAGE); + if (!isComparatorSet) + ((EventDetailsDialogAction) propertiesAction).setComparator(comparator); + applyFonts(); + } + }); + column3 = new TableColumn(table, SWT.NULL); + column3.setText(PHPDebugCorePlugin.getResourceString("LogView.column.plugin")); //$NON-NLS-1$ + column3.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PLUGIN_ORDER *= -1; + ViewerSorter sorter = getViewerSorter(PLUGIN); + tableTreeViewer.setSorter(sorter); + collator = sorter.getCollator(); + boolean isComparatorSet = ((EventDetailsDialogAction) propertiesAction).resetSelection(PLUGIN, PLUGIN_ORDER); + setComparator(PLUGIN); + if (!isComparatorSet) + ((EventDetailsDialogAction) propertiesAction).setComparator(comparator); + applyFonts(); + } + }); + column4 = new TableColumn(table, SWT.NULL); + column4.setText(PHPDebugCorePlugin.getResourceString("LogView.column.date")); //$NON-NLS-1$ + column4.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (DATE_ORDER == ASCENDING) { + DATE_ORDER = DESCENDING; + } else { + DATE_ORDER = ASCENDING; + } + ViewerSorter sorter = getViewerSorter(DATE); + tableTreeViewer.setSorter(sorter); + collator = sorter.getCollator(); + boolean isComparatorSet = ((EventDetailsDialogAction) propertiesAction).resetSelection(DATE, DATE_ORDER); + setComparator(DATE); + if (!isComparatorSet) + ((EventDetailsDialogAction) propertiesAction).setComparator(comparator); + applyFonts(); + } + }); + TableLayout tlayout = new TableLayout(); + tlayout.addColumnData(new ColumnPixelData(21)); + tlayout.addColumnData(new ColumnPixelData(memento.getInteger(P_COLUMN_1).intValue())); + tlayout.addColumnData(new ColumnPixelData(memento.getInteger(P_COLUMN_2).intValue())); + tlayout.addColumnData(new ColumnPixelData(memento.getInteger(P_COLUMN_3).intValue())); + tlayout.addColumnData(new ColumnPixelData(memento.getInteger(P_COLUMN_4).intValue())); + table.setLayout(tlayout); + table.setHeaderVisible(true); + } + + private void makeActions(Table table) { + propertiesAction = new EventDetailsDialogAction(table.getShell(), tableTreeViewer); + propertiesAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_PROPERTIES); + propertiesAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_PROPERTIES_DISABLED); + propertiesAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.properties.tooltip")); //$NON-NLS-1$ + propertiesAction.setEnabled(false); + clearAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.clear")) { //$NON-NLS-1$ + public void run() { + handleClear(); + } + }; + clearAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_CLEAR); + clearAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_CLEAR_DISABLED); + clearAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.clear.tooltip")); //$NON-NLS-1$ + clearAction.setText(PHPDebugCorePlugin.getResourceString("LogView.clear")); //$NON-NLS-1$ + readLogAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.readLog.restore")) { //$NON-NLS-1$ + public void run() { + inputFile = Platform.getLogFileLocation().toFile(); + reloadLog(); + } + }; + readLogAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.readLog.restore.tooltip")); //$NON-NLS-1$ + readLogAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_READ_LOG); + readLogAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_READ_LOG_DISABLED); + deleteLogAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.delete")) { //$NON-NLS-1$ + public void run() { + doDeleteLog(); + } + }; + deleteLogAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.delete.tooltip")); //$NON-NLS-1$ + deleteLogAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_REMOVE_LOG); + deleteLogAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_REMOVE_LOG_DISABLED); + deleteLogAction.setEnabled(inputFile.exists() && inputFile.equals(Platform.getLogFileLocation().toFile())); + copyAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.copy")) { //$NON-NLS-1$ + public void run() { + copyToClipboard(tableTreeViewer.getSelection()); + } + }; + copyAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); + filterAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.filter")) { //$NON-NLS-1$ + public void run() { + handleFilter(); + } + }; + filterAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.filter")); //$NON-NLS-1$ + filterAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_FILTER); + filterAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_FILTER_DISABLED); + exportAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.export")) { //$NON-NLS-1$ + public void run() { + handleExport(); + } + }; + exportAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.export.tooltip")); //$NON-NLS-1$ + exportAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_EXPORT); + exportAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_EXPORT_DISABLED); + importAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.import")) { //$NON-NLS-1$ + public void run() { + handleImport(); + } + }; + importAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.import.tooltip")); //$NON-NLS-1$ + importAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_IMPORT); + importAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_IMPORT_DISABLED); + activateViewAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.activate")) { //$NON-NLS-1$ + public void run() { + } + }; + activateViewAction.setChecked(memento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$ + viewLogAction = new Action(PHPDebugCorePlugin.getResourceString("LogView.view.currentLog")) { //$NON-NLS-1$ + public void run() { + if (inputFile.exists()) { + if (inputFile.length() > LogReader.MAX_FILE_LENGTH) { + OpenLogDialog openDialog = new OpenLogDialog(getViewSite().getShell(), inputFile); + openDialog.create(); + openDialog.open(); + } else { + boolean canLaunch = Program.launch(inputFile.getAbsolutePath()); + if (!canLaunch) { + Program p = Program.findProgram(".txt"); //$NON-NLS-1$ + if (p != null) + p.execute(inputFile.getAbsolutePath()); + else { + OpenLogDialog openDialog = new OpenLogDialog(getViewSite().getShell(), inputFile); + openDialog.create(); + openDialog.open(); + } + } + } + } + } + }; + viewLogAction.setImageDescriptor(PHPDegugCorePluginImages.DESC_OPEN_LOG); + viewLogAction.setDisabledImageDescriptor(PHPDegugCorePluginImages.DESC_OPEN_LOG_DISABLED); + viewLogAction.setEnabled(inputFile.exists()); + viewLogAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.view.currentLog.tooltip")); //$NON-NLS-1$ + } + + public void dispose() { + Platform.removeLogListener(this); + clipboard.dispose(); + LogReader.reset(); + boldFont.dispose(); + super.dispose(); + } + + private void handleImport() { + FileDialog dialog = new FileDialog(getViewSite().getShell()); + dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$ + if (directory != null) + dialog.setFilterPath(directory); + String path = dialog.open(); + if (path != null && new Path(path).toFile().exists()) { + inputFile = new Path(path).toFile(); + directory = inputFile.getParent(); + IRunnableWithProgress op = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(PHPDebugCorePlugin.getResourceString("LogView.operation.importing"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ + readLogFile(); + } + }; + ProgressMonitorDialog pmd = new ProgressMonitorDialog(getViewSite().getShell()); + try { + pmd.run(true, true, op); + } catch (InvocationTargetException e) { + } catch (InterruptedException e) { + } finally { + readLogAction.setText(PHPDebugCorePlugin.getResourceString("LogView.readLog.reload")); //$NON-NLS-1$ + readLogAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.readLog.reload")); //$NON-NLS-1$ + asyncRefresh(false); + resetDialogButtons(); + } + } + } + + private void handleExport() { + FileDialog dialog = new FileDialog(getViewSite().getShell(), SWT.SAVE); + dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$ + if (directory != null) + dialog.setFilterPath(directory); + String path = dialog.open(); + if (path != null) { + if (!path.endsWith(".log")) //$NON-NLS-1$ + path += ".log"; //$NON-NLS-1$ + File outputFile = new Path(path).toFile(); + directory = outputFile.getParent(); + if (outputFile.exists()) { + String message = PHPDebugCorePlugin.getFormattedMessage("LogView.confirmOverwrite.message", //$NON-NLS-1$ + outputFile.toString()); + if (!MessageDialog.openQuestion(getViewSite().getShell(), exportAction.getText(), message)) + return; + } + copy(inputFile, outputFile); + } + } + + private void copy(File inputFile, File outputFile) { + BufferedReader reader = null; + BufferedWriter writer = null; + try { + reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), "UTF-8")); //$NON-NLS-1$ + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8")); //$NON-NLS-1$ + while (reader.ready()) { + writer.write(reader.readLine()); + writer.write(System.getProperty("line.separator")); //$NON-NLS-1$ + } + } catch (IOException e) { + } finally { + try { + if (reader != null) + reader.close(); + if (writer != null) + writer.close(); + } catch (IOException e1) { + } + } + } + + private void handleFilter() { + FilterDialog dialog = new FilterDialog(PHPDebugCorePlugin.getActiveWorkbenchShell(), memento); + dialog.create(); + dialog.getShell().setText(PHPDebugCorePlugin.getResourceString("LogView.FilterDialog.title")); //$NON-NLS-1$ + if (dialog.open() == FilterDialog.OK) + reloadLog(); + } + + private void doDeleteLog() { + String title = PHPDebugCorePlugin.getResourceString("LogView.confirmDelete.title"); //$NON-NLS-1$ + String message = PHPDebugCorePlugin.getResourceString("LogView.confirmDelete.message"); //$NON-NLS-1$ + if (!MessageDialog.openConfirm(tableTreeViewer.getControl().getShell(), title, message)) + return; + if (inputFile.delete()) { + logs.clear(); + asyncRefresh(false); + resetDialogButtons(); + } + } + + public void fillContextMenu(IMenuManager manager) { + manager.add(copyAction); + manager.add(new Separator()); + manager.add(clearAction); + manager.add(deleteLogAction); + manager.add(viewLogAction); + manager.add(readLogAction); + manager.add(new Separator()); + manager.add(exportAction); + manager.add(importAction); + manager.add(new Separator()); + ((EventDetailsDialogAction) propertiesAction).setComparator(comparator); + manager.add(propertiesAction); + } + + public LogEntry[] getLogs() { + return (LogEntry[]) logs.toArray(new LogEntry[logs.size()]); + } + + protected void handleClear() { + BusyIndicator.showWhile(tableTreeViewer.getControl().getDisplay(), new Runnable() { + public void run() { + logs.clear(); + asyncRefresh(false); + resetDialogButtons(); + } + }); + } + + protected void reloadLog() { + IRunnableWithProgress op = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(PHPDebugCorePlugin.getResourceString("LogView.operation.reloading"), //$NON-NLS-1$ + IProgressMonitor.UNKNOWN); + readLogFile(); + } + }; + ProgressMonitorDialog pmd = new ProgressMonitorDialog(getViewSite().getShell()); + try { + pmd.run(true, true, op); + } catch (InvocationTargetException e) { + } catch (InterruptedException e) { + } finally { + readLogAction.setText(PHPDebugCorePlugin.getResourceString("LogView.readLog.restore")); //$NON-NLS-1$ + readLogAction.setToolTipText(PHPDebugCorePlugin.getResourceString("LogView.readLog.restore")); //$NON-NLS-1$ + asyncRefresh(false); + resetDialogButtons(); + } + } + + private void readLogFile() { + logs.clear(); + if (!inputFile.exists()) + return; + if (inputFile.length() > LogReader.MAX_FILE_LENGTH) + LogReader.parseLargeFile(inputFile, logs, memento); + else + LogReader.parseLogFile(inputFile, logs, memento); + } + + public void logging(IStatus status, String plugin) { + if (!inputFile.equals(Platform.getLogFileLocation().toFile())) + return; + if (firstEvent) { + readLogFile(); + asyncRefresh(); + firstEvent = false; + } else { + pushStatus(status); + } + } + + private void pushStatus(IStatus status) { + LogEntry entry = new LogEntry(status); + LogReader.addEntry(entry, logs, memento, true); + asyncRefresh(); + } + + private void asyncRefresh() { + asyncRefresh(true); + } + + private void asyncRefresh(final boolean activate) { + final Control control = tableTreeViewer.getControl(); + if (control.isDisposed()) + return; + Display display = control.getDisplay(); + final ViewPart view = this; + if (display != null) { + display.asyncExec(new Runnable() { + public void run() { + if (!control.isDisposed()) { + tableTreeViewer.refresh(); + deleteLogAction.setEnabled(inputFile.exists() && inputFile.equals(Platform.getLogFileLocation().toFile())); + viewLogAction.setEnabled(inputFile.exists()); + if (activate && activateViewAction.isChecked()) { + IWorkbenchPage page = PHPDebugCorePlugin.getActivePage(); + if (page != null) + page.bringToTop(view); + } + } + applyFonts(); + } + }); + } + } + + public void setFocus() { + if (tableTreeViewer != null && !tableTreeViewer.getTableTree().isDisposed()) + tableTreeViewer.getTableTree().getTable().setFocus(); + } + + private void handleSelectionChanged(ISelection selection) { + updateStatus(selection); + copyAction.setEnabled(!selection.isEmpty()); + propertiesAction.setEnabled(!selection.isEmpty()); + } + + private void updateStatus(ISelection selection) { + IStatusLineManager status = getViewSite().getActionBars().getStatusLineManager(); + if (selection.isEmpty()) + status.setMessage(null); + else { + LogEntry entry = (LogEntry) ((IStructuredSelection) selection).getFirstElement(); + status.setMessage(((LogViewLabelProvider) tableTreeViewer.getLabelProvider()).getColumnText(entry, 2)); + } + } + + private void copyToClipboard(ISelection selection) { + StringWriter writer = new StringWriter(); + PrintWriter pwriter = new PrintWriter(writer); + if (selection.isEmpty()) + return; + LogEntry entry = (LogEntry) ((IStructuredSelection) selection).getFirstElement(); + entry.write(pwriter); + pwriter.flush(); + String textVersion = writer.toString(); + try { + pwriter.close(); + writer.close(); + } catch (IOException e) { + } + if (textVersion.trim().length() > 0) { + // set the clipboard contents + clipboard.setContents(new Object[] { textVersion }, new Transfer[] { TextTransfer.getInstance() }); + } + } + + public void init(IViewSite site, IMemento memento) throws PartInitException { + super.init(site, memento); + if (memento == null) + this.memento = XMLMemento.createWriteRoot("LOGVIEW"); //$NON-NLS-1$ + else + this.memento = memento; + initializeMemento(); + } + + private void initializeMemento() { + if (memento.getString(P_USE_LIMIT) == null) + memento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$ + if (memento.getInteger(P_LOG_LIMIT) == null) + memento.putInteger(P_LOG_LIMIT, 50); + if (memento.getString(P_LOG_INFO) == null) + memento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$ + if (memento.getString(P_LOG_WARNING) == null) + memento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$ + if (memento.getString(P_LOG_ERROR) == null) + memento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$ + if (memento.getString(P_SHOW_ALL_SESSIONS) == null) + memento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$ + Integer width = memento.getInteger(P_COLUMN_1); + if (width == null || width.intValue() == 0) + memento.putInteger(P_COLUMN_1, 20); + width = memento.getInteger(P_COLUMN_2); + if (width == null || width.intValue() == 0) + memento.putInteger(P_COLUMN_2, 300); + width = memento.getInteger(P_COLUMN_3); + if (width == null || width.intValue() == 0) + memento.putInteger(P_COLUMN_3, 150); + width = memento.getInteger(P_COLUMN_4); + if (width == null || width.intValue() == 0) + memento.putInteger(P_COLUMN_4, 150); + if (memento.getString(P_ACTIVATE) == null) + memento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$ + } + + public void saveState(IMemento memento) { + if (this.memento == null || memento == null) + return; + this.memento.putInteger(P_COLUMN_1, column1.getWidth()); + this.memento.putInteger(P_COLUMN_2, column2.getWidth()); + this.memento.putInteger(P_COLUMN_3, column3.getWidth()); + this.memento.putInteger(P_COLUMN_4, column4.getWidth()); + this.memento.putString(P_ACTIVATE, activateViewAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ + memento.putMemento(this.memento); + } + + private void addMouseListeners() { + Listener tableListener = new Listener() { + public void handleEvent(Event e) { + switch (e.type) { + case SWT.MouseMove: + onMouseMove(e); + break; + case SWT.MouseHover: + onMouseHover(e); + break; + case SWT.MouseDown: + onMouseDown(e); + break; + } + } + }; + int[] tableEvents = new int[] { SWT.MouseDown, SWT.MouseMove, SWT.MouseHover }; + for (int i = 0; i < tableEvents.length; i++) { + tableTreeViewer.getTableTree().getTable().addListener(tableEvents[i], tableListener); + } + } + + private void makeHoverShell() { + Control control = tableTreeViewer.getControl(); + textShell = new Shell(control.getShell(), SWT.NO_FOCUS | SWT.ON_TOP); + Display display = textShell.getDisplay(); + textShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + GridLayout layout = new GridLayout(1, false); + int border = ((control.getShell().getStyle() & SWT.NO_TRIM) == 0) ? 0 : 1; + layout.marginHeight = border; + layout.marginWidth = border; + textShell.setLayout(layout); + textShell.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Composite shellComposite = new Composite(textShell, SWT.NONE); + layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + shellComposite.setLayout(layout); + shellComposite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING)); + textLabel = new Text(shellComposite, SWT.WRAP | SWT.MULTI); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.widthHint = 100; + gd.grabExcessHorizontalSpace = true; + textLabel.setLayoutData(gd); + Color c = control.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND); + textLabel.setBackground(c); + c = control.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND); + textLabel.setForeground(c); + textLabel.setEditable(false); + textShell.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + onTextShellDispose(e); + } + }); + } + + void onTextShellDispose(DisposeEvent e) { + canOpenTextShell = true; + setFocus(); + } + + void onMouseDown(Event e) { + if (textShell != null && !textShell.isDisposed() && !textShell.isFocusControl()) { + textShell.close(); + canOpenTextShell = true; + } + } + + void onMouseHover(Event e) { + if (!canOpenTextShell) + return; + canOpenTextShell = false; + Point point = new Point(e.x, e.y); + TableTree table = tableTreeViewer.getTableTree(); + TableTreeItem item = table.getItem(point); + if (item == null) + return; + String message = ((LogEntry) item.getData()).getStack(); + if (message == null) + return; + makeHoverShell(); + textLabel.setText(message); + int x = point.x + 5; + int y = point.y - (table.getItemHeight() * 2) - 20; + textShell.setLocation(table.toDisplay(x, y)); + textShell.setSize(tableTreeViewer.getTableTree().getSize().x - x, 125); + textShell.open(); + setFocus(); + } + + void onMouseMove(Event e) { + if (textShell != null && !textShell.isDisposed()) { + textShell.close(); + canOpenTextShell = textShell.isDisposed() && e.x > column0.getWidth() && e.x < (column0.getWidth() + column1.getWidth()); + } else { + canOpenTextShell = e.x > column0.getWidth() && e.x < (column0.getWidth() + column1.getWidth()); + } + } + + public Comparator getComparator() { + return comparator; + } + + private void setComparator(byte sortType) { + if (sortType == DATE) { + comparator = new Comparator() { + public int compare(Object e1, Object e2) { + try { + SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$ + Date date1 = formatter.parse(((LogEntry) e1).getDate()); + Date date2 = formatter.parse(((LogEntry) e2).getDate()); + if (DATE_ORDER == ASCENDING) + return date1.before(date2) ? -1 : 1; + return date1.after(date2) ? -1 : 1; + } catch (ParseException e) { + } + return 0; + } + }; + } else if (sortType == PLUGIN) { + comparator = new Comparator() { + public int compare(Object e1, Object e2) { + LogEntry entry1 = (LogEntry) e1; + LogEntry entry2 = (LogEntry) e2; + return collator.compare(entry1.getPluginId(), entry2.getPluginId()) * PLUGIN_ORDER; + } + }; + } else { + comparator = new Comparator() { + public int compare(Object e1, Object e2) { + LogEntry entry1 = (LogEntry) e1; + LogEntry entry2 = (LogEntry) e2; + return collator.compare(entry1.getMessage(), entry2.getMessage()) * MESSAGE_ORDER; + } + }; + } + } + + private ViewerSorter getViewerSorter(byte sortType) { + if (sortType == PLUGIN) { + return new ViewerSorter() { + public int compare(Viewer viewer, Object e1, Object e2) { + LogEntry entry1 = (LogEntry) e1; + LogEntry entry2 = (LogEntry) e2; + return super.compare(viewer, entry1.getPluginId(), entry2.getPluginId()) * PLUGIN_ORDER; + } + }; + } else if (sortType == MESSAGE) { + return new ViewerSorter() { + public int compare(Viewer viewer, Object e1, Object e2) { + LogEntry entry1 = (LogEntry) e1; + LogEntry entry2 = (LogEntry) e2; + return super.compare(viewer, entry1.getMessage(), entry2.getMessage()) * MESSAGE_ORDER; + } + }; + } else { + return new ViewerSorter() { + public int compare(Viewer viewer, Object e1, Object e2) { + try { + SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$ + Date date1 = formatter.parse(((LogEntry) e1).getDate()); + Date date2 = formatter.parse(((LogEntry) e2).getDate()); + if (DATE_ORDER == ASCENDING) + return date1.before(date2) ? -1 : 1; + return date1.after(date2) ? -1 : 1; + } catch (ParseException e) { + } + return 0; + } + }; + } + } + + private void resetDialogButtons() { + ((EventDetailsDialogAction) propertiesAction).resetDialogButtons(); + } +} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewContentProvider.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewContentProvider.java new file mode 100644 index 0000000..fc0e550 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewContentProvider.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.core.logview; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +public class LogViewContentProvider + implements ITreeContentProvider, IStructuredContentProvider { + private LogView logView; + + public LogViewContentProvider(LogView logView) { + this.logView = logView; + } + public void dispose() { + } + public Object[] getChildren(Object element) { + return ((LogEntry) element).getChildren(element); + } + public Object[] getElements(Object element) { + return logView.getLogs(); + } + public Object getParent(Object element) { + return ((LogEntry) element).getParent(element); + } + public boolean hasChildren(Object element) { + return ((LogEntry) element).hasChildren(); + } + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + public boolean isDeleted(Object element) { + return false; + } +} diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewLabelProvider.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewLabelProvider.java new file mode 100644 index 0000000..96d532d --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/LogViewLabelProvider.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.core.logview; + +import net.sourceforge.phpdt.internal.debug.core.PHPDegugCorePluginImages; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; + +public class LogViewLabelProvider + extends LabelProvider + implements ITableLabelProvider { + private Image infoImage; + private Image errorImage; + private Image warningImage; + private Image errorWithStackImage; + + public LogViewLabelProvider() { + errorImage = PHPDegugCorePluginImages.DESC_ERROR_ST_OBJ.createImage(); + warningImage = PHPDegugCorePluginImages.DESC_WARNING_ST_OBJ.createImage(); + infoImage = PHPDegugCorePluginImages.DESC_INFO_ST_OBJ.createImage(); + errorWithStackImage = PHPDegugCorePluginImages.DESC_ERROR_STACK_OBJ.createImage(); + } + public void dispose() { + errorImage.dispose(); + infoImage.dispose(); + warningImage.dispose(); + errorWithStackImage.dispose(); + super.dispose(); + } + public Image getColumnImage(Object element, int columnIndex) { + LogEntry entry = (LogEntry) element; + if (columnIndex == 1) { + switch (entry.getSeverity()) { + case IStatus.INFO : + return infoImage; + case IStatus.WARNING : + return warningImage; + case IStatus.ERROR : + return (entry.getStack() == null ? errorImage : errorWithStackImage); + } + } + return null; + } + + public String getColumnText(Object element, int columnIndex) { + LogEntry entry = (LogEntry) element; + switch (columnIndex) { + case 2 : + return entry.getMessage(); + case 3 : + return entry.getPluginId(); + case 4 : + return entry.getDate(); + } + return ""; //$NON-NLS-1$ + } +} diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/OpenLogDialog.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/OpenLogDialog.java new file mode 100644 index 0000000..ed150df --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/logview/OpenLogDialog.java @@ -0,0 +1,270 @@ +/******************************************************************************* + * Copyright (c) 2003, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package net.sourceforge.phpdt.internal.debug.core.logview; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.RandomAccessFile; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; + +import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * Displays the error log in non-Win32 platforms - see bug 55314. + */ +public final class OpenLogDialog extends Dialog { + // input log file + private File logFile; + // location/size configuration + private IDialogSettings dialogSettings; + private Point dialogLocation; + private Point dialogSize; + private int DEFAULT_WIDTH = 750; + private int DEFAULT_HEIGHT = 800; + + public OpenLogDialog(Shell parentShell, File logFile) { + super(parentShell); + this.logFile = logFile; + setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.MODELESS); + + } + + /* + * (non-Javadoc) Method declared on Window. + */ + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(PHPDebugCorePlugin.getResourceString("OpenLogDialog.title")); //$NON-NLS-1$ + readConfiguration(); + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, + true); + } + + public void create() { + super.create(); + // dialog location + if (dialogLocation != null) + getShell().setLocation(dialogLocation); + // dialog size + if (dialogSize != null) + getShell().setSize(dialogSize); + else + getShell().setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); + getButton(IDialogConstants.CLOSE_ID).setFocus(); + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected Control createDialogArea(Composite parent) { + Composite outer = (Composite) super.createDialogArea(parent); + Text text = new Text(outer, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL + | SWT.NO_FOCUS | SWT.H_SCROLL); + text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL + | GridData.VERTICAL_ALIGN_FILL); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + text.setLayoutData(gridData); + text.setText(getLogSummary()); + return outer; + } + + private String getLogSummary() { + StringWriter out = new StringWriter(); + PrintWriter writer = new PrintWriter(out); + if (logFile.length() > LogReader.MAX_FILE_LENGTH) { + readLargeFileWithMonitor(writer); + } else { + readFileWithMonitor(writer); + } + writer.close(); + return out.toString(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) + */ + protected void buttonPressed(int buttonId) { + if (buttonId == IDialogConstants.CLOSE_ID) { + storeSettings(); + close(); + } + super.buttonPressed(buttonId); + } + + //--------------- configuration handling -------------- + /** + * Stores the current state in the dialog settings. + * + * @since 2.0 + */ + private void storeSettings() { + writeConfiguration(); + } + + /** + * Returns the dialog settings object used to share state between several + * event detail dialogs. + * + * @return the dialog settings to be used + */ + private IDialogSettings getDialogSettings() { + IDialogSettings settings = PHPDebugCorePlugin.getDefault().getDialogSettings(); + dialogSettings = settings.getSection(getClass().getName()); + if (dialogSettings == null) + dialogSettings = settings.addNewSection(getClass().getName()); + return dialogSettings; + } + + /** + * Initializes itself from the dialog settings with the same state as at the + * previous invocation. + */ + private void readConfiguration() { + IDialogSettings s = getDialogSettings(); + try { + int x = s.getInt("x"); //$NON-NLS-1$ + int y = s.getInt("y"); //$NON-NLS-1$ + dialogLocation = new Point(x, y); + x = s.getInt("width"); //$NON-NLS-1$ + y = s.getInt("height"); //$NON-NLS-1$ + dialogSize = new Point(x, y); + } catch (NumberFormatException e) { + dialogLocation = null; + dialogSize = null; + } + } + + private void writeConfiguration() { + IDialogSettings s = getDialogSettings(); + Point location = getShell().getLocation(); + s.put("x", location.x); //$NON-NLS-1$ + s.put("y", location.y); //$NON-NLS-1$ + Point size = getShell().getSize(); + s.put("width", size.x); //$NON-NLS-1$ + s.put("height", size.y); //$NON-NLS-1$ + } + + // reading file within MAX_FILE_LENGTH size + private void readFile(PrintWriter writer) throws FileNotFoundException, IOException { + BufferedReader bReader = new BufferedReader(new FileReader(logFile)); + while (bReader.ready()) + writer.println(bReader.readLine()); + } + + // reading large files + private void readLargeFile(PrintWriter writer) throws FileNotFoundException, + IOException { + RandomAccessFile random = null; + boolean hasStarted = false; + try { + random = new RandomAccessFile(logFile, "r"); //$NON-NLS-1$ + random.seek(logFile.length() - LogReader.MAX_FILE_LENGTH); + for (;;) { + String line = random.readLine(); + if (line == null) + break; + line = line.trim(); + if (line.length() == 0) + continue; + if (!hasStarted + && (line.startsWith("!ENTRY") || line.startsWith("!SESSION"))) //$NON-NLS-1$ //$NON-NLS-2$ + hasStarted = true; + if (hasStarted) + writer.println(line); + continue; + } + } finally { + try { + if (random != null) + random.close(); + } catch (IOException e1) { + } + } + } + + private void readLargeFileWithMonitor(final PrintWriter writer) { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor + .beginTask( + PHPDebugCorePlugin + .getResourceString("OpenLogDialog.message"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ + try { + readLargeFile(writer); + } catch (IOException e) { + writer.println(PHPDebugCorePlugin + .getResourceString("OpenLogDialog.cannotDisplay")); //$NON-NLS-1$ + } + } + }; + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getParentShell()); + try { + dialog.run(true, true, runnable); + } catch (InvocationTargetException e) { + } catch (InterruptedException e) { + } + } + + private void readFileWithMonitor(final PrintWriter writer) { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor + .beginTask( + PHPDebugCorePlugin + .getResourceString("OpenLogDialog.message"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ + try { + readFile(writer); + } catch (IOException e) { + writer.println(PHPDebugCorePlugin + .getResourceString("OpenLogDialog.cannotDisplay")); //$NON-NLS-1$ + } + } + }; + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getParentShell()); + try { + dialog.run(true, true, runnable); + } catch (InvocationTargetException e) { + } catch (InterruptedException e) { + } + } +} -- 1.7.1