Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b4c19431bd52ebd3bf7cfdc250e0c977466a9cb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
 * Copyright (c) 2007, 2009 Wind River Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *     Nokia - create and use backend service. 
 *******************************************************************************/
package org.eclipse.cdt.tests.dsf.pda.util;

import java.util.concurrent.ExecutionException;

import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.examples.dsf.pda.service.PDABackend;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.Launch;

/**
 * 
 */
public class Launching {
    
	private static PDABackend fBackendService;
	
    public static Process launchPDA(DsfSession session, Launch launch, String pdaProgram) throws CoreException {
        
        class InitializeBackendServiceQuery extends Query<Object> {
            @Override
            protected void execute(DataRequestMonitor<Object> rm) {
                fBackendService.initialize(rm);
            }
        };

        fBackendService = new PDABackend(session, launch, pdaProgram);
    	InitializeBackendServiceQuery initQuery = new InitializeBackendServiceQuery();
        session.getExecutor().execute(initQuery);
        try {
			initQuery.get();
		} catch (InterruptedException e) {
			e.printStackTrace();
			return null;
		} catch (ExecutionException e) {
			e.printStackTrace();
			return null;
		}        
   	
        return fBackendService.getProcess();
    }

	public static PDABackend getBackendService() {
		return fBackendService;
	}
}

Back to the top