1 /*******************************************************************************
2 * Copyright (c) 2010, 2015 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
10 * Francois Chouinard - Initial API and implementation, replaced Table by TmfVirtualTable
11 * Patrick Tasse - Factored out from events view,
12 * Filter implementation (inspired by www.eclipse.org/mat)
13 * Ansgar Radermacher - Support navigation to model URIs (Bug 396956)
14 * Bernd Hufmann - Updated call site and model URI implementation
15 * Alexandre Montplaisir - Update to new column API
16 * Matthew Khouzam - Add hide columns
17 *******************************************************************************/
19 package org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.events
;
21 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
23 import java
.io
.FileNotFoundException
;
24 import java
.util
.ArrayList
;
25 import java
.util
.Collection
;
26 import java
.util
.HashMap
;
27 import java
.util
.LinkedList
;
28 import java
.util
.List
;
29 import java
.util
.Map
.Entry
;
30 import java
.util
.regex
.Matcher
;
31 import java
.util
.regex
.Pattern
;
32 import java
.util
.regex
.PatternSyntaxException
;
34 import org
.eclipse
.core
.commands
.Command
;
35 import org
.eclipse
.core
.commands
.ExecutionException
;
36 import org
.eclipse
.core
.commands
.NotEnabledException
;
37 import org
.eclipse
.core
.commands
.NotHandledException
;
38 import org
.eclipse
.core
.commands
.ParameterizedCommand
;
39 import org
.eclipse
.core
.commands
.common
.NotDefinedException
;
40 import org
.eclipse
.core
.expressions
.IEvaluationContext
;
41 import org
.eclipse
.core
.resources
.IFile
;
42 import org
.eclipse
.core
.resources
.IMarker
;
43 import org
.eclipse
.core
.resources
.IResource
;
44 import org
.eclipse
.core
.resources
.IResourceVisitor
;
45 import org
.eclipse
.core
.resources
.ResourcesPlugin
;
46 import org
.eclipse
.core
.runtime
.CoreException
;
47 import org
.eclipse
.core
.runtime
.IPath
;
48 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
49 import org
.eclipse
.core
.runtime
.IStatus
;
50 import org
.eclipse
.core
.runtime
.ListenerList
;
51 import org
.eclipse
.core
.runtime
.Path
;
52 import org
.eclipse
.core
.runtime
.Status
;
53 import org
.eclipse
.core
.runtime
.jobs
.Job
;
54 import org
.eclipse
.emf
.common
.util
.URI
;
55 import org
.eclipse
.emf
.ecore
.EValidator
;
56 import org
.eclipse
.jdt
.annotation
.NonNull
;
57 import org
.eclipse
.jface
.action
.Action
;
58 import org
.eclipse
.jface
.action
.IAction
;
59 import org
.eclipse
.jface
.action
.IMenuListener
;
60 import org
.eclipse
.jface
.action
.IMenuManager
;
61 import org
.eclipse
.jface
.action
.IStatusLineManager
;
62 import org
.eclipse
.jface
.action
.MenuManager
;
63 import org
.eclipse
.jface
.action
.Separator
;
64 import org
.eclipse
.jface
.dialogs
.InputDialog
;
65 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
66 import org
.eclipse
.jface
.resource
.ColorRegistry
;
67 import org
.eclipse
.jface
.resource
.FontRegistry
;
68 import org
.eclipse
.jface
.resource
.JFaceResources
;
69 import org
.eclipse
.jface
.resource
.LocalResourceManager
;
70 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
71 import org
.eclipse
.jface
.util
.OpenStrategy
;
72 import org
.eclipse
.jface
.util
.PropertyChangeEvent
;
73 import org
.eclipse
.jface
.util
.SafeRunnable
;
74 import org
.eclipse
.jface
.viewers
.ArrayContentProvider
;
75 import org
.eclipse
.jface
.viewers
.ISelection
;
76 import org
.eclipse
.jface
.viewers
.ISelectionChangedListener
;
77 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
78 import org
.eclipse
.jface
.viewers
.LabelProvider
;
79 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
80 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
81 import org
.eclipse
.jface
.window
.Window
;
82 import org
.eclipse
.swt
.SWT
;
83 import org
.eclipse
.swt
.custom
.SashForm
;
84 import org
.eclipse
.swt
.custom
.StyleRange
;
85 import org
.eclipse
.swt
.custom
.TableEditor
;
86 import org
.eclipse
.swt
.events
.ControlAdapter
;
87 import org
.eclipse
.swt
.events
.ControlEvent
;
88 import org
.eclipse
.swt
.events
.FocusAdapter
;
89 import org
.eclipse
.swt
.events
.FocusEvent
;
90 import org
.eclipse
.swt
.events
.KeyAdapter
;
91 import org
.eclipse
.swt
.events
.KeyEvent
;
92 import org
.eclipse
.swt
.events
.MouseAdapter
;
93 import org
.eclipse
.swt
.events
.MouseEvent
;
94 import org
.eclipse
.swt
.events
.SelectionAdapter
;
95 import org
.eclipse
.swt
.events
.SelectionEvent
;
96 import org
.eclipse
.swt
.graphics
.Color
;
97 import org
.eclipse
.swt
.graphics
.Font
;
98 import org
.eclipse
.swt
.graphics
.GC
;
99 import org
.eclipse
.swt
.graphics
.Image
;
100 import org
.eclipse
.swt
.graphics
.Point
;
101 import org
.eclipse
.swt
.graphics
.Rectangle
;
102 import org
.eclipse
.swt
.layout
.FillLayout
;
103 import org
.eclipse
.swt
.layout
.GridData
;
104 import org
.eclipse
.swt
.layout
.GridLayout
;
105 import org
.eclipse
.swt
.widgets
.Composite
;
106 import org
.eclipse
.swt
.widgets
.Display
;
107 import org
.eclipse
.swt
.widgets
.Event
;
108 import org
.eclipse
.swt
.widgets
.Label
;
109 import org
.eclipse
.swt
.widgets
.Listener
;
110 import org
.eclipse
.swt
.widgets
.Menu
;
111 import org
.eclipse
.swt
.widgets
.MenuItem
;
112 import org
.eclipse
.swt
.widgets
.MessageBox
;
113 import org
.eclipse
.swt
.widgets
.Shell
;
114 import org
.eclipse
.swt
.widgets
.TableColumn
;
115 import org
.eclipse
.swt
.widgets
.TableItem
;
116 import org
.eclipse
.swt
.widgets
.Text
;
117 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
118 import org
.eclipse
.tracecompass
.internal
.tmf
.core
.filter
.TmfCollapseFilter
;
119 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Activator
;
120 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Messages
;
121 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.commands
.ExportToTextCommandHandler
;
122 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.dialogs
.MultiLineInputDialog
;
123 import org
.eclipse
.tracecompass
.tmf
.core
.component
.ITmfEventProvider
;
124 import org
.eclipse
.tracecompass
.tmf
.core
.component
.TmfComponent
;
125 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
126 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
127 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfContentFieldAspect
;
128 import org
.eclipse
.tracecompass
.tmf
.core
.event
.collapse
.ITmfCollapsibleEvent
;
129 import org
.eclipse
.tracecompass
.tmf
.core
.event
.lookup
.ITmfCallsite
;
130 import org
.eclipse
.tracecompass
.tmf
.core
.event
.lookup
.ITmfModelLookup
;
131 import org
.eclipse
.tracecompass
.tmf
.core
.event
.lookup
.ITmfSourceLookup
;
132 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.ITmfFilter
;
133 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
134 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
.TmfFilterAndNode
;
135 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
.TmfFilterMatchesNode
;
136 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
.TmfFilterNode
;
137 import org
.eclipse
.tracecompass
.tmf
.core
.request
.ITmfEventRequest
.ExecutionType
;
138 import org
.eclipse
.tracecompass
.tmf
.core
.request
.TmfEventRequest
;
139 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfEventFilterAppliedSignal
;
140 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfEventSearchAppliedSignal
;
141 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfEventSelectedSignal
;
142 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSelectionRangeUpdatedSignal
;
143 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignalHandler
;
144 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceUpdatedSignal
;
145 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.ITmfTimestamp
;
146 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimeRange
;
147 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimestamp
;
148 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfContext
;
149 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
150 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTrace
;
151 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
152 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.location
.ITmfLocation
;
153 import org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.events
.TmfEventsCache
.CachedEvent
;
154 import org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.events
.columns
.TmfEventTableColumn
;
155 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.colors
.ColorSetting
;
156 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.colors
.ColorSettingsManager
;
157 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.colors
.IColorSettingsListener
;
158 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.filter
.FilterManager
;
159 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.rawviewer
.TmfRawEventViewer
;
160 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.virtualtable
.TmfVirtualTable
;
161 import org
.eclipse
.ui
.IWorkbenchPage
;
162 import org
.eclipse
.ui
.PlatformUI
;
163 import org
.eclipse
.ui
.commands
.ICommandService
;
164 import org
.eclipse
.ui
.dialogs
.ListDialog
;
165 import org
.eclipse
.ui
.handlers
.IHandlerService
;
166 import org
.eclipse
.ui
.ide
.IDE
;
167 import org
.eclipse
.ui
.ide
.IGotoMarker
;
168 import org
.eclipse
.ui
.themes
.ColorUtil
;
169 import org
.eclipse
.ui
.themes
.IThemeManager
;
171 import com
.google
.common
.base
.Joiner
;
172 import com
.google
.common
.collect
.HashMultimap
;
173 import com
.google
.common
.collect
.ImmutableList
;
174 import com
.google
.common
.collect
.Multimap
;
177 * The generic TMF Events table
179 * This is a view that will list events that are read from a trace.
181 * @author Francois Chouinard
182 * @author Patrick Tasse
184 public class TmfEventsTable
extends TmfComponent
implements IGotoMarker
, IColorSettingsListener
, ISelectionProvider
, IPropertyChangeListener
{
187 * Empty string array, used by {@link #getItemStrings}.
189 protected static final @NonNull String
[] EMPTY_STRING_ARRAY
= new String
[0];
194 protected static final @NonNull String EMPTY_STRING
= ""; //$NON-NLS-1$
196 private static final boolean IS_LINUX
= System
.getProperty("os.name").contains("Linux") ?
true : false; //$NON-NLS-1$ //$NON-NLS-2$
198 private static final String FONT_DEFINITION_ID
= "org.eclipse.tracecompass.tmf.ui.font.eventtable"; //$NON-NLS-1$
199 private static final String HIGHLIGHT_COLOR_DEFINITION_ID
= "org.eclipse.tracecompass.tmf.ui.color.eventtable.highlight"; //$NON-NLS-1$
201 private static final Image BOOKMARK_IMAGE
= Activator
.getDefault().getImageFromPath(
202 "icons/elcl16/bookmark_obj.gif"); //$NON-NLS-1$
203 private static final Image SEARCH_IMAGE
= Activator
.getDefault().getImageFromPath("icons/elcl16/search.gif"); //$NON-NLS-1$
204 private static final Image SEARCH_MATCH_IMAGE
= Activator
.getDefault().getImageFromPath(
205 "icons/elcl16/search_match.gif"); //$NON-NLS-1$
206 private static final Image SEARCH_MATCH_BOOKMARK_IMAGE
= Activator
.getDefault().getImageFromPath(
207 "icons/elcl16/search_match_bookmark.gif"); //$NON-NLS-1$
208 private static final Image FILTER_IMAGE
= Activator
.getDefault().getImageFromPath("icons/elcl16/filter_items.gif"); //$NON-NLS-1$
209 private static final Image STOP_IMAGE
= Activator
.getDefault().getImageFromPath("icons/elcl16/stop.gif"); //$NON-NLS-1$
210 private static final String SEARCH_HINT
= Messages
.TmfEventsTable_SearchHint
;
211 private static final String FILTER_HINT
= Messages
.TmfEventsTable_FilterHint
;
212 private static final int MAX_CACHE_SIZE
= 1000;
214 private static final int MARGIN_COLUMN_INDEX
= 0;
215 private static final int FILTER_SUMMARY_INDEX
= 1;
216 private static final int EVENT_COLUMNS_START_INDEX
= MARGIN_COLUMN_INDEX
+ 1;
219 * The events table search/filter/data keys
222 * @author Patrick Tasse
224 public interface Key
{
226 String SEARCH_TXT
= "$srch_txt"; //$NON-NLS-1$
229 String SEARCH_OBJ
= "$srch_obj"; //$NON-NLS-1$
232 String FILTER_TXT
= "$fltr_txt"; //$NON-NLS-1$
235 String FILTER_OBJ
= "$fltr_obj"; //$NON-NLS-1$
238 String TIMESTAMP
= "$time"; //$NON-NLS-1$
241 String RANK
= "$rank"; //$NON-NLS-1$
243 /** Bookmark indicator */
244 String BOOKMARK
= "$bookmark"; //$NON-NLS-1$
246 /** Event aspect represented by this column */
247 String ASPECT
= "$aspect"; //$NON-NLS-1$
250 * Table item list of style ranges
254 String STYLE_RANGES
= "$style_ranges"; //$NON-NLS-1$
257 * The width of a table item
261 String WIDTH
= "$width"; //$NON-NLS-1$
265 * The events table search/filter state
268 * @author Patrick Tasse
270 public static enum HeaderState
{
271 /** A search is being run */
274 /** A filter is applied */
278 interface Direction
{
283 // ------------------------------------------------------------------------
285 // ------------------------------------------------------------------------
287 /** The virtual event table */
288 protected TmfVirtualTable fTable
;
290 private Composite fComposite
;
291 private SashForm fSashForm
;
292 private TmfRawEventViewer fRawViewer
;
293 private ITmfTrace fTrace
;
294 private volatile boolean fPackDone
= false;
295 private HeaderState fHeaderState
= HeaderState
.SEARCH
;
296 private long fSelectedRank
= 0;
297 private ITmfTimestamp fSelectedBeginTimestamp
= null;
298 private IStatusLineManager fStatusLineManager
= null;
301 private long fFilterMatchCount
;
302 private long fFilterCheckCount
;
303 private FilterThread fFilterThread
;
304 private boolean fFilterThreadResume
= false;
305 private final Object fFilterSyncObj
= new Object();
306 private SearchThread fSearchThread
;
307 private final Object fSearchSyncObj
= new Object();
310 * List of selection change listeners (element type:
311 * <code>ISelectionChangedListener</code>).
313 * @see #fireSelectionChanged
315 private ListenerList selectionChangedListeners
= new ListenerList();
317 // Bookmark map <Rank, MarkerId>
318 private Multimap
<Long
, Long
> fBookmarksMap
= HashMultimap
.create();
319 private IFile fBookmarksFile
;
320 private long fPendingGotoRank
= -1;
323 private LocalResourceManager fResourceManager
= new LocalResourceManager(JFaceResources
.getResources());
324 private Color fGrayColor
;
325 private Color fGreenColor
;
326 private Color fHighlightColor
;
328 private Font fBoldFont
;
330 private final List
<TmfEventTableColumn
> fColumns
= new LinkedList
<>();
333 private final TmfEventsCache fCache
;
334 private boolean fCacheUpdateBusy
= false;
335 private boolean fCacheUpdatePending
= false;
336 private boolean fCacheUpdateCompleted
= false;
337 private final Object fCacheUpdateSyncObj
= new Object();
339 // Keep track of column order, it is needed after table is disposed
340 private int[] fColumnOrder
;
342 private boolean fDisposeOnClose
;
344 private Menu fHeaderMenu
;
346 private Menu fTablePopup
;
348 private Menu fRawTablePopup
;
350 // ------------------------------------------------------------------------
352 // ------------------------------------------------------------------------
355 * Basic constructor, using the default set of columns
358 * The parent composite UI object
360 * The size of the event table cache
362 public TmfEventsTable(final Composite parent
, final int cacheSize
) {
363 this(parent
, cacheSize
, TmfTrace
.BASE_ASPECTS
);
367 * Legacy constructor, using ColumnData to define columns
370 * The parent composite UI object
372 * The size of the event table cache
374 * The column data array
375 * @deprecated Deprecated constructor, use
376 * {@link #TmfEventsTable(Composite, int, Collection)}
379 public TmfEventsTable(final Composite parent
, int cacheSize
,
380 final org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.virtualtable
.ColumnData
[] columnData
) {
382 * We'll do a "best-effort" to keep trace types still using this API to
383 * keep working, by defining a TmfEventTableColumn for each ColumnData
386 this(parent
, cacheSize
, convertFromColumnData(columnData
));
390 private static @NonNull Iterable
<ITmfEventAspect
> convertFromColumnData(
391 org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.virtualtable
.ColumnData
[] columnData
) {
393 ImmutableList
.Builder
<ITmfEventAspect
> builder
= new ImmutableList
.Builder
<>();
394 for (org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.virtualtable
.ColumnData col
: columnData
) {
395 String fieldName
= col
.header
;
396 if (fieldName
!= null) {
397 builder
.add(new TmfContentFieldAspect(fieldName
, fieldName
));
400 return checkNotNull(builder
.build());
404 * Standard constructor, where we define which columns to use.
407 * The parent composite UI object
409 * The size of the event table cache
411 * The event aspects to display in this table. One column per
412 * aspect will be created.
414 * The iteration order of this collection will correspond to the
415 * initial ordering of the columns in the table.
418 public TmfEventsTable(final Composite parent
, int cacheSize
,
419 @NonNull Iterable
<ITmfEventAspect
> aspects
) {
420 super("TmfEventsTable"); //$NON-NLS-1$
422 fComposite
= new Composite(parent
, SWT
.NONE
);
423 final GridLayout gl
= new GridLayout(1, false);
426 gl
.verticalSpacing
= 0;
427 fComposite
.setLayout(gl
);
429 fSashForm
= new SashForm(fComposite
, SWT
.HORIZONTAL
);
430 fSashForm
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
432 // Create a virtual table
433 final int style
= SWT
.H_SCROLL
| SWT
.V_SCROLL
| SWT
.MULTI
| SWT
.FULL_SELECTION
;
434 fTable
= new TmfVirtualTable(fSashForm
, style
);
436 // Set the table layout
437 final GridData layoutData
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true);
438 fTable
.setLayoutData(layoutData
);
440 // Some cosmetic enhancements
441 fTable
.setHeaderVisible(true);
442 fTable
.setLinesVisible(true);
445 for (ITmfEventAspect aspect
: aspects
) {
446 if (aspect
!= null) {
447 fColumns
.add(new TmfEventTableColumn(aspect
));
451 TmfMarginColumn collapseCol
= new TmfMarginColumn();
452 fColumns
.add(MARGIN_COLUMN_INDEX
, collapseCol
);
454 fHeaderMenu
= new Menu(fTable
);
455 // Create the UI columns in the table
456 for (TmfEventTableColumn col
: fColumns
) {
457 TableColumn column
= fTable
.newTableColumn(SWT
.LEFT
);
458 column
.setText(col
.getHeaderName());
459 column
.setToolTipText(col
.getHeaderTooltip());
460 column
.setData(Key
.ASPECT
, col
.getEventAspect());
462 if (col
instanceof TmfMarginColumn
) {
463 column
.setResizable(false);
465 column
.setMoveable(true);
466 createHeaderMenuItem(fHeaderMenu
, column
);
468 column
.addControlListener(new ControlAdapter() {
470 * Make sure that the margin column is always first and keep the
471 * column order variable up to date.
474 public void controlMoved(ControlEvent e
) {
475 int[] order
= fTable
.getColumnOrder();
476 if (order
[0] == MARGIN_COLUMN_INDEX
) {
477 fColumnOrder
= order
;
480 for (int i
= order
.length
- 1; i
> 0; i
--) {
481 if (order
[i
] == MARGIN_COLUMN_INDEX
) {
482 order
[i
] = order
[i
- 1];
483 order
[i
- 1] = MARGIN_COLUMN_INDEX
;
486 fTable
.setColumnOrder(order
);
487 fColumnOrder
= fTable
.getColumnOrder();
491 fColumnOrder
= fTable
.getColumnOrder();
493 // Set the frozen row for header row
494 fTable
.setFrozenRowCount(1);
496 // Create the header row cell editor
497 createHeaderEditor();
499 // Handle the table item selection
500 fTable
.addSelectionListener(new SelectionAdapter() {
502 public void widgetSelected(final SelectionEvent e
) {
503 if (e
.item
== null) {
506 updateStatusLine(null);
507 if (fTable
.getSelectionIndices().length
> 0) {
508 if (e
.item
.getData(Key
.RANK
) instanceof Long
) {
509 fSelectedRank
= (Long
) e
.item
.getData(Key
.RANK
);
510 fRawViewer
.selectAndReveal((Long
) e
.item
.getData(Key
.RANK
));
512 if (e
.item
.getData(Key
.TIMESTAMP
) instanceof ITmfTimestamp
) {
513 final ITmfTimestamp ts
= NonNullUtils
.checkNotNull((ITmfTimestamp
) e
.item
.getData(Key
.TIMESTAMP
));
514 if (fTable
.getSelectionIndices().length
== 1) {
515 fSelectedBeginTimestamp
= ts
;
517 ITmfTimestamp selectedBeginTimestamp
= fSelectedBeginTimestamp
;
518 if (selectedBeginTimestamp
!= null) {
519 broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable
.this, selectedBeginTimestamp
, ts
));
520 if (fTable
.getSelectionIndices().length
== 2) {
521 updateStatusLine(ts
.getDelta(selectedBeginTimestamp
));
525 if (fTable
.getSelectionIndices().length
== 1) {
526 fSelectedBeginTimestamp
= null;
530 if (e
.item
.getData() instanceof ITmfEvent
) {
531 broadcast(new TmfEventSelectedSignal(TmfEventsTable
.this, (ITmfEvent
) e
.item
.getData()));
532 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, new StructuredSelection(e
.item
.getData())));
534 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, StructuredSelection
.EMPTY
));
539 int realCacheSize
= Math
.max(cacheSize
, Display
.getDefault().getBounds().height
/ fTable
.getItemHeight());
540 realCacheSize
= Math
.min(realCacheSize
, MAX_CACHE_SIZE
);
541 fCache
= new TmfEventsCache(realCacheSize
, this);
543 // Handle the table item requests
544 fTable
.addListener(SWT
.SetData
, new Listener() {
547 public void handleEvent(final Event event
) {
549 final TableItem item
= (TableItem
) event
.item
;
550 int index
= event
.index
- 1; // -1 for the header row
552 if (event
.index
== 0) {
553 setHeaderRowItemData(item
);
557 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
558 if ((event
.index
== 1) || (event
.index
== (fTable
.getItemCount() - 1))) {
559 setFilterStatusRowItemData(item
);
562 /* -1 for top filter status row */
566 final CachedEvent cachedEvent
= fCache
.getEvent(index
);
567 if (cachedEvent
!= null) {
568 setItemData(item
, cachedEvent
, cachedEvent
.rank
);
572 // Else, fill the cache asynchronously (and off the UI thread)
577 fTable
.addListener(SWT
.MenuDetect
, new Listener() {
579 public void handleEvent(Event event
) {
580 Point pt
= fTable
.getDisplay().map(null, fTable
, new Point(event
.x
, event
.y
));
581 Rectangle clientArea
= fTable
.getClientArea();
582 boolean header
= clientArea
.y
<= pt
.y
&& pt
.y
< (clientArea
.y
+ fTable
.getHeaderHeight());
583 fTable
.setMenu(header ? fHeaderMenu
: fTablePopup
);
587 fTable
.addMouseListener(new MouseAdapter() {
589 public void mouseDoubleClick(final MouseEvent event
) {
590 if (event
.button
!= 1) {
593 // Identify the selected row
594 final Point point
= new Point(event
.x
, event
.y
);
595 final TableItem item
= fTable
.getItem(point
);
597 final Rectangle imageBounds
= item
.getImageBounds(0);
598 imageBounds
.width
= BOOKMARK_IMAGE
.getBounds().width
;
599 if (imageBounds
.contains(point
)) {
600 final Long rank
= (Long
) item
.getData(Key
.RANK
);
602 toggleBookmark(rank
);
609 final Listener tooltipListener
= new Listener() {
610 Shell tooltipShell
= null;
613 public void handleEvent(final Event event
) {
614 switch (event
.type
) {
616 final TableItem item
= fTable
.getItem(new Point(event
.x
, event
.y
));
620 final Long rank
= (Long
) item
.getData(Key
.RANK
);
624 final String tooltipText
= (String
) item
.getData(Key
.BOOKMARK
);
625 final Rectangle bounds
= item
.getImageBounds(0);
626 bounds
.width
= BOOKMARK_IMAGE
.getBounds().width
;
627 if (!bounds
.contains(event
.x
, event
.y
)) {
630 if ((tooltipShell
!= null) && !tooltipShell
.isDisposed()) {
631 tooltipShell
.dispose();
633 tooltipShell
= new Shell(fTable
.getShell(), SWT
.ON_TOP
| SWT
.NO_FOCUS
| SWT
.TOOL
);
634 tooltipShell
.setBackground(PlatformUI
.getWorkbench().getDisplay().getSystemColor(SWT
.COLOR_INFO_BACKGROUND
));
635 final FillLayout layout
= new FillLayout();
636 layout
.marginWidth
= 2;
637 tooltipShell
.setLayout(layout
);
638 final Label label
= new Label(tooltipShell
, SWT
.WRAP
);
639 String text
= rank
.toString() + (tooltipText
!= null ?
": " + tooltipText
: EMPTY_STRING
); //$NON-NLS-1$
640 label
.setForeground(PlatformUI
.getWorkbench().getDisplay().getSystemColor(SWT
.COLOR_INFO_FOREGROUND
));
641 label
.setBackground(PlatformUI
.getWorkbench().getDisplay().getSystemColor(SWT
.COLOR_INFO_BACKGROUND
));
643 label
.addListener(SWT
.MouseExit
, this);
644 label
.addListener(SWT
.MouseDown
, this);
645 label
.addListener(SWT
.MouseWheel
, this);
646 final Point size
= tooltipShell
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
);
648 * Bug in Linux. The coordinates of the event have an origin
649 * that excludes the table header but the method toDisplay()
650 * expects coordinates relative to an origin that includes
655 y
+= fTable
.getHeaderHeight();
657 Point pt
= fTable
.toDisplay(event
.x
, y
);
658 pt
.x
+= BOOKMARK_IMAGE
.getBounds().width
;
659 pt
.y
+= item
.getBounds().height
;
660 tooltipShell
.setBounds(pt
.x
, pt
.y
, size
.x
, size
.y
);
661 tooltipShell
.setVisible(true);
669 if (tooltipShell
!= null) {
670 tooltipShell
.dispose();
680 fTable
.addListener(SWT
.MouseHover
, tooltipListener
);
681 fTable
.addListener(SWT
.Dispose
, tooltipListener
);
682 fTable
.addListener(SWT
.KeyDown
, tooltipListener
);
683 fTable
.addListener(SWT
.MouseMove
, tooltipListener
);
684 fTable
.addListener(SWT
.MouseExit
, tooltipListener
);
685 fTable
.addListener(SWT
.MouseDown
, tooltipListener
);
686 fTable
.addListener(SWT
.MouseWheel
, tooltipListener
);
688 fTable
.addListener(SWT
.EraseItem
, new Listener() {
690 public void handleEvent(Event event
) {
691 TableItem item
= (TableItem
) event
.item
;
692 List
<?
> styleRanges
= (List
<?
>) item
.getData(Key
.STYLE_RANGES
);
695 Color background
= item
.getBackground(event
.index
);
697 * Paint the background if it is not the default system color.
698 * In Windows, if you let the widget draw the background, it
699 * will not show the item's background color if the item is
700 * selected or hot. If there are no style ranges and the item
701 * background is the default system color, we do not want to
702 * paint it or otherwise we would override the platform theme
703 * (e.g. alternating colors).
705 if (styleRanges
!= null || !background
.equals(item
.getParent().getBackground())) {
706 // we will paint the table item's background
707 event
.detail
&= ~SWT
.BACKGROUND
;
709 // paint the item's default background
710 gc
.setBackground(background
);
711 gc
.fillRectangle(event
.x
, event
.y
, event
.width
, event
.height
);
715 * We will paint the table item's foreground. In Windows, if you
716 * paint the background but let the widget draw the foreground,
717 * it will override your background, unless the item is selected
720 event
.detail
&= ~SWT
.FOREGROUND
;
722 // paint the highlighted background for all style ranges
723 if (styleRanges
!= null) {
724 Rectangle textBounds
= item
.getTextBounds(event
.index
);
725 String text
= item
.getText(event
.index
);
726 for (Object o
: styleRanges
) {
727 if (o
instanceof StyleRange
) {
728 StyleRange styleRange
= (StyleRange
) o
;
729 if (styleRange
.data
.equals(event
.index
)) {
730 int startIndex
= styleRange
.start
;
731 int endIndex
= startIndex
+ styleRange
.length
;
732 int startX
= gc
.stringExtent(text
.substring(0, startIndex
)).x
;
733 int endX
= gc
.stringExtent(text
.substring(0, endIndex
)).x
;
734 gc
.setBackground(styleRange
.background
);
735 gc
.fillRectangle(textBounds
.x
+ startX
, textBounds
.y
, (endX
- startX
), textBounds
.height
);
743 fTable
.addListener(SWT
.PaintItem
, new Listener() {
745 public void handleEvent(Event event
) {
746 TableItem item
= (TableItem
) event
.item
;
748 // we promised to paint the table item's foreground
750 Image image
= item
.getImage(event
.index
);
752 Rectangle imageBounds
= item
.getImageBounds(event
.index
);
754 * The image bounds don't match the default image position.
757 gc
.drawImage(image
, imageBounds
.x
+ 1, imageBounds
.y
+ 3);
759 gc
.drawImage(image
, imageBounds
.x
, imageBounds
.y
+ 1);
762 gc
.setForeground(item
.getForeground(event
.index
));
763 gc
.setFont(item
.getFont(event
.index
));
764 String text
= item
.getText(event
.index
);
765 Rectangle textBounds
= item
.getTextBounds(event
.index
);
767 * The text bounds don't match the default text position.
770 gc
.drawText(text
, textBounds
.x
+ 1, textBounds
.y
+ 3, true);
772 gc
.drawText(text
, textBounds
.x
- 1, textBounds
.y
+ 2, true);
782 PlatformUI
.getWorkbench().getThemeManager().addPropertyChangeListener(this);
784 ColorSettingsManager
.addColorSettingsListener(this);
786 fTable
.setItemCount(1); // +1 for header row
788 fRawViewer
= new TmfRawEventViewer(fSashForm
, SWT
.H_SCROLL
| SWT
.V_SCROLL
);
790 fRawViewer
.addSelectionListener(new Listener() {
792 public void handleEvent(final Event e
) {
793 if (fTrace
== null) {
797 if (e
.data
instanceof Long
) {
798 rank
= (Long
) e
.data
;
799 } else if (e
.data
instanceof ITmfLocation
) {
800 rank
= findRank((ITmfLocation
) e
.data
);
804 int index
= (int) rank
;
805 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
806 // +1 for top filter status row
807 index
= fCache
.getFilteredEventIndex(rank
) + 1;
810 fTable
.setSelection(index
+ 1);
811 fSelectedRank
= rank
;
812 updateStatusLine(null);
813 final TableItem
[] selection
= fTable
.getSelection();
814 if ((selection
!= null) && (selection
.length
> 0)) {
815 TableItem item
= fTable
.getSelection()[0];
816 final TmfTimestamp ts
= (TmfTimestamp
) item
.getData(Key
.TIMESTAMP
);
818 broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable
.this, ts
));
820 if (item
.getData() instanceof ITmfEvent
) {
821 broadcast(new TmfEventSelectedSignal(TmfEventsTable
.this, (ITmfEvent
) item
.getData()));
822 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, new StructuredSelection(item
.getData())));
824 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, StructuredSelection
.EMPTY
));
829 private long findRank(final ITmfLocation selectedLocation
) {
830 final double selectedRatio
= fTrace
.getLocationRatio(selectedLocation
);
832 long high
= fTrace
.getNbEvents();
833 long rank
= high
/ 2;
835 while (ratio
!= selectedRatio
) {
836 ITmfContext context
= fTrace
.seekEvent(rank
);
837 ratio
= fTrace
.getLocationRatio(context
.getLocation());
839 if (ratio
< selectedRatio
) {
841 rank
= (rank
+ high
) / 2;
842 } else if (ratio
> selectedRatio
) {
844 rank
= (rank
+ low
) / 2;
846 if ((high
- low
) < 2) {
854 fSashForm
.setWeights(new int[] { 1, 1 });
855 fRawViewer
.setVisible(false);
861 * Checked menu creator to make columns visible or not.
868 private static void createHeaderMenuItem(Menu parent
, final TableColumn column
) {
869 final MenuItem columnMenuItem
= new MenuItem(parent
, SWT
.CHECK
);
870 columnMenuItem
.setText(column
.getText());
871 columnMenuItem
.setSelection(column
.getResizable());
872 columnMenuItem
.addSelectionListener(new SelectionAdapter() {
874 public void widgetSelected(SelectionEvent e
) {
875 if (columnMenuItem
.getSelection()) {
876 column
.setWidth((int) column
.getData(Key
.WIDTH
));
877 column
.setResizable(true);
879 column
.setData(Key
.WIDTH
, column
.getWidth());
881 column
.setResizable(false);
887 private void createResetHeaderMenuItem() {
888 final MenuItem resetMenu
= new MenuItem(fHeaderMenu
, SWT
.PUSH
);
889 resetMenu
.setText(Messages
.TmfEventsTable_showAll
);
890 resetMenu
.addSelectionListener(new SelectionAdapter() {
892 public void widgetSelected(SelectionEvent e
) {
893 for (TableColumn column
: fTable
.getColumns()) {
894 final Object widthVal
= column
.getData(Key
.WIDTH
);
895 if (widthVal
instanceof Integer
) {
896 Integer width
= (Integer
) widthVal
;
897 if (!column
.getResizable()) {
898 column
.setWidth(width
);
899 column
.setResizable(true);
901 * This is because Linux always resizes the last
902 * column to fill in the void, this means that
903 * hiding a column resizes others and we can have 10
904 * columns that are 1000 pixels wide by hiding the
905 * last one progressively.
913 for (MenuItem menuItem
: fHeaderMenu
.getItems()) {
914 menuItem
.setSelection(true);
921 // ------------------------------------------------------------------------
923 // ------------------------------------------------------------------------
926 * Create a pop-up menu.
928 private void createPopupMenu() {
929 createResetHeaderMenuItem();
930 final IAction showTableAction
= new Action(Messages
.TmfEventsTable_ShowTableActionText
) {
933 fTable
.setVisible(true);
938 final IAction hideTableAction
= new Action(Messages
.TmfEventsTable_HideTableActionText
) {
941 fTable
.setVisible(false);
946 final IAction showRawAction
= new Action(Messages
.TmfEventsTable_ShowRawActionText
) {
949 fRawViewer
.setVisible(true);
951 final int index
= fTable
.getSelectionIndex();
953 fRawViewer
.selectAndReveal(index
- 1);
958 final IAction hideRawAction
= new Action(Messages
.TmfEventsTable_HideRawActionText
) {
961 fRawViewer
.setVisible(false);
966 final IAction openCallsiteAction
= new Action(Messages
.TmfEventsTable_OpenSourceCodeActionText
) {
969 final TableItem items
[] = fTable
.getSelection();
970 if (items
.length
!= 1) {
973 final TableItem item
= items
[0];
975 final Object data
= item
.getData();
976 if (data
instanceof ITmfSourceLookup
) {
977 ITmfSourceLookup event
= (ITmfSourceLookup
) data
;
978 ITmfCallsite cs
= event
.getCallsite();
979 if (cs
== null || cs
.getFileName() == null) {
982 IMarker marker
= null;
984 String fileName
= cs
.getFileName();
985 final String trimmedPath
= fileName
.replaceAll("\\.\\./", EMPTY_STRING
); //$NON-NLS-1$
986 final ArrayList
<IFile
> files
= new ArrayList
<>();
987 ResourcesPlugin
.getWorkspace().getRoot().accept(new IResourceVisitor() {
989 public boolean visit(IResource resource
) throws CoreException
{
990 if (resource
instanceof IFile
&& resource
.getFullPath().toString().endsWith(trimmedPath
)) {
991 files
.add((IFile
) resource
);
997 if (files
.size() > 1) {
998 ListDialog dialog
= new ListDialog(getTable().getShell());
999 dialog
.setContentProvider(ArrayContentProvider
.getInstance());
1000 dialog
.setLabelProvider(new LabelProvider() {
1002 public String
getText(Object element
) {
1003 return ((IFile
) element
).getFullPath().toString();
1006 dialog
.setInput(files
);
1007 dialog
.setTitle(Messages
.TmfEventsTable_OpenSourceCodeSelectFileDialogTitle
);
1008 dialog
.setMessage(Messages
.TmfEventsTable_OpenSourceCodeSelectFileDialogTitle
+ '\n' + cs
.toString());
1010 Object
[] result
= dialog
.getResult();
1011 if (result
!= null && result
.length
> 0) {
1012 file
= (IFile
) result
[0];
1014 } else if (files
.size() == 1) {
1015 file
= files
.get(0);
1018 marker
= file
.createMarker(IMarker
.MARKER
);
1019 marker
.setAttribute(IMarker
.LINE_NUMBER
, Long
.valueOf(cs
.getLineNumber()).intValue());
1020 IDE
.openEditor(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage(), marker
);
1022 } else if (files
.size() == 0) {
1023 displayException(new FileNotFoundException('\'' + cs
.toString() + '\'' + '\n' + Messages
.TmfEventsTable_OpenSourceCodeNotFound
));
1025 } catch (CoreException e
) {
1026 displayException(e
);
1032 final IAction openModelAction
= new Action(Messages
.TmfEventsTable_OpenModelActionText
) {
1036 final TableItem items
[] = fTable
.getSelection();
1037 if (items
.length
!= 1) {
1040 final TableItem item
= items
[0];
1042 final Object eventData
= item
.getData();
1043 if (eventData
instanceof ITmfModelLookup
) {
1044 String modelURI
= ((ITmfModelLookup
) eventData
).getModelUri();
1046 if (modelURI
!= null) {
1047 IWorkbenchPage activePage
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage();
1050 final URI uri
= URI
.createURI(modelURI
);
1051 if (uri
.isPlatformResource()) {
1052 IPath path
= new Path(uri
.toPlatformString(true));
1053 file
= ResourcesPlugin
.getWorkspace().getRoot().getFile(path
);
1054 } else if (uri
.isFile() && !uri
.isRelative()) {
1055 file
= ResourcesPlugin
.getWorkspace().getRoot().getFileForLocation(
1056 new Path(uri
.toFileString()));
1062 * create a temporary validation marker on the
1063 * model file, remove it afterwards thus,
1064 * navigation works with all model editors
1065 * supporting the navigation to a marker
1067 IMarker marker
= file
.createMarker(EValidator
.MARKER
);
1068 marker
.setAttribute(EValidator
.URI_ATTRIBUTE
, modelURI
);
1069 marker
.setAttribute(IMarker
.SEVERITY
, IMarker
.SEVERITY_INFO
);
1071 IDE
.openEditor(activePage
, marker
, OpenStrategy
.activateOnOpen());
1073 } catch (CoreException e
) {
1074 displayException(e
);
1077 displayException(new FileNotFoundException('\'' + modelURI
+ '\'' + '\n' + Messages
.TmfEventsTable_OpenModelUnsupportedURI
));
1084 final IAction exportToTextAction
= new Action(Messages
.TmfEventsTable_Export_to_text
) {
1087 IWorkbenchPage activePage
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage();
1088 Object handlerServiceObject
= activePage
.getActiveEditor().getSite().getService(IHandlerService
.class);
1089 IHandlerService handlerService
= (IHandlerService
) handlerServiceObject
;
1090 Object cmdServiceObject
= activePage
.getActiveEditor().getSite().getService(ICommandService
.class);
1091 ICommandService cmdService
= (ICommandService
) cmdServiceObject
;
1093 HashMap
<String
, Object
> parameters
= new HashMap
<>();
1094 Command command
= cmdService
.getCommand(ExportToTextCommandHandler
.COMMAND_ID
);
1095 ParameterizedCommand cmd
= ParameterizedCommand
.generateCommand(command
, parameters
);
1097 IEvaluationContext context
= handlerService
.getCurrentState();
1098 List
<TmfEventTableColumn
> exportColumns
= new ArrayList
<>();
1099 for (int i
: fTable
.getColumnOrder()) {
1100 // Omit the margin column
1101 if (i
>= EVENT_COLUMNS_START_INDEX
) {
1102 exportColumns
.add(fColumns
.get(i
));
1105 context
.addVariable(ExportToTextCommandHandler
.TMF_EVENT_TABLE_COLUMNS_ID
, exportColumns
);
1107 handlerService
.executeCommandInContext(cmd
, null, context
);
1108 } catch (ExecutionException
| NotDefinedException
| NotEnabledException
| NotHandledException e
) {
1109 displayException(e
);
1114 final IAction showSearchBarAction
= new Action(Messages
.TmfEventsTable_ShowSearchBarActionText
) {
1117 fHeaderState
= HeaderState
.SEARCH
;
1123 final IAction showFilterBarAction
= new Action(Messages
.TmfEventsTable_ShowFilterBarActionText
) {
1126 fHeaderState
= HeaderState
.FILTER
;
1132 final IAction clearFiltersAction
= new Action(Messages
.TmfEventsTable_ClearFiltersActionText
) {
1139 final IAction collapseAction
= new Action(Messages
.TmfEventsTable_CollapseFilterMenuName
) {
1142 applyFilter(new TmfCollapseFilter());
1146 class ToggleBookmarkAction
extends Action
{
1149 public ToggleBookmarkAction(final String text
, final Long rank
) {
1156 toggleBookmark(fRank
);
1160 final MenuManager tablePopupMenu
= new MenuManager();
1161 tablePopupMenu
.setRemoveAllWhenShown(true);
1162 tablePopupMenu
.addMenuListener(new IMenuListener() {
1164 public void menuAboutToShow(final IMenuManager manager
) {
1165 if (fTable
.getSelectionIndex() == 0) {
1166 // Right-click on header row
1167 if (fHeaderState
== HeaderState
.FILTER
) {
1168 tablePopupMenu
.add(showSearchBarAction
);
1170 tablePopupMenu
.add(showFilterBarAction
);
1174 final Point point
= fTable
.toControl(Display
.getDefault().getCursorLocation());
1175 final TableItem item
= fTable
.getSelection().length
> 0 ? fTable
.getSelection()[0] : null;
1177 final Rectangle imageBounds
= item
.getImageBounds(0);
1178 imageBounds
.width
= BOOKMARK_IMAGE
.getBounds().width
;
1179 if (point
.x
<= (imageBounds
.x
+ imageBounds
.width
)) {
1180 // Right-click on left margin
1181 final Long rank
= (Long
) item
.getData(Key
.RANK
);
1182 if ((rank
!= null) && (fBookmarksFile
!= null)) {
1183 if (fBookmarksMap
.containsKey(rank
)) {
1184 tablePopupMenu
.add(new ToggleBookmarkAction(
1185 Messages
.TmfEventsTable_RemoveBookmarkActionText
, rank
));
1187 tablePopupMenu
.add(new ToggleBookmarkAction(
1188 Messages
.TmfEventsTable_AddBookmarkActionText
, rank
));
1195 // Right-click on table
1196 if (fTable
.isVisible() && fRawViewer
.isVisible()) {
1197 tablePopupMenu
.add(hideTableAction
);
1198 tablePopupMenu
.add(hideRawAction
);
1199 } else if (!fTable
.isVisible()) {
1200 tablePopupMenu
.add(showTableAction
);
1201 } else if (!fRawViewer
.isVisible()) {
1202 tablePopupMenu
.add(showRawAction
);
1204 tablePopupMenu
.add(exportToTextAction
);
1205 tablePopupMenu
.add(new Separator());
1208 final Object data
= item
.getData();
1209 Separator separator
= null;
1210 if (data
instanceof ITmfSourceLookup
) {
1211 ITmfSourceLookup event
= (ITmfSourceLookup
) data
;
1212 if (event
.getCallsite() != null) {
1213 tablePopupMenu
.add(openCallsiteAction
);
1214 separator
= new Separator();
1218 if (data
instanceof ITmfModelLookup
) {
1219 ITmfModelLookup event
= (ITmfModelLookup
) data
;
1220 if (event
.getModelUri() != null) {
1221 tablePopupMenu
.add(openModelAction
);
1222 separator
= new Separator();
1225 if (separator
!= null) {
1226 tablePopupMenu
.add(separator
);
1232 * Only show collapse filter if at least one trace can be
1235 boolean isCollapsible
= false;
1236 if (fTrace
!= null) {
1237 for (ITmfTrace trace
: TmfTraceManager
.getTraceSet(fTrace
)) {
1238 Class
<?
extends ITmfEvent
> eventClass
= trace
.getEventType();
1239 isCollapsible
= ITmfCollapsibleEvent
.class.isAssignableFrom(eventClass
);
1240 if (isCollapsible
) {
1246 if (isCollapsible
&& !(fTable
.getData(Key
.FILTER_OBJ
) instanceof TmfCollapseFilter
)) {
1247 tablePopupMenu
.add(collapseAction
);
1248 tablePopupMenu
.add(new Separator());
1251 tablePopupMenu
.add(clearFiltersAction
);
1252 final ITmfFilterTreeNode
[] savedFilters
= FilterManager
.getSavedFilters();
1253 if (savedFilters
.length
> 0) {
1254 final MenuManager subMenu
= new MenuManager(Messages
.TmfEventsTable_ApplyPresetFilterMenuName
);
1255 for (final ITmfFilterTreeNode node
: savedFilters
) {
1256 if (node
instanceof TmfFilterNode
) {
1257 final TmfFilterNode filter
= (TmfFilterNode
) node
;
1258 subMenu
.add(new Action(filter
.getFilterName()) {
1261 applyFilter(filter
);
1266 tablePopupMenu
.add(subMenu
);
1268 appendToTablePopupMenu(tablePopupMenu
, item
);
1272 final MenuManager rawViewerPopupMenu
= new MenuManager();
1273 rawViewerPopupMenu
.setRemoveAllWhenShown(true);
1274 rawViewerPopupMenu
.addMenuListener(new IMenuListener() {
1276 public void menuAboutToShow(final IMenuManager manager
) {
1277 if (fTable
.isVisible() && fRawViewer
.isVisible()) {
1278 rawViewerPopupMenu
.add(hideTableAction
);
1279 rawViewerPopupMenu
.add(hideRawAction
);
1280 } else if (!fTable
.isVisible()) {
1281 rawViewerPopupMenu
.add(showTableAction
);
1282 } else if (!fRawViewer
.isVisible()) {
1283 rawViewerPopupMenu
.add(showRawAction
);
1285 appendToRawPopupMenu(tablePopupMenu
);
1289 fTablePopup
= tablePopupMenu
.createContextMenu(fTable
);
1290 fTable
.setMenu(fTablePopup
);
1292 fRawTablePopup
= rawViewerPopupMenu
.createContextMenu(fRawViewer
);
1293 fRawViewer
.setMenu(fRawTablePopup
);
1297 * Append an item to the event table's pop-up menu.
1299 * @param tablePopupMenu
1301 * @param selectedItem
1302 * The item to append
1304 protected void appendToTablePopupMenu(final MenuManager tablePopupMenu
, final TableItem selectedItem
) {
1305 // override to append more actions
1309 * Append an item to the raw viewer's pop-up menu.
1311 * @param rawViewerPopupMenu
1314 protected void appendToRawPopupMenu(final MenuManager rawViewerPopupMenu
) {
1315 // override to append more actions
1319 public void dispose() {
1322 PlatformUI
.getWorkbench().getThemeManager().removePropertyChangeListener(this);
1323 ColorSettingsManager
.removeColorSettingsListener(this);
1324 fComposite
.dispose();
1325 if ((fTrace
!= null) && fDisposeOnClose
) {
1328 fResourceManager
.dispose();
1329 fRawViewer
.dispose();
1334 * Assign a layout data object to this view.
1337 * The layout data to assign
1339 public void setLayoutData(final Object layoutData
) {
1340 fComposite
.setLayoutData(layoutData
);
1344 * Get the virtual table contained in this event table.
1346 * @return The TMF virtual table
1348 public TmfVirtualTable
getTable() {
1355 * @deprecated The column headers are now set at the constructor, this
1356 * shouldn't be called anymore.
1359 protected void setColumnHeaders(final org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.virtualtable
.ColumnData
[] columnData
) {
1364 * Set a table item's data.
1369 * Which trace event to link with this entry
1371 * Which rank this event has in the trace/experiment
1373 protected void setItemData(final TableItem item
, final ITmfEvent event
, final long rank
) {
1374 String
[] itemStrings
= getItemStrings(fColumns
, event
);
1376 // Get the actual ITmfEvent from the CachedEvent
1377 ITmfEvent tmfEvent
= event
;
1378 if (event
instanceof CachedEvent
) {
1379 tmfEvent
= ((CachedEvent
) event
).event
;
1381 item
.setText(itemStrings
);
1382 item
.setData(tmfEvent
);
1383 item
.setData(Key
.TIMESTAMP
, new TmfTimestamp(tmfEvent
.getTimestamp()));
1384 item
.setData(Key
.RANK
, rank
);
1386 final Collection
<Long
> markerIds
= fBookmarksMap
.get(rank
);
1387 if (!markerIds
.isEmpty()) {
1388 Joiner joiner
= Joiner
.on("\n -").skipNulls(); //$NON-NLS-1$
1389 List
<Object
> parts
= new ArrayList
<>();
1390 if (markerIds
.size() > 1) {
1391 parts
.add(Messages
.TmfEventsTable_MultipleBookmarksToolTip
);
1394 for (long markerId
: markerIds
) {
1395 final IMarker marker
= fBookmarksFile
.findMarker(markerId
);
1396 parts
.add(marker
.getAttribute(IMarker
.MESSAGE
));
1398 } catch (CoreException e
) {
1399 displayException(e
);
1401 item
.setData(Key
.BOOKMARK
, joiner
.join(parts
));
1403 item
.setData(Key
.BOOKMARK
, null);
1406 boolean searchMatch
= false;
1407 boolean searchNoMatch
= false;
1408 final ITmfFilter searchFilter
= (ITmfFilter
) fTable
.getData(Key
.SEARCH_OBJ
);
1409 if (searchFilter
!= null) {
1410 if (searchFilter
.matches(tmfEvent
)) {
1413 searchNoMatch
= true;
1417 final ColorSetting colorSetting
= ColorSettingsManager
.getColorSetting(tmfEvent
);
1418 if (searchNoMatch
) {
1419 item
.setForeground(colorSetting
.getDimmedForegroundColor());
1420 item
.setBackground(colorSetting
.getDimmedBackgroundColor());
1422 item
.setForeground(colorSetting
.getForegroundColor());
1423 item
.setBackground(colorSetting
.getBackgroundColor());
1425 item
.setFont(fFont
);
1428 if (!markerIds
.isEmpty()) {
1429 item
.setImage(SEARCH_MATCH_BOOKMARK_IMAGE
);
1431 item
.setImage(SEARCH_MATCH_IMAGE
);
1433 } else if (!markerIds
.isEmpty()) {
1434 item
.setImage(BOOKMARK_IMAGE
);
1436 item
.setImage((Image
) null);
1439 List
<StyleRange
> styleRanges
= new ArrayList
<>();
1440 for (int index
= 0; index
< fTable
.getColumns().length
; index
++) {
1441 TableColumn column
= fTable
.getColumns()[index
];
1442 String regex
= null;
1443 if (fHeaderState
== HeaderState
.FILTER
) {
1444 regex
= (String
) column
.getData(Key
.FILTER_TXT
);
1445 } else if (searchMatch
) {
1446 regex
= (String
) column
.getData(Key
.SEARCH_TXT
);
1448 if (regex
!= null) {
1449 String text
= item
.getText(index
);
1451 Pattern pattern
= Pattern
.compile(regex
);
1452 Matcher matcher
= pattern
.matcher(text
);
1453 while (matcher
.find()) {
1454 int start
= matcher
.start();
1455 int length
= matcher
.end() - start
;
1456 Color foreground
= colorSetting
.getForegroundColor();
1457 Color background
= fHighlightColor
;
1458 StyleRange styleRange
= new StyleRange(start
, length
, foreground
, background
);
1459 styleRange
.data
= index
;
1460 styleRanges
.add(styleRange
);
1462 } catch (PatternSyntaxException e
) {
1467 if (styleRanges
.isEmpty()) {
1468 item
.setData(Key
.STYLE_RANGES
, null);
1470 item
.setData(Key
.STYLE_RANGES
, styleRanges
);
1472 item
.getParent().redraw();
1474 if ((itemStrings
[MARGIN_COLUMN_INDEX
] != null) && !itemStrings
[MARGIN_COLUMN_INDEX
].isEmpty()) {
1480 * Set the item data of the header row.
1483 * The item to use as table header
1485 protected void setHeaderRowItemData(final TableItem item
) {
1486 String txtKey
= null;
1487 if (fHeaderState
== HeaderState
.SEARCH
) {
1488 item
.setImage(SEARCH_IMAGE
);
1489 txtKey
= Key
.SEARCH_TXT
;
1490 } else if (fHeaderState
== HeaderState
.FILTER
) {
1491 item
.setImage(FILTER_IMAGE
);
1492 txtKey
= Key
.FILTER_TXT
;
1494 item
.setForeground(fGrayColor
);
1495 // Ignore collapse and image column
1496 for (int i
= EVENT_COLUMNS_START_INDEX
; i
< fTable
.getColumns().length
; i
++) {
1497 final TableColumn column
= fTable
.getColumns()[i
];
1498 final String filter
= (String
) column
.getData(txtKey
);
1499 if (filter
== null) {
1500 if (fHeaderState
== HeaderState
.SEARCH
) {
1501 item
.setText(i
, SEARCH_HINT
);
1502 } else if (fHeaderState
== HeaderState
.FILTER
) {
1503 item
.setText(i
, FILTER_HINT
);
1505 item
.setForeground(i
, fGrayColor
);
1506 item
.setFont(i
, fFont
);
1508 item
.setText(i
, filter
);
1509 item
.setForeground(i
, fGreenColor
);
1510 item
.setFont(i
, fBoldFont
);
1516 * Set the item data of the "filter status" row.
1519 * The item to use as filter status row
1521 protected void setFilterStatusRowItemData(final TableItem item
) {
1522 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
1523 if (i
== MARGIN_COLUMN_INDEX
) {
1524 if ((fTrace
== null) || (fFilterCheckCount
== fTrace
.getNbEvents())) {
1525 item
.setImage(FILTER_IMAGE
);
1527 item
.setImage(STOP_IMAGE
);
1531 if (i
== FILTER_SUMMARY_INDEX
) {
1532 item
.setText(FILTER_SUMMARY_INDEX
, fFilterMatchCount
+ "/" + fFilterCheckCount
); //$NON-NLS-1$
1534 item
.setText(i
, EMPTY_STRING
);
1538 item
.setData(Key
.TIMESTAMP
, null);
1539 item
.setData(Key
.RANK
, null);
1540 item
.setData(Key
.STYLE_RANGES
, null);
1541 item
.setForeground(null);
1542 item
.setBackground(null);
1543 item
.setFont(fFont
);
1547 * Create an editor for the header.
1549 private void createHeaderEditor() {
1550 final TableEditor tableEditor
= fTable
.createTableEditor();
1551 tableEditor
.horizontalAlignment
= SWT
.LEFT
;
1552 tableEditor
.verticalAlignment
= SWT
.CENTER
;
1553 tableEditor
.grabHorizontal
= true;
1554 tableEditor
.minimumWidth
= 50;
1556 // Handle the header row selection
1557 fTable
.addMouseListener(new MouseAdapter() {
1563 public void mouseDown(final MouseEvent event
) {
1564 if (event
.button
!= 1) {
1567 // Identify the selected row
1568 final Point point
= new Point(event
.x
, event
.y
);
1569 item
= fTable
.getItem(point
);
1571 // Header row selected
1572 if ((item
!= null) && (fTable
.indexOf(item
) == 0)) {
1574 // Margin column selected
1575 if (item
.getBounds(0).contains(point
)) {
1576 if (fHeaderState
== HeaderState
.SEARCH
) {
1577 fHeaderState
= HeaderState
.FILTER
;
1578 } else if (fHeaderState
== HeaderState
.FILTER
) {
1579 fHeaderState
= HeaderState
.SEARCH
;
1581 fTable
.setSelection(0);
1587 // Identify the selected column
1589 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
1590 final Rectangle rect
= item
.getBounds(i
);
1591 if (rect
.contains(point
)) {
1597 if (columnIndex
== -1) {
1601 column
= fTable
.getColumns()[columnIndex
];
1603 String txtKey
= null;
1604 if (fHeaderState
== HeaderState
.SEARCH
) {
1605 txtKey
= Key
.SEARCH_TXT
;
1606 } else if (fHeaderState
== HeaderState
.FILTER
) {
1607 txtKey
= Key
.FILTER_TXT
;
1611 * The control that will be the editor must be a child of
1614 final Text newEditor
= (Text
) fTable
.createTableEditorControl(Text
.class);
1615 final String headerString
= (String
) column
.getData(txtKey
);
1616 if (headerString
!= null) {
1617 newEditor
.setText(headerString
);
1619 newEditor
.addFocusListener(new FocusAdapter() {
1621 public void focusLost(final FocusEvent e
) {
1622 final boolean changed
= updateHeader(newEditor
.getText());
1628 newEditor
.addKeyListener(new KeyAdapter() {
1630 public void keyPressed(final KeyEvent e
) {
1631 if (e
.character
== SWT
.CR
) {
1632 updateHeader(newEditor
.getText());
1636 * Set focus on the table so that the next
1637 * carriage return goes to the next result
1639 TmfEventsTable
.this.getTable().setFocus();
1640 } else if (e
.character
== SWT
.ESC
) {
1641 tableEditor
.getEditor().dispose();
1645 newEditor
.selectAll();
1646 newEditor
.setFocus();
1647 tableEditor
.setEditor(newEditor
, item
, columnIndex
);
1652 * returns true is value was changed
1654 private boolean updateHeader(final String regex
) {
1655 String objKey
= null;
1656 String txtKey
= null;
1657 if (fHeaderState
== HeaderState
.SEARCH
) {
1658 objKey
= Key
.SEARCH_OBJ
;
1659 txtKey
= Key
.SEARCH_TXT
;
1660 } else if (fHeaderState
== HeaderState
.FILTER
) {
1661 objKey
= Key
.FILTER_OBJ
;
1662 txtKey
= Key
.FILTER_TXT
;
1664 if (regex
.length() > 0) {
1666 Pattern
.compile(regex
);
1667 if (regex
.equals(column
.getData(txtKey
))) {
1668 tableEditor
.getEditor().dispose();
1671 final TmfFilterMatchesNode filter
= new TmfFilterMatchesNode(null);
1672 ITmfEventAspect aspect
= (ITmfEventAspect
) column
.getData(Key
.ASPECT
);
1673 filter
.setEventAspect(aspect
);
1674 filter
.setRegex(regex
);
1675 column
.setData(objKey
, filter
);
1676 column
.setData(txtKey
, regex
);
1677 } catch (final PatternSyntaxException ex
) {
1678 tableEditor
.getEditor().dispose();
1679 MessageDialog
.openError(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell(),
1680 ex
.getDescription(), ex
.getMessage());
1684 if (column
.getData(txtKey
) == null) {
1685 tableEditor
.getEditor().dispose();
1688 column
.setData(objKey
, null);
1689 column
.setData(txtKey
, null);
1694 private void applyHeader() {
1695 if (fHeaderState
== HeaderState
.SEARCH
) {
1697 final TmfFilterAndNode filter
= new TmfFilterAndNode(null);
1698 for (final TableColumn col
: fTable
.getColumns()) {
1699 final Object filterObj
= col
.getData(Key
.SEARCH_OBJ
);
1700 if (filterObj
instanceof ITmfFilterTreeNode
) {
1701 filter
.addChild((ITmfFilterTreeNode
) filterObj
);
1704 if (filter
.getChildrenCount() > 0) {
1705 fTable
.setData(Key
.SEARCH_OBJ
, filter
);
1708 fireSearchApplied(filter
);
1710 fTable
.setData(Key
.SEARCH_OBJ
, null);
1712 fireSearchApplied(null);
1714 } else if (fHeaderState
== HeaderState
.FILTER
) {
1715 final TmfFilterAndNode filter
= new TmfFilterAndNode(null);
1716 for (final TableColumn col
: fTable
.getColumns()) {
1717 final Object filterObj
= col
.getData(Key
.FILTER_OBJ
);
1718 if (filterObj
instanceof ITmfFilterTreeNode
) {
1719 filter
.addChild((ITmfFilterTreeNode
) filterObj
);
1722 if (filter
.getChildrenCount() > 0) {
1723 applyFilter(filter
);
1729 tableEditor
.getEditor().dispose();
1733 fTable
.addKeyListener(new KeyAdapter() {
1735 public void keyPressed(final KeyEvent e
) {
1737 if (e
.character
== SWT
.ESC
) {
1741 } else if (e
.character
== SWT
.DEL
) {
1742 if (fHeaderState
== HeaderState
.SEARCH
) {
1744 for (final TableColumn column
: fTable
.getColumns()) {
1745 column
.setData(Key
.SEARCH_OBJ
, null);
1746 column
.setData(Key
.SEARCH_TXT
, null);
1748 fTable
.setData(Key
.SEARCH_OBJ
, null);
1750 fireSearchApplied(null);
1751 } else if (fHeaderState
== HeaderState
.FILTER
) {
1754 } else if (e
.character
== SWT
.CR
) {
1755 if ((e
.stateMask
& SWT
.SHIFT
) == 0) {
1766 * Send an event indicating a filter has been applied.
1769 * The filter that was just applied
1771 protected void fireFilterApplied(final ITmfFilter filter
) {
1772 broadcast(new TmfEventFilterAppliedSignal(this, fTrace
, filter
));
1776 * Send an event indicating that a search has been applied.
1779 * The search filter that was just applied
1781 protected void fireSearchApplied(final ITmfFilter filter
) {
1782 broadcast(new TmfEventSearchAppliedSignal(this, fTrace
, filter
));
1786 * Start the filtering thread.
1788 protected void startFilterThread() {
1789 synchronized (fFilterSyncObj
) {
1790 final ITmfFilterTreeNode filter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.FILTER_OBJ
);
1791 if (fFilterThread
== null || fFilterThread
.filter
!= filter
) {
1792 if (fFilterThread
!= null) {
1793 fFilterThread
.cancel();
1794 fFilterThreadResume
= false;
1796 fFilterThread
= new FilterThread(filter
);
1797 fFilterThread
.start();
1799 fFilterThreadResume
= true;
1805 * Stop the filtering thread.
1807 protected void stopFilterThread() {
1808 synchronized (fFilterSyncObj
) {
1809 if (fFilterThread
!= null) {
1810 fFilterThread
.cancel();
1811 fFilterThread
= null;
1812 fFilterThreadResume
= false;
1821 * The filter to apply
1823 protected void applyFilter(ITmfFilter filter
) {
1826 fFilterMatchCount
= 0;
1827 fFilterCheckCount
= 0;
1828 fCache
.applyFilter(filter
);
1830 fTable
.setData(Key
.FILTER_OBJ
, filter
);
1831 /* +1 for header row, +2 for top and bottom filter status rows */
1832 fTable
.setItemCount(3);
1833 startFilterThread();
1834 fireFilterApplied(filter
);
1838 * Clear all currently active filters.
1840 protected void clearFilters() {
1841 if (fTable
.getData(Key
.FILTER_OBJ
) == null) {
1846 fCache
.clearFilter();
1848 for (final TableColumn column
: fTable
.getColumns()) {
1849 column
.setData(Key
.FILTER_OBJ
, null);
1850 column
.setData(Key
.FILTER_TXT
, null);
1852 fTable
.setData(Key
.FILTER_OBJ
, null);
1853 if (fTrace
!= null) {
1854 /* +1 for header row */
1855 fTable
.setItemCount((int) fTrace
.getNbEvents() + 1);
1857 /* +1 for header row */
1858 fTable
.setItemCount(1);
1860 fFilterMatchCount
= 0;
1861 fFilterCheckCount
= 0;
1862 if (fSelectedRank
>= 0) {
1863 /* +1 for header row */
1864 fTable
.setSelection((int) fSelectedRank
+ 1);
1866 fTable
.setSelection(0);
1868 fireFilterApplied(null);
1869 updateStatusLine(null);
1871 // Set original width
1872 fTable
.getColumns()[MARGIN_COLUMN_INDEX
].setWidth(0);
1877 * Wrapper Thread object for the filtering thread.
1879 protected class FilterThread
extends Thread
{
1880 private final ITmfFilterTreeNode filter
;
1881 private TmfEventRequest request
;
1882 private boolean refreshBusy
= false;
1883 private boolean refreshPending
= false;
1884 private final Object syncObj
= new Object();
1890 * The filter this thread will be processing
1892 public FilterThread(final ITmfFilterTreeNode filter
) {
1893 super("Filter Thread"); //$NON-NLS-1$
1894 this.filter
= filter
;
1899 if (fTrace
== null) {
1902 final int nbRequested
= (int) (fTrace
.getNbEvents() - fFilterCheckCount
);
1903 if (nbRequested
<= 0) {
1906 request
= new TmfEventRequest(ITmfEvent
.class, TmfTimeRange
.ETERNITY
,
1907 (int) fFilterCheckCount
, nbRequested
, ExecutionType
.BACKGROUND
) {
1909 public void handleData(final ITmfEvent event
) {
1910 super.handleData(event
);
1911 if (request
.isCancelled()) {
1914 boolean refresh
= false;
1915 if (filter
.matches(event
)) {
1916 final long rank
= fFilterCheckCount
;
1917 final int index
= (int) fFilterMatchCount
;
1918 fFilterMatchCount
++;
1919 fCache
.storeEvent(event
, rank
, index
);
1922 if (filter
instanceof TmfCollapseFilter
) {
1923 fCache
.updateCollapsedEvent((int) fFilterMatchCount
- 1);
1927 if (refresh
|| (fFilterCheckCount
% 100) == 0) {
1930 fFilterCheckCount
++;
1933 ((ITmfEventProvider
) fTrace
).sendRequest(request
);
1935 request
.waitForCompletion();
1936 } catch (final InterruptedException e
) {
1939 synchronized (fFilterSyncObj
) {
1940 fFilterThread
= null;
1941 if (fFilterThreadResume
) {
1942 fFilterThreadResume
= false;
1943 fFilterThread
= new FilterThread(filter
);
1944 fFilterThread
.start();
1950 * Refresh the filter.
1952 public void refreshTable() {
1953 synchronized (syncObj
) {
1955 refreshPending
= true;
1960 Display
.getDefault().asyncExec(new Runnable() {
1963 if (request
.isCancelled()) {
1966 if (fTable
.isDisposed()) {
1970 * +1 for header row, +2 for top and bottom filter status
1973 fTable
.setItemCount((int) fFilterMatchCount
+ 3);
1975 synchronized (syncObj
) {
1976 refreshBusy
= false;
1977 if (refreshPending
) {
1978 refreshPending
= false;
1987 * Cancel this filtering thread.
1989 public void cancel() {
1990 if (request
!= null) {
1997 * Go to the next item of a search.
1999 protected void searchNext() {
2000 synchronized (fSearchSyncObj
) {
2001 if (fSearchThread
!= null) {
2004 final ITmfFilterTreeNode searchFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.SEARCH_OBJ
);
2005 if (searchFilter
== null) {
2008 final int selectionIndex
= fTable
.getSelectionIndex();
2010 if (selectionIndex
> 0) {
2011 /* -1 for header row, +1 for next event */
2012 startIndex
= selectionIndex
;
2015 * header row is selected, start at top event
2017 /* -1 for header row */
2018 startIndex
= Math
.max(0, fTable
.getTopIndex() - 1);
2020 final ITmfFilterTreeNode eventFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.FILTER_OBJ
);
2021 if (eventFilter
!= null) {
2022 // -1 for top filter status row
2023 startIndex
= Math
.max(0, startIndex
- 1);
2025 fSearchThread
= new SearchThread(searchFilter
, eventFilter
, startIndex
, fSelectedRank
, Direction
.FORWARD
);
2026 fSearchThread
.schedule();
2031 * Go to the previous item of a search.
2033 protected void searchPrevious() {
2034 synchronized (fSearchSyncObj
) {
2035 if (fSearchThread
!= null) {
2038 final ITmfFilterTreeNode searchFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.SEARCH_OBJ
);
2039 if (searchFilter
== null) {
2042 final int selectionIndex
= fTable
.getSelectionIndex();
2044 if (selectionIndex
> 0) {
2045 /* -1 for header row, -1 for previous event */
2046 startIndex
= selectionIndex
- 2;
2049 * Header row is selected, start at precedent of top event
2051 /* -1 for header row, -1 for previous event */
2052 startIndex
= fTable
.getTopIndex() - 2;
2054 final ITmfFilterTreeNode eventFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.FILTER_OBJ
);
2055 if (eventFilter
!= null) {
2056 /* -1 for top filter status row */
2057 startIndex
= startIndex
- 1;
2059 fSearchThread
= new SearchThread(searchFilter
, eventFilter
, startIndex
, fSelectedRank
, Direction
.BACKWARD
);
2060 fSearchThread
.schedule();
2065 * Stop the search thread.
2067 protected void stopSearchThread() {
2068 fPendingGotoRank
= -1;
2069 synchronized (fSearchSyncObj
) {
2070 if (fSearchThread
!= null) {
2071 fSearchThread
.cancel();
2072 fSearchThread
= null;
2078 * Wrapper for the search thread.
2080 protected class SearchThread
extends Job
{
2082 private ITmfFilterTreeNode searchFilter
;
2083 private ITmfFilterTreeNode eventFilter
;
2084 private int startIndex
;
2085 private int direction
;
2087 private long foundRank
= -1;
2088 private TmfEventRequest request
;
2089 private ITmfTimestamp foundTimestamp
= null;
2094 * @param searchFilter
2096 * @param eventFilter
2099 * The index at which we should start searching
2100 * @param currentRank
2103 * In which direction should we search, forward or backwards
2105 public SearchThread(final ITmfFilterTreeNode searchFilter
,
2106 final ITmfFilterTreeNode eventFilter
, final int startIndex
,
2107 final long currentRank
, final int direction
) {
2108 super(Messages
.TmfEventsTable_SearchingJobName
);
2109 this.searchFilter
= searchFilter
;
2110 this.eventFilter
= eventFilter
;
2111 this.startIndex
= startIndex
;
2112 this.rank
= currentRank
;
2113 this.direction
= direction
;
2117 protected IStatus
run(final IProgressMonitor monitor
) {
2118 final ITmfTrace trace
= fTrace
;
2119 if (trace
== null) {
2120 return Status
.OK_STATUS
;
2122 final Display display
= Display
.getDefault();
2123 if (startIndex
< 0) {
2124 rank
= (int) trace
.getNbEvents() - 1;
2126 * -1 for header row, -3 for header and top and bottom filter
2129 } else if (startIndex
>= (fTable
.getItemCount() - (eventFilter
== null ?
1 : 3))) {
2132 int idx
= startIndex
;
2133 while (foundRank
== -1) {
2134 final CachedEvent event
= fCache
.peekEvent(idx
);
2135 if (event
== null) {
2139 if (searchFilter
.matches(event
.event
) && ((eventFilter
== null) || eventFilter
.matches(event
.event
))) {
2140 foundRank
= event
.rank
;
2141 foundTimestamp
= event
.event
.getTimestamp();
2144 if (direction
== Direction
.FORWARD
) {
2150 if (foundRank
== -1) {
2151 if (direction
== Direction
.FORWARD
) {
2153 if (rank
> (trace
.getNbEvents() - 1)) {
2159 rank
= (int) trace
.getNbEvents() - 1;
2164 final int startRank
= (int) rank
;
2165 boolean wrapped
= false;
2166 while (!monitor
.isCanceled() && (foundRank
== -1)) {
2167 int nbRequested
= (direction
== Direction
.FORWARD ? Integer
.MAX_VALUE
: Math
.min((int) rank
+ 1, trace
.getCacheSize()));
2168 if (direction
== Direction
.BACKWARD
) {
2169 rank
= Math
.max(0, rank
- trace
.getCacheSize() + 1);
2171 request
= new TmfEventRequest(ITmfEvent
.class, TmfTimeRange
.ETERNITY
,
2172 (int) rank
, nbRequested
, ExecutionType
.BACKGROUND
) {
2173 long currentRank
= rank
;
2176 public void handleData(final ITmfEvent event
) {
2177 super.handleData(event
);
2178 if (searchFilter
.matches(event
) && ((eventFilter
== null) || eventFilter
.matches(event
))) {
2179 foundRank
= currentRank
;
2180 foundTimestamp
= event
.getTimestamp();
2181 if (direction
== Direction
.FORWARD
) {
2189 ((ITmfEventProvider
) trace
).sendRequest(request
);
2191 request
.waitForCompletion();
2192 if (request
.isCancelled()) {
2193 return Status
.OK_STATUS
;
2195 } catch (final InterruptedException e
) {
2196 synchronized (fSearchSyncObj
) {
2197 fSearchThread
= null;
2199 return Status
.OK_STATUS
;
2201 if (foundRank
== -1) {
2202 if (direction
== Direction
.FORWARD
) {
2204 synchronized (fSearchSyncObj
) {
2205 fSearchThread
= null;
2207 return Status
.OK_STATUS
;
2209 nbRequested
= (int) rank
;
2215 rank
= (int) trace
.getNbEvents() - 1;
2218 if ((rank
<= startRank
) && wrapped
) {
2219 synchronized (fSearchSyncObj
) {
2220 fSearchThread
= null;
2222 return Status
.OK_STATUS
;
2227 int index
= (int) foundRank
;
2228 if (eventFilter
!= null) {
2229 index
= fCache
.getFilteredEventIndex(foundRank
);
2231 /* +1 for header row, +1 for top filter status row */
2232 final int selection
= index
+ 1 + (eventFilter
!= null ?
+1 : 0);
2234 display
.asyncExec(new Runnable() {
2237 if (monitor
.isCanceled()) {
2240 if (fTable
.isDisposed()) {
2243 fTable
.setSelection(selection
);
2244 fSelectedRank
= foundRank
;
2245 fRawViewer
.selectAndReveal(fSelectedRank
);
2246 if (foundTimestamp
!= null) {
2247 broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable
.this, foundTimestamp
));
2249 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, getSelection()));
2250 synchronized (fSearchSyncObj
) {
2251 fSearchThread
= null;
2253 updateStatusLine(null);
2256 return Status
.OK_STATUS
;
2260 protected void canceling() {
2262 synchronized (fSearchSyncObj
) {
2263 fSearchThread
= null;
2269 * Create the resources.
2271 private void createResources() {
2272 fGrayColor
= fResourceManager
.createColor(ColorUtil
.blend(fTable
.getBackground().getRGB(), fTable
.getForeground().getRGB()));
2273 fGreenColor
= fTable
.getDisplay().getSystemColor(SWT
.COLOR_DARK_GREEN
);
2277 * Initialize the fonts.
2279 private void initializeFonts() {
2280 FontRegistry fontRegistry
= PlatformUI
.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
2281 fFont
= fontRegistry
.get(FONT_DEFINITION_ID
);
2282 fBoldFont
= fontRegistry
.getBold(FONT_DEFINITION_ID
);
2283 fTable
.setFont(fFont
);
2284 /* Column header font cannot be set. See Bug 63038 */
2288 * Initialize the colors.
2290 private void initializeColors() {
2291 ColorRegistry colorRegistry
= PlatformUI
.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
2292 fHighlightColor
= colorRegistry
.get(HIGHLIGHT_COLOR_DEFINITION_ID
);
2299 public void propertyChange(PropertyChangeEvent event
) {
2300 if ((IThemeManager
.CHANGE_CURRENT_THEME
.equals(event
.getProperty())) ||
2301 (FONT_DEFINITION_ID
.equals(event
.getProperty()))) {
2305 if ((IThemeManager
.CHANGE_CURRENT_THEME
.equals(event
.getProperty())) ||
2306 (HIGHLIGHT_COLOR_DEFINITION_ID
.equals(event
.getProperty()))) {
2315 protected void packColumns() {
2319 fTable
.setRedraw(false);
2321 TableColumn tableColumns
[] = fTable
.getColumns();
2322 for (int i
= 0; i
< tableColumns
.length
; i
++) {
2323 final TableColumn column
= tableColumns
[i
];
2324 packSingleColumn(i
, column
);
2325 column
.setData(Key
.WIDTH
, column
.getWidth());
2329 // Make sure that redraw is always enabled.
2330 fTable
.setRedraw(true);
2335 private void packMarginColumn() {
2336 TableColumn
[] columns
= fTable
.getColumns();
2337 if (columns
.length
> 0) {
2338 packSingleColumn(0, columns
[0]);
2342 private void packSingleColumn(int i
, final TableColumn column
) {
2343 final int headerWidth
= column
.getWidth();
2346 * Workaround for Linux which doesn't consider the image width of
2347 * search/filter row in TableColumn.pack() after having executed
2348 * TableItem.setImage(null) for other rows than search/filter row.
2350 boolean isCollapseFilter
= fTable
.getData(Key
.FILTER_OBJ
) instanceof TmfCollapseFilter
;
2351 if (IS_LINUX
&& (i
== 0) && isCollapseFilter
) {
2352 column
.setWidth(column
.getWidth() + SEARCH_IMAGE
.getBounds().width
);
2355 if (column
.getWidth() < headerWidth
) {
2356 column
.setWidth(headerWidth
);
2361 * Get the array of item strings (e.g., what to display in each cell of the
2362 * table row) corresponding to the columns and trace event passed in
2363 * parameter. The order of the Strings in the returned array will correspond
2364 * to the iteration order of 'columns'.
2367 * To ensure consistent results, make sure only call this within a scope
2368 * synchronized on 'columns'! If the order of 'columns' changes right after
2369 * this method is called, the returned value won't be ordered correctly
2372 private static String
[] getItemStrings(List
<TmfEventTableColumn
> columns
, ITmfEvent event
) {
2373 if (event
== null) {
2374 return EMPTY_STRING_ARRAY
;
2376 synchronized (columns
) {
2377 List
<String
> itemStrings
= new ArrayList
<>(columns
.size());
2378 for (TmfEventTableColumn column
: columns
) {
2379 ITmfEvent passedEvent
= event
;
2380 if (!(column
instanceof TmfMarginColumn
) && (event
instanceof CachedEvent
)) {
2382 * Make sure that the event object from the trace is passed
2383 * to all columns but the TmfMarginColumn
2385 passedEvent
= ((CachedEvent
) event
).event
;
2387 if (passedEvent
== null) {
2388 itemStrings
.add(EMPTY_STRING
);
2390 itemStrings
.add(column
.getItemString(passedEvent
));
2394 return itemStrings
.toArray(new String
[0]);
2399 * Get the contents of the row in the events table corresponding to an
2400 * event. The order of the elements corresponds to the current order of the
2404 * The event printed in this row
2405 * @return The event row entries
2407 public String
[] getItemStrings(ITmfEvent event
) {
2408 List
<TmfEventTableColumn
> columns
= new ArrayList
<>();
2409 for (int i
: fTable
.getColumnOrder()) {
2410 columns
.add(fColumns
.get(i
));
2412 return getItemStrings(columns
, event
);
2416 * Returns an array of zero-relative integers that map the creation order of
2417 * the receiver's columns to the order in which they are currently being
2420 * Specifically, the indices of the returned array represent the current
2421 * visual order of the columns, and the contents of the array represent the
2422 * creation order of the columns.
2424 * @return the current visual order of the receiver's columns
2427 public int[] getColumnOrder() {
2428 return fColumnOrder
;
2432 * Sets the order that the columns in the receiver should be displayed in to
2433 * the given argument which is described in terms of the zero-relative
2434 * ordering of when the columns were added.
2436 * Specifically, the contents of the array represent the original position
2437 * of each column at the time its creation.
2440 * the new order to display the columns
2443 public void setColumnOrder(int[] order
) {
2444 if (order
== null || order
.length
!= fTable
.getColumns().length
) {
2447 fTable
.setColumnOrder(order
);
2448 fColumnOrder
= fTable
.getColumnOrder();
2452 * Notify this table that is got the UI focus.
2454 public void setFocus() {
2459 * Assign a new trace to this event table.
2462 * The trace to assign to this event table
2463 * @param disposeOnClose
2464 * true if the trace should be disposed when the table is
2467 public void setTrace(final ITmfTrace trace
, final boolean disposeOnClose
) {
2468 if ((fTrace
!= null) && fDisposeOnClose
) {
2474 fDisposeOnClose
= disposeOnClose
;
2476 // Perform the updates on the UI thread
2477 fTable
.getDisplay().syncExec(new Runnable() {
2481 fCache
.setTrace(trace
); // Clear the cache
2482 if (trace
!= null) {
2483 if (!fTable
.isDisposed()) {
2484 if (fTable
.getData(Key
.FILTER_OBJ
) == null) {
2485 // +1 for header row
2486 fTable
.setItemCount((int) trace
.getNbEvents() + 1);
2489 fFilterMatchCount
= 0;
2490 fFilterCheckCount
= 0;
2492 * +1 for header row, +2 for top and bottom filter
2495 fTable
.setItemCount(3);
2496 startFilterThread();
2500 fRawViewer
.setTrace(trace
);
2506 * Assign the status line manager
2508 * @param statusLineManager
2509 * The status line manager, or null to disable status line
2512 public void setStatusLineManager(IStatusLineManager statusLineManager
) {
2513 if (fStatusLineManager
!= null && statusLineManager
== null) {
2514 fStatusLineManager
.setMessage(EMPTY_STRING
);
2516 fStatusLineManager
= statusLineManager
;
2519 private void updateStatusLine(ITmfTimestamp delta
) {
2520 if (fStatusLineManager
!= null) {
2521 if (delta
!= null) {
2522 fStatusLineManager
.setMessage("\u0394: " + delta
); //$NON-NLS-1$
2524 fStatusLineManager
.setMessage(null);
2529 // ------------------------------------------------------------------------
2531 // ------------------------------------------------------------------------
2534 * Notify that the event cache has been updated
2537 * Also notify if the populating of the cache is complete, or
2540 public void cacheUpdated(final boolean completed
) {
2541 synchronized (fCacheUpdateSyncObj
) {
2542 if (fCacheUpdateBusy
) {
2543 fCacheUpdatePending
= true;
2544 fCacheUpdateCompleted
= completed
;
2547 fCacheUpdateBusy
= true;
2549 // Event cache is now updated. Perform update on the UI thread
2550 if (!fTable
.isDisposed()) {
2551 fTable
.getDisplay().asyncExec(new Runnable() {
2554 if (!fTable
.isDisposed()) {
2559 populateCompleted();
2561 synchronized (fCacheUpdateSyncObj
) {
2562 fCacheUpdateBusy
= false;
2563 if (fCacheUpdatePending
) {
2564 fCacheUpdatePending
= false;
2565 cacheUpdated(fCacheUpdateCompleted
);
2574 * Callback for when populating the table is complete.
2576 protected void populateCompleted() {
2577 // Nothing by default;
2580 // ------------------------------------------------------------------------
2581 // ISelectionProvider
2582 // ------------------------------------------------------------------------
2585 public void addSelectionChangedListener(ISelectionChangedListener listener
) {
2586 selectionChangedListeners
.add(listener
);
2590 public ISelection
getSelection() {
2591 if (fTable
== null || fTable
.isDisposed()) {
2592 return StructuredSelection
.EMPTY
;
2594 List
<Object
> list
= new ArrayList
<>(fTable
.getSelection().length
);
2595 for (TableItem item
: fTable
.getSelection()) {
2596 if (item
.getData() != null) {
2597 list
.add(item
.getData());
2600 return new StructuredSelection(list
);
2604 public void removeSelectionChangedListener(ISelectionChangedListener listener
) {
2605 selectionChangedListeners
.remove(listener
);
2609 public void setSelection(ISelection selection
) {
2614 * Notifies any selection changed listeners that the viewer's selection has
2615 * changed. Only listeners registered at the time this method is called are
2619 * a selection changed event
2621 * @see ISelectionChangedListener#selectionChanged
2623 protected void fireSelectionChanged(final SelectionChangedEvent event
) {
2624 Object
[] listeners
= selectionChangedListeners
.getListeners();
2625 for (int i
= 0; i
< listeners
.length
; ++i
) {
2626 final ISelectionChangedListener l
= (ISelectionChangedListener
) listeners
[i
];
2627 SafeRunnable
.run(new SafeRunnable() {
2630 l
.selectionChanged(event
);
2636 // ------------------------------------------------------------------------
2637 // Bookmark handling
2638 // ------------------------------------------------------------------------
2641 * Add a bookmark to this event table.
2643 * @param bookmarksFile
2644 * The file to use for the bookmarks
2646 public void addBookmark(final IFile bookmarksFile
) {
2647 fBookmarksFile
= bookmarksFile
;
2648 final TableItem
[] selection
= fTable
.getSelection();
2649 if (selection
.length
> 0) {
2650 final TableItem tableItem
= selection
[0];
2651 if (tableItem
.getData(Key
.RANK
) != null) {
2652 final StringBuffer defaultMessage
= new StringBuffer();
2653 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
2655 defaultMessage
.append(", "); //$NON-NLS-1$
2657 defaultMessage
.append(tableItem
.getText(i
));
2659 final InputDialog dialog
= new MultiLineInputDialog(
2660 PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell(),
2661 Messages
.TmfEventsTable_AddBookmarkDialogTitle
,
2662 Messages
.TmfEventsTable_AddBookmarkDialogMessage
,
2663 defaultMessage
.toString());
2664 if (dialog
.open() == Window
.OK
) {
2665 final String message
= dialog
.getValue();
2667 final IMarker bookmark
= bookmarksFile
.createMarker(IMarker
.BOOKMARK
);
2668 if (bookmark
.exists()) {
2669 bookmark
.setAttribute(IMarker
.MESSAGE
, message
.toString());
2670 final Long rank
= (Long
) tableItem
.getData(Key
.RANK
);
2671 final int location
= rank
.intValue();
2672 bookmark
.setAttribute(IMarker
.LOCATION
, Integer
.valueOf(location
));
2673 fBookmarksMap
.put(rank
, bookmark
.getId());
2676 } catch (final CoreException e
) {
2677 displayException(e
);
2686 * Remove a bookmark from this event table.
2689 * The bookmark to remove
2691 public void removeBookmark(final IMarker bookmark
) {
2692 for (final Entry
<Long
, Long
> entry
: fBookmarksMap
.entries()) {
2693 if (entry
.getValue().equals(bookmark
.getId())) {
2694 fBookmarksMap
.remove(entry
.getKey(), entry
.getValue());
2701 private void toggleBookmark(final Long rank
) {
2702 if (fBookmarksFile
== null) {
2705 if (fBookmarksMap
.containsKey(rank
)) {
2706 final Collection
<Long
> markerIds
= fBookmarksMap
.removeAll(rank
);
2709 for (long markerId
: markerIds
) {
2710 final IMarker bookmark
= fBookmarksFile
.findMarker(markerId
);
2711 if (bookmark
!= null) {
2715 } catch (final CoreException e
) {
2716 displayException(e
);
2719 addBookmark(fBookmarksFile
);
2724 * Refresh the bookmarks assigned to this trace, from the contents of a
2727 * @param bookmarksFile
2728 * The bookmark file to use
2730 public void refreshBookmarks(final IFile bookmarksFile
) {
2731 fBookmarksFile
= bookmarksFile
;
2732 if (bookmarksFile
== null) {
2733 fBookmarksMap
.clear();
2738 fBookmarksMap
.clear();
2739 for (final IMarker bookmark
: bookmarksFile
.findMarkers(IMarker
.BOOKMARK
, false, IResource
.DEPTH_ZERO
)) {
2740 final int location
= bookmark
.getAttribute(IMarker
.LOCATION
, -1);
2741 if (location
!= -1) {
2742 final long rank
= location
;
2743 fBookmarksMap
.put(rank
, bookmark
.getId());
2747 } catch (final CoreException e
) {
2748 displayException(e
);
2753 public void gotoMarker(final IMarker marker
) {
2754 final int rank
= marker
.getAttribute(IMarker
.LOCATION
, -1);
2757 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
2758 // +1 for top filter status row
2759 index
= fCache
.getFilteredEventIndex(rank
) + 1;
2760 } else if (rank
>= fTable
.getItemCount()) {
2761 fPendingGotoRank
= rank
;
2763 fSelectedRank
= rank
;
2764 fTable
.setSelection(index
+ 1); // +1 for header row
2765 updateStatusLine(null);
2769 // ------------------------------------------------------------------------
2771 // ------------------------------------------------------------------------
2774 public void colorSettingsChanged(final ColorSetting
[] colorSettings
) {
2778 // ------------------------------------------------------------------------
2780 // ------------------------------------------------------------------------
2783 * Handler for the trace updated signal
2786 * The incoming signal
2789 public void traceUpdated(final TmfTraceUpdatedSignal signal
) {
2790 if ((signal
.getTrace() != fTrace
) || fTable
.isDisposed()) {
2793 // Perform the refresh on the UI thread
2794 Display
.getDefault().asyncExec(new Runnable() {
2797 if (!fTable
.isDisposed() && (fTrace
!= null)) {
2798 if (fTable
.getData(Key
.FILTER_OBJ
) == null) {
2799 /* +1 for header row */
2800 fTable
.setItemCount((int) fTrace
.getNbEvents() + 1);
2801 /* +1 for header row */
2802 if ((fPendingGotoRank
!= -1) && ((fPendingGotoRank
+ 1) < fTable
.getItemCount())) {
2803 /* +1 for header row */
2804 fTable
.setSelection((int) fPendingGotoRank
+ 1);
2805 fPendingGotoRank
= -1;
2806 updateStatusLine(null);
2809 startFilterThread();
2812 if (!fRawViewer
.isDisposed() && (fTrace
!= null)) {
2813 fRawViewer
.refreshEventCount();
2820 * Handler for the selection range signal.
2823 * The incoming signal
2827 public void selectionRangeUpdated(final TmfSelectionRangeUpdatedSignal signal
) {
2828 if ((signal
.getSource() != this) && (fTrace
!= null) && (!fTable
.isDisposed())) {
2831 * Create a request for one event that will be queued after other
2832 * ongoing requests. When this request is completed do the work to
2833 * select the actual event with the timestamp specified in the
2834 * signal. This procedure prevents the method fTrace.getRank() from
2835 * interfering and delaying ongoing requests.
2837 final TmfEventRequest subRequest
= new TmfEventRequest(ITmfEvent
.class,
2838 TmfTimeRange
.ETERNITY
, 0, 1, ExecutionType
.FOREGROUND
) {
2840 TmfTimestamp ts
= new TmfTimestamp(signal
.getBeginTime());
2843 public void handleData(final ITmfEvent event
) {
2844 super.handleData(event
);
2848 public void handleSuccess() {
2849 super.handleSuccess();
2850 if (fTrace
== null) {
2855 * Verify if the event is within the trace range and adjust
2858 ITmfTimestamp timestamp
= ts
;
2859 if (timestamp
.compareTo(fTrace
.getStartTime()) == -1) {
2860 timestamp
= fTrace
.getStartTime();
2862 if (timestamp
.compareTo(fTrace
.getEndTime()) == 1) {
2863 timestamp
= fTrace
.getEndTime();
2866 // Get the rank of the selected event in the table
2867 final ITmfContext context
= fTrace
.seekEvent(timestamp
);
2868 final long rank
= context
.getRank();
2870 fSelectedRank
= rank
;
2872 fTable
.getDisplay().asyncExec(new Runnable() {
2875 // Return if table is disposed
2876 if (fTable
.isDisposed()) {
2880 int index
= (int) rank
;
2881 if (fTable
.isDisposed()) {
2884 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
2885 /* +1 for top filter status row */
2886 index
= fCache
.getFilteredEventIndex(rank
) + 1;
2888 /* +1 for header row */
2889 fTable
.setSelection(index
+ 1);
2890 fRawViewer
.selectAndReveal(rank
);
2891 updateStatusLine(null);
2897 ((ITmfEventProvider
) fTrace
).sendRequest(subRequest
);
2901 // ------------------------------------------------------------------------
2903 // ------------------------------------------------------------------------
2906 * Display an exception in a message box
2911 private static void displayException(final Exception e
) {
2912 final MessageBox mb
= new MessageBox(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell());
2913 mb
.setText(e
.getClass().getSimpleName());
2914 mb
.setMessage(e
.getMessage());
2921 public void refresh() {
2928 * Margin column for images and special text (e.g. collapse count)
2930 private static final class TmfMarginColumn
extends TmfEventTableColumn
{
2932 private static final @NonNull ITmfEventAspect MARGIN_ASPECT
= new ITmfEventAspect() {
2935 public String
getName() {
2936 return EMPTY_STRING
;
2940 public String
resolve(ITmfEvent event
) {
2941 if (!(event
instanceof CachedEvent
) || ((CachedEvent
) event
).repeatCount
== 0) {
2942 return EMPTY_STRING
;
2944 return "+" + ((CachedEvent
) event
).repeatCount
; //$NON-NLS-1$
2948 public String
getHelpText() {
2949 return EMPTY_STRING
;
2956 public TmfMarginColumn() {
2957 super(MARGIN_ASPECT
);