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
;
62 public class TimeChartView
extends TmfView
implements ITimeGraphRangeListener
, ITimeGraphSelectionListener
, ITimeGraphTimeListener
, IColorSettingsListener
,
63 IResourceChangeListener
, ITmfEventsFilterListener
{
65 public static final String ID
= "org.eclipse.linuxtools.tmf.ui.views.timechart"; //$NON-NLS-1$
67 private static final int TIMESTAMP_SCALE
= -9;
69 private final int fDisplayWidth
;
70 private TimeGraphViewer fViewer
;
71 private final ArrayList
<TimeChartAnalysisEntry
> fTimeAnalysisEntries
= new ArrayList
<TimeChartAnalysisEntry
>();
72 private final Map
<ITmfTrace
<?
>, TimeChartDecorationProvider
> fDecorationProviders
= new HashMap
<ITmfTrace
<?
>, TimeChartDecorationProvider
>();
73 private ArrayList
<DecorateThread
> fDecorateThreads
;
74 private long fStartTime
= 0;
75 private long fStopTime
= Long
.MAX_VALUE
;
76 private boolean fRefreshBusy
= false;
77 private boolean fRefreshPending
= false;
78 private boolean fRedrawBusy
= false;
79 private boolean fRedrawPending
= false;
80 private final Object fSyncObj
= new Object();
81 private ITimeGraphPresentationProvider fPresentationProvider
;
83 public TimeChartView() {
84 super("Time Chart"); //$NON-NLS-1$
85 fDisplayWidth
= Display
.getDefault().getBounds().width
;
89 public void createPartControl(Composite parent
) {
90 fViewer
= new TimeGraphViewer(parent
, SWT
.NONE
);
91 fPresentationProvider
= new TimeChartAnalysisProvider();
92 fViewer
.setTimeGraphProvider(fPresentationProvider
);
93 fViewer
.setTimeCalendarFormat(true);
94 fViewer
.addTimeListener(this);
95 fViewer
.addRangeListener(this);
96 fViewer
.addSelectionListener(this);
97 fViewer
.setMinimumItemWidth(1);
99 IEditorReference
[] editorReferences
= getSite().getPage().getEditorReferences();
100 for (IEditorReference editorReference
: editorReferences
) {
101 IEditorPart editor
= editorReference
.getEditor(false);
102 if (editor
instanceof ITmfTraceEditor
) {
103 ITmfTrace
<?
> trace
= ((ITmfTraceEditor
) editor
).getTrace();
105 IFile bookmarksFile
= ((ITmfTraceEditor
) editor
).getBookmarksFile();
106 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
107 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
108 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
109 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
114 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
116 fDecorateThreads
= new ArrayList
<DecorateThread
>();
117 ColorSettingsManager
.addColorSettingsListener(this);
118 ResourcesPlugin
.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent
.POST_CHANGE
);
122 public void dispose() {
123 ResourcesPlugin
.getWorkspace().removeResourceChangeListener(this);
124 for (DecorateThread thread
: fDecorateThreads
) {
127 ColorSettingsManager
.removeColorSettingsListener(this);
132 public void setFocus() {
136 private class ProcessTraceThread
extends Thread
{
138 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
140 public ProcessTraceThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
141 super("ProcessTraceJob:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
142 fTimeAnalysisEntry
= timeAnalysisEntry
;
147 updateTraceEntry(fTimeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
151 private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, long stopRank
, long startTime
, long stopTime
) {
152 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
153 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
154 if (decorationProvider
== null) {
155 return; // the trace has been closed
157 ITmfContext context
= null;
158 // TmfTimestamp lastTimestamp = null;
159 boolean done
= false;
161 synchronized (timeAnalysisEntry
) {
162 if (timeAnalysisEntry
.getLastRank() >= trace
.getNbEvents()) {
166 if (context
== null || context
.getRank() != timeAnalysisEntry
.getLastRank()) {
167 if (context
!= null) {
170 if (timeAnalysisEntry
.getLastRank() != -1) {
171 context
= trace
.seekEvent(timeAnalysisEntry
.getLastRank());
173 // context = trace.seekLocation(null);
174 context
= trace
.seekEvent(0);
178 long rank
= context
.getRank();
179 ITmfEvent event
= trace
.getNext(context
);
184 // if (!event.getTimestamp().equals(lastTimestamp)) {
185 TimeChartEvent timeEvent
= new TimeChartEvent(timeAnalysisEntry
, event
, rank
, decorationProvider
);
186 if (timeEvent
.getTime() >= startTime
&& timeEvent
.getTime() <= stopTime
) {
187 timeAnalysisEntry
.addTraceEvent(timeEvent
);
189 // lastTimestamp = event.getTimestamp();
190 // } *** commented out so that color setting priority gets
191 // set even if the event has same time
192 if (context
.getRank() == trace
.getNbEvents() || context
.getRank() == stopRank
) {
196 if (context
.getRank() % trace
.getCacheSize() == 1) {
197 // break for UI refresh
201 // timeAnalysisEntry.setLastRank(Math.min(trace.getNbEvents(),
203 timeAnalysisEntry
.setLastRank(context
.getRank());
207 if (context
!= null) {
212 private void refreshViewer() {
213 synchronized (fSyncObj
) {
215 fRefreshPending
= true;
221 // Perform the refresh on the UI thread
222 Display
.getDefault().asyncExec(new Runnable() {
225 if (fViewer
.getControl().isDisposed()) {
228 fViewer
.setInput(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
229 fViewer
.resetStartFinishTime();
230 synchronized (fSyncObj
) {
231 fRefreshBusy
= false;
232 if (fRefreshPending
) {
233 fRefreshPending
= false;
241 private void redrawViewer(boolean resetTimeIntervals
) {
242 synchronized (fSyncObj
) {
244 fRedrawPending
= true;
250 final boolean reset
= resetTimeIntervals
;
251 // Perform the refresh on the UI thread
252 Display
.getDefault().asyncExec(new Runnable() {
255 if (fViewer
.getControl().isDisposed()) {
259 fViewer
.setTimeRange(fTimeAnalysisEntries
.toArray(new TimeChartAnalysisEntry
[0]));
260 fViewer
.setTimeBounds();
262 fViewer
.getControl().redraw();
263 fViewer
.getControl().update();
264 synchronized (fSyncObj
) {
266 if (fRedrawPending
) {
267 fRedrawPending
= false;
275 private void itemize(long startTime
, long stopTime
) {
276 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
277 Thread thread
= new ItemizeThread(fTimeAnalysisEntries
.get(i
), startTime
, stopTime
);
282 private class ItemizeThread
extends Thread
{
284 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
285 private final long fStartTime
;
286 private final long fStopTime
;
287 private final long fMaxDuration
;
289 private ItemizeThread(TimeChartAnalysisEntry timeAnalysisEntry
, long startTime
, long stopTime
) {
290 super("Itemize Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
291 fTimeAnalysisEntry
= timeAnalysisEntry
;
292 fStartTime
= startTime
;
293 fStopTime
= stopTime
;
294 fMaxDuration
= 3 * (fStopTime
- fStartTime
) / fDisplayWidth
;
299 itemizeTraceEntry(fTimeAnalysisEntry
);
302 public void itemizeTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
303 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
304 TimeChartEvent event
= null;
305 boolean hasNext
= true;
307 synchronized (timeAnalysisEntry
) {
308 while (hasNext
= iterator
.hasNext()) {
309 event
= (TimeChartEvent
) iterator
.next();
310 if (event
.getTime() + event
.getDuration() > fStartTime
&& event
.getTime() < fStopTime
&& event
.getDuration() > fMaxDuration
311 && event
.getNbEvents() > 1) {
317 if (event
.getItemizedEntry() == null) {
320 itemizeTraceEntry(event
.getItemizedEntry());
326 public void itemizeEvent(TimeChartEvent event
) {
327 synchronized (event
) {
328 if (event
.isItemizing()) {
331 event
.setItemizing(true);
333 TimeChartAnalysisEntry timeAnalysisEntry
= new TimeChartAnalysisEntry(fTimeAnalysisEntry
.getTrace(), (int) Math
.min(
334 event
.getNbEvents() + 1, fDisplayWidth
* 2));
335 synchronized (event
.getRankRangeList()) {
336 for (RankRange range
: event
.getRankRangeList()) {
337 timeAnalysisEntry
.setLastRank(range
.getFirstRank());
338 updateTraceEntry(timeAnalysisEntry
, range
.getLastRank() + 1, event
.getTime(), event
.getTime() + event
.getDuration());
341 event
.setItemizedEntry(timeAnalysisEntry
);
343 itemizeTraceEntry(timeAnalysisEntry
);
344 synchronized (event
) {
345 event
.setItemizing(false);
350 private void redecorate() {
351 synchronized (fDecorateThreads
) {
352 for (DecorateThread thread
: fDecorateThreads
) {
355 fDecorateThreads
.clear();
356 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
357 DecorateThread thread
= new DecorateThread(fTimeAnalysisEntries
.get(i
));
359 fDecorateThreads
.add(thread
);
364 private class DecorateThread
extends Thread
{
365 private volatile boolean interrupted
= false;
366 private final TimeChartAnalysisEntry fTimeAnalysisEntry
;
367 private final TimeChartDecorationProvider fDecorationProvider
;
368 private ITmfContext fContext
;
369 private int fCount
= 0;
371 private DecorateThread(TimeChartAnalysisEntry timeAnalysisEntry
) {
372 super("Decorate Thread:" + timeAnalysisEntry
.getName()); //$NON-NLS-1$
373 fTimeAnalysisEntry
= timeAnalysisEntry
;
374 fDecorationProvider
= fDecorationProviders
.get(timeAnalysisEntry
.getTrace());
379 resetTraceEntry(fTimeAnalysisEntry
);
381 decorateTraceEntry(fTimeAnalysisEntry
, null);
383 synchronized (fDecorateThreads
) {
384 fDecorateThreads
.remove(this);
386 if (fContext
!= null) {
391 public void resetTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
) {
392 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator();
393 TimeChartEvent event
= null;
394 boolean hasNext
= true;
395 while (!interrupted
&& hasNext
) {
396 synchronized (timeAnalysisEntry
) {
397 while (hasNext
= iterator
.hasNext()) {
398 event
= (TimeChartEvent
) iterator
.next();
403 // TODO possible concurrency problem here with ItemizeJob
404 event
.setColorSettingPriority(ColorSettingsManager
.PRIORITY_NONE
);
405 if (event
.getItemizedEntry() != null) {
406 resetTraceEntry(event
.getItemizedEntry());
412 public void decorateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry
, TimeChartEvent parentEvent
) {
413 // Set max duration high to ensure iterator does not consider
415 Iterator
<ITimeEvent
> iterator
= timeAnalysisEntry
.getTimeEventsIterator(0, Long
.MAX_VALUE
, Long
.MAX_VALUE
);
416 TimeChartEvent event
= null;
417 int entryPriority
= ColorSettingsManager
.PRIORITY_NONE
;
418 boolean entryIsBookmarked
= false;
419 boolean entryIsVisible
= false;
420 boolean entryIsSearchMatch
= false;
421 boolean hasNext
= true;
422 while (!interrupted
&& hasNext
) {
423 synchronized (timeAnalysisEntry
) {
424 while (hasNext
= iterator
.hasNext()) {
425 event
= (TimeChartEvent
) iterator
.next();
430 // TODO possible concurrency problem here with ItemizeJob
431 if (event
.getItemizedEntry() == null) {
432 decorateEvent(event
);
434 decorateTraceEntry(event
.getItemizedEntry(), event
);
436 entryPriority
= Math
.min(entryPriority
, event
.getColorSettingPriority());
437 entryIsBookmarked
|= event
.isBookmarked();
438 entryIsVisible
|= event
.isVisible();
439 entryIsSearchMatch
|= event
.isSearchMatch();
440 if (++fCount
% timeAnalysisEntry
.getTrace().getCacheSize() == 0) {
445 if (parentEvent
!= null) {
446 parentEvent
.setColorSettingPriority(entryPriority
);
447 parentEvent
.setIsBookmarked(entryIsBookmarked
);
448 parentEvent
.setIsVisible(entryIsVisible
);
449 parentEvent
.setIsSearchMatch(entryIsSearchMatch
);
453 public void decorateEvent(TimeChartEvent timeChartEvent
) {
454 // TODO possible concurrency problem here with ItemizeJob
455 TimeChartAnalysisEntry timeAnalysisEntry
= (TimeChartAnalysisEntry
) timeChartEvent
.getEntry();
456 ITmfTrace
<?
> trace
= timeAnalysisEntry
.getTrace();
457 int priority
= ColorSettingsManager
.PRIORITY_NONE
;
458 boolean isBookmarked
= false;
459 boolean isVisible
= false;
460 boolean isSearchMatch
= false;
461 synchronized (timeChartEvent
.getRankRangeList()) {
462 for (RankRange range
: timeChartEvent
.getRankRangeList()) {
466 if (fContext
== null || fContext
.getRank() != range
.getFirstRank()) {
467 if (fContext
!= null) {
470 fContext
= trace
.seekEvent(range
.getFirstRank());
471 fContext
.setRank(range
.getFirstRank());
477 long rank
= fContext
.getRank();
478 ITmfEvent event
= trace
.getNext(fContext
);
482 long eventTime
= event
.getTimestamp().normalize(0, -9).getValue();
483 if (eventTime
>= timeChartEvent
.getTime() && eventTime
<= timeChartEvent
.getTime() + timeChartEvent
.getDuration()) {
484 priority
= Math
.min(priority
, ColorSettingsManager
.getColorSettingPriority(event
));
486 isBookmarked
|= fDecorationProvider
.isBookmark(rank
);
487 isVisible
|= fDecorationProvider
.isVisible(event
);
488 isSearchMatch
|= fDecorationProvider
.isSearchMatch(event
);
489 if (fContext
.getRank() > range
.getLastRank()) {
495 timeChartEvent
.setColorSettingPriority(priority
);
496 timeChartEvent
.setIsBookmarked(isBookmarked
);
497 timeChartEvent
.setIsVisible(isVisible
);
498 timeChartEvent
.setIsSearchMatch(isSearchMatch
);
501 public void cancel() {
506 // ------------------------------------------------------------------------
508 // ------------------------------------------------------------------------
511 public void timeRangeUpdated(TimeGraphRangeUpdateEvent event
) {
512 fStartTime
= event
.getStartTime();
513 fStopTime
= event
.getEndTime();
514 itemize(fStartTime
, fStopTime
);
518 public void selectionChanged(TimeGraphSelectionEvent event
) {
519 ITimeGraphEntry timeAnalysisEntry
= null;
520 if (event
.getSelection() instanceof TimeChartAnalysisEntry
) {
521 timeAnalysisEntry
= event
.getSelection();
522 } else if (event
.getSelection() instanceof TimeChartEvent
) {
523 timeAnalysisEntry
= ((TimeChartEvent
) event
.getSelection()).getEntry();
525 if (timeAnalysisEntry
instanceof TimeChartAnalysisEntry
) {
526 broadcast(new TmfTraceSelectedSignal(this, ((TimeChartAnalysisEntry
) timeAnalysisEntry
).getTrace()));
531 public void timeSelected(TimeGraphTimeEvent event
) {
532 broadcast(new TmfTimeSynchSignal(this, new TmfTimestamp(event
.getTime(), TIMESTAMP_SCALE
)));
536 public void colorSettingsChanged(ColorSetting
[] colorSettings
) {
537 // Set presentation provider again to trigger re-creation of new color settings which are stored
538 // in the TimeGraphControl class
539 fViewer
.setTimeGraphProvider(fPresentationProvider
);
544 public void resourceChanged(IResourceChangeEvent event
) {
545 for (IMarkerDelta delta
: event
.findMarkerDeltas(IMarker
.BOOKMARK
, false)) {
546 for (TimeChartDecorationProvider provider
: fDecorationProviders
.values()) {
547 if (delta
.getResource().equals(provider
.getBookmarksFile())) {
548 if (delta
.getKind() == IResourceDelta
.CHANGED
&& delta
.getMarker().getAttribute(IMarker
.LOCATION
, -1) != -1) {
549 provider
.refreshBookmarks();
550 } else if (delta
.getKind() == IResourceDelta
.REMOVED
) {
551 provider
.refreshBookmarks();
560 public void filterApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
561 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
562 decorationProvider
.filterApplied(filter
);
567 public void searchApplied(ITmfFilter filter
, ITmfTrace
<?
> trace
) {
568 TimeChartDecorationProvider decorationProvider
= fDecorationProviders
.get(trace
);
569 decorationProvider
.searchApplied(filter
);
573 // ------------------------------------------------------------------------
575 // ------------------------------------------------------------------------
578 public void traceOpened(TmfTraceOpenedSignal signal
) {
579 if (fTimeAnalysisEntries
== null) {
582 final ITmfTrace
<?
> trace
= signal
.getTrace();
583 final IFile bookmarksFile
= signal
.getBookmarksFile();
584 final ITmfEventsFilterProvider eventsFilterProvider
= signal
.getEventsFilterProvider();
585 TimeChartAnalysisEntry timeAnalysisEntry
= null;
586 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
587 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
588 timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
592 if (timeAnalysisEntry
== null) {
593 timeAnalysisEntry
= new TimeChartAnalysisEntry(trace
, fDisplayWidth
* 2);
594 fTimeAnalysisEntries
.add(timeAnalysisEntry
);
595 fDecorationProviders
.put(trace
, new TimeChartDecorationProvider(bookmarksFile
));
596 Thread thread
= new ProcessTraceThread(timeAnalysisEntry
);
600 if (eventsFilterProvider
!= null) {
601 eventsFilterProvider
.addEventsFilterListener(this);
606 public void traceClosed(TmfTraceClosedSignal signal
) {
607 if (fTimeAnalysisEntries
== null) {
610 final ITmfTrace
<?
> trace
= signal
.getTrace();
611 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
612 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
613 fTimeAnalysisEntries
.remove(i
);
614 fDecorationProviders
.remove(trace
);
622 public void traceSelected(TmfTraceSelectedSignal signal
) {
623 if (signal
.getSource() != this && fTimeAnalysisEntries
!= null) {
624 ITmfTrace
<?
> trace
= signal
.getTrace();
625 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
626 if (fTimeAnalysisEntries
.get(i
).getTrace().equals(trace
)) {
627 fViewer
.setSelection(fTimeAnalysisEntries
.get(i
));
635 public void traceUpdated(TmfTraceUpdatedSignal signal
) {
636 if (fTimeAnalysisEntries
== null) {
639 final ITmfTrace
<?
> trace
= signal
.getTrace();
640 for (int i
= 0; i
< fTimeAnalysisEntries
.size(); i
++) {
641 TimeChartAnalysisEntry timeAnalysisEntry
= fTimeAnalysisEntries
.get(i
);
642 if (timeAnalysisEntry
.getTrace().equals(trace
)) {
643 updateTraceEntry(timeAnalysisEntry
, Long
.MAX_VALUE
, 0, Long
.MAX_VALUE
);
650 public void currentTimeUpdated(TmfTimeSynchSignal signal
) {
651 final long time
= signal
.getCurrentTime().normalize(0, TIMESTAMP_SCALE
).getValue();
652 Display
.getDefault().asyncExec(new Runnable() {
655 fViewer
.setSelectedTime(time
, true);