Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 179be870dab39724e243c64840b9eb14f6b1ef59 (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
59
60
61
62
/*******************************************************************************
 * Copyright (c) 2007 Wind River Systems, Inc. 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
 *******************************************************************************/
package com.windriver.tcf.dsf.core.launch;

import org.eclipse.dd.dsf.concurrent.DsfExecutor;
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.debug.core.ILaunchConfiguration;

import com.windriver.debug.tcf.core.model.ITCFConstants;
import com.windriver.debug.tcf.core.model.TCFLaunch;
import com.windriver.tcf.api.protocol.IChannel;

public class TCFDSFLaunch extends TCFLaunch {

    private final TCFDSFExecuter executor;
    private final DsfSession session;

    public TCFDSFLaunch(ILaunchConfiguration launchConfiguration, String mode) {
        super(launchConfiguration, mode);
        executor = new TCFDSFExecuter();
        session = DsfSession.startSession(executor, ITCFConstants.ID_TCF_DEBUG_MODEL);
    }

    @Override
    protected void runLaunchSequence(final Runnable done) {
        super.runLaunchSequence(new Runnable() {
            public void run() {
                IChannel channel = getChannel();
                if (channel != null) {
                    RequestMonitor monitor = new RequestMonitor(executor, null) {
                        @Override
                        protected void handleOK() {
                            done.run();
                        }
                    };
                    TCFDSFLaunchSequence seq = new TCFDSFLaunchSequence(session, TCFDSFLaunch.this, monitor);
                    executor.execute(seq);
                }
                else {
                    done.run();
                }
            }
        });
    }

    public DsfExecutor getDsfExecutor() {
        return executor;
    }

    public DsfSession getSession() {
        return session;
    }
}

Back to the top