1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 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
11 * Patrick Tasse - Factored out from events view
12 * Francois Chouinard - Replaced Table by TmfVirtualTable
13 * Patrick Tasse - Filter implementation (inspired by www.eclipse.org/mat)
14 * Ansgar Radermacher - Support navigation to model URIs (Bug 396956)
15 * Bernd Hufmann - Updated call site and model URI implementation
16 *******************************************************************************/
18 package org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
;
20 import java
.io
.FileNotFoundException
;
21 import java
.util
.ArrayList
;
22 import java
.util
.Arrays
;
23 import java
.util
.HashMap
;
24 import java
.util
.List
;
26 import java
.util
.Map
.Entry
;
27 import java
.util
.regex
.Pattern
;
28 import java
.util
.regex
.PatternSyntaxException
;
30 import org
.eclipse
.core
.resources
.IFile
;
31 import org
.eclipse
.core
.resources
.IMarker
;
32 import org
.eclipse
.core
.resources
.IResource
;
33 import org
.eclipse
.core
.resources
.IResourceVisitor
;
34 import org
.eclipse
.core
.resources
.ResourcesPlugin
;
35 import org
.eclipse
.core
.runtime
.CoreException
;
36 import org
.eclipse
.core
.runtime
.IPath
;
37 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
38 import org
.eclipse
.core
.runtime
.IStatus
;
39 import org
.eclipse
.core
.runtime
.ListenerList
;
40 import org
.eclipse
.core
.runtime
.Path
;
41 import org
.eclipse
.core
.runtime
.Status
;
42 import org
.eclipse
.core
.runtime
.jobs
.Job
;
43 import org
.eclipse
.emf
.common
.util
.URI
;
44 import org
.eclipse
.emf
.ecore
.EValidator
;
45 import org
.eclipse
.jface
.action
.Action
;
46 import org
.eclipse
.jface
.action
.IAction
;
47 import org
.eclipse
.jface
.action
.IMenuListener
;
48 import org
.eclipse
.jface
.action
.IMenuManager
;
49 import org
.eclipse
.jface
.action
.MenuManager
;
50 import org
.eclipse
.jface
.action
.Separator
;
51 import org
.eclipse
.jface
.dialogs
.InputDialog
;
52 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
53 import org
.eclipse
.jface
.resource
.FontDescriptor
;
54 import org
.eclipse
.jface
.resource
.JFaceResources
;
55 import org
.eclipse
.jface
.resource
.LocalResourceManager
;
56 import org
.eclipse
.jface
.util
.OpenStrategy
;
57 import org
.eclipse
.jface
.util
.SafeRunnable
;
58 import org
.eclipse
.jface
.viewers
.ArrayContentProvider
;
59 import org
.eclipse
.jface
.viewers
.ISelection
;
60 import org
.eclipse
.jface
.viewers
.ISelectionChangedListener
;
61 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
62 import org
.eclipse
.jface
.viewers
.LabelProvider
;
63 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
64 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
65 import org
.eclipse
.jface
.window
.Window
;
66 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
67 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Messages
;
68 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.dialogs
.MultiLineInputDialog
;
69 import org
.eclipse
.linuxtools
.tmf
.core
.component
.ITmfDataProvider
;
70 import org
.eclipse
.linuxtools
.tmf
.core
.component
.TmfComponent
;
71 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
72 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEventField
;
73 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfEventField
;
74 import org
.eclipse
.linuxtools
.tmf
.core
.event
.lookup
.ITmfCallsite
;
75 import org
.eclipse
.linuxtools
.tmf
.core
.event
.lookup
.ITmfModelLookup
;
76 import org
.eclipse
.linuxtools
.tmf
.core
.event
.lookup
.ITmfSourceLookup
;
77 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.ITmfFilter
;
78 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
79 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterAndNode
;
80 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterMatchesNode
;
81 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterNode
;
82 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfDataRequest
.ExecutionType
;
83 import org
.eclipse
.linuxtools
.tmf
.core
.request
.TmfDataRequest
;
84 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfEventFilterAppliedSignal
;
85 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfEventSearchAppliedSignal
;
86 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalHandler
;
87 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTimeSynchSignal
;
88 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceUpdatedSignal
;
89 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.ITmfTimestamp
;
90 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimestamp
;
91 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfContext
;
92 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfLocation
;
93 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
94 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.TmfEventsCache
.CachedEvent
;
95 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.colors
.ColorSetting
;
96 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.colors
.ColorSettingsManager
;
97 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.colors
.IColorSettingsListener
;
98 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.filter
.FilterManager
;
99 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.rawviewer
.TmfRawEventViewer
;
100 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.virtualtable
.ColumnData
;
101 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.virtualtable
.TmfVirtualTable
;
102 import org
.eclipse
.swt
.SWT
;
103 import org
.eclipse
.swt
.custom
.SashForm
;
104 import org
.eclipse
.swt
.custom
.TableEditor
;
105 import org
.eclipse
.swt
.events
.FocusAdapter
;
106 import org
.eclipse
.swt
.events
.FocusEvent
;
107 import org
.eclipse
.swt
.events
.KeyAdapter
;
108 import org
.eclipse
.swt
.events
.KeyEvent
;
109 import org
.eclipse
.swt
.events
.MouseAdapter
;
110 import org
.eclipse
.swt
.events
.MouseEvent
;
111 import org
.eclipse
.swt
.events
.SelectionAdapter
;
112 import org
.eclipse
.swt
.events
.SelectionEvent
;
113 import org
.eclipse
.swt
.graphics
.Color
;
114 import org
.eclipse
.swt
.graphics
.Font
;
115 import org
.eclipse
.swt
.graphics
.Image
;
116 import org
.eclipse
.swt
.graphics
.Point
;
117 import org
.eclipse
.swt
.graphics
.Rectangle
;
118 import org
.eclipse
.swt
.layout
.FillLayout
;
119 import org
.eclipse
.swt
.layout
.GridData
;
120 import org
.eclipse
.swt
.layout
.GridLayout
;
121 import org
.eclipse
.swt
.widgets
.Composite
;
122 import org
.eclipse
.swt
.widgets
.Display
;
123 import org
.eclipse
.swt
.widgets
.Event
;
124 import org
.eclipse
.swt
.widgets
.Label
;
125 import org
.eclipse
.swt
.widgets
.Listener
;
126 import org
.eclipse
.swt
.widgets
.Menu
;
127 import org
.eclipse
.swt
.widgets
.MessageBox
;
128 import org
.eclipse
.swt
.widgets
.Shell
;
129 import org
.eclipse
.swt
.widgets
.TableColumn
;
130 import org
.eclipse
.swt
.widgets
.TableItem
;
131 import org
.eclipse
.swt
.widgets
.Text
;
132 import org
.eclipse
.ui
.IWorkbenchPage
;
133 import org
.eclipse
.ui
.PlatformUI
;
134 import org
.eclipse
.ui
.dialogs
.ListDialog
;
135 import org
.eclipse
.ui
.ide
.IDE
;
136 import org
.eclipse
.ui
.ide
.IGotoMarker
;
137 import org
.eclipse
.ui
.themes
.ColorUtil
;
140 * The generic TMF Events table
142 * This is a view that will list events that are read from a trace.
145 * @author Francois Chouinard
146 * @author Patrick Tasse
149 public class TmfEventsTable
extends TmfComponent
implements IGotoMarker
, IColorSettingsListener
, ISelectionProvider
{
151 private static final Image BOOKMARK_IMAGE
= Activator
.getDefault().getImageFromPath(
152 "icons/elcl16/bookmark_obj.gif"); //$NON-NLS-1$
153 private static final Image SEARCH_IMAGE
= Activator
.getDefault().getImageFromPath("icons/elcl16/search.gif"); //$NON-NLS-1$
154 private static final Image SEARCH_MATCH_IMAGE
= Activator
.getDefault().getImageFromPath(
155 "icons/elcl16/search_match.gif"); //$NON-NLS-1$
156 private static final Image SEARCH_MATCH_BOOKMARK_IMAGE
= Activator
.getDefault().getImageFromPath(
157 "icons/elcl16/search_match_bookmark.gif"); //$NON-NLS-1$
158 private static final Image FILTER_IMAGE
= Activator
.getDefault()
159 .getImageFromPath("icons/elcl16/filter_items.gif"); //$NON-NLS-1$
160 private static final Image STOP_IMAGE
= Activator
.getDefault().getImageFromPath("icons/elcl16/stop.gif"); //$NON-NLS-1$
161 private static final String SEARCH_HINT
= Messages
.TmfEventsTable_SearchHint
;
162 private static final String FILTER_HINT
= Messages
.TmfEventsTable_FilterHint
;
163 private static final int MAX_CACHE_SIZE
= 1000;
166 * The events table search/filter keys
169 * @author Patrick Tasse
171 public interface Key
{
173 String SEARCH_TXT
= "$srch_txt"; //$NON-NLS-1$
176 String SEARCH_OBJ
= "$srch_obj"; //$NON-NLS-1$
179 String FILTER_TXT
= "$fltr_txt"; //$NON-NLS-1$
182 String FILTER_OBJ
= "$fltr_obj"; //$NON-NLS-1$
185 String TIMESTAMP
= "$time"; //$NON-NLS-1$
188 String RANK
= "$rank"; //$NON-NLS-1$
191 String FIELD_ID
= "$field_id"; //$NON-NLS-1$
193 /** Bookmark indicator */
194 String BOOKMARK
= "$bookmark"; //$NON-NLS-1$
198 * The events table search/filter state
201 * @author Patrick Tasse
203 public static enum HeaderState
{
204 /** A search is being run */
207 /** A filter is applied */
211 interface Direction
{
216 // ------------------------------------------------------------------------
218 // ------------------------------------------------------------------------
220 /** The virtual event table */
221 protected TmfVirtualTable fTable
;
223 private Composite fComposite
;
224 private SashForm fSashForm
;
225 private TmfRawEventViewer fRawViewer
;
226 private ITmfTrace fTrace
;
227 private boolean fPackDone
= false;
228 private HeaderState fHeaderState
= HeaderState
.SEARCH
;
229 private long fSelectedRank
= 0;
232 private long fFilterMatchCount
;
233 private long fFilterCheckCount
;
234 private FilterThread fFilterThread
;
235 private boolean fFilterThreadResume
= false;
236 private final Object fFilterSyncObj
= new Object();
237 private SearchThread fSearchThread
;
238 private final Object fSearchSyncObj
= new Object();
241 * List of selection change listeners (element type: <code>ISelectionChangedListener</code>).
243 * @see #fireSelectionChanged
245 private ListenerList selectionChangedListeners
= new ListenerList();
247 // Bookmark map <Rank, MarkerId>
248 private Map
<Long
, Long
> fBookmarksMap
= new HashMap
<Long
, Long
>();
249 private IFile fBookmarksFile
;
250 private long fPendingGotoRank
= -1;
253 private LocalResourceManager fResourceManager
= new LocalResourceManager(JFaceResources
.getResources());
254 private Color fGrayColor
;
255 private Color fGreenColor
;
256 private Font fBoldFont
;
258 // Table column names
259 private static final String
[] COLUMN_NAMES
= new String
[] { Messages
.TmfEventsTable_TimestampColumnHeader
,
260 Messages
.TmfEventsTable_SourceColumnHeader
, Messages
.TmfEventsTable_TypeColumnHeader
,
261 Messages
.TmfEventsTable_ReferenceColumnHeader
, Messages
.TmfEventsTable_ContentColumnHeader
};
263 private static final ColumnData
[] COLUMN_DATA
= new ColumnData
[] { new ColumnData(COLUMN_NAMES
[0], 100, SWT
.LEFT
),
264 new ColumnData(COLUMN_NAMES
[1], 100, SWT
.LEFT
), new ColumnData(COLUMN_NAMES
[2], 100, SWT
.LEFT
),
265 new ColumnData(COLUMN_NAMES
[3], 100, SWT
.LEFT
), new ColumnData(COLUMN_NAMES
[4], 100, SWT
.LEFT
) };
268 private final TmfEventsCache fCache
;
269 private boolean fCacheUpdateBusy
= false;
270 private boolean fCacheUpdatePending
= false;
271 private boolean fCacheUpdateCompleted
= false;
272 private final Object fCacheUpdateSyncObj
= new Object();
274 private boolean fDisposeOnClose
;
276 // ------------------------------------------------------------------------
278 // ------------------------------------------------------------------------
281 * Basic constructor, will use default column data.
284 * The parent composite UI object
286 * The size of the event table cache
288 public TmfEventsTable(final Composite parent
, final int cacheSize
) {
289 this(parent
, cacheSize
, COLUMN_DATA
);
293 * Advanced constructor, where we also define which column data to use.
296 * The parent composite UI object
298 * The size of the event table cache
300 * The column data to use for this table
302 public TmfEventsTable(final Composite parent
, int cacheSize
, final ColumnData
[] columnData
) {
303 super("TmfEventsTable"); //$NON-NLS-1$
305 fComposite
= new Composite(parent
, SWT
.NONE
);
306 final GridLayout gl
= new GridLayout(1, false);
309 gl
.verticalSpacing
= 0;
310 fComposite
.setLayout(gl
);
312 fSashForm
= new SashForm(fComposite
, SWT
.HORIZONTAL
);
313 fSashForm
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
315 // Create a virtual table
316 final int style
= SWT
.H_SCROLL
| SWT
.V_SCROLL
| SWT
.SINGLE
| SWT
.FULL_SELECTION
;
317 fTable
= new TmfVirtualTable(fSashForm
, style
);
319 // Set the table layout
320 final GridData layoutData
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true);
321 fTable
.setLayoutData(layoutData
);
323 // Some cosmetic enhancements
324 fTable
.setHeaderVisible(true);
325 fTable
.setLinesVisible(true);
328 setColumnHeaders(columnData
);
330 // Set the default column field ids if this is not a subclass
331 if (Arrays
.equals(columnData
, COLUMN_DATA
)) {
332 fTable
.getColumns()[0].setData(Key
.FIELD_ID
, ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
333 fTable
.getColumns()[1].setData(Key
.FIELD_ID
, ITmfEvent
.EVENT_FIELD_SOURCE
);
334 fTable
.getColumns()[2].setData(Key
.FIELD_ID
, ITmfEvent
.EVENT_FIELD_TYPE
);
335 fTable
.getColumns()[3].setData(Key
.FIELD_ID
, ITmfEvent
.EVENT_FIELD_REFERENCE
);
336 fTable
.getColumns()[4].setData(Key
.FIELD_ID
, ITmfEvent
.EVENT_FIELD_CONTENT
);
339 // Set the frozen row for header row
340 fTable
.setFrozenRowCount(1);
342 // Create the header row cell editor
343 createHeaderEditor();
345 // Handle the table item selection
346 fTable
.addSelectionListener(new SelectionAdapter() {
348 public void widgetSelected(final SelectionEvent e
) {
349 final TableItem
[] selection
= fTable
.getSelection();
350 if (selection
.length
> 0) {
351 final TableItem selectedTableItem
= selection
[0];
352 if (selectedTableItem
!= null) {
353 if (selectedTableItem
.getData(Key
.RANK
) instanceof Long
) {
354 fSelectedRank
= (Long
) selectedTableItem
.getData(Key
.RANK
);
355 fRawViewer
.selectAndReveal((Long
) selectedTableItem
.getData(Key
.RANK
));
357 if (selectedTableItem
.getData(Key
.TIMESTAMP
) instanceof TmfTimestamp
) {
358 final TmfTimestamp ts
= (TmfTimestamp
) selectedTableItem
.getData(Key
.TIMESTAMP
);
359 broadcast(new TmfTimeSynchSignal(TmfEventsTable
.this, ts
));
363 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, getSelection()));
367 int realCacheSize
= Math
.max(cacheSize
, Display
.getDefault().getBounds().height
/ fTable
.getItemHeight());
368 realCacheSize
= Math
.min(realCacheSize
, MAX_CACHE_SIZE
);
369 fCache
= new TmfEventsCache(realCacheSize
, this);
371 // Handle the table item requests
372 fTable
.addListener(SWT
.SetData
, new Listener() {
375 public void handleEvent(final Event event
) {
377 final TableItem item
= (TableItem
) event
.item
;
378 int index
= event
.index
- 1; // -1 for the header row
380 if (event
.index
== 0) {
381 setHeaderRowItemData(item
);
385 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
386 if ((event
.index
== 1) || (event
.index
== (fTable
.getItemCount() - 1))) {
387 setFilterStatusRowItemData(item
);
390 index
= index
- 1; // -1 for top filter status row
393 final CachedEvent cachedEvent
= fCache
.getEvent(index
);
394 if (cachedEvent
!= null) {
395 setItemData(item
, cachedEvent
.event
, cachedEvent
.rank
);
399 // Else, fill the cache asynchronously (and off the UI thread)
404 fTable
.addMouseListener(new MouseAdapter() {
406 public void mouseDoubleClick(final MouseEvent event
) {
407 if (event
.button
!= 1) {
410 // Identify the selected row
411 final Point point
= new Point(event
.x
, event
.y
);
412 final TableItem item
= fTable
.getItem(point
);
414 final Rectangle imageBounds
= item
.getImageBounds(0);
415 imageBounds
.width
= BOOKMARK_IMAGE
.getBounds().width
;
416 if (imageBounds
.contains(point
)) {
417 final Long rank
= (Long
) item
.getData(Key
.RANK
);
419 toggleBookmark(rank
);
426 final Listener tooltipListener
= new Listener () {
427 Shell tooltipShell
= null;
429 public void handleEvent(final Event event
) {
430 switch (event
.type
) {
432 final TableItem item
= fTable
.getItem(new Point(event
.x
, event
.y
));
436 final Long rank
= (Long
) item
.getData(Key
.RANK
);
440 final String tooltipText
= (String
) item
.getData(Key
.BOOKMARK
);
441 final Rectangle bounds
= item
.getImageBounds(0);
442 bounds
.width
= BOOKMARK_IMAGE
.getBounds().width
;
443 if (!bounds
.contains(event
.x
,event
.y
)) {
446 if ((tooltipShell
!= null) && !tooltipShell
.isDisposed()) {
447 tooltipShell
.dispose();
449 tooltipShell
= new Shell(fTable
.getShell(), SWT
.ON_TOP
| SWT
.NO_FOCUS
| SWT
.TOOL
);
450 tooltipShell
.setBackground(PlatformUI
.getWorkbench().getDisplay().getSystemColor(SWT
.COLOR_INFO_BACKGROUND
));
451 final FillLayout layout
= new FillLayout();
452 layout
.marginWidth
= 2;
453 tooltipShell
.setLayout(layout
);
454 final Label label
= new Label(tooltipShell
, SWT
.WRAP
);
455 String text
= rank
.toString() + (tooltipText
!= null ?
": " + tooltipText
: ""); //$NON-NLS-1$ //$NON-NLS-2$
456 label
.setForeground(PlatformUI
.getWorkbench().getDisplay().getSystemColor(SWT
.COLOR_INFO_FOREGROUND
));
457 label
.setBackground(PlatformUI
.getWorkbench().getDisplay().getSystemColor(SWT
.COLOR_INFO_BACKGROUND
));
459 label
.addListener(SWT
.MouseExit
, this);
460 label
.addListener(SWT
.MouseDown
, this);
461 label
.addListener(SWT
.MouseWheel
, this);
462 final Point size
= tooltipShell
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
);
464 * Bug in Linux. The coordinates of the event have an origin that excludes the table header but
465 * the method toDisplay() expects coordinates relative to an origin that includes the table header.
468 if (System
.getProperty("os.name").contains("Linux")) { //$NON-NLS-1$ //$NON-NLS-2$
469 y
+= fTable
.getHeaderHeight();
471 Point pt
= fTable
.toDisplay(event
.x
, y
);
472 pt
.x
+= BOOKMARK_IMAGE
.getBounds().width
;
473 pt
.y
+= item
.getBounds().height
;
474 tooltipShell
.setBounds(pt
.x
, pt
.y
, size
.x
, size
.y
);
475 tooltipShell
.setVisible(true);
483 if (tooltipShell
!= null) {
484 tooltipShell
.dispose();
494 fTable
.addListener(SWT
.MouseHover
, tooltipListener
);
495 fTable
.addListener(SWT
.Dispose
, tooltipListener
);
496 fTable
.addListener(SWT
.KeyDown
, tooltipListener
);
497 fTable
.addListener(SWT
.MouseMove
, tooltipListener
);
498 fTable
.addListener(SWT
.MouseExit
, tooltipListener
);
499 fTable
.addListener(SWT
.MouseDown
, tooltipListener
);
500 fTable
.addListener(SWT
.MouseWheel
, tooltipListener
);
505 ColorSettingsManager
.addColorSettingsListener(this);
507 fTable
.setItemCount(1); // +1 for header row
509 fRawViewer
= new TmfRawEventViewer(fSashForm
, SWT
.H_SCROLL
| SWT
.V_SCROLL
);
511 fRawViewer
.addSelectionListener(new Listener() {
513 public void handleEvent(final Event e
) {
514 if (e
.data
instanceof Long
) {
515 final long rank
= (Long
) e
.data
;
516 int index
= (int) rank
;
517 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
518 index
= fCache
.getFilteredEventIndex(rank
) + 1; // +1 for top filter status row
520 fTable
.setSelection(index
+ 1); // +1 for header row
521 fSelectedRank
= rank
;
522 } else if (e
.data
instanceof ITmfLocation
) {
523 // DOES NOT WORK: rank undefined in context from seekLocation()
524 // ITmfLocation<?> location = (ITmfLocation<?>) e.data;
525 // TmfContext context = fTrace.seekLocation(location);
526 // fTable.setSelection((int) context.getRank());
531 final TableItem
[] selection
= fTable
.getSelection();
532 if ((selection
!= null) && (selection
.length
> 0)) {
533 final TmfTimestamp ts
= (TmfTimestamp
) fTable
.getSelection()[0].getData(Key
.TIMESTAMP
);
535 broadcast(new TmfTimeSynchSignal(TmfEventsTable
.this, ts
));
541 fSashForm
.setWeights(new int[] { 1, 1 });
542 fRawViewer
.setVisible(false);
548 * Create a pop-up menu.
550 protected void createPopupMenu() {
551 final IAction showTableAction
= new Action(Messages
.TmfEventsTable_ShowTableActionText
) {
554 fTable
.setVisible(true);
559 final IAction hideTableAction
= new Action(Messages
.TmfEventsTable_HideTableActionText
) {
562 fTable
.setVisible(false);
567 final IAction showRawAction
= new Action(Messages
.TmfEventsTable_ShowRawActionText
) {
570 fRawViewer
.setVisible(true);
572 final int index
= fTable
.getSelectionIndex();
574 fRawViewer
.selectAndReveal(index
- 1);
579 final IAction hideRawAction
= new Action(Messages
.TmfEventsTable_HideRawActionText
) {
582 fRawViewer
.setVisible(false);
587 final IAction openCallsiteAction
= new Action(Messages
.TmfEventsTable_OpenSourceCodeActionText
) {
590 final TableItem items
[] = fTable
.getSelection();
591 if (items
.length
!= 1) {
594 final TableItem item
= items
[0];
596 final Object data
= item
.getData();
597 if (data
instanceof ITmfSourceLookup
) {
598 ITmfSourceLookup event
= (ITmfSourceLookup
) data
;
599 ITmfCallsite cs
= event
.getCallsite();
600 if (cs
== null || cs
.getFileName() == null) {
603 IMarker marker
= null;
605 String fileName
= cs
.getFileName();
606 final String trimmedPath
= fileName
.replaceAll("\\.\\./", ""); //$NON-NLS-1$ //$NON-NLS-2$
607 final ArrayList
<IFile
> files
= new ArrayList
<IFile
>();
608 ResourcesPlugin
.getWorkspace().getRoot().accept(new IResourceVisitor() {
610 public boolean visit(IResource resource
) throws CoreException
{
611 if (resource
instanceof IFile
&& resource
.getFullPath().toString().endsWith(trimmedPath
)) {
612 files
.add((IFile
) resource
);
618 if (files
.size() > 1) {
619 ListDialog dialog
= new ListDialog(getTable().getShell());
620 dialog
.setContentProvider(ArrayContentProvider
.getInstance());
621 dialog
.setLabelProvider(new LabelProvider() {
623 public String
getText(Object element
) {
624 return ((IFile
) element
).getFullPath().toString();
627 dialog
.setInput(files
);
628 dialog
.setTitle(Messages
.TmfEventsTable_OpenSourceCodeSelectFileDialogTitle
);
629 dialog
.setMessage(Messages
.TmfEventsTable_OpenSourceCodeSelectFileDialogTitle
+ '\n' + cs
.toString());
631 Object
[] result
= dialog
.getResult();
632 if (result
!= null && result
.length
> 0) {
633 file
= (IFile
) result
[0];
635 } else if (files
.size() == 1) {
639 marker
= file
.createMarker(IMarker
.MARKER
);
640 marker
.setAttribute(IMarker
.LINE_NUMBER
, Long
.valueOf(cs
.getLineNumber()).intValue());
641 IDE
.openEditor(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage(), marker
);
643 } else if (files
.size() == 0){
644 displayException(new FileNotFoundException('\'' + cs
.toString() + '\'' + '\n' + Messages
.TmfEventsTable_OpenSourceCodeNotFound
));
646 } catch (CoreException e
) {
653 final IAction openModelAction
= new Action(Messages
.TmfEventsTable_OpenModelActionText
) {
657 final TableItem items
[] = fTable
.getSelection();
658 if (items
.length
!= 1) {
661 final TableItem item
= items
[0];
663 final Object eventData
= item
.getData();
664 if (eventData
instanceof ITmfModelLookup
) {
665 String modelURI
= ((ITmfModelLookup
) eventData
).getModelUri();
667 if (modelURI
!= null) {
668 IWorkbenchPage activePage
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage();
671 final URI uri
= URI
.createURI(modelURI
);
672 if (uri
.isPlatformResource()) {
673 IPath path
= new Path(uri
.toPlatformString(true));
674 file
= ResourcesPlugin
.getWorkspace().getRoot().getFile(path
);
675 } else if (uri
.isFile() && !uri
.isRelative()) {
676 file
= ResourcesPlugin
.getWorkspace().getRoot().getFileForLocation(
677 new Path(uri
.toFileString()));
683 * create a temporary validation marker on the
684 * model file, remove it afterwards thus,
685 * navigation works with all model editors
686 * supporting the navigation to a marker
688 IMarker marker
= file
.createMarker(EValidator
.MARKER
);
689 marker
.setAttribute(EValidator
.URI_ATTRIBUTE
, modelURI
);
690 marker
.setAttribute(IMarker
.SEVERITY
, IMarker
.SEVERITY_INFO
);
692 IDE
.openEditor(activePage
, marker
, OpenStrategy
.activateOnOpen());
695 catch (CoreException e
) {
699 displayException(new FileNotFoundException('\'' + modelURI
+ '\'' + '\n' + Messages
.TmfEventsTable_OpenModelUnsupportedURI
));
706 final IAction showSearchBarAction
= new Action(Messages
.TmfEventsTable_ShowSearchBarActionText
) {
709 fHeaderState
= HeaderState
.SEARCH
;
714 final IAction showFilterBarAction
= new Action(Messages
.TmfEventsTable_ShowFilterBarActionText
) {
717 fHeaderState
= HeaderState
.FILTER
;
722 final IAction clearFiltersAction
= new Action(Messages
.TmfEventsTable_ClearFiltersActionText
) {
729 class ToggleBookmarkAction
extends Action
{
732 public ToggleBookmarkAction(final String text
, final long rank
) {
739 toggleBookmark(fRank
);
743 final MenuManager tablePopupMenu
= new MenuManager();
744 tablePopupMenu
.setRemoveAllWhenShown(true);
745 tablePopupMenu
.addMenuListener(new IMenuListener() {
747 public void menuAboutToShow(final IMenuManager manager
) {
748 if (fTable
.getSelectionIndex() == 0) {
749 // Right-click on header row
750 if (fHeaderState
== HeaderState
.FILTER
) {
751 tablePopupMenu
.add(showSearchBarAction
);
753 tablePopupMenu
.add(showFilterBarAction
);
757 final Point point
= fTable
.toControl(Display
.getDefault().getCursorLocation());
758 final TableItem item
= fTable
.getSelection().length
> 0 ? fTable
.getSelection()[0] : null;
760 final Rectangle imageBounds
= item
.getImageBounds(0);
761 imageBounds
.width
= BOOKMARK_IMAGE
.getBounds().width
;
762 if (point
.x
<= (imageBounds
.x
+ imageBounds
.width
)) {
763 // Right-click on left margin
764 final Long rank
= (Long
) item
.getData(Key
.RANK
);
765 if ((rank
!= null) && (fBookmarksFile
!= null)) {
766 if (fBookmarksMap
.containsKey(rank
)) {
767 tablePopupMenu
.add(new ToggleBookmarkAction(
768 Messages
.TmfEventsTable_RemoveBookmarkActionText
, rank
));
770 tablePopupMenu
.add(new ToggleBookmarkAction(
771 Messages
.TmfEventsTable_AddBookmarkActionText
, rank
));
778 // Right-click on table
779 if (fTable
.isVisible() && fRawViewer
.isVisible()) {
780 tablePopupMenu
.add(hideTableAction
);
781 tablePopupMenu
.add(hideRawAction
);
782 } else if (!fTable
.isVisible()) {
783 tablePopupMenu
.add(showTableAction
);
784 } else if (!fRawViewer
.isVisible()) {
785 tablePopupMenu
.add(showRawAction
);
787 tablePopupMenu
.add(new Separator());
790 final Object data
= item
.getData();
791 Separator separator
= null;
792 if (data
instanceof ITmfSourceLookup
) {
793 ITmfSourceLookup event
= (ITmfSourceLookup
) data
;
794 if (event
.getCallsite() != null) {
795 tablePopupMenu
.add(openCallsiteAction
);
796 separator
= new Separator();
800 if (data
instanceof ITmfModelLookup
) {
801 ITmfModelLookup event
= (ITmfModelLookup
) data
;
802 if (event
.getModelUri() != null) {
803 tablePopupMenu
.add(openModelAction
);
804 separator
= new Separator();
807 if (separator
!= null) {
808 tablePopupMenu
.add(separator
);
813 tablePopupMenu
.add(clearFiltersAction
);
814 final ITmfFilterTreeNode
[] savedFilters
= FilterManager
.getSavedFilters();
815 if (savedFilters
.length
> 0) {
816 final MenuManager subMenu
= new MenuManager(Messages
.TmfEventsTable_ApplyPresetFilterMenuName
);
817 for (final ITmfFilterTreeNode node
: savedFilters
) {
818 if (node
instanceof TmfFilterNode
) {
819 final TmfFilterNode filter
= (TmfFilterNode
) node
;
820 subMenu
.add(new Action(filter
.getFilterName()) {
828 tablePopupMenu
.add(subMenu
);
830 appendToTablePopupMenu(tablePopupMenu
, item
);
834 final MenuManager rawViewerPopupMenu
= new MenuManager();
835 rawViewerPopupMenu
.setRemoveAllWhenShown(true);
836 rawViewerPopupMenu
.addMenuListener(new IMenuListener() {
838 public void menuAboutToShow(final IMenuManager manager
) {
839 if (fTable
.isVisible() && fRawViewer
.isVisible()) {
840 rawViewerPopupMenu
.add(hideTableAction
);
841 rawViewerPopupMenu
.add(hideRawAction
);
842 } else if (!fTable
.isVisible()) {
843 rawViewerPopupMenu
.add(showTableAction
);
844 } else if (!fRawViewer
.isVisible()) {
845 rawViewerPopupMenu
.add(showRawAction
);
847 appendToRawPopupMenu(tablePopupMenu
);
851 Menu menu
= tablePopupMenu
.createContextMenu(fTable
);
852 fTable
.setMenu(menu
);
854 menu
= rawViewerPopupMenu
.createContextMenu(fRawViewer
);
855 fRawViewer
.setMenu(menu
);
860 * Append an item to the event table's pop-up menu.
862 * @param tablePopupMenu
864 * @param selectedItem
867 protected void appendToTablePopupMenu(final MenuManager tablePopupMenu
, final TableItem selectedItem
) {
868 // override to append more actions
872 * Append an item to the raw viewer's pop-up menu.
874 * @param rawViewerPopupMenu
877 protected void appendToRawPopupMenu(final MenuManager rawViewerPopupMenu
) {
878 // override to append more actions
882 public void dispose() {
885 ColorSettingsManager
.removeColorSettingsListener(this);
886 fComposite
.dispose();
887 if ((fTrace
!= null) && fDisposeOnClose
) {
890 fResourceManager
.dispose();
895 * Assign a layout data object to this view.
898 * The layout data to assign
900 public void setLayoutData(final Object layoutData
) {
901 fComposite
.setLayoutData(layoutData
);
905 * Get the virtual table contained in this event table.
907 * @return The TMF virtual table
909 public TmfVirtualTable
getTable() {
916 * FIXME: Add support for column selection
918 protected void setColumnHeaders(final ColumnData
[] columnData
) {
919 fTable
.setColumnHeaders(columnData
);
923 * Set a table item's data.
928 * Which trace event to link with this entry
930 * Which rank this event has in the trace/experiment
932 protected void setItemData(final TableItem item
, final ITmfEvent event
, final long rank
) {
933 final ITmfEventField
[] fields
= extractItemFields(event
);
934 final String
[] content
= new String
[fields
.length
];
935 for (int i
= 0; i
< fields
.length
; i
++) {
936 content
[i
] = fields
[i
].getValue() != null ? fields
[i
].getValue().toString() : ""; //$NON-NLS-1$
938 item
.setText(content
);
940 item
.setData(Key
.TIMESTAMP
, new TmfTimestamp(event
.getTimestamp()));
941 item
.setData(Key
.RANK
, rank
);
943 boolean bookmark
= false;
944 final Long markerId
= fBookmarksMap
.get(rank
);
945 if (markerId
!= null) {
948 final IMarker marker
= fBookmarksFile
.findMarker(markerId
);
949 item
.setData(Key
.BOOKMARK
, marker
.getAttribute(IMarker
.MESSAGE
));
950 } catch (final CoreException e
) {
954 item
.setData(Key
.BOOKMARK
, null);
957 boolean searchMatch
= false;
958 boolean searchNoMatch
= false;
959 final ITmfFilter searchFilter
= (ITmfFilter
) fTable
.getData(Key
.SEARCH_OBJ
);
960 if (searchFilter
!= null) {
961 if (searchFilter
.matches(event
)) {
964 searchNoMatch
= true;
968 final ColorSetting colorSetting
= ColorSettingsManager
.getColorSetting(event
);
970 item
.setForeground(colorSetting
.getDimmedForegroundColor());
971 item
.setBackground(colorSetting
.getDimmedBackgroundColor());
973 item
.setForeground(colorSetting
.getForegroundColor());
974 item
.setBackground(colorSetting
.getBackgroundColor());
979 item
.setImage(SEARCH_MATCH_BOOKMARK_IMAGE
);
981 item
.setImage(SEARCH_MATCH_IMAGE
);
983 } else if (bookmark
) {
984 item
.setImage(BOOKMARK_IMAGE
);
986 item
.setImage((Image
) null);
991 * Set the item data of the header row.
994 * The item to use as table header
996 protected void setHeaderRowItemData(final TableItem item
) {
997 String txtKey
= null;
998 if (fHeaderState
== HeaderState
.SEARCH
) {
999 item
.setImage(SEARCH_IMAGE
);
1000 txtKey
= Key
.SEARCH_TXT
;
1001 } else if (fHeaderState
== HeaderState
.FILTER
) {
1002 item
.setImage(FILTER_IMAGE
);
1003 txtKey
= Key
.FILTER_TXT
;
1005 item
.setForeground(fGrayColor
);
1006 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
1007 final TableColumn column
= fTable
.getColumns()[i
];
1008 final String filter
= (String
) column
.getData(txtKey
);
1009 if (filter
== null) {
1010 if (fHeaderState
== HeaderState
.SEARCH
) {
1011 item
.setText(i
, SEARCH_HINT
);
1012 } else if (fHeaderState
== HeaderState
.FILTER
) {
1013 item
.setText(i
, FILTER_HINT
);
1015 item
.setForeground(i
, fGrayColor
);
1016 item
.setFont(i
, fTable
.getFont());
1018 item
.setText(i
, filter
);
1019 item
.setForeground(i
, fGreenColor
);
1020 item
.setFont(i
, fBoldFont
);
1026 * Set the item data of the "filter status" row.
1029 * The item to use as filter status row
1031 protected void setFilterStatusRowItemData(final TableItem item
) {
1032 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
1034 if ((fTrace
== null) || (fFilterCheckCount
== fTrace
.getNbEvents())) {
1035 item
.setImage(FILTER_IMAGE
);
1037 item
.setImage(STOP_IMAGE
);
1039 item
.setText(0, fFilterMatchCount
+ "/" + fFilterCheckCount
); //$NON-NLS-1$
1041 item
.setText(i
, ""); //$NON-NLS-1$
1045 item
.setData(Key
.TIMESTAMP
, null);
1046 item
.setData(Key
.RANK
, null);
1047 item
.setForeground(null);
1048 item
.setBackground(null);
1052 * Create an editor for the header.
1054 protected void createHeaderEditor() {
1055 final TableEditor tableEditor
= fTable
.createTableEditor();
1056 tableEditor
.horizontalAlignment
= SWT
.LEFT
;
1057 tableEditor
.verticalAlignment
= SWT
.CENTER
;
1058 tableEditor
.grabHorizontal
= true;
1059 tableEditor
.minimumWidth
= 50;
1061 // Handle the header row selection
1062 fTable
.addMouseListener(new MouseAdapter() {
1068 public void mouseDown(final MouseEvent event
) {
1069 if (event
.button
!= 1) {
1072 // Identify the selected row
1073 final Point point
= new Point(event
.x
, event
.y
);
1074 item
= fTable
.getItem(point
);
1076 // Header row selected
1077 if ((item
!= null) && (fTable
.indexOf(item
) == 0)) {
1080 if (item
.getImageBounds(0).contains(point
)) {
1081 if (fHeaderState
== HeaderState
.SEARCH
) {
1082 fHeaderState
= HeaderState
.FILTER
;
1083 } else if (fHeaderState
== HeaderState
.FILTER
) {
1084 fHeaderState
= HeaderState
.SEARCH
;
1090 // Identify the selected column
1092 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
1093 final Rectangle rect
= item
.getBounds(i
);
1094 if (rect
.contains(point
)) {
1100 if (columnIndex
== -1) {
1104 column
= fTable
.getColumns()[columnIndex
];
1106 String txtKey
= null;
1107 if (fHeaderState
== HeaderState
.SEARCH
) {
1108 txtKey
= Key
.SEARCH_TXT
;
1109 } else if (fHeaderState
== HeaderState
.FILTER
) {
1110 txtKey
= Key
.FILTER_TXT
;
1113 // The control that will be the editor must be a child of the Table
1114 final Text newEditor
= (Text
) fTable
.createTableEditorControl(Text
.class);
1115 final String headerString
= (String
) column
.getData(txtKey
);
1116 if (headerString
!= null) {
1117 newEditor
.setText(headerString
);
1119 newEditor
.addFocusListener(new FocusAdapter() {
1121 public void focusLost(final FocusEvent e
) {
1122 final boolean changed
= updateHeader(newEditor
.getText());
1128 newEditor
.addKeyListener(new KeyAdapter() {
1130 public void keyPressed(final KeyEvent e
) {
1131 if (e
.character
== SWT
.CR
) {
1132 updateHeader(newEditor
.getText());
1134 } else if (e
.character
== SWT
.ESC
) {
1135 tableEditor
.getEditor().dispose();
1139 newEditor
.selectAll();
1140 newEditor
.setFocus();
1141 tableEditor
.setEditor(newEditor
, item
, columnIndex
);
1146 * returns true is value was changed
1148 private boolean updateHeader(final String text
) {
1149 String objKey
= null;
1150 String txtKey
= null;
1151 if (fHeaderState
== HeaderState
.SEARCH
) {
1152 objKey
= Key
.SEARCH_OBJ
;
1153 txtKey
= Key
.SEARCH_TXT
;
1154 } else if (fHeaderState
== HeaderState
.FILTER
) {
1155 objKey
= Key
.FILTER_OBJ
;
1156 txtKey
= Key
.FILTER_TXT
;
1158 if (text
.trim().length() > 0) {
1160 final String regex
= TmfFilterMatchesNode
.regexFix(text
);
1161 Pattern
.compile(regex
);
1162 if (regex
.equals(column
.getData(txtKey
))) {
1163 tableEditor
.getEditor().dispose();
1166 final TmfFilterMatchesNode filter
= new TmfFilterMatchesNode(null);
1167 String fieldId
= (String
) column
.getData(Key
.FIELD_ID
);
1168 if (fieldId
== null) {
1169 fieldId
= column
.getText();
1171 filter
.setField(fieldId
);
1172 filter
.setRegex(regex
);
1173 column
.setData(objKey
, filter
);
1174 column
.setData(txtKey
, regex
);
1175 } catch (final PatternSyntaxException ex
) {
1176 tableEditor
.getEditor().dispose();
1177 MessageDialog
.openError(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell(),
1178 ex
.getDescription(), ex
.getMessage());
1182 if (column
.getData(txtKey
) == null) {
1183 tableEditor
.getEditor().dispose();
1186 column
.setData(objKey
, null);
1187 column
.setData(txtKey
, null);
1192 private void applyHeader() {
1193 if (fHeaderState
== HeaderState
.SEARCH
) {
1195 final TmfFilterAndNode filter
= new TmfFilterAndNode(null);
1196 for (final TableColumn col
: fTable
.getColumns()) {
1197 final Object filterObj
= col
.getData(Key
.SEARCH_OBJ
);
1198 if (filterObj
instanceof ITmfFilterTreeNode
) {
1199 filter
.addChild((ITmfFilterTreeNode
) filterObj
);
1202 if (filter
.getChildrenCount() > 0) {
1203 fTable
.setData(Key
.SEARCH_OBJ
, filter
);
1206 fireSearchApplied(filter
);
1208 fTable
.setData(Key
.SEARCH_OBJ
, null);
1210 fireSearchApplied(null);
1212 } else if (fHeaderState
== HeaderState
.FILTER
) {
1213 final TmfFilterAndNode filter
= new TmfFilterAndNode(null);
1214 for (final TableColumn col
: fTable
.getColumns()) {
1215 final Object filterObj
= col
.getData(Key
.FILTER_OBJ
);
1216 if (filterObj
instanceof ITmfFilterTreeNode
) {
1217 filter
.addChild((ITmfFilterTreeNode
) filterObj
);
1220 if (filter
.getChildrenCount() > 0) {
1221 applyFilter(filter
);
1227 tableEditor
.getEditor().dispose();
1231 fTable
.addKeyListener(new KeyAdapter() {
1233 public void keyPressed(final KeyEvent e
) {
1235 if (e
.character
== SWT
.ESC
) {
1239 } else if (e
.character
== SWT
.DEL
) {
1240 if (fHeaderState
== HeaderState
.SEARCH
) {
1242 for (final TableColumn column
: fTable
.getColumns()) {
1243 column
.setData(Key
.SEARCH_OBJ
, null);
1244 column
.setData(Key
.SEARCH_TXT
, null);
1246 fTable
.setData(Key
.SEARCH_OBJ
, null);
1248 fireSearchApplied(null);
1249 } else if (fHeaderState
== HeaderState
.FILTER
) {
1252 } else if (e
.character
== SWT
.CR
) {
1253 if ((e
.stateMask
& SWT
.SHIFT
) == 0) {
1264 * Send an event indicating a filter has been applied.
1267 * The filter that was just applied
1269 protected void fireFilterApplied(final ITmfFilter filter
) {
1270 broadcast(new TmfEventFilterAppliedSignal(this, fTrace
, filter
));
1274 * Send an event indicating that a search has been applied.
1277 * The search filter that was just applied
1279 protected void fireSearchApplied(final ITmfFilter filter
) {
1280 broadcast(new TmfEventSearchAppliedSignal(this, fTrace
, filter
));
1284 * Start the filtering thread.
1286 protected void startFilterThread() {
1287 synchronized (fFilterSyncObj
) {
1288 final ITmfFilterTreeNode filter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.FILTER_OBJ
);
1289 if (fFilterThread
== null || fFilterThread
.filter
!= filter
) {
1290 if (fFilterThread
!= null) {
1291 fFilterThread
.cancel();
1292 fFilterThreadResume
= false;
1294 fFilterThread
= new FilterThread(filter
);
1295 fFilterThread
.start();
1297 fFilterThreadResume
= true;
1303 * Stop the filtering thread.
1305 protected void stopFilterThread() {
1306 synchronized (fFilterSyncObj
) {
1307 if (fFilterThread
!= null) {
1308 fFilterThread
.cancel();
1309 fFilterThread
= null;
1310 fFilterThreadResume
= false;
1319 * The filter to apply
1322 protected void applyFilter(ITmfFilter filter
) {
1325 fFilterMatchCount
= 0;
1326 fFilterCheckCount
= 0;
1327 fCache
.applyFilter(filter
);
1329 fTable
.setData(Key
.FILTER_OBJ
, filter
);
1330 fTable
.setItemCount(3); // +1 for header row, +2 for top and bottom filter status rows
1331 startFilterThread();
1332 fireFilterApplied(filter
);
1336 * Clear all currently active filters.
1338 protected void clearFilters() {
1339 if (fTable
.getData(Key
.FILTER_OBJ
) == null) {
1344 fCache
.clearFilter();
1346 for (final TableColumn column
: fTable
.getColumns()) {
1347 column
.setData(Key
.FILTER_OBJ
, null);
1348 column
.setData(Key
.FILTER_TXT
, null);
1350 fTable
.setData(Key
.FILTER_OBJ
, null);
1351 if (fTrace
!= null) {
1352 fTable
.setItemCount((int) fTrace
.getNbEvents() + 1); // +1 for header row
1354 fTable
.setItemCount(1); // +1 for header row
1356 fFilterMatchCount
= 0;
1357 fFilterCheckCount
= 0;
1358 if (fSelectedRank
>= 0) {
1359 fTable
.setSelection((int) fSelectedRank
+ 1); // +1 for header row
1361 fTable
.setSelection(0);
1363 fireFilterApplied(null);
1367 * Wrapper Thread object for the filtering thread.
1369 protected class FilterThread
extends Thread
{
1370 private final ITmfFilterTreeNode filter
;
1371 private TmfDataRequest request
;
1372 private boolean refreshBusy
= false;
1373 private boolean refreshPending
= false;
1374 private final Object syncObj
= new Object();
1380 * The filter this thread will be processing
1382 public FilterThread(final ITmfFilterTreeNode filter
) {
1383 super("Filter Thread"); //$NON-NLS-1$
1384 this.filter
= filter
;
1389 if (fTrace
== null) {
1392 final int nbRequested
= (int) (fTrace
.getNbEvents() - fFilterCheckCount
);
1393 if (nbRequested
<= 0) {
1396 request
= new TmfDataRequest(ITmfEvent
.class, (int) fFilterCheckCount
,
1397 nbRequested
, ExecutionType
.BACKGROUND
) {
1399 public void handleData(final ITmfEvent event
) {
1400 super.handleData(event
);
1401 if (request
.isCancelled()) {
1404 if (filter
.matches(event
)) {
1405 final long rank
= fFilterCheckCount
;
1406 final int index
= (int) fFilterMatchCount
;
1407 fFilterMatchCount
++;
1408 fCache
.storeEvent(event
, rank
, index
);
1410 } else if ((fFilterCheckCount
% 100) == 0) {
1413 fFilterCheckCount
++;
1416 ((ITmfDataProvider
) fTrace
).sendRequest(request
);
1418 request
.waitForCompletion();
1419 } catch (final InterruptedException e
) {
1422 synchronized (fFilterSyncObj
) {
1423 fFilterThread
= null;
1424 if (fFilterThreadResume
) {
1425 fFilterThreadResume
= false;
1426 fFilterThread
= new FilterThread(filter
);
1427 fFilterThread
.start();
1433 * Refresh the filter.
1435 public void refreshTable() {
1436 synchronized (syncObj
) {
1438 refreshPending
= true;
1443 Display
.getDefault().asyncExec(new Runnable() {
1446 if (request
.isCancelled()) {
1449 if (fTable
.isDisposed()) {
1452 fTable
.setItemCount((int) fFilterMatchCount
+ 3); // +1 for header row, +2 for top and bottom filter status rows
1454 synchronized (syncObj
) {
1455 refreshBusy
= false;
1456 if (refreshPending
) {
1457 refreshPending
= false;
1466 * Cancel this filtering thread.
1468 public void cancel() {
1469 if (request
!= null) {
1476 * Go to the next item of a search.
1478 protected void searchNext() {
1479 synchronized (fSearchSyncObj
) {
1480 if (fSearchThread
!= null) {
1483 final ITmfFilterTreeNode searchFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.SEARCH_OBJ
);
1484 if (searchFilter
== null) {
1487 final int selectionIndex
= fTable
.getSelectionIndex();
1489 if (selectionIndex
> 0) {
1490 startIndex
= selectionIndex
; // -1 for header row, +1 for next event
1492 // header row is selected, start at top event
1493 startIndex
= Math
.max(0, fTable
.getTopIndex() - 1); // -1 for header row
1495 final ITmfFilterTreeNode eventFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.FILTER_OBJ
);
1496 if (eventFilter
!= null) {
1497 startIndex
= Math
.max(0, startIndex
- 1); // -1 for top filter status row
1499 fSearchThread
= new SearchThread(searchFilter
, eventFilter
, startIndex
, fSelectedRank
, Direction
.FORWARD
);
1500 fSearchThread
.schedule();
1505 * Go to the previous item of a search.
1507 protected void searchPrevious() {
1508 synchronized (fSearchSyncObj
) {
1509 if (fSearchThread
!= null) {
1512 final ITmfFilterTreeNode searchFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.SEARCH_OBJ
);
1513 if (searchFilter
== null) {
1516 final int selectionIndex
= fTable
.getSelectionIndex();
1518 if (selectionIndex
> 0) {
1519 startIndex
= selectionIndex
- 2; // -1 for header row, -1 for previous event
1521 // header row is selected, start at precedent of top event
1522 startIndex
= fTable
.getTopIndex() - 2; // -1 for header row, -1 for previous event
1524 final ITmfFilterTreeNode eventFilter
= (ITmfFilterTreeNode
) fTable
.getData(Key
.FILTER_OBJ
);
1525 if (eventFilter
!= null) {
1526 startIndex
= startIndex
- 1; // -1 for top filter status row
1528 fSearchThread
= new SearchThread(searchFilter
, eventFilter
, startIndex
, fSelectedRank
, Direction
.BACKWARD
);
1529 fSearchThread
.schedule();
1534 * Stop the search thread.
1536 protected void stopSearchThread() {
1537 fPendingGotoRank
= -1;
1538 synchronized (fSearchSyncObj
) {
1539 if (fSearchThread
!= null) {
1540 fSearchThread
.cancel();
1541 fSearchThread
= null;
1547 * Wrapper for the search thread.
1549 protected class SearchThread
extends Job
{
1551 private ITmfFilterTreeNode searchFilter
;
1552 private ITmfFilterTreeNode eventFilter
;
1553 private int startIndex
;
1554 private int direction
;
1556 private long foundRank
= -1;
1557 private TmfDataRequest request
;
1558 private ITmfTimestamp foundTimestamp
= null;
1563 * @param searchFilter
1565 * @param eventFilter
1568 * The index at which we should start searching
1569 * @param currentRank
1572 * In which direction should we search, forward or backwards
1574 public SearchThread(final ITmfFilterTreeNode searchFilter
,
1575 final ITmfFilterTreeNode eventFilter
, final int startIndex
,
1576 final long currentRank
, final int direction
) {
1577 super(Messages
.TmfEventsTable_SearchingJobName
);
1578 this.searchFilter
= searchFilter
;
1579 this.eventFilter
= eventFilter
;
1580 this.startIndex
= startIndex
;
1581 this.rank
= currentRank
;
1582 this.direction
= direction
;
1586 protected IStatus
run(final IProgressMonitor monitor
) {
1587 if (fTrace
== null) {
1588 return Status
.OK_STATUS
;
1590 final Display display
= Display
.getDefault();
1591 if (startIndex
< 0) {
1592 rank
= (int) fTrace
.getNbEvents() - 1;
1593 } else if (startIndex
>= (fTable
.getItemCount() - (eventFilter
== null ?
1 : 3))) { // -1 for header row, -2 for top and bottom filter status rows
1596 int idx
= startIndex
;
1597 while (foundRank
== -1) {
1598 final CachedEvent event
= fCache
.peekEvent(idx
);
1599 if (event
== null) {
1603 if (searchFilter
.matches(event
.event
) && ((eventFilter
== null) || eventFilter
.matches(event
.event
))) {
1604 foundRank
= event
.rank
;
1605 foundTimestamp
= event
.event
.getTimestamp();
1608 if (direction
== Direction
.FORWARD
) {
1614 if (foundRank
== -1) {
1615 if (direction
== Direction
.FORWARD
) {
1617 if (rank
> (fTrace
.getNbEvents() - 1)) {
1623 rank
= (int) fTrace
.getNbEvents() - 1;
1628 final int startRank
= (int) rank
;
1629 boolean wrapped
= false;
1630 while (!monitor
.isCanceled() && (foundRank
== -1) && (fTrace
!= null)) {
1631 int nbRequested
= (direction
== Direction
.FORWARD ? Integer
.MAX_VALUE
: Math
.min((int) rank
+ 1, fTrace
.getCacheSize()));
1632 if (direction
== Direction
.BACKWARD
) {
1633 rank
= Math
.max(0, rank
- fTrace
.getCacheSize() + 1);
1635 request
= new TmfDataRequest(ITmfEvent
.class, (int) rank
, nbRequested
, ExecutionType
.BACKGROUND
) {
1636 long currentRank
= rank
;
1639 public void handleData(final ITmfEvent event
) {
1640 super.handleData(event
);
1641 if (searchFilter
.matches(event
) && ((eventFilter
== null) || eventFilter
.matches(event
))) {
1642 foundRank
= currentRank
;
1643 foundTimestamp
= event
.getTimestamp();
1644 if (direction
== Direction
.FORWARD
) {
1652 ((ITmfDataProvider
) fTrace
).sendRequest(request
);
1654 request
.waitForCompletion();
1655 if (request
.isCancelled()) {
1656 return Status
.OK_STATUS
;
1658 } catch (final InterruptedException e
) {
1659 synchronized (fSearchSyncObj
) {
1660 fSearchThread
= null;
1662 return Status
.OK_STATUS
;
1664 if (foundRank
== -1) {
1665 if (direction
== Direction
.FORWARD
) {
1667 synchronized (fSearchSyncObj
) {
1668 fSearchThread
= null;
1670 return Status
.OK_STATUS
;
1672 nbRequested
= (int) rank
;
1678 rank
= (int) fTrace
.getNbEvents() - 1;
1681 if ((rank
<= startRank
) && wrapped
) {
1682 synchronized (fSearchSyncObj
) {
1683 fSearchThread
= null;
1685 return Status
.OK_STATUS
;
1690 int index
= (int) foundRank
;
1691 if (eventFilter
!= null) {
1692 index
= fCache
.getFilteredEventIndex(foundRank
);
1694 final int selection
= index
+ 1 + (eventFilter
!= null ?
+1 : 0); // +1 for header row, +1 for top filter status row
1696 display
.asyncExec(new Runnable() {
1699 if (monitor
.isCanceled()) {
1702 if (fTable
.isDisposed()) {
1705 fTable
.setSelection(selection
);
1706 fSelectedRank
= foundRank
;
1707 fRawViewer
.selectAndReveal(fSelectedRank
);
1708 if (foundTimestamp
!= null) {
1709 broadcast(new TmfTimeSynchSignal(TmfEventsTable
.this, foundTimestamp
));
1711 fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable
.this, getSelection()));
1712 synchronized (fSearchSyncObj
) {
1713 fSearchThread
= null;
1717 return Status
.OK_STATUS
;
1721 protected void canceling() {
1723 synchronized (fSearchSyncObj
) {
1724 fSearchThread
= null;
1730 * Create the resources.
1732 protected void createResources() {
1733 fGrayColor
= fResourceManager
.createColor(ColorUtil
.blend(fTable
.getBackground().getRGB(), fTable
1734 .getForeground().getRGB()));
1735 fGreenColor
= fTable
.getDisplay().getSystemColor(SWT
.COLOR_DARK_GREEN
);
1736 fBoldFont
= fResourceManager
.createFont(FontDescriptor
.createFrom(fTable
.getFont()).setStyle(SWT
.BOLD
));
1742 protected void packColumns() {
1746 boolean isLinux
= System
.getProperty("os.name").contains("Linux") ?
true : false; //$NON-NLS-1$ //$NON-NLS-2$
1748 TableColumn tableColumns
[] = fTable
.getColumns();
1749 for (int i
= 0; i
< tableColumns
.length
; i
++) {
1750 final TableColumn column
= tableColumns
[i
];
1751 final int headerWidth
= column
.getWidth();
1753 // Workaround for Linux which doesn't consider the image width of
1754 // search/filter row in TableColumn.pack() after having executed
1755 // TableItem.setImage((Image)null) for other rows than search/filter row.
1756 if (isLinux
&& (i
== 0)) {
1757 column
.setWidth(column
.getWidth() + SEARCH_IMAGE
.getBounds().width
);
1760 if (column
.getWidth() < headerWidth
) {
1761 column
.setWidth(headerWidth
);
1768 * Extract the fields of an event (item in the table).
1771 * The event to extract from
1772 * @return The array of fields
1774 * FIXME: Add support for column selection
1776 protected ITmfEventField
[] extractItemFields(final ITmfEvent event
) {
1777 ITmfEventField
[] fields
= new TmfEventField
[0];
1778 if (event
!= null) {
1779 final String timestamp
= event
.getTimestamp().toString();
1780 final String source
= event
.getSource();
1781 final String type
= event
.getType().getName();
1782 final String reference
= event
.getReference();
1783 final String content
= event
.getContent().toString();
1784 fields
= new TmfEventField
[] {
1785 new TmfEventField(ITmfEvent
.EVENT_FIELD_TIMESTAMP
, timestamp
, null),
1786 new TmfEventField(ITmfEvent
.EVENT_FIELD_SOURCE
, source
, null),
1787 new TmfEventField(ITmfEvent
.EVENT_FIELD_TYPE
, type
, null),
1788 new TmfEventField(ITmfEvent
.EVENT_FIELD_REFERENCE
, reference
, null),
1789 new TmfEventField(ITmfEvent
.EVENT_FIELD_CONTENT
, content
, null)
1796 * Notify this table that is got the UI focus.
1798 public void setFocus() {
1803 * Assign a new trace to this event table.
1806 * The trace to assign to this event table
1807 * @param disposeOnClose
1808 * true if the trace should be disposed when the table is
1811 public void setTrace(final ITmfTrace trace
, final boolean disposeOnClose
) {
1812 if ((fTrace
!= null) && fDisposeOnClose
) {
1818 fDisposeOnClose
= disposeOnClose
;
1820 // Perform the updates on the UI thread
1821 fTable
.getDisplay().syncExec(new Runnable() {
1825 fCache
.setTrace(fTrace
); // Clear the cache
1826 if (fTrace
!= null) {
1827 if (!fTable
.isDisposed() && (fTrace
!= null)) {
1828 if (fTable
.getData(Key
.FILTER_OBJ
) == null) {
1829 fTable
.setItemCount((int) fTrace
.getNbEvents() + 1); // +1 for header row
1832 fFilterMatchCount
= 0;
1833 fFilterCheckCount
= 0;
1834 fTable
.setItemCount(3); // +1 for header row, +2 for top and bottom filter status rows
1835 startFilterThread();
1839 fRawViewer
.setTrace(fTrace
);
1844 // ------------------------------------------------------------------------
1846 // ------------------------------------------------------------------------
1849 * Notify that the event cache has been updated
1852 * Also notify if the populating of the cache is complete, or
1855 public void cacheUpdated(final boolean completed
) {
1856 synchronized (fCacheUpdateSyncObj
) {
1857 if (fCacheUpdateBusy
) {
1858 fCacheUpdatePending
= true;
1859 fCacheUpdateCompleted
= completed
;
1862 fCacheUpdateBusy
= true;
1864 // Event cache is now updated. Perform update on the UI thread
1865 if (!fTable
.isDisposed()) {
1866 fTable
.getDisplay().asyncExec(new Runnable() {
1869 if (!fTable
.isDisposed()) {
1874 populateCompleted();
1876 synchronized (fCacheUpdateSyncObj
) {
1877 fCacheUpdateBusy
= false;
1878 if (fCacheUpdatePending
) {
1879 fCacheUpdatePending
= false;
1880 cacheUpdated(fCacheUpdateCompleted
);
1889 * Callback for when populating the table is complete.
1891 protected void populateCompleted() {
1892 // Nothing by default;
1895 // ------------------------------------------------------------------------
1896 // ISelectionProvider
1897 // ------------------------------------------------------------------------
1903 public void addSelectionChangedListener(ISelectionChangedListener listener
) {
1904 selectionChangedListeners
.add(listener
);
1911 public ISelection
getSelection() {
1912 if (fTable
== null || fTable
.isDisposed()) {
1913 return StructuredSelection
.EMPTY
;
1915 List
<Object
> list
= new ArrayList
<Object
>(fTable
.getSelection().length
);
1916 for (TableItem item
: fTable
.getSelection()) {
1917 if (item
.getData() != null) {
1918 list
.add(item
.getData());
1921 return new StructuredSelection(list
);
1928 public void removeSelectionChangedListener(ISelectionChangedListener listener
) {
1929 selectionChangedListeners
.remove(listener
);
1936 public void setSelection(ISelection selection
) {
1941 * Notifies any selection changed listeners that the viewer's selection has changed.
1942 * Only listeners registered at the time this method is called are notified.
1944 * @param event a selection changed event
1946 * @see ISelectionChangedListener#selectionChanged
1949 protected void fireSelectionChanged(final SelectionChangedEvent event
) {
1950 Object
[] listeners
= selectionChangedListeners
.getListeners();
1951 for (int i
= 0; i
< listeners
.length
; ++i
) {
1952 final ISelectionChangedListener l
= (ISelectionChangedListener
) listeners
[i
];
1953 SafeRunnable
.run(new SafeRunnable() {
1956 l
.selectionChanged(event
);
1962 // ------------------------------------------------------------------------
1963 // Bookmark handling
1964 // ------------------------------------------------------------------------
1967 * Add a bookmark to this event table.
1969 * @param bookmarksFile
1970 * The file to use for the bookmarks
1972 public void addBookmark(final IFile bookmarksFile
) {
1973 fBookmarksFile
= bookmarksFile
;
1974 final TableItem
[] selection
= fTable
.getSelection();
1975 if (selection
.length
> 0) {
1976 final TableItem tableItem
= selection
[0];
1977 if (tableItem
.getData(Key
.RANK
) != null) {
1978 final StringBuffer defaultMessage
= new StringBuffer();
1979 for (int i
= 0; i
< fTable
.getColumns().length
; i
++) {
1981 defaultMessage
.append(", "); //$NON-NLS-1$
1983 defaultMessage
.append(tableItem
.getText(i
));
1985 final InputDialog dialog
= new MultiLineInputDialog(
1986 PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell(),
1987 Messages
.TmfEventsTable_AddBookmarkDialogTitle
,
1988 Messages
.TmfEventsTable_AddBookmarkDialogMessage
,
1989 defaultMessage
.toString());
1990 if (dialog
.open() == Window
.OK
) {
1991 final String message
= dialog
.getValue();
1993 final IMarker bookmark
= bookmarksFile
.createMarker(IMarker
.BOOKMARK
);
1994 if (bookmark
.exists()) {
1995 bookmark
.setAttribute(IMarker
.MESSAGE
, message
.toString());
1996 final long rank
= (Long
) tableItem
.getData(Key
.RANK
);
1997 final int location
= (int) rank
;
1998 bookmark
.setAttribute(IMarker
.LOCATION
, (Integer
) location
);
1999 fBookmarksMap
.put(rank
, bookmark
.getId());
2002 } catch (final CoreException e
) {
2003 displayException(e
);
2012 * Remove a bookmark from this event table.
2015 * The bookmark to remove
2017 public void removeBookmark(final IMarker bookmark
) {
2018 for (final Entry
<Long
, Long
> entry
: fBookmarksMap
.entrySet()) {
2019 if (entry
.getValue().equals(bookmark
.getId())) {
2020 fBookmarksMap
.remove(entry
.getKey());
2027 private void toggleBookmark(final long rank
) {
2028 if (fBookmarksFile
== null) {
2031 if (fBookmarksMap
.containsKey(rank
)) {
2032 final Long markerId
= fBookmarksMap
.remove(rank
);
2035 final IMarker bookmark
= fBookmarksFile
.findMarker(markerId
);
2036 if (bookmark
!= null) {
2039 } catch (final CoreException e
) {
2040 displayException(e
);
2043 addBookmark(fBookmarksFile
);
2048 * Refresh the bookmarks assigned to this trace, from the contents of a
2051 * @param bookmarksFile
2052 * The bookmark file to use
2054 public void refreshBookmarks(final IFile bookmarksFile
) {
2055 fBookmarksFile
= bookmarksFile
;
2056 if (bookmarksFile
== null) {
2057 fBookmarksMap
.clear();
2062 fBookmarksMap
.clear();
2063 for (final IMarker bookmark
: bookmarksFile
.findMarkers(IMarker
.BOOKMARK
, false, IResource
.DEPTH_ZERO
)) {
2064 final int location
= bookmark
.getAttribute(IMarker
.LOCATION
, -1);
2065 if (location
!= -1) {
2066 final long rank
= location
;
2067 fBookmarksMap
.put(rank
, bookmark
.getId());
2071 } catch (final CoreException e
) {
2072 displayException(e
);
2077 public void gotoMarker(final IMarker marker
) {
2078 final int rank
= marker
.getAttribute(IMarker
.LOCATION
, -1);
2081 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
2082 index
= fCache
.getFilteredEventIndex(rank
) + 1; // +1 for top filter status row
2083 } else if (rank
>= fTable
.getItemCount()) {
2084 fPendingGotoRank
= rank
;
2086 fSelectedRank
= rank
;
2087 fTable
.setSelection(index
+ 1); // +1 for header row
2091 // ------------------------------------------------------------------------
2093 // ------------------------------------------------------------------------
2096 public void colorSettingsChanged(final ColorSetting
[] colorSettings
) {
2100 // ------------------------------------------------------------------------
2102 // ------------------------------------------------------------------------
2105 * Handler for the trace updated signal
2108 * The incoming signal
2111 public void traceUpdated(final TmfTraceUpdatedSignal signal
) {
2112 if ((signal
.getTrace() != fTrace
) || fTable
.isDisposed()) {
2115 // Perform the refresh on the UI thread
2116 Display
.getDefault().asyncExec(new Runnable() {
2119 if (!fTable
.isDisposed() && (fTrace
!= null)) {
2120 if (fTable
.getData(Key
.FILTER_OBJ
) == null) {
2121 fTable
.setItemCount((int) fTrace
.getNbEvents() + 1); // +1 for header row
2122 if ((fPendingGotoRank
!= -1) && ((fPendingGotoRank
+ 1) < fTable
.getItemCount())) { // +1 for header row
2123 fTable
.setSelection((int) fPendingGotoRank
+ 1); // +1 for header row
2124 fPendingGotoRank
= -1;
2127 startFilterThread();
2130 if (!fRawViewer
.isDisposed() && (fTrace
!= null)) {
2131 fRawViewer
.refreshEventCount();
2138 * Handler for the time synch signal.
2141 * The incoming signal
2144 public void currentTimeUpdated(final TmfTimeSynchSignal signal
) {
2145 if ((signal
.getSource() != this) && (fTrace
!= null) && (!fTable
.isDisposed())) {
2147 // Create a request for one event that will be queued after other ongoing requests. When this request is completed
2148 // do the work to select the actual event with the timestamp specified in the signal. This procedure prevents
2149 // the method fTrace.getRank() from interfering and delaying ongoing requests.
2150 final TmfDataRequest subRequest
= new TmfDataRequest(ITmfEvent
.class,
2151 0, 1, ExecutionType
.FOREGROUND
) {
2153 TmfTimestamp ts
= new TmfTimestamp(signal
.getCurrentTime());
2156 public void handleData(final ITmfEvent event
) {
2157 super.handleData(event
);
2161 public void handleCompleted() {
2162 super.handleCompleted();
2163 if (fTrace
== null) {
2167 // Verify if the event is within the trace range and adjust if necessary
2168 ITmfTimestamp timestamp
= ts
;
2169 if (timestamp
.compareTo(fTrace
.getStartTime(), true) == -1) {
2170 timestamp
= fTrace
.getStartTime();
2172 if (timestamp
.compareTo(fTrace
.getEndTime(), true) == 1) {
2173 timestamp
= fTrace
.getEndTime();
2176 // Get the rank of the selected event in the table
2177 final ITmfContext context
= fTrace
.seekEvent(timestamp
);
2178 final long rank
= context
.getRank();
2180 fSelectedRank
= rank
;
2182 fTable
.getDisplay().asyncExec(new Runnable() {
2185 // Return if table is disposed
2186 if (fTable
.isDisposed()) {
2190 int index
= (int) rank
;
2191 if (fTable
.isDisposed()) {
2194 if (fTable
.getData(Key
.FILTER_OBJ
) != null) {
2195 index
= fCache
.getFilteredEventIndex(rank
) + 1; // +1 for top filter status row
2197 fTable
.setSelection(index
+ 1); // +1 for header row
2198 fRawViewer
.selectAndReveal(rank
);
2204 ((ITmfDataProvider
) fTrace
).sendRequest(subRequest
);
2208 // ------------------------------------------------------------------------
2210 // ------------------------------------------------------------------------
2213 * Display an exception in a message box
2215 * @param e the exception
2217 private static void displayException(final Exception e
) {
2218 final MessageBox mb
= new MessageBox(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell());
2219 mb
.setText(e
.getClass().getSimpleName());
2220 mb
.setMessage(e
.getMessage());
2227 public void refresh() {