tmf: Split ISymbolProvider into core and UI parts
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Mon, 17 Apr 2017 02:10:34 +0000 (22:10 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 20 Apr 2017 17:24:58 +0000 (13:24 -0400)
The ISymbolProvider interface and related classes were all living in the UI
plugin only because of the preference page option, which is a UI-only
construct. This limitation was known since the inception of the symbol
provider, with the intent of eventually correctly splitting it into
core and UI components. This patch partially fullfills that.

Future work:

* Make symbol providers in core.

Change-Id: I64696929fcd8f47ba34b6a7b48d5e814faca7616
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/95115
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/ISymbolProvider.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/package-info.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/symbols/ISymbolProvider.java

index 6ff5a467e26f87de31d94442dd7ce09bdb029a94..6f565394cac39aa6570e051570fe1a793bc08ffe 100644 (file)
@@ -54,6 +54,7 @@ Export-Package: org.eclipse.tracecompass.internal.tmf.core;x-friends:="org.eclip
  org.eclipse.tracecompass.tmf.core.signal,
  org.eclipse.tracecompass.tmf.core.statesystem,
  org.eclipse.tracecompass.tmf.core.statistics,
+ org.eclipse.tracecompass.tmf.core.symbols,
  org.eclipse.tracecompass.tmf.core.synchronization,
  org.eclipse.tracecompass.tmf.core.timestamp,
  org.eclipse.tracecompass.tmf.core.trace,
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/ISymbolProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/ISymbolProvider.java
new file mode 100644 (file)
index 0000000..a456947
--- /dev/null
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2016-2017 Movidius 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.symbols;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
+
+/**
+ * An ISymbolProvider is used to map symbol addresses that might be found inside
+ * an {@link TmfTrace} into human readable strings.
+ *
+ * @author Matthew Khouzam
+ * @author Robert Kiss
+ * @since 2.4
+ */
+public interface ISymbolProvider {
+
+    /**
+     * @return the trace that this class resolves symbols for
+     */
+    ITmfTrace getTrace();
+
+    /**
+     * Some providers might have configurations that take some time to load. All
+     * the CPU intensive load operations shall be done in this method. The
+     * adopters shall call this method at an opportune moment when cancellation
+     * and UI feedback is possible. However, the implementors of this interface
+     * shall not assume that this method has been called.
+     *
+     * @param monitor
+     *            The progress monitor to use, can be null
+     */
+    void loadConfiguration(@Nullable IProgressMonitor monitor);
+
+    /**
+     * Return the symbol text corresponding to the given address or null if
+     * there is no such symbol
+     *
+     * @param address
+     *            the address of the symbol
+     * @return the symbol text or <code>null</code> if the symbol cannot be found
+     */
+    @Nullable String getSymbolText(long address);
+
+    /**
+     * Return the symbol text corresponding to the given pid/timestamp/address
+     * tuple, or null if there is no such symbol. An implementation that does
+     * not support pid and timestamp should return the symbol based on address
+     * only.
+     *
+     * A caller that has pid and timestamp information should call this method.
+     * {@link #getSymbolText(long)} should only be invoked by callers that do
+     * not have access to the pid and timestamp.
+     *
+     * @param pid
+     *            The process Id for which to query
+     * @param timestamp
+     *            The timestamp of the query
+     * @param address
+     *            the address of the symbol
+     * @return the symbol text or <code>null</code> if the symbol cannot be
+     *         found
+     */
+    default @Nullable String getSymbolText(int pid, long timestamp, long address) {
+        return getSymbolText(address);
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/package-info.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/package-info.java
new file mode 100644 (file)
index 0000000..4e9e27d
--- /dev/null
@@ -0,0 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Ericsson
+ *
+ * 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
+ *******************************************************************************/
+
+@org.eclipse.jdt.annotation.NonNullByDefault
+package org.eclipse.tracecompass.tmf.core.symbols;
index dbac47e4da2d71e7746b3eb6a6c95d47cebe113f..202f3930287f5a2792598ec2e488ecde170adeca 100644 (file)
 
 package org.eclipse.tracecompass.tmf.ui.symbols;
 
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
 
 /**
  * An ISymbolProvider is used to map symbol addresses that might be found inside
- * an {@link TmfTrace} into human readable strings.
+ * an {@link TmfTrace} into human readable strings. This interface should be
+ * used to augment
+ * {@link org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider} to support
+ * preference pages.
  *
  * @author Robert Kiss
  * @since 2.0
  * @see ISymbolProviderFactory
  */
-public interface ISymbolProvider {
-
-    /**
-     * @return the trace that this class resolves symbols for
-     */
-    @NonNull ITmfTrace getTrace();
-
-    /**
-     * Some providers might have configurations that take some time to load. All
-     * the CPU intensive load operations shall be done in this method. The
-     * adopters shall call this method at an opportune moment when cancellation
-     * and UI feedback is possible. However, the implementors of this interface
-     * shall not assume that this method has been called.
-     *
-     * @param monitor
-     *            The progress monitor to use, can be null
-     */
-    void loadConfiguration(IProgressMonitor monitor);
-
-    /**
-     * Return the symbol text corresponding to the given address or null if
-     * there is no such symbol
-     *
-     * @param address
-     *            the address of the symbol
-     * @return the symbol text or null if the symbol cannot be found
-     */
-    @Nullable String getSymbolText(long address);
+public interface ISymbolProvider extends org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider {
 
     /**
      * Return additional information regarding the symbol from the given address
@@ -68,22 +41,6 @@ public interface ISymbolProvider {
     @Deprecated
     @Nullable ITmfCallsite getSymbolInfo(long address);
 
-    /**
-     * Return the symbol text corresponding to the given pid/timestamp/address
-     * tuple, or null if there is no such symbol.
-     *
-     * @param pid
-     *            The process Id for which to query
-     * @param timestamp
-     *            The timestamp of the query
-     * @param address
-     *            the address of the symbol
-     * @return the symbol text or null if the symbol cannot be found
-     */
-    default @Nullable String getSymbolText(int pid, long timestamp, long address) {
-        return getSymbolText(address);
-    }
-
     /**
      * Return additional information regarding the symbol from the given
      * pid/timestamp/address tuple, or null if the symbol cannot be found.
This page took 0.03048 seconds and 5 git commands to generate.