Java Code Examples for org.gradle.tooling.GradleConnector#newCancellationTokenSource()
The following examples show how to use
org.gradle.tooling.GradleConnector#newCancellationTokenSource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradleProjectCache.java From netbeans with Apache License 2.0 | 6 votes |
@Messages({ "# {0} - The project name", "LBL_Loading=Loading {0}" }) @Override public GradleProject call() throws Exception { tokenSource = GradleConnector.newCancellationTokenSource(); final ProgressHandle handle = ProgressHandle.createHandle(Bundle.LBL_Loading(ctx.previous.getBaseProject().getName()), this); ProgressListener pl = (ProgressEvent pe) -> { handle.progress(pe.getDescription()); }; handle.start(); try { return loadGradleProject(ctx, tokenSource.token(), pl); } catch (Throwable ex) { LOG.log(WARNING, ex.getMessage(), ex); throw ex; } finally { handle.finish(); } }
Example 2
Source File: GradleBuildSupport.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private boolean isRoot(IProject project, GradleBuild gradleBuild, IProgressMonitor monitor) { if (gradleBuild instanceof InternalGradleBuild) { CancellationTokenSource tokenSource = GradleConnector.newCancellationTokenSource(); Collection<EclipseProject> eclipseProjects = ((InternalGradleBuild) gradleBuild).getModelProvider().fetchModels(EclipseProject.class, FetchStrategy.LOAD_IF_NOT_CACHED, tokenSource, monitor); for (EclipseProject eclipseProject : eclipseProjects) { File eclipseProjectDirectory = eclipseProject.getProjectDirectory(); File projectDirectory = project.getLocation().toFile(); if (eclipseProjectDirectory.equals(projectDirectory)) { return eclipseProject.getParent() == null; } } } return false; }
Example 3
Source File: GradleProjectSettingsConfigurator.java From spring-javaformat with Apache License 2.0 | 4 votes |
@Override public void init(InitializationContext context, IProgressMonitor monitor) { this.tokenSource = GradleConnector.newCancellationTokenSource(); }