Package org.eclipse.debug.core

## Interface IExpressionManager

    public interface IExpressionManager

The expression manager manages the collection of registered expressions in the workspace. An expression is a snippet of code that can be evaluated to produce a value. Expression creation and evaluation are client responsibilities.

Clients interested in expression change notification may register with the expression manager - see `IExpressionListener` and `IExpressionsListener`.

Since:
  2.0
See Also:
  `IExpression`, `IExpressionListener`, `IExpressionsListener`
Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addExpression​(IExpression expression)` Adds the given expression to the collection of registered expressions in the workspace and notifies all registered listeners.
`void` `addExpressionListener​(IExpressionListener listener)` Adds the given listener to the collection of registered expression listeners.
`void` `addExpressionListener​(IExpressionsListener listener)` Adds the given listener to the collection of registered expression listeners.
`void` `addExpressions​(IExpression[] expressions)` Adds the given expressions to the collection of registered expressions in the workspace and notifies all registered listeners.
`IExpression[]` `getExpressions()` Returns a collection of all registered expressions, possibly empty.
`IExpression[]` `getExpressions​(String modelIdentifier)` Returns a collection of all expressions registered for the given debug model,possibly empty.
`boolean` `hasExpressions()` Returns whether there are any registered expressions
`boolean` `hasWatchExpressionDelegate​(String id)` Returns whether a watch expression delegate has been contributed for the given debug model.
`IWatchExpression` `newWatchExpression​(String expressionText)` Creates and returns a new watch expression with the given text.
`IWatchExpressionDelegate` `newWatchExpressionDelegate​(String id)` Returns a new watch expression delegate for the given debug model or `null` if no delegate is available.
`void` `removeExpression​(IExpression expression)` Removes the given expression from the expression manager, and notifies all registered listeners.
`void` `removeExpressionListener​(IExpressionListener listener)` Removes the given listener from the collection of registered expression listeners.
`void` `removeExpressionListener​(IExpressionsListener listener)` Removes the given listener from the collection of registered expression listeners.
`void` `removeExpressions​(IExpression[] expressions)` Removes the given expressions from the collection of registered expressions in the workspace and notifies all registered listeners.

### Method Detail

#### addExpression

    void addExpression​(IExpression expression)

Adds the given expression to the collection of registered expressions in the workspace and notifies all registered listeners. This has no effect if the given expression is already registered.

Parameters:
  `expression` - the expression to add

#### addExpressions

    void addExpressions​(IExpression[] expressions)

Adds the given expressions to the collection of registered expressions in the workspace and notifies all registered listeners. Has no effect on expressions already registered.

Parameters:
  `expressions` - the expressions to add
Since:
  2.1

#### newWatchExpression

    IWatchExpression newWatchExpression​(String expressionText)

Creates and returns a new watch expression with the given text. The returned expression is not added to this manager.

Parameters:
  `expressionText` - the text for the new expression
Returns:
  new watch expression
Since:
  3.0

#### getExpressions

    IExpression[] getExpressions()

Returns a collection of all registered expressions, possibly empty.

Returns:
  an array of expressions

#### hasExpressions

    boolean hasExpressions()

Returns whether there are any registered expressions

Returns:
  whether there are any registered expressions

#### getExpressions

    IExpression[] getExpressions​(String modelIdentifier)

Returns a collection of all expressions registered for the given debug model,possibly empty.

Parameters:
  `modelIdentifier` - identifier of a debug model plug-in
Returns:
  an array of expressions

#### removeExpression

    void removeExpression​(IExpression expression)

Removes the given expression from the expression manager, and notifies all registered listeners. Has no effect if the given expression is not currently registered.

Parameters:
  `expression` - the expression to remove

#### removeExpressions

    void removeExpressions​(IExpression[] expressions)

Removes the given expressions from the collection of registered expressions in the workspace and notifies all registered listeners. Has no effect on expressions not already registered.

Parameters:
  `expressions` - the expressions to remove
Since:
  2.1

#### addExpressionListener

    void addExpressionListener​(IExpressionListener listener)

Adds the given listener to the collection of registered expression listeners. Has no effect if an identical listener is already registered.

Parameters:
  `listener` - the listener to add

#### removeExpressionListener

    void removeExpressionListener​(IExpressionListener listener)

Removes the given listener from the collection of registered expression listeners. Has no effect if an identical listener is not already registered.

Parameters:
  `listener` - the listener to remove

#### addExpressionListener

    void addExpressionListener​(IExpressionsListener listener)

Adds the given listener to the collection of registered expression listeners. Has no effect if an identical listener is already registered.

Parameters:
  `listener` - the listener to add
Since:
  2.1

#### removeExpressionListener

    void removeExpressionListener​(IExpressionsListener listener)

Removes the given listener from the collection of registered expression listeners. Has no effect if an identical listener is not already registered.

Parameters:
  `listener` - the listener to remove
Since:
  2.1

#### newWatchExpressionDelegate

    IWatchExpressionDelegate newWatchExpressionDelegate​(String id)

Returns a new watch expression delegate for the given debug model or `null` if no delegate is available.

Parameters:
  `id` - the unique identifier of a debug model for which a watch expression delegate has been contributed
Returns:
  a watch expression delegate associated with the given model or `null` if none
Since:
  3.0
See Also:
  `IWatchExpressionDelegate`

#### hasWatchExpressionDelegate

    boolean hasWatchExpressionDelegate​(String id)

Returns whether a watch expression delegate has been contributed for the given debug model.

Parameters:
  `id` - the unique identifier of a debug model
Returns:
  whether a watch expression delegate has been contributed for the given debug model
Since:
  3.1
See Also:
  `IWatchExpressionDelegate`