Class AbstractTmfTreeViewer
java.lang.Object
org.eclipse.tracecompass.tmf.core.component.TmfComponent
org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer
org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer
org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractTmfTreeViewer
- All Implemented Interfaces:
ITmfComponent,ITmfTimeProvider,ITmfViewer,ITmfPinnable
- Direct Known Subclasses:
AbstractSegmentsStatisticsViewer,AbstractSelectTreeViewer2
Abstract class for viewers who will display data using a TreeViewer. It
automatically synchronizes with time information of the UI. It also
implements some common functionalities for all tree viewer, such as managing
the column data, content initialization and update. The viewer implementing
this does not have to worry about whether some code runs in the UI thread or
not.
- Author:
- Geneviève Bastien
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractTmfTreeViewer(org.eclipse.swt.widgets.Composite parent, boolean allowMultiSelect) ConstructorAbstractTmfTreeViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.viewers.TreeViewer treeViewer) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelectionChangeListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) Add a selection listener to the tree viewer.org.eclipse.swt.widgets.ControlReturns the primary control associated with this viewer.@Nullable TmfTreeViewerEntryGets the root element for the specified trace.org.eclipse.jface.viewers.TreeViewerGet the tree viewer objectvoidA Method to load a trace into the viewer.voidrefresh()Tells the viewer to refresh its contents.voidreset()Resets the content of the viewervoidsetAutoExpandLevel(int level) Sets the auto-expand level to be used for the input of the viewer.voidsetSelection(@NonNull List<ITmfTreeViewerEntry> selection) Set the currently selected items in the treeviewervoidsetTreeColumns(List<TmfTreeColumnData> columns) Sets the tree columns for this tree viewervoidtraceClosed(@Nullable TmfTraceClosedSignal signal) Signal handler for handling of the trace closed signal.voidSignal handler for handling of the window range signal.Methods inherited from class org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer
getEndTime, getSelectionBeginTime, getSelectionEndTime, getStartTime, getTrace, getWindowDuration, getWindowEndTime, getWindowStartTime, selectionRangeUpdated, setPinned, traceOpened, traceRangeUpdated, traceSelected, traceUpdated, updateSelectionRange, updateWindowMethods inherited from class org.eclipse.tracecompass.tmf.core.component.TmfComponent
broadcast, broadcastAsync, dispose, getName, initMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.tracecompass.tmf.core.component.ITmfComponent
broadcast, broadcastAsync, dispose, getName
-
Constructor Details
-
AbstractTmfTreeViewer
public AbstractTmfTreeViewer(org.eclipse.swt.widgets.Composite parent, boolean allowMultiSelect) Constructor- Parameters:
parent- The parent composite that holds this viewerallowMultiSelect- Whether multiple selections are allowed
-
AbstractTmfTreeViewer
public AbstractTmfTreeViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.viewers.TreeViewer treeViewer) Constructor- Parameters:
parent- The parent composite that holds this viewertreeViewer- The tree viewer to use- Since:
- 3.1
-
-
Method Details
-
setTreeColumns
Sets the tree columns for this tree viewer- Parameters:
columns- The tree column data
-
getTreeViewer
public org.eclipse.jface.viewers.TreeViewer getTreeViewer()Get the tree viewer object- Returns:
- The tree viewer object displayed by this viewer
- Since:
- 2.2
-
getControl
public org.eclipse.swt.widgets.Control getControl()Description copied from interface:ITmfViewerReturns the primary control associated with this viewer.- Returns:
- the SWT control which displays this viewer's contents
-
refresh
public void refresh()Description copied from interface:ITmfViewerTells the viewer to refresh its contents. -
loadTrace
Description copied from class:TmfTimeViewerA Method to load a trace into the viewer.- Overrides:
loadTracein classTmfTimeViewer- Parameters:
trace- A trace to apply in the viewer
-
getRoot
Gets the root element for the specified trace. Using a fixed root element helps the tree maintain its state when the model is updated or sorted.- Parameters:
trace- the trace- Returns:
- the root element, or null if the trace is closed
- Since:
- 6.2
-
setSelection
Set the currently selected items in the treeviewer- Parameters:
selection- The list of selected items
-
addSelectionChangeListener
public void addSelectionChangeListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) Add a selection listener to the tree viewer. This will be called when the selection changes and contain all the selected items. The selection change listener can be used like this:getTreeViewer().addSelectionChangeListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof IStructuredSelection) { Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (selection instanceof ITmfTreeViewerEntry) { // Do something } } } });- Parameters:
listener- TheISelectionChangedListener
-
setAutoExpandLevel
public void setAutoExpandLevel(int level) Sets the auto-expand level to be used for the input of the viewer. The value 0 means that there is no auto-expand; 1 means that top-level elements are expanded, but not their children; 2 means that top-level elements are expanded, and their children, but not grand-children; and so on.The value
AbstractTreeViewer.ALL_LEVELSmeans that all subtrees should be expanded.- Parameters:
level- non-negative level, orAbstractTreeViewer.ALL_LEVELSto expand all levels of the tree- Since:
- 4.0
-
windowRangeUpdated
Signal handler for handling of the window range signal. This time range is the visible zone of the view.- Overrides:
windowRangeUpdatedin classTmfTimeViewer- Parameters:
signal- TheTmfWindowRangeUpdatedSignal
-
traceClosed
Description copied from class:TmfTimeViewerSignal handler for handling of the trace closed signal.- Overrides:
traceClosedin classTmfTimeViewer- Parameters:
signal- The trace closed signalTmfTraceClosedSignal
-
reset
public void reset()Description copied from class:TmfTimeViewerResets the content of the viewer- Overrides:
resetin classTmfTimeViewer
-