Chapter 25. ResultView Revisited — Observing Changes

Our old ResultView will keep displaying red or green even if the underlying Java code changes. We would like the color to be accurate—red if a test fails, green if all tests succeed, and neutral if we don't know. In this chapter we revisit the ResultView to clear the red/green result indication as soon as a Java resource has changed and we no longer know whether the tests will succeed or not. This will allow us to illustrate how to listen to changes to Java elements.

In this chapter, we'll see how to

  • Listen to changes to Java elements

  • Process Java element deltas

Testing Color

Let's start with the corresponding test case. We add the following test to ViewColorTest:

Example . org.eclipse.contribution.junit.test/ViewColorTest ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.