mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Workspace Model] Add entity source editing to propertyBased tests
GitOrigin-RevId: 8a68c9ce3b6757328c2d5333daa034ba663b04a2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
efc7e0a52b
commit
c570ed8e65
+23
-1
@@ -20,7 +20,8 @@ internal fun getEntityManipulation(workspace: WorkspaceEntityStorageBuilderImpl)
|
||||
return Generator.anyOf(
|
||||
RemoveSomeEntity.create(workspace),
|
||||
EntityManipulation.addManipulations(workspace),
|
||||
EntityManipulation.modifyManipulations(workspace)
|
||||
EntityManipulation.modifyManipulations(workspace),
|
||||
ChangeEntitySource.create(workspace)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -65,6 +66,27 @@ private class RemoveSomeEntity(private val storage: WorkspaceEntityStorageBuilde
|
||||
}
|
||||
}
|
||||
|
||||
private class ChangeEntitySource(private val storage: WorkspaceEntityStorageBuilderImpl) : ImperativeCommand {
|
||||
override fun performCommand(env: ImperativeCommand.Environment) {
|
||||
val id = env.generateValue(EntityIdGenerator.create(storage), null) ?: run {
|
||||
env.logMessage("Tried to change entity source, but entity to change isn't found")
|
||||
return
|
||||
}
|
||||
val newSource = env.generateValue(sources, null)
|
||||
val entity = storage.entityDataByIdOrDie(id).createEntity(storage)
|
||||
val oldEntitySource = entity.entitySource
|
||||
storage.changeSource(entity, newSource)
|
||||
|
||||
env.logMessage("Entity source changed. Entity: $entity, Old source: $oldEntitySource, New source: $newSource")
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun create(workspace: WorkspaceEntityStorageBuilderImpl): Generator<ChangeEntitySource> {
|
||||
return Generator.constant(ChangeEntitySource(workspace))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class AddEntity(protected val storage: WorkspaceEntityStorageBuilderImpl,
|
||||
private val entityDescription: String) : ImperativeCommand {
|
||||
abstract fun makeEntity(source: EntitySource, someProperty: String, env: ImperativeCommand.Environment): WorkspaceEntity?
|
||||
|
||||
Reference in New Issue
Block a user