Package com._1c.g5.v8.dt.core
Class V8Commands.ReadOnlyEditingContextWrapper
- java.lang.Object
-
- com._1c.g5.v8.dt.core.V8Commands.ReadOnlyEditingContextWrapper
-
- All Implemented Interfaces:
IBmEditingContext
,IBmLocalEditingContext
- Enclosing class:
- V8Commands
public static final class V8Commands.ReadOnlyEditingContextWrapper extends Object implements IBmLocalEditingContext
Special wrapper around theIBmLocalEditingContext
which notifies the V8Commands infrastructure that change commands should be omitted in order to simulate the read-only behavior of editors. Used as a basic level read-only support for non-conventional editors (like DCS, etc).
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyEditingContextWrapper(IBmLocalEditingContext sourceContext)
Initializes the instance of theV8Commands.ReadOnlyEditingContextWrapper
with source editing context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStateListener(IBmEditingContextStateListener listener)
Adds the given state listener to the editing context.boolean
canRedo()
Checks if undo operation can be performed.boolean
canUndo()
Checks if undo operation can be performed.void
dispose()
Disposes the editing context.<T> T
execute(IBmTask<T> task)
Executes the giventask
.IBmModel
getModel()
Gets the corresponding model.org.eclipse.core.commands.operations.IUndoContext
getUndoContext()
Returns theIUndoContext
instance corresponding to the editing context.boolean
isDirty()
Checks if the editing context is in the 'unsaved' state.boolean
isDisposed()
Checks whether the editing context is disposed.void
redo()
Performs the redo operation.void
removeStateListener(IBmEditingContextStateListener listener)
Removes the given state listener from the editing context.void
save()
Saves the editing context asynchronously.void
save(boolean sync)
Saves the editing context.void
undo()
Performs the undo operation.
-
-
-
Constructor Detail
-
ReadOnlyEditingContextWrapper
public ReadOnlyEditingContextWrapper(IBmLocalEditingContext sourceContext)
Initializes the instance of theV8Commands.ReadOnlyEditingContextWrapper
with source editing context.- Parameters:
sourceContext
- Source editing context. Cannot benull
.
-
-
Method Detail
-
execute
public <T> T execute(IBmTask<T> task)
Description copied from interface:IBmEditingContext
Executes the given
task
.- If the task execution causes the transaction deadlock (throw
BmDeadlockDetectedException
), the transaction is rolled back, and the task executed again. - If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
- If the task throws any exception other than
BmDeadlockDetectedException
it is re-thrown.
- Specified by:
execute
in interfaceIBmEditingContext
- Parameters:
task
- The task to execute. May benull
.- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method.
- If the task execution causes the transaction deadlock (throw
-
getModel
public IBmModel getModel()
Description copied from interface:IBmEditingContext
Gets the corresponding model.- Specified by:
getModel
in interfaceIBmEditingContext
- Returns:
- the corresponding model.
-
canUndo
public boolean canUndo()
Description copied from interface:IBmLocalEditingContext
Checks if undo operation can be performed.- Specified by:
canUndo
in interfaceIBmLocalEditingContext
- Returns:
true
if undo operation can be performed,false
otherwise.
-
canRedo
public boolean canRedo()
Description copied from interface:IBmLocalEditingContext
Checks if undo operation can be performed.- Specified by:
canRedo
in interfaceIBmLocalEditingContext
- Returns:
true
if redo operation can be performed,false
otherwise.
-
undo
public void undo()
Description copied from interface:IBmLocalEditingContext
Performs the undo operation. Throws an exception if undo operation cannot be performed.- Specified by:
undo
in interfaceIBmLocalEditingContext
-
redo
public void redo()
Description copied from interface:IBmLocalEditingContext
Performs the redo operation. Throws an exception if redo operation cannot be performed.- Specified by:
redo
in interfaceIBmLocalEditingContext
-
isDirty
public boolean isDirty()
Description copied from interface:IBmLocalEditingContext
Checks if the editing context is in the 'unsaved' state.- Specified by:
isDirty
in interfaceIBmLocalEditingContext
- Returns:
true
if the editing context is in dirty state,false
otherwise.
-
save
public void save()
Description copied from interface:IBmLocalEditingContext
Saves the editing context asynchronously. It writes modified in tasks objects into resources.- Specified by:
save
in interfaceIBmLocalEditingContext
-
save
public void save(boolean sync)
Description copied from interface:IBmLocalEditingContext
Saves the editing context. It writes modified in tasks objects into resources.- Specified by:
save
in interfaceIBmLocalEditingContext
- Parameters:
sync
- The flag indicating whether the editing context will be saved synchronously.
-
dispose
public void dispose()
Description copied from interface:IBmLocalEditingContext
Disposes the editing context.- Specified by:
dispose
in interfaceIBmLocalEditingContext
-
addStateListener
public void addStateListener(IBmEditingContextStateListener listener)
Description copied from interface:IBmLocalEditingContext
Adds the given state listener to the editing context.- Specified by:
addStateListener
in interfaceIBmLocalEditingContext
- Parameters:
listener
- The state listener. May not benull
-
removeStateListener
public void removeStateListener(IBmEditingContextStateListener listener)
Description copied from interface:IBmLocalEditingContext
Removes the given state listener from the editing context.- Specified by:
removeStateListener
in interfaceIBmLocalEditingContext
- Parameters:
listener
- The state listener. May not benull
.
-
getUndoContext
public org.eclipse.core.commands.operations.IUndoContext getUndoContext()
Description copied from interface:IBmLocalEditingContext
Returns theIUndoContext
instance corresponding to the editing context.- Specified by:
getUndoContext
in interfaceIBmLocalEditingContext
- Returns:
- the
IUndoContext
instance.
-
isDisposed
public boolean isDisposed()
Description copied from interface:IBmLocalEditingContext
Checks whether the editing context is disposed.- Specified by:
isDisposed
in interfaceIBmLocalEditingContext
- Returns:
true
if the editing context is disposed,false
otherwise
-
-