* 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.control.LttngCoreProviderFactory;
-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;
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");
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 = 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"); //$NON-NLS-1$
}
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);
*/
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();
}
}
}
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.FOREGROUND);
+ eventRequest(initTimeWindow, experimentTRange, true, ExecutionType.FOREGROUND);
if (TraceDebug.isDEBUG()) {
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"); //$NON-NLS-1$
-
- // Gnome : most common case, no adjustement
- if ( desktopSessionName.equals("gnome") ) { //$NON-NLS-1$
- returnedAjustement = 0;
- }
- // Kde : ajustement of 2 is needed
- else if ( desktopSessionName.equals("kde") ) { //$NON-NLS-1$
- 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;
}
/*