View | Details | Raw Unified | Return to bug 301609
Collapse All | Expand All

(-)src/org/eclipse/ant/internal/launching/AntLaunchingUtil.java (-1 / +18 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 521-524 Link Here
521
			}
521
			}
522
		}
522
		}
523
	}
523
	}
524
	
525
	/**
526
	 * Returns whether the given configuration should be launched in the background.
527
	 * When unspecified, the default value for an Ant launch configuration is <code>true</code>.
528
	 * 
529
	 * @param configuration the configuration
530
	 * @return whether the configuration is configured to launch in the background
531
	 */
532
	public static boolean isLaunchInBackground(ILaunchConfiguration configuration) {
533
		boolean launchInBackground= true;
534
		try {
535
			launchInBackground= configuration.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
536
		} catch (CoreException ce) {
537
			AntLaunching.log(ce);
538
		}
539
		return launchInBackground;
540
	}
524
}
541
}
(-)src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java (-4 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 141-147 Link Here
141
		boolean isSeparateJRE = AntLaunchingUtil
141
		boolean isSeparateJRE = AntLaunchingUtil
142
				.isSeparateJREAntBuild(configuration);
142
				.isSeparateJREAntBuild(configuration);
143
143
144
		if (ExternalToolsCoreUtil.isAsynchronousBuild(configuration)) {
144
		if (AntLaunchingUtil.isLaunchInBackground(configuration)) {
145
			monitor.beginTask(MessageFormat.format(
145
			monitor.beginTask(MessageFormat.format(
146
				AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__1,
146
				AntLaunchConfigurationMessages.AntLaunchDelegate_Launching__0__1,
147
						new String[] { configuration.getName() }), 10);
147
						new String[] { configuration.getName() }), 10);
Lines 290-296 Link Here
290
				launch, attributes);
290
				launch, attributes);
291
		setProcessAttributes(process, idStamp, commandLine);
291
		setProcessAttributes(process, idStamp, commandLine);
292
		boolean debug = fMode.equals(ILaunchManager.DEBUG_MODE);
292
		boolean debug = fMode.equals(ILaunchManager.DEBUG_MODE);
293
		if (debug || ExternalToolsCoreUtil.isAsynchronousBuild(configuration)) {
293
		if (debug || AntLaunchingUtil.isLaunchInBackground(configuration)) {
294
			final AntRunner finalRunner = runner;
294
			final AntRunner finalRunner = runner;
295
			Runnable r = new Runnable() {
295
			Runnable r = new Runnable() {
296
				public void run() {
296
				public void run() {
Lines 317-322 Link Here
317
		} else {
317
		} else {
318
			// execute the build
318
			// execute the build
319
			try {
319
			try {
320
				process.setProgressMonitor(monitor);
320
				runner.run(monitor);
321
				runner.run(monitor);
321
			} catch (CoreException e) {
322
			} catch (CoreException e) {
322
				process.terminated();
323
				process.terminated();
Lines 654-660 Link Here
654
			setProcessAttributes(processes[i], idStamp, null);
655
			setProcessAttributes(processes[i], idStamp, null);
655
		}
656
		}
656
657
657
		if (ExternalToolsCoreUtil.isAsynchronousBuild(copy)) {
658
		if (AntLaunchingUtil.isLaunchInBackground(copy)) {
658
			// refresh resources after process finishes
659
			// refresh resources after process finishes
659
			if (configuration.getAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String)null) != null) {
660
			if (configuration.getAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String)null) != null) {
660
				BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(
661
				BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(
(-)src/org/eclipse/ant/internal/launching/launchConfigurations/AntProcess.java (-1 / +33 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 30-35 Link Here
30
	private Map fAttributes = null;
30
	private Map fAttributes = null;
31
	private boolean fTerminated = false;
31
	private boolean fTerminated = false;
32
	private boolean fCancelled = false;
32
	private boolean fCancelled = false;
33
	// progress monitor to delegate or null if none
34
	private IProgressMonitor fMonitor;
33
	
35
	
34
	public AntProcess(String label, ILaunch launch, Map attributes) {
36
	public AntProcess(String label, ILaunch launch, Map attributes) {
35
		fLabel = label;
37
		fLabel = label;
Lines 124-141 Link Here
124
	 * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int)
126
	 * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int)
125
	 */
127
	 */
126
	public void beginTask(String name, int totalWork) {
128
	public void beginTask(String name, int totalWork) {
129
		if (fMonitor != null) {
130
			fMonitor.beginTask(name, totalWork);
131
		}
127
	}
132
	}
128
133
129
	/**
134
	/**
130
	 * @see org.eclipse.core.runtime.IProgressMonitor#done()
135
	 * @see org.eclipse.core.runtime.IProgressMonitor#done()
131
	 */
136
	 */
132
	public void done() {
137
	public void done() {
138
		if (fMonitor != null) {
139
			fMonitor.done();
140
		}
133
	}
141
	}
134
142
135
	/**
143
	/**
136
	 * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
144
	 * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
137
	 */
145
	 */
138
	public void internalWorked(double work) {
146
	public void internalWorked(double work) {
147
		if (fMonitor != null) {
148
			fMonitor.internalWorked(work);
149
		}
139
	}
150
	}
140
151
141
	/**
152
	/**
Lines 150-172 Link Here
150
	 */
161
	 */
151
	public void setCanceled(boolean value) {
162
	public void setCanceled(boolean value) {
152
		fCancelled = value;
163
		fCancelled = value;
164
		if (fMonitor != null) {
165
			fMonitor.setCanceled(value);
166
		}
153
	}
167
	}
154
168
155
	/**
169
	/**
156
	 * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
170
	 * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
157
	 */
171
	 */
158
	public void setTaskName(String name) {
172
	public void setTaskName(String name) {
173
		if (fMonitor != null) {
174
			fMonitor.setTaskName(name);
175
		}
159
	}
176
	}
160
177
161
	/**
178
	/**
162
	 * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String)
179
	 * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String)
163
	 */
180
	 */
164
	public void subTask(String name) {
181
	public void subTask(String name) {
182
		if (fMonitor != null) {
183
			fMonitor.subTask(name);
184
		}
165
	}
185
	}
166
186
167
	/**
187
	/**
168
	 * @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
188
	 * @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
169
	 */
189
	 */
170
	public void worked(int work) {
190
	public void worked(int work) {
191
		if (fMonitor != null) {
192
			fMonitor.worked(work);
193
		}
194
	}
195
	
196
	/**
197
	 * Sets a progress monitor to delegate to or <code>null</code> if none.
198
	 * 
199
	 * @param monitor delegate monitor or <code>null</code>
200
	 */
201
	public void setProgressMonitor(IProgressMonitor monitor) {
202
		fMonitor = monitor;
171
	}
203
	}
172
}
204
}

Return to bug 301609