tmf: Remove ITmfCallsite from ISymbolProvider
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / symbols / DefaultSymbolProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2016 Movidius Inc. and others
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 *******************************************************************************/
10
11 package org.eclipse.tracecompass.tmf.ui.symbols;
12
13 import org.eclipse.core.runtime.IProgressMonitor;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
18 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
19
20 /**
21 * A default implementation of the {@link ISymbolProvider} which return a hex
22 * format representation of the symbol address
23 *
24 * @author Robert Kiss
25 * @since 2.0
26 *
27 */
28 @NonNullByDefault
29 public class DefaultSymbolProvider implements ISymbolProvider {
30
31 private final ITmfTrace fTrace;
32
33 /**
34 * Create a new provider for the given trace
35 *
36 * @param trace
37 * the trace
38 */
39 public DefaultSymbolProvider(ITmfTrace trace) {
40 fTrace = trace;
41 }
42
43 @Override
44 public void loadConfiguration(@Nullable IProgressMonitor monitor) {
45 // no configuration here
46 }
47
48 @Override
49 public ITmfTrace getTrace() {
50 return fTrace;
51 }
52
53 /**
54 * Return a hex formated representation of the given address
55 *
56 * @param address
57 * the symbol address
58 * @return the hex representation of the given address
59 */
60 @Override
61 public @NonNull String getSymbolText(long address) {
62 if ((address & (0xFFFFFFFF << 32)) == 0) {
63 return String.format("%08x", address); //$NON-NLS-1$
64 }
65 return String.format("%016x", address); //$NON-NLS-1$
66 }
67
68 /**
69 * The default symbol provider will return null for this method
70 *
71 * @param address
72 * the symbol address
73 * @return always null
74 */
75 @Deprecated
76 @Override
77 public @Nullable ITmfCallsite getSymbolInfo(long address) {
78 return null;
79 }
80
81 /**
82 * @return null because the default symbol provider doesn't support
83 * configuration
84 */
85 @Override
86 public @Nullable ISymbolProviderPreferencePage createPreferencePage() {
87 return null;
88 }
89 }
This page took 0.034707 seconds and 5 git commands to generate.