The final restructured version for automatic build using maven tycho
[Mograsim.git] / plugins / net.mograsim.plugin.core / src / net / mograsim / plugin / tables / mi / MnemonicCellEditorValidator.java
1 package net.mograsim.plugin.tables.mi;
2
3 import org.eclipse.jface.viewers.ICellEditorValidator;
4
5 import net.mograsim.machine.mi.parameters.MnemonicFamily;
6
7 public class MnemonicCellEditorValidator implements ICellEditorValidator
8 {
9         private MnemonicFamily family;
10
11         public MnemonicCellEditorValidator(MnemonicFamily family)
12         {
13                 this.family = family;
14         }
15
16         @Override
17         public String isValid(Object value)
18         {
19                 int index = (Integer) value;
20                 return index >= 0 && index < family.size() ? null
21                                 : String.format("MnemonicFamily has %s elements, index %s is out of bounds", family.size(), value.toString());
22         }
23
24 }