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
TheHistoricizingDomainis anIDomainthat uses anIOperationHistoryfor 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 newHistoricizingDomaininstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivate()protected voidactivateAdapters()Activates the adapters registered at thisHistoricizingDomain.javafx.beans.property.ReadOnlyBooleanPropertyactiveProperty()javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object>adaptersProperty()protected voidapplyUndoContext(ITransactionalOperation operation)Applies the undo context to the given operation.voidcloseExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)Closes the active execution transaction, removes the givenIGesturefrom the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.protected AbstractCompositeOperationcreateExecutionTransaction()Creates aForwardUndoCompositeOperationwhich is used to store the operations within an execution transaction.voiddeactivate()protected voiddeactivateAdapters()Deactivates the adapters registered at thisHistoricizingDomain.voiddispose()protected voiddoActivate()Activates thisHistoricizingDomain, which activates its adapters.protected voiddoDeactivate()Deactivates thisHistoricizingDomain, which deactivates its adapters.voidexecute(ITransactionalOperation operation, IProgressMonitor monitor)Executes the givenIUndoableOperation.<T> TgetAdapter(TypeToken<T> key)<T> TgetAdapter(java.lang.Class<T> classKey)<T> TgetAdapter(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 theIGestures registered at thisIDomain(viaIAdaptable.setAdapter(TypeToken, Object)) with theAdapterKeys used for registration.IOperationHistorygetOperationHistory()Returns theIOperationHistoryused by thisHistoricizingDomainto 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.IUndoContextgetUndoContext()Returns theUndoContextthat is used by this domain to execute transactions.java.util.Map<AdapterKey<? extends IViewer>,IViewer>getViewers()Returns theIViewers registered at thisIDomain(viaIAdaptable.setAdapter(TypeToken, Object)) with theAdapterKeys used for registration.booleanisActive()protected booleanisExecutionTransactionOpen()Returnstrueif an execution transaction is currently open.booleanisExecutionTransactionOpen(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)Returnstrueif the givenIGestureis taking part in the currently open execution transaction.voidopenExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)Opens a new transaction or adds the givenIGestureto the currently opened transaction for executing operations (viaIDomain.execute(ITransactionalOperation, IProgressMonitor)) on theIOperationHistoryused by thisIDomain.<T> voidsetAdapter(TypeToken<T> adapterType, T adapter)<T> voidsetAdapter(TypeToken<T> adapterType, T adapter, java.lang.String role)<T> voidsetAdapter(T adapter)<T> voidsetAdapter(T adapter, java.lang.String role)voidsetOperationHistory(IOperationHistory operationHistory)Sets theIOperationHistorythat is used by thisHistoricizingDomainto the given value.voidsetUndoContext(IUndoContext undoContext)Sets theIUndoContextthat is used by thisHistoricizingDomainto the given value.<T> voidunsetAdapter(T adapter)
-
-
-
Constructor Detail
-
HistoricizingDomain
public HistoricizingDomain()
Creates a newHistoricizingDomaininstance.
-
-
Method Detail
-
activate
public final void activate()
- Specified by:
activatein interfaceIActivatable
-
activateAdapters
protected void activateAdapters()
Activates the adapters registered at thisHistoricizingDomain.
-
activeProperty
public final javafx.beans.property.ReadOnlyBooleanProperty activeProperty()
- Specified by:
activePropertyin interfaceIActivatable
-
adaptersProperty
public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object> adaptersProperty()
- Specified by:
adaptersPropertyin 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- TheITransactionalOperationto apply thegetUndoContext()to.
-
closeExecutionTransaction
public void closeExecutionTransaction(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)
Description copied from interface:IDomainCloses the active execution transaction, removes the givenIGesturefrom the transaction context, and opens a new execution transaction if there are any gestures remaining in the context.- Specified by:
closeExecutionTransactionin interfaceIDomain- Parameters:
gesture- TheIGesturethat should be removed from the transaction context.- See Also:
IDomain.openExecutionTransaction(IGesture)
-
createExecutionTransaction
protected AbstractCompositeOperation createExecutionTransaction()
Creates aForwardUndoCompositeOperationwhich is used to store the operations within an execution transaction. The operation is opened on theoperation history.- Returns:
- A new
ForwardUndoCompositeOperationwhich is configured to store the operations within an execution transaction.
-
deactivate
public final void deactivate()
- Specified by:
deactivatein interfaceIActivatable
-
deactivateAdapters
protected void deactivateAdapters()
Deactivates the adapters registered at thisHistoricizingDomain.
-
dispose
public void dispose()
- Specified by:
disposein 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 theIUndoContextused by thisIDomain) (so that no specificIUndoContextis set on the passed inIUndoableOperation). If no transaction is currently open, theIUndoContextof thisIDomainwill be set on the passed inIUndoableOperation.- Specified by:
executein interfaceIDomain- Parameters:
operation- TheIUndoableOperationto be executed on theIOperationHistoryof thisIDomain.monitor- AnIProgressMonitorused 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:
getAdapterin interfaceIAdaptable
-
getAdapter
public <T> T getAdapter(java.lang.Class<T> classKey)
- Specified by:
getAdapterin interfaceIAdaptable
-
getAdapter
public <T> T getAdapter(TypeToken<T> key)
- Specified by:
getAdapterin interfaceIAdaptable
-
getAdapterKey
public <T> AdapterKey<T> getAdapterKey(T adapter)
- Specified by:
getAdapterKeyin interfaceIAdaptable
-
getAdapters
public javafx.collections.ObservableMap<AdapterKey<?>,java.lang.Object> getAdapters()
- Specified by:
getAdaptersin interfaceIAdaptable
-
getAdapters
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(java.lang.Class<? super T> classKey)
- Specified by:
getAdaptersin interfaceIAdaptable
-
getAdapters
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(TypeToken<? super T> key)
- Specified by:
getAdaptersin 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:IDomainReturns theIGestures registered at thisIDomain(viaIAdaptable.setAdapter(TypeToken, Object)) with theAdapterKeys used for registration.- Specified by:
getGesturesin interfaceIDomain- Returns:
- A
Mapcontaining the registeredIGestures mapped to their respectiveAdapterKeys. - See Also:
IAdaptable.setAdapter(TypeToken, Object)
-
getOperationHistory
public IOperationHistory getOperationHistory()
Returns theIOperationHistoryused by thisHistoricizingDomainto 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 theIGestures registered at thisIDomain(viaIAdaptable.setAdapter(TypeToken, Object)) with theAdapterKeys used for registration.- Specified by:
getToolsin interfaceIDomain- Returns:
- A
Mapcontaining the registeredIGestures mapped to their respectiveAdapterKeys. - See Also:
IAdaptable.setAdapter(TypeToken, Object)
-
getUndoContext
public IUndoContext getUndoContext()
Returns theUndoContextthat 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:IDomainReturns theIViewers registered at thisIDomain(viaIAdaptable.setAdapter(TypeToken, Object)) with theAdapterKeys used for registration.- Specified by:
getViewersin interfaceIDomain- Returns:
- A
Mapcontaining the registeredIViewers mapped to their respectiveAdapterKeys. - See Also:
IAdaptable.setAdapter(TypeToken, Object)
-
isActive
public final boolean isActive()
- Specified by:
isActivein interfaceIActivatable
-
isExecutionTransactionOpen
protected boolean isExecutionTransactionOpen()
Returnstrueif an execution transaction is currently open. Otherwise returnsfalse.- Returns:
trueif an execution transaction is currently open, otherwisefalse.
-
isExecutionTransactionOpen
public boolean isExecutionTransactionOpen(org.eclipse.gef.mvc.fx.gestures.IGesture gesture)
Description copied from interface:IDomainReturnstrueif the givenIGestureis taking part in the currently open execution transaction. Otherwise returnsfalse.- Specified by:
isExecutionTransactionOpenin interfaceIDomain- Parameters:
gesture- TheIGesturethat is checked.- Returns:
trueif the givenIGestureis 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:IDomainOpens a new transaction or adds the givenIGestureto the currently opened transaction for executing operations (viaIDomain.execute(ITransactionalOperation, IProgressMonitor)) on theIOperationHistoryused by thisIDomain.- Specified by:
openExecutionTransactionin interfaceIDomain- Parameters:
gesture- TheIGesturestarting/joining the transaction.
-
setAdapter
public <T> void setAdapter(T adapter)
- Specified by:
setAdapterin interfaceIAdaptable
-
setAdapter
public <T> void setAdapter(T adapter, java.lang.String role)- Specified by:
setAdapterin interfaceIAdaptable
-
setAdapter
public <T> void setAdapter(TypeToken<T> adapterType, T adapter)
- Specified by:
setAdapterin interfaceIAdaptable
-
setAdapter
@InjectAdapters public <T> void setAdapter(TypeToken<T> adapterType, T adapter, java.lang.String role)
- Specified by:
setAdapterin interfaceIAdaptable
-
setOperationHistory
@Inject public void setOperationHistory(IOperationHistory operationHistory)
Sets theIOperationHistorythat is used by thisHistoricizingDomainto the given value. Operation history listeners are un-/registered accordingly.- Parameters:
operationHistory- The newIOperationHistoryfor this domain.
-
setUndoContext
@Inject public void setUndoContext(IUndoContext undoContext)
Sets theIUndoContextthat is used by thisHistoricizingDomainto the given value.- Parameters:
undoContext- The newIUndoContextfor this domain.
-
unsetAdapter
public <T> void unsetAdapter(T adapter)
- Specified by:
unsetAdapterin interfaceIAdaptable
-
-