Package jetbrains.mps.smodel
Class ModelAccessBase
- java.lang.Object
 - 
- jetbrains.mps.smodel.ModelAccessBase
 
 
- 
- All Implemented Interfaces:
 ModelAccess
- Direct Known Subclasses:
 GlobalModelAccess,ProjectModelAccess
public abstract class ModelAccessBase extends Object implements ModelAccess
ModelAccess basic implementation: all non-command methods are implemented here. Currently it delegates everything to theModelAccess, it is planned to rewrite this class when multiple repositories are supported. Created by Alex Pyshkin on 9/3/14. 
- 
- 
Constructor Summary
Constructors Constructor Description ModelAccessBase() 
- 
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 eventsbooleancanRead()Indicates, whether the current thread holds the read lockbooleancanWrite()Indicates, whether the current thread holds the write lockvoidcheckReadAccess()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 ModelAccessgetDelegate()voidremoveCommandListener(CommandListener listener)voidremoveReadActionListener(ReadActionListener listener)Cease notifications about start/finish of a model read actionvoidremoveWriteActionListener(WriteActionListener listener)voidrunReadAction(Runnable r)Querying properties of models can only be performed from within managed actions, which hold the appropriate read lock.voidrunReadInEDT(Runnable r)Querying properties of models can only be performed from within managed actions, which hold the appropriate read lock.voidrunWriteAction(Runnable r)Modifications to models can only be performed from within managed actions, which hold the appropriate write lock.voidrunWriteInEDT(Runnable r)Modifications to models can only be performed from within managed actions, which hold the appropriate write lock.- 
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
executeCommand, executeCommandInEDT, executeUndoTransparentCommand, isCommandAction 
 - 
 
 - 
 
- 
- 
Method Detail
- 
canRead
public boolean canRead()
Description copied from interface:ModelAccessIndicates, whether the current thread holds the read lock- Specified by:
 canReadin interfaceModelAccess
 
- 
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
 
- 
canWrite
public boolean canWrite()
Description copied from interface:ModelAccessIndicates, whether the current thread holds the write lock- Specified by:
 canWritein 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
 
- 
runReadAction
public void runReadAction(Runnable r)
Description copied from interface:ModelAccessQuerying properties of models can only be performed from within managed actions, which hold the appropriate read lock. The method obtains such a lock and executes the provided action.- Specified by:
 runReadActionin interfaceModelAccess
 
- 
runReadInEDT
public void runReadInEDT(Runnable r)
Description copied from interface:ModelAccessQuerying properties of models can only be performed from within managed actions, which hold the appropriate read lock. The method obtains such a lock and executes the provided action asynchronously on the EDT UI thread. Inside the action it is safe to touch any UI elements and perform other EDT-bound actions of the IntelliJ platform.- Specified by:
 runReadInEDTin interfaceModelAccess
 
- 
runWriteAction
public void runWriteAction(Runnable r)
Description copied from interface:ModelAccessModifications to models can only be performed from within managed actions, which hold the appropriate write lock. The method obtains such a lock and executes the provided action. It should not be invoked from EDT, otherwise UI freeze may occur. Note: A lock cannot be upgraded. When owning the read lock it is not allowed to ask for the write lock through the runWriteAction() method.- Specified by:
 runWriteActionin interfaceModelAccess
 
- 
runWriteInEDT
public void runWriteInEDT(Runnable r)
Description copied from interface:ModelAccessModifications to models can only be performed from within managed actions, which hold the appropriate write lock. The method obtains such a lock and executes the provided action asynchronously on the EDT UI thread. Inside the action it is safe to touch any UI elements and perform other EDT-bound actions of the IntelliJ platform.- Specified by:
 runWriteInEDTin interfaceModelAccess
 
- 
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
 
- 
getDelegate
protected final ModelAccess getDelegate()
 
 - 
 
 -