Chapter 5. Contributing a Menu Item to Run Tests

What we'll see in this chapter:

  • Contributing an action that shows up in the context menu of a selected object

  • Implementing the contribution by looking at an example

We'd like to get the minimal user interface possible for our example, just to have something complete running. Here is where we will start:

  1. Choose a test case class in the Package Explorer.

  2. Pop-up a context menu.

  3. Select Run Test.

  4. Run the tests.

  5. Pop up a dialog with the results of running all the tests in the type.

Create a new plug-in project named org.eclipse.contribution.junit. Use the default plug-in structure, but uncheck the Generate code for the class button on the final page. You will have to delete the line class="org.eclipse.contribution.junit.JUnitPlugin" ...

Get Contributing to Eclipse: Principles, Patterns, and Plug-Ins now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.