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
TheHistoricizingDomain
is anIDomain
that uses anIOperationHistory
for executingITransactionalOperations
.
-
-
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 Constructor Description HistoricizingDomain()
Creates a newHistoricizingDomain
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activate()
protected void
activateAdapters()
Activates the adapters registered at thisHistoricizingDomain
.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 givenIGesture
from the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.protected AbstractCompositeOperation
createExecutionTransaction()
Creates aForwardUndoCompositeOperation
which is used to store the operations within an execution transaction.void
deactivate()
protected void
deactivateAdapters()
Deactivates the adapters registered at thisHistoricizingDomain
.void
dispose()
protected void
doActivate()
Activates thisHistoricizingDomain
, which activates its adapters.protected void
doDeactivate()
Deactivates thisHistoricizingDomain
, which deactivates its adapters.void
execute(ITransactionalOperation operation, IProgressMonitor monitor)
Executes the givenIUndoableOperation
.<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 theIGesture
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.IOperationHistory
getOperationHistory()
Returns theIOperationHistory
used by thisHistoricizingDomain
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 theUndoContext
that is used by this domain to execute transactions.java.util.Map<AdapterKey<? extends IViewer>,IViewer>
getViewers()
Returns theIViewer
s registered at thisIDomain
(viaIAdaptable.setAdapter(TypeToken, Object)
) with theAdapterKey
s used for registration.boolean
isActive()
protected boolean
isExecutionTransactionOpen()
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, java.lang.String role)
<T> void
setAdapter(T adapter)
<T> void
setAdapter(T adapter, java.lang.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)
-
-
-
Constructor Detail
-
HistoricizingDomain
public HistoricizingDomain()
Creates a newHistoricizingDomain
instance.
-
-
Method Detail
-
activate
public final void activate()
- Specified by:
activate
in interfaceIActivatable
-
activateAdapters
protected void activateAdapters()
Activates the adapters registered at thisHistoricizingDomain
.
-
activeProperty
public final javafx.beans.property.ReadOnlyBooleanProperty activeProperty()
- Specified by:
activeProperty
in interfaceIActivatable
-
adaptersProperty
public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object> adaptersProperty()
- Specified by:
adaptersProperty
in interfaceIAdaptable
-
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
- 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:
IDomain.openExecutionTransaction(IGesture)
-
createExecutionTransaction
protected AbstractCompositeOperation 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
public <T> T getAdapter(AdapterKey<T> key)
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapter
public <T> T getAdapter(java.lang.Class<T> classKey)
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapter
public <T> T getAdapter(TypeToken<T> key)
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapterKey
public <T> AdapterKey<T> getAdapterKey(T adapter)
- Specified by:
getAdapterKey
in interfaceIAdaptable
-
getAdapters
public javafx.collections.ObservableMap<AdapterKey<?>,java.lang.Object> getAdapters()
- Specified by:
getAdapters
in interfaceIAdaptable
-
getAdapters
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(java.lang.Class<? super T> classKey)
- Specified by:
getAdapters
in interfaceIAdaptable
-
getAdapters
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(TypeToken<? super T> key)
- Specified by:
getAdapters
in interfaceIAdaptable
-
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 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:
IAdaptable.setAdapter(TypeToken, Object)
-
getOperationHistory
public IOperationHistory getOperationHistory()
Returns theIOperationHistory
used by thisHistoricizingDomain
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 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:
IAdaptable.setAdapter(TypeToken, Object)
-
getUndoContext
public IUndoContext getUndoContext()
Returns theUndoContext
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 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:
IAdaptable.setAdapter(TypeToken, Object)
-
isActive
public final boolean isActive()
- Specified by:
isActive
in interfaceIActivatable
-
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
public <T> void setAdapter(T adapter, java.lang.String role)
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
public <T> void setAdapter(TypeToken<T> adapterType, T adapter)
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
@InjectAdapters public <T> void setAdapter(TypeToken<T> adapterType, T adapter, java.lang.String role)
- Specified by:
setAdapter
in interfaceIAdaptable
-
setOperationHistory
@Inject public void setOperationHistory(IOperationHistory operationHistory)
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
@Inject public void setUndoContext(IUndoContext undoContext)
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
-
-