tmf: Mark TmfTraceUtils @NonNullByDefault
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / callstack / CallStackView.java
index 8bc13e063c510216cb81599952a825a8e5fff755..8f9f9c079a2de60a8b9eb3d7e09b5af818df6954 100644 (file)
@@ -14,6 +14,8 @@
 
 package org.eclipse.tracecompass.tmf.ui.views.callstack;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -29,6 +31,7 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
@@ -59,6 +62,7 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Tree;
+import org.eclipse.tracecompass.internal.tmf.core.callstack.FunctionNameMapper;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.ui.ITmfImageConstants;
 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
@@ -83,6 +87,7 @@ import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampDelta;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
 import org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor;
@@ -109,7 +114,6 @@ import org.eclipse.ui.IEditorPart;
  * Main implementation for the Call Stack view
  *
  * @author Patrick Tasse
- * @since 2.0
  */
 public class CallStackView extends TmfView {
 
@@ -454,11 +458,11 @@ public class CallStackView extends TmfView {
     }
 
     private class BuildThread extends Thread {
-        private final ITmfTrace fBuildTrace;
+        private final @NonNull ITmfTrace fBuildTrace;
         private final ITmfTrace fParentTrace;
         private final IProgressMonitor fMonitor;
 
-        public BuildThread(ITmfTrace trace, ITmfTrace parentTrace) {
+        public BuildThread(@NonNull ITmfTrace trace, ITmfTrace parentTrace) {
             super("CallStackView build"); //$NON-NLS-1$
             fBuildTrace = trace;
             fParentTrace = parentTrace;
@@ -674,7 +678,6 @@ public class CallStackView extends TmfView {
      *
      * @param signal
      *            The incoming signal
-     * @since 2.0
      */
     @TmfSignalHandler
     public void traceOpened(TmfTraceOpenedSignal signal) {
@@ -833,6 +836,7 @@ public class CallStackView extends TmfView {
                 refresh();
                 synchronized (fBuildThreadMap) {
                     for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
+                        trace = checkNotNull(trace);
                         BuildThread buildThread = new BuildThread(trace, fTrace);
                         fBuildThreadMap.put(trace, buildThread);
                         buildThread.start();
@@ -846,7 +850,7 @@ public class CallStackView extends TmfView {
         }
     }
 
-    private void buildThreadList(final ITmfTrace trace, final ITmfTrace parentTrace, IProgressMonitor monitor) {
+    private void buildThreadList(final @NonNull ITmfTrace trace, final ITmfTrace parentTrace, IProgressMonitor monitor) {
         if (monitor.isCanceled()) {
             return;
         }
@@ -1111,10 +1115,11 @@ public class CallStackView extends TmfView {
                 }
                 fTimeGraphCombo.getTimeGraphViewer().setTimeBounds(fStartTime, fEndTime);
 
-                long selectionBeginTime = fTrace == null ? 0 : fTraceManager.getSelectionBeginTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-                long selectionEndTime = fTrace == null ? 0 : fTraceManager.getSelectionEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-                long startTime = fTrace == null ? 0 : fTraceManager.getCurrentRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-                long endTime = fTrace == null ? 0 : fTraceManager.getCurrentRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+                TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
+                long selectionBeginTime = fTrace == null ? 0 : ctx.getSelectionRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+                long selectionEndTime = fTrace == null ? 0 : ctx.getSelectionRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+                long startTime = fTrace == null ? 0 : ctx.getWindowRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+                long endTime = fTrace == null ? 0 : ctx.getWindowRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
                 startTime = Math.max(startTime, fStartTime);
                 endTime = Math.min(endTime, fEndTime);
                 fTimeGraphCombo.getTimeGraphViewer().setSelectionRange(selectionBeginTime, selectionEndTime);
@@ -1313,7 +1318,7 @@ public class CallStackView extends TmfView {
         return fPrevEventAction;
     }
 
-    private static @Nullable AbstractCallStackAnalysis getCallStackModule(ITmfTrace trace) {
+    private static @Nullable AbstractCallStackAnalysis getCallStackModule(@NonNull ITmfTrace trace) {
         /*
          * Since we cannot know the exact analysis ID (in separate plugins), we
          * will search using the analysis type.
This page took 0.02554 seconds and 5 git commands to generate.