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;
233 // Perform the refresh on the UI thread
234 Display
.getDefault().asyncExec(new Runnable() {
237 if (fViewer
.getControl().isDisposed()) {
240 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
241 fViewer
.resetStartFinishTime();
242 synchronized (fSyncObj
) {
243 fRefreshBusy
= false;
244 if (fRefreshPending
) {
245 fRefreshPending
= false;
253 private void redrawViewer(boolean resetTimeIntervals
) {
254 synchronized (fSyncObj
) {
256 fRedrawPending
= true;
262 final boolean reset
= resetTimeIntervals
;
263 // Perform the refresh on the UI thread
264 Display
.getDefault().asyncExec(new Runnable() {
267 if (fViewer
.getControl().isDisposed()) {
271 fViewer
.setTimeRange(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
272 fViewer
.setTimeBounds();
274 fViewer
.getControl().redraw();
275 fViewer
.getControl().update();
276 synchronized (fSyncObj
) {
278 if (fRedrawPending
) {
279 fRedrawPending
= false;
287 private void itemize(long startTime
, long stopTime
) {
288 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
289 Thread thread
= new ItemizeThread(fTimeAnalysisEntries
.get(i
), startTime
, stopTime
);
294 private class ItemizeThread
extends Thread
{
296 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
297 private final long fStartTime
;
298 private final long fStopTime
;
299 private final long fMaxDuration
;
301 private ItemizeThread(TimeChartAnalysisEntry timeAnalysisEntry
, long startTime
, long stopTime
) {
302 super("Itemize Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
303 fTimeAnalysisEntry
= timeAnalysisEntry
;
304 fStartTime
= startTime
;
305 fStopTime
= stopTime
;
306 fMaxDuration
= 3 * (fStopTime
- fStartTime
) / fDisplayWidth
;
311 itemizeTraceEntry(fTimeAnalysisEntry
);
314 public void itemizeTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
315 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
316 TimeChartEvent event
= null;
317 boolean hasNext
= true;
319 synchronized (timeAnalysisEntry
) {
320 while (hasNext
= iterator
.hasNext()) {
321 event
= (TimeChartEvent
) iterator
.next();
322 if (event
.getTime() + event
.getDuration() > fStartTime
&& event
.getTime() < fStopTime
&& event
.getDuration() > fMaxDuration
323 && event
.getNbEvents() > 1) {
329 if (event
.getItemizedEntry() == null) {
332 itemizeTraceEntry(event
.getItemizedEntry());
338 public void itemizeEvent(TimeChartEvent event
) {
339 synchronized (event
) {
340 if (event
.isItemizing()) {
343 event
.setItemizing(true);
345 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(fTimeAnalysisEntry
.getTrace(), (int) Math
.min(
346 event
.getNbEvents() + 1, fDisplayWidth
* 2));
347 synchronized (event
.getRankRangeList()) {
348 for (RankRange range
: event
.getRankRangeList()) {
349 timeAnalysisEntry
.setLastRank(range
.getFirstRank());
350 updateTraceEntry(timeAnalysisEntry
, range
.getLastRank() + 1, event
.getTime(), event
.getTime() + event
.getDuration());
353 event
.setItemizedEntry(timeAnalysisEntry
);
355 itemizeTraceEntry(timeAnalysisEntry
);
356 synchronized (event
) {
357 event
.setItemizing(false);
362 private void redecorate() {
363 synchronized (fDecorateThreads
) {
364 for (DecorateThread thread
: fDecorateThreads
) {
367 fDecorateThreads
.clear();
368 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
369 DecorateThread thread
= new DecorateThread(fTimeAnalysisEntries
.get(i
));
371 fDecorateThreads
.add(thread
);
376 private class DecorateThread
extends Thread
{
377 private volatile boolean interrupted
= false;
378 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
379 private final TimeChartDecorationProvider fDecorationProvider
;
380 private ITmfContext fContext
;
381 private int fCount
= 0;
383 private DecorateThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
384 super("Decorate Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
385 fTimeAnalysisEntry
= timeAnalysisEntry
;
386 fDecorationProvider
= fDecorationProviders
.get(timeAnalysisEntry
.getTrace());
391 resetTraceEntry(fTimeAnalysisEntry
);
393 decorateTraceEntry(fTimeAnalysisEntry
, null);
395 synchronized (fDecorateThreads
) {
396 fDecorateThreads
.remove(this);
398 if (fContext
!= null) {
403 public void resetTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
404 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
405 TimeChartEvent event
= null;
406 boolean hasNext
= true;
407 while (!interrupted
&& hasNext
) {
408 synchronized (timeAnalysisEntry
) {
409 while (hasNext
= iterator
.hasNext()) {
410 event
= (TimeChartEvent
) iterator
.next();
415 // TODO possible concurrency problem here with ItemizeJob
416 event
.setColorSettingPriority(ColorSettingsManager
.PRIORITY_NONE
);
417 if (event
.getItemizedEntry() != null) {
418 resetTraceEntry(event
.getItemizedEntry());
424 public void decorateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, TimeChartEvent parentEvent
) {
425 // Set max duration high to ensure iterator does not consider
427 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator(0, Long
.MAX_VALUE
, Long
.MAX_VALUE
);
428 TimeChartEvent event
= null;
429 int entryPriority
= ColorSettingsManager
.PRIORITY_NONE
;
430 boolean entryIsBookmarked
= false;
431 boolean entryIsVisible
= false;
432 boolean entryIsSearchMatch
= false;
433 boolean hasNext
= true;
434 while (!interrupted
&& hasNext
) {
435 synchronized (timeAnalysisEntry
) {
436 while (hasNext
= iterator
.hasNext()) {
437 event
= (TimeChartEvent
) iterator
.next();
442 // TODO possible concurrency problem here with ItemizeJob
443 if (event
.getItemizedEntry() == null) {
444 decorateEvent(event
);
446 decorateTraceEntry(event
.getItemizedEntry(), event
);
448 entryPriority
= Math
.min(entryPriority
, event
.getColorSettingPriority());
449 entryIsBookmarked
|= event
.isBookmarked();
450 entryIsVisible
|= event
.isVisible();
451 entryIsSearchMatch
|= event
.isSearchMatch();
452 if (++fCount
% timeAnalysisEntry
.getTrace().getCacheSize() == 0) {
457 if (parentEvent
!= null) {
458 parentEvent
.setColorSettingPriority(entryPriority
);
459 parentEvent
.setIsBookmarked(entryIsBookmarked
);
460 parentEvent
.setIsVisible(entryIsVisible
);
461 parentEvent
.setIsSearchMatch(entryIsSearchMatch
);
465 public void decorateEvent(TimeChartEvent timeChartEvent
) {
466 // TODO possible concurrency problem here with ItemizeJob
467 TimeChartAnalysisEntry timeAnalysisEntry
= (TimeChartAnalysisEntry
) timeChartEvent
.getEntry();
468 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
469 int priority
= ColorSettingsManager
.PRIORITY_NONE
;
470 boolean isBookmarked
= false;
471 boolean isVisible
= false;
472 boolean isSearchMatch
= false;
473 synchronized (timeChartEvent
.getRankRangeList()) {
474 for (RankRange range
: timeChartEvent
.getRankRangeList()) {
478 if (fContext
== null || fContext
.getRank() != range
.getFirstRank()) {
479 if (fContext
!= null) {
482 fContext
= trace
.seekEvent(range
.getFirstRank());
483 fContext
.setRank(range
.getFirstRank());
489 long rank
= fContext
.getRank();
490 ITmfEvent event
= trace
.getNext(fContext
);
494 long eventTime
= event
.getTimestamp().normalize(0, -9).getValue();
495 if (eventTime
>= timeChartEvent
.getTime() && eventTime
<= timeChartEvent
.getTime() + timeChartEvent
.getDuration()) {
496 priority
= Math
.min(priority
, ColorSettingsManager
.getColorSettingPriority(event
));
498 isBookmarked
|= fDecorationProvider
.isBookmark(rank
);
499 isVisible
|= fDecorationProvider
.isVisible(event
);
500 isSearchMatch
|= fDecorationProvider
.isSearchMatch(event
);
501 if (fContext
.getRank() > range
.getLastRank()) {
507 timeChartEvent
.setColorSettingPriority(priority
);
508 timeChartEvent
.setIsBookmarked(isBookmarked
);
509 timeChartEvent
.setIsVisible(isVisible
);
510 timeChartEvent
.setIsSearchMatch(isSearchMatch
);
513 public void cancel() {
518 // ------------------------------------------------------------------------
520 // ------------------------------------------------------------------------
523 public void timeRangeUpdated(TimeGraphRangeUpdateEvent event
) {
524 fStartTime
= event
.getStartTime();
525 fStopTime
= event
.getEndTime();
526 itemize(fStartTime
, fStopTime
);
530 public void selectionChanged(TimeGraphSelectionEvent event
) {
531 ITimeGraphEntry timeAnalysisEntry
= null;
532 if (event
.getSelection() instanceof TimeChartAnalysisEntry
) {
533 timeAnalysisEntry
= event
.getSelection();
534 } else if (event
.getSelection() instanceof TimeChartEvent
) {
535 timeAnalysisEntry
= ((TimeChartEvent
) event
.getSelection()).getEntry();
537 if (timeAnalysisEntry
instanceof TimeChartAnalysisEntry
) {
538 broadcast(new TmfTraceSelectedSignal(this, ((TimeChartAnalysisEntry
) timeAnalysisEntry
).getTrace()));
543 public void timeSelected(TimeGraphTimeEvent event
) {
544 broadcast(new TmfTimeSynchSignal(this, new TmfTimestamp(event
.getTime(), TIMESTAMP_SCALE
)));
548 public void colorSettingsChanged(ColorSetting
[] colorSettings
) {
549 // Set presentation provider again to trigger re-creation of new color settings which are stored
550 // in the TimeGraphControl class
551 fViewer
.setTimeGraphProvider(fPresentationProvider
);
556 public void resourceChanged(IResourceChangeEvent event
) {
557 for (IMarkerDelta delta
: event
.findMarkerDeltas(IMarker
.BOOKMARK
, false)) {
558 for (TimeChartDecorationProvider provider
: fDecorationProviders
.values()) {
559 if (delta
.getResource().equals(provider
.getBookmarksFile())) {
560 if (delta
.getKind() == IResourceDelta
.CHANGED
&& delta
.getMarker().getAttribute(IMarker
.LOCATION
, -1) != -1) {
561 provider
.refreshBookmarks();
562 } else if (delta
.getKind() == IResourceDelta
.REMOVED
) {
563 provider
.refreshBookmarks();
572 public void filterApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
573 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
574 decorationProvider
.filterApplied(filter
);
579 public void searchApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
580 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
581 decorationProvider
.searchApplied(filter
);
585 // ------------------------------------------------------------------------
587 // ------------------------------------------------------------------------
590 * Handler for the Trace Opened signal
593 * The incoming signal
596 public void traceOpened(TmfTraceOpenedSignal signal
) {
597 if (fTimeAnalysisEntries
== null) {
600 final ITmfTrace
<?
> trace
= signal
.getTrace();
601 final IFile bookmarksFile
= signal
.getBookmarksFile();
602 final ITmfEventsFilterProvider eventsFilterProvider
= signal
.getEventsFilterProvider();
603 TimeChartAnalysisEntry timeAnalysisEntry
= null;
604 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
605 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
606 timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
610 if (timeAnalysisEntry
== null) {
611 timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
612 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
613 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
614 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
618 if (eventsFilterProvider
!= null) {
619 eventsFilterProvider
.addEventsFilterListener(this);
624 * Handler for the Trace Closed signal
627 * The incoming signal
630 public void traceClosed(TmfTraceClosedSignal signal
) {
631 if (fTimeAnalysisEntries
== null) {
634 final ITmfTrace
<?
> trace
= signal
.getTrace();
635 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
636 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
637 fTimeAnalysisEntries
.remove(i
);
638 fDecorationProviders
.remove(trace
);
646 * Handler for the Trace Selected signal
649 * The incoming signal
652 public void traceSelected(TmfTraceSelectedSignal signal
) {
653 if (signal
.getSource() != this && fTimeAnalysisEntries
!= null) {
654 ITmfTrace
<?
> trace
= signal
.getTrace();
655 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
656 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
657 fViewer
.setSelection(fTimeAnalysisEntries
.get(i
));
665 * Handler for the Trace Updated signal
668 * The incoming signal
671 public void traceUpdated(TmfTraceUpdatedSignal signal
) {
672 if (fTimeAnalysisEntries
== null) {
675 final ITmfTrace
<?
> trace
= signal
.getTrace();
676 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
677 TimeChartAnalysisEntry timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
678 if (timeAnalysisEntry
.getTrace().equals(trace
)) {
679 updateTraceEntry(timeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
686 * Handler for the Time Synch signal
689 * The incoming signal
692 public void currentTimeUpdated(TmfTimeSynchSignal signal
) {
693 final long time
= signal
.getCurrentTime().normalize(0, TIMESTAMP_SCALE
).getValue();
694 Display
.getDefault().asyncExec(new Runnable() {
697 fViewer
.setSelectedTime(time
, true);