📄 lengthvalidator.java
字号:
/*
* Created on 2005-1-5
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.hnjchina.dialogs;
import org.eclipse.jface.dialogs.IInputValidator;
/**
* @author limeiyong
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class LengthValidator implements IInputValidator {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
*/
public String isValid(String newText) {
int len = newText.length();
// Determine if input is too short or too long
if (len < 5) return "Too short";
if (len > 8) return "Too long";
// Input must be OK
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -