public class HistoricizingDomain extends java.lang.Object implements IDomain
HistoricizingDomain
is an IDomain
that uses an
IOperationHistory
for executing ITransactionalOperations
.Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyBooleanProperty |
active |
javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object> |
adapters |
IAdaptable.Bound<A extends IAdaptable>
CONTENT_VIEWER_ROLE
ADAPTERS_PROPERTY
ACTIVE_PROPERTY
Constructor and Description |
---|
HistoricizingDomain()
Creates a new
HistoricizingDomain instance. |
Modifier and Type | Method and Description |
---|---|
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 tool)
Closes the active execution transaction, removes the given
IGesture
from the transaction context, and opens a new execution transaction if
there are any tools 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(AdapterKey<T> key) |
<T> T |
getAdapter(java.lang.Class<T> classKey) |
<T> T |
getAdapter(com.google.common.reflect.TypeToken<T> key) |
<T> AdapterKey<T> |
getAdapterKey(T adapter) |
javafx.collections.ObservableMap<AdapterKey<?>,java.lang.Object> |
getAdapters()
Gets the value of the property adapters.
|
<T> java.util.Map<AdapterKey<? extends T>,T> |
getAdapters(java.lang.Class<? super T> classKey) |
<T> java.util.Map<AdapterKey<? extends T>,T> |
getAdapters(com.google.common.reflect.TypeToken<? super T> key) |
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()
Returns the
IGesture s registered at this IDomain (via
IAdaptable.setAdapter(TypeToken, Object) ) with the AdapterKey s used
for registration. |
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()
Gets the value of the property active.
|
protected boolean |
isExecutionTransactionOpen()
Returns
true if an execution transaction is currently open. |
boolean |
isExecutionTransactionOpen(org.eclipse.gef.mvc.fx.gestures.IGesture tool)
Returns
true if the given IGesture is taking part in
the currently open execution transaction. |
void |
openExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture tool)
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(T adapter) |
<T> void |
setAdapter(T adapter,
java.lang.String role) |
<T> void |
setAdapter(com.google.common.reflect.TypeToken<T> adapterType,
T adapter) |
<T> void |
setAdapter(com.google.common.reflect.TypeToken<T> adapterType,
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) |
public final javafx.beans.property.ReadOnlyBooleanProperty activeProperty
activeProperty
in interface IActivatable
isActive()
public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object> adaptersProperty
adaptersProperty
in interface IAdaptable
getAdapters()
public HistoricizingDomain()
HistoricizingDomain
instance.public final void activate()
activate
in interface IActivatable
protected void activateAdapters()
HistoricizingDomain
.public final javafx.beans.property.ReadOnlyBooleanProperty activeProperty()
activeProperty
in interface IActivatable
isActive()
public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object> adaptersProperty()
adaptersProperty
in interface IAdaptable
getAdapters()
protected void applyUndoContext(ITransactionalOperation operation)
operation
- The ITransactionalOperation
to apply the
getUndoContext()
to.public void closeExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture tool)
IDomain
IGesture
from the transaction context, and opens a new execution transaction if
there are any tools remaining in the context.closeExecutionTransaction
in interface IDomain
tool
- The IGesture
that should be removed from the transaction
context.IDomain.openExecutionTransaction(IGesture)
protected AbstractCompositeOperation createExecutionTransaction()
ForwardUndoCompositeOperation
which is used to store
the operations within an execution transaction. The operation is opened
on the operation history
.ForwardUndoCompositeOperation
which is configured
to store the operations within an execution transaction.public final void deactivate()
deactivate
in interface IActivatable
protected void deactivateAdapters()
HistoricizingDomain
.public void dispose()
dispose
in interface IDisposable
protected void doActivate()
HistoricizingDomain
, which activates its adapters.protected void doDeactivate()
HistoricizingDomain
, which deactivates its
adapters.public void execute(ITransactionalOperation operation, IProgressMonitor monitor) throws ExecutionException
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
.execute
in interface IDomain
operation
- The IUndoableOperation
to be executed on the
IOperationHistory
of this IDomain
.monitor
- An IProgressMonitor
used to indicate progress. May be
null
.ExecutionException
- In case an exception occurred during the execution of the
operation.public <T> T getAdapter(AdapterKey<T> key)
getAdapter
in interface IAdaptable
public <T> T getAdapter(java.lang.Class<T> classKey)
getAdapter
in interface IAdaptable
public <T> T getAdapter(com.google.common.reflect.TypeToken<T> key)
getAdapter
in interface IAdaptable
public <T> AdapterKey<T> getAdapterKey(T adapter)
getAdapterKey
in interface IAdaptable
public javafx.collections.ObservableMap<AdapterKey<?>,java.lang.Object> getAdapters()
getAdapters
in interface IAdaptable
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(java.lang.Class<? super T> classKey)
getAdapters
in interface IAdaptable
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(com.google.common.reflect.TypeToken<? super T> key)
getAdapters
in interface IAdaptable
public IOperationHistory getOperationHistory()
IOperationHistory
used by this
HistoricizingDomain
to execute transactions.IOperationHistory
.public java.util.Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.gestures.IGesture>,org.eclipse.gef.mvc.fx.gestures.IGesture> getTools()
IDomain
IGesture
s registered at this IDomain
(via
IAdaptable.setAdapter(TypeToken, Object)
) with the AdapterKey
s used
for registration.getTools
in interface IDomain
Map
containing the registered IGesture
s mapped to
their respective AdapterKey
s.IAdaptable.setAdapter(TypeToken, Object)
public IUndoContext getUndoContext()
UndoContext
that is used by this domain to execute
transactions.UndoContext
.public java.util.Map<AdapterKey<? extends IViewer>,IViewer> getViewers()
IDomain
IViewer
s registered at this IDomain
(via
IAdaptable.setAdapter(TypeToken, Object)
) with the AdapterKey
s used
for registration.getViewers
in interface IDomain
Map
containing the registered IViewer
s mapped
to their respective AdapterKey
s.IAdaptable.setAdapter(TypeToken, Object)
public final boolean isActive()
isActive
in interface IActivatable
protected boolean isExecutionTransactionOpen()
true
if an execution transaction is currently open.
Otherwise returns false
.true
if an execution transaction is currently open,
otherwise false
.public boolean isExecutionTransactionOpen(org.eclipse.gef.mvc.fx.gestures.IGesture tool)
IDomain
true
if the given IGesture
is taking part in
the currently open execution transaction. Otherwise returns
false
.isExecutionTransactionOpen
in interface IDomain
tool
- The IGesture
that is checked.true
if the given IGesture
is taking part in
the currently open execution transaction, otherwise
false
.public void openExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture tool)
IDomain
IGesture
to the currently
opened transaction for executing operations (via
IDomain.execute(ITransactionalOperation, IProgressMonitor)
) on the
IOperationHistory
used by this IDomain
.openExecutionTransaction
in interface IDomain
tool
- The IGesture
starting/joining the transaction.public <T> void setAdapter(T adapter)
setAdapter
in interface IAdaptable
public <T> void setAdapter(T adapter, java.lang.String role)
setAdapter
in interface IAdaptable
public <T> void setAdapter(com.google.common.reflect.TypeToken<T> adapterType, T adapter)
setAdapter
in interface IAdaptable
@InjectAdapters public <T> void setAdapter(com.google.common.reflect.TypeToken<T> adapterType, T adapter, java.lang.String role)
setAdapter
in interface IAdaptable
@Inject public void setOperationHistory(IOperationHistory operationHistory)
IOperationHistory
that is used by this
HistoricizingDomain
to the given value. Operation history
listeners are un-/registered accordingly.operationHistory
- The new IOperationHistory
for this domain.@Inject public void setUndoContext(IUndoContext undoContext)
IUndoContext
that is used by this
HistoricizingDomain
to the given value.undoContext
- The new IUndoContext
for this domain.public <T> void unsetAdapter(T adapter)
unsetAdapter
in interface IAdaptable
Copyright (c) 2014, 2016 itemis AG and others. All rights reserved.