1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

PR 166772, suppress error when from the binary parser when the project is close.

This commit is contained in:
Alain Magloire 2006-12-17 19:20:56 +00:00
parent 23ad32e88a
commit ca000ab6f5
6 changed files with 22 additions and 19 deletions

View file

@ -44,7 +44,7 @@ public class ArchiveContainer extends Openable implements IArchiveContainer {
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
throws CModelException { throws CModelException {
// this will bootstrap/start the runner for the project. // this will bootstrap/start the runner for the project.
CModelManager.getDefault().getBinaryRunner(getCProject(), true); CModelManager.getDefault().getBinaryRunner(getCProject());
return true; return true;
} }

View file

@ -25,7 +25,7 @@ public class ArchiveContainerInfo extends OpenableInfo {
} }
synchronized void sync() { synchronized void sync() {
BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(getElement().getCProject(), true); BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(getElement().getCProject());
if (runner != null) { if (runner != null) {
runner.waitIfRunning(); runner.waitIfRunning();
} }

View file

@ -54,7 +54,7 @@ public class BinaryContainer extends Openable implements IBinaryContainer {
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
throws CModelException { throws CModelException {
// this will bootstrap/start the runner for the project. // this will bootstrap/start the runner for the project.
CModelManager.getDefault().getBinaryRunner(getCProject(), true); CModelManager.getDefault().getBinaryRunner(getCProject());
return true; return true;
} }

View file

@ -26,7 +26,7 @@ public class BinaryContainerInfo extends OpenableInfo {
} }
synchronized void sync() { synchronized void sync() {
BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(getElement().getCProject(), true); BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(getElement().getCProject());
if (runner != null) { if (runner != null) {
runner.waitIfRunning(); runner.waitIfRunning();
} }

View file

@ -93,10 +93,10 @@ public class BinaryRunner {
*/ */
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS; IStatus status = Status.OK_STATUS;
try {
if (cproject == null || monitor.isCanceled()) { if (cproject == null || monitor.isCanceled()) {
status = Status.CANCEL_STATUS; status = Status.CANCEL_STATUS;
} else { } else {
try {
monitor.beginTask(getName(), IProgressMonitor.UNKNOWN); monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer(); BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer();
@ -110,16 +110,20 @@ public class BinaryRunner {
CModelOperation op = new BinaryRunnerOperation(cproject); CModelOperation op = new BinaryRunnerOperation(cproject);
op.runOperation(monitor); op.runOperation(monitor);
}
} catch (CoreException e) { } catch (CoreException e) {
status = e.getStatus(); // Ignore the error and just cancel the binary thread
} //status = e.getStatus();
} status = Status.CANCEL_STATUS;
} finally {
monitor.done(); monitor.done();
}
System.out.println("DONE " + cproject.getElementName()+ " :"+ status);
return status; return status;
} }
}; };
runner.setPriority(Job.LONG);
runner.schedule(); runner.schedule();
} }
/** /**
@ -162,6 +166,9 @@ public class BinaryRunner {
return false; return false;
} }
vMonitor.worked(1); vMonitor.worked(1);
// give a hint to the user of what we are doing
String name = proxy.getName();
vMonitor.subTask(name);
// Attempt to speed things up by rejecting up front // Attempt to speed things up by rejecting up front
// Things we know should not be Binary files. // Things we know should not be Binary files.
@ -173,8 +180,6 @@ public class BinaryRunner {
} }
// check against known content types // check against known content types
String name = proxy.getName();
vMonitor.subTask(name); // give a hint to the user of what we are doing
IContentType contentType = CCorePlugin.getContentType(project, name); IContentType contentType = CCorePlugin.getContentType(project, name);
if (contentType != null && textContentType != null) { if (contentType != null && textContentType != null) {

View file

@ -654,7 +654,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
} }
} }
public BinaryRunner getBinaryRunner(ICProject cproject, boolean start) { public BinaryRunner getBinaryRunner(ICProject cproject) {
BinaryRunner runner = null; BinaryRunner runner = null;
synchronized (binaryRunners) { synchronized (binaryRunners) {
IProject project = cproject.getProject(); IProject project = cproject.getProject();
@ -662,11 +662,9 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
if (runner == null) { if (runner == null) {
runner = new BinaryRunner(project); runner = new BinaryRunner(project);
binaryRunners.put(project, runner); binaryRunners.put(project, runner);
if (start) {
runner.start(); runner.start();
} }
} }
}
return runner; return runner;
} }