Interface ModelAccess


  • public interface ModelAccess
    Grants access to objects in the repository (for example to models)
    • Method Detail

      • canRead

        boolean canRead()
        Indicates, whether the current thread holds the read lock
      • checkReadAccess

        void checkReadAccess()
        Fails with an exception, if the current thread does not hold the read lock
      • canWrite

        boolean canWrite()
        Indicates, whether the current thread holds the write lock
      • checkWriteAccess

        void checkWriteAccess()
        Fails with an exception, if the current thread does not hold the write lock
      • runReadAction

        void runReadAction​(Runnable r)
        Querying 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.
      • runReadInEDT

        void runReadInEDT​(Runnable r)
        Querying 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.
      • runWriteAction

        void runWriteAction​(Runnable r)
        Modifications 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.
      • computeWriteAction

        default <T> T computeWriteAction​(Supplier<T> s)
      • runWriteInEDT

        void runWriteInEDT​(Runnable r)
        Modifications 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.
      • executeCommand

        void executeCommand​(Runnable r)
        Represents a write action executed with respect to platform undo mechanism. This method shall be invoked from EDT thread only. Unlike executeCommandInEDT(Runnable), this method executes synchronously
      • executeCommandInEDT

        void executeCommandInEDT​(@NotNull
                                 Runnable r)
        Represents a write action executed with respect to platform undo mechanism, runs asynchronously from EDT thread. This method may be invoked from any thread.
      • executeUndoTransparentCommand

        void executeUndoTransparentCommand​(Runnable r)
        FIXME need thorough documentation Executed code has model write, is treated as a command, the only difference is that changes from the transparent action merged with the that of the previous undoable command
      • addCommandListener

        void addCommandListener​(CommandListener listener)
        add/remove listeners to listen to the start/finish of command events
        Parameters:
        listener - listens to command
        See Also:
        executeCommand(Runnable)
      • removeCommandListener

        void removeCommandListener​(CommandListener listener)
      • addReadActionListener

        void addReadActionListener​(@NotNull
                                   ReadActionListener listener)
        Get notified about start/finish of a model read action
        Since:
        2018.3
      • removeReadActionListener

        void removeReadActionListener​(@NotNull
                                      ReadActionListener listener)
        Cease notifications about start/finish of a model read action
        Since:
        2018.3