1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

autotools: Migrate core bundle to SubMonitor.

Migrate org.eclipse.cdt.autotools.core from deprecated
SubProgressMonitor to SubMonitor.

Change-Id: Icad7c666fc88852554c5d7dbc70b4ecf26b9bc88
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2015-10-20 20:01:26 +03:00
parent 62f349f013
commit 508ee9fd44

View file

@ -76,7 +76,7 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionType; import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteResource; import org.eclipse.remote.core.IRemoteResource;
@ -220,10 +220,10 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// Create the file if it does not exist // Create the file if it does not exist
ByteArrayInputStream contents = new ByteArrayInputStream(new byte[0]); ByteArrayInputStream contents = new ByteArrayInputStream(new byte[0]);
try { try {
newFile.create(contents, false, new SubProgressMonitor(monitor, 1)); newFile.create(contents, false, SubMonitor.convert(monitor, 1));
// Make sure the new file is marked as derived // Make sure the new file is marked as derived
if (!newFile.isDerived()) { if (!newFile.isDerived()) {
newFile.setDerived(true); newFile.setDerived(true, SubMonitor.convert(monitor, 1));
} }
// if successful, refresh any remote projects to notify them of the new file // if successful, refresh any remote projects to notify them of the new file
refresh(); refresh();
@ -264,7 +264,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private void refresh() throws CoreException{ private void refresh() throws CoreException{
IRemoteResource remRes = getProject().getAdapter(IRemoteResource.class); IRemoteResource remRes = getProject().getAdapter(IRemoteResource.class);
if (remRes != null) { if (remRes != null) {
remRes.refresh(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); remRes.refresh(SubMonitor.convert(monitor));
} }
} }
@ -925,8 +925,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
OutputStream stderr = stdout; OutputStream stderr = stdout;
launcher.showCommand(true); launcher.showCommand(true);
Process proc = launcher.execute(commandPath, configTargets, env, Process proc = launcher.execute(commandPath, configTargets, env, runPath, SubMonitor.convert(monitor));
runPath, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
int exitValue = 0; int exitValue = 0;
if (proc != null) { if (proc != null) {
try { try {
@ -936,8 +935,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
} catch (IOException e) { } catch (IOException e) {
} }
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor( if (launcher.waitAndRead(stdout, stderr, SubMonitor.convert(monitor)) != ICommandLauncher.OK) {
monitor, IProgressMonitor.UNKNOWN)) != ICommandLauncher.OK) {
errMsg = launcher.getErrorMessage(); errMsg = launcher.getErrorMessage();
} }
@ -1056,7 +1054,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
new String[] { "-c", "echo $OSTYPE" }, //$NON-NLS-1$ //$NON-NLS-2$ new String[] { "-c", "echo $OSTYPE" }, //$NON-NLS-1$ //$NON-NLS-2$
env, env,
new Path("."), //$NON-NLS-1$ new Path("."), //$NON-NLS-1$
new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); SubMonitor.convert(monitor));
if (launcher.waitAndRead(out, out) == ICommandLauncher.OK) if (launcher.waitAndRead(out, out) == ICommandLauncher.OK)
winOSType = out.toString().trim(); winOSType = out.toString().trim();
} catch (CoreException e) { } catch (CoreException e) {
@ -1078,7 +1076,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (conn != null) { if (conn != null) {
if (!conn.isOpen()) { if (!conn.isOpen()) {
try { try {
conn.open(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); conn.open(SubMonitor.convert(monitor));
} catch (RemoteConnectionException e) { } catch (RemoteConnectionException e) {
// Ignore and return platform OS // Ignore and return platform OS
} }
@ -1264,8 +1262,8 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
launcher.showCommand(true); launcher.showCommand(true);
// Run the shell script via shell command. // Run the shell script via shell command.
Process proc = launcher.execute(new Path(SHELL_COMMAND), configTargets, env, Process proc = launcher.execute(new Path(SHELL_COMMAND), configTargets, env, runPath,
runPath, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); SubMonitor.convert(monitor));
int exitValue = 0; int exitValue = 0;
if (proc != null) { if (proc != null) {
@ -1276,8 +1274,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
} catch (IOException e) { } catch (IOException e) {
} }
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor( if (launcher.waitAndRead(stdout, stderr, SubMonitor.convert(monitor)) != ICommandLauncher.OK) {
monitor, IProgressMonitor.UNKNOWN)) != ICommandLauncher.OK) {
errMsg = launcher.getErrorMessage(); errMsg = launcher.getErrorMessage();
} }