Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Tuesday, August 26, 2008

Debugging WebSphere with Eclipse

This is how I attach my Eclipse 3.3 to WebSphere 6.1 for debugging my deployed applications.

WebSphere
In WebSphere’s console, I go to Application Servers > my-server-to-debug > Java and Process Management > Process Definition > Java Virtual Machine. Near the bottom of the page, I check Debug Mode and the values I am using in Debug arguments are:
-Djava.compiler=NONE -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777

After applying the changes, I restart WebSphere.

Eclipse
In the Debug Dialog, I create a new configuration under the category Remote Java Application. I specify the project containing the source code of my deployed application, localhost (my WebSphere is running locally) and the port 7777.

Now I am ready to debug. I add some breakpoints, launch the debug configuration and run my deploy application.


Hope this helps you.


Until next…

Wednesday, July 16, 2008

Demo for Ganymede's security

Hi All,
Security is one of the features I was waiting to see in Eclipse and I am glad that Ganymede comes with it.

I found a good introductory demo in Eclipse Live that explains the new security features: http://live.eclipse.org/node/565. The demo is pretty clear and gives an overview of how security works in Ganymede. Don't forget to visit Equinox Security website for more info.

<>

Friday, July 11, 2008

org.eclipse.ui.menus

Recently I’ve been guiding our off-shore team on moving our pop-up menu actions from using org.eclipse.ui.popupMenus extension point to a newer mechanism. Eclipse 3.3 provides a new mechanism, a lot easier to use, through the org.eclipse.ui.menus extension point. This extension point adds UI contributions to the main menu, main toolbars, view menus, view toolbars, context menus, etc. and replaces the following (legacy) extension points: org.eclipse.ui.ActionSets, org.eclipse.ui.EditorActions, org.eclipse.ui.popupMenus (including 'objectContributions') and org.eclipse.ui.viewActions.

Below is a summary of the steps for migrating to the new mechanism. Since there are a number of pop-up items, the migration converts one action at a time. Here are the steps:

1) Contribute a command using org.eclipse.ui.commands extension point.
2) Refactor the action delegate class to a handler delegate class.
3) Contribute the converted handler class using org.eclipse.ui.handlers extension point and specifying the command from step 1).
4) Then, add the command to your particular menu using org.eclipse.ui.menus. Here the trick is specifying the locationURI. For example: locationURI="menu:org.eclipse.ui.main.menu?after=additions" adds a command to the main menu and locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions" add a command to the main toolbar.

The org.eclipse.core.commands.ExecutionEvent in the new handler’s execute(ExecutionEvent) method can be passed to class org.eclipse.ui.handlers.HandlerUtil. HandlerUtil provides static methods for obtaining the context when the command is executed, such as the shell, active editors, parts, menus, etc.

After testing the conversion of the old actions to the new mechanism, the next step may be adding key bindings by extending org.eclipse.ui.bindings. Remember to specify a sequence that has not been bound already.

Another consideration is enablement, as some commands may not be available all the time. Method isEnabled() in the new handler may be overridden, but when this method is called it is not possible to obtain the active editor. In cases when the user enables or disables the action through a preference page, method isEnabled() may be used. An approach to enablement is as follows:
1) Create a property tester using org.eclipse.core.expressions.propertyTesters extension point
2) Add the clause enabledWhen in org.eclipse.ui.handlers extension point and test for the above property, for example:
... inside a given extension point

variable="selection">
value="*">


property="com.example.objetToTest.propertyName">



...
May be used for testing that a selection (like a resource) has a particular property, that is command may applied to the selection.


At this point, the conversion should have gone fine. I hope this post helps you as a reference.


Until next…