Eclipse Tip: Making a Good First Impression, Page 2
To make things just a bit more interesting, place a link at the bottom of your contributed section that will close the Welcome view and switch to the PDE perspective when clicked (that way, the user can start developing Eclipse plug-ins right away). The complete example of contributed content is shown in Listing 1.
There is no pre-defined action that would accomplish what you want, so you have to implement our own. All intro actions must implement the IIntroAction interface. This really consists of only one method—run(IIntroSite, Properties). The first argument is the workbench site that hosts the intro from which the action is invoked, and the second argument contains a map of arguments specified as part of the link's URL. The body of this method can be relatively simple—first, close the intro part, and then open the desired perspective (whose ID is provided as a URL parameter). This way, you can reuse the same action whenever you want to open an arbitrary perspective by simply specifying the corresponding perspective ID in the parameter list.
Finally, you could reference this action using the rather verbose "runAction" form, which requires its plug-in ID, class name, and all parameters. Instead, register the action under a short name—goPDE—in plugin.xml (as part of the same extension). You can see that this really simplifies its use and decouples the content from its implementation details.
- Source code (Eclipse projects) for the example (requires Eclipse 3.3)
- Platform Plug-in Developer Guide: Universal intro
- Extending the content of an intro config
- Intro Content File XML Format
About the Author
Peter Nehrer is a software consultant specializing in Eclipse-based business applications and development tools. He is the founder of Ecliptical Software Inc. and a contributor to several Eclipse-related Open Source projects. He holds an M.S. in Computer Science from the University of Massachusetts at Amherst, MA. Peter can be reached at pnehrer AT eclipticalsoftware DOT com.