Package org.eclipse.gef.mvc.fx.domain

## Class HistoricizingDomain

- java.lang.Object
- - org.eclipse.gef.mvc.fx.domain.HistoricizingDomain

All Implemented Interfaces:
  `IActivatable`, `IAdaptable`, `IDisposable`, `IDomain`

    public class HistoricizingDomain
    extends java.lang.Object
    implements IDomain

The `HistoricizingDomain` is an `IDomain` that uses an `IOperationHistory` for executing `ITransactionalOperations`.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable

`IAdaptable.Bound<A extends IAdaptable>`

### Field Summary

### Fields inherited from interface org.eclipse.gef.common.activate.IActivatable

`ACTIVE_PROPERTY`

### Fields inherited from interface org.eclipse.gef.common.adapt.IAdaptable

`ADAPTERS_PROPERTY`

### Fields inherited from interface org.eclipse.gef.mvc.fx.domain.IDomain

`CONTENT_VIEWER_ROLE`

### Constructor Summary

Constructors
`HistoricizingDomain()` Creates a new `HistoricizingDomain` instance.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `activate()`
`protected void` `activateAdapters()` Activates the adapters registered at this `HistoricizingDomain`.
`javafx.beans.property.ReadOnlyBooleanProperty` `activeProperty()`
`javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,​java.lang.Object>` `adaptersProperty()`
`protected void` `applyUndoContext​(ITransactionalOperation operation)` Applies the undo context to the given operation.
`void` `closeExecutionTransaction​(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)` Closes the active execution transaction, removes the given `IGesture` from the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.
`protected AbstractCompositeOperation` `createExecutionTransaction()` Creates a `ForwardUndoCompositeOperation` which is used to store the operations within an execution transaction.
`void` `deactivate()`
`protected void` `deactivateAdapters()` Deactivates the adapters registered at this `HistoricizingDomain`.
`void` `dispose()`
`protected void` `doActivate()` Activates this `HistoricizingDomain`, which activates its adapters.
`protected void` `doDeactivate()` Deactivates this `HistoricizingDomain`, which deactivates its adapters.
`void` `execute​(ITransactionalOperation operation, IProgressMonitor monitor)` Executes the given `IUndoableOperation`.
`<T> T` `getAdapter​(TypeToken<T> key)`
`<T> T` `getAdapter​(java.lang.Class<T> classKey)`
`<T> T` `getAdapter​(AdapterKey<T> key)`
`<T> AdapterKey<T>` `getAdapterKey​(T adapter)`
`javafx.collections.ObservableMap<AdapterKey<?>,​java.lang.Object>` `getAdapters()`
`<T> java.util.Map<AdapterKey<? extends T>,​T>` `getAdapters​(TypeToken<? super T> key)`
`<T> java.util.Map<AdapterKey<? extends T>,​T>` `getAdapters​(java.lang.Class<? super T> classKey)`
`java.util.Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,​org.eclipse.gef.mvc.fx.gestures.IGesture>` `getGestures()` Returns the `IGesture`s registered at this `IDomain` (via `IAdaptable.setAdapter(TypeToken, Object)`) with the `AdapterKey`s used for registration.
`IOperationHistory` `getOperationHistory()` Returns the `IOperationHistory` used by this `HistoricizingDomain` to execute transactions.
`java.util.Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,​org.eclipse.gef.mvc.fx.gestures.IGesture>` `getTools()` Deprecated. Will be removed in 6.0.0.
`IUndoContext` `getUndoContext()` Returns the `UndoContext` that is used by this domain to execute transactions.
`java.util.Map<AdapterKey<? extends IViewer>,​IViewer>` `getViewers()` Returns the `IViewer`s registered at this `IDomain` (via `IAdaptable.setAdapter(TypeToken, Object)`) with the `AdapterKey`s used for registration.
`boolean` `isActive()`
`protected boolean` `isExecutionTransactionOpen()` Returns `true` if an execution transaction is currently open.
`boolean` `isExecutionTransactionOpen​(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)` Returns `true` if the given `IGesture` is taking part in the currently open execution transaction.
`void` `openExecutionTransaction​(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)` Opens a new transaction or adds the given `IGesture` to the currently opened transaction for executing operations (via `IDomain.execute(ITransactionalOperation, IProgressMonitor)`) on the `IOperationHistory` used by this `IDomain`.
`<T> void` `setAdapter​(TypeToken<T> adapterType, T adapter)`
`<T> void` `setAdapter​(TypeToken<T> adapterType, T adapter, java.lang.String role)`
`<T> void` `setAdapter​(T adapter)`
`<T> void` `setAdapter​(T adapter, java.lang.String role)`
`void` `setOperationHistory​(IOperationHistory operationHistory)` Sets the `IOperationHistory` that is used by this `HistoricizingDomain` to the given value.
`void` `setUndoContext​(IUndoContext undoContext)` Sets the `IUndoContext` that is used by this `HistoricizingDomain` to the given value.
`<T> void` `unsetAdapter​(T adapter)`

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

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

### Constructor Detail

#### HistoricizingDomain

    public HistoricizingDomain()

Creates a new `HistoricizingDomain` instance.

### Method Detail

#### activate

    public final void activate()

Specified by:
  `activate` in interface `IActivatable`

#### activateAdapters

    protected void activateAdapters()

Activates the adapters registered at this `HistoricizingDomain`.

#### activeProperty

    public final javafx.beans.property.ReadOnlyBooleanProperty activeProperty()

Specified by:
  `activeProperty` in interface `IActivatable`

#### adaptersProperty

    public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,​java.lang.Object> adaptersProperty()

Specified by:
  `adaptersProperty` in interface `IAdaptable`

#### applyUndoContext

    protected void applyUndoContext​(ITransactionalOperation operation)

Applies the undo context to the given operation. May be overwritten by clients to filter out operations that should not be undoable in the given context.

Parameters:
  `operation` - The `ITransactionalOperation` to apply the `getUndoContext()` to.

#### closeExecutionTransaction

    public void closeExecutionTransaction​(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)

Description copied from interface: `IDomain`
Closes the active execution transaction, removes the given `IGesture` from the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.

Specified by:
  `closeExecutionTransaction` in interface `IDomain`
Parameters:
  `gesture` - The `IGesture` that should be removed from the transaction context.
See Also:
  `IDomain.openExecutionTransaction(IGesture)`

#### createExecutionTransaction

    protected AbstractCompositeOperation createExecutionTransaction()

Creates a `ForwardUndoCompositeOperation` which is used to store the operations within an execution transaction. The operation is opened on the `operation history`.

Returns:
  A new `ForwardUndoCompositeOperation` which is configured to store the operations within an execution transaction.

#### deactivate

    public final void deactivate()

Specified by:
  `deactivate` in interface `IActivatable`

#### deactivateAdapters

    protected void deactivateAdapters()

Deactivates the adapters registered at this `HistoricizingDomain`.

#### dispose

    public void dispose()

Specified by:
  `dispose` in interface `IDisposable`

#### doActivate

    protected void doActivate()

Activates this `HistoricizingDomain`, which activates its adapters.

#### doDeactivate

    protected void doDeactivate()

Deactivates this `HistoricizingDomain`, which deactivates its adapters.

#### execute

    public void execute​(ITransactionalOperation operation,
                        IProgressMonitor monitor)
                 throws ExecutionException

Executes the given `IUndoableOperation`. In case an execution transaction is currently open (see `openExecutionTransaction(IGesture)`, `closeExecutionTransaction(IGesture)`) the enclosing transaction will refer to the `IUndoContext` used by this `IDomain`) (so that no specific `IUndoContext` is set on the passed in `IUndoableOperation`). If no transaction is currently open, the `IUndoContext` of this `IDomain` will be set on the passed in `IUndoableOperation`.

Specified by:
  `execute` in interface `IDomain`
Parameters:
  `operation` - The `IUndoableOperation` to be executed on the `IOperationHistory` of this `IDomain`.
  `monitor` - An `IProgressMonitor` used to indicate progress. May be `null`.
Throws:
  `ExecutionException` - In case an exception occurred during the execution of the operation.

#### getAdapter

    public <T> T getAdapter​(AdapterKey<T> key)

Specified by:
  `getAdapter` in interface `IAdaptable`

#### getAdapter

    public <T> T getAdapter​(java.lang.Class<T> classKey)

Specified by:
  `getAdapter` in interface `IAdaptable`

#### getAdapter

    public <T> T getAdapter​(TypeToken<T> key)

Specified by:
  `getAdapter` in interface `IAdaptable`

#### getAdapterKey

    public <T> AdapterKey<T> getAdapterKey​(T adapter)

Specified by:
  `getAdapterKey` in interface `IAdaptable`

#### getAdapters

    public javafx.collections.ObservableMap<AdapterKey<?>,​java.lang.Object> getAdapters()

Specified by:
  `getAdapters` in interface `IAdaptable`

#### getAdapters

    public <T> java.util.Map<AdapterKey<? extends T>,​T> getAdapters​(java.lang.Class<? super T> classKey)

Specified by:
  `getAdapters` in interface `IAdaptable`

#### getAdapters

    public <T> java.util.Map<AdapterKey<? extends T>,​T> getAdapters​(TypeToken<? super T> key)

Specified by:
  `getAdapters` in interface `IAdaptable`

#### getGestures

    public java.util.Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,​org.eclipse.gef.mvc.fx.gestures.IGesture> getGestures()

Description copied from interface: `IDomain`
Returns the `IGesture`s registered at this `IDomain` (via `IAdaptable.setAdapter(TypeToken, Object)`) with the `AdapterKey`s used for registration.

Specified by:
  `getGestures` in interface `IDomain`
Returns:
  A `Map` containing the registered `IGesture`s mapped to their respective `AdapterKey`s.
See Also:
  `IAdaptable.setAdapter(TypeToken, Object)`

#### getOperationHistory

    public IOperationHistory getOperationHistory()

Returns the `IOperationHistory` used by this `HistoricizingDomain` to execute transactions.

Returns:
  The `IOperationHistory`.

#### getTools

    @Deprecated
    public java.util.Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,​org.eclipse.gef.mvc.fx.gestures.IGesture> getTools()

Deprecated.
Will be removed in 6.0.0. Please use `getGestures()` instead.
Returns the `IGesture`s registered at this `IDomain` (via `IAdaptable.setAdapter(TypeToken, Object)`) with the `AdapterKey`s used for registration.

Specified by:
  `getTools` in interface `IDomain`
Returns:
  A `Map` containing the registered `IGesture`s mapped to their respective `AdapterKey`s.
See Also:
  `IAdaptable.setAdapter(TypeToken, Object)`

#### getUndoContext

    public IUndoContext getUndoContext()

Returns the `UndoContext` that is used by this domain to execute transactions.

Returns:
  The `UndoContext`.

#### getViewers

    public java.util.Map<AdapterKey<? extends IViewer>,​IViewer> getViewers()

Description copied from interface: `IDomain`
Returns the `IViewer`s registered at this `IDomain` (via `IAdaptable.setAdapter(TypeToken, Object)`) with the `AdapterKey`s used for registration.

Specified by:
  `getViewers` in interface `IDomain`
Returns:
  A `Map` containing the registered `IViewer`s mapped to their respective `AdapterKey`s.
See Also:
  `IAdaptable.setAdapter(TypeToken, Object)`

#### isActive

    public final boolean isActive()

Specified by:
  `isActive` in interface `IActivatable`

#### isExecutionTransactionOpen

    protected boolean isExecutionTransactionOpen()

Returns `true` if an execution transaction is currently open. Otherwise returns `false`.

Returns:
  `true` if an execution transaction is currently open, otherwise `false`.

#### isExecutionTransactionOpen

    public boolean isExecutionTransactionOpen​(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)

Description copied from interface: `IDomain`
Returns `true` if the given `IGesture` is taking part in the currently open execution transaction. Otherwise returns `false`.

Specified by:
  `isExecutionTransactionOpen` in interface `IDomain`
Parameters:
  `gesture` - The `IGesture` that is checked.
Returns:
  `true` if the given `IGesture` is taking part in the currently open execution transaction, otherwise `false`.

#### openExecutionTransaction

    public void openExecutionTransaction​(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)

Description copied from interface: `IDomain`
Opens a new transaction or adds the given `IGesture` to the currently opened transaction for executing operations (via `IDomain.execute(ITransactionalOperation, IProgressMonitor)`) on the `IOperationHistory` used by this `IDomain`.

Specified by:
  `openExecutionTransaction` in interface `IDomain`
Parameters:
  `gesture` - The `IGesture` starting/joining the transaction.

#### setAdapter

    public <T> void setAdapter​(T adapter)

Specified by:
  `setAdapter` in interface `IAdaptable`

#### setAdapter

    public <T> void setAdapter​(T adapter,
                               java.lang.String role)

Specified by:
  `setAdapter` in interface `IAdaptable`

#### setAdapter

    public <T> void setAdapter​(TypeToken<T> adapterType,
                               T adapter)

Specified by:
  `setAdapter` in interface `IAdaptable`

#### setAdapter

    @InjectAdapters
    public <T> void setAdapter​(TypeToken<T> adapterType,
                               T adapter,
                               java.lang.String role)

Specified by:
  `setAdapter` in interface `IAdaptable`

#### setOperationHistory

    @Inject
    public void setOperationHistory​(IOperationHistory operationHistory)

Sets the `IOperationHistory` that is used by this `HistoricizingDomain` to the given value. Operation history listeners are un-/registered accordingly.

Parameters:
  `operationHistory` - The new `IOperationHistory` for this domain.

#### setUndoContext

    @Inject
    public void setUndoContext​(IUndoContext undoContext)

Sets the `IUndoContext` that is used by this `HistoricizingDomain` to the given value.

Parameters:
  `undoContext` - The new `IUndoContext` for this domain.

#### unsetAdapter

    public <T> void unsetAdapter​(T adapter)

Specified by:
  `unsetAdapter` in interface `IAdaptable`