use of org.eclipse.core.resources.IWorkspaceRunnable in project eclipse.platform.text by eclipse.
the class ResourceTextFileBufferManager method validateState.
@Override
public void validateState(final IFileBuffer[] fileBuffers, IProgressMonitor monitor, final Object computationContext) throws CoreException {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor progressMonitor) throws CoreException {
IFileBuffer[] toValidate = findFileBuffersToValidate(fileBuffers);
validationStateAboutToBeChanged(toValidate);
try {
IStatus status = validateEdit(toValidate, computationContext);
validationStateChanged(toValidate, true, status);
} catch (RuntimeException x) {
validationStateChangedFailed(toValidate);
}
}
};
ResourcesPlugin.getWorkspace().run(runnable, computeValidateStateRule(fileBuffers), IWorkspace.AVOID_UPDATE, monitor);
}
use of org.eclipse.core.resources.IWorkspaceRunnable in project linuxtools by eclipse.
the class CProjectHelper method createCProject.
/**
* Creates a ICProject.
*/
private static ICProject createCProject(final String projectName, String binFolderName, final String indexerID) throws CoreException {
final IWorkspace ws = ResourcesPlugin.getWorkspace();
final ICProject[] newProject = new ICProject[1];
ws.run((IWorkspaceRunnable) monitor -> {
IWorkspaceRoot root = ws.getRoot();
IProject project = root.getProject(projectName);
if (indexerID != null) {
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
}
if (!project.exists()) {
project.create(null);
} else {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
}
if (!project.isOpen()) {
project.open(null);
}
if (!project.hasNature(CProjectNature.C_NATURE_ID)) {
String projectId = PLUGIN_ID + ".TestProject";
addNatureToProject(project, CProjectNature.C_NATURE_ID, null);
CCorePlugin.getDefault().mapCProjectOwner(project, projectId, false);
}
addDefaultBinaryParser(project);
newProject[0] = CCorePlugin.getDefault().getCoreModel().create(project);
}, null);
return newProject[0];
}
use of org.eclipse.core.resources.IWorkspaceRunnable in project linuxtools by eclipse.
the class CProjectHelper method createCCProject.
private static ICProject createCCProject(final String projectName, final String binFolderName) throws CoreException {
final IWorkspace ws = ResourcesPlugin.getWorkspace();
final ICProject[] newProject = new ICProject[1];
ws.run((IWorkspaceRunnable) monitor -> {
ICProject cproject = createCProject2(projectName, binFolderName);
if (!cproject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
addNatureToProject(cproject.getProject(), CCProjectNature.CC_NATURE_ID, null);
}
newProject[0] = cproject;
}, null);
return newProject[0];
}
Aggregations