Package jetbrains.mps.smodel
Class AbstractModelAccess
- java.lang.Object
 - 
- jetbrains.mps.smodel.AbstractModelAccess
 
 
- 
- All Implemented Interfaces:
 ModelAccess
- Direct Known Subclasses:
 ModelAccess
public abstract class AbstractModelAccess extends Object implements ModelAccess
Base class for implementations ofModelAccess. UnlikeModelAccessBase, is pure implementation of the interface and doesn't care aboutModelAccess.instance()existence.- Since:
 - 2017.3
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected jetbrains.mps.smodel.ActionDispatcher<CommandListener>myCommandActionDispatcherImplementation ofModelAccess.executeCommand(Runnable)andModelAccess.executeCommandInEDT(Runnable)shall dispatch actions throughActionDispatcher.dispatch(Runnable)method of this field to get proper notifications forCommandListenerprotected jetbrains.mps.smodel.ActionDispatcher<ReadActionListener>myReadActionDispatcherprotected jetbrains.mps.smodel.ActionDispatcher<WriteActionListener>myWriteActionDispatcherImplementation ofModelAccess.runWriteAction(Runnable)andModelAccess.runWriteInEDT(Runnable)shall dispatch actions throughActionDispatcher.dispatch(Runnable)method of this field to get proper notifications forWriteActionListener 
- 
Constructor Summary
Constructors Constructor Description AbstractModelAccess() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCommandListener(CommandListener listener)add/remove listeners to listen to the start/finish of command eventsvoidaddReadActionListener(ReadActionListener listener)Get notified about start/finish of a model read actionvoidaddWriteActionListener(WriteActionListener listener)add/remove listeners to listen to the start/finish of write action eventsvoidcheckReadAccess()Fails with an exception, if the current thread does not hold the read lockvoidcheckWriteAccess()Fails with an exception, if the current thread does not hold the write lockprotected voidonCommandFinished()protected voidonCommandStarted()voidremoveCommandListener(CommandListener listener)voidremoveReadActionListener(ReadActionListener listener)Cease notifications about start/finish of a model read actionvoidremoveWriteActionListener(WriteActionListener listener)- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.jetbrains.mps.openapi.module.ModelAccess
canRead, canWrite, executeCommand, executeCommandInEDT, executeUndoTransparentCommand, isCommandAction, runReadAction, runReadInEDT, runWriteAction, runWriteInEDT 
 - 
 
 - 
 
- 
- 
Field Detail
- 
myReadActionDispatcher
protected final jetbrains.mps.smodel.ActionDispatcher<ReadActionListener> myReadActionDispatcher
 
- 
myCommandActionDispatcher
protected final jetbrains.mps.smodel.ActionDispatcher<CommandListener> myCommandActionDispatcher
Implementation ofModelAccess.executeCommand(Runnable)andModelAccess.executeCommandInEDT(Runnable)shall dispatch actions throughActionDispatcher.dispatch(Runnable)method of this field to get proper notifications forCommandListener 
- 
myWriteActionDispatcher
protected final jetbrains.mps.smodel.ActionDispatcher<WriteActionListener> myWriteActionDispatcher
Implementation ofModelAccess.runWriteAction(Runnable)andModelAccess.runWriteInEDT(Runnable)shall dispatch actions throughActionDispatcher.dispatch(Runnable)method of this field to get proper notifications forWriteActionListener 
 - 
 
- 
Method Detail
- 
checkReadAccess
public void checkReadAccess()
Description copied from interface:ModelAccessFails with an exception, if the current thread does not hold the read lock- Specified by:
 checkReadAccessin interfaceModelAccess
 
- 
checkWriteAccess
public void checkWriteAccess()
Description copied from interface:ModelAccessFails with an exception, if the current thread does not hold the write lock- Specified by:
 checkWriteAccessin interfaceModelAccess
 
- 
onCommandStarted
protected void onCommandStarted()
 
- 
onCommandFinished
protected void onCommandFinished()
 
- 
addCommandListener
public void addCommandListener(CommandListener listener)
Description copied from interface:ModelAccessadd/remove listeners to listen to the start/finish of command events- Specified by:
 addCommandListenerin interfaceModelAccess- Parameters:
 listener- listens to command- See Also:
 ModelAccess.executeCommand(Runnable)
 
- 
removeCommandListener
public void removeCommandListener(CommandListener listener)
- Specified by:
 removeCommandListenerin interfaceModelAccess
 
- 
addWriteActionListener
public void addWriteActionListener(@NotNull WriteActionListener listener)
Description copied from interface:ModelAccessadd/remove listeners to listen to the start/finish of write action events- Specified by:
 addWriteActionListenerin interfaceModelAccess- Parameters:
 listener- listens to write action- See Also:
 ModelAccess.runWriteAction(Runnable)
 
- 
removeWriteActionListener
public void removeWriteActionListener(@NotNull WriteActionListener listener)
- Specified by:
 removeWriteActionListenerin interfaceModelAccess
 
- 
addReadActionListener
public void addReadActionListener(@NotNull ReadActionListener listener)
Description copied from interface:ModelAccessGet notified about start/finish of a model read action- Specified by:
 addReadActionListenerin interfaceModelAccess
 
- 
removeReadActionListener
public void removeReadActionListener(@NotNull ReadActionListener listener)
Description copied from interface:ModelAccessCease notifications about start/finish of a model read action- Specified by:
 removeReadActionListenerin interfaceModelAccess
 
 - 
 
 -