Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 48cc082305074e194995b0a3093c097c4408ca0d (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
/*******************************************************************************
 * Copyright (c) 2007, 2010 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 org.eclipse.tm.internal.tcf.debug.launch;

import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
import org.eclipse.tm.tcf.services.ILineNumbers;

/**
 * TCF source lookup director.
 * For TCF source lookup there is one source lookup participant.
 */
public class TCFSourceLookupDirector extends AbstractSourceLookupDirector {

    public static Object lookup(ISourceLocator locator, Object element) {
        Object source_element = null;
        if (locator instanceof ISourceLookupDirector) {
            if (element instanceof ILineNumbers.CodeArea) {
                String file_name = TCFSourceLookupParticipant.toFileName((ILineNumbers.CodeArea)element);
                if (file_name != null) source_element = ((ISourceLookupDirector)locator).getSourceElement(file_name);
            }
            else {
                source_element = ((ISourceLookupDirector)locator).getSourceElement(element);
            }
        }
        else if (element instanceof IStackFrame) {
            source_element = locator.getSourceElement((IStackFrame)element);
        }
        return source_element;
    }

    public void initializeParticipants() {
        addParticipants(new ISourceLookupParticipant[] { new TCFSourceLookupParticipant() });
    }
}

Back to the top