diff options
author | 2021-08-03 18:42:39 +0900 | |
---|---|---|
committer | 2021-08-06 19:32:38 +0900 | |
commit | be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch) | |
tree | 1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.tool.editor/src/rba/tool/editor/validation/validators/OutputtingSoundValidator.xtend | |
parent | 71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff) |
Initial commit
Bug-AGL: SPEC-4033
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
Diffstat (limited to 'rba.tool.editor/src/rba/tool/editor/validation/validators/OutputtingSoundValidator.xtend')
-rw-r--r-- | rba.tool.editor/src/rba/tool/editor/validation/validators/OutputtingSoundValidator.xtend | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/rba.tool.editor/src/rba/tool/editor/validation/validators/OutputtingSoundValidator.xtend b/rba.tool.editor/src/rba/tool/editor/validation/validators/OutputtingSoundValidator.xtend new file mode 100644 index 0000000..7a5f7fa --- /dev/null +++ b/rba.tool.editor/src/rba/tool/editor/validation/validators/OutputtingSoundValidator.xtend @@ -0,0 +1,34 @@ +package rba.tool.editor.validation.validators + +import org.eclipse.xtext.validation.Check +import org.eclipse.xtext.validation.EValidatorRegistrar +import rba.core.ExpressionType +import rba.core.RBACorePackage +import rba.sound.OutputtingSound +import rba.tool.editor.messages.Messages +import rba.tool.editor.validation.AbstractRBAModelValidator + +class OutputtingSoundValidator extends AbstractRBAModelValidator { + + private String OUTPUTTINGSOUND_SIZE = Messages.OUTPUTTINGSOUND_SIZE; + + private String OUTPUTTINGSOUND_TYPE = Messages.OUTPUTTINGSOUND_TYPE; + + override register(EValidatorRegistrar registrar) { + // not needed for classes used as ComposedCheck + } + + @Check(NORMAL) + def checkIsHidden(OutputtingSound outputtingSound) { + if (outputtingSound.operand.size > 1) { + error(OUTPUTTINGSOUND_SIZE, RBACorePackage.Literals.OPERATOR__OPERAND, 1) + return; + } + for (operand : outputtingSound.operand) { + if (operand.type != ExpressionType.ZONE) { + error(OUTPUTTINGSOUND_TYPE, RBACorePackage.Literals.OPERATOR__OPERAND) + return; + } + } + } +} |