KetraTerm
API · DevelopmentAll versions

SwingShellSuggestionInteraction

class SwingShellSuggestionInteraction(val request: SwingShellSuggestionRequest, handler: SwingShellSuggestionHandler = SwingShellSuggestionHandler.NONE, feedbackHandler: SwingShellSuggestionFeedbackHandler = SwingShellSuggestionFeedbackHandler.NONE) : AutoCloseable

One suggestion request shared by built-in, detached Swing, and IntelliJ presentation.

Construct and call on the EDT. The owner captures handler before asynchronous work, publishes immutable candidate snapshots, and closes obsolete requests. Views own mounting, placement, and visibility; they invoke guarded operations instead of reporting acceptance. Provider completion does not close a still-usable final publication.

Acceptance leaves the active state before any view callback. The original handler and feedback destination survive reentrant UI replacement. Callback failures propagate, but cleanup completes and an edit or feedback event is never retried.

Parameters

handler

original editing capability; owned and closed by this interaction.

feedbackHandler

original request observer. Passive closure produces no preference feedback.

Constructors

Link copied to clipboard
constructor(request: SwingShellSuggestionRequest, handler: SwingShellSuggestionHandler = SwingShellSuggestionHandler.NONE, feedbackHandler: SwingShellSuggestionFeedbackHandler = SwingShellSuggestionFeedbackHandler.NONE)

Properties

Link copied to clipboard

Final lifecycle outcome, or null while active or synchronously accepting.

Link copied to clipboard

Whether new publications and user actions can still be admitted.

Link copied to clipboard

Whether final cleanup has run. An accepting interaction is inactive but not yet closed.

Link copied to clipboard

immutable command-line context captured before provider work.

Link copied to clipboard

Current complete publication; selection changes reuse its immutable candidate list.

Functions

Link copied to clipboard

Registers an EDT observer; registration does not synthesize a state change.

Link copied to clipboard
open override fun close()

Cancels an obsolete request and releases its captured editing capability.

Cancels this request without negative user feedback. Cancellation can still reject an in-progress admission.

Link copied to clipboard

Explicit user dismissal of the displayed publication. An empty or unselected publication produces no preference feedback.

Link copied to clipboard
fun publish(suggestions: List<SwingShellSuggestion>, selectedIndex: Int = -1, preserveSelection: Boolean = true): Boolean

Copies one progressive ranking at its ownership boundary. Returns false after invalidation. Selection is retained by replacement outcome across reranking when preserveSelection is true.

Link copied to clipboard

Removes a registered observer, including from a reentrant callback.

Link copied to clipboard
fun select(publication: SwingShellSuggestionSnapshot, index: Int): Boolean

Selects an index only if publication still belongs to the current candidate publication.

Link copied to clipboard

Attempts exactly one complete edit using the original capability. A stale view action returns STALE_CONTEXT without closing a newer publication or emitting feedback.