Skip to content

Commit

Permalink
Mark UiDataProvider APIs as internal API
Browse files Browse the repository at this point in the history
They're not meant for public consumption, but we need to keep them
public as we have tests in a separate module (and can't move them in).
  • Loading branch information
rock3r committed Aug 27, 2024
1 parent 1c6aa5c commit 11b6486
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import androidx.compose.ui.node.ModifierNodeElement
import com.intellij.openapi.actionSystem.DataSink
import com.intellij.openapi.actionSystem.UiDataProvider
import org.jetbrains.annotations.VisibleForTesting
import org.jetbrains.jewel.foundation.InternalJewelApi

@VisibleForTesting
@InternalJewelApi
public class RootDataProviderModifier : ModifierNodeElement<RootDataProviderNode>(), UiDataProvider {
private val rootNode = RootDataProviderNode()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import androidx.compose.ui.node.TraversableNode
import androidx.compose.ui.node.traverseDescendants
import com.intellij.openapi.actionSystem.DataSink
import com.intellij.openapi.actionSystem.UiDataProvider
import org.jetbrains.annotations.VisibleForTesting
import org.jetbrains.jewel.foundation.InternalJewelApi
import org.jetbrains.jewel.foundation.actionSystem.DataProviderNode

@VisibleForTesting
@InternalJewelApi
public class RootDataProviderNode : Modifier.Node(), UiDataProvider {
override fun uiDataSnapshot(sink: DataSink) {
val context = DataProviderDataSinkContext(sink)

traverseDescendants(DataProviderNode) { dp ->
if (dp is DataProviderNode) {
if (!dp.hasFocus) {
return@traverseDescendants TraversableNode.Companion.TraverseDescendantsAction.SkipSubtreeAndContinueTraversal
return@traverseDescendants TraversableNode.Companion.TraverseDescendantsAction
.SkipSubtreeAndContinueTraversal
} else {
dp.dataProvider(context)
}
Expand Down

0 comments on commit 11b6486

Please sign in to comment.