Class AwtRunnable

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    OneTimeRunnable

    public class AwtRunnable
    extends java.lang.Object
    implements java.lang.Runnable
    Used to create a task that needs to potentially run on the AwtThread.
    • Constructor Summary

      Constructors 
      Constructor Description
      AwtRunnable​(boolean awtThread, java.lang.Runnable command)  
      AwtRunnable​(boolean awtThread, java.lang.Runnable command, com.intellij.openapi.application.ModalityState modalityState)  
      AwtRunnable​(java.lang.Runnable command)  
      AwtRunnable​(java.lang.Runnable command, com.intellij.openapi.application.ModalityState modalityState)  
    • Constructor Detail

      • AwtRunnable

        public AwtRunnable​(java.lang.Runnable command)
      • AwtRunnable

        public AwtRunnable​(java.lang.Runnable command,
                           com.intellij.openapi.application.ModalityState modalityState)
      • AwtRunnable

        public AwtRunnable​(boolean awtThread,
                           java.lang.Runnable command)
      • AwtRunnable

        public AwtRunnable​(boolean awtThread,
                           java.lang.Runnable command,
                           com.intellij.openapi.application.ModalityState modalityState)
    • Method Detail

      • getCommand

        public java.lang.Runnable getCommand()
      • isAwtThread

        public boolean isAwtThread()
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • schedule

        public static CancellableRunnable schedule​(CancelableJobScheduler scheduler,
                                                   @NotNull
                                                   @NotNull java.lang.String id,
                                                   int delay,
                                                   @Nullable
                                                   @Nullable com.intellij.openapi.application.ModalityState modalityState,
                                                   @NotNull
                                                   @NotNull java.lang.Runnable command)
        Creates a one-shot runnable that will run after a delay, can be run early, or cancelled

        the given command will only be executed once, either by the delayed trigger or by the run method. if you want to execute the task early just invoke #run, it will do nothing if the task has already run.

        Parameters:
        scheduler - job scheduler to use
        id - id of the job
        delay - the time from now to delay execution
        modalityState - the modality state to use when invoking the command
        command - the task to execute
        Returns:
        a CancellableRunnable which will run after the given delay on the AwtThread if run() is invoked before Cancellable.cancel()
        Throws:
        java.lang.NullPointerException - if command is null