本文整理汇总了Java中org.jboss.forge.addon.ui.context.UIValidationContext.addValidationError方法的典型用法代码示例。如果您正苦于以下问题:Java UIValidationContext.addValidationError方法的具体用法?Java UIValidationContext.addValidationError怎么用?Java UIValidationContext.addValidationError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.addon.ui.context.UIValidationContext
的用法示例。
在下文中一共展示了UIValidationContext.addValidationError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context) {
Project selectedProject = getSelectedProject(context);
JavaSourceFacet javaFacet = selectedProject.getFacet(JavaSourceFacet.class);
try {
if (null == context.getCurrentInputComponent().getValue())
return;
JavaResource javaResource = javaFacet.getJavaResource((String)context.getCurrentInputComponent().getValue());
if (javaResource.exists()) {
if (!javaResource.getJavaType().hasAnnotation(Named.class)) {
context.addValidationError(context.getCurrentInputComponent(), javaResource.getFullyQualifiedName() + " must be annotated with @Named");
}
}
} catch (FileNotFoundException e) {
context.addValidationError(context.getCurrentInputComponent(), e.getMessage());
}
}
示例2: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context) {
if (deploymentType.getValue() == DeploymentType.CD) {
if (!openShiftCluster.getValueChoices().iterator().hasNext()) {
context.addValidationError(null, "No OpenShift token assigned");
}
}
}
示例3: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context) {
UIContext uiContext = context.getUIContext();
Mission mission = (Mission) uiContext.getAttributeMap().get(Mission.class);
String[] filterLabels = catalogServiceFactory.getFilterLabels(uiContext);
Optional<Booster> booster = catalogServiceFactory.getCatalog(uiContext).getBooster(mission,
runtime.getValue(), filterLabels);
if (!booster.isPresent()) {
context.addValidationError(runtime,
"No booster found for mission '" + mission + "' and runtime '" + runtime.getValue() + "'");
}
}
示例4: validateGitHubTokenExists
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
public boolean validateGitHubTokenExists(UIValidationContext context) {
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
String validationMessage = (String) attributeMap.computeIfAbsent("token_github_exists", key -> {
List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
return missionControlFacade.validateGitHubTokenExists(authHeader);
});
if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
context.addValidationError(context.getCurrentInputComponent(), validationMessage);
return false;
}
return true;
}
示例5: validateOpenShiftTokenExists
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
public boolean validateOpenShiftTokenExists(UIValidationContext context, String cluster) {
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
String validationMessage = (String) attributeMap.computeIfAbsent("token_openshift_exists", key -> {
List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
return missionControlFacade.validateOpenShiftTokenExists(authHeader, cluster);
});
if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
context.addValidationError(context.getCurrentInputComponent(), validationMessage);
return false;
}
return true;
}
示例6: validateGitHubRepositoryExists
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
public void validateGitHubRepositoryExists(UIValidationContext context, String repository) {
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
String validationMessage = (String) attributeMap.computeIfAbsent("validate_repo_" + repository, key -> {
List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
return missionControlFacade.validateGitHubRepositoryExists(authHeader, repository);
});
if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
context.addValidationError(context.getCurrentInputComponent(), validationMessage);
}
}
示例7: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context) {
if (github == null || !github.isDetailsValid()) {
// invoked too early before the github account is setup - lets return silently
return;
}
Iterable<GitRepositoryDTO> value = gitRepositoryPattern.getValue();
if (!value.iterator().hasNext()) {
context.addValidationError(gitRepositoryPattern, "You must select a repository to import");
}
// Check for repos with already existing bc
Controller controller = new Controller(kubernetesClientHelper.getKubernetesClient());
OpenShiftClient openShiftClient = controller.getOpenShiftClientOrNull();
if (openShiftClient == null) {
context.addValidationError(gitRepositoryPattern, "Could not create OpenShiftClient. Maybe the Kubernetes server version is older than 1.7?");
}
Iterator<GitRepositoryDTO> it = value.iterator();
String userNameSpace = Tenants.findDefaultUserNamespace(namespaces);
if (userNameSpace == null) {
// Tenant not yet initialised properly!
return;
}
while (it.hasNext()) {
GitRepositoryDTO repo = it.next();
if (repo != null && repo.getName() != null) {
BuildConfig oldBC = openShiftClient.buildConfigs().inNamespace(userNameSpace).withName(repo.getName().toLowerCase()).get();
if (oldBC != null && Strings.isNotBlank(KubernetesHelper.getName(oldBC))) {
context.addValidationError(gitRepositoryPattern, "The repository " + repo.getName() + " has already a build config, please select another repo.");
break;
}
}
}
}
示例8: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context) {
if (github == null || !github.isDetailsValid()) {
// invoked too early before the github account is setup - lets return silently
return;
}
String orgName = getOrganisationName(gitOrganisation.getValue());
if (Strings.isNullOrBlank(orgName)) {
context.addValidationError(gitOrganisation, "Please select a github organization");
}
}
示例9: validateFileDoesNotExist
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
/**
* Validates that the given selected directory and fileName are valid and that the file doesn't already exist
*/
public void validateFileDoesNotExist(UIInput<String> directory, UIInput<String> fileName, UIValidationContext validator) {
String resourcePath = CamelXmlHelper.createFileName(directory, fileName);
if (files.contains(resourcePath)) {
validator.addValidationError(fileName, "A file with that name already exists!");
}
}
示例10: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context)
{
if (deploymentType.getValue() == DeploymentType.CD)
{
if (!openShiftCluster.getValueChoices().iterator().hasNext())
{
context.addValidationError(null, "No OpenShift token assigned");
}
}
}
示例11: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext context)
{
UIContext uiContext = context.getUIContext();
Mission mission = (Mission) uiContext.getAttributeMap().get(Mission.class);
String[] filterLabels = catalogServiceFactory.getFilterLabels(uiContext);
Optional<Booster> booster = catalogServiceFactory.getCatalog(uiContext).getBooster(mission,
runtime.getValue(), filterLabels);
if (!booster.isPresent())
{
context.addValidationError(runtime,
"No booster found for mission '" + mission + "' and runtime '" + runtime.getValue() + "'");
}
}
示例12: validateGitHubTokenExists
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
public boolean validateGitHubTokenExists(UIValidationContext context)
{
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
String validationMessage = (String) attributeMap.computeIfAbsent("token_github_exists", key -> {
List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
return missionControlFacade.validateGitHubTokenExists(authHeader);
});
if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage))
{
context.addValidationError(context.getCurrentInputComponent(), validationMessage);
return false;
}
return true;
}
示例13: validateOpenShiftTokenExists
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
public boolean validateOpenShiftTokenExists(UIValidationContext context, String cluster)
{
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
String validationMessage = (String) attributeMap.computeIfAbsent("token_openshift_exists", key -> {
List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
return missionControlFacade.validateOpenShiftTokenExists(authHeader, cluster);
});
if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage))
{
context.addValidationError(context.getCurrentInputComponent(), validationMessage);
return false;
}
return true;
}
示例14: validateGitHubRepositoryExists
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
public void validateGitHubRepositoryExists(UIValidationContext context, String repository)
{
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
String validationMessage = (String) attributeMap.computeIfAbsent("validate_repo_" + repository, key -> {
List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
return missionControlFacade.validateGitHubRepositoryExists(authHeader, repository);
});
if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage))
{
context.addValidationError(context.getCurrentInputComponent(), validationMessage);
}
}
示例15: validate
import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext validator)
{
super.validate(validator);
if (connectionProfile.getValue().equals(""))
validator.addValidationError(connectionProfile,
"Please select a database connection. If there is no connection, "
+ "please use Forge to create a new connection profile");
}