Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bfa28ddef4334c5df952551016d33dbf19676fa0 (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
/*******************************************************************************
 * Copyright (c) 2009, 2018 STMicroelectronics and others.
 * 
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
 *******************************************************************************/

package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditor;
import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;
import org.eclipse.ui.IEditorInput;

/**
 * @author Xavier Raynaud <xavier.raynaud@st.com>
 */
public class STAnnotatedSourceNotFoundEditor extends STCSourceNotFoundEditor {

    public static final String ID = "org.eclipse.linuxtools.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor"; //$NON-NLS-1$

    @Override
    protected void openSourceFileAtLocation(IProject project, IPath sourceLoc, int lineNumber) {
        IEditorInput input = this.getEditorInput();
        if (input instanceof STAnnotatedSourceNotFoundEditorInput) {
            STAnnotatedSourceNotFoundEditorInput editorInput = (STAnnotatedSourceNotFoundEditorInput) input;
            SourceFile sf = editorInput.getSourceFile();
            OpenSourceFileAction.openAnnotatedSourceFile(project, null, sf, sourceLoc, lineNumber);
        } else {
            super.openSourceFileAtLocation(project, sourceLoc, lineNumber);
        }
    }
}

Back to the top