mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[R-1508] simplify InlayStateCustomizer
GitOrigin-RevId: e20455537a5bdb104f828a50d83c4e95c5f20def
This commit is contained in:
committed by
intellij-monorepo-bot
parent
beebabe85b
commit
ae6c8dfb5c
@@ -321,9 +321,7 @@ abstract class NotebookInlayComponent(protected val editor: EditorImpl)
|
||||
shouldLimitMaxHeight = false
|
||||
}
|
||||
|
||||
InlayStateCustomizer.EP.extensionList
|
||||
.filter { it.isApplicableTo(output::class.java) }
|
||||
.forEach { customizer -> customizer.customize(output) }
|
||||
InlayStateCustomizer.customize(output)
|
||||
|
||||
if (UiCustomizer.instance.isResizeOutputToPreviewHeight && size.height == InlayDimensions.smallHeight) {
|
||||
deltaSize(0, InlayDimensions.previewHeight - size.height)
|
||||
@@ -354,9 +352,7 @@ abstract class NotebookInlayComponent(protected val editor: EditorImpl)
|
||||
resizable = true
|
||||
(state as? NotebookInlayMultiOutput)?.also { st ->
|
||||
st.onOutputs(inlayOutputs)
|
||||
InlayStateCustomizer.EP.extensionList
|
||||
.filter { it.isApplicableTo(st::class.java) }
|
||||
.forEach { customizer -> customizer.customize(st) }
|
||||
InlayStateCustomizer.customize(st)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@ import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
* */
|
||||
@Experimental
|
||||
interface InlayStateCustomizer {
|
||||
/** Checks if a customizer can customize an inlay output of the given type. */
|
||||
fun <T : NotebookInlayState> isApplicableTo(klass: Class<T>): Boolean = true
|
||||
|
||||
/** Applies customizations and return the inlay output. */
|
||||
fun customize(state: NotebookInlayState): NotebookInlayState
|
||||
|
||||
companion object {
|
||||
val EP = ExtensionPointName.create<InlayStateCustomizer>("com.intellij.datavis.inlays.components.inlayStateCustomizer")
|
||||
private val EP = ExtensionPointName.create<InlayStateCustomizer>("com.intellij.datavis.inlays.components.inlayStateCustomizer")
|
||||
|
||||
fun customize(state: NotebookInlayState) {
|
||||
EP.extensionList.forEach { customizer -> customizer.customize(state) }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user