1 19 20 package ca.mcgill.sable.soot.launching; 21 22 import java.util.ArrayList ; 23 24 import org.eclipse.jface.dialogs.IInputValidator; 25 26 29 public class SootConfigNameInputValidator implements IInputValidator { 30 31 private ArrayList alreadyUsed; 32 33 36 public SootConfigNameInputValidator() { 37 super(); 38 } 39 40 43 public String isValid(String newText) { 44 if (newText.equals("")){ 45 return "You must enter a name!"; 46 } 47 else if (newText == null) { 48 return "Must not be null!"; 49 } 50 else if (getAlreadyUsed().contains(newText)) { 51 return "A configuration with that name already exists!"; 52 } 53 return null; 54 } 55 56 60 public ArrayList getAlreadyUsed() { 61 return alreadyUsed; 62 } 63 64 68 public void setAlreadyUsed(ArrayList alreadyUsed) { 69 this.alreadyUsed = alreadyUsed; 70 } 71 72 } 73 | Popular Tags |