本文整理汇总了Java中org.eclipse.core.databinding.validation.ValidationStatus.ok方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationStatus.ok方法的具体用法?Java ValidationStatus.ok怎么用?Java ValidationStatus.ok使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.databinding.validation.ValidationStatus
的用法示例。
在下文中一共展示了ValidationStatus.ok方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
protected IStatus validate() {
// this access is recorded and ensures that changes are tracked, don't move it inside the if
Collection<?> projects = (Collection<?>) projectInput.getValue();
// this access is recorded and ensures that changes are tracked, don't move it inside the if
Object selectedProject = projectSelection.getValue();
if (projects.isEmpty()) {
if (requireValues) {
return ValidationStatus.error(Messages.getString("projectselector.no.projects")); //$NON-NLS-1$
} else {
return ValidationStatus.info(Messages.getString("projectselector.no.projects")); //$NON-NLS-1$
}
}
if (requireValues) {
if (selectedProject == null) {
return ValidationStatus.error(Messages.getString("projectselector.project.not.selected")); //$NON-NLS-1$
}
}
return ValidationStatus.ok();
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:AppEngineDeployPreferencesPanel.java
示例2: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
/**
* @param input the prospective version string
* @return OK status if valid, or an ERROR status with a description why invalid
*/
@Override
public IStatus validate(Object input) {
// https://cloud.google.com/appengine/docs/java/config/appref
// "The version specifier can contain lowercase letters, digits, and hyphens.
// It cannot begin with the prefix ah- and the names default and latest are
// reserved and cannot be used."
if (!(input instanceof String)) {
return ValidationStatus.error(Messages.getString("version.invalid")); //$NON-NLS-1$
}
String value = (String) input;
if (value.isEmpty()) {
return ValidationStatus.ok();
} else if (APPENGINE_PROJECT_VERSION_PATTERN.matcher(value).matches()) {
if (value.startsWith(RESERVED_PREFIX) || RESERVED_VALUES.contains(value)) {
return ValidationStatus.error(Messages.getString("version.reserved")); //$NON-NLS-1$
}
return ValidationStatus.ok();
} else {
return ValidationStatus.error(Messages.getString("version.invalid")); //$NON-NLS-1$
}
}
示例3: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
if (value instanceof String && !"".equals(value)) {
Matcher m = pattern.matcher((CharSequence) value);
if (m.find()) {
return ValidationStatus.ok();
}
else {
return ValidationStatus.error(errorMessage + patternString);
}
}
if (force)
{
return ValidationStatus.error(errorMessage + patternString);
}
return ValidationStatus.ok();
}
示例4: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
String qualifier = (String) value;
/* We would like the qualifier without dot. */
if (qualifier.startsWith(".")) {
return ValidationStatus.error("Please omit the prefixing dot.");
}
/* We don't allow qualifiers containing special characters other than underscores and dashes. */
Pattern p = Pattern.compile("[^A-Za-z0-9\\-\\_]");
if (p.matcher(qualifier).find()) {
return ValidationStatus.error("Qualifiers may only contain letters, numbers, underscores, and dashes.");
}
/* Phew, oll klear! */
return ValidationStatus.ok();
}
示例5: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
if (value == null) {
return ValidationStatus.ok();
}
if (value instanceof String) {
String text = (String) value;
if (text.trim().isEmpty() || text.matches("\\d*")) {
return ValidationStatus.ok();
}
}
if (value instanceof Integer) {
String s = String.valueOf(value);
if (s.matches("\\d*")) {
return ValidationStatus.ok();
}
}
return ValidationStatus.error("Not a number");
}
示例6: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
String serverURI = (String) value;
if (serverURI == null || serverURI.length() == 0) {
return ValidationStatus.error(Messages.VALIDATION_SERVER_URI_REQUIRED);
}
try {
URI srvURI = new URI(serverURI);
if (!"".equals(srvURI.getPath())) {
return ValidationStatus.error(Messages.VALIDATION_INVALID_SERVER_URI);
}
return Constants.MQTT_SCHEMES.contains(srvURI.getScheme()) ? ValidationStatus.ok()
: ValidationStatus.error(Messages.VALIDATION_INVALID_SERVER_URI);
}
catch (URISyntaxException e) {
return ValidationStatus.error(Messages.bind(Messages.VALIDATION_INVALID_SERVER_URI_MSG,
e.getLocalizedMessage()));
}
}
示例7: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
String s = String.valueOf(value);
if (s.contains(File.pathSeparator))
return ValidationStatus.error("Forbidden character: " + File.pathSeparator);
else if (s.endsWith(extension)) {
return ValidationStatus.ok();
} else
return ValidationStatus.error("Bad file name: " + s);
}
示例8: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
if (new File(String.valueOf(value)).exists())
return ValidationStatus.ok();
else
return ValidationStatus.error("Directory does not exist");
}
示例9: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
String s = String.valueOf(value);
if (s.matches("\\d+")) {
String msg = super.validate(Integer.parseInt(s));
return msg != null ? ValidationStatus.error(msg) : ValidationStatus.ok();
}
return ValidationStatus.error("Not a number");
}
示例10: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
String s = String.valueOf(value);
if (s.isEmpty())
return ValidationStatus.error("Name must not be empty");
else
return ValidationStatus.ok();
}
示例11: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
try {
double v = StringConverter.asDouble(String.valueOf(value));
String msg = super.validate(v);
return msg != null ? ValidationStatus.error(msg) : ValidationStatus.ok();
} catch (Exception e) {
return ValidationStatus.error("Not a number");
}
}
示例12: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object input) {
if (!(input instanceof String)) {
return ValidationStatus.error(Messages.getString("bucket.name.not.string")); //$NON-NLS-1$
}
String value = (String) input;
if (value.isEmpty()) {
return ValidationStatus.ok();
} else if (!CLOUD_STORAGE_BUCKET_NAME_PATTERN.matcher(value).matches()) {
return ValidationStatus.error(Messages.getString("bucket.name.invalid", value)); //$NON-NLS-1$
} else {
return allComponentsLengthAreValid(value);
}
}
示例13: allComponentsLengthAreValid
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
private IStatus allComponentsLengthAreValid(String value) {
String[] components = value.split("\\.");
for (String component : components) {
if (component.length() == 0 || component.length() > 63) {
return ValidationStatus.error(Messages.getString("bucket.name.invalid", value));
}
}
// if contains dots then must be a valid domain name
if (components.length > 1 && !InternetDomainName.isValid(value)) {
return ValidationStatus.error(Messages.getString("bucket.name.invalid", value));
}
return ValidationStatus.ok();
}
示例14: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value)
{
if (nullable && value == null)
{
return ValidationStatus.ok();
}
if (value instanceof String)
{
if (value.toString().trim().length() > 0)
{
try
{
@SuppressWarnings("unused")
Integer i = new Integer((String) value);
return ValidationStatus.ok();
} catch (NumberFormatException e)
{
return ValidationStatus.error(errorMessage);
}
} else if (nullable)
{
return ValidationStatus.ok();
}
}
return ValidationStatus.error(errorMessage);
}
示例15: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value)
{
if (nullable && value == null)
{
return ValidationStatus.ok();
}
if (value instanceof String)
{
String string = (String) value;
if (nullable && string.trim().length() == 0)
{
return ValidationStatus.ok();
}
try
{
Matcher matcher = patt.matcher(string);
if (matcher.matches())
{
return ValidationStatus.ok();
}
return ValidationStatus.error(errorMessage);
} catch (RuntimeException e)
{
return ValidationStatus.error(errorMessage);
}
}
if (nullable)
{
return ValidationStatus.ok();
}
return ValidationStatus.error(errorMessage);
}