Mar 31, 2009

How to use Mobile Media API with eSWT

On mobile Java world Mobile Media API (MMAPI, aka. JSR 135) is the API to use for playing videos and music as well as accessing the phone camera. Basically all the multimedia development is done through this API on mobile phones.
Video support and the camera support requires the MMAPI to be used together with the UI toolkit. Although there is plenty of information on the MMAPI, because eSWT is a young toolkit, it is hard to find information on how to use it together with eSWT.
The cue for using MMAPI and eSWT is in the way the VideoControl is initialized. The rest of the use is similar, if not same, to other toolkits.  Below is a snippet that shows how to initialize the VideoControl to use an eSWT Control. If you pay attention to line 5 of the snippet there is a call to Control.setParent(). This method must be called, regardless if the eSWT implementation supports reparenting or not. The actual initialization of the video to control actually takes place in this method. Initialization is delayed until this method is called because MMAPI does not provide a mechanism to provide arguments during control initialization and eSWT requires at least the parent Control to properly initialize.
1: Player player = Manager.createPlayer("capture://video");
2: player.realize();
3: VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
4: Control vControl = (Control) videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, Control.class.getName());
5: vControl.setParent(shell);



A complete example that shows how to take a picture using eSWT and MMAPI can be found here.
Read more →

Mar 25, 2009

Ada Lovelace Day, an Eclipse community version

I was reminded that yesterday was Ada Lovelace day. On Ada Lovelace day bloggers are asked to post about women they know and admire in technology. So I would like to use the opportunity to highlight some of the women that I have met and\or witnessed the excellent work they are doing in Eclipse community.

This is by no means a complete list and it is not intended to be. Please feel free to enhance the list in the comments or through your blog.

Read more →

Mar 12, 2009

BiDi support on eSWT

Bi-directional (BiDi) language support is one of the rare areas where eSWT acts different from the desktop SWT. Mobile phones are personal devices where it is desired that the language selected for the device determines the language for the applications. On the other hand, it is more common on desktop PCs that some applications, and IDEs especially fall into this category, are desired to have a different language support than the platform’s selected language.
BiDi support in SWT and eSWT is specified to be supported through the use of SWT.RIGHT_TO_LEFT flag on Control creation. The difference on eSWT is it really does not. eSWT implementations currently do not support explicitly setting of the SWT.RIGHT_TO_LEFT flag on Controls. So it is not possible to force orientation on eSWT Controls at this time. There are currently plans to support these flags in the future on platforms where it is possible.
The second difference is the default orientation. eSWT implementations inherit the language direction from user selected language of the device. That means, on a mobile phone that has Urdu as the selected language, the orientation will be right to left. This is different from SWT where directionality is determined by use of command line parameters or system properties as explained in here. There are also plans to support a system property to determine the default language direction for eSWT. Of course, such a property will not make too much difference in platforms such as MIDP but it can get handy for eRCP applications.
Read more →

Mar 2, 2009

Eclipse marketplace inspired by the gaming industry

I have blogged about the need for an Eclipse marketplace on an earlier post. Since I am a techie who knows about bundles, I have called it “bundle marketplace” but Eclipse marketplace is more friendly. The post revealed that others in the community were supportive of the idea. Moreover, I have discovered about the renewal of the EPIC, which can present an opportunity to make the marketplace happen.
I have started with the marketplace idea initially when the Equinox application model demo was made available two years ago. The demo shows the use of OSGi Application Admin Service specification to manage Eclipse applications. I was suffering from several Eclipse installation for different purposes syndrome back then. So I decided to put together my personal RCP application to manage those instances.
My inspiration for the RCP application was actually the Steam gaming platform that I used to use actively. This is an application platform that let’s you buy and download full games. It also keeps them up-to-date and informs you about the changes and releases. Sounds familiar? Here is how it works. On most of the time, the application is an icon on the tray. It manages the game updates, installs when idle. It also provides a menu as you can see on the screenshot below to reach your games and other stuff.
SteamMenu   
If you click the Games menu it opens up your list of games ( read applications here ).
GamesList
There is also the store view which is essentially a web application in the embedded browser.
SteamStorefront
So I decided, I want the similar kind of experience for my Eclipse installations. So I started coding a RCP application that would most of the time sit on the tray and would launch my applications. Actually that part went smoothly and I was able to do the listing and launching of the applications. Introducing different Eclipse configurations as applications was a bit pain but it worked. Then, I have turned my attention to installing, and updating but remember this was two years ago, there was no P2! So that’s where I have stopped.
After the talks about the marketplace started I have checked back to my SVN and I still have the code. If a project to mix the capabilities of P2 and the EPIC to create a client is started I would be willing to contribute this work. Further, with the use of new SWT Browser APIs (for cookies and calling Java from web pages) on 3.5  stream, I think it would be possible to create web hybrid application as the front end for the Eclipse marketplace that integrates with this client and therefore with P2.
Read more →