Grep Console How-to #8: Notifications

Grep Console 3.5 introduced the notification feature, designed to give you feedback about key information in your Eclipse console even if Eclipse isn’t currently your active window. This article gives an overview of how to use notifications. If you’ve been using previous versions of Grep Console, you can also see the new tabbed interface on the expression dialogue for the first time.


Let’s say you have a test case which runs for a while before producing a temporary output file. The path to the output file is written to the console so you can open and verify it. For exactly this situation at work, I’ve been using Grep Console’s link feature to make the file paths clickable and directly view the PDF files created by my test cases.

Our example output looks like this:

Generating output...
Output is ready: /home/grepconsole/temp/demo.pdf

We want to highlight the second line, and turn the path into a link we can click to view the PDF. In addition to that, we want to set up notifications triggered by this line.

Styles and Links

We start by creating a new expression item, using the following expression to capture the path part of all “Output is ready” lines:

\QOutput is ready: \E(\S+)

All other fields on the General tab can be left on the default settings for our purpose. On the Styles & Links tab, we assign a highlight style to the line and a further highlight to the capture group:

We configure highlights for the line and the file path, turn the file path into a link and rename the capture group to "file".

As you can see, we’ve also renamed the capture group to “file” for easier reference (see below in the notifications section) and added a File link to it. The link simply specifies “{group}” as the file path (as we’ve renamed the capture group, we could just as well have specified “{file}” here). This turns the path portion of our output line into a clickable link which will open the referenced file.


On the Notifications tab, we configure a popup notification to display a popup message, and a sound notification to play when our test output is ready:

We configure a popup and a sound notification.

The popup notification is set up to use the fixed title “Output” and the message “Output is ready:” followed by the path from our file capture group (which we named “file” in the previous step). Also, we assign the same link action to the notification which we already used in the previous step (you can simply use copy & paste to assign the same link here). Setting this link means that when we click on the popup message, the referenced file will open directly. If we don’t set a link, we can still click on the message – it will simply activate the Eclipse window in this case.

The sound notification is straightforward: We’ve assigned a “click.wav” sound. This sound will play as soon as the output line is written to the console.

Also on this tab, we could specify an autostart action, which is exactly the same feature described in How To #6: Autostart Links. As of Grep Console version 3.5, autostart links have been renamed to autostart actions and moved to the notifications tab.


And this is what it looks like when our demo application finishes:

The popup message can be seen on the lower right.

To the lower right you can see the popup message which you can click to open the output file. Even if your Eclipse window is minimised or in the background, this message will pop up as soon as our demo file is ready. The message will automatically fade out and disappear after a few seconds, unless you move the mouse pointer inside the popup, which will keep it alive until the pointer leaves the popup again.

This entry was posted in Grep Console and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *