本文整理汇总了Java中org.eclipse.core.databinding.validation.ValidationStatus.error方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationStatus.error方法的具体用法?Java ValidationStatus.error怎么用?Java ValidationStatus.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.databinding.validation.ValidationStatus
的用法示例。
在下文中一共展示了ValidationStatus.error方法的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包/类
@Override
protected IStatus validate() {
String pathValue = deployArtifactPath.getValue().toString();
if (pathValue.isEmpty()) {
return ValidationStatus.error(Messages.getString("error.deploy.artifact.empty"));
} else if (!pathValue.endsWith(".war") && !pathValue.endsWith(".jar")) {
return ValidationStatus.error(Messages.getString("error.deploy.artifact.invalid.extension"));
}
File deployArtifact = new File((String) deployArtifactPath.getValue());
if (!deployArtifact.isAbsolute()) {
deployArtifact = new File(basePath + "/" + deployArtifact);
}
if (!deployArtifact.exists()) {
return ValidationStatus.error(
Messages.getString("error.deploy.artifact.non.existing", deployArtifact));
} else if (!deployArtifact.isFile()) {
return ValidationStatus.error(Messages.getString("error.not.a.file", deployArtifact));
}
return Status.OK_STATUS;
}
示例3: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
protected IStatus validate() {
if (appYamlPath.getValue().toString().isEmpty()) {
return ValidationStatus.error(Messages.getString("error.app.yaml.empty"));
}
File appYaml = new File((String) appYamlPath.getValue());
if (!appYaml.isAbsolute()) {
appYaml = new File(basePath + "/" + appYaml);
}
// appengine-plugins-core does not yet support other file names.
if (!"app.yaml".equals(appYaml.getName())) {
return ValidationStatus.error(Messages.getString("error.app.yaml.invalid.name", appYaml));
} else if (!appYaml.exists()) {
return ValidationStatus.error(Messages.getString("error.app.yaml.non.existing"));
} else if (!appYaml.isFile()) {
return ValidationStatus.error(Messages.getString("error.not.a.file", appYaml));
} else {
return validateRuntime(appYaml);
}
}
示例4: 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$
}
}
示例5: 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();
}
示例6: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
public IStatus validate(Object value) {
if (value instanceof String) {
String text = (String) value;
if (text.trim().length() == 0) {
controlDecoration.show();
okButton.setEnabled(false);
return ValidationStatus.error(errorText);
}
for (String t : themes) {
if (t.equals(value)) {
controlDecoration.show();
okButton.setEnabled(false);
return ValidationStatus.error(errorText);
}
}
}
okButton.setEnabled(true);
controlDecoration.hide();
return Status.OK_STATUS;
}
示例7: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
public IStatus validate(Object value) {
String v = (String) value;
if (value == null || v.isEmpty())
return ValidationStatus.error(Messages.IDStringValidator_EmptyError);
if (v.length() > 100)
return ValidationStatus.error("ID size between 0 and 100");
for (char c : v.toCharArray()) {
if (Character.isLetterOrDigit(c))
continue;
boolean isAllowed = false;
for (char a : allowed) {
if (c == a) {
isAllowed = true;
break;
}
}
if (!isAllowed)
return ValidationStatus.error(Messages.IDStringValidator_InvalidChars);
}
return Status.OK_STATUS;
}
示例8: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
public IStatus validate(Object value) {
if (value == null) {
controlDecoration.hide();
return Status.OK_STATUS;
} else if (value instanceof String) {
String text = (String) value;
if (text.length() == 0 || SVNR.validateSVNumber(text)) {
controlDecoration.hide();
return Status.OK_STATUS;
}
}
controlDecoration.show();
return ValidationStatus.error(errorText);
}
示例9: validateXliffFile
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
/**
* 验证 xliff 所需要转换的 xliff 文件
* @param xliffPath
* xliff 文件路径
* @param monitor
* @return ;
*/
public IStatus validateXliffFile(String xliffPath, XLFHandler handler, IProgressMonitor monitor) {
IStatus result = new ReverseConversionValidateWithLibrary3().validate(xliffPath, configBean, monitor);
if (!result.isOK()) {
return result;
}
// 验证是否存在 xliff 对应的源文件类型的转换器实现
String fileType = configBean.getFileType();
Converter converter = getConverter(fileType);
if (converter != null) {
result = validateFileNodeInXliff(handler, xliffPath, converter.getType()); // 验证 XLIFF 文件的 file 节点
if (!result.isOK()) {
return result;
}
setSelectedType(fileType);
result = Status.OK_STATUS;
} else {
result = ValidationStatus.error("xliff 对应的源文件类型的转换器不存在:" + fileType);
}
return result;
}
示例10: validateFileNodeInXliff
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
/**
* 验证 XLIFF 文件中的 file 节点
* @param handler
* XLFHandler 实例
* @param xliffPath
* XLIFF 文件路径
* @param type
* 文件类型,(Converter.getType() 的值,XLIIF 文件 file 节点的 datatype 属性值)
* @return ;
*/
private IStatus validateFileNodeInXliff(XLFHandler handler, String xliffPath, String type) {
handler.reset(); // 重置,以便重新使用。
Map<String, Object> resultMap = handler.openFile(xliffPath);
if (resultMap == null
|| Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) {
// 打开文件失败。
return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg4")); //$NON-NLS-1$
}
try {
int fileCount = handler.getFileCountInXliff(xliffPath);
if (fileCount < 1) { // 不存在 file 节点。提示为不合法的 XLIFF
return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg4")); //$NON-NLS-1$
} else if (fileCount > 1) { // 多个 file 节点,提示分割。
if (ConverterUtils.isOpenOfficeOrMSOffice2007(type)) {
// 验证源文件是 OpenOffice 和 MSOffice 2007 的XLIFF 的 file 节点信息是否完整
return validateOpenOfficeOrMSOffice2007(handler, xliffPath);
}
return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg5")); //$NON-NLS-1$
} else { // 只有一个 file 节点
return Status.OK_STATUS;
}
} catch (Exception e) { // 当前打开了多个 XLIFF 文件,参看 XLFHandler.getFileCountInXliff() 方法
return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg5")); //$NON-NLS-1$
}
}
示例11: validateFileNodeInXliff
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
/**
* 验证 XLIFF 文件中的 file 节点
* @param handler
* XLFHandler 实例
* @param xliffPath
* XLIFF 文件路径
* @param type
* 文件类型,(Converter.getType() 的值,XLIIF 文件 file 节点的 datatype 属性值)
* @return ;
*/
private IStatus validateFileNodeInXliff(XLFHandler handler, String xliffPath, String type) {
handler.reset(); // 重置,以便重新使用。
Map<String, Object> resultMap = handler.openFile(xliffPath);
if (resultMap == null
|| Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) {
// 打开文件失败。
return ValidationStatus.error(Messages.getString("ConverterViewModel.0")); //$NON-NLS-1$
}
try {
int fileCount = handler.getFileCountInXliff(xliffPath);
if (fileCount < 1) { // 不存在 file 节点。提示为不合法的 XLIFF
return ValidationStatus.error(Messages.getString("ConverterViewModel.0")); //$NON-NLS-1$
} else if (fileCount > 1) { // 多个 file 节点,提示分割。
if (ConverterUtils.isOpenOfficeOrMSOffice2007(type)) {
// 验证源文件是 OpenOffice 和 MSOffice 2007 的XLIFF 的 file 节点信息是否完整
return validateOpenOfficeOrMSOffice2007(handler, xliffPath);
}
return ValidationStatus.error(Messages.getString("ConverterViewModel.1")); //$NON-NLS-1$
} else { // 只有一个 file 节点
return Status.OK_STATUS;
}
} catch (Exception e) { // 当前打开了多个 XLIFF 文件,参看 XLFHandler.getFileCountInXliff() 方法
return ValidationStatus.error(Messages.getString("ConverterViewModel.1")); //$NON-NLS-1$
}
}
示例12: validateReverseConversion
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
/**
* 逆向转换验证
* @return ;
*/
public IStatus validateReverseConversion() {
if (target == null || target.trim().equals("")) {
return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg9"));
} else {
if (!replaceTarget) { // 如果未选择覆盖,判断并提示目标文件是否存在
String localTarget = ConverterUtil.toLocalPath(target);
File file = new File(localTarget);
if (file.exists()) {
return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg10"));
}
}
}
if (targetEncoding == null || targetEncoding.trim().equals("")) {
return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg11"));
}
return Status.OK_STATUS;
}
示例13: validateReverseConversion
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
/**
* 逆向转换验证
* @return ;
*/
public IStatus validateReverseConversion() {
if (target == null || target.trim().equals("")) {
return ValidationStatus.error("请选择已转换的文件。");
} else {
if (!replaceTarget) { // 如果未选择覆盖,判断并提示目标文件是否存在
String localTarget = ConverterUtil.toLocalPath(target);
File file = new File(localTarget);
if (file.exists()) {
return ValidationStatus.error("已转换的文件已存在。");
}
}
}
if (targetEncoding == null || targetEncoding.trim().equals("")) {
return ValidationStatus.error("请选择已转换文件的编码。");
}
return Status.OK_STATUS;
}
示例14: validate
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
public IStatus validate(Object value)
{
if (value instanceof String)
{
String s = (String) value;
try
{
Long.parseLong(s);
decoration.hide();
return Status.OK_STATUS;
}
catch(Exception e)
{
decoration.show();
return ValidationStatus.error(message);
}
}
else
{
throw new ConfigurationException("Not supposed to be called for non-strings.");
}
}
示例15: doSet
import org.eclipse.core.databinding.validation.ValidationStatus; //导入方法依赖的package包/类
@Override
protected IStatus doSet(IObservableValue observableValue, Object value)
{
try
{
observableValue.setValue(value);
widget.setMessage("");
}
catch (Exception ex)
{
String msg = ex.getLocalizedMessage();
widget.setMessage(msg);
return ValidationStatus.error(BindingMessages.getString(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), ex);
}
return Status.OK_STATUS;
}