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
, ITimeGraphSelectionListener
, ITimeGraphTimeListener
, IColorSettingsListener
,
69 IResourceChangeListener
, ITmfEventsFilterListener
{
71 public static final String ID
= "org.eclipse.linuxtools.tmf.ui.views.timechart"; //$NON-NLS-1$
73 private static final int TIMESTAMP_SCALE
= -9;
75 private final int fDisplayWidth
;
76 private TimeGraphViewer fViewer
;
77 private final ArrayList
<TimeChartAnalysisEntry
> fTimeAnalysisEntries
= new ArrayList
<TimeChartAnalysisEntry
>();
78 private final Map
<ITmfTrace
<?
>, TimeChartDecorationProvider
> fDecorationProviders
= new HashMap
<ITmfTrace
<?
>, TimeChartDecorationProvider
>();
79 private ArrayList
<DecorateThread
> fDecorateThreads
;
80 private long fStartTime
= 0;
81 private long fStopTime
= Long
.MAX_VALUE
;
82 private boolean fRefreshBusy
= false;
83 private boolean fRefreshPending
= false;
84 private boolean fRedrawBusy
= false;
85 private boolean fRedrawPending
= false;
86 private final Object fSyncObj
= new Object();
87 private ITimeGraphPresentationProvider fPresentationProvider
;
89 public TimeChartView() {
90 super("Time Chart"); //$NON-NLS-1$
91 fDisplayWidth
= Display
.getDefault().getBounds().width
;
95 public void createPartControl(Composite parent
) {
96 fViewer
= new TimeGraphViewer(parent
, SWT
.NONE
);
97 fPresentationProvider
= new TimeChartAnalysisProvider();
98 fViewer
.setTimeGraphProvider(fPresentationProvider
);
99 fViewer
.setTimeCalendarFormat(true);
100 fViewer
.addTimeListener(this);
101 fViewer
.addRangeListener(this);
102 fViewer
.addSelectionListener(this);
103 fViewer
.setMinimumItemWidth(1);
105 IEditorReference
[] editorReferences
= getSite().getPage().getEditorReferences();
106 for (IEditorReference editorReference
: editorReferences
) {
107 IEditorPart editor
= editorReference
.getEditor(false);
108 if (editor
instanceof ITmfTraceEditor
) {
109 ITmfTrace
<?
> trace
= ((ITmfTraceEditor
) editor
).getTrace();
111 IFile bookmarksFile
= ((ITmfTraceEditor
) editor
).getBookmarksFile();
112 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
113 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
114 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
115 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
120 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
122 fDecorateThreads
= new ArrayList
<DecorateThread
>();
123 ColorSettingsManager
.addColorSettingsListener(this);
124 ResourcesPlugin
.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent
.POST_CHANGE
);
128 public void dispose() {
129 ResourcesPlugin
.getWorkspace().removeResourceChangeListener(this);
130 for (DecorateThread thread
: fDecorateThreads
) {
133 ColorSettingsManager
.removeColorSettingsListener(this);
138 public void setFocus() {
142 private class ProcessTraceThread
extends Thread
{
144 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
146 public ProcessTraceThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
147 super("ProcessTraceJob:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
148 fTimeAnalysisEntry
= timeAnalysisEntry
;
153 updateTraceEntry(fTimeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
157 private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, long stopRank
, long startTime
, long stopTime
) {
158 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
159 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
160 if (decorationProvider
== null) {
161 return; // the trace has been closed
163 ITmfContext context
= null;
164 // TmfTimestamp lastTimestamp = null;
165 boolean done
= false;
167 synchronized (timeAnalysisEntry
) {
168 if (timeAnalysisEntry
.getLastRank() >= trace
.getNbEvents()) {
172 if (context
== null || context
.getRank() != timeAnalysisEntry
.getLastRank()) {
173 if (context
!= null) {
176 if (timeAnalysisEntry
.getLastRank() != -1) {
177 context
= trace
.seekEvent(timeAnalysisEntry
.getLastRank());
179 // context = trace.seekLocation(null);
180 context
= trace
.seekEvent(0);
184 long rank
= context
.getRank();
185 ITmfEvent event
= trace
.getNext(context
);
190 // if (!event.getTimestamp().equals(lastTimestamp)) {
191 TimeChartEvent timeEvent
= new TimeChartEvent(timeAnalysisEntry
, event
, rank
, decorationProvider
);
192 if (timeEvent
.getTime() >= startTime
&& timeEvent
.getTime() <= stopTime
) {
193 timeAnalysisEntry
.addTraceEvent(timeEvent
);
195 // lastTimestamp = event.getTimestamp();
196 // } *** commented out so that color setting priority gets
197 // set even if the event has same time
198 if (context
.getRank() == trace
.getNbEvents() || context
.getRank() == stopRank
) {
202 if (context
.getRank() % trace
.getCacheSize() == 1) {
203 // break for UI refresh
207 // timeAnalysisEntry.setLastRank(Math.min(trace.getNbEvents(),
209 timeAnalysisEntry
.setLastRank(context
.getRank());
213 if (context
!= null) {
218 private void refreshViewer() {
219 synchronized (fSyncObj
) {
221 fRefreshPending
= true;
227 // Perform the refresh on the UI thread
228 Display
.getDefault().asyncExec(new Runnable() {
231 if (fViewer
.getControl().isDisposed()) {
234 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
235 fViewer
.resetStartFinishTime();
236 synchronized (fSyncObj
) {
237 fRefreshBusy
= false;
238 if (fRefreshPending
) {
239 fRefreshPending
= false;
247 private void redrawViewer(boolean resetTimeIntervals
) {
248 synchronized (fSyncObj
) {
250 fRedrawPending
= true;
256 final boolean reset
= resetTimeIntervals
;
257 // Perform the refresh on the UI thread
258 Display
.getDefault().asyncExec(new Runnable() {
261 if (fViewer
.getControl().isDisposed()) {
265 fViewer
.setTimeRange(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
266 fViewer
.setTimeBounds();
268 fViewer
.getControl().redraw();
269 fViewer
.getControl().update();
270 synchronized (fSyncObj
) {
272 if (fRedrawPending
) {
273 fRedrawPending
= false;
281 private void itemize(long startTime
, long stopTime
) {
282 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
283 Thread thread
= new ItemizeThread(fTimeAnalysisEntries
.get(i
), startTime
, stopTime
);
288 private class ItemizeThread
extends Thread
{
290 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
291 private final long fStartTime
;
292 private final long fStopTime
;
293 private final long fMaxDuration
;
295 private ItemizeThread(TimeChartAnalysisEntry timeAnalysisEntry
, long startTime
, long stopTime
) {
296 super("Itemize Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
297 fTimeAnalysisEntry
= timeAnalysisEntry
;
298 fStartTime
= startTime
;
299 fStopTime
= stopTime
;
300 fMaxDuration
= 3 * (fStopTime
- fStartTime
) / fDisplayWidth
;
305 itemizeTraceEntry(fTimeAnalysisEntry
);
308 public void itemizeTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
309 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
310 TimeChartEvent event
= null;
311 boolean hasNext
= true;
313 synchronized (timeAnalysisEntry
) {
314 while (hasNext
= iterator
.hasNext()) {
315 event
= (TimeChartEvent
) iterator
.next();
316 if (event
.getTime() + event
.getDuration() > fStartTime
&& event
.getTime() < fStopTime
&& event
.getDuration() > fMaxDuration
317 && event
.getNbEvents() > 1) {
323 if (event
.getItemizedEntry() == null) {
326 itemizeTraceEntry(event
.getItemizedEntry());
332 public void itemizeEvent(TimeChartEvent event
) {
333 synchronized (event
) {
334 if (event
.isItemizing()) {
337 event
.setItemizing(true);
339 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(fTimeAnalysisEntry
.getTrace(), (int) Math
.min(
340 event
.getNbEvents() + 1, fDisplayWidth
* 2));
341 synchronized (event
.getRankRangeList()) {
342 for (RankRange range
: event
.getRankRangeList()) {
343 timeAnalysisEntry
.setLastRank(range
.getFirstRank());
344 updateTraceEntry(timeAnalysisEntry
, range
.getLastRank() + 1, event
.getTime(), event
.getTime() + event
.getDuration());
347 event
.setItemizedEntry(timeAnalysisEntry
);
349 itemizeTraceEntry(timeAnalysisEntry
);
350 synchronized (event
) {
351 event
.setItemizing(false);
356 private void redecorate() {
357 synchronized (fDecorateThreads
) {
358 for (DecorateThread thread
: fDecorateThreads
) {
361 fDecorateThreads
.clear();
362 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
363 DecorateThread thread
= new DecorateThread(fTimeAnalysisEntries
.get(i
));
365 fDecorateThreads
.add(thread
);
370 private class DecorateThread
extends Thread
{
371 private volatile boolean interrupted
= false;
372 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
373 private final TimeChartDecorationProvider fDecorationProvider
;
374 private ITmfContext fContext
;
375 private int fCount
= 0;
377 private DecorateThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
378 super("Decorate Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
379 fTimeAnalysisEntry
= timeAnalysisEntry
;
380 fDecorationProvider
= fDecorationProviders
.get(timeAnalysisEntry
.getTrace());
385 resetTraceEntry(fTimeAnalysisEntry
);
387 decorateTraceEntry(fTimeAnalysisEntry
, null);
389 synchronized (fDecorateThreads
) {
390 fDecorateThreads
.remove(this);
392 if (fContext
!= null) {
397 public void resetTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
398 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
399 TimeChartEvent event
= null;
400 boolean hasNext
= true;
401 while (!interrupted
&& hasNext
) {
402 synchronized (timeAnalysisEntry
) {
403 while (hasNext
= iterator
.hasNext()) {
404 event
= (TimeChartEvent
) iterator
.next();
409 // TODO possible concurrency problem here with ItemizeJob
410 event
.setColorSettingPriority(ColorSettingsManager
.PRIORITY_NONE
);
411 if (event
.getItemizedEntry() != null) {
412 resetTraceEntry(event
.getItemizedEntry());
418 public void decorateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, TimeChartEvent parentEvent
) {
419 // Set max duration high to ensure iterator does not consider
421 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator(0, Long
.MAX_VALUE
, Long
.MAX_VALUE
);
422 TimeChartEvent event
= null;
423 int entryPriority
= ColorSettingsManager
.PRIORITY_NONE
;
424 boolean entryIsBookmarked
= false;
425 boolean entryIsVisible
= false;
426 boolean entryIsSearchMatch
= false;
427 boolean hasNext
= true;
428 while (!interrupted
&& hasNext
) {
429 synchronized (timeAnalysisEntry
) {
430 while (hasNext
= iterator
.hasNext()) {
431 event
= (TimeChartEvent
) iterator
.next();
436 // TODO possible concurrency problem here with ItemizeJob
437 if (event
.getItemizedEntry() == null) {
438 decorateEvent(event
);
440 decorateTraceEntry(event
.getItemizedEntry(), event
);
442 entryPriority
= Math
.min(entryPriority
, event
.getColorSettingPriority());
443 entryIsBookmarked
|= event
.isBookmarked();
444 entryIsVisible
|= event
.isVisible();
445 entryIsSearchMatch
|= event
.isSearchMatch();
446 if (++fCount
% timeAnalysisEntry
.getTrace().getCacheSize() == 0) {
451 if (parentEvent
!= null) {
452 parentEvent
.setColorSettingPriority(entryPriority
);
453 parentEvent
.setIsBookmarked(entryIsBookmarked
);
454 parentEvent
.setIsVisible(entryIsVisible
);
455 parentEvent
.setIsSearchMatch(entryIsSearchMatch
);
459 public void decorateEvent(TimeChartEvent timeChartEvent
) {
460 // TODO possible concurrency problem here with ItemizeJob
461 TimeChartAnalysisEntry timeAnalysisEntry
= (TimeChartAnalysisEntry
) timeChartEvent
.getEntry();
462 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
463 int priority
= ColorSettingsManager
.PRIORITY_NONE
;
464 boolean isBookmarked
= false;
465 boolean isVisible
= false;
466 boolean isSearchMatch
= false;
467 synchronized (timeChartEvent
.getRankRangeList()) {
468 for (RankRange range
: timeChartEvent
.getRankRangeList()) {
472 if (fContext
== null || fContext
.getRank() != range
.getFirstRank()) {
473 if (fContext
!= null) {
476 fContext
= trace
.seekEvent(range
.getFirstRank());
477 fContext
.setRank(range
.getFirstRank());
483 long rank
= fContext
.getRank();
484 ITmfEvent event
= trace
.getNext(fContext
);
488 long eventTime
= event
.getTimestamp().normalize(0, -9).getValue();
489 if (eventTime
>= timeChartEvent
.getTime() && eventTime
<= timeChartEvent
.getTime() + timeChartEvent
.getDuration()) {
490 priority
= Math
.min(priority
, ColorSettingsManager
.getColorSettingPriority(event
));
492 isBookmarked
|= fDecorationProvider
.isBookmark(rank
);
493 isVisible
|= fDecorationProvider
.isVisible(event
);
494 isSearchMatch
|= fDecorationProvider
.isSearchMatch(event
);
495 if (fContext
.getRank() > range
.getLastRank()) {
501 timeChartEvent
.setColorSettingPriority(priority
);
502 timeChartEvent
.setIsBookmarked(isBookmarked
);
503 timeChartEvent
.setIsVisible(isVisible
);
504 timeChartEvent
.setIsSearchMatch(isSearchMatch
);
507 public void cancel() {
512 // ------------------------------------------------------------------------
514 // ------------------------------------------------------------------------
517 public void timeRangeUpdated(TimeGraphRangeUpdateEvent event
) {
518 fStartTime
= event
.getStartTime();
519 fStopTime
= event
.getEndTime();
520 itemize(fStartTime
, fStopTime
);
524 public void selectionChanged(TimeGraphSelectionEvent event
) {
525 ITimeGraphEntry timeAnalysisEntry
= null;
526 if (event
.getSelection() instanceof TimeChartAnalysisEntry
) {
527 timeAnalysisEntry
= event
.getSelection();
528 } else if (event
.getSelection() instanceof TimeChartEvent
) {
529 timeAnalysisEntry
= ((TimeChartEvent
) event
.getSelection()).getEntry();
531 if (timeAnalysisEntry
instanceof TimeChartAnalysisEntry
) {
532 broadcast(new TmfTraceSelectedSignal(this, ((TimeChartAnalysisEntry
) timeAnalysisEntry
).getTrace()));
537 public void timeSelected(TimeGraphTimeEvent event
) {
538 broadcast(new TmfTimeSynchSignal(this, new TmfTimestamp(event
.getTime(), TIMESTAMP_SCALE
)));
542 public void colorSettingsChanged(ColorSetting
[] colorSettings
) {
543 // Set presentation provider again to trigger re-creation of new color settings which are stored
544 // in the TimeGraphControl class
545 fViewer
.setTimeGraphProvider(fPresentationProvider
);
550 public void resourceChanged(IResourceChangeEvent event
) {
551 for (IMarkerDelta delta
: event
.findMarkerDeltas(IMarker
.BOOKMARK
, false)) {
552 for (TimeChartDecorationProvider provider
: fDecorationProviders
.values()) {
553 if (delta
.getResource().equals(provider
.getBookmarksFile())) {
554 if (delta
.getKind() == IResourceDelta
.CHANGED
&& delta
.getMarker().getAttribute(IMarker
.LOCATION
, -1) != -1) {
555 provider
.refreshBookmarks();
556 } else if (delta
.getKind() == IResourceDelta
.REMOVED
) {
557 provider
.refreshBookmarks();
566 public void filterApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
567 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
568 decorationProvider
.filterApplied(filter
);
573 public void searchApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
574 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
575 decorationProvider
.searchApplied(filter
);
579 // ------------------------------------------------------------------------
581 // ------------------------------------------------------------------------
584 public void traceOpened(TmfTraceOpenedSignal signal
) {
585 if (fTimeAnalysisEntries
== null) {
588 final ITmfTrace
<?
> trace
= signal
.getTrace();
589 final IFile bookmarksFile
= signal
.getBookmarksFile();
590 final ITmfEventsFilterProvider eventsFilterProvider
= signal
.getEventsFilterProvider();
591 TimeChartAnalysisEntry timeAnalysisEntry
= null;
592 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
593 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
594 timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
598 if (timeAnalysisEntry
== null) {
599 timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
600 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
601 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
602 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
606 if (eventsFilterProvider
!= null) {
607 eventsFilterProvider
.addEventsFilterListener(this);
612 public void traceClosed(TmfTraceClosedSignal signal
) {
613 if (fTimeAnalysisEntries
== null) {
616 final ITmfTrace
<?
> trace
= signal
.getTrace();
617 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
618 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
619 fTimeAnalysisEntries
.remove(i
);
620 fDecorationProviders
.remove(trace
);
628 public void traceSelected(TmfTraceSelectedSignal signal
) {
629 if (signal
.getSource() != this && fTimeAnalysisEntries
!= null) {
630 ITmfTrace
<?
> trace
= signal
.getTrace();
631 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
632 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
633 fViewer
.setSelection(fTimeAnalysisEntries
.get(i
));
641 public void traceUpdated(TmfTraceUpdatedSignal signal
) {
642 if (fTimeAnalysisEntries
== null) {
645 final ITmfTrace
<?
> trace
= signal
.getTrace();
646 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
647 TimeChartAnalysisEntry timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
648 if (timeAnalysisEntry
.getTrace().equals(trace
)) {
649 updateTraceEntry(timeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
656 public void currentTimeUpdated(TmfTimeSynchSignal signal
) {
657 final long time
= signal
.getCurrentTime().normalize(0, TIMESTAMP_SCALE
).getValue();
658 Display
.getDefault().asyncExec(new Runnable() {
661 fViewer
.setSelectedTime(time
, true);