Thursday, October 19, 2006

[Eclipse]The call sequence between partActivated and menu update

I met a defect that dynamically created menu items disappear after creating a new viewPart. It caused me overtime last Friday. Today I find the root cause.

The scenario is:

  1. open first document, the items are shown well

  2. open another document, the items disappear

The requirement is that showing the menu items while current part is document, otherwise hide them.

So our implementation is:

  1. when current document part is deactivated, set menu items invisible

  2. when document part is activated, set menu items visible


After debugging, I found that menu items was updated before the part activated listener was notified. Hence the menu is invisible while the parent menu is updated. The resolved solution is that setting menu items visible while part opened listener is notified.

Wednesday, October 18, 2006

[debug][java]Remote debug in Eclipse

I need use remote debug in our project, however just some experience in Weblogic were found from internet. After my investigation, I got some experience about using Eclipse remote debug RCP.
There are two important parameters for jvm. And we must launch remote java app with those two parameters.
-Xdebug //tells jvm starting with debug mode
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 //transport=dt_socket represents communication with socket, address=1044 represents that the port number is 1044
Then there are 3 steps in local env:
1.import source code into eclipse's project
2.Debug-Remote Java Application, see attachement as a sample
3.insert breakpoint,

update:
a simpler way:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000