December 18, 2014
Hot Topics:

The (J)Face of Eclipse

  • November 17, 2005
  • By Peter Nehrer
  • Send Email »
  • More Articles »

Test Running the Example

There's nothing new that is required to test-run your example; simply right-click the plug-in in your Package Explorer and choose Run As -> Eclipse Application. When the run-time workbench comes up, go to Window -> Show View -> Other... and choose Developer.com -> Superview from the list. When the Superview shows up, you can test the functionality you've implemented.

Figure 3: The Extended Superview

A good way to learn and understand these simple examples is to install a few breakpoints in methods of your interest and run the plug-in in debug mode. Because SWT applications are (mostly) single-threaded, you won't find it difficult to keep track of multiple threads while debugging; you do need to keep in mind, however, that SWT uses JNI calls (which you can't step into with your debugger). It also receives events from the operating system, which are often dispatched some time after the related piece of code has executed (for example, when you programmatically check a radio button, the other radio buttons in the group receive their "uncheck" events next time the event queue is processed, so you won't immediately see the full effect).

Conclusion

Two Eclipse frameworks you will most likely rely upon when building visual plug-ins are SWT and JFace. SWT provides Java wrappers for native platform widgets, which are the foundation of most Eclipse user interface components. JFace, on the other hand, provides higher-order abstractions and patterns for building typical user interfaces in Eclipse, such as viewers, actions, dialogs, and wizards. You extended the previous article's example to demonstrate the use of JFace viewers and menu actions, as well as the creation of a dialog and a multi-page wizard. In the next installment, you will examine the API for working with the Eclipse workbench and its parts.

Resources

  • The example plug-in developed in this article is available here. To import it into your clean, new workspace as a project, click File -> Import; then choose the Existing Projects into Workspace wizard, and specify the path to your downloaded archive file.
  • Eclipse Help (click Help -> Help Contents in the main menu), also available online at http://help.eclipse.org/help31. See the Platform Plug-in Developer Guide, sections Dialogs and Wizards, JFace UI framework, and Standard Widget Toolkit in the Programmer's Guide, and packages org.eclipse.jface.* and org.eclipse.swt.* in API Reference.
  • Eclipse SDK Examples (visit http://www.eclipse.org/downloads and scroll down to the Example Plug-ins section)
  • Eclipse newsgroups (Platform, SWT)
  • SWT Designer is a visual user interface builder for Eclipse (commercial, free version available); Eclipse Visual Editor Project aims to provide a similar tool licensed under EPL.

About the Author

Peter Nehrer is a software consultant living in Toronto, Ontario. He specializes in Eclipse-based enterprise solutions and J2EE applications. His professional interests include development tools, model-driven software development, and information sharing. He is the author and contributor to several Eclipse-related Open Source projects. Peter is an IBM Certified Solutons Developer for XML and related technologies. He holds an M.S. in Computer Science from the University of Massachusetts at Amherst, MA.





Page 5 of 5



Comment and Contribute

 


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

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel