How to position Eclipse Dialogs and Messages at ceter of screen.

I want to share a common issues that most of the UI programmers come across. When we program with lots of dialogs and messages in any kind of applications, for the usability and predictability we would want most of them to be centered to the screen. In many cases when we use constructors for Dialogs, MessageDialogs, etc… very often we pass newly constructed Shell.

e.g. MessageDialog.openInfo(new Shell(), “Hi This is a test Message Dialog.”);

In the above case remember that we have not specified any of the co-ordinates and often we see that it takes different coordinates depending on the number of times that we invoke it. And each time you invoke, you wonder where the dialog will appear. I have been using a simple solution that solves this issue… Hope some of you will be able to use this code right away. I hope the following code is self explanatory 🙂

I have tested this with all screen resolutions and on Windows XP and OSX.

/**
* All dialogs and messages will be passed with the centered shell.
* @return Shell
*/
public static Shell getScreenCentredShell() {
Display display = PlatformUI.getWorkbench().getDisplay();
Shell centreShell = new Shell(display);
Point size = centreShell.computeSize(-1, -1);
Rectangle screen = display.getMonitors()[0].getBounds();
centreShell.setBounds((screen.width-size.x)/2, (screen.height-size.y)/2, size.x, size.y);
return centreShell;
}

Posted in eclipse, java, plugins | Tagged , | Leave a comment

Dont blame Eclipse if you cant train your users !!!

This article is some thing that i want to write for a long time and i am writing it now :).  For reasons that we all know, many organizations have adopted Eclipse either as IDE for product development, ot IT customizes and offers it to the developers/users. Thats nice to hear….and i also see so mnay support calls and tickets to the IT and Sales guys, its very frustrating to educate some one over the phone or by mail.

Some of the Frequently Asked Questions :

  • Business Users  (still users ….)
    • Why should i use the workspace ?
    • Where are the projects created ?
    • Eclipse is hogging my CPU and Memory consumption
    • I found a useful plugin. How can i update a plugin ?
    • Where should i enter the license for this plugin ?
    • If an error occurs in eclipse, where should i look ?
    • Whats an error log ?
    • Whats a View and Perspective ? Where should i look for them …
    • When i am editing a file, why does it say that a file is changed on file system….
    • Where are preferences and properties ? Are they specific to a project ?
    • I want to open an existing project, i dont see that option (refering to Project Import)
    • Why cant i add/modify anything in the “Outline View” 🙂
    • Documentation and Help does not come with the installation
    • I want to develop c code, edit xmls etc…. can i do that in Eclipse
    • How do i know the version numbers of the plugins that i use ?
    • Should i set any environment variables….
  • Product Managers / Executives
    • Does eclipse work on Linux and Mac ?
    • I want to have a similar interface as Web 2.0 (all nice and cool effects…)
    • Should we train all our users on Java ?
    • Eclipse …. Its open source right…. is it reliable ?
    • If some thing goes wrong, whom should i blame 🙂

 And by now you know what i am talking about. I have had several problems in dealing with these kind of questions. You are quite lucky if all of your users, execs, etc…are in one single geo location and in one single office. But i am quite sure that many of the projects are not like this. We have development, sales, marketing and R&D divisions spread out and some times probably even different languages too :).

In many of the cases that i have seen, users are FORCED to use the tools and IDEs right from the day one. Now users try to get the every possible reason NOT to use it. I dont blame them, some times its frustrating to attend some of the support calls and trying to explain what a view and perspective is over the phone, but… You got to do what you got to do.

After all these years i see that there are definately obvious reason why you get these kind of questions.

Some of my recommendations for all those who want to roll out a Eclipse Application / RCP tools.

  • Executives / Product Managers
    • Any organization spends huge bucks on their tools and IDEs. This is a fact. You dont have the luxury of changing the tools every now-and-then. You got to choose some thing and thats gonna stay for a long time. So, please DO spend some time in getting to know eclipse on the ground level.
    • Eclipse + Open Source does not mean that there is no quality in software / its just for academics / just a Java IDE.
    • Dont ever think even with a commercial tool / IDE, you can get the things rectified in a super light years fast :).  I am sure that in reality that never happens, we raise the tickets, attach the logs, explalin the problem to the support, do some iterations and the finally…. you get some good or bad news. Does it ring bells…..
    • Before you take any decision on the Product Architecture and Product Suite, please DO consult some experts in eclipse to know what you are doing makes sense or not. The companies that i saw use Eclipse as one of the puzzle peices in the product suite.
    • You have to know what is possible and what is NOT possible. As an example… WEB 2.0 and Ajax kind of special and cool effects are nice, but please dont try to bring them into the Eclipse IDE/Applicaiton/Product. You just need to understand that an IDE is an IDE and WEB is a WEB 🙂 .
    • When you invest money on Eclipse, its not only as an IDE but also as an Application, as a RCP Product, Framework to build other applications, Data Integration Tools, etc… so know what eclispe can offer to you before you say anything.
  • Bussiness users / Developers  /Newbies…
    • If you are not a developer and never ever worked with an IDE, please do take a Training. Its worth a life time than getting frustrated with some small issues.
    • If Eclipse is delivered to you as a RCP application, there are two aspects of looking into the features. First is to see what are the features that RCP application provides, and second is to see what parts of eclipse features are available. Always understand that any RCP application or Eclipse IDE is made from Eclipse Plaltform (in many cases). So its important to know what you get by default and what you get from your own companies plugin distribution.
    • Ask your IT manager to arrange for a training and get the Yogic Knowledge 🙂
Posted in eclipse, plugins | Tagged , | Leave a comment

org.eclipse.swt.SWTException: Unable to load graphics library [GDI+ is required] (java.lang.NoClassDefFoundError)

This is the SWTException that you might see on the W2K machine. This cause for this exception is absence of GDI+ library (gdiplus.dll) on Windows 2000. On WindowsXP and Vista they come by default and its taken care of.

Don’t be dis-hearted by this, you can download from Microsoft site and every thing should work fine. For those who want to have some additional information…

http://www.eclipse.org/swt/faq.php#nographicslibrary
http://www-1.ibm.com/support/docview.wss?rs=2357&context=SS6RTP&dc=DB520&uid=swg21260149&loc=en_US&cs=UTF-8〈=en&rss=ct2357lotus
http://forum.springframework.org/showthread.php?t=36127
http://dev.eclipse.org/newslists/news.eclipse.technology.gmf/msg03973.html

Posted in eclipse, plugins | Tagged , , | Leave a comment

Eclipse SWT Browser and Cross Browser compatibility

I have been using the Browser widget from past 1 year in my project which is targetted on AJAX and SOA kind of integration environments in Eclipse. As one can imagnine that the inbuilt browser capabilities are necessary on AJAX environement.

It was quite interesting in the initial stages to use the Browser and render the html and other widgets in the Windows environment. In time we moved on to the Linux and Mac OSX and then we had to really face some major challenges.

Especially the way Browser Widget renders the widgets on the Internal Browsers is weird. The same HTML DOM is rendered by an external browser in a different way on OSX and Linux and in external browser everything looks fine.

Some of the DOM rendering capabilities, Draggable events, etc…are kind of strange in the internal Browser. In that case the only thing we had to do was to support the External Browser invokation also when ever the internal Browser fails.

In the end becareful in “Why you want to use Browser Widget” and also “What you want to display” in it.

Posted in eclipse, java, plugins | Tagged , , | Leave a comment

At what level do you use eclipse ?

 Eclipse the ubiquitous platform has survived another challenge by releasing the Europa and i am already seeing the # of downloads. Initially it was Java IDE then RCP Platform then Tool Building Platform and now as i know its an eco-system of major frameworks, tools, runtimes and platform which can be extended for ANYTHING an NOTHING in particular. OK, i am not going to define what eclipse does and what not. The scope of my article is to highlight the problems i am solving with eclipse platform.
I have been using eclipse right from 2003 and built tools on Automotive Domain and Ajax&SOA Domain. I have been closely following the other implementations on different verticals. Several OEMs, ISVs, Startups, Universities and individuals have adopted the eclipse “principles” and they know what they are doing soon after they use it. All the content in this article is purely my personal views from my professional experience and do not correlate to any ones opinions dead or alive 😉
What can i do with Eclipse : I would want to start with highlighting the tasks which can be accomplished with eclipse. I am hoping that we will understand the differences between using the eclipse, developing the plugins, making an IDE out of eclipse and eclipse as an integration platform.

Eclipse an IDE
: This is what many of us know about the eclipse and what can it do. Its a Java IDE and java developers can create, modify, build the java projects in eclipse. It provides different features like code refactoring (one of the gr8 feature), syntax highlighting, syntax/code checks, code completion, code suggestions, compile, debug, jarring, etc… I have used for an year with out knowing what ELSE can eclipse do. In this use-case we are primarily involved in using the eclipse IDE features as is. I am sure that you are aware of different eclipse language ides like, JDT, CDT, Cobol, PHP editors amongst the most popular ones.
Eclipse Happy User.

Eclipse does Plugins : By this time you know that eclipse can be used to develop plugins and bootstrap in eclipse. Design Plugins in Eclipse -> Develop Plugins in Eclipse -> Test in Eclipse -> Run in Eclipse. A plugin is a logical group of some functionality that in turn can be run in eclipse. If there is no UI part that is associated, it can be used as a simple jar file. In any case its pretty common that we have some UI associated with the plugin. This can be run either on a normal eclipse platform or on a RCP environment.
A simplest plugin you can think of it is a Hello World application (damn…why always HelloWorld). You basically want to contribute an action item to the toolbar of eclipse and on click of that button you want to display a dialog with Hello World Message. Thus in this plugin, you just USEd the eclipse platform to add some functionality your current eclipse runtime.
Basic Plugin Developer.

Eclipse as a Platform :All of us know about the JDT, CDT, PHP language plugins. On this level of platform usage, we as developers are building the different kind of plugins and these they will be used by target audience, who in turn develop some applications with our language kit. Its like one of my colleague had developed Cobol Language toolkit for Fujitsu customer (of course they have released it to open source after some time). In my view i think of the some of the editors like JSF Editor, XML Editors, JSP Editor, JS Editor that fall under this category.
There are many companies that are using the Eclipse as their real time application configuration platform. Its like they have the metadata and the configuration of metadata is a big deal.
Advanced Plugin Developer.

Eclipse an Integration Framework :This is the highest level of integration and complex applications that i have seen with Eclipse. Here i am talking about different usecases. One of the nice example is to be able to create the entire development life cycle of your complex engineering activities in to the eclipse. Starting from System Requirements, Software Requirements, Component Design, Function Design, Coding, Unit Testing, Integration Testing, System Testing, Delivery and finally Issue Tracking into Eclipse. Dont feel apprehensive about the possibility, i am aware of some companies who have done this. This on the ground level means, to integrate different tools [editors, compilers, debuggers, configurators] into eclipse. The integration can be done done on sharing different data models/formats primarily on the EMF models.
Many companies have integrated some AJAX and SOA kind of applications. A typical of these applications would use Platform, WTP, ATF, DTP. The final application could be a RCP application or a plugin distributed via internet/intranet.
I also knew of many Data ETL companies that have started adopting the eclipse as their integration platform of their next generation tooling platform. Many have migrated from their conventional COM/DCOM and Perl based applications to java/eclipse.
Happy Application Integrator.

In the next article i want to highlight the different usecases that are prevailing in the automobile and web 2.0 industries.
In the end you need to know that Eclipse is an ECO System.
You have almost all plugins, tools and frameworks that you want to build/integrate your applications.

Till then Happy Application Integration with Eclipse.

Posted in eclipse, java, plugins | Tagged , | Leave a comment

Performance tools for Eclipse RCP Applications

Recently i have been looking for the Testing, Performance and Runtime Visualization tools for Eclipse RCP Platform. The real challenge is to choose the variety of the tools that we have today in the market and which one suits us.
I have done almost few weeks of research and foudn some good tools for desktop applications. I am mainly concerned with the analysis of the runtime performance of custom developed plugins. I have a great things to deal on the SWT and JFace UI.
Anyway i want to give few resources for all of you who are interested in these tools.

http://jakarta.apache.org/jmeter  I ma sure everyone knows about it. Its the Apache kid and adopted by many enterprises for the J2EE performance tracking on the servers. In anycase as i am more interested in the desktop applications i had to lookinto others.
http://sourceforge.net/projects/jmechanic  I have heard a lot about this in the initial 2003 and 2004 but as i also see from the website, there are no prominent releases recently.
http://www.quest.com/jprobe  This is a real cool tool available today. I have checked it couple of times and i am impressed. It gives a very clear stats of the stack trace and call hierarchy. It can debug even the remote applications and its nice. I would definately recommend JProbe if you like it.
http://www.eclipse.org/tptp  As everyone knows its a subproject from eclipse and its a great platform to work on. As with my experience, its a little bit of effort to install, configure and run the plugin. Once you are used to it, its a GREAT thing on eclipse platform. You get all sorts of the stats that you want. How many Objects are alive, whats the sequance of the Object invocation, how many threads are alive, memory footprint, etc…
http://java.sun.com/performance/jvmstat  The jvmstat technology adds light weight performance and configuration instrumentation to the HotSpot JVM and provides a set of monitoring APIs and tools for monitoring the performance of the HotSpot JVM in production environments. The instrumentation is designed such that it is ‘always on’, yet has negligible performance impact. The monitoring interfaces added to the HotSpot JVM are proprietary and may or may not be supported in future versions of the HotSpot JVM.

Hope this helps for you some how.

Posted in eclipse, java, software | Tagged , , | Leave a comment

java.lang.OutOfMemoryError: PermGen space

Looks like this is been a common error for almost memory intensive applications now-a-days. I have been working on eclipse for a long time and recently with the Eclipse + Java 1.5.0_04 + EMF + WTP combimation of installation, i have been seeing the error more often.

Its been quite emberrasing to see such errors on the client machines and especially when i was not sure of the problem and the root of the cause. In anycase after going through couple of documents on the java and eclipse news groups, looks like this problem can be avoided if we set some jvm arguments. Some also suggest that if we use IBM’s Java, it would be solved. But i have not changed the Java from Sun to IBM but just the vm arguments works.

It can be done in few different ways…

  • Set the arguments in the Run or Profile windows of eclipse -XX:PermSize=128M -XX:MaxPermSize=256M
  • Set the arguments in eclipse.ini file in eclipse home directory
  • Set these programmatically…

In my case i have the following vm agrs already set  🙂

-Xms256m
-Xmx1024m
-XX:PermSize=128M
-XX:MaxPermSize=256M

 Few other sources to get more info…

http://www.brokenbuild.com/blog/2006/08/04/java-jvm-gc-permgen-and-memory-options/

http://java.sun.com/docs/hotspot/gc1.4.2/faq.html

Posted in java | Tagged , | Leave a comment

Europa launched…

The long awaited europa launched few days ago and its really really cool. Releasing 21 eclipse projects at the same time is a tremendous work and they have did it again. I was very apprehensive about the initial stages of Callisto, whether it will be able to make it or not. Callisto it self was a great success and Europa has broken these records too.

Looks like europa has 17 million lines of code and the real nice thing i found is that now we have 2 different distributions for Java Developers and C/C++ Developers. That’s so cool, is nt it. Now the developers need to not remove/disable the parts that they dont want. And most importantly its slim.

Long live Eclipse. !!!

Posted in eclipse, plugins, software | Tagged , | Leave a comment

When NOT to offshore ?

Recently i have started realizing the side effects of offshoring. I have already worked with  off shoring projects for many years and and i was pretty convinced with this model. Its been almost from past 10 months that i am seeing some (more) challenging topics in this model.

Probably let me explain with the current model that we have. Its a product development company, we have engineering, product management, sales and QA teams wide spread across continents. Engineering team it self is spread out. Now… this product has a LOT of innovation, few resources, lot of accountability and responsibility on each team member. I am sure many of us do have this kind of scenario….but i want to publish my own observations.

Vision : Off shoring team does not share the same vision as ABC Company. The future technology direction, how to move swiftly in the competitive market, what does the sales team need, what does the end customer/user needs, etc.. are different kind of questions that basically makes our thought process to go in a single direction. When these kind of questions and answers are not visualized in individuals mind, its very difficult to drive everyone for a common goal.

Communication : As the company is very small the decisions are very fast and some time its very very difficult to communicate each and every decision taken. When decisions are taken and communicated, we are very notorious in just mentioning What you need ?. And now for the people sitting across 10,000 distance, it difficult to comprehend the cause-effect scenarios and especially Why you need something ?. Because of the geographical and cultural barriers, we tend to get offended to lot of mail communication. We are too good at arguing and sending some nasty mail chains till some one puts an end to it.  

Innovation : First things first. Innovation needs motivation. People need to understand that even to work within their 8 hours/day contract also needs motivation. The very common aspect of the offshore team to be inert is that they tend to think that other guys (customer/coordinator) is sitting in a beautiful country, Why should i break my head for him. When you do not have motivation, you dont care about anything. You are least bothered about the innovation, you are good at repeating the same job again and agin and thats it.

Incremental development : Oh man….never ever do this. I mean Incremental development spread across the geo graphies on the same module. You would see night mares. It might be OK, for initial few months, but once you get a initial shape to the product/module then you will start realizing many things. The module coherence, coding styles, redundancy in code, fix the bugs, revert again, etc… If you can , have the complete modules distributed across. But dont distribute a single module. Some time with these kind of decisions you can ruin your product delivery dates.

Estimation and Scheduling : Do not ever estimate and schedule for a team in teh offshore. That would be like keep a time bomb in your shoe. Understand that the offshore team is with a different mindset, different culture, diffeent personal problems and priorities. Let them estimate and decide when they want to do and just ask them a delivery date. Of course you can always influence and negotiate the deadlines. On that level i feel, its better to kind of macro manage on the estimates and scheduling on the tasks and do a micro management on the delivery dates.

In the end,  if you are a Director, Program/Project Manager, VP involved in off shoring, you know what i have written, but the only thing i want to highlight is that you need to take the offshoring decisions consciously. You need to keep in mind all the effects and side-effects of it. Its better to be informed about effects of decisions rather repent the decisions.

Posted in entrepreneurship, management, startups | Tagged , | Leave a comment

Reno – The Biggest Little City in the World

Probably a 1 day trip if you are living closer to it (around 100 miles) or a 2 day trip from bay area in CA. I would not say it as a MUST visit, but a time-pass place. We started from Sacramento on a saturday afternoon and it took around 2 hours to reach Reno. Its in Nevada and the road was really cool. Its a ride on the small hills and nice scenarios to enjoy. On the way is the Lake Tahoe (very famous for Bay-Area SW Engineers :)), but we did not visit it anyway due to tome constraints. 

There are quite a number of casinos in Reno. But honestly they are all placed apart. Its difficult to have a look at them in a single shot. Of course i am comparing it to Atlantic City in East Coast. That was more organised and more colorful than Reno. At this point of time i am not comparing anything to Vegas 🙂 . 

It was a good trip definitely worth remembering. Visit it if you are some where near to this place. 

Posted in travel | Tagged , , , | Leave a comment