1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Move parsing for source file into a job with progress monitor.

This commit is contained in:
Ken Ryall 2010-04-29 16:34:19 +00:00
parent 8ece4ead1a
commit a5e8476af3

View file

@ -12,10 +12,14 @@
package org.eclipse.cdt.debug.internal.ui.views.executables;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.executables.Executable;
import org.eclipse.cdt.ui.CElementContentProvider;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
public class SourceFilesContentProvider extends CElementContentProvider {
@ -35,8 +39,26 @@ public class SourceFilesContentProvider extends CElementContentProvider {
public Object[] getElements(Object inputElement) {
if (inputElement instanceof Executable) {
Executable executable = (Executable) inputElement;
ITranslationUnit[] sourceFiles = executable.getSourceFiles(new NullProgressMonitor());
final Executable executable = (Executable) inputElement;
final ITranslationUnit[][] resultHolder = new ITranslationUnit[1][];
Job quickParseJob = new Job("Reading Debug Symbol Information: " + executable.getName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
ITranslationUnit[] sourceFiles = executable.getSourceFiles(monitor);
resultHolder[0] = sourceFiles;
return Status.OK_STATUS;
}
};
try {
quickParseJob.schedule();
quickParseJob.join();
} catch (InterruptedException e) {
CDebugCorePlugin.log(e);
}
ITranslationUnit[] sourceFiles = resultHolder[0];
if (sourceFiles.length == 0)
return new String[] { Messages.SourceFilesContentProvider_NoFilesFound + executable.getName() };
else