September 20, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Eclipse Tip: Making a Good First Impression

  • September 6, 2007
  • By Peter Nehrer
  • Send Email »
  • More Articles »

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.

Resources

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.





Page 2 of 2



Comment and Contribute

 


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

 

 


Sitemap | Contact Us

Rocket Fuel