1 /*******************************************************************************
2 * Copyright (c) 2010 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 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.timechart
;
15 import java
.util
.ArrayList
;
16 import java
.util
.HashMap
;
17 import java
.util
.Iterator
;
20 import org
.eclipse
.core
.resources
.IFile
;
21 import org
.eclipse
.core
.resources
.IMarker
;
22 import org
.eclipse
.core
.resources
.IMarkerDelta
;
23 import org
.eclipse
.core
.resources
.IResourceChangeEvent
;
24 import org
.eclipse
.core
.resources
.IResourceChangeListener
;
25 import org
.eclipse
.core
.resources
.IResourceDelta
;
26 import org
.eclipse
.core
.resources
.ResourcesPlugin
;
27 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
28 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
29 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.ITmfFilter
;
30 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalHandler
;
31 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTimeSynchSignal
;
32 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceSelectedSignal
;
33 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceUpdatedSignal
;
34 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfContext
;
35 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
36 import org
.eclipse
.linuxtools
.tmf
.ui
.editors
.ITmfTraceEditor
;
37 import org
.eclipse
.linuxtools
.tmf
.ui
.signal
.TmfTraceClosedSignal
;
38 import org
.eclipse
.linuxtools
.tmf
.ui
.signal
.TmfTraceOpenedSignal
;
39 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.ITmfEventsFilterListener
;
40 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.ITmfEventsFilterProvider
;
41 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.TmfView
;
42 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.colors
.ColorSetting
;
43 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.colors
.ColorSettingsManager
;
44 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.colors
.IColorSettingsListener
;
45 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.timechart
.TimeChartEvent
.RankRange
;
46 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.ITimeGraphPresentationProvider
;
47 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.ITimeGraphRangeListener
;
48 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.ITimeGraphSelectionListener
;
49 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.ITimeGraphTimeListener
;
50 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphRangeUpdateEvent
;
51 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphSelectionEvent
;
52 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphTimeEvent
;
53 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphViewer
;
54 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
55 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
56 import org
.eclipse
.swt
.SWT
;
57 import org
.eclipse
.swt
.widgets
.Composite
;
58 import org
.eclipse
.swt
.widgets
.Display
;
59 import org
.eclipse
.ui
.IEditorPart
;
60 import org
.eclipse
.ui
.IEditorReference
;
63 * Generic Time Chart view, which is similar to a Gantt chart for trace analysis
66 * @author Patrick Tasse
68 public class TimeChartView
extends TmfView
implements ITimeGraphRangeListener
,
69 ITimeGraphSelectionListener
, ITimeGraphTimeListener
,
70 IColorSettingsListener
, IResourceChangeListener
,
71 ITmfEventsFilterListener
{
73 /** TimeChartView's ID */
74 public static final String ID
= "org.eclipse.linuxtools.tmf.ui.views.timechart"; //$NON-NLS-1$
76 private static final int TIMESTAMP_SCALE
= -9;
78 private final int fDisplayWidth
;
79 private TimeGraphViewer fViewer
;
80 private final ArrayList
<TimeChartAnalysisEntry
> fTimeAnalysisEntries
= new ArrayList
<TimeChartAnalysisEntry
>();
81 private final Map
<ITmfTrace
<?
>, TimeChartDecorationProvider
> fDecorationProviders
= new HashMap
<ITmfTrace
<?
>, TimeChartDecorationProvider
>();
82 private ArrayList
<DecorateThread
> fDecorateThreads
;
83 private long fStartTime
= 0;
84 private long fStopTime
= Long
.MAX_VALUE
;
85 private boolean fRefreshBusy
= false;
86 private boolean fRefreshPending
= false;
87 private boolean fRedrawBusy
= false;
88 private boolean fRedrawPending
= false;
89 private final Object fSyncObj
= new Object();
90 private ITimeGraphPresentationProvider fPresentationProvider
;
95 public TimeChartView() {
96 super("Time Chart"); //$NON-NLS-1$
97 fDisplayWidth
= Display
.getDefault().getBounds().width
;
101 public void createPartControl(Composite parent
) {
102 fViewer
= new TimeGraphViewer(parent
, SWT
.NONE
);
103 fPresentationProvider
= new TimeChartAnalysisProvider();
104 fViewer
.setTimeGraphProvider(fPresentationProvider
);
105 fViewer
.setTimeCalendarFormat(true);
106 fViewer
.addTimeListener(this);
107 fViewer
.addRangeListener(this);
108 fViewer
.addSelectionListener(this);
109 fViewer
.setMinimumItemWidth(1);
111 IEditorReference
[] editorReferences
= getSite().getPage().getEditorReferences();
112 for (IEditorReference editorReference
: editorReferences
) {
113 IEditorPart editor
= editorReference
.getEditor(false);
114 if (editor
instanceof ITmfTraceEditor
) {
115 ITmfTrace
<?
> trace
= ((ITmfTraceEditor
) editor
).getTrace();
117 IFile bookmarksFile
= ((ITmfTraceEditor
) editor
).getBookmarksFile();
118 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
119 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
120 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
121 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
126 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
128 fDecorateThreads
= new ArrayList
<DecorateThread
>();
129 ColorSettingsManager
.addColorSettingsListener(this);
130 ResourcesPlugin
.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent
.POST_CHANGE
);
134 public void dispose() {
135 ResourcesPlugin
.getWorkspace().removeResourceChangeListener(this);
136 for (DecorateThread thread
: fDecorateThreads
) {
139 ColorSettingsManager
.removeColorSettingsListener(this);
144 public void setFocus() {
148 private class ProcessTraceThread
extends Thread
{
150 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
152 public ProcessTraceThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
153 super("ProcessTraceJob:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
154 fTimeAnalysisEntry
= timeAnalysisEntry
;
159 updateTraceEntry(fTimeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
163 private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, long stopRank
, long startTime
, long stopTime
) {
164 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
165 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
166 if (decorationProvider
== null) {
167 return; // the trace has been closed
169 ITmfContext context
= null;
170 // TmfTimestamp lastTimestamp = null;
171 boolean done
= false;
173 synchronized (timeAnalysisEntry
) {
174 if (timeAnalysisEntry
.getLastRank() >= trace
.getNbEvents()) {
178 if (context
== null || context
.getRank() != timeAnalysisEntry
.getLastRank()) {
179 if (context
!= null) {
182 if (timeAnalysisEntry
.getLastRank() != -1) {
183 context
= trace
.seekEvent(timeAnalysisEntry
.getLastRank());
185 // context = trace.seekLocation(null);
186 context
= trace
.seekEvent(0);
190 long rank
= context
.getRank();
191 ITmfEvent event
= trace
.getNext(context
);
196 // if (!event.getTimestamp().equals(lastTimestamp)) {
197 TimeChartEvent timeEvent
= new TimeChartEvent(timeAnalysisEntry
, event
, rank
, decorationProvider
);
198 if (timeEvent
.getTime() >= startTime
&& timeEvent
.getTime() <= stopTime
) {
199 timeAnalysisEntry
.addTraceEvent(timeEvent
);
201 // lastTimestamp = event.getTimestamp();
202 // } *** commented out so that color setting priority gets
203 // set even if the event has same time
204 if (context
.getRank() == trace
.getNbEvents() || context
.getRank() == stopRank
) {
208 if (context
.getRank() % trace
.getCacheSize() == 1) {
209 // break for UI refresh
213 // timeAnalysisEntry.setLastRank(Math.min(trace.getNbEvents(),
215 timeAnalysisEntry
.setLastRank(context
.getRank());
219 if (context
!= null) {
224 private void refreshViewer() {
225 synchronized (fSyncObj
) {
227 fRefreshPending
= true;
232 // Perform the refresh on the UI thread
233 Display
.getDefault().asyncExec(new Runnable() {
236 if (fViewer
.getControl().isDisposed()) {
239 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
240 fViewer
.resetStartFinishTime();
241 synchronized (fSyncObj
) {
242 fRefreshBusy
= false;
243 if (fRefreshPending
) {
244 fRefreshPending
= false;
252 private void redrawViewer(boolean resetTimeIntervals
) {
253 synchronized (fSyncObj
) {
255 fRedrawPending
= true;
260 final boolean reset
= resetTimeIntervals
;
261 // Perform the refresh on the UI thread
262 Display
.getDefault().asyncExec(new Runnable() {
265 if (fViewer
.getControl().isDisposed()) {
269 fViewer
.setTimeRange(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
270 fViewer
.setTimeBounds();
272 fViewer
.getControl().redraw();
273 fViewer
.getControl().update();
274 synchronized (fSyncObj
) {
276 if (fRedrawPending
) {
277 fRedrawPending
= false;
285 private void itemize(long startTime
, long stopTime
) {
286 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
287 Thread thread
= new ItemizeThread(fTimeAnalysisEntries
.get(i
), startTime
, stopTime
);
292 private class ItemizeThread
extends Thread
{
294 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
295 private final long fStartTime
;
296 private final long fStopTime
;
297 private final long fMaxDuration
;
299 private ItemizeThread(TimeChartAnalysisEntry timeAnalysisEntry
, long startTime
, long stopTime
) {
300 super("Itemize Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
301 fTimeAnalysisEntry
= timeAnalysisEntry
;
302 fStartTime
= startTime
;
303 fStopTime
= stopTime
;
304 fMaxDuration
= 3 * (fStopTime
- fStartTime
) / fDisplayWidth
;
309 itemizeTraceEntry(fTimeAnalysisEntry
);
312 public void itemizeTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
313 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
314 TimeChartEvent event
= null;
315 boolean hasNext
= true;
317 synchronized (timeAnalysisEntry
) {
318 while (hasNext
= iterator
.hasNext()) {
319 event
= (TimeChartEvent
) iterator
.next();
320 if (event
.getTime() + event
.getDuration() > fStartTime
&& event
.getTime() < fStopTime
&& event
.getDuration() > fMaxDuration
321 && event
.getNbEvents() > 1) {
327 if (event
.getItemizedEntry() == null) {
330 itemizeTraceEntry(event
.getItemizedEntry());
336 public void itemizeEvent(TimeChartEvent event
) {
337 synchronized (event
) {
338 if (event
.isItemizing()) {
341 event
.setItemizing(true);
343 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(fTimeAnalysisEntry
.getTrace(), (int) Math
.min(
344 event
.getNbEvents() + 1, fDisplayWidth
* 2));
345 synchronized (event
.getRankRangeList()) {
346 for (RankRange range
: event
.getRankRangeList()) {
347 timeAnalysisEntry
.setLastRank(range
.getFirstRank());
348 updateTraceEntry(timeAnalysisEntry
, range
.getLastRank() + 1, event
.getTime(), event
.getTime() + event
.getDuration());
351 event
.setItemizedEntry(timeAnalysisEntry
);
353 itemizeTraceEntry(timeAnalysisEntry
);
354 synchronized (event
) {
355 event
.setItemizing(false);
360 private void redecorate() {
361 synchronized (fDecorateThreads
) {
362 for (DecorateThread thread
: fDecorateThreads
) {
365 fDecorateThreads
.clear();
366 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
367 DecorateThread thread
= new DecorateThread(fTimeAnalysisEntries
.get(i
));
369 fDecorateThreads
.add(thread
);
374 private class DecorateThread
extends Thread
{
375 private volatile boolean interrupted
= false;
376 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
377 private final TimeChartDecorationProvider fDecorationProvider
;
378 private ITmfContext fContext
;
379 private int fCount
= 0;
381 private DecorateThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
382 super("Decorate Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
383 fTimeAnalysisEntry
= timeAnalysisEntry
;
384 fDecorationProvider
= fDecorationProviders
.get(timeAnalysisEntry
.getTrace());
389 resetTraceEntry(fTimeAnalysisEntry
);
391 decorateTraceEntry(fTimeAnalysisEntry
, null);
393 synchronized (fDecorateThreads
) {
394 fDecorateThreads
.remove(this);
396 if (fContext
!= null) {
401 public void resetTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
402 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
403 TimeChartEvent event
= null;
404 boolean hasNext
= true;
405 while (!interrupted
&& hasNext
) {
406 synchronized (timeAnalysisEntry
) {
407 while (hasNext
= iterator
.hasNext()) {
408 event
= (TimeChartEvent
) iterator
.next();
413 // TODO possible concurrency problem here with ItemizeJob
414 event
.setColorSettingPriority(ColorSettingsManager
.PRIORITY_NONE
);
415 if (event
.getItemizedEntry() != null) {
416 resetTraceEntry(event
.getItemizedEntry());
422 public void decorateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, TimeChartEvent parentEvent
) {
423 // Set max duration high to ensure iterator does not consider
425 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator(0, Long
.MAX_VALUE
, Long
.MAX_VALUE
);
426 TimeChartEvent event
= null;
427 int entryPriority
= ColorSettingsManager
.PRIORITY_NONE
;
428 boolean entryIsBookmarked
= false;
429 boolean entryIsVisible
= false;
430 boolean entryIsSearchMatch
= false;
431 boolean hasNext
= true;
432 while (!interrupted
&& hasNext
) {
433 synchronized (timeAnalysisEntry
) {
434 while (hasNext
= iterator
.hasNext()) {
435 event
= (TimeChartEvent
) iterator
.next();
440 // TODO possible concurrency problem here with ItemizeJob
441 if (event
.getItemizedEntry() == null) {
442 decorateEvent(event
);
444 decorateTraceEntry(event
.getItemizedEntry(), event
);
446 entryPriority
= Math
.min(entryPriority
, event
.getColorSettingPriority());
447 entryIsBookmarked
|= event
.isBookmarked();
448 entryIsVisible
|= event
.isVisible();
449 entryIsSearchMatch
|= event
.isSearchMatch();
450 if (++fCount
% timeAnalysisEntry
.getTrace().getCacheSize() == 0) {
455 if (parentEvent
!= null) {
456 parentEvent
.setColorSettingPriority(entryPriority
);
457 parentEvent
.setIsBookmarked(entryIsBookmarked
);
458 parentEvent
.setIsVisible(entryIsVisible
);
459 parentEvent
.setIsSearchMatch(entryIsSearchMatch
);
463 public void decorateEvent(TimeChartEvent timeChartEvent
) {
464 // TODO possible concurrency problem here with ItemizeJob
465 TimeChartAnalysisEntry timeAnalysisEntry
= (TimeChartAnalysisEntry
) timeChartEvent
.getEntry();
466 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
467 int priority
= ColorSettingsManager
.PRIORITY_NONE
;
468 boolean isBookmarked
= false;
469 boolean isVisible
= false;
470 boolean isSearchMatch
= false;
471 synchronized (timeChartEvent
.getRankRangeList()) {
472 for (RankRange range
: timeChartEvent
.getRankRangeList()) {
476 if (fContext
== null || fContext
.getRank() != range
.getFirstRank()) {
477 if (fContext
!= null) {
480 fContext
= trace
.seekEvent(range
.getFirstRank());
481 fContext
.setRank(range
.getFirstRank());
487 long rank
= fContext
.getRank();
488 ITmfEvent event
= trace
.getNext(fContext
);
492 long eventTime
= event
.getTimestamp().normalize(0, -9).getValue();
493 if (eventTime
>= timeChartEvent
.getTime() && eventTime
<= timeChartEvent
.getTime() + timeChartEvent
.getDuration()) {
494 priority
= Math
.min(priority
, ColorSettingsManager
.getColorSettingPriority(event
));
496 isBookmarked
|= fDecorationProvider
.isBookmark(rank
);
497 isVisible
|= fDecorationProvider
.isVisible(event
);
498 isSearchMatch
|= fDecorationProvider
.isSearchMatch(event
);
499 if (fContext
.getRank() > range
.getLastRank()) {
505 timeChartEvent
.setColorSettingPriority(priority
);
506 timeChartEvent
.setIsBookmarked(isBookmarked
);
507 timeChartEvent
.setIsVisible(isVisible
);
508 timeChartEvent
.setIsSearchMatch(isSearchMatch
);
511 public void cancel() {
516 // ------------------------------------------------------------------------
518 // ------------------------------------------------------------------------
521 public void timeRangeUpdated(TimeGraphRangeUpdateEvent event
) {
522 fStartTime
= event
.getStartTime();
523 fStopTime
= event
.getEndTime();
524 itemize(fStartTime
, fStopTime
);
528 public void selectionChanged(TimeGraphSelectionEvent event
) {
529 ITimeGraphEntry timeAnalysisEntry
= null;
530 if (event
.getSelection() instanceof TimeChartAnalysisEntry
) {
531 timeAnalysisEntry
= event
.getSelection();
532 } else if (event
.getSelection() instanceof TimeChartEvent
) {
533 timeAnalysisEntry
= ((TimeChartEvent
) event
.getSelection()).getEntry();
535 if (timeAnalysisEntry
instanceof TimeChartAnalysisEntry
) {
536 broadcast(new TmfTraceSelectedSignal(this, ((TimeChartAnalysisEntry
) timeAnalysisEntry
).getTrace()));
541 public void timeSelected(TimeGraphTimeEvent event
) {
542 broadcast(new TmfTimeSynchSignal(this, new TmfTimestamp(event
.getTime(), TIMESTAMP_SCALE
)));
546 public void colorSettingsChanged(ColorSetting
[] colorSettings
) {
547 // Set presentation provider again to trigger re-creation of new color settings which are stored
548 // in the TimeGraphControl class
549 fViewer
.setTimeGraphProvider(fPresentationProvider
);
554 public void resourceChanged(IResourceChangeEvent event
) {
555 for (IMarkerDelta delta
: event
.findMarkerDeltas(IMarker
.BOOKMARK
, false)) {
556 for (TimeChartDecorationProvider provider
: fDecorationProviders
.values()) {
557 if (delta
.getResource().equals(provider
.getBookmarksFile())) {
558 if (delta
.getKind() == IResourceDelta
.CHANGED
&& delta
.getMarker().getAttribute(IMarker
.LOCATION
, -1) != -1) {
559 provider
.refreshBookmarks();
560 } else if (delta
.getKind() == IResourceDelta
.REMOVED
) {
561 provider
.refreshBookmarks();
570 public void filterApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
571 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
572 decorationProvider
.filterApplied(filter
);
577 public void searchApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
578 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
579 decorationProvider
.searchApplied(filter
);
583 // ------------------------------------------------------------------------
585 // ------------------------------------------------------------------------
588 * Handler for the Trace Opened signal
591 * The incoming signal
594 public void traceOpened(TmfTraceOpenedSignal signal
) {
595 if (fTimeAnalysisEntries
== null) {
598 final ITmfTrace
<?
> trace
= signal
.getTrace();
599 final IFile bookmarksFile
= signal
.getBookmarksFile();
600 final ITmfEventsFilterProvider eventsFilterProvider
= signal
.getEventsFilterProvider();
601 TimeChartAnalysisEntry timeAnalysisEntry
= null;
602 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
603 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
604 timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
608 if (timeAnalysisEntry
== null) {
609 timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
610 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
611 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
612 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
616 if (eventsFilterProvider
!= null) {
617 eventsFilterProvider
.addEventsFilterListener(this);
622 * Handler for the Trace Closed signal
625 * The incoming signal
628 public void traceClosed(TmfTraceClosedSignal signal
) {
629 if (fTimeAnalysisEntries
== null) {
632 final ITmfTrace
<?
> trace
= signal
.getTrace();
633 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
634 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
635 fTimeAnalysisEntries
.remove(i
);
636 fDecorationProviders
.remove(trace
);
644 * Handler for the Trace Selected signal
647 * The incoming signal
650 public void traceSelected(TmfTraceSelectedSignal signal
) {
651 if (signal
.getSource() != this && fTimeAnalysisEntries
!= null) {
652 ITmfTrace
<?
> trace
= signal
.getTrace();
653 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
654 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
655 fViewer
.setSelection(fTimeAnalysisEntries
.get(i
));
663 * Handler for the Trace Updated signal
666 * The incoming signal
669 public void traceUpdated(TmfTraceUpdatedSignal signal
) {
670 if (fTimeAnalysisEntries
== null) {
673 final ITmfTrace
<?
> trace
= signal
.getTrace();
674 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
675 TimeChartAnalysisEntry timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
676 if (timeAnalysisEntry
.getTrace().equals(trace
)) {
677 updateTraceEntry(timeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
684 * Handler for the Time Synch signal
687 * The incoming signal
690 public void currentTimeUpdated(TmfTimeSynchSignal signal
) {
691 final long time
= signal
.getCurrentTime().normalize(0, TIMESTAMP_SCALE
).getValue();
692 Display
.getDefault().asyncExec(new Runnable() {
695 fViewer
.setSelectedTime(time
, true);