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:
parent
8ece4ead1a
commit
a5e8476af3
1 changed files with 25 additions and 3 deletions
|
@ -12,10 +12,14 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui.views.executables;
|
package org.eclipse.cdt.debug.internal.ui.views.executables;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
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.debug.core.executables.Executable;
|
||||||
import org.eclipse.cdt.ui.CElementContentProvider;
|
import org.eclipse.cdt.ui.CElementContentProvider;
|
||||||
import org.eclipse.core.runtime.IPath;
|
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 {
|
public class SourceFilesContentProvider extends CElementContentProvider {
|
||||||
|
|
||||||
|
@ -35,8 +39,26 @@ public class SourceFilesContentProvider extends CElementContentProvider {
|
||||||
|
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
if (inputElement instanceof Executable) {
|
if (inputElement instanceof Executable) {
|
||||||
Executable executable = (Executable) inputElement;
|
final Executable executable = (Executable) inputElement;
|
||||||
ITranslationUnit[] sourceFiles = executable.getSourceFiles(new NullProgressMonitor());
|
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)
|
if (sourceFiles.length == 0)
|
||||||
return new String[] { Messages.SourceFilesContentProvider_NoFilesFound + executable.getName() };
|
return new String[] { Messages.SourceFilesContentProvider_NoFilesFound + executable.getName() };
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue