Java Code Examples for org.eclipse.jdt.core.JavaCore#run()

The following examples show how to use org.eclipse.jdt.core.JavaCore#run() . 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: AbstractSyntaxProjectsManagerBasedTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
protected List<IProject> importProjects(Collection<String> paths, boolean deleteExistingFiles) throws Exception {
	final List<IPath> roots = new ArrayList<>();
	for (String path : paths) {
		File file = copyFiles(path, deleteExistingFiles);
		roots.add(Path.fromOSString(file.getAbsolutePath()));
	}
	IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
		@Override
		public void run(IProgressMonitor monitor) throws CoreException {
			projectsManager.initializeProjects(roots, monitor);
		}
	};
	JavaCore.run(runnable, null, monitor);
	JobHelpers.waitForWorkspaceJobsToComplete(monitor);
	return Arrays.asList(ProjectUtils.getAllProjects());
}
 
Example 2
Source File: AbstractInvisibleProjectBasedTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
protected IProject importRootFolder(IPath rootPath, String triggerFile) throws Exception {
	if (StringUtils.isNotBlank(triggerFile)) {
		IPath triggerFilePath = rootPath.append(triggerFile);
		Preferences preferences = preferenceManager.getPreferences();
		preferences.setTriggerFiles(Arrays.asList(triggerFilePath));
	}
	final List<IPath> roots = Arrays.asList(rootPath);
	IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
		@Override
		public void run(IProgressMonitor monitor) throws CoreException {
			projectsManager.initializeProjects(roots, monitor);
		}
	};
	JavaCore.run(runnable, null, monitor);
	waitForBackgroundJobs();
	String invisibleProjectName = ProjectUtils.getWorkspaceInvisibleProjectName(rootPath);
	return ResourcesPlugin.getWorkspace().getRoot().getProject(invisibleProjectName);
}
 
Example 3
Source File: AbstractProjectsManagerBasedTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
protected List<IProject> importProjects(Collection<String> paths, boolean deleteExistingFiles) throws Exception {
	final List<IPath> roots = new ArrayList<>();
	for (String path : paths) {
		File file = copyFiles(path, deleteExistingFiles);
		roots.add(Path.fromOSString(file.getAbsolutePath()));
	}
	IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
		@Override
		public void run(IProgressMonitor monitor) throws CoreException {
			projectsManager.initializeProjects(roots, monitor);
		}
	};
	JavaCore.run(runnable, null, monitor);
	waitForBackgroundJobs();
	return WorkspaceHelper.getAllProjects();
}
 
Example 4
Source File: DynamicValidationStateChange.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Change perform(IProgressMonitor pm) throws CoreException {
	final Change[] result = new Change[1];
	IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
		@Override
		public void run(IProgressMonitor monitor) throws CoreException {
			result[0] = DynamicValidationStateChange.super.perform(monitor);
		}
	};
	JavaCore.run(runnable, fSchedulingRule, pm);
	return result[0];
}
 
Example 5
Source File: DynamicValidationStateChange.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Change perform(IProgressMonitor pm) throws CoreException {
	final Change[] result= new Change[1];
	IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
		public void run(IProgressMonitor monitor) throws CoreException {
			result[0]= DynamicValidationStateChange.super.perform(monitor);
		}
	};
	JavaCore.run(runnable, fSchedulingRule, pm);
	return result[0];
}