use of com.redhat.qute.commons.datamodel.DataModelProject in project quarkus-ls by redhat-developer.
the class MockQuteProject method loadDataModelProject.
@Override
protected synchronized CompletableFuture<ExtendedDataModelProject> loadDataModelProject() {
DataModelProject<DataModelTemplate<DataModelParameter>> project = new DataModelProject<DataModelTemplate<DataModelParameter>>();
project.setTemplates(templates);
project.setValueResolvers(valueResolvers);
project.setNamespaceResolverInfos(namespaceResolverInfos);
return CompletableFuture.completedFuture(new ExtendedDataModelProject(project));
}
use of com.redhat.qute.commons.datamodel.DataModelProject in project quarkus-ls by redhat-developer.
the class QuteSupportForTemplateDelegateCommandHandler method getProjectDataModel.
private static DataModelProject<DataModelTemplate<DataModelParameter>> getProjectDataModel(List<Object> arguments, String commandId, IProgressMonitor monitor) throws Exception {
QuteDataModelProjectParams params = createQuteProjectDataModelParams(arguments, commandId);
// Execute the getProjectDataModel in a Job to benefit with progress
// monitor
final AtomicReference<DataModelProject<DataModelTemplate<DataModelParameter>>> dataModelRef = new AtomicReference<DataModelProject<DataModelTemplate<DataModelParameter>>>(null);
Job job = Job.create("Qute data model collector", progress -> {
DataModelProject<DataModelTemplate<DataModelParameter>> project = QuteSupportForTemplate.getInstance().getDataModelProject(params, JDTUtilsLSImpl.getInstance(), progress);
dataModelRef.set(project);
});
job.schedule();
try {
job.join();
} catch (InterruptedException e) {
LOGGER.log(Level.WARNING, "Error while joining Qute data model collector job", e);
}
Exception jobException = (Exception) job.getResult().getException();
if (jobException != null) {
if (jobException.getCause() != null) {
throw (Exception) jobException.getCause();
}
throw jobException;
}
return dataModelRef.get();
}
use of com.redhat.qute.commons.datamodel.DataModelProject in project quarkus-ls by redhat-developer.
the class ExtendedDataModelProject method getAllNamespaces.
private static Set<String> getAllNamespaces(DataModelProject<DataModelTemplate<DataModelParameter>> project) {
Set<String> allNamespaces = //
project.getValueResolvers().stream().filter(//
resolver -> resolver.getNamespace() != null).map(//
resolver -> resolver.getNamespace()).distinct().collect(Collectors.toSet());
allNamespaces.add(NamespacePart.DATA_NAMESPACE);
for (NamespaceResolverInfo info : project.getNamespaceResolverInfos().values()) {
info.getNamespaces().forEach(namespace -> {
allNamespaces.add(namespace);
});
}
return allNamespaces;
}
Aggregations