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
The
HistoricizingDomain
is an IDomain
that uses an
IOperationHistory
for executing ITransactionalOperations
.-
Property Summary
-
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
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
activate()
protected void
Activates the adapters registered at thisHistoricizingDomain
.final ReadOnlyBooleanProperty
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 givenIGesture
from the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.protected AbstractCompositeOperation
Creates aForwardUndoCompositeOperation
which is used to store the operations within an execution transaction.final void
protected void
Deactivates the adapters registered at thisHistoricizingDomain
.void
dispose()
protected void
Activates thisHistoricizingDomain
, which activates its adapters.protected void
Deactivates thisHistoricizingDomain
, which deactivates its adapters.void
execute
(ITransactionalOperation operation, IProgressMonitor monitor) Executes the givenIUndoableOperation
.<T> T
getAdapter
(TypeToken<T> key) <T> T
getAdapter
(Class<T> classKey) <T> T
getAdapter
(AdapterKey<T> key) <T> AdapterKey<T>
getAdapterKey
(T adapter) Gets the value of the property adapters.<T> Map<AdapterKey<? extends T>,
T> getAdapters
(TypeToken<? super T> key) <T> Map<AdapterKey<? extends T>,
T> getAdapters
(Class<? super T> classKey) Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,
org.eclipse.gef.mvc.fx.gestures.IGesture> Returns theIGesture
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.Returns theIOperationHistory
used by thisHistoricizingDomain
to execute transactions.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.Returns theUndoContext
that is used by this domain to execute transactions.Map<AdapterKey<? extends IViewer>,
IViewer> Returns theIViewer
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.final boolean
isActive()
Gets the value of the property active.protected boolean
Returnstrue
if an execution transaction is currently open.boolean
isExecutionTransactionOpen
(org.eclipse.gef.mvc.fx.gestures.IGesture gesture) Returnstrue
if the givenIGesture
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 givenIGesture
to the currently opened transaction for executing operations (viaIDomain.execute(ITransactionalOperation, IProgressMonitor)
) on theIOperationHistory
used by thisIDomain
.<T> void
setAdapter
(TypeToken<T> adapterType, T adapter) <T> void
setAdapter
(TypeToken<T> adapterType, T adapter, String role) <T> void
setAdapter
(T adapter) <T> void
setAdapter
(T adapter, String role) void
setOperationHistory
(IOperationHistory operationHistory) Sets theIOperationHistory
that is used by thisHistoricizingDomain
to the given value.void
setUndoContext
(IUndoContext undoContext) Sets theIUndoContext
that is used by thisHistoricizingDomain
to the given value.<T> void
unsetAdapter
(T adapter)
-
Property Details
-
active
- Specified by:
activeProperty
in interfaceIActivatable
- See Also:
-
adapters
- Specified by:
adaptersProperty
in interfaceIAdaptable
- See Also:
-
-
Constructor Details
-
HistoricizingDomain
public HistoricizingDomain()Creates a newHistoricizingDomain
instance.
-
-
Method Details
-
activate
public final void activate()- Specified by:
activate
in interfaceIActivatable
-
activateAdapters
protected void activateAdapters()Activates the adapters registered at thisHistoricizingDomain
. -
activeProperty
- Specified by:
activeProperty
in interfaceIActivatable
- See Also:
-
adaptersProperty
- Specified by:
adaptersProperty
in interfaceIAdaptable
- See Also:
-
applyUndoContext
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
- TheITransactionalOperation
to apply thegetUndoContext()
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 givenIGesture
from the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.- Specified by:
closeExecutionTransaction
in interfaceIDomain
- Parameters:
gesture
- TheIGesture
that should be removed from the transaction context.- See Also:
-
createExecutionTransaction
Creates aForwardUndoCompositeOperation
which is used to store the operations within an execution transaction. The operation is opened on theoperation 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 interfaceIActivatable
-
deactivateAdapters
protected void deactivateAdapters()Deactivates the adapters registered at thisHistoricizingDomain
. -
dispose
public void dispose()- Specified by:
dispose
in interfaceIDisposable
-
doActivate
protected void doActivate()Activates thisHistoricizingDomain
, which activates its adapters. -
doDeactivate
protected void doDeactivate()Deactivates thisHistoricizingDomain
, which deactivates its adapters. -
execute
public void execute(ITransactionalOperation operation, IProgressMonitor monitor) throws ExecutionException Executes the givenIUndoableOperation
. In case an execution transaction is currently open (seeopenExecutionTransaction(IGesture)
,closeExecutionTransaction(IGesture)
) the enclosing transaction will refer to theIUndoContext
used by thisIDomain
) (so that no specificIUndoContext
is set on the passed inIUndoableOperation
). If no transaction is currently open, theIUndoContext
of thisIDomain
will be set on the passed inIUndoableOperation
.- Specified by:
execute
in interfaceIDomain
- Parameters:
operation
- TheIUndoableOperation
to be executed on theIOperationHistory
of thisIDomain
.monitor
- AnIProgressMonitor
used to indicate progress. May benull
.- Throws:
ExecutionException
- In case an exception occurred during the execution of the operation.
-
getAdapter
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapter
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapter
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapterKey
- Specified by:
getAdapterKey
in interfaceIAdaptable
-
getAdapters
Gets the value of the property adapters.- Specified by:
getAdapters
in interfaceIAdaptable
- Property description:
-
getAdapters
- Specified by:
getAdapters
in interfaceIAdaptable
-
getAdapters
- Specified by:
getAdapters
in interfaceIAdaptable
-
getGestures
public Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,org.eclipse.gef.mvc.fx.gestures.IGesture> getGestures()Description copied from interface:IDomain
Returns theIGesture
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.- Specified by:
getGestures
in interfaceIDomain
- Returns:
- A
Map
containing the registeredIGesture
s mapped to their respectiveAdapterKey
s. - See Also:
-
getOperationHistory
Returns theIOperationHistory
used by thisHistoricizingDomain
to execute transactions.- Returns:
- The
IOperationHistory
.
-
getTools
@Deprecated public 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 usegetGestures()
instead.Returns theIGesture
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.- Specified by:
getTools
in interfaceIDomain
- Returns:
- A
Map
containing the registeredIGesture
s mapped to their respectiveAdapterKey
s. - See Also:
-
getUndoContext
Returns theUndoContext
that is used by this domain to execute transactions.- Returns:
- The
UndoContext
.
-
getViewers
Description copied from interface:IDomain
Returns theIViewer
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.- Specified by:
getViewers
in interfaceIDomain
- Returns:
- A
Map
containing the registeredIViewer
s mapped to their respectiveAdapterKey
s. - See Also:
-
isActive
public final boolean isActive()Gets the value of the property active.- Specified by:
isActive
in interfaceIActivatable
- Property description:
-
isExecutionTransactionOpen
protected boolean isExecutionTransactionOpen()Returnstrue
if an execution transaction is currently open. Otherwise returnsfalse
.- Returns:
true
if an execution transaction is currently open, otherwisefalse
.
-
isExecutionTransactionOpen
public boolean isExecutionTransactionOpen(org.eclipse.gef.mvc.fx.gestures.IGesture gesture) Description copied from interface:IDomain
Returnstrue
if the givenIGesture
is taking part in the currently open execution transaction. Otherwise returnsfalse
.- Specified by:
isExecutionTransactionOpen
in interfaceIDomain
- Parameters:
gesture
- TheIGesture
that is checked.- Returns:
true
if the givenIGesture
is taking part in the currently open execution transaction, otherwisefalse
.
-
openExecutionTransaction
public void openExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture gesture) Description copied from interface:IDomain
Opens a new transaction or adds the givenIGesture
to the currently opened transaction for executing operations (viaIDomain.execute(ITransactionalOperation, IProgressMonitor)
) on theIOperationHistory
used by thisIDomain
.- Specified by:
openExecutionTransaction
in interfaceIDomain
- Parameters:
gesture
- TheIGesture
starting/joining the transaction.
-
setAdapter
public <T> void setAdapter(T adapter) - Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
- Specified by:
setAdapter
in interfaceIAdaptable
-
setOperationHistory
Sets theIOperationHistory
that is used by thisHistoricizingDomain
to the given value. Operation history listeners are un-/registered accordingly.- Parameters:
operationHistory
- The newIOperationHistory
for this domain.
-
setUndoContext
Sets theIUndoContext
that is used by thisHistoricizingDomain
to the given value.- Parameters:
undoContext
- The newIUndoContext
for this domain.
-
unsetAdapter
public <T> void unsetAdapter(T adapter) - Specified by:
unsetAdapter
in interfaceIAdaptable
-