1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.ui
.actions
;
12 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
13 import org
.eclipse
.jdt
.annotation
.Nullable
;
14 import org
.eclipse
.jface
.action
.Action
;
15 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.signals
.TmfThreadSelectedSignal
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
17 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.TmfView
;
20 * Follow Thread Action, this action broadcasts a
21 * {@link TmfThreadSelectedSignal} when run, it sends a thread id and a trace to
24 * @author Matthew Khouzam
27 public class FollowThreadAction
extends Action
{
29 private final int fThreadId
;
30 private final TmfView fView
;
31 private final ITmfTrace fTrace
;
32 private final @Nullable String fThreadName
;
38 * the view that is generating the signal, but also shall
41 * the thread name, can be null
45 * the trace containing the thread
47 public FollowThreadAction(TmfView source
, @Nullable String threadName
, int threadId
, ITmfTrace trace
) {
49 fThreadName
= threadName
;
55 public String
getText() {
56 if (fThreadName
== null) {
57 return Messages
.FollowThreadAction_follow
+ ' ' + fThreadId
;
59 return Messages
.FollowThreadAction_follow
+ ' ' + fThreadName
+ '/' + fThreadId
;
64 fView
.broadcast(new TmfThreadSelectedSignal(fView
, fThreadId
, fTrace
));