1 /*******************************************************************************
2 * Copyright (c) 2012, 2016 Ericsson, École Polytechnique de Montréal
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 * Bernd Hufmann - Updated signal handling
12 * Geneviève Bastien - Move code to provide base classes for time graph view
13 * Marc-Andre Laperle - Add time zone preference
14 * Geneviève Bastien - Add event links between entries
15 *******************************************************************************/
17 package org
.eclipse
.tracecompass
.tmf
.ui
.views
.timegraph
;
19 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
21 import java
.util
.ArrayList
;
22 import java
.util
.Collections
;
23 import java
.util
.Comparator
;
24 import java
.util
.HashMap
;
25 import java
.util
.LinkedHashSet
;
26 import java
.util
.List
;
29 import java
.util
.concurrent
.CopyOnWriteArrayList
;
30 import java
.util
.concurrent
.atomic
.AtomicInteger
;
31 import java
.util
.regex
.Matcher
;
32 import java
.util
.regex
.Pattern
;
34 import org
.eclipse
.core
.resources
.IFile
;
35 import org
.eclipse
.core
.resources
.IMarker
;
36 import org
.eclipse
.core
.resources
.IMarkerDelta
;
37 import org
.eclipse
.core
.resources
.IResource
;
38 import org
.eclipse
.core
.resources
.IResourceChangeEvent
;
39 import org
.eclipse
.core
.resources
.IResourceChangeListener
;
40 import org
.eclipse
.core
.resources
.IWorkspaceRunnable
;
41 import org
.eclipse
.core
.resources
.ResourcesPlugin
;
42 import org
.eclipse
.core
.runtime
.CoreException
;
43 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
44 import org
.eclipse
.core
.runtime
.NullProgressMonitor
;
45 import org
.eclipse
.jdt
.annotation
.NonNull
;
46 import org
.eclipse
.jdt
.annotation
.Nullable
;
47 import org
.eclipse
.jface
.action
.Action
;
48 import org
.eclipse
.jface
.action
.GroupMarker
;
49 import org
.eclipse
.jface
.action
.IAction
;
50 import org
.eclipse
.jface
.action
.IMenuListener
;
51 import org
.eclipse
.jface
.action
.IMenuManager
;
52 import org
.eclipse
.jface
.action
.IStatusLineManager
;
53 import org
.eclipse
.jface
.action
.IToolBarManager
;
54 import org
.eclipse
.jface
.action
.MenuManager
;
55 import org
.eclipse
.jface
.action
.Separator
;
56 import org
.eclipse
.jface
.commands
.ActionHandler
;
57 import org
.eclipse
.jface
.viewers
.AbstractTreeViewer
;
58 import org
.eclipse
.jface
.viewers
.ILabelProvider
;
59 import org
.eclipse
.jface
.viewers
.ILabelProviderListener
;
60 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
61 import org
.eclipse
.jface
.viewers
.ITableLabelProvider
;
62 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
63 import org
.eclipse
.jface
.viewers
.TreeSelection
;
64 import org
.eclipse
.jface
.viewers
.TreeViewer
;
65 import org
.eclipse
.jface
.viewers
.ViewerFilter
;
66 import org
.eclipse
.osgi
.util
.NLS
;
67 import org
.eclipse
.swt
.SWT
;
68 import org
.eclipse
.swt
.events
.MenuDetectEvent
;
69 import org
.eclipse
.swt
.events
.MenuDetectListener
;
70 import org
.eclipse
.swt
.events
.SelectionAdapter
;
71 import org
.eclipse
.swt
.events
.SelectionEvent
;
72 import org
.eclipse
.swt
.graphics
.Image
;
73 import org
.eclipse
.swt
.graphics
.Point
;
74 import org
.eclipse
.swt
.graphics
.RGBA
;
75 import org
.eclipse
.swt
.widgets
.Composite
;
76 import org
.eclipse
.swt
.widgets
.Display
;
77 import org
.eclipse
.swt
.widgets
.Menu
;
78 import org
.eclipse
.swt
.widgets
.Shell
;
79 import org
.eclipse
.swt
.widgets
.Tree
;
80 import org
.eclipse
.swt
.widgets
.TreeColumn
;
81 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Activator
;
82 import org
.eclipse
.tracecompass
.tmf
.core
.resources
.ITmfMarker
;
83 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSelectionRangeUpdatedSignal
;
84 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignalHandler
;
85 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTimestampFormatUpdateSignal
;
86 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceClosedSignal
;
87 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceOpenedSignal
;
88 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceSelectedSignal
;
89 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfWindowRangeUpdatedSignal
;
90 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfNanoTimestamp
;
91 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimeRange
;
92 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
93 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceAdapterManager
;
94 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceContext
;
95 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
96 import org
.eclipse
.tracecompass
.tmf
.ui
.TmfUiRefreshHandler
;
97 import org
.eclipse
.tracecompass
.tmf
.ui
.signal
.TmfTimeViewAlignmentInfo
;
98 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.ITmfTimeAligned
;
99 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.TmfView
;
100 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.ITimeGraphBookmarkListener
;
101 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.ITimeGraphContentProvider
;
102 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.ITimeGraphPresentationProvider2
;
103 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.ITimeGraphRangeListener
;
104 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.ITimeGraphSelectionListener
;
105 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.ITimeGraphTimeListener
;
106 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphBookmarkEvent
;
107 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphCombo
;
108 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphContentProvider
;
109 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphPresentationProvider
;
110 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphRangeUpdateEvent
;
111 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphTimeEvent
;
112 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphViewer
;
113 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ILinkEvent
;
114 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.IMarkerEvent
;
115 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.IMarkerEventSource
;
116 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
117 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
118 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.MarkerEvent
;
119 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.TimeGraphEntry
;
120 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.widgets
.TimeGraphControl
;
121 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.widgets
.Utils
.TimeFormat
;
122 import org
.eclipse
.ui
.IActionBars
;
123 import org
.eclipse
.ui
.IPartListener
;
124 import org
.eclipse
.ui
.IWorkbenchActionConstants
;
125 import org
.eclipse
.ui
.IWorkbenchPart
;
126 import org
.eclipse
.ui
.PlatformUI
;
127 import org
.eclipse
.ui
.actions
.ActionFactory
;
128 import org
.eclipse
.ui
.handlers
.IHandlerActivation
;
129 import org
.eclipse
.ui
.handlers
.IHandlerService
;
132 * An abstract view all time graph views can inherit
134 * This view contains either a time graph viewer, or a time graph combo which is
135 * divided between a tree viewer on the left and a time graph viewer on the right.
137 public abstract class AbstractTimeGraphView
extends TmfView
implements ITmfTimeAligned
, IResourceChangeListener
{
139 /** Constant indicating that all levels of the time graph should be expanded */
140 protected static final int ALL_LEVELS
= AbstractTreeViewer
.ALL_LEVELS
;
142 private static final Pattern RGBA_PATTERN
= Pattern
.compile("RGBA \\{(\\d+), (\\d+), (\\d+), (\\d+)\\}"); //$NON-NLS-1$
151 // ------------------------------------------------------------------------
153 // ------------------------------------------------------------------------
155 /** The timegraph wrapper */
156 private ITimeGraphWrapper fTimeGraphWrapper
;
158 private AtomicInteger fDirty
= new AtomicInteger();
160 private final Object fZoomThreadResultLock
= new Object();
162 /** The selected trace */
163 private ITmfTrace fTrace
;
165 /** The selected trace editor file*/
166 private IFile fEditorFile
;
168 /** The timegraph entry list */
169 private List
<TimeGraphEntry
> fEntryList
;
171 /** The trace to entry list hash map */
172 private final Map
<ITmfTrace
, List
<TimeGraphEntry
>> fEntryListMap
= new HashMap
<>();
174 /** The trace to filters hash map */
175 private final Map
<ITmfTrace
, @NonNull ViewerFilter
[]> fFiltersMap
= new HashMap
<>();
177 /** The trace to view context hash map */
178 private final Map
<ITmfTrace
, ViewContext
> fViewContext
= new HashMap
<>();
180 /** The trace to marker event sources hash map */
181 private final Map
<ITmfTrace
, List
<IMarkerEventSource
>> fMarkerEventSourcesMap
= new HashMap
<>();
183 /** The trace to build thread hash map */
184 private final Map
<ITmfTrace
, BuildThread
> fBuildThreadMap
= new HashMap
<>();
186 /** The start time */
187 private long fStartTime
= SWT
.DEFAULT
;
190 private long fEndTime
= SWT
.DEFAULT
;
192 /** The display width */
193 private final int fDisplayWidth
;
195 /** The zoom thread */
196 private ZoomThread fZoomThread
;
198 /** The next resource action */
199 private Action fNextResourceAction
;
201 /** The previous resource action */
202 private Action fPreviousResourceAction
;
204 /** A comparator class */
205 private Comparator
<ITimeGraphEntry
> fEntryComparator
= null;
207 /** The redraw state used to prevent unnecessary queuing of display runnables */
208 private State fRedrawState
= State
.IDLE
;
210 /** The redraw synchronization object */
211 private final Object fSyncObj
= new Object();
213 /** The presentation provider for this view */
214 private final TimeGraphPresentationProvider fPresentation
;
216 /** The tree column label array, or null if combo is not used */
217 private String
[] fColumns
;
219 private Comparator
<ITimeGraphEntry
>[] fColumnComparators
;
221 /** The tree label provider, or null if combo is not used */
222 private TreeLabelProvider fLabelProvider
= null;
224 /** The time graph content provider */
225 private @NonNull ITimeGraphContentProvider fTimeGraphContentProvider
= new TimeGraphContentProvider();
227 /** The relative weight of the sash, ignored if combo is not used */
228 private int[] fWeight
= { 1, 3 };
230 /** The filter column label array, or null if filter is not used */
231 private String
[] fFilterColumns
;
233 /** The pack done flag */
234 private boolean fPackDone
= false;
236 /** The filter content provider, or null if filter is not used */
237 private ITreeContentProvider fFilterContentProvider
;
239 /** The filter label provider, or null if filter is not used */
240 private TreeLabelProvider fFilterLabelProvider
;
242 private int fAutoExpandLevel
= ALL_LEVELS
;
244 /** The default column index for sorting */
245 private int fInitialSortColumn
= 0;
247 /** The default column index for sorting */
248 private int fCurrentSortColumn
= 0;
250 /** The current sort direction */
251 private int fSortDirection
= SWT
.DOWN
;
253 /** Flag to indicate to reveal selection */
254 private volatile boolean fIsRevealSelection
= false;
257 * Menu Manager for context-sensitive menu for time graph entries.
258 * This will be used on the tree viewer in case of the time graph combo
259 * or the on the namespace in case of a single time graph viewer.
261 private final @NonNull MenuManager fEntryMenuManager
= new MenuManager();
263 /** Time Graph View part listener */
264 private TimeGraphPartListener fPartListener
;
266 /** Action for the find command. There is only one for all Time Graph views */
267 private static final ShowFindDialogAction FIND_ACTION
= new ShowFindDialogAction();
269 /** The find action handler */
270 private static ActionHandler fFindActionHandler
;
272 /** The find handler activation */
273 private static IHandlerActivation fFindHandlerActivation
;
275 /** The find target to use */
276 private final FindTarget fFindTarget
;
278 // ------------------------------------------------------------------------
280 // ------------------------------------------------------------------------
282 private interface ITimeGraphWrapper
{
284 void setTimeGraphContentProvider(ITimeGraphContentProvider timeGraphContentProvider
);
286 void setTimeGraphPresentationProvider(TimeGraphPresentationProvider timeGraphPresentationProvider
);
288 TimeGraphViewer
getTimeGraphViewer();
290 void addSelectionListener(ITimeGraphSelectionListener listener
);
292 ISelectionProvider
getSelectionProvider();
296 boolean isDisposed();
300 void setInput(Object input
);
304 void setFilters(@NonNull ViewerFilter
[] filters
);
306 @NonNull ViewerFilter
[] getFilters();
312 void setAutoExpandLevel(int level
);
314 boolean getExpandedState(ITimeGraphEntry entry
);
316 void setExpandedState(ITimeGraphEntry entry
, boolean expanded
);
318 void setFilterColumns(String
[] columnNames
);
320 void setFilterContentProvider(ITreeContentProvider contentProvider
);
322 void setFilterLabelProvider(ITableLabelProvider labelProvider
);
324 IAction
getShowFilterDialogAction();
326 void performAlign(int offset
, int width
);
328 TmfTimeViewAlignmentInfo
getTimeViewAlignmentInfo();
330 int getAvailableWidth(int requestedOffset
);
332 ITimeGraphEntry
getSelection();
334 void setSelection(ITimeGraphEntry selection
);
336 void selectAndReveal(@NonNull ITimeGraphEntry selection
);
340 private class TimeGraphViewerWrapper
implements ITimeGraphWrapper
{
341 private TimeGraphViewer viewer
;
343 private TimeGraphViewerWrapper(Composite parent
, int style
) {
344 viewer
= new TimeGraphViewer(parent
, style
);
348 public void setTimeGraphContentProvider(ITimeGraphContentProvider timeGraphContentProvider
) {
349 viewer
.setTimeGraphContentProvider(timeGraphContentProvider
);
353 public void setTimeGraphPresentationProvider(TimeGraphPresentationProvider timeGraphPresentationProvider
) {
354 viewer
.setTimeGraphProvider(timeGraphPresentationProvider
);
358 public TimeGraphViewer
getTimeGraphViewer() {
363 public void addSelectionListener(ITimeGraphSelectionListener listener
) {
364 viewer
.addSelectionListener(listener
);
368 public ISelectionProvider
getSelectionProvider() {
369 return viewer
.getSelectionProvider();
373 public void setFocus() {
378 public boolean isDisposed() {
379 return viewer
.getControl().isDisposed();
383 public void setInput(Object input
) {
384 viewer
.setInput(input
);
388 public Object
getInput() {
389 return viewer
.getInput();
393 public void setFilterColumns(String
[] columnNames
) {
394 viewer
.setFilterColumns(columnNames
);
398 public void setFilterContentProvider(ITreeContentProvider contentProvider
) {
399 viewer
.setFilterContentProvider(contentProvider
);
403 public void setFilterLabelProvider(ITableLabelProvider labelProvider
) {
404 viewer
.setFilterLabelProvider(labelProvider
);
408 public void setFilters(@NonNull ViewerFilter
[] filters
) {
409 viewer
.setFilters(filters
);
413 public @NonNull ViewerFilter
[] getFilters() {
414 return viewer
.getFilters();
418 public IAction
getShowFilterDialogAction() {
419 return viewer
.getShowFilterDialogAction();
423 public void refresh() {
428 public void redraw() {
429 viewer
.getControl().redraw();
433 public void update() {
434 viewer
.getControl().update();
438 public void setAutoExpandLevel(int level
) {
439 viewer
.setAutoExpandLevel(level
);
443 public boolean getExpandedState(ITimeGraphEntry entry
) {
444 return viewer
.getExpandedState(entry
);
448 public void setExpandedState(ITimeGraphEntry entry
, boolean expanded
) {
449 viewer
.setExpandedState(entry
, expanded
);
453 public void performAlign(int offset
, int width
) {
454 viewer
.performAlign(offset
, width
);
458 public TmfTimeViewAlignmentInfo
getTimeViewAlignmentInfo() {
459 return viewer
.getTimeViewAlignmentInfo();
463 public int getAvailableWidth(int requestedOffset
) {
464 return viewer
.getAvailableWidth(requestedOffset
);
468 public ITimeGraphEntry
getSelection() {
469 return viewer
.getSelection();
473 public void setSelection(ITimeGraphEntry selection
) {
474 viewer
.setSelection(selection
);
478 public void selectAndReveal(@NonNull ITimeGraphEntry selection
) {
479 viewer
.selectAndReveal(selection
);
483 private class TimeGraphComboWrapper
implements ITimeGraphWrapper
{
484 private TimeGraphCombo combo
;
486 private TimeGraphComboWrapper(Composite parent
, int style
) {
487 combo
= new TimeGraphCombo(parent
, style
, fWeight
);
491 public void setTimeGraphContentProvider(ITimeGraphContentProvider timeGraphContentProvider
) {
492 combo
.setTimeGraphContentProvider(timeGraphContentProvider
);
496 public void setTimeGraphPresentationProvider(TimeGraphPresentationProvider timeGraphPresentationProvider
) {
497 combo
.setTimeGraphProvider(timeGraphPresentationProvider
);
501 public TimeGraphViewer
getTimeGraphViewer() {
502 return combo
.getTimeGraphViewer();
506 public void addSelectionListener(ITimeGraphSelectionListener listener
) {
507 combo
.addSelectionListener(listener
);
511 public ISelectionProvider
getSelectionProvider() {
512 return combo
.getTreeViewer();
516 public void setFocus() {
521 public boolean isDisposed() {
522 return combo
.isDisposed();
526 public void setInput(Object input
) {
527 combo
.setInput(input
);
531 public Object
getInput() {
532 return combo
.getInput();
536 public void setFilterColumns(String
[] columnNames
) {
537 combo
.setFilterColumns(columnNames
);
541 public void setFilterContentProvider(ITreeContentProvider contentProvider
) {
542 combo
.setFilterContentProvider(contentProvider
);
546 public void setFilterLabelProvider(ITableLabelProvider labelProvider
) {
547 combo
.setFilterLabelProvider(labelProvider
);
551 public void setFilters(@NonNull ViewerFilter
[] filters
) {
552 combo
.setFilters(filters
);
556 public @NonNull ViewerFilter
[] getFilters() {
557 return combo
.getFilters();
561 public IAction
getShowFilterDialogAction() {
562 return combo
.getShowFilterDialogAction();
566 public void refresh() {
571 public void redraw() {
576 public void update() {
581 public void setAutoExpandLevel(int level
) {
582 combo
.setAutoExpandLevel(level
);
586 public boolean getExpandedState(ITimeGraphEntry entry
) {
587 return combo
.getExpandedState(entry
);
591 public void setExpandedState(ITimeGraphEntry entry
, boolean expanded
) {
592 combo
.setExpandedState(entry
, expanded
);
595 TimeGraphCombo
getTimeGraphCombo() {
599 TreeViewer
getTreeViewer() {
600 return combo
.getTreeViewer();
604 public void performAlign(int offset
, int width
) {
605 combo
.performAlign(offset
, width
);
609 public TmfTimeViewAlignmentInfo
getTimeViewAlignmentInfo() {
610 return combo
.getTimeViewAlignmentInfo();
614 public int getAvailableWidth(int requestedOffset
) {
615 return combo
.getAvailableWidth(requestedOffset
);
619 public ITimeGraphEntry
getSelection() {
620 return combo
.getTimeGraphViewer().getSelection();
624 public void setSelection(ITimeGraphEntry selection
) {
625 combo
.setSelection(selection
);
629 public void selectAndReveal(@NonNull ITimeGraphEntry selection
) {
630 combo
.selectAndReveal(selection
);
635 * Base class to provide the labels for the tree viewer. Views extending
636 * this class typically need to override the getColumnText method if they
637 * have more than one column to display
639 protected static class TreeLabelProvider
implements ITableLabelProvider
, ILabelProvider
{
642 public void addListener(ILabelProviderListener listener
) {
646 public void dispose() {
650 public boolean isLabelProperty(Object element
, String property
) {
655 public void removeListener(ILabelProviderListener listener
) {
659 public Image
getColumnImage(Object element
, int columnIndex
) {
664 public String
getColumnText(Object element
, int columnIndex
) {
665 TimeGraphEntry entry
= (TimeGraphEntry
) element
;
666 if (columnIndex
== 0) {
667 return entry
.getName();
673 public Image
getImage(Object element
) {
678 public String
getText(Object element
) {
679 TimeGraphEntry entry
= (TimeGraphEntry
) element
;
680 return entry
.getName();
685 private class BuildThread
extends Thread
{
686 private final @NonNull ITmfTrace fBuildTrace
;
687 private final @NonNull ITmfTrace fParentTrace
;
688 private final @NonNull IProgressMonitor fMonitor
;
690 public BuildThread(final @NonNull ITmfTrace trace
, final @NonNull ITmfTrace parentTrace
, final String name
) {
691 super(name
+ " build"); //$NON-NLS-1$
693 fParentTrace
= parentTrace
;
694 fMonitor
= new NullProgressMonitor();
699 buildEventList(fBuildTrace
, fParentTrace
, fMonitor
);
700 synchronized (fBuildThreadMap
) {
701 fBuildThreadMap
.remove(fBuildTrace
);
705 public void cancel() {
706 fMonitor
.setCanceled(true);
714 protected abstract class ZoomThread
extends Thread
{
715 private final long fZoomStartTime
;
716 private final long fZoomEndTime
;
717 private final long fResolution
;
718 private final @NonNull IProgressMonitor fMonitor
;
730 public ZoomThread(long startTime
, long endTime
, long resolution
) {
731 super(AbstractTimeGraphView
.this.getName() + " zoom"); //$NON-NLS-1$
732 fZoomStartTime
= startTime
;
733 fZoomEndTime
= endTime
;
734 fResolution
= resolution
;
735 fMonitor
= new NullProgressMonitor();
739 * @return the zoom start time
741 public long getZoomStartTime() {
742 return fZoomStartTime
;
746 * @return the zoom end time
748 public long getZoomEndTime() {
753 * @return the resolution
755 public long getResolution() {
760 * @return the monitor
762 public @NonNull IProgressMonitor
getMonitor() {
767 * Cancel the zoom thread
769 public void cancel() {
770 fMonitor
.setCanceled(true);
774 public final void run() {
776 fDirty
.decrementAndGet();
780 * Applies the results of the ZoomThread calculations.
782 * Note: This method makes sure that only the results of the last
783 * created ZoomThread are applied.
786 * the code to run in order to apply the results
789 protected void applyResults(Runnable runnable
) {
790 synchronized (fZoomThreadResultLock
) {
791 if (this == fZoomThread
) {
798 * Run the zoom operation.
801 public abstract void doRun();
804 private class ZoomThreadByEntry
extends ZoomThread
{
805 private final @NonNull List
<TimeGraphEntry
> fZoomEntryList
;
807 public ZoomThreadByEntry(@NonNull List
<TimeGraphEntry
> entryList
, long startTime
, long endTime
, long resolution
) {
808 super(startTime
, endTime
, resolution
);
809 fZoomEntryList
= entryList
;
813 public void doRun() {
814 for (TimeGraphEntry entry
: fZoomEntryList
) {
815 if (getMonitor().isCanceled()) {
821 zoom(entry
, getMonitor());
823 /* Refresh the arrows when zooming */
824 List
<ILinkEvent
> events
= getLinkList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor());
825 /* Refresh the view-specific markers when zooming */
826 List
<IMarkerEvent
> markers
= new ArrayList
<>(getViewMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()));
827 /* Refresh the trace-specific markers when zooming */
828 markers
.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()));
830 if (events
!= null) {
831 fTimeGraphWrapper
.getTimeGraphViewer().setLinks(events
);
833 fTimeGraphWrapper
.getTimeGraphViewer().setMarkers(markers
);
838 private void zoom(@NonNull TimeGraphEntry entry
, @NonNull IProgressMonitor monitor
) {
839 if (getZoomStartTime() <= fStartTime
&& getZoomEndTime() >= fEndTime
) {
841 entry
.setZoomedEventList(null);
844 List
<ITimeEvent
> zoomedEventList
= getEventList(entry
, getZoomStartTime(), getZoomEndTime(), getResolution(), monitor
);
845 if (zoomedEventList
!= null) {
847 entry
.setZoomedEventList(zoomedEventList
);
852 for (ITimeGraphEntry child
: entry
.getChildren()) {
853 if (monitor
.isCanceled()) {
856 if (child
instanceof TimeGraphEntry
) {
857 zoom((TimeGraphEntry
) child
, monitor
);
864 // ------------------------------------------------------------------------
866 // ------------------------------------------------------------------------
869 * Constructs a time graph view that contains either a time graph viewer or
870 * a time graph combo.
872 * By default, the view uses a time graph viewer. To use a time graph combo,
873 * the subclass constructor must call {@link #setTreeColumns(String[])} and
874 * {@link #setTreeLabelProvider(TreeLabelProvider)}.
879 * The presentation provider
881 public AbstractTimeGraphView(String id
, TimeGraphPresentationProvider pres
) {
883 fPresentation
= pres
;
884 fDisplayWidth
= Display
.getDefault().getBounds().width
;
885 fFindTarget
= new FindTarget();
888 // ------------------------------------------------------------------------
889 // Getters and setters
890 // ------------------------------------------------------------------------
893 * Getter for the time graph combo
895 * @return The time graph combo, or null if combo is not used
897 protected TimeGraphCombo
getTimeGraphCombo() {
898 if (fTimeGraphWrapper
instanceof TimeGraphComboWrapper
) {
899 return ((TimeGraphComboWrapper
) fTimeGraphWrapper
).getTimeGraphCombo();
905 * Getter for the time graph viewer
907 * @return The time graph viewer
909 protected TimeGraphViewer
getTimeGraphViewer() {
910 return fTimeGraphWrapper
.getTimeGraphViewer();
914 * Getter for the presentation provider
916 * @return The time graph presentation provider
918 protected ITimeGraphPresentationProvider2
getPresentationProvider() {
919 return fPresentation
;
923 * Sets the tree column labels.
925 * This should be called from the constructor.
928 * The array of tree column labels
930 protected void setTreeColumns(final String
[] columns
) {
931 setTreeColumns(columns
, null, 0);
935 * Sets the tree column labels.
937 * This should be called from the constructor.
940 * The array of tree column labels
942 * An array of column comparators for sorting of columns when
943 * clicking on column header
944 * @param initialSortColumn
945 * Index of column to sort initially
948 protected void setTreeColumns(final String
[] columns
, final Comparator
<ITimeGraphEntry
>[] comparators
, int initialSortColumn
) {
949 checkPartNotCreated();
951 fColumnComparators
= comparators
;
952 fInitialSortColumn
= initialSortColumn
;
956 * Sets the tree label provider.
958 * This should be called from the constructor.
961 * The tree label provider
963 protected void setTreeLabelProvider(final TreeLabelProvider tlp
) {
964 checkPartNotCreated();
965 fLabelProvider
= tlp
;
969 * Sets the time graph content provider.
971 * This should be called from the constructor.
974 * The time graph content provider
977 protected void setTimeGraphContentProvider(final @NonNull ITimeGraphContentProvider tgcp
) {
978 checkPartNotCreated();
979 fTimeGraphContentProvider
= tgcp
;
983 * Sets the relative weight of each part of the time graph combo.
985 * This should be called from the constructor.
988 * The array (length 2) of relative weights of each part of the combo
990 protected void setWeight(final int[] weights
) {
991 checkPartNotCreated();
996 * Sets the filter column labels.
998 * This should be called from the constructor.
1000 * @param filterColumns
1001 * The array of filter column labels
1003 protected void setFilterColumns(final String
[] filterColumns
) {
1004 checkPartNotCreated();
1005 fFilterColumns
= filterColumns
;
1009 * Sets the filter content provider.
1011 * This should be called from the constructor.
1013 * @param contentProvider
1014 * The filter content provider
1017 protected void setFilterContentProvider(final ITreeContentProvider contentProvider
) {
1018 checkPartNotCreated();
1019 fFilterContentProvider
= contentProvider
;
1023 * Sets the filter label provider.
1025 * This should be called from the constructor.
1027 * @param labelProvider
1028 * The filter label provider
1030 protected void setFilterLabelProvider(final TreeLabelProvider labelProvider
) {
1031 checkPartNotCreated();
1032 fFilterLabelProvider
= labelProvider
;
1035 private void checkPartNotCreated() {
1036 if (getParentComposite() != null) {
1037 throw new IllegalStateException("This method must be called before createPartControl."); //$NON-NLS-1$
1042 * Gets the display width
1044 * @return the display width
1046 protected int getDisplayWidth() {
1047 return fDisplayWidth
;
1051 * Gets the comparator for the entries
1053 * @return The entry comparator
1055 protected Comparator
<ITimeGraphEntry
> getEntryComparator() {
1056 return fEntryComparator
;
1060 * Sets the comparator class for the entries.
1062 * This comparator will apply recursively to entries that implement
1063 * {@link TimeGraphEntry#sortChildren(Comparator)}.
1066 * A comparator object
1068 protected void setEntryComparator(final Comparator
<ITimeGraphEntry
> comparator
) {
1069 fEntryComparator
= comparator
;
1073 * Gets the trace displayed in the view
1077 protected ITmfTrace
getTrace() {
1082 * Gets the start time
1084 * @return The start time
1086 protected long getStartTime() {
1091 * Sets the start time
1096 protected void setStartTime(long time
) {
1103 * @return The end time
1105 protected long getEndTime() {
1115 protected void setEndTime(long time
) {
1120 * Sets the auto-expand level to be used for the input of the view. The
1121 * value 0 means that there is no auto-expand; 1 means that top-level
1122 * elements are expanded, but not their children; 2 means that top-level
1123 * elements are expanded, and their children, but not grand-children; and so
1126 * The value {@link #ALL_LEVELS} means that all subtrees should be expanded.
1130 * non-negative level, or <code>ALL_LEVELS</code> to expand all
1131 * levels of the tree
1133 protected void setAutoExpandLevel(int level
) {
1134 fAutoExpandLevel
= level
;
1135 ITimeGraphWrapper tgWrapper
= fTimeGraphWrapper
;
1136 if (tgWrapper
!= null) {
1137 tgWrapper
.setAutoExpandLevel(level
);
1142 * Gets the entry list for a trace
1147 * @return the entry list map
1149 protected List
<TimeGraphEntry
> getEntryList(ITmfTrace trace
) {
1150 synchronized (fEntryListMap
) {
1151 return fEntryListMap
.get(trace
);
1156 * Adds a trace entry list to the entry list map
1161 * the list of time graph entries
1163 protected void putEntryList(ITmfTrace trace
, List
<TimeGraphEntry
> list
) {
1164 synchronized (fEntryListMap
) {
1165 fEntryListMap
.put(trace
, new CopyOnWriteArrayList
<>(list
));
1170 * Adds a list of entries to a trace's entry list
1175 * the list of time graph entries to add
1177 protected void addToEntryList(ITmfTrace trace
, List
<TimeGraphEntry
> list
) {
1178 synchronized (fEntryListMap
) {
1179 List
<TimeGraphEntry
> entryList
= fEntryListMap
.get(trace
);
1180 if (entryList
== null) {
1181 fEntryListMap
.put(trace
, new CopyOnWriteArrayList
<>(list
));
1183 entryList
.addAll(list
);
1189 * Removes a list of entries from a trace's entry list
1194 * the list of time graph entries to remove
1196 protected void removeFromEntryList(ITmfTrace trace
, List
<TimeGraphEntry
> list
) {
1197 synchronized (fEntryListMap
) {
1198 List
<TimeGraphEntry
> entryList
= fEntryListMap
.get(trace
);
1199 if (entryList
!= null) {
1200 entryList
.removeAll(list
);
1206 * Text for the "next" button
1208 * @return The "next" button text
1210 protected String
getNextText() {
1211 return Messages
.AbstractTimeGraphtView_NextText
;
1215 * Tooltip for the "next" button
1217 * @return Tooltip for the "next" button
1219 protected String
getNextTooltip() {
1220 return Messages
.AbstractTimeGraphView_NextTooltip
;
1224 * Text for the "Previous" button
1226 * @return The "Previous" button text
1228 protected String
getPrevText() {
1229 return Messages
.AbstractTimeGraphView_PreviousText
;
1233 * Tooltip for the "previous" button
1235 * @return Tooltip for the "previous" button
1237 protected String
getPrevTooltip() {
1238 return Messages
.AbstractTimeGraphView_PreviousTooltip
;
1242 FindTarget
getFindTarget() {
1246 // ------------------------------------------------------------------------
1248 // ------------------------------------------------------------------------
1251 public void createPartControl(Composite parent
) {
1252 super.createPartControl(parent
);
1253 if (fColumns
== null || fLabelProvider
== null) {
1254 fTimeGraphWrapper
= new TimeGraphViewerWrapper(parent
, SWT
.NONE
);
1256 TimeGraphComboWrapper wrapper
= new TimeGraphComboWrapper(parent
, SWT
.NONE
);
1257 fTimeGraphWrapper
= wrapper
;
1258 TimeGraphCombo combo
= wrapper
.getTimeGraphCombo();
1259 combo
.setTreeContentProvider(fTimeGraphContentProvider
);
1260 combo
.setTreeLabelProvider(fLabelProvider
);
1261 combo
.setTreeColumns(fColumns
);
1262 if (fColumnComparators
!= null) {
1263 createColumnSelectionListener(combo
.getTreeViewer());
1265 // Add double click listener to tree viewer
1266 createDoubleClickListener(combo
.getTreeViewer());
1268 fTimeGraphWrapper
.setTimeGraphContentProvider(fTimeGraphContentProvider
);
1269 fTimeGraphWrapper
.setFilterContentProvider(fFilterContentProvider
!= null ? fFilterContentProvider
: fTimeGraphContentProvider
);
1270 fTimeGraphWrapper
.setFilterLabelProvider(fFilterLabelProvider
);
1271 fTimeGraphWrapper
.setFilterColumns(fFilterColumns
);
1273 fTimeGraphWrapper
.setTimeGraphPresentationProvider(fPresentation
);
1274 fTimeGraphWrapper
.setAutoExpandLevel(fAutoExpandLevel
);
1276 fTimeGraphWrapper
.getTimeGraphViewer().addRangeListener(new ITimeGraphRangeListener() {
1278 public void timeRangeUpdated(TimeGraphRangeUpdateEvent event
) {
1279 final long startTime
= event
.getStartTime();
1280 final long endTime
= event
.getEndTime();
1281 TmfTimeRange range
= new TmfTimeRange(new TmfNanoTimestamp(startTime
), new TmfNanoTimestamp(endTime
));
1282 broadcast(new TmfWindowRangeUpdatedSignal(AbstractTimeGraphView
.this, range
));
1283 startZoomThread(startTime
, endTime
);
1287 fTimeGraphWrapper
.getTimeGraphViewer().addTimeListener(new ITimeGraphTimeListener() {
1289 public void timeSelected(TimeGraphTimeEvent event
) {
1290 TmfNanoTimestamp startTime
= new TmfNanoTimestamp(event
.getBeginTime());
1291 TmfNanoTimestamp endTime
= new TmfNanoTimestamp(event
.getEndTime());
1292 broadcast(new TmfSelectionRangeUpdatedSignal(AbstractTimeGraphView
.this, startTime
, endTime
));
1296 fTimeGraphWrapper
.getTimeGraphViewer().addBookmarkListener(new ITimeGraphBookmarkListener() {
1298 public void bookmarkAdded(final TimeGraphBookmarkEvent event
) {
1300 ResourcesPlugin
.getWorkspace().run(new IWorkspaceRunnable() {
1302 public void run(IProgressMonitor monitor
) throws CoreException
{
1303 IMarkerEvent bookmark
= event
.getBookmark();
1304 IMarker marker
= fEditorFile
.createMarker(IMarker
.BOOKMARK
);
1305 marker
.setAttribute(IMarker
.MESSAGE
, bookmark
.getLabel());
1306 marker
.setAttribute(ITmfMarker
.MARKER_TIME
, Long
.toString(bookmark
.getTime()));
1307 if (bookmark
.getDuration() > 0) {
1308 marker
.setAttribute(ITmfMarker
.MARKER_DURATION
, Long
.toString(bookmark
.getDuration()));
1309 marker
.setAttribute(IMarker
.LOCATION
,
1310 NLS
.bind(org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Messages
.TmfMarker_LocationTimeRange
,
1311 new TmfNanoTimestamp(bookmark
.getTime()),
1312 new TmfNanoTimestamp(bookmark
.getTime() + bookmark
.getDuration())));
1314 marker
.setAttribute(IMarker
.LOCATION
,
1315 NLS
.bind(org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Messages
.TmfMarker_LocationTime
,
1316 new TmfNanoTimestamp(bookmark
.getTime())));
1318 marker
.setAttribute(ITmfMarker
.MARKER_COLOR
, bookmark
.getColor().toString());
1321 } catch (CoreException e
) {
1322 Activator
.getDefault().logError(e
.getMessage());
1327 public void bookmarkRemoved(TimeGraphBookmarkEvent event
) {
1329 IMarkerEvent bookmark
= event
.getBookmark();
1330 IMarker
[] markers
= fEditorFile
.findMarkers(IMarker
.BOOKMARK
, false, IResource
.DEPTH_ZERO
);
1331 for (IMarker marker
: markers
) {
1332 if (bookmark
.getLabel().equals(marker
.getAttribute(IMarker
.MESSAGE
)) &&
1333 Long
.toString(bookmark
.getTime()).equals(marker
.getAttribute(ITmfMarker
.MARKER_TIME
, (String
) null)) &&
1334 Long
.toString(bookmark
.getDuration()).equals(marker
.getAttribute(ITmfMarker
.MARKER_DURATION
, Long
.toString(0))) &&
1335 bookmark
.getColor().toString().equals(marker
.getAttribute(ITmfMarker
.MARKER_COLOR
))) {
1340 } catch (CoreException e
) {
1341 Activator
.getDefault().logError(e
.getMessage());
1346 fTimeGraphWrapper
.getTimeGraphViewer().setTimeFormat(TimeFormat
.CALENDAR
);
1348 IStatusLineManager statusLineManager
= getViewSite().getActionBars().getStatusLineManager();
1349 fTimeGraphWrapper
.getTimeGraphViewer().getTimeGraphControl().setStatusLineManager(statusLineManager
);
1351 // View Action Handling
1353 contributeToActionBars();
1355 ITmfTrace trace
= TmfTraceManager
.getInstance().getActiveTrace();
1356 if (trace
!= null) {
1357 traceSelected(new TmfTraceSelectedSignal(this, trace
));
1360 // make selection available to other views
1361 getSite().setSelectionProvider(fTimeGraphWrapper
.getSelectionProvider());
1363 ResourcesPlugin
.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent
.POST_CHANGE
);
1365 createContextMenu();
1366 fPartListener
= new TimeGraphPartListener();
1367 getSite().getPage().addPartListener(fPartListener
);
1371 public void setFocus() {
1372 fTimeGraphWrapper
.setFocus();
1376 public void dispose() {
1378 ResourcesPlugin
.getWorkspace().removeResourceChangeListener(this);
1379 getSite().getPage().removePartListener(fPartListener
);
1386 public void resourceChanged(final IResourceChangeEvent event
) {
1387 for (final IMarkerDelta delta
: event
.findMarkerDeltas(IMarker
.BOOKMARK
, false)) {
1388 if (delta
.getResource().equals(fEditorFile
)) {
1389 fTimeGraphWrapper
.getTimeGraphViewer().setBookmarks(refreshBookmarks(fEditorFile
));
1396 private static List
<IMarkerEvent
> refreshBookmarks(final IFile editorFile
) {
1397 List
<IMarkerEvent
> bookmarks
= new ArrayList
<>();
1398 if (editorFile
== null || !editorFile
.exists()) {
1402 IMarker
[] markers
= editorFile
.findMarkers(IMarker
.BOOKMARK
, false, IResource
.DEPTH_ZERO
);
1403 for (IMarker marker
: markers
) {
1404 String label
= marker
.getAttribute(IMarker
.MESSAGE
, (String
) null);
1405 String time
= marker
.getAttribute(ITmfMarker
.MARKER_TIME
, (String
) null);
1406 String duration
= marker
.getAttribute(ITmfMarker
.MARKER_DURATION
, Long
.toString(0));
1407 String rgba
= marker
.getAttribute(ITmfMarker
.MARKER_COLOR
, (String
) null);
1408 if (label
!= null && time
!= null && rgba
!= null) {
1409 Matcher matcher
= RGBA_PATTERN
.matcher(rgba
);
1410 if (matcher
.matches()) {
1412 int red
= Integer
.valueOf(matcher
.group(1));
1413 int green
= Integer
.valueOf(matcher
.group(2));
1414 int blue
= Integer
.valueOf(matcher
.group(3));
1415 int alpha
= Integer
.valueOf(matcher
.group(4));
1416 RGBA color
= new RGBA(red
, green
, blue
, alpha
);
1417 bookmarks
.add(new MarkerEvent(null, Long
.valueOf(time
), Long
.valueOf(duration
), IMarkerEvent
.BOOKMARKS
, color
, label
, true));
1418 } catch (NumberFormatException e
) {
1419 Activator
.getDefault().logError(e
.getMessage());
1424 } catch (CoreException e
) {
1425 Activator
.getDefault().logError(e
.getMessage());
1432 // ------------------------------------------------------------------------
1434 // ------------------------------------------------------------------------
1437 * Handler for the trace opened signal.
1440 * The incoming signal
1443 public void traceOpened(TmfTraceOpenedSignal signal
) {
1444 loadTrace(signal
.getTrace());
1448 * Handler for the trace selected signal
1451 * The incoming signal
1454 public void traceSelected(final TmfTraceSelectedSignal signal
) {
1455 if (signal
.getTrace() == fTrace
) {
1458 loadTrace(signal
.getTrace());
1462 * Trace is closed: clear the data structures and the view
1465 * the signal received
1468 public void traceClosed(final TmfTraceClosedSignal signal
) {
1469 synchronized (fBuildThreadMap
) {
1470 for (ITmfTrace trace
: getTracesToBuild(signal
.getTrace())) {
1471 BuildThread buildThread
= fBuildThreadMap
.remove(trace
);
1472 if (buildThread
!= null) {
1473 buildThread
.cancel();
1477 fMarkerEventSourcesMap
.remove(signal
.getTrace());
1478 synchronized (fEntryListMap
) {
1479 fEntryListMap
.remove(signal
.getTrace());
1481 fFiltersMap
.remove(signal
.getTrace());
1482 fViewContext
.remove(signal
.getTrace());
1483 if (signal
.getTrace() == fTrace
) {
1486 fStartTime
= SWT
.DEFAULT
;
1487 fEndTime
= SWT
.DEFAULT
;
1488 if (fZoomThread
!= null) {
1489 fZoomThread
.cancel();
1497 * Handler for the selection range signal.
1500 * The signal that's received
1504 public void selectionRangeUpdated(final TmfSelectionRangeUpdatedSignal signal
) {
1505 if (signal
.getSource() == this || fTrace
== null) {
1508 final long beginTime
= signal
.getBeginTime().toNanos();
1509 final long endTime
= signal
.getEndTime().toNanos();
1511 Display
.getDefault().asyncExec(new Runnable() {
1514 if (fTimeGraphWrapper
.isDisposed()) {
1517 if (beginTime
== endTime
) {
1518 fTimeGraphWrapper
.getTimeGraphViewer().setSelectedTime(beginTime
, true);
1520 fTimeGraphWrapper
.getTimeGraphViewer().setSelectionRange(beginTime
, endTime
, true);
1522 synchingToTime(fTimeGraphWrapper
.getTimeGraphViewer().getSelectionBegin());
1528 * Handler for the window range signal.
1531 * The signal that's received
1535 public void windowRangeUpdated(final TmfWindowRangeUpdatedSignal signal
) {
1536 if (signal
.getSource() == this || fTrace
== null) {
1539 if (signal
.getCurrentRange().getIntersection(fTrace
.getTimeRange()) == null) {
1542 final long startTime
= signal
.getCurrentRange().getStartTime().toNanos();
1543 final long endTime
= signal
.getCurrentRange().getEndTime().toNanos();
1544 Display
.getDefault().asyncExec(new Runnable() {
1547 if (fTimeGraphWrapper
.isDisposed()) {
1550 fTimeGraphWrapper
.getTimeGraphViewer().setStartFinishTime(startTime
, endTime
);
1551 startZoomThread(startTime
, endTime
);
1557 * @param signal the format of the timestamps was updated.
1560 public void updateTimeFormat( final TmfTimestampFormatUpdateSignal signal
){
1561 fTimeGraphWrapper
.refresh();
1564 // ------------------------------------------------------------------------
1566 // ------------------------------------------------------------------------
1568 private void loadTrace(final ITmfTrace trace
) {
1569 if (fZoomThread
!= null) {
1570 fZoomThread
.cancel();
1573 if (fTrace
!= null) {
1574 /* save the filters of the previous trace */
1575 fFiltersMap
.put(fTrace
, fTimeGraphWrapper
.getFilters());
1576 fViewContext
.put(fTrace
, new ViewContext(fCurrentSortColumn
, fSortDirection
, fTimeGraphWrapper
.getSelection()));
1579 restoreViewContext();
1580 fEditorFile
= TmfTraceManager
.getInstance().getTraceEditorFile(trace
);
1581 synchronized (fEntryListMap
) {
1582 fEntryList
= fEntryListMap
.get(fTrace
);
1583 if (fEntryList
== null) {
1586 fStartTime
= fTrace
.getStartTime().toNanos();
1587 fEndTime
= fTrace
.getEndTime().toNanos();
1594 * Forces a rebuild of the entries list, even if entries already exist for this trace
1596 protected void rebuild() {
1597 setStartTime(Long
.MAX_VALUE
);
1598 setEndTime(Long
.MIN_VALUE
);
1600 ITmfTrace viewTrace
= fTrace
;
1601 if (viewTrace
== null) {
1604 List
<IMarkerEventSource
> markerEventSources
= new ArrayList
<>();
1605 synchronized (fBuildThreadMap
) {
1606 for (ITmfTrace trace
: getTracesToBuild(viewTrace
)) {
1607 if (trace
== null) {
1610 markerEventSources
.addAll(TmfTraceAdapterManager
.getAdapters(trace
, IMarkerEventSource
.class));
1611 BuildThread buildThread
= new BuildThread(trace
, viewTrace
, getName());
1612 fBuildThreadMap
.put(trace
, buildThread
);
1613 buildThread
.start();
1616 fMarkerEventSourcesMap
.put(viewTrace
, markerEventSources
);
1620 * Method called when synching to a given timestamp. Inheriting classes can
1621 * perform actions here to update the view at the given timestamp.
1624 * The currently selected time
1626 protected void synchingToTime(long time
) {
1631 * Return the list of traces whose data or analysis results will be used to
1632 * populate the view. By default, if the trace is an experiment, the traces
1633 * under it will be returned, otherwise, the trace itself is returned.
1635 * A build thread will be started for each trace returned by this method,
1636 * some of which may receive events in live streaming mode.
1639 * The trace associated with this view
1640 * @return List of traces with data to display
1642 protected @NonNull Iterable
<ITmfTrace
> getTracesToBuild(@NonNull ITmfTrace trace
) {
1643 return TmfTraceManager
.getTraceSet(trace
);
1647 * Build the entries list to show in this time graph
1649 * Called from the BuildThread
1652 * The trace being built
1653 * @param parentTrace
1654 * The parent of the trace set, or the trace itself
1656 * The progress monitor object
1658 protected abstract void buildEventList(@NonNull ITmfTrace trace
, @NonNull ITmfTrace parentTrace
, @NonNull IProgressMonitor monitor
);
1661 * Gets the list of event for an entry in a given timerange
1664 * The entry to get events for
1666 * Start of the time range
1668 * End of the time range
1672 * The progress monitor object
1673 * @return The list of events for the entry
1675 protected abstract @Nullable List
<@NonNull ITimeEvent
> getEventList(@NonNull TimeGraphEntry entry
,
1676 long startTime
, long endTime
, long resolution
,
1677 @NonNull IProgressMonitor monitor
);
1680 * Gets the list of links (displayed as arrows) for a trace in a given
1681 * timerange. Default implementation returns an empty list.
1684 * Start of the time range
1686 * End of the time range
1690 * The progress monitor object
1691 * @return The list of link events
1693 protected @Nullable List
<@NonNull ILinkEvent
> getLinkList(long startTime
, long endTime
,
1694 long resolution
, @NonNull IProgressMonitor monitor
) {
1695 return new ArrayList
<>();
1699 * Gets the list of view-specific marker categories. Default implementation
1700 * returns an empty list.
1702 * @return The list of marker categories
1705 protected @NonNull List
<String
> getViewMarkerCategories() {
1706 return new ArrayList
<>();
1710 * Gets the list of view-specific markers for a trace in a given time range.
1711 * Default implementation returns an empty list.
1714 * Start of the time range
1716 * End of the time range
1720 * The progress monitor object
1721 * @return The list of marker events
1724 protected @NonNull List
<IMarkerEvent
> getViewMarkerList(long startTime
, long endTime
,
1725 long resolution
, @NonNull IProgressMonitor monitor
) {
1726 return new ArrayList
<>();
1730 * Gets the list of trace-specific markers for a trace in a given time range.
1733 * Start of the time range
1735 * End of the time range
1739 * The progress monitor object
1740 * @return The list of marker events
1743 protected @NonNull List
<IMarkerEvent
> getTraceMarkerList(long startTime
, long endTime
,
1744 long resolution
, @NonNull IProgressMonitor monitor
) {
1745 List
<IMarkerEvent
> markers
= new ArrayList
<>();
1746 for (IMarkerEventSource markerEventSource
: getMarkerEventSources(fTrace
)) {
1747 for (String category
: markerEventSource
.getMarkerCategories()) {
1748 if (monitor
.isCanceled()) {
1751 markers
.addAll(markerEventSource
.getMarkerList(category
, startTime
, endTime
, resolution
, monitor
));
1758 * Get the list of current marker categories.
1760 * @return The list of marker categories
1763 private @NonNull List
<String
> getMarkerCategories() {
1764 Set
<String
> categories
= new LinkedHashSet
<>(getViewMarkerCategories());
1765 for (IMarkerEventSource markerEventSource
: getMarkerEventSources(fTrace
)) {
1766 categories
.addAll(markerEventSource
.getMarkerCategories());
1768 return new ArrayList
<>(categories
);
1772 * Gets the list of marker event sources for a given trace.
1776 * @return The list of marker event sources
1779 private @NonNull List
<IMarkerEventSource
> getMarkerEventSources(ITmfTrace trace
) {
1780 List
<IMarkerEventSource
> markerEventSources
= fMarkerEventSourcesMap
.get(trace
);
1781 if (markerEventSources
== null) {
1782 markerEventSources
= Collections
.emptyList();
1784 return markerEventSources
;
1788 * Refresh the display
1790 protected void refresh() {
1791 final boolean zoomThread
= Thread
.currentThread() instanceof ZoomThread
;
1792 TmfUiRefreshHandler
.getInstance().queueUpdate(this, new Runnable() {
1795 if (fTimeGraphWrapper
.isDisposed()) {
1798 fDirty
.incrementAndGet();
1800 boolean hasEntries
= false;
1801 synchronized (fEntryListMap
) {
1802 fEntryList
= fEntryListMap
.get(fTrace
);
1803 if (fEntryList
== null) {
1804 fEntryList
= new CopyOnWriteArrayList
<>();
1805 } else if (fEntryComparator
!= null) {
1806 List
<TimeGraphEntry
> list
= new ArrayList
<>(fEntryList
);
1807 Collections
.sort(list
, fEntryComparator
);
1808 for (ITimeGraphEntry entry
: list
) {
1809 sortChildren(entry
, fEntryComparator
);
1812 fEntryList
.addAll(list
);
1814 hasEntries
= !fEntryList
.isEmpty();
1816 boolean inputChanged
= fEntryList
!= fTimeGraphWrapper
.getInput();
1817 TimeGraphCombo combo
= getTimeGraphCombo();
1819 // Set redraw to false to only draw once
1820 if (combo
!= null) {
1821 combo
.getTreeViewer().getTree().setRedraw(false);
1823 getTimeGraphViewer().getTimeGraphControl().setRedraw(false);
1825 fTimeGraphWrapper
.setInput(fEntryList
);
1826 /* restore the previously saved filters, if any */
1827 fTimeGraphWrapper
.setFilters(fFiltersMap
.get(fTrace
));
1828 fTimeGraphWrapper
.getTimeGraphViewer().setLinks(null);
1829 fTimeGraphWrapper
.getTimeGraphViewer().setBookmarks(refreshBookmarks(fEditorFile
));
1830 fTimeGraphWrapper
.getTimeGraphViewer().setMarkerCategories(getMarkerCategories());
1831 fTimeGraphWrapper
.getTimeGraphViewer().setMarkers(null);
1834 fTimeGraphWrapper
.refresh();
1837 if (fIsRevealSelection
) {
1838 fIsRevealSelection
= false;
1839 ITimeGraphEntry entry1
= fTimeGraphWrapper
.getSelection();
1840 fTimeGraphWrapper
.setSelection(entry1
);
1843 if (combo
!= null) {
1844 combo
.getTreeViewer().getTree().setRedraw(true);
1846 getTimeGraphViewer().getTimeGraphControl().setRedraw(true);
1848 long startBound
= (fStartTime
== Long
.MAX_VALUE ? SWT
.DEFAULT
: fStartTime
);
1849 long endBound
= (fEndTime
== Long
.MIN_VALUE ? SWT
.DEFAULT
: fEndTime
);
1850 fTimeGraphWrapper
.getTimeGraphViewer().setTimeBounds(startBound
, endBound
);
1852 TmfTraceContext ctx
= TmfTraceManager
.getInstance().getCurrentTraceContext();
1853 long selectionBeginTime
= fTrace
== null ? SWT
.DEFAULT
: ctx
.getSelectionRange().getStartTime().toNanos();
1854 long selectionEndTime
= fTrace
== null ? SWT
.DEFAULT
: ctx
.getSelectionRange().getEndTime().toNanos();
1855 long startTime
= fTrace
== null ? SWT
.DEFAULT
: ctx
.getWindowRange().getStartTime().toNanos();
1856 long endTime
= fTrace
== null ? SWT
.DEFAULT
: ctx
.getWindowRange().getEndTime().toNanos();
1857 startTime
= (fStartTime
== Long
.MAX_VALUE ? SWT
.DEFAULT
: Math
.max(startTime
, fStartTime
));
1858 endTime
= (fEndTime
== Long
.MIN_VALUE ? SWT
.DEFAULT
: Math
.min(endTime
, fEndTime
));
1859 fTimeGraphWrapper
.getTimeGraphViewer().setSelectionRange(selectionBeginTime
, selectionEndTime
, false);
1860 fTimeGraphWrapper
.getTimeGraphViewer().setStartFinishTime(startTime
, endTime
);
1862 if (inputChanged
&& selectionBeginTime
!= SWT
.DEFAULT
) {
1863 synchingToTime(selectionBeginTime
);
1866 if (fTimeGraphWrapper
instanceof TimeGraphComboWrapper
&& !fPackDone
) {
1867 for (TreeColumn column
: ((TimeGraphComboWrapper
) fTimeGraphWrapper
).getTreeViewer().getTree().getColumns()) {
1876 startZoomThread(startTime
, endTime
);
1878 fDirty
.decrementAndGet();
1886 protected void redraw() {
1887 synchronized (fSyncObj
) {
1888 if (fRedrawState
== State
.IDLE
) {
1889 fRedrawState
= State
.BUSY
;
1891 fRedrawState
= State
.PENDING
;
1895 Display
.getDefault().asyncExec(new Runnable() {
1898 if (fTimeGraphWrapper
.isDisposed()) {
1901 fTimeGraphWrapper
.redraw();
1902 fTimeGraphWrapper
.update();
1903 synchronized (fSyncObj
) {
1904 if (fRedrawState
== State
.PENDING
) {
1905 fRedrawState
= State
.IDLE
;
1908 fRedrawState
= State
.IDLE
;
1915 private void sortChildren(ITimeGraphEntry entry
, Comparator
<ITimeGraphEntry
> comparator
) {
1916 if (entry
instanceof TimeGraphEntry
) {
1917 ((TimeGraphEntry
) entry
).sortChildren(comparator
);
1919 for (ITimeGraphEntry child
: entry
.getChildren()) {
1920 sortChildren(child
, comparator
);
1925 * Start or restart the zoom thread.
1928 * the zoom start time
1933 protected final void startZoomThread(long startTime
, long endTime
) {
1934 long clampedStartTime
= Math
.min(Math
.max(startTime
, fStartTime
), fEndTime
);
1935 long clampedEndTime
= Math
.max(Math
.min(endTime
, fEndTime
), fStartTime
);
1936 fDirty
.incrementAndGet();
1937 boolean restart
= false;
1938 if (fZoomThread
!= null) {
1939 fZoomThread
.cancel();
1940 if (fZoomThread
.fZoomStartTime
== clampedStartTime
&& fZoomThread
.fZoomEndTime
== clampedEndTime
) {
1944 long resolution
= Math
.max(1, (clampedEndTime
- clampedStartTime
) / fDisplayWidth
);
1945 fZoomThread
= createZoomThread(clampedStartTime
, clampedEndTime
, resolution
, restart
);
1946 if (fZoomThread
!= null) {
1947 // Don't start a new thread right away if results are being applied
1948 // from an old ZoomThread. Otherwise, the old results might
1949 // overwrite the new results if it finishes after.
1950 synchronized (fZoomThreadResultLock
) {
1951 fZoomThread
.start();
1954 fDirty
.decrementAndGet();
1959 * Create a zoom thread.
1962 * the zoom start time
1968 * true if restarting zoom for the same time range
1969 * @return a zoom thread
1972 protected @Nullable ZoomThread
createZoomThread(long startTime
, long endTime
, long resolution
, boolean restart
) {
1973 final List
<TimeGraphEntry
> entryList
= fEntryList
;
1974 if (entryList
== null) {
1977 return new ZoomThreadByEntry(entryList
, startTime
, endTime
, resolution
);
1980 private void makeActions() {
1981 fPreviousResourceAction
= fTimeGraphWrapper
.getTimeGraphViewer().getPreviousItemAction();
1982 fPreviousResourceAction
.setText(getPrevText());
1983 fPreviousResourceAction
.setToolTipText(getPrevTooltip());
1984 fNextResourceAction
= fTimeGraphWrapper
.getTimeGraphViewer().getNextItemAction();
1985 fNextResourceAction
.setText(getNextText());
1986 fNextResourceAction
.setToolTipText(getNextTooltip());
1989 private void contributeToActionBars() {
1990 IActionBars bars
= getViewSite().getActionBars();
1991 fillLocalToolBar(bars
.getToolBarManager());
1992 fillLocalMenu(bars
.getMenuManager());
1996 * Add actions to local tool bar manager
1998 * @param manager the tool bar manager
2000 protected void fillLocalToolBar(IToolBarManager manager
) {
2001 if (fFilterColumns
!= null && fFilterLabelProvider
!= null && fFilterColumns
.length
> 0) {
2002 manager
.add(fTimeGraphWrapper
.getShowFilterDialogAction());
2004 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getShowLegendAction());
2005 manager
.add(new Separator());
2006 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getResetScaleAction());
2007 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getPreviousEventAction());
2008 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getNextEventAction());
2009 manager
.add(new Separator());
2010 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getToggleBookmarkAction());
2011 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getPreviousMarkerAction());
2012 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getNextMarkerAction());
2013 manager
.add(new Separator());
2014 manager
.add(fPreviousResourceAction
);
2015 manager
.add(fNextResourceAction
);
2016 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getZoomInAction());
2017 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getZoomOutAction());
2018 manager
.add(new Separator());
2022 * Add actions to local menu manager
2024 * @param manager the tool bar manager
2027 protected void fillLocalMenu(IMenuManager manager
) {
2028 manager
.add(fTimeGraphWrapper
.getTimeGraphViewer().getMarkersMenu());
2035 public TmfTimeViewAlignmentInfo
getTimeViewAlignmentInfo() {
2036 if (fTimeGraphWrapper
== null) {
2039 return fTimeGraphWrapper
.getTimeViewAlignmentInfo();
2046 public int getAvailableWidth(int requestedOffset
) {
2047 if (fTimeGraphWrapper
== null) {
2050 return fTimeGraphWrapper
.getAvailableWidth(requestedOffset
);
2057 public void performAlign(int offset
, int width
) {
2058 if (fTimeGraphWrapper
!= null) {
2059 fTimeGraphWrapper
.performAlign(offset
, width
);
2064 * Returns whether or not the time graph view is dirty. The time graph view
2065 * is considered dirty if it has yet to completely update its model.
2067 * This method is meant to be used by tests in order to know when it is safe
2070 * Note: If a trace is smaller than the initial window range (see
2071 * {@link ITmfTrace#getInitialRangeOffset}) this method will return true
2074 * @return true if the time graph view has yet to completely update its
2075 * model, false otherwise
2078 public boolean isDirty() {
2079 if (fTrace
== null) {
2083 TmfTraceContext ctx
= TmfTraceManager
.getInstance().getCurrentTraceContext();
2084 long startTime
= ctx
.getWindowRange().getStartTime().toNanos();
2085 long endTime
= ctx
.getWindowRange().getEndTime().toNanos();
2087 // If the time graph control hasn't updated all the way to the end of
2088 // the window range then it's dirty. A refresh should happen later.
2089 if (fTimeGraphWrapper
.getTimeGraphViewer().getTime0() != startTime
|| fTimeGraphWrapper
.getTimeGraphViewer().getTime1() != endTime
) {
2093 if (fZoomThread
== null) {
2094 // The zoom thread is null but we might be just about to create it (refresh called).
2095 return fDirty
.get() != 0;
2097 // Dirty if the zoom thread is not done or if it hasn't zoomed all the
2098 // way to the end of the window range. In the latter case, there should be
2099 // a subsequent zoom thread that will be triggered.
2100 return fDirty
.get() != 0 || fZoomThread
.getZoomStartTime() != startTime
|| fZoomThread
.getZoomEndTime() != endTime
;
2103 private void createColumnSelectionListener(TreeViewer treeViewer
) {
2104 for (int i
= 0; i
< fColumnComparators
.length
; i
++) {
2105 final int index
= i
;
2106 final Comparator
<ITimeGraphEntry
> comp
= fColumnComparators
[index
];
2107 final Tree tree
= treeViewer
.getTree();
2108 final TreeColumn column
= tree
.getColumn(i
);
2111 column
.addSelectionListener(new SelectionAdapter() {
2113 public void widgetSelected(SelectionEvent e
) {
2114 TreeColumn prevSortcolumn
= tree
.getSortColumn();
2115 int direction
= tree
.getSortDirection();
2116 if (prevSortcolumn
== column
) {
2117 direction
= (direction
== SWT
.DOWN
) ? SWT
.UP
: SWT
.DOWN
;
2119 direction
= SWT
.DOWN
;
2121 tree
.setSortColumn(column
);
2122 tree
.setSortDirection(direction
);
2123 fSortDirection
= direction
;
2124 fCurrentSortColumn
= index
;
2125 Comparator
<ITimeGraphEntry
> comparator
= comp
;
2127 if (comparator
instanceof ITimeGraphEntryComparator
) {
2128 ((ITimeGraphEntryComparator
) comparator
).setDirection(direction
);
2130 if (direction
!= SWT
.DOWN
) {
2131 comparator
= checkNotNull(Collections
.reverseOrder(comparator
));
2133 setEntryComparator(comparator
);
2134 fIsRevealSelection
= true;
2135 if (fTimeGraphWrapper
instanceof TimeGraphComboWrapper
) {
2136 ((TimeGraphComboWrapper
) fTimeGraphWrapper
).getTreeViewer().getControl().setFocus();
2145 private void createDoubleClickListener(TreeViewer treeViewer
) {
2146 treeViewer
.addDoubleClickListener(event
-> {
2147 if (event
.getSelection() instanceof TreeSelection
) {
2148 TreeSelection selection
= (TreeSelection
) event
.getSelection();
2149 if (selection
.getFirstElement() instanceof ITimeGraphEntry
) {
2150 ITimeGraphEntry entry
= (ITimeGraphEntry
) selection
.getFirstElement();
2151 if (entry
.hasChildren()) {
2152 fTimeGraphWrapper
.setExpandedState(entry
, !fTimeGraphWrapper
.getExpandedState(entry
));
2160 private void restoreViewContext() {
2161 TimeGraphCombo combo
= getTimeGraphCombo();
2162 ViewContext viewContext
= fViewContext
.get(fTrace
);
2163 if (combo
!= null) {
2164 if (fColumnComparators
!= null) {
2165 // restore sort settings
2166 fSortDirection
= SWT
.DOWN
;
2167 fCurrentSortColumn
= fInitialSortColumn
;
2168 if (viewContext
!= null) {
2169 fSortDirection
= viewContext
.getSortDirection();
2170 fCurrentSortColumn
= viewContext
.getSortColumn();
2172 if ((fCurrentSortColumn
< fColumnComparators
.length
) && (fColumnComparators
[fCurrentSortColumn
] != null)) {
2173 Comparator
<ITimeGraphEntry
> comparator
= fColumnComparators
[fCurrentSortColumn
];
2174 if (comparator
instanceof ITimeGraphEntryComparator
) {
2175 ((ITimeGraphEntryComparator
) comparator
).setDirection(fSortDirection
);
2177 if (fSortDirection
!= SWT
.DOWN
) {
2178 comparator
= checkNotNull(Collections
.reverseOrder(comparator
));
2180 setEntryComparator(comparator
);
2186 private void applyViewContext() {
2187 TimeGraphCombo combo
= getTimeGraphCombo();
2188 ViewContext viewContext
= fViewContext
.get(fTrace
);
2189 if (combo
!= null) {
2190 TreeViewer treeViewer
= combo
.getTreeViewer();
2191 final Tree tree
= treeViewer
.getTree();
2192 final TreeColumn column
= tree
.getColumn(fCurrentSortColumn
);
2193 tree
.setSortDirection(fSortDirection
);
2194 tree
.setSortColumn(column
);
2195 combo
.getTreeViewer().getControl().setFocus();
2197 // restore and reveal selection
2198 if ((viewContext
!= null) && (viewContext
.getSelection() != null)) {
2199 fTimeGraphWrapper
.setSelection(viewContext
.getSelection());
2201 fViewContext
.remove(fTrace
);
2204 private static class ViewContext
{
2205 private int fSortColumnIndex
;
2206 private int fSortDirection
;
2207 private @Nullable ITimeGraphEntry fSelection
;
2209 ViewContext(int sortColunm
, int sortDirection
, ITimeGraphEntry selection
) {
2210 fSortColumnIndex
= sortColunm
;
2211 fSortDirection
= sortDirection
;
2212 fSelection
= selection
;
2215 * @return the sortColumn
2217 public int getSortColumn() {
2218 return fSortColumnIndex
;
2221 * @return the sortDirection
2223 public int getSortDirection() {
2224 return fSortDirection
;
2227 * @return the selection
2229 public ITimeGraphEntry
getSelection() {
2234 private void createContextMenu() {
2235 TimeGraphCombo combo
= getTimeGraphCombo();
2236 fEntryMenuManager
.setRemoveAllWhenShown(true);
2237 if (combo
!= null) {
2238 TreeViewer treeViewer
= combo
.getTreeViewer();
2239 Tree tree
= treeViewer
.getTree();
2240 Menu menu
= fEntryMenuManager
.createContextMenu(tree
);
2243 TimeGraphControl timeGraphControl
= getTimeGraphViewer().getTimeGraphControl();
2244 final Menu entryMenu
= fEntryMenuManager
.createContextMenu(timeGraphControl
);
2245 timeGraphControl
.addTimeGraphEntryMenuListener(new MenuDetectListener() {
2247 public void menuDetected(MenuDetectEvent event
) {
2248 Point p
= timeGraphControl
.toControl(event
.x
, event
.y
);
2250 * The TimeGraphControl will call the TimeGraphEntryMenuListener
2251 * before the TimeEventMenuListener. If the event is
2252 * triggered on the namespace then show the menu else
2255 if (p
.x
< getTimeGraphViewer().getNameSpace()) {
2256 timeGraphControl
.setMenu(entryMenu
);
2258 timeGraphControl
.setMenu(null);
2264 fEntryMenuManager
.addMenuListener(new IMenuListener() {
2266 public void menuAboutToShow(IMenuManager manager
) {
2267 fillTimeGraphEntryContextMenu(fEntryMenuManager
);
2268 fEntryMenuManager
.add(new GroupMarker(IWorkbenchActionConstants
.MB_ADDITIONS
));
2271 getSite().registerContextMenu(fEntryMenuManager
, fTimeGraphWrapper
.getSelectionProvider());
2277 * @param menuManager
2278 * a menuManager to fill
2281 protected void fillTimeGraphEntryContextMenu (@NonNull IMenuManager menuManager
) {
2285 * Inner classes used for searching
2288 public ITimeGraphEntry
getSelection() {
2289 return fTimeGraphWrapper
.getSelection();
2292 public void selectAndReveal(@NonNull ITimeGraphEntry entry
) {
2293 fTimeGraphWrapper
.selectAndReveal(entry
);
2296 public ITimeGraphEntry
[] getEntries() {
2297 TimeGraphViewer viewer
= getTimeGraphViewer();
2298 return viewer
.getTimeGraphContentProvider().getElements(viewer
.getInput());
2301 public Shell
getShell() {
2302 return getSite().getShell();
2306 class TimeGraphPartListener
implements IPartListener
{
2308 public void partActivated(IWorkbenchPart part
) {
2309 if (part
== AbstractTimeGraphView
.this) {
2310 synchronized (FIND_ACTION
) {
2311 if (fFindActionHandler
== null) {
2312 fFindActionHandler
= new ActionHandler(FIND_ACTION
);
2314 final Object service
= PlatformUI
.getWorkbench().getService(IHandlerService
.class);
2315 fFindHandlerActivation
= ((IHandlerService
) service
).activateHandler(ActionFactory
.FIND
.getCommandId(), fFindActionHandler
);
2318 // Notify action for all parts
2319 FIND_ACTION
.partActivated(part
);
2322 public void partDeactivated(IWorkbenchPart part
) {
2323 if ((part
== AbstractTimeGraphView
.this) && (fFindHandlerActivation
!= null)) {
2324 final Object service
= PlatformUI
.getWorkbench().getService(IHandlerService
.class);
2325 ((IHandlerService
) service
).deactivateHandler(fFindHandlerActivation
);
2329 public void partBroughtToTop(IWorkbenchPart part
) {
2332 public void partClosed(IWorkbenchPart part
) {
2335 public void partOpened(IWorkbenchPart part
) {