* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Alvaro Sanchez-Leon - Initial implementation
+ * Contributors:
+ * Alvaro Sanchez-Leon - Initial implementation
+ * Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ * Bernd Hufmann - Bug fixes
*******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.controlflow;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
-import org.eclipse.linuxtools.lttng.request.ILttngSyntEventRequest;
-import org.eclipse.linuxtools.lttng.state.evProcessor.ITransEventProcessor;
+import org.eclipse.linuxtools.lttng.core.control.LttngCoreProviderFactory;
+import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp;
+import org.eclipse.linuxtools.lttng.core.request.ILttngSyntEventRequest;
+import org.eclipse.linuxtools.lttng.core.state.evProcessor.ITransEventProcessor;
import org.eclipse.linuxtools.lttng.ui.TraceDebug;
import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeViewerProvider;
import org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView;
import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
import org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor.FlowEventToHandlerFactory;
import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowModelFactory;
-import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
-import org.eclipse.linuxtools.tmf.request.ITmfDataRequest.ExecutionType;
-import org.eclipse.linuxtools.tmf.signal.TmfExperimentSelectedSignal;
-import org.eclipse.linuxtools.tmf.signal.TmfRangeSynchSignal;
-import org.eclipse.linuxtools.tmf.signal.TmfSignalHandler;
-import org.eclipse.linuxtools.tmf.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowTimeRangeViewerProvider;
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
import org.eclipse.linuxtools.tmf.ui.viewers.TmfViewerFactory;
import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeFilterSelectionListener;
import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeScaleSelectionListener;
ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener,
ITmfTimeFilterSelectionListener {
- public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.controlflow";
+ public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.controlflow"; //$NON-NLS-1$
// ========================================================================
// Table data
// ========================================================================
- private final String PROCESS_COLUMN = "Process";
- private final String BRAND_COLUMN = "Brand";
- private final String PID_COLUMN = "PID";
- private final String TGID_COLUMN = "TGID";
- private final String PPID_COLUMN = "PPID";
- private final String CPU_COLUMN = "CPU";
- private final String BIRTH_SEC_COLUMN = "Birth sec";
- private final String BIRTH_NSEC_COLUMN = "Birth nsec";
- private final String TRACE = "TRACE";
+
+ private final String PROCESS_COLUMN = Messages.getString("ControlFlowView.processColumn"); //$NON-NLS-1$
+ private final String BRAND_COLUMN = Messages.getString("ControlFlowView.brandColumn"); //$NON-NLS-1$
+ private final String PID_COLUMN = Messages.getString("ControlFlowView.pidColumn"); //$NON-NLS-1$
+ private final String TGID_COLUMN = Messages.getString("ControlFlowView.tgidColumn"); //$NON-NLS-1$
+ private final String PPID_COLUMN = Messages.getString("ControlFlowView.ppidColumn"); //$NON-NLS-1$
+ private final String CPU_COLUMN = Messages.getString("ControlFlowView.cpuColumn"); //$NON-NLS-1$
+ private final String BIRTH_SEC_COLUMN = Messages.getString("ControlFlowView.birthSecColumn"); //$NON-NLS-1$
+ private final String BIRTH_NSEC_COLUMN = Messages.getString("ControlFlowView.birthNSecColumn"); //$NON-NLS-1$
+ private final String TRACE = Messages.getString("ControlFlowView.TraceNameColumn"); //$NON-NLS-1$
private final String[] columnNames = new String[] { PROCESS_COLUMN, /* */
BRAND_COLUMN,/* */
private ViewProcessFilter tableFilter = null;
private ScrolledComposite scrollFrame = null;
+
+ private TmfTimeRange initTimeRange = TmfTimeRange.Null;
// private static SimpleDateFormat stimeformat = new SimpleDateFormat(
// "yy/MM/dd HH:mm:ss");
cviewer = v;
}
+ @Override
public void inputChanged(Viewer v, Object oldInput, Object newInput) {
this.elements = (ITmfTimeAnalysisEntry[]) newInput;
if (elements != null) {
- TraceDebug.debug("Total number of processes provided to Control Flow view: " + elements.length);
+ TraceDebug.debug("Total number of processes provided to Control Flow view: " + elements.length); //$NON-NLS-1$
} else {
- TraceDebug.debug("New input = null");
+ TraceDebug.debug("New input = null"); //$NON-NLS-1$
}
}
+ @Override
public void dispose() {
}
cviewer.replace(elements[index], index);
}
- // @Override
+ @Override
public Object[] getElements(Object inputElement) {
return elements;
}
}
- class ViewLabelProvider extends LabelProvider implements
- ITableLabelProvider {
+ class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
+ @Override
public String getColumnText(Object obj, int index) {
String strRes = ""; //$NON-NLS-1$
LttngTimestamp time;
return strRes;
}
+ @Override
public Image getColumnImage(Object obj, int index) {
return getImage(obj);
}
return false;
}
} else {
- TraceDebug.debug("Unexpected type of filter element received: "
+ TraceDebug.debug("Unexpected type of filter element received: " //$NON-NLS-1$
+ element.toString());
}
// Compare element versus a list of filtered out
tableViewer.setLabelProvider(new ViewLabelProvider());
Table table = tableViewer.getTable();
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection sel = event.getSelection();
if (!sel.isEmpty()) {
// Listen to page up /down and Home / Enc keys
tableViewer.getTable().addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
Table table = tableViewer.getTable();
Point origin = scrollFrame.getOrigin();
}
}
+ @Override
public void keyReleased(KeyEvent e) {
// Nothing to do
int borderWidth = table.getBorderWidth();
- int itemHeight = table.getItemHeight() + checkForSWTBugItemHeightAdjustement();
+ int itemHeight = table.getItemHeight() + getTableItemHeightAdjustement();
int headerHeight = table.getHeaderHeight();
table.getVerticalBar().setVisible(false);
- tsfviewer = TmfViewerFactory.createViewer(sash,
- new TimeRangeViewerProvider(getParamsUpdater()));
-
- tsfviewer.addWidgetSelectionListner(this);
- tsfviewer.addWidgetTimeScaleSelectionListner(this);
+ tsfviewer = TmfViewerFactory.createViewer(sash, new FlowTimeRangeViewerProvider(getParamsUpdater()));
// Traces shall not be grouped to allow synchronisation
tsfviewer.groupTraces(false);
if (experiment != null) {
TmfTimeRange experimentTRange = experiment.getTimeRange();
- // send request and received the adjusted time used
- TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this,
- experimentTRange);
-
- // initialize widget time boundaries and filtering parameters
- ModelUpdateInit(experimentTRange, adjustedTimeRange, this);
+ if (experimentTRange != TmfTimeRange.Null) {
+ // send request and received the adjusted time used
+ TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this,
+ experimentTRange);
+
+ // initialize widget time boundaries and filtering parameters
+ ModelUpdateInit(experimentTRange, adjustedTimeRange, this);
+ }
} else {
- TraceDebug.debug("No selected experiment information available");
+ TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
}
}
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
ControlFlowView.this.fillContextMenu(manager);
}
private void fillLocalPullDown(IMenuManager manager) {
manager.add(new Separator());
- // manager.add(showLegend);
+ manager.add(showLegend);
manager.add(new Separator());
manager.add(resetScale);
manager.add(nextEvent);
}
private void fillContextMenu(IMenuManager manager) {
- // manager.add(showLegend);
+ manager.add(showLegend);
manager.add(new Separator());
manager.add(resetScale);
manager.add(nextEvent);
manager.add(prevEvent);
manager.add(nextTrace);
manager.add(prevTrace);
- // manager.add(showLegend);
+ manager.add(showLegend);
// manager.add(filterTraces);
manager.add(zoomIn);
manager.add(zoomOut);
}
private void fillLocalToolBar(IToolBarManager manager) {
- // manager.add(showLegend);
+ manager.add(showLegend);
manager.add(new Separator());
manager.add(resetScale);
manager.add(nextEvent);
.getString("ControlFlowView.Action.Reset.ToolTip")); //$NON-NLS-1$
resetScale.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/home_nav.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/home_nav.gif")); //$NON-NLS-1$
// nextEvent
nextEvent = new Action() {
.getString("ControlFlowView.Action.NextEvent.Tooltip")); //$NON-NLS-1$
nextEvent.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/next_event.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/next_event.gif")); //$NON-NLS-1$
// prevEvent
prevEvent = new Action() {
.getString("ControlFlowView.Action.PrevEvent.Tooltip")); //$NON-NLS-1$
prevEvent.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/prev_event.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/prev_event.gif")); //$NON-NLS-1$
// nextTrace
nextTrace = new Action() {
.getString("ControlFlowView.Action.NextProcess.ToolTip")); //$NON-NLS-1$
nextTrace.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/next_item.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/next_item.gif")); //$NON-NLS-1$
// prevTrace
prevTrace = new Action() {
.getString("ControlFlowView.Action.PreviousProcess.Tooltip")); //$NON-NLS-1$
prevTrace.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/prev_item.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/prev_item.gif")); //$NON-NLS-1$
// showLegend
showLegend = new Action() {
.getString("ControlFlowView.Action.Filter.ToolTip")); //$NON-NLS-1$
filterTraces.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/filter_items.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/filter_items.gif")); //$NON-NLS-1$
// zoomIn
zoomIn = new Action() {
zoomIn.setToolTipText(Messages
.getString("ControlFlowView.Action.ZoomIn.Tooltip")); //$NON-NLS-1$
zoomIn.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ControlFlowView.tmf.UI"),
- "icons/zoomin_nav.gif"));
+ Messages.getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/zoomin_nav.gif")); //$NON-NLS-1$
// zoomOut
zoomOut = new Action() {
zoomOut.setToolTipText(Messages
.getString("ControlFlowView.Action.ZoomOut.tooltip")); //$NON-NLS-1$
zoomOut.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ControlFlowView.tmf.UI"),
- "icons/zoomout_nav.gif"));
+ Messages.getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/zoomout_nav.gif")); //$NON-NLS-1$
// zoomFilter
zoomFilter = new Action() {
.getString("ControlFlowView.Action.ZoomFilter.tooltip")); //$NON-NLS-1$
zoomFilter.setImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(Messages
- .getString("ControlFlowView.tmf.UI"),
- "icons/filter_items.gif"));
+ .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+ "icons/elcl16/filter_items.gif")); //$NON-NLS-1$
zoomFilter.setChecked(false);
// PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_SYNCED);
private void hookDoubleClickAction() {
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
public void doubleClick(DoubleClickEvent event) {
doubleClickAction.run();
}
* .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent)
*/
@Override
- public synchronized void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
+ public void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
super.tsfTmProcessTimeScaleEvent(event);
}
if(tableViewer != null) {
final Table table = tableViewer.getTable();
+
+ // Ignore update if widget is disposed
+ if (table.isDisposed()) return;
+
Display display = table.getDisplay();
-
+
// Perform the updates on the UI thread)
display.asyncExec(new Runnable() {
+ @Override
public void run() {
-
- tableViewer.setInput(items); // This shall be the minimal
- // initial
- tableFilter = new ViewProcessFilter(tableViewer);
- tableViewer.setFilters(new ViewerFilter[] { tableFilter });
-
- resizeTableColumns(table);
- table.update();
- tableViewer.refresh();
-
- tsfviewer.display(items, startBoundTime, endBoundTime,
- updateTimeBounds);
-
- // validate visible boundaries
- if (startVisibleWindow > -1 && endVisibleWindow > -1) {
- tsfviewer.setSelectVisTimeWindow(startVisibleWindow,
- endVisibleWindow, source);
- }
-
- tsfviewer.resizeControls();
-
- // Adjust the size of the vertical scroll bar to fit the
- // contents
- if (scrollFrame != null) {
- updateScrolls(scrollFrame);
+ if (!table.isDisposed()) {
+ tableViewer.setInput(items); // This shall be the minimal
+ // initial
+ tableFilter = new ViewProcessFilter(tableViewer);
+ tableViewer.setFilters(new ViewerFilter[] { tableFilter });
+
+ resizeTableColumns(table);
+ table.update();
+ tableViewer.refresh();
+
+ tsfviewer.display(items, startBoundTime, endBoundTime,
+ updateTimeBounds);
+
+ // validate visible boundaries
+ if (startVisibleWindow > -1 && endVisibleWindow > -1) {
+ tsfviewer.setSelectVisTimeWindow(startVisibleWindow,
+ endVisibleWindow, source);
+ }
+
+ tsfviewer.resizeControls();
+
+ // Adjust asynchronously the size of the vertical scroll bar to fit the
+ // contents
+ tableViewer.getTable().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if ((scrollFrame != null) && (!scrollFrame.isDisposed())) {
+ updateScrolls(scrollFrame);
+ }
+ }
+ });
}
}
});
*/
private synchronized void resizeTableColumns(Table table) {
if (table != null) {
- Composite parent = table.getParent();
- int tableWidthSum = parent.getBorderWidth();
-
TableColumn[] columns = table.getColumns();
for (TableColumn column : columns) {
column.pack();
- tableWidthSum += column.getWidth();
}
}
}
- // @Override
+ @Override
public void tmfTaProcessFilterSelection(TmfTimeFilterSelectionEvent event) {
if (tableFilter != null) {
Vector<ITmfTimeAnalysisEntry> filteredout = event.getFilteredOut();
TmfTimeRange experimentTRange = signal.getExperiment()
.getTimeRange();
- // prepare time intervals in widget
- ModelUpdateInit(experimentTRange, experimentTRange, signal
- .getSource());
+ initTimeRange = TmfTimeRange.Null;
+ if (experimentTRange != TmfTimeRange.Null) {
+ // prepare time intervals in widget
+ ModelUpdateInit(experimentTRange, experimentTRange, signal
+ .getSource());
+
+ // request initial data
+ initialExperimentDataRequest(signal
+ .getSource(), experimentTRange);
+ }
+ }
+ }
+
+ @TmfSignalHandler
+ public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {
+ if (initTimeRange == TmfTimeRange.Null && signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
+ TmfTimeRange experimentTRange = signal.getRange();
- // request initial data
- initialExperimentDataRequest(signal
- .getSource(), experimentTRange);
+ if (experimentTRange != TmfTimeRange.Null) {
+ // prepare time intervals in widget
+ ModelUpdateInit(experimentTRange, experimentTRange, signal.getSource());
+
+ // request initial data
+ initialExperimentDataRequest(signal.getSource(), experimentTRange);
+ }
}
}
// user to select the interesting area based on the perspective
TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
- dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.SHORT);
+ eventRequest(initTimeWindow, experimentTRange, true, ExecutionType.FOREGROUND);
if (TraceDebug.isDEBUG()) {
- TraceDebug.debug("Initialization request time range is: "
- + initTimeWindow.getStartTime().toString() + "-"
+ TraceDebug.debug("Initialization request time range is: " //$NON-NLS-1$
+ + initTimeWindow.getStartTime().toString() + "-" //$NON-NLS-1$
+ initTimeWindow.getEndTime().toString());
}
+ initTimeRange = initTimeWindow;
return initTimeWindow;
}
- // *** HACK ***
- //
- //
- //
- public int checkForSWTBugItemHeightAdjustement() {
- int returnedAjustement = 0;
- String desktopSessionName = System.getenv("DESKTOP_SESSION");
-
- // Gnome : most common case, no adjustement
- if ( desktopSessionName.equals("gnome") ) {
- returnedAjustement = 0;
- }
- // Kde : ajustement of 2 is needed
- else if ( desktopSessionName.equals("kde") ) {
- returnedAjustement = 2;
+ /*
+ * SWT doesn't seem to report correctly the table item height, at least in
+ * the case of KDE.
+ *
+ * This method provides an adjustment term according to the desktop session.
+ *
+ * @return Height adjustment
+ */
+ private int getTableItemHeightAdjustement() {
+ int ajustement = 0;
+ String desktopSession = System.getenv("DESKTOP_SESSION"); //$NON-NLS-1$
+
+ if (desktopSession != null) {
+ if (desktopSession.equals("kde")) { //$NON-NLS-1$
+ ajustement = 2;
+ }
}
-
- return returnedAjustement;
+
+ return ajustement;
}
/*
protected ItemContainer<?> getItemContainer() {
return FlowModelFactory.getProcContainer();
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getProviderId()
+ */
+ @Override
+ protected int getProviderId() {
+ return LttngCoreProviderFactory.CONTROL_FLOW_LTTNG_SYTH_EVENT_PROVIDER;
+ }
}
\ No newline at end of file