use of com.redhat.devtools.intellij.tektoncd.utils.model.ConfigurationModel in project intellij-tekton by redhat-developer.
the class ResourceInPipelineCompletionProvider method getResourcesLookups.
private List<LookupElementBuilder> getResourcesLookups(CompletionParameters parameters) {
String configuration = parameters.getEditor().getDocument().getText();
ConfigurationModel model = ConfigurationModelFactory.getModel(configuration);
if (model == null || !(model instanceof PipelineConfigurationModel))
return Collections.emptyList();
List<LookupElementBuilder> lookups = new ArrayList<>();
((PipelineConfigurationModel) model).getInputResources().forEach(resource -> {
lookups.add(LookupElementBuilder.create(resource.name()).withPresentableText(resource.name()).withLookupString(resource.name()));
});
return lookups;
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.ConfigurationModel in project intellij-tekton by redhat-developer.
the class SingleInputInTaskCompletionProvider method getSingleInputLookups.
/**
* Get lookups for all possible variables matching the prefix
*
* @param parameters
* @return
*/
private List<LookupElementBuilder> getSingleInputLookups(CompletionParameters parameters) {
String configuration = parameters.getEditor().getDocument().getText();
ConfigurationModel model = ConfigurationModelFactory.getModel(configuration);
if (model == null)
return Collections.emptyList();
return getLookupsByKind(parameters, model);
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.ConfigurationModel in project intellij-tekton by redhat-developer.
the class TaskReferencesInspector method checkFile.
@Nullable
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
ConfigurationModel model = getTektonModelFromFile(file);
if (model == null) {
return ProblemDescriptor.EMPTY_ARRAY;
}
List<PsiElement> tasKNotFoundPsiElements = new ArrayList<>();
if (model instanceof PipelineConfigurationModel) {
List<String> tasksOnCluster = getTasksOnCluster(file.getProject(), model.getNamespace());
tasKNotFoundPsiElements = findTaskElementsNotFoundOnCluster(file, tasksOnCluster);
}
return tasKNotFoundPsiElements.stream().map(item -> manager.createProblemDescriptor(item, item, "No task named " + StringHelper.getUnquotedValueFromPsi(item) + " found on cluster.", ProblemHighlightType.GENERIC_ERROR, isOnTheFly)).toArray(ProblemDescriptor[]::new);
}
Aggregations