tmf.core/ui: Move some logic of the symbol provider to core
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.ust.ui / src / org / eclipse / tracecompass / internal / lttng2 / ust / ui / analysis / debuginfo / UstDebugInfoSymbolProviderFactory.java
CommitLineData
cb2b5e56
AM
1/*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc. and others
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10package org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.debuginfo;
11
12import org.eclipse.jdt.annotation.Nullable;
13import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule;
14import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
37c87032
MK
15import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider;
16import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProviderFactory;
cb2b5e56
AM
17import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
18import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
cb2b5e56
AM
19
20/**
21 * Factory to create {@link UstDebugInfoSymbolProvider}. Provided to TMF via
22 * the extension point. Only works with LTTng-UST traces.
23 *
24 * @author Alexandre Montplaisir
25 */
26public class UstDebugInfoSymbolProviderFactory implements ISymbolProviderFactory {
27
28 @Override
29 public @Nullable ISymbolProvider createProvider(ITmfTrace trace) {
30 /*
31 * This applies only to UST traces that fulfill the DebugInfo analysis
32 * requirements.
33 */
34 UstDebugInfoAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace,
35 UstDebugInfoAnalysisModule.class, UstDebugInfoAnalysisModule.ID);
36
37 if (module != null && trace instanceof LttngUstTrace) {
38 return new UstDebugInfoSymbolProvider((LttngUstTrace) trace);
39 }
40 return null;
41 }
42
43}
This page took 0.045834 seconds and 5 git commands to generate.