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)
throws CModelException {
// this will bootstrap/start the runner for the project.
CModelManager.getDefault().getBinaryRunner(getCProject(), true);
CModelManager.getDefault().getBinaryRunner(getCProject());
return true;
}

View file

@ -25,7 +25,7 @@ public class ArchiveContainerInfo extends OpenableInfo {
}
synchronized void sync() {
BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(getElement().getCProject(), true);
BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(getElement().getCProject());
if (runner != null) {
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)
throws CModelException {
// this will bootstrap/start the runner for the project.
CModelManager.getDefault().getBinaryRunner(getCProject(), true);
CModelManager.getDefault().getBinaryRunner(getCProject());
return true;
}

View file

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

View file

@ -93,10 +93,10 @@ public class BinaryRunner {
*/
protected IStatus run(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
if (cproject == null || monitor.isCanceled()) {
status = Status.CANCEL_STATUS;
} else {
try {
try {
if (cproject == null || monitor.isCanceled()) {
status = Status.CANCEL_STATUS;
} else {
monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer();
@ -110,16 +110,20 @@ public class BinaryRunner {
CModelOperation op = new BinaryRunnerOperation(cproject);
op.runOperation(monitor);
} catch (CoreException e) {
status = e.getStatus();
}
} catch (CoreException e) {
// 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;
}
};
runner.setPriority(Job.LONG);
runner.schedule();
}
/**
@ -162,6 +166,9 @@ public class BinaryRunner {
return false;
}
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
// Things we know should not be Binary files.
@ -173,8 +180,6 @@ public class BinaryRunner {
}
// 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);
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;
synchronized (binaryRunners) {
IProject project = cproject.getProject();
@ -662,9 +662,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
if (runner == null) {
runner = new BinaryRunner(project);
binaryRunners.put(project, runner);
if (start) {
runner.start();
}
runner.start();
}
}
return runner;