* 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
*******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.resources;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.linuxtools.lttng.control.LttngCoreProviderFactory;
-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.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.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.resources.evProcessor.ResourcesEventToHandlerFactory;
import org.eclipse.linuxtools.lttng.ui.views.resources.model.ResourceModelFactory;
-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.resources.model.ResourcesTimeRangeViewerProvider;
+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.ITmfTimeScaleSelectionListener;
import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeSelectionListener;
private Action zoomFilter;
private Composite top;
+ private TmfTimeRange initTimeRange = TmfTimeRange.Null;
+
// private static SimpleDateFormat stimeformat = new SimpleDateFormat(
// "yy/MM/dd HH:mm:ss");
top = new Composite(parent, SWT.BORDER);
top.setLayout(new FillLayout());
- tsfviewer = TmfViewerFactory.createViewer(top, new TimeRangeViewerProvider(getParamsUpdater()));
+ tsfviewer = TmfViewerFactory.createViewer(top, new ResourcesTimeRangeViewerProvider(getParamsUpdater()));
tsfviewer.addWidgetSelectionListner(this);
tsfviewer.addWidgetTimeScaleSelectionListner(this);
TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
if (experiment != null) {
TmfTimeRange experimentTRange = experiment.getTimeRange();
- if (experimentTRange != null) {
+ if (experimentTRange != TmfTimeRange.Null) {
long time0 = experimentTRange.getStartTime().getValue();
long time1 = experimentTRange.getEndTime().getValue();
ParamsUpdater paramUpdater = getParamsUpdater();
paramUpdater.update(time0, time1); // , timeSpaceWidth);
- }
- // send the initial request and obtained the adjusted time used
- TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this, experimentTRange);
- // initialize widget time boundaries and filtering parameters
- ModelUpdateInit(experimentTRange, adjustedTimeRange, this);
+ // send the initial request and obtained 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);
}
private void fillLocalToolBar(IToolBarManager manager) {
- // manager.add(showLegend);
+ manager.add(showLegend);
manager.add(new Separator());
manager.add(resetScale);
manager.add(nextEvent);
resetScale.setText(Messages.getString("ResourcesView.Action.Reset")); //$NON-NLS-1$
resetScale.setToolTipText(Messages.getString("ResourcesView.Action.Reset.ToolTip")); //$NON-NLS-1$
resetScale.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/home_nav.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/home_nav.gif")); //$NON-NLS-1$ //$NON-NLS-2$
// action5
nextEvent = new Action() {
nextEvent.setText(Messages.getString("ResourcesView.Action.NextEvent")); //$NON-NLS-1$
nextEvent.setToolTipText(Messages.getString("ResourcesView.Action.NextEvent.Tooltip")); //$NON-NLS-1$
nextEvent.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/next_event.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/next_event.gif")); //$NON-NLS-1$//$NON-NLS-2$
// action6
prevEvent = new Action() {
prevEvent.setText(Messages.getString("ResourcesView.Action.PrevEvent")); //$NON-NLS-1$
prevEvent.setToolTipText(Messages.getString("ResourcesView.Action.PrevEvent.Tooltip")); //$NON-NLS-1$
prevEvent.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/prev_event.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/prev_event.gif")); //$NON-NLS-1$//$NON-NLS-2$
// action7
nextTrace = new Action() {
nextTrace.setText(Messages.getString("ResourcesView.Action.NextResource")); //$NON-NLS-1$
nextTrace.setToolTipText(Messages.getString("ResourcesView.Action.NextResource.ToolTip")); //$NON-NLS-1$
nextTrace.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/next_item.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/next_item.gif")); //$NON-NLS-1$//$NON-NLS-2$
// action8
prevTrace = new Action() {
prevTrace.setText(Messages.getString("ResourcesView.Action.PreviousResource")); //$NON-NLS-1$
prevTrace.setToolTipText(Messages.getString("ResourcesView.Action.PreviousResource.Tooltip")); //$NON-NLS-1$
prevTrace.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/prev_item.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/prev_item.gif")); //$NON-NLS-1$//$NON-NLS-2$
// action9
showLegend = new Action() {
filterTraces.setText(Messages.getString("ResourcesView.Action.Filter")); //$NON-NLS-1$
filterTraces.setToolTipText(Messages.getString("ResourcesView.Action.Filter.ToolTip")); //$NON-NLS-1$
filterTraces.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/filter_items.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/filter_items.gif")); //$NON-NLS-1$//$NON-NLS-2$
// action10
zoomIn = new Action() {
zoomIn.setText(Messages.getString("ResourcesView.Action.ZoomIn")); //$NON-NLS-1$
zoomIn.setToolTipText(Messages.getString("ResourcesView.Action.ZoomIn.Tooltip")); //$NON-NLS-1$
zoomIn.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/zoomin_nav.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/zoomin_nav.gif")); //$NON-NLS-1$//$NON-NLS-2$
// action10
zoomOut = new Action() {
zoomOut.setText(Messages.getString("ResourcesView.Action.ZoomOut")); //$NON-NLS-1$
zoomOut.setToolTipText(Messages.getString("ResourcesView.Action.ZoomOut.tooltip")); //$NON-NLS-1$
zoomOut.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/zoomout_nav.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/zoomout_nav.gif")); //$NON-NLS-1$//$NON-NLS-2$
// zoomFilter
zoomFilter = new Action() {
zoomFilter.setText(Messages.getString("ResourcesView.Action.ZoomFilter")); //$NON-NLS-1$
zoomFilter.setToolTipText(Messages.getString("ResourcesView.Action.ZoomFilter.tooltip")); //$NON-NLS-1$
zoomFilter.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- Messages.getString("ResourcesView.tmf.UI"), "icons/filter_items.gif")); //$NON-NLS-1$//$NON-NLS-2$
+ Messages.getString("ResourcesView.tmf.UI"), "icons/elcl16/filter_items.gif")); //$NON-NLS-1$//$NON-NLS-2$
zoomFilter.setChecked(false);
// PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_SYNCED);
if (signal != null) {
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);
+ // 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();
+
+ 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: " + initTimeWindow.getStartTime().toString() + "-" //$NON-NLS-1$ //$NON-NLS-2$
+ initTimeWindow.getEndTime().toString());
}
+ initTimeRange = initTimeWindow;
return initTimeWindow;
}