Package org.eclipse.jface.util

# Class Policy

java.lang.Object
org.eclipse.jface.util.Policy

public class Policy extends Object
The Policy class handles settings for behaviour, debug flags and logging within JFace.

Since:
  3.0

## Field Summary

Fields
Modifier and Type
Field
Description
`static boolean`
`DEBUG_DIALOG_NO_PARENT`
A flag to indicate whether unparented dialogs should be checked.
`static final boolean`
`DEFAULT`
Constant for the the default setting for debug options.
`static final String`
`JFACE`
The unique identifier of the JFace plug-in.
`static boolean`
`TRACE_ACTIONS`
A flag to indicate whether actions are being traced.
`static boolean`
`TRACE_TOOLBAR`
A flag to indicate whether toolbars are being traced.

## Constructor Summary

Constructors
Constructor
Description
`Policy()`

## Method Summary

Modifier and Type
Method
Description
`static AnimatorFactory`
`getAnimatorFactory()`
Deprecated, for removal: This API element is subject to removal in a future version.
this is no longer in use as of 3.3
`static Comparator<Object>`
`getComparator()`
Return the comparator used by JFace to sort strings.
`static ErrorSupportProvider`
`getErrorSupportProvider()`
Return the ErrorSupportProvider for the receiver.
`static ILogger`
`getLog()`
Returns the logger used by JFace to log errors.
`static StatusHandler`
`getStatusHandler()`
Returns the status handler used by JFace to handle statuses.
`static void`
`logException(Exception exception)`
Log the Exception to the logger.
`static void`
`setAnimatorFactory(AnimatorFactory factory)`
Deprecated, for removal: This API element is subject to removal in a future version.
this is no longer in use as of 3.3
`static void`
`setComparator(Comparator<Object> comparator)`
Sets the comparator used by JFace to sort strings.
`static void`
`setErrorSupportProvider(ErrorSupportProvider provider)`
Set the error support provider for error dialogs.
`static void`
`setLog(ILogger logger)`
Sets the logger used by JFace to log errors.
`static void`
`setStatusHandler(StatusHandler status)`
Sets the status handler used by JFace to handle statuses.

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

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

## Field Details

### DEFAULT

public static final boolean DEFAULT
Constant for the the default setting for debug options.

See Also:
  - Constant Field Values

### JFACE

public static final String JFACE
The unique identifier of the JFace plug-in.

See Also:
  - Constant Field Values

### DEBUG_DIALOG_NO_PARENT

public static boolean DEBUG_DIALOG_NO_PARENT
A flag to indicate whether unparented dialogs should be checked.

### TRACE_ACTIONS

public static boolean TRACE_ACTIONS
A flag to indicate whether actions are being traced.

### TRACE_TOOLBAR

public static boolean TRACE_TOOLBAR
A flag to indicate whether toolbars are being traced.

## Constructor Details

### Policy

public Policy()

## Method Details

### setLog

public static void setLog(ILogger logger)
Sets the logger used by JFace to log errors.

Parameters:
  `logger` - the logger to use, or `null` to use the default logger
Since:
  3.1

### getLog

public static ILogger getLog()
Returns the logger used by JFace to log errors.

The default logger prints the status to `System.err`.

Returns:
  the logger
Since:
  3.1

### setStatusHandler

public static void setStatusHandler(StatusHandler status)
Sets the status handler used by JFace to handle statuses.

Parameters:
  `status` - the handler to use, or `null` to use the default one
Since:
  3.4

### getStatusHandler

public static StatusHandler getStatusHandler()
Returns the status handler used by JFace to handle statuses.

Returns:
  the status handler
Since:
  3.4

### getComparator

public static Comparator<Object> getComparator()
Return the comparator used by JFace to sort strings.

Returns:
  the comparator used by JFace to sort strings
Since:
  3.2

### setComparator

public static void setComparator(Comparator<Object> comparator)
Sets the comparator used by JFace to sort strings.

Parameters:
  `comparator` - comparator used by JFace to sort strings
Since:
  3.2

### setAnimatorFactory

@Deprecated(forRemoval=true, since="2025-03") public static void setAnimatorFactory(AnimatorFactory factory)
Deprecated, for removal: This API element is subject to removal in a future version.
this is no longer in use as of 3.3
Sets the animator factory used by JFace to create control animator instances.

Parameters:
  `factory` - the AnimatorFactory to use.
Since:
  3.2

### getAnimatorFactory

@Deprecated(forRemoval=true, since="2025-03") public static AnimatorFactory getAnimatorFactory()
Deprecated, for removal: This API element is subject to removal in a future version.
this is no longer in use as of 3.3
Returns the animator factory used by JFace to create control animator instances.

Returns:
  the animator factory used to create control animator instances.
Since:
  3.2

### setErrorSupportProvider

public static void setErrorSupportProvider(ErrorSupportProvider provider)
Set the error support provider for error dialogs.

Parameters:
  `provider` - provider to set
Since:
  3.3

### getErrorSupportProvider

public static ErrorSupportProvider getErrorSupportProvider()
Return the ErrorSupportProvider for the receiver.

Returns:
  ErrorSupportProvider or `null` if this has not been set
Since:
  3.3

### logException

public static void logException(Exception exception)
Log the Exception to the logger.

Parameters:
  `exception` - exception to log
Since:
  3.4