1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Bug 301229 - BinaryRunner: Init output entries in constructor and not while running

This commit is contained in:
Anton Leherbauer 2010-02-16 12:43:31 +00:00
parent 0582fc2a23
commit 1019868357

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2008 QNX Software Systems and others. * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -84,12 +84,17 @@ public class BinaryRunner {
} }
private final ICProject cproject; private final ICProject cproject;
private final Job runnerJob; // final fields don't need syncronization private final Job runnerJob; // final fields don't need synchronization
private boolean isStopped= false; // access to isStopped must be syncronized. private IOutputEntry[] entries = new IOutputEntry[0];
private boolean isStopped= false; // access to isStopped must be synchronized.
public BinaryRunner(IProject prj) { public BinaryRunner(IProject prj) {
cproject = CModelManager.getDefault().create(prj); cproject = CModelManager.getDefault().create(prj);
runnerJob= createRunnerJob(); runnerJob= createRunnerJob();
try {
entries = cproject.getOutputEntries();
} catch (CModelException e) {
}
} }
private Job createRunnerJob() { private Job createRunnerJob() {
@ -100,7 +105,7 @@ public class BinaryRunner {
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS; IStatus status = Status.OK_STATUS;
try { try {
if (cproject == null || monitor.isCanceled()) { if (cproject == null || entries.length == 0 || monitor.isCanceled()) {
status = Status.CANCEL_STATUS; status = Status.CANCEL_STATUS;
} else { } else {
monitor.beginTask(getName(), IProgressMonitor.UNKNOWN); monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
@ -168,16 +173,11 @@ public class BinaryRunner {
private class Visitor implements IResourceProxyVisitor { private class Visitor implements IResourceProxyVisitor {
private IProgressMonitor vMonitor; private IProgressMonitor vMonitor;
private IProject project; private IProject project;
private IOutputEntry[] entries = new IOutputEntry[0];
private IContentType textContentType; private IContentType textContentType;
public Visitor(IProgressMonitor monitor) { public Visitor(IProgressMonitor monitor) {
vMonitor = monitor; vMonitor = monitor;
this.project = cproject.getProject(); this.project = cproject.getProject();
try {
entries = cproject.getOutputEntries();
} catch (CModelException e) {
}
IContentTypeManager mgr = Platform.getContentTypeManager(); IContentTypeManager mgr = Platform.getContentTypeManager();
textContentType = mgr.getContentType("org.eclipse.core.runtime.text"); //$NON-NLS-1$ textContentType = mgr.getContentType("org.eclipse.core.runtime.text"); //$NON-NLS-1$
} }