Package org.eclipse.e4.core.contexts

# Class RunAndTrack

java.lang.Object
org.eclipse.e4.core.contexts.RunAndTrack

public abstract class RunAndTrack extends Object
Instances of this class contain behavior that is executed within an `IEclipseContext`. The context records all values accessed by this object, and will re-evaluate this runnable whenever any accessed value changes.

Since:
  1.3
See Also:
  - `IEclipseContext.runAndTrack(RunAndTrack)`

## Constructor Summary

Constructors
Constructor
Description
`RunAndTrack()`
Creates a new instance of trackable computation

## Method Summary

Modifier and Type
Method
Description
`abstract boolean`
`changed(IEclipseContext context)`
This method is initially called by the framework when an instance of this class is associated with the context via `IEclipseContext.runAndTrack(RunAndTrack)`.
`protected void`
`runExternalCode(Runnable runnable)`
Use this method to wrap calls to external code.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### RunAndTrack

public RunAndTrack()
Creates a new instance of trackable computation

## Method Details

### changed

public abstract boolean changed(IEclipseContext context)
This method is initially called by the framework when an instance of this class is associated with the context via `IEclipseContext.runAndTrack(RunAndTrack)`.

After the initial call this method is executed when one or more values it retrieved from the context change.

Parameters:
  `context` - modified context
Returns:
  `true` to continue to be called on updates; `false` otherwise

### runExternalCode

protected void runExternalCode(Runnable runnable)
Use this method to wrap calls to external code. For instance, while in `changed(IEclipseContext)`. consider calling listeners from this method. This wrapper will pause dependency recording while in the 3rd party code, reducing potential dependency circularity issues.

Parameters:
  `runnable` - the runnable to execute