Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Divided Loyalty: Create Plugins that Work in Eclipse and NetBeans : Page 3

One of the benefits of today's open source IDEs is that anyone can design a tool that plugs in to the IDE using an API, but Eclipse and NetBeans each uses a different API. This article will show you how to make your tool plug in to both environments with the least amount of coding work.


advertisement
User Interface Issues
One of the most important design decisions concerns which UI toolkit to use. Eclipse uses Standard Widget Toolkit (SWT) while NetBeans uses Swing/AWT. SWT is based on an operating system's native UI toolkit and Swing, which is implemented in pure Java, does not use any native UI components. Fortunately, Eclipse provides a way to integrate Swing UIs into SWT frameworks. If you want to reuse your UI code, using Swing or some other pure Java UI toolkit is a good idea. (My company's product, Nexaweb Designer, uses an alternative pure Java UI toolkit). Here's how to add an AWT button to Eclipse:

//Create a new composite with the embedded style. Composite composite = new Composite(parent, SWT.EMBEDDED); //Create the AWT frame Frame frame = SWT_AWT.new_Frame(composite); //Create an AWT button on top of the frame Button button = new Button("This is an AWT button"); //Add the button to the frame frame.add(button);

Integrating Swing/AWT into Eclipse does come with some caveats; currently only the Windows OS version supports this feature. However, in recent articles I have seen that more people have succeeded in getting it to work with GTK and Motif using an early-access JDK 1.5. If you're in need of a solution that works on all platforms, then you may have to rewrite your UI code. Also when integrating Swing or AWT, the look and feel of the plugin will vary greatly from the overall IDE. The plugin developed for Eclipse, I limited the use of the AWT integration to the Visual Design Editor for Nexaweb's rich Internet applications. This provided minimal impact to the workflow and feel of the application while maximizing the amount of code reuse.

The ability to develop a tool that will work in both Eclipse and NetBeans is a valuable luxury. I've explained the differences between the two frameworks and shown how to integrate the Swing UI into the eclipse SWT UI using code from Nexaweb's Designer tool as an example. There is still much more to learn to successfully build a complete tool for both environments; both IDEs come with an vast set of APIs as well as the implementation details of developing other pieces of functionality. I hope this information will at least start you on a path for further exploration on the subject.





Robert Buffone is a principal software architect responsible for platforms and tools at Nexaweb Technologies, Inc. Before Nexaweb, Buffone was with Trakus, a technology company for tracking sports in real-time. He has deep experience and knowledge about Windows technologies as well as Java, and is a leading expert in user interface design and application development.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date