Class SyncDialogUtil

java.lang.Object
org.eclipse.swt.internal.SyncDialogUtil

public class SyncDialogUtil extends Object
This class is an internal use utilities class introduced during the port from GTK3 to GTK4. This class transforms a non-blocking show dialog call to a blocking call. See bug 567371 for more information and where this is applied.
  • Field Details

    • responseID

      static int responseID
    • dialogResponseCallback

      static Callback dialogResponseCallback
    • dialogAsyncFinish

      static Function<Long,Long> dialogAsyncFinish
    • dialogAsyncValue

      static Long dialogAsyncValue
  • Constructor Details

    • SyncDialogUtil

      public SyncDialogUtil()
  • Method Details

    • run

      public static long run(Display display, AsyncReadyCallback callback)
      This method implements the AsyncReadyCallback mechanism that is used in GTK4. Most operations within GTK4 are executed asynchronously, where the user is given the option to respond to the completion of such an operation via a callback method, in order to e.g. process the result or to apply additional cleanup tasks.
      When calling this method, the asynchronous operation is initiated via the {code asyncOpen} parameter. Callers have to ensure that the callback address is used as argument for the AsyncReadyCallback parameter. From within the callback routine, the asyncFinish function is called, receiving the AsyncResult of the callback as argument and returning the long value of the callback function.
      This method blocks until the callback method has been called. It is therefore essential that callers use the address of the Callback as address for the AsyncReadyCallback object.
    • run

      public static int run(Display display, long handle, boolean isNativeDialog)
      A blocking call that waits for the handling of the signal before returning
      Returns:
      the response_id from the dialog presented to the user
    • initializeResponseCallback

      static void initializeResponseCallback()
      Initializes the response callback and resets the responseID of the dialog to the default value. This function should be called before connect the dialog to the "response" signal, as this sets up the callback.
    • disposeResponseCallback

      static void disposeResponseCallback()
    • dialogResponseProc

      static void dialogResponseProc(long dialog, long response_id, long user_data)
      Callback function for the "response" signal in GtkDialog widgets. Responsibility of destroying the dialog is the owner of the dialog handle. Note: Native dialogs are platform dialogs that don't use GtkDialog or GtkWindow.