-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check MPS constraints to filter the CC menu
- Loading branch information
Showing
3 changed files
with
85 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
projectional-editor/src/commonMain/kotlin/org/modelix/constraints/ConstraintsAspect.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.modelix.constraints | ||
|
||
import org.modelix.editor.INonExistingNode | ||
|
||
object ConstraintsAspect { | ||
val checkers: MutableSet<IConstraintsChecker> = HashSet() | ||
|
||
fun check(node: INonExistingNode) = checkers.flatMap { it.check(node) } | ||
|
||
fun canCreate(node: INonExistingNode) = check(node).isEmpty() | ||
} | ||
|
||
interface IConstraintsChecker { | ||
fun check(node: INonExistingNode): List<IConstraintViolation> | ||
} | ||
|
||
interface IConstraintViolation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters