Interface AppearanceService

All Known Implementing Classes:
AppearanceService.Unavailable

public interface AppearanceService
A plugin's handle on the Editor appearance: read the current state, overlay its own, and put the Editor's back.

Business outcomes — rejection, unavailability, apply and restore failures — are reported as result values on the returned stages, so callers can branch on the outcome enums. That does not make the calls total: an implementation may throw synchronously before returning a stage (for example on permission denial, a null argument or a provider error), and a returned stage may itself complete exceptionally. A plugin may only restore an appearance it owns. Where the host offers no appearance control at all, unavailable() supplies a conformant no-op implementation.

  • Method Details

    • current

      Returns the appearance state currently in force on the host.
      Returns:
      a stage for the observed status; see the class contract — synchronous validation failures may still be thrown
    • apply

      Overlays this plugin's appearance on the Editor.
      Parameters:
      request - the requested appearance, including the expectedRevision optimistic-concurrency token from an earlier current() result
      Returns:
      a stage for the outcome of the attempt; business rejection and failure arrive as values, while permission denial and provider errors may throw synchronously
    • restoreOwnedAppearance

      CompletionStage<AppearanceRestoreResult> restoreOwnedAppearance()
      Removes the appearance overlay this plugin owns, putting the Editor's own appearance back.
      Returns:
      a stage for the outcome; NO_OWNED_OVERRIDE reports a clean no-op when this plugin had nothing installed; permission denial may throw synchronously
    • isAvailable

      default boolean isAvailable()
      Reports whether a live runtime surface backs this instance.
      Returns:
      false when the backend backing this instance is unavailable, including the unavailable() sentinel
    • unavailable

      static AppearanceService unavailable()
      Returns:
      a service that changes nothing: current() reports AppearanceStatus.Availability.UNAVAILABLE at revision 0, and both mutating calls complete with an UNAVAILABLE outcome and the appearance.unavailable diagnostic id. Never returns null; argument validation still applies.