© Markus Duft 2018
Markus DuftEclipse TEA Revealedhttps://doi.org/10.1007/978-1-4842-4093-9_5

5. Tasks

Markus Duft1 
(1)
Peggau, Steiermark, Austria
 

A Task is basically a piece of executable code that is dynamically created and managed by TEA. You can use dependency injection (DI) to obtain objects in the DI context of the Task (or any parent context—see Figure 3-4). You can think of it as a more powerful Runnable.

A simple Task implementation looks like the code snippet in Listing 5-1.
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.tea.core.services.TaskingLog;
public class SampleSimpleTask {
      @Execute
      public void doIt(TaskingLog log) {
            log.info("Hello World");
      }
}
Listing 5-1

A Very Simple Task

Something worth ...

Get Eclipse TEA Revealed: Building Plug-ins and Creating Extensions for Eclipse 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.