1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 11:55:40 +02:00

Replaced tabs with white space.

This commit is contained in:
Pawel Piech 2008-02-22 16:15:09 +00:00
parent 2d3a869931
commit 5f9445edbd

View file

@ -88,9 +88,9 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
return null;
}
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
String program = configuration.getAttribute(PDAPlugin.ATTR_PDA_PROGRAM, (String)null);
if (program == null) {
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
String program = configuration.getAttribute(PDAPlugin.ATTR_PDA_PROGRAM, (String)null);
if (program == null) {
abort("Perl program unspecified.", null);
}
@ -103,19 +103,19 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
launchProcess(launch, program, requestPort, eventPort);
PDALaunch pdaLaunch = (PDALaunch)launch;
initServices(pdaLaunch, program, requestPort, eventPort);
}
}
/**
* Launches PDA interpreter with the given program.
*
* @param launch Launch that will contain the new process.
* @param program PDA program to use in the interpreter.
* @param requestPort The port number for connecting the request socket.
* @param eventPort The port number for connecting the events socket.
*
* @throws CoreException
*/
private void launchProcess(ILaunch launch, String program, int requestPort, int eventPort) throws CoreException {
/**
* Launches PDA interpreter with the given program.
*
* @param launch Launch that will contain the new process.
* @param program PDA program to use in the interpreter.
* @param requestPort The port number for connecting the request socket.
* @param eventPort The port number for connecting the events socket.
*
* @throws CoreException
*/
private void launchProcess(ILaunch launch, String program, int requestPort, int eventPort) throws CoreException {
List<String> commandList = new ArrayList<String>();
// Find Perl executable
@ -159,23 +159,23 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
// Create a debug platform process object and add it to the launch.
DebugPlugin.newProcess(launch, process, path);
}
}
/**
* Calls the launch to initialize DSF services for this launch.
*/
private void initServices(final PDALaunch pdaLaunch, final String program, final int requestPort, final int eventPort)
throws CoreException
{
// Synchronization object to use when waiting for the services initialization.
Query<Object> initQuery = new Query<Object>() {
@Override
protected void execute(DataRequestMonitor<Object> rm) {
pdaLaunch.initializeServices(program, requestPort, eventPort, rm);
}
};
/**
* Calls the launch to initialize DSF services for this launch.
*/
private void initServices(final PDALaunch pdaLaunch, final String program, final int requestPort, final int eventPort)
throws CoreException
{
// Synchronization object to use when waiting for the services initialization.
Query<Object> initQuery = new Query<Object>() {
@Override
protected void execute(DataRequestMonitor<Object> rm) {
pdaLaunch.initializeServices(program, requestPort, eventPort, rm);
}
};
// Submit the query to the executor.
// Submit the query to the executor.
pdaLaunch.getSession().getExecutor().execute(initQuery);
try {
// Block waiting for query results.
@ -185,37 +185,37 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
} catch (ExecutionException e1) {
throw new DebugException(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error in launch sequence", e1.getCause())); //$NON-NLS-1$
}
}
}
/**
* Throws an exception with a new status containing the given
* message and optional exception.
*
* @param message error message
* @param e underlying exception
* @throws CoreException
*/
private void abort(String message, Throwable e) throws CoreException {
throw new CoreException(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, 0, message, e));
}
/**
* Throws an exception with a new status containing the given
* message and optional exception.
*
* @param message error message
* @param e underlying exception
* @throws CoreException
*/
private void abort(String message, Throwable e) throws CoreException {
throw new CoreException(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, 0, message, e));
}
/**
* Returns a free port number on localhost, or -1 if unable to find a free port.
*/
public static int findFreePort() {
ServerSocket socket= null;
try {
socket= new ServerSocket(0);
return socket.getLocalPort();
} catch (IOException e) {
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
}
}
}
return -1;
}
/**
* Returns a free port number on localhost, or -1 if unable to find a free port.
*/
public static int findFreePort() {
ServerSocket socket= null;
try {
socket= new ServerSocket(0);
return socket.getLocalPort();
} catch (IOException e) {
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
}
}
}
return -1;
}
}