Internalize lttng.ui APIs
authorFrancois Chouinard <fchouinard@gmail.com>
Wed, 14 Mar 2012 19:52:53 +0000 (15:52 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Wed, 14 Mar 2012 19:52:53 +0000 (15:52 -0400)
273 files changed:
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/distribution/LatencyGraphModelTest.java
org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng.ui/plugin.xml
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/LTTngUILogger.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/TraceDebug.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/ITimeRangeComponent.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/ItemContainer.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeComponent.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeComposite.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEvent.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEventProcess.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEventResource.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeResourceFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeViewerProvider.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/NewLTTngProjectMainWizardPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/NewLTTngProjectWizard.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/TraceLibraryPathPropertyPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/TraceLibraryPathWizardPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/TraceControlConstants.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ConfigureMarkers.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ConfigureTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/CreateNewTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/DeleteTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ImportToProject.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/PauseTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/StartTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/StopTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/connectorservice/TraceConnectorService.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/connectorservice/TraceConnectorServiceManager.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/ConfigureMarkersDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/ImportTraceDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/NewTraceDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/SelectTracePathDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/ProviderResourceAdapter.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TargetResourceAdapter.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceAdapterFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceResourceAdapter.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelCellModifier.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelTableContentProvider.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelTableLabelProvider.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/ITCFSubSystem.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/ITraceSubSystem.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/TraceSubSystemConfiguration.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/utility/DownloadProxy.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/ConfigureTraceWizard.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/ITraceChannelConfigurationPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/TraceConfigurationPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/UstTraceChannelConfigurationPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/PerspectiveFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/AbsTRangeUpdate.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/AbsTimeUpdateView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/ParamsUpdater.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/control/ControlView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/ControlFlowView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowBeforeUpdateHandlers.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowEventToHandlerFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowFinishUpdateHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowModelFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowProcessContainer.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowTimeRangeViewerProvider.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/DistributionData.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/HorDistributionData.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/VerDistributionData.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/EventsTable.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/AbstractViewer.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/GraphViewer.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/HistogramViewer.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/LatencyView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/AbstractDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/AddDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/DeleteDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/ListDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractMouseListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractMouseTrackListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractPaintListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/GraphMouseListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/GraphPaintListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/HistogramPaintListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/TimePointerListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/TooltipListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/ZoomListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/Config.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/GraphScaledData.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/IGraphDataModel.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/IGraphModelListener.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyController.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyEventRequest.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyGraphModel.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/ResourcesView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesAfterUpdateHandlers.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesBeforeUpdateHandlers.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesEventToHandlerFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesFinishUpdateHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourceContainer.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourceModelFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourcesTimeRangeViewerProvider.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/StatisticsView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/AbstractStatsEventHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsModeChangeHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsModeEndHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsProcessExitHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlerFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlers.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTracesetEndHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/FixedArray.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/KernelStatisticsData.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/Statistics.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsData.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsTreeNode.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsTreeRootFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/SpinnerGroup.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/TimeFrameView.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/Activator.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUILogger.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/ITimeRangeComponent.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/ItemContainer.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEvent.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/NewLTTngProjectMainWizardPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/NewLTTngProjectWizard.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/TraceLibraryPathPropertyPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/TraceLibraryPathWizardPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/TraceControlConstants.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureMarkers.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/CreateNewTrace.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/DeleteTrace.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ImportToProject.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/PauseTrace.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/StartTrace.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/StopTrace.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/connectorservice/TraceConnectorService.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/connectorservice/TraceConnectorServiceManager.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/ConfigureMarkersDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/ImportTraceDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/NewTraceDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/SelectTracePathDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/ProviderResourceAdapter.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TargetResourceAdapter.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TraceAdapterFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TraceResourceAdapter.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelCellModifier.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelTableContentProvider.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelTableLabelProvider.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/ITCFSubSystem.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/ITraceSubSystem.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystemConfiguration.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/utility/DownloadProxy.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/ConfigureTraceWizard.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/ITraceChannelConfigurationPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/TraceConfigurationPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/UstTraceChannelConfigurationPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/ControlView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowBeforeUpdateHandlers.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowEventToHandlerFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowFinishUpdateHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowModelFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowTimeRangeViewerProvider.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/DistributionData.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/HorDistributionData.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/VerDistributionData.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsTable.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/AbstractViewer.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/GraphViewer.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/HistogramViewer.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/LatencyView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AbstractDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractMouseListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractMouseTrackListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractPaintListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/GraphMouseListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/GraphPaintListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/HistogramPaintListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/TimePointerListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/TooltipListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/ZoomListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/Config.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/GraphScaledData.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/IGraphDataModel.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/IGraphModelListener.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyController.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyEventRequest.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyGraphModel.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesAfterUpdateHandlers.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesBeforeUpdateHandlers.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesEventToHandlerFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesFinishUpdateHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceModelFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourcesTimeRangeViewerProvider.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/AbstractStatsEventHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsModeChangeHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsModeEndHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsProcessExitHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlerFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlers.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTracesetEndHandler.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Statistics.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeRootFactory.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/messages.properties [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/Messages.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/messages.properties [deleted file]

index 36c382d76b18e3a092712e3cd18d21648d5b2970..38f5653cbf6c8679d1a2f90e6d64854c2af802f0 100644 (file)
@@ -2,10 +2,10 @@ package org.eclipse.linuxtools.lttng.ui.tests.distribution;
 
 import junit.framework.TestCase;
 
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.Config;
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.GraphScaledData;
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener;
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyGraphModel;
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.Config;
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.GraphScaledData;
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.IGraphModelListener;
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.LatencyGraphModel;
 
 @SuppressWarnings("nls")
 public class LatencyGraphModelTest extends TestCase {
index 6e0795f130fabaeaa9396d4d57b6460266675b8b..7cb60a3171ccab6325c916ab293c018fe11d5907 100644 (file)
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng.ui;singleton:=true
 Bundle-Version: 0.5.0.qualifier
-Bundle-Activator: org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin
+Bundle-Activator: org.eclipse.linuxtools.lttng.ui.Activator
 Bundle-Vendor: %Bundle-Vendor
 Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
  org.eclipse.ui.ide;bundle-version="3.7.0",
@@ -21,33 +21,34 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Bundle-Localization: plugin
-Export-Package: org.eclipse.linuxtools.lttng.ui;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.model.trange;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.connectorservice;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.utility;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.common;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.control;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.controlflow;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.controlflow.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.distribution.model,
- org.eclipse.linuxtools.lttng.ui.views.events;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.latency;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.latency.dialogs;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.latency.listeners;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.latency.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.resources;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.resources.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.statistics;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.statistics.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
- org.eclipse.linuxtools.lttng.ui.views.timeframe;x-friends:="org.eclipse.linuxtools.lttng.ui.tests"
+Export-Package: org.eclipse.linuxtools.lttng.ui,
+ org.eclipse.linuxtools.internal.lttng.ui;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.model.trange;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.connectorservice;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.utility;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.common;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.control;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.controlflow;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.events;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.latency;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.resources;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.resources.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.statistics;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests",
+ org.eclipse.linuxtools.internal.lttng.ui.views.timeframe;x-friends:="org.eclipse.linuxtools.lttng.ui.tests"
index 127cc70f7c29d1fd57993d8026d550f14af512f3..205470c14cbde21f2e81f1e01119b34c38ab482a 100644 (file)
@@ -5,7 +5,7 @@
          id="org.eclipse.linuxtools.lttng.ui.perspective"
          point="org.eclipse.ui.perspectives">
       <perspective
-            class="org.eclipse.linuxtools.lttng.ui.views.PerspectiveFactory"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.PerspectiveFactory"
             icon="icons/obj16/garland16.png"
             id="org.eclipse.linuxtools.lttng.ui.perspective"
             name="%perspective.category.name">
@@ -21,7 +21,7 @@
       <view
             allowMultiple="false"
             category="org.eclipse.linuxtools.lttng.ui.views.category"
-            class="org.eclipse.linuxtools.lttng.ui.views.control.ControlView"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.control.ControlView"
             icon="icons/eview16/control_view.gif"
             id="org.eclipse.linuxtools.lttng.ui.views.control"
             name="%control.view.name"
@@ -30,7 +30,7 @@
       <view
             allowMultiple="false"
             category="org.eclipse.linuxtools.lttng.ui.views.category"
-            class="org.eclipse.linuxtools.lttng.ui.views.timeframe.TimeFrameView"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.timeframe.TimeFrameView"
             icon="icons/eview16/time_frame_view.gif"
             id="org.eclipse.linuxtools.lttng.ui.views.timeframe"
             name="%timeframe.view.name"
@@ -39,7 +39,7 @@
       <view
             allowMultiple="false"
             category="org.eclipse.linuxtools.lttng.ui.views.category"
-            class="org.eclipse.linuxtools.lttng.ui.views.controlflow.ControlFlowView"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.ControlFlowView"
             icon="icons/eview16/control_flow_view.gif"
             id="org.eclipse.linuxtools.lttng.ui.views.controlflow"
             name="%controlflow.view.name"
@@ -48,7 +48,7 @@
       <view
             allowMultiple="false"
             category="org.eclipse.linuxtools.lttng.ui.views.category"
-            class="org.eclipse.linuxtools.lttng.ui.views.resources.ResourcesView"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.resources.ResourcesView"
             icon="icons/eview16/resources_view.gif"
             id="org.eclipse.linuxtools.lttng.ui.views.resources"
             name="%resources.view.name"
@@ -57,7 +57,7 @@
       <view
             allowMultiple="false"
             category="org.eclipse.linuxtools.lttng.ui.views.category"
-            class="org.eclipse.linuxtools.lttng.ui.views.statistics.StatisticsView"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.statistics.StatisticsView"
             icon="icons/eview16/statistics_view.gif"
             id="org.eclipse.linuxtools.lttng.ui.views.statistics"
             name="%statistics.view.name"
@@ -66,7 +66,7 @@
       <view
             allowMultiple="false"
             category="org.eclipse.linuxtools.lttng.ui.views.category"
-            class="org.eclipse.linuxtools.lttng.ui.views.latency.LatencyView"
+            class="org.eclipse.linuxtools.internal.lttng.ui.views.latency.LatencyView"
             icon="icons/eview16/graph.gif"
             id="org.eclipse.linuxtools.lttng.ui.views.latency"
             name="%latency.view.name"
@@ -81,7 +81,7 @@
       </category>
       <wizard
             category="org.eclipse.linuxtools.lttng.ui.wizards.new"
-            class="org.eclipse.linuxtools.lttng.ui.project.dialogs.NewLTTngProjectWizard"
+            class="org.eclipse.linuxtools.internal.lttng.ui.project.dialogs.NewLTTngProjectWizard"
             descriptionImage="icons/obj16/garland16.png"
             finalPerspective="org.eclipse.linuxtools.lttng.ui.perspective"
             icon="icons/obj16/garland16.png"
              id="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.deletetrace"
              objectClass="org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource">
           <action
-                class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.DeleteTrace"
+                class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.DeleteTrace"
                 enablesFor="*"
                 icon="icons/elcl16/delete_trace.gif"
                 id="actions.trace.delete"
              id="org.eclipse.linuxtools.lttng.ui.tracecontrol.importtrace"
              objectClass="org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource">
           <action
-                class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.ImportToProject"
+                class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.ImportToProject"
                 enablesFor="*"
                 icon="icons/elcl16/import_trace.gif"
                 id="org.eclipse.linuxtools.lttng.ui.tracecontrol.action1"
                    label="%action.newtrace.label"
                    tooltip="%action.newtrace.tooltip"
                    icon="icons/elcl16/new_trace.gif"
-                   class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.CreateNewTrace"
+                   class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.CreateNewTrace"
                    menubarPath="additions"
                    enablesFor="1"
                    id="actions.trace.new">
                    label="%action.configuretrace.label"
                    tooltip="%action.configuretrace.tooltip"
                    icon="icons/elcl16/configure_trace.gif"
-                   class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.ConfigureTrace"
+                   class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.ConfigureTrace"
                    menubarPath="additions"
                    enablesFor="1"
                    id="actions.trace.configure">
              id="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.stoptrace"
              objectClass="org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource">
           <action
-                class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.StopTrace"
+                class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.StopTrace"
                 enablesFor="*"
                 icon="icons/elcl16/stop_trace.gif"
                 id="actions.trace.stop"
              id="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.pausetrace"
              objectClass="org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource">
           <action
-                class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.PauseTrace"
+                class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.PauseTrace"
                 enablesFor="*"
                 icon="icons/elcl16/pause_trace.gif"
                 id="actions.trace.pause"
                objectClass="org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource"
                id="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.starttrace">
            <action
-                 class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.StartTrace"
+                 class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.StartTrace"
                  enablesFor="*"
                  icon="icons/elcl16/start_trace.gif"
                  id="actions.trace.start"
                    label="%action.configuremarkers.label"
                    tooltip="%action.configuremarkers.tooltip"
                    icon="icons/elcl16/configure_markers.gif"
-                   class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.ConfigureMarkers"
+                   class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.ConfigureMarkers"
                    menubarPath="additions"
                    enablesFor="1"
                    id="actions.markers.configure">
             id="org.eclipse.linuxtools.lttng.ui.tracecontrol.viewContribution.stop"
             targetID="org.eclipse.rse.ui.view.systemView">
          <action
-               class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.StopTrace"
+               class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.StopTrace"
                enablesFor="*"
                icon="icons/elcl16/stop_trace.gif"
                id="actions.trace.stop"
             id="org.eclipse.linuxtools.lttng.ui.tracecontrol.viewContribution.pause"
             targetID="org.eclipse.rse.ui.view.systemView">
          <action
-               class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.PauseTrace"
+               class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.PauseTrace"
                enablesFor="*"
                icon="icons/elcl16/pause_trace.gif"
                id="actions.trace.pause"
             id="org.eclipse.linuxtools.lttng.ui.tracecontrol.viewContribution.start"
             targetID="org.eclipse.rse.ui.view.systemView">
          <action
-               class="org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.StartTrace"
+               class="org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.StartTrace"
                enablesFor="*"
                icon="icons/elcl16/start_trace.gif"
                id="actions.trace.start"
    <extension
          point="org.eclipse.ui.propertyPages">
       <page
-            class="org.eclipse.linuxtools.lttng.ui.project.dialogs.TraceLibraryPathPropertyPage"
+            class="org.eclipse.linuxtools.internal.lttng.ui.project.dialogs.TraceLibraryPathPropertyPage"
             id="org.eclipse.linuxtools.lttng.ui.propertyPage.libPath"
             name="%project.propertyPage.tracelibPath">
          <filter name="nature"
             name="%tracetype.type.kernel"
             trace_type="org.eclipse.linuxtools.internal.lttng.core.trace.LTTngTrace">
          <eventsTableType
-               class="org.eclipse.linuxtools.lttng.ui.views.events.EventsTable">
+               class="org.eclipse.linuxtools.internal.lttng.ui.views.events.EventsTable">
          </eventsTableType>
       </type>
    </extension>
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/LTTngUILogger.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/LTTngUILogger.java
new file mode 100644 (file)
index 0000000..8be34cb
--- /dev/null
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui;
+
+import org.eclipse.linuxtools.lttng.ui.Activator;
+
+/**
+ * <b><u>LTTngUILogger</u></b>
+ * <p>
+ * A logging utility 
+ */
+public class LTTngUILogger {
+
+       public static void logInfo(String message) {
+               Activator.getDefault().getLogger().logInfo(message);
+       }
+
+       public static void logWarning(String message) {
+               Activator.getDefault().getLogger().logWarning(message);
+       }
+
+       public static void logError(Throwable exception) {
+               logError("Unexpected exception", exception); //$NON-NLS-1$
+       }
+
+       public static void logError(String message, Throwable exception) {
+               Activator.getDefault().getLogger().logError(message, exception);
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/TraceDebug.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/TraceDebug.java
new file mode 100644 (file)
index 0000000..d2872e3
--- /dev/null
@@ -0,0 +1,228 @@
+package org.eclipse.linuxtools.internal.lttng.ui;\r
+\r
+\r
+import java.io.FileWriter;\r
+import java.io.IOException;\r
+import java.io.PrintWriter;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Date;\r
+\r
+import org.eclipse.core.runtime.ILog;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.core.runtime.Plugin;\r
+import org.eclipse.core.runtime.Status;\r
+import org.eclipse.linuxtools.lttng.ui.Activator;\r
+\r
+@SuppressWarnings("nls")\r
+public class TraceDebug {\r
+    static boolean DEBUG = false;\r
+    static boolean INFO = false;\r
+    static boolean WARN = false;\r
+\r
+    static boolean CFV = false;\r
+    static boolean RV = false;\r
+    static boolean SV = false;\r
+\r
+    private static Plugin plugin = Activator.getDefault();\r
+    private static String pluginID = Activator.PLUGIN_ID;\r
+    private static SimpleDateFormat stimeformat = new SimpleDateFormat("HH:mm:ss:SSS");\r
+\r
+    // Note: files are created in $HOME\r
+    static private PrintWriter fCFVfile = null;\r
+    static private PrintWriter fRVfile = null;\r
+    static private PrintWriter fSVfile = null;\r
+\r
+    public static void init() {\r
+        // Update Trace configuration options\r
+        String debugTrace = Platform.getDebugOption(pluginID + "/debug");\r
+        String infoTrace = Platform.getDebugOption(pluginID + "/info");\r
+        String warnTrace = Platform.getDebugOption(pluginID + "/warn");\r
+\r
+        if (debugTrace != null) {\r
+            DEBUG = Boolean.valueOf(debugTrace);\r
+        }\r
+\r
+        if (infoTrace != null) {\r
+            INFO = Boolean.valueOf(infoTrace);\r
+        }\r
+\r
+        if (warnTrace != null) {\r
+            WARN = Boolean.valueOf(warnTrace);\r
+        }\r
+\r
+        String cfvTrace = Platform.getDebugOption(pluginID + "/cfv");\r
+        if (cfvTrace != null) {\r
+            CFV = Boolean.valueOf(cfvTrace);\r
+            if (CFV) {\r
+                try {\r
+                    fCFVfile = new PrintWriter(new FileWriter("CFVTrace.txt"));\r
+                } catch (IOException e) {\r
+                    e.printStackTrace();\r
+                }\r
+            }\r
+        }\r
+\r
+        String rvTrace = Platform.getDebugOption(pluginID + "/rv");\r
+        if (rvTrace != null) {\r
+            RV = Boolean.valueOf(rvTrace);\r
+            if (RV) {\r
+                try {\r
+                    fRVfile = new PrintWriter(new FileWriter("RVTrace.txt"));\r
+                } catch (IOException e) {\r
+                    e.printStackTrace();\r
+                }\r
+            }\r
+        }\r
+\r
+        String svTrace = Platform.getDebugOption(pluginID + "/sv");\r
+        if (svTrace != null) {\r
+            SV = Boolean.valueOf(svTrace);\r
+            if (SV) {\r
+                try {\r
+                    fSVfile = new PrintWriter(new FileWriter("SVTrace.txt"));\r
+                } catch (IOException e) {\r
+                    e.printStackTrace();\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    public static void stop() {\r
+        if (fCFVfile != null) {\r
+            fCFVfile.close();\r
+            fCFVfile = null;\r
+        }\r
+\r
+        if (fRVfile != null) {\r
+            fRVfile.close();\r
+            fRVfile = null;\r
+        }\r
+\r
+        if (fSVfile != null) {\r
+            fSVfile.close();\r
+            fSVfile = null;\r
+        }\r
+    }\r
+\r
+    public static void traceCFV(String trace) {\r
+        if (CFV && fCFVfile != null) {\r
+            fCFVfile.println(trace);\r
+            fCFVfile.flush();\r
+        }\r
+    }\r
+\r
+    public static void traceRV(String trace) {\r
+        if (RV && fRVfile != null) {\r
+            fRVfile.println(trace);\r
+            fRVfile.flush();\r
+        }\r
+    }\r
+\r
+    public static void traceSV(String trace) {\r
+        if (SV && fSVfile != null) {\r
+            fSVfile.println(trace);\r
+            fSVfile.flush();\r
+        }\r
+    }\r
+\r
+    public static void info(String message) {\r
+        if (INFO) {\r
+            ILog logger = plugin.getLog();\r
+            logger.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, IStatus.OK, message, null));\r
+        }\r
+    }\r
+\r
+    public static void warn(String message) {\r
+        if (WARN) {\r
+            ILog logger = plugin.getLog();\r
+            logger.log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, IStatus.WARNING, message, null));\r
+        }\r
+    }\r
+\r
+    public static void debug(String message) {\r
+        if (DEBUG) {\r
+            String location = getCallingLocation();\r
+            System.out.println(location + "\n\t-> " + message);\r
+\r
+        }\r
+    }\r
+\r
+    public static void debug(String message, int additionalStackLines) {\r
+        if (DEBUG) {\r
+            String location = getCallingLocation(additionalStackLines);\r
+            System.out.println(location + "\n\t-> " + message);\r
+        }\r
+    }\r
+\r
+    public static void throwException(String message) {\r
+        if (DEBUG) {\r
+            try {\r
+                triggerException(message);\r
+            } catch (Exception e) {\r
+                e.printStackTrace();\r
+            }\r
+        }\r
+    }\r
+\r
+    private static void triggerException(String message) throws Exception {\r
+        throw new Exception(message);\r
+    }\r
+\r
+    private static String getCallingLocation() {\r
+        StringBuilder sb = new StringBuilder();\r
+        sb.append(trace(Thread.currentThread().getStackTrace(), 4));\r
+        sb.append("\n" + trace(Thread.currentThread().getStackTrace(), 3));\r
+        return sb.toString();\r
+    }\r
+\r
+    private static String getCallingLocation(int numOfStackLines) {\r
+        int stackCalledFromIdx = 3;\r
+        int earliestRequested = numOfStackLines > 0 ? stackCalledFromIdx + numOfStackLines : stackCalledFromIdx;\r
+        StringBuilder sb = new StringBuilder();\r
+        for (int i = earliestRequested; i >= stackCalledFromIdx; i--) {\r
+            sb.append(trace(Thread.currentThread().getStackTrace(), i) + "\n");\r
+        }\r
+        return sb.toString();\r
+    }\r
+\r
+    private static String trace(StackTraceElement e[], int level) {\r
+        if (e != null) {\r
+            level = level >= e.length ? e.length - 1 : level;\r
+            StackTraceElement s = e[level];\r
+            if (s != null) {\r
+                String simpleClassName = s.getClassName();\r
+                String[] clsNameSegs = simpleClassName.split("\\.");\r
+                if (clsNameSegs.length > 0)\r
+                    simpleClassName = clsNameSegs[clsNameSegs.length - 1];\r
+                return stimeformat.format(new Date()) + " " + simpleClassName + "." + s.getLineNumber() + "." + s.getMethodName();\r
+            }\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    public static boolean isDEBUG() {\r
+        return DEBUG;\r
+    }\r
+\r
+    public static boolean isINFO() {\r
+        return INFO;\r
+    }\r
+\r
+    public static boolean isWARN() {\r
+        return WARN;\r
+    }\r
+\r
+    public static boolean isCFV() {\r
+        return CFV;\r
+    }\r
+\r
+    public static boolean isRV() {\r
+        return RV;\r
+    }\r
+\r
+    public static boolean isSV() {\r
+        return SV;\r
+    }\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/ITimeRangeComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/ITimeRangeComponent.java
new file mode 100644 (file)
index 0000000..53b711e
--- /dev/null
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;
+
+/**
+ * The common component of the Composite related to time-range events its
+ * components or containers
+ * 
+ * @author alvaro
+ * 
+ */
+public interface ITimeRangeComponent {
+
+       public long getStartTime();
+
+       public void setStartTime(long startTime);
+
+       public long getStopTime();
+
+       public void setStopTime(long endTime);
+
+       public ITimeRangeComponent getEventParent();
+
+       public String getName();
+
+       /**
+        * Flag to indicate if this Time Range is visible within the GUI, May not be
+        * visible if the duration can not be represented in one pixel
+        * 
+        * @return true if visible i.e. represented at least in one pixel
+        */
+       public boolean isVisible();
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/ItemContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/ItemContainer.java
new file mode 100644 (file)
index 0000000..6349e97
--- /dev/null
@@ -0,0 +1,53 @@
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;
+
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+
+public interface ItemContainer<T extends ITmfTimeAnalysisEntry> {
+
+       /**
+        * Interface to add resources.
+        * 
+        * @param process
+        */
+       public abstract void addItem(T newItem);
+
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       /**
+        * Request a unique ID
+        * 
+        * @return Integer
+        */
+       public abstract Integer getUniqueId();
+
+       /**
+        * This method is intended for read only purposes in order to keep the
+        * internal data structure in Synch
+        * 
+        * @return
+        */
+       public abstract T[] readItems();
+
+       /**
+        * Clear the children information for resources related to a specific trace
+        * e.g. just before refreshing data with a new time range
+        * 
+        * @param traceId
+        */
+       public abstract void clearChildren();
+
+       /**
+        * Clear all resources items e.g. when a new experiment is selected
+        */
+       public abstract void clearItems();
+
+       /**
+        * Remove the resources related to a specific trace e.g. during trace
+        * removal
+        * 
+        * @param traceId
+        */
+       public abstract void removeItems(String traceId);
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/Messages.java
new file mode 100644 (file)
index 0000000..42b170b
--- /dev/null
@@ -0,0 +1,20 @@
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.model.trange.messages"; //$NON-NLS-1$
+    public static String TimeRangeViewerProvider_BadRangeExtraInfo;
+    public static String TimeRangeViewerProvider_EndTime;
+    public static String TimeRangeViewerProvider_ProcessType;
+    public static String TimeRangeViewerProvider_StartTime;
+    public static String TimeRangeViewerProvider_UndefinedEndTime;
+    public static String TimeRangeViewerProvider_UndefinedStartTime;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeComponent.java
new file mode 100644 (file)
index 0000000..28be1ae
--- /dev/null
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;
+
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+
+
+/**
+ * @author alvaro
+ * 
+ */
+public abstract class TimeRangeComponent implements ITimeRangeComponent, ITimeEvent {
+
+       // ========================================================================
+       // Data
+       // =======================================================================
+       protected Long startTime = 0L;
+       protected Long stopTime = Long.MAX_VALUE;
+       protected TimeRangeComposite eventParent = null;
+       private boolean visible = true;
+       
+
+
+       // ========================================================================
+       // Constructor
+       // =======================================================================
+       public TimeRangeComponent(Long stime, Long etime,
+                       TimeRangeComposite eventParent) {
+               this.startTime = stime;
+               this.stopTime = etime;
+               this.eventParent = eventParent;
+       }
+
+       // ========================================================================
+       // Methods
+       // =======================================================================
+       /**
+        * This method shall not be used to estimate the starting drawing point of
+        * the time range-event. see interface method getTime(). However this method
+        * can be used to retrieve the tool tip information where we need to reflect
+        * that the actual start of this event is unknown
+        * 
+        * @param time
+        */
+       @Override
+       public long getStartTime() {
+               return startTime.longValue();
+       }
+
+       @Override
+       public void setStartTime(long time) {
+               if (time > -1) {
+                       startTime = time;
+               }
+       }
+
+       @Override
+       public long getStopTime() {
+               return stopTime.longValue();
+       }
+
+       @Override
+       public void setStopTime(long stopTime) {
+               if (stopTime > -1) {
+                       this.stopTime = stopTime;
+               }
+       }
+
+       @Override
+       public ITimeRangeComponent getEventParent() {
+               return eventParent;
+       }
+
+       public void setEventParent(TimeRangeComposite eventParent) {
+               this.eventParent = eventParent;
+       }
+
+       @Override
+       public abstract String getName();
+
+       
+       public void setVisible(boolean visible) {
+               this.visible = visible;
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.model.trange.ITimeRangeComponent#isVisible()
+        */
+       @Override
+       public boolean isVisible() {
+               return visible;
+       }
+
+       @Override
+       public ITmfTimeAnalysisEntry getEntry() {
+               return eventParent;
+       }
+
+       @Override
+       public long getTime() {
+               return startTime;
+       }
+
+       @Override
+       public long getDuration() {
+               return stopTime - startTime;
+       }
+
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+               return "[TimeRangeComponent:" + "startTime=" + startTime + ",stopTime=" + stopTime +
+               ",parent=" + (eventParent != null ? eventParent.id : "null") + "]";
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeComposite.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeComposite.java
new file mode 100644 (file)
index 0000000..86ebac3
--- /dev/null
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+
+public class TimeRangeComposite extends TimeRangeComponent implements
+ITmfTimeAnalysisEntry {
+
+       // ========================================================================
+       // Data
+       // =======================================================================
+       /**
+        * Type of Composites or Containers
+        * <p>
+        * PROPERTY: Refers to a sub-composite of a RESOURCE or a PROCESS e.g the
+        * cpu which can vary over time and can have time range events associated to
+        * it, and at the same time PROPERTY is associated to a Composite parent
+        * like a PROCESS
+        * </p>
+        * <p>
+        * PROCESS: A composite of time range events representing a Process
+        * </p>
+        * <p>
+        * RESOURCE: A composite of time range events representing a resource i.g.
+        * irq, softIrq, trap, bdev, cpu
+        * </p>
+        * 
+        * @author alvaro
+        * 
+        */
+       public static enum CompositeType {
+               UNKNOWN, PROPERTY, PROCESS, RESOURCE
+       }
+
+       protected final Vector<TimeRangeComponent> ChildEventLeafs = new Vector<TimeRangeComponent>();
+       protected final Vector<TimeRangeComponent> ChildEventComposites = new Vector<TimeRangeComponent>();
+       protected Integer id = 0;
+       protected String name;
+       protected String groupName = ""; //$NON-NLS-1$
+       protected String className = ""; //$NON-NLS-1$
+       protected CompositeType contType = CompositeType.UNKNOWN;
+       protected Long next_good_time = -1L;
+       /*Time of first event which trigger the creation of this local resource */
+       protected Long insertionTime = -1L; 
+
+       // ========================================================================
+       // Constructors
+       // =======================================================================
+       public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
+                       CompositeType type, long insertionTime) {
+               super(stime, etime, null);
+               this.id = id;
+               this.name = name;
+               contType = type;
+               this.insertionTime = insertionTime;
+               // Adjust the first good drawing position to the event time creating this resource
+               next_good_time = insertionTime;
+       }
+
+       public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
+                       String groupName, String className, CompositeType type,
+                       long insertionTime) {
+               this(id, stime, etime, name, type, insertionTime);
+               this.groupName = groupName;
+               this.className = className;
+    }
+       
+       // ========================================================================
+       // Methods
+       // =======================================================================
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent#getName()
+        */
+       @Override
+       public String getName() {
+               return name;
+       }
+
+       /**
+        * @param name
+        */
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry#getGroupName()
+        */
+       @Override
+       public String getGroupName() {
+               return groupName;
+       }
+
+       /**
+        * @param groupName
+        */
+       public void setGroupName(String groupName) {
+               this.groupName = groupName;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry#getId()
+        */
+       @Override
+       public int getId() {
+               return id;
+       }
+
+       /**
+        * @param id
+        */
+       public void setId(int id) {
+               this.id = id;
+       }
+
+       /**
+        * @return
+        */
+       public String getClassName() {
+               return className;
+       }
+
+       /**
+        * @param className
+        */
+       public void setClassName(String className) {
+               this.className = className;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry#getTraceEvents()
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       @Deprecated public Vector<TimeRangeComponent> getTraceEvents() {
+               return ChildEventLeafs;
+       }
+
+       @Override
+       @SuppressWarnings("unchecked")
+       public Iterator<TimeRangeComponent> getTraceEventsIterator() {
+               Vector<TimeRangeComponent> clone = (Vector<TimeRangeComponent>) ChildEventLeafs.clone();
+               return clone.iterator();
+       }
+
+       @Override
+       @SuppressWarnings("unchecked")
+       public Iterator<TimeRangeComponent> getTraceEventsIterator(long startTime, long stopTime, long visibleDuration) {
+               return getTraceEventsIterator();
+       }
+
+       @Override
+       public void addTraceEvent(ITimeEvent event) {
+               if (event instanceof TimeRangeComponent) {
+                       ChildEventLeafs.add((TimeRangeComponent) event);
+               }
+       }
+
+    /**
+        * @return
+        */
+       public Vector<TimeRangeComponent> getChildEventComposites() {
+               return ChildEventComposites;
+       }
+
+       /**
+        * Represents the time where the next time range can start the drawing i.e.
+        * right after previous time range.
+        * 
+        * @return
+        */
+       public long getNext_good_time() {
+               return next_good_time;
+       }
+
+       /**
+        * Represents the time where the next time range can start the drawing i.e.
+        * right after previous time range.
+        * 
+        * @param nextGoodTime
+        */
+       public void setNext_good_time(long nextGoodTime) {
+               next_good_time = nextGoodTime;
+       }
+
+       /**
+        * Reset this resource to the construction state
+        */
+       public void reset() {
+               getChildEventComposites().clear();
+               getTraceEvents().clear();
+               next_good_time = insertionTime;
+       }
+
+       /**
+        * Event Time reflecting the creation of this local resource e.g. at Reception of Fork, etc.
+        * 
+        * @return
+        */
+       public long getInsertionTime() {
+               return insertionTime;
+       }
+
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+               return "[TimeRangeComposite:" + super.toString() +
+               ",id=" + id + ",name=" + name + ",group=" + groupName + ",class=" + className +
+               ",ctype=" + contType + ",itime=" + insertionTime + 
+               ",leaves=" + ChildEventLeafs + ",composites=" + ChildEventComposites + "]";
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEvent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEvent.java
new file mode 100644 (file)
index 0000000..e04fd81
--- /dev/null
@@ -0,0 +1,159 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
+ *******************************************************************************/\r
+\r
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;\r
+\r
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;\r
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
+\r
+/**\r
+ * @author alvaro\r
+ * \r
+ */\r
+public class TimeRangeEvent extends TimeRangeComponent implements ITimeEvent {\r
+       // =======================================================================\r
+       // Data\r
+       // =======================================================================\r
+       TimeRangeComposite parent = null;\r
+\r
+       public static enum Type {\r
+               UNKNOWN, PROPERTY, PROCESS_MODE, BDEV_MODE, TRAP_MODE, SOFT_IRQ_MODE, IRQ_MODE, CPU_MODE\r
+       }\r
+\r
+       protected Type eventType = Type.UNKNOWN;\r
+       protected String stateMode = ""; //$NON-NLS-1$\r
+\r
+       // =======================================================================\r
+       // Constructors\r
+       // =======================================================================\r
+       /**\r
+        * @param stime\r
+        *            Event Start Time (may be unknown)\r
+        * @param etime\r
+        *            Event EndTime (may be unknown)\r
+        * @param eventParent\r
+        * @param type\r
+        * @param duration\r
+        */\r
+       public TimeRangeEvent(Long stime, Long etime,\r
+                       TimeRangeComposite eventParent, Type type, String stateMode) {\r
+               super(stime, etime, eventParent);\r
+               parent = eventParent;\r
+               this.eventType = type;\r
+               this.stateMode = stateMode;\r
+       }\r
+\r
+       // =======================================================================\r
+       // Methods\r
+       // =======================================================================\r
+       \r
+       // @Override\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see\r
+        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getTime\r
+        * ()\r
+        */\r
+       @Override\r
+       public long getTime() {\r
+               // The value provided by this method is used to start drawing the\r
+               // time-range,\r
+               // so a null value shall not be provided.\r
+               // If the actual start time is unknown then use the start of the Trace\r
+               // as the\r
+               // starting reference point.\r
+               if (startTime == null) {\r
+                       return eventParent.getStartTime();\r
+               }\r
+               return startTime;\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see\r
+        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getEntry\r
+        * ()\r
+        */\r
+       @Override\r
+       public ITmfTimeAnalysisEntry getEntry() {\r
+               return parent;\r
+       }\r
+\r
+       /**\r
+        * return the duration between end and start time , if the start time or end\r
+        * time are unknown, use the Trace start and End times to estimate it, this\r
+        * value will be used to draw the time range and need to provide a valid\r
+        * time width.\r
+        * \r
+        * @return the duration\r
+        */\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#\r
+        * getDuration()\r
+        */\r
+       @Override\r
+       public long getDuration() {\r
+               long duration = -1;\r
+               long endT = (stopTime == null) ? parent.getStopTime() : stopTime;\r
+               long startT = (startTime == null) ? parent.getStartTime() : startTime;\r
+\r
+               if (endT > startT) {\r
+                       return stopTime - startTime;\r
+               }\r
+               return duration;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public String getStateMode() {\r
+               return stateMode;\r
+       }\r
+\r
+       /**\r
+        * @param stateMode\r
+        */\r
+       public void setStateMode(String stateMode) {\r
+               if (stateMode != null) {\r
+                       this.stateMode = stateMode;\r
+               }\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see org.eclipse.linuxtools.lttng.ui.model.ITimeRangeComponent#getName()\r
+        */\r
+       @Override\r
+       public String getName() {\r
+               return stateMode;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public Type getEventType() {\r
+               return eventType;\r
+       }\r
+\r
+       /**\r
+        * @param eventType\r
+        */\r
+       public void setEventType(Type eventType) {\r
+               this.eventType = eventType;\r
+       }\r
+\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEventProcess.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEventProcess.java
new file mode 100644 (file)
index 0000000..2c8b78d
--- /dev/null
@@ -0,0 +1,324 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;\r
+\r
+public class TimeRangeEventProcess extends TimeRangeComposite implements\r
+               Comparable<TimeRangeEventProcess> {\r
+       // ========================================================================\r
+       // Data\r
+       // =======================================================================\r
+       // GUI information\r
+       private Long pid = 0L;\r
+       private Long tgid = 0L;\r
+       private Long ppid = 0L;\r
+       private Long creationTime = 0L;\r
+       private String traceID = ""; //$NON-NLS-1$\r
+       private String processType = "User"; // Kernel or user thread //$NON-NLS-1$\r
+       private Long cpu = 0L;\r
+       private String brand = ""; //$NON-NLS-1$\r
+\r
+       // ========================================================================\r
+       // Constructor\r
+       // =======================================================================\r
+       /**\r
+        * @param id\r
+        * @param name\r
+        * @param sTime\r
+        *            normally set to the Trace start time\r
+        * @param stopTime\r
+        *            normally set to the Trace end time\r
+        * @param groupName\r
+        * @param className\r
+        */\r
+       public TimeRangeEventProcess(int id, String name, long startTime,\r
+                       long stopTime, String groupName, String className, Long cpu,\r
+                       long insertionTime) {\r
+\r
+               super(id, startTime, stopTime, name, CompositeType.PROCESS,\r
+                               insertionTime);\r
+               this.cpu = cpu;\r
+       }\r
+\r
+       // ========================================================================\r
+       // Methods\r
+       // =======================================================================\r
+       \r
+       \r
+       /**\r
+     * Interface to add children to this process\r
+     * \r
+     * @param newEvent\r
+     */\r
+    public void addChildren(TimeRangeEvent newEvent) {\r
+        if ((newEvent != null)) {\r
+            this.ChildEventLeafs.add(newEvent);\r
+        }\r
+    }\r
+       \r
+       /**\r
+        * @return\r
+        */\r
+       public Long getPid() {\r
+               return pid;\r
+       }\r
+\r
+       /**\r
+        * @param pid\r
+        */\r
+       public void setPid(Long pid) {\r
+               this.pid = pid;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public Long getTgid() {\r
+               return tgid;\r
+       }\r
+\r
+       /**\r
+        * @param tgid\r
+        */\r
+       public void setTgid(Long tgid) {\r
+               this.tgid = tgid;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public Long getPpid() {\r
+               return ppid;\r
+       }\r
+\r
+       /**\r
+        * @param ppid\r
+        */\r
+       public void setPpid(Long ppid) {\r
+               this.ppid = ppid;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public Long getCreationTime() {\r
+               return creationTime;\r
+       }\r
+\r
+       /**\r
+        * @param creationTime\r
+        */\r
+       public void setCreationTime(Long creationTime) {\r
+               this.creationTime = creationTime;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public String getTraceID() {\r
+               return traceID;\r
+       }\r
+\r
+       /**\r
+        * @param traceID\r
+        */\r
+       public void setTraceID(String traceID) {\r
+               if (traceID != null) {\r
+                       this.traceID = traceID;\r
+               } else {\r
+                       this.traceID = ""; //$NON-NLS-1$\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public String getProcessType() {\r
+               return processType;\r
+       }\r
+\r
+       /**\r
+        * @param processType\r
+        */\r
+       public void setProcessType(String processType) {\r
+               if (processType != null) {\r
+                       this.processType = processType;\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public Long getCpu() {\r
+               return cpu;\r
+       }\r
+\r
+       /**\r
+        * @param cpu\r
+        */\r
+       public void setCpu(Long cpu) {\r
+               if (cpu != null) {\r
+                       this.cpu = cpu;\r
+               } else {\r
+                   this.cpu = 0L;\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public String getBrand() {\r
+        return brand;\r
+    }\r
+\r
+       /**\r
+        * @param brand\r
+        */\r
+    public void setBrand(String brand) {\r
+        if (brand != null) {\r
+            this.brand = brand;\r
+        } else {\r
+            brand = ""; //$NON-NLS-1$\r
+        }\r
+    }\r
+       \r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see java.lang.Comparable#compareTo(java.lang.Object)\r
+        */\r
+       @Override\r
+       public int compareTo(TimeRangeEventProcess process) {\r
+               if (process != null) {\r
+                       int result = 0;\r
+                       // first compare by pid\r
+                       Long anotherPid = process.getPid();\r
+                       result = pid.compareTo(anotherPid);\r
+                       if (result != 0) {\r
+                               return result;\r
+                       }\r
+\r
+                       // Then by CPU\r
+                       Long anotherCpu = process.getCpu();\r
+                       result = cpu.compareTo(anotherCpu);\r
+                       if (result != 0) {\r
+                               return result;\r
+                       }\r
+\r
+                       // finally by trace\r
+                       String anotherTraceId = process.getTraceID();\r
+                       return traceID.compareTo(anotherTraceId);\r
+               }\r
+\r
+               return 0;\r
+       }\r
+       \r
+    @Override\r
+    @SuppressWarnings("nls")\r
+    public String toString() {\r
+               return "[TimeRangeEventProcess:" + super.toString() +\r
+               ",pid=" + pid + ",tgid=" + tgid + ",ppid=" + ppid + ",ctime=" + creationTime +\r
+               ",trace=" + traceID + ",ptype=" + processType + ",cpu=" + cpu + ",brand=" + brand + "]";\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.lang.Object#hashCode()\r
+     */\r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + ((brand == null) ? 0 : brand.hashCode());\r
+        result = prime * result + ((cpu == null) ? 0 : cpu.hashCode());\r
+        result = prime * result + ((creationTime == null) ? 0 : creationTime.hashCode());\r
+        result = prime * result + ((pid == null) ? 0 : pid.hashCode());\r
+        result = prime * result + ((ppid == null) ? 0 : ppid.hashCode());\r
+        result = prime * result + ((processType == null) ? 0 : processType.hashCode());\r
+        result = prime * result + ((tgid == null) ? 0 : tgid.hashCode());\r
+        result = prime * result + ((traceID == null) ? 0 : traceID.hashCode());\r
+        return result;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.lang.Object#equals(java.lang.Object)\r
+     */\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+        if (!(obj instanceof TimeRangeEventProcess)) {\r
+            return false;\r
+        }\r
+        TimeRangeEventProcess other = (TimeRangeEventProcess) obj;\r
+        if (brand == null) {\r
+            if (other.brand != null) {\r
+                return false;\r
+            }\r
+        } else if (!brand.equals(other.brand)) {\r
+            return false;\r
+        }\r
+        if (cpu == null) {\r
+            if (other.cpu != null) {\r
+                return false;\r
+            }\r
+        } else if (!cpu.equals(other.cpu)) {\r
+            return false;\r
+        }\r
+        if (creationTime == null) {\r
+            if (other.creationTime != null) {\r
+                return false;\r
+            }\r
+        } else if (!creationTime.equals(other.creationTime)) {\r
+            return false;\r
+        }\r
+        if (pid == null) {\r
+            if (other.pid != null) {\r
+                return false;\r
+            }\r
+        } else if (!pid.equals(other.pid)) {\r
+            return false;\r
+        }\r
+        if (ppid == null) {\r
+            if (other.ppid != null) {\r
+                return false;\r
+            }\r
+        } else if (!ppid.equals(other.ppid)) {\r
+            return false;\r
+        }\r
+        if (processType == null) {\r
+            if (other.processType != null) {\r
+                return false;\r
+            }\r
+        } else if (!processType.equals(other.processType)) {\r
+            return false;\r
+        }\r
+        if (tgid == null) {\r
+            if (other.tgid != null) {\r
+                return false;\r
+            }\r
+        } else if (!tgid.equals(other.tgid)) {\r
+            return false;\r
+        }\r
+        if (traceID == null) {\r
+            if (other.traceID != null) {\r
+                return false;\r
+            }\r
+        } else if (!traceID.equals(other.traceID)) {\r
+            return false;\r
+        }\r
+        return true;\r
+    }\r
+\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEventResource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeEventResource.java
new file mode 100644 (file)
index 0000000..453fada
--- /dev/null
@@ -0,0 +1,185 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;\r
+\r
+\r
+/**\r
+ * @author alvaro\r
+ * \r
+ */\r
+public abstract class TimeRangeEventResource extends TimeRangeComposite\r
+               implements\r
+               Comparable<TimeRangeEventResource> {\r
+\r
+       // ========================================================================\r
+       // Data\r
+       // =======================================================================\r
+       public static enum ResourceTypes {\r
+               UNKNOWN, IRQ, TRAP, SOFT_IRQ, BDEV, CPU\r
+       }\r
+\r
+       private ResourceTypes type = ResourceTypes.UNKNOWN;\r
+       private Long resourceId = null;\r
+\r
+       // ========================================================================\r
+       // Constructor\r
+       // =======================================================================\r
+       /**\r
+        * Constructor<br>\r
+        * \r
+        * @param newId            Id used by the UI\r
+        * @param newStartTime     normally set to the Trace start time\r
+        * @param newStopTime      normally set to the Trace end time\r
+        * @param newName          the name of this resource\r
+        * @param newGroupName     the group name of this resource. Should be same as the traceId\r
+        * @param newClassName     the classname of this resource.\r
+        * @param newType          the type of the resource, as defined in the ResourceTypes enum\r
+        * @param newResourceId    the resourceId, unique id identifying this resource \r
+        * \r
+        */\r
+       public TimeRangeEventResource(int newId, long newStartTime,\r
+                       long newStopTime, String newName, String newGroupName,\r
+                       String newClassName, ResourceTypes newType, Long newResourceId,\r
+                       long insertionTime) {\r
+\r
+               super(newId, newStartTime, newStopTime, newName, newGroupName,\r
+                               newClassName, CompositeType.RESOURCE, insertionTime);\r
+\r
+               type = newType;\r
+               resourceId = newResourceId;\r
+       }\r
+\r
+       // ========================================================================\r
+       // Methods\r
+       // =======================================================================\r
+\r
+       /**\r
+        * Interface to add children to this resource\r
+        * \r
+        * @param newEvent\r
+        */\r
+       public void addChildren(TimeRangeEvent newEvent) {\r
+               if ((newEvent != null)) {\r
+                       this.ChildEventLeafs.add(newEvent);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public Long getResourceId() {\r
+               return resourceId;\r
+       }\r
+\r
+       /**\r
+        * @param newResId\r
+        */\r
+       public void setResourceId(Long newResId) {\r
+               this.resourceId = newResId;\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public ResourceTypes getType() {\r
+               return type;\r
+       }\r
+\r
+       /**\r
+        * @param type\r
+        */\r
+       public void setType(ResourceTypes type) {\r
+               this.type = type;\r
+       }\r
+\r
+       /**\r
+        * Getter for traceId.<br>\r
+        * Note : traceId and groupName are the same for EventResource\r
+        * \r
+        * @return String\r
+        */\r
+       public String getTraceId() {\r
+               return groupName;\r
+       }\r
+\r
+       /**\r
+        * Getter for traceId.<br>\r
+        * Note : traceId and groupName are the same for EventResource\r
+        * \r
+        * @return String\r
+        */\r
+       public void setTraceId(String traceId) {\r
+               this.groupName = traceId;\r
+       }\r
+\r
+       // @Override\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see java.lang.Object#toString()\r
+        */\r
+//     @Override\r
+//     public String toString() {\r
+//             return getResourceId().toString() + ":" + getTraceId().toString() + ":"\r
+//                             + getType().toString();\r
+//     }\r
+\r
+    @Override\r
+    @SuppressWarnings("nls")\r
+    public String toString() {\r
+               return "[TimeRangeEventResource: " + super.toString() +\r
+               ",type=" + type + ",resourceId=" + resourceId + "]";\r
+    }\r
+\r
+    /**\r
+        * Compare function to implement Comparable<br>\r
+        * <br>\r
+        * Compare by traceId THEN IF EQUAL by resourceType THEN IF EQUAL by\r
+        * resourceId\r
+        * \r
+        * @param comparedResource\r
+        *            The resource to compare to\r
+        * \r
+        * @return int 0 if equals, negative number if "smaller", positive if\r
+        *         "bigger".\r
+        */\r
+       // @Override\r
+       @Override\r
+       public int compareTo(TimeRangeEventResource comparedResource) {\r
+               int returnedValue = 0;\r
+\r
+               if (comparedResource != null) {\r
+                       // Compare by trace id first\r
+                       returnedValue = this.getTraceId().compareTo(\r
+                                       comparedResource.getTraceId());\r
+\r
+                       // If same, compare by resourceName\r
+                       if (returnedValue == 0) {\r
+                               returnedValue = this.getName().compareTo(\r
+                                               comparedResource.getName());\r
+\r
+                               // Finally, if same, compare by ResourceId\r
+                               if (returnedValue == 0) {\r
+                                       returnedValue = this.getResourceId().compareTo(\r
+                                                       comparedResource.getResourceId());\r
+                               }\r
+                       }\r
+\r
+               }\r
+\r
+               return returnedValue;\r
+       }\r
+\r
+       public abstract String getStateMode(LttngTraceState traceState);\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeResourceFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeResourceFactory.java
new file mode 100644 (file)
index 0000000..27a2864
--- /dev/null
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;
+
+
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LTTngCPUState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngIRQState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTrapState;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
+
+/**
+ * Creates Resources with custom implementation to obtain its corresponding
+ * state mode
+ * <p>
+ * The state mode resolution is needed at the end of a data request, as well as
+ * in the before and after handlers
+ * </p>
+ * 
+ * @author alvaro
+ * 
+ */
+public class TimeRangeResourceFactory {
+       // ========================================================================
+       // Data
+       // =======================================================================
+       private static TimeRangeResourceFactory instance = null;
+
+       // ========================================================================
+       // Create instance
+       // =======================================================================
+       /**
+        * Factory singleton
+        * 
+        * @return
+        */
+       public static TimeRangeResourceFactory getInstance() {
+               if (instance == null) {
+                       instance = new TimeRangeResourceFactory();
+               }
+               return instance;
+       }
+
+       // ========================================================================
+       // Public methods
+       // =======================================================================
+       public TimeRangeEventResource createResource(int newId, long newStartTime,
+                       long newStopTime, String newName, String newGroupName,
+                       String newClassName, ResourceTypes type, Long newResourceId,
+                       long insertionTime) {
+
+               TimeRangeEventResource resource = null;
+               switch (type) {
+               case CPU:
+                       resource = createCpuResource(newId, newStartTime, newStopTime,
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
+                       break;
+               case IRQ:
+                       resource = createIrqResource(newId, newStartTime, newStopTime,
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
+                       break;
+               case SOFT_IRQ:
+                       resource = createSoftIrqResource(newId, newStartTime, newStopTime,
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
+                       break;
+               case TRAP:
+                       resource = createTrapResource(newId, newStartTime, newStopTime,
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
+                       break;
+               case BDEV:
+                       resource = createBdevResource(newId, newStartTime, newStopTime,
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
+                       break;
+               default:
+                       break;
+               }
+
+               return resource;
+       }
+
+       // ========================================================================
+       // Private methods
+       // =======================================================================
+       private TimeRangeEventResource createIrqResource(int newId,
+                       long newStartTime, long newStopTime, String newName,
+                       String newGroupName, String newClassName, ResourceTypes newType,
+                       Long newResourceId, long insertionTime) {
+
+               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
+                               newStartTime, newStopTime, newName, newGroupName, newClassName,
+                               newType, newResourceId, insertionTime) {
+
+                       @Override
+                       public String getStateMode(LttngTraceState traceSt) {
+                               LttngIRQState irqState = traceSt.getIrq_states().get(
+                                               getResourceId());
+                               String statemode = ""; //$NON-NLS-1$
+                               if (irqState != null) {
+                                       statemode = irqState.peekFromIrqStack().getInName();
+                               }
+
+                               return statemode;
+                       }
+               };
+               
+               return resource;
+       }
+
+       private TimeRangeEventResource createTrapResource(int newId,
+                       long newStartTime, long newStopTime, String newName,
+                       String newGroupName, String newClassName, ResourceTypes newType,
+                       Long newResourceId, long insertionTime) {
+
+               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
+                               newStartTime, newStopTime, newName, newGroupName, newClassName,
+                               newType, newResourceId, insertionTime) {
+
+                       @Override
+                       public String getStateMode(LttngTraceState traceSt) {
+                               // Determine the trap state.
+                               String trapStateMode = ""; //$NON-NLS-1$
+                               LttngTrapState ts = traceSt.getTrap_states().get(getResourceId());
+                               
+                               // *** Note : 
+                               //      Ts might not have been created yet.
+                               //      This is because the state system will be updated next to this before hook
+                               //      It should be correct to create it here as Busy 
+                               //              (traps are created with running++ so it wont be idle)
+                               if ( ts != null ) {
+                                       Long trapState = ts.getRunning();
+                                       
+                                       if (trapState == 0) {
+                                               trapStateMode = StateStrings.TrapMode.LTTV_TRAP_IDLE.getInName();
+                                       } else {
+                                               trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY.getInName();
+                                       }
+                               }
+                               else {
+                                       trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY.getInName();
+                               }
+                               
+                               return trapStateMode;
+                       }
+               };
+
+               return resource;
+       }
+
+       private TimeRangeEventResource createSoftIrqResource(int newId,
+                       long newStartTime, long newStopTime, String newName,
+                       String newGroupName, String newClassName, ResourceTypes newType,
+                       Long newResourceId, long insertionTime) {
+
+               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
+                               newStartTime, newStopTime, newName, newGroupName, newClassName,
+                               newType, newResourceId, insertionTime) {
+
+                       @Override
+                       public String getStateMode(LttngTraceState traceSt) {
+                               // Get the resource id.
+                               Long softIrqId = getResourceId();
+                               // Get the resource state mode
+                               long running = traceSt.getSoft_irq_states().get(softIrqId)
+                                               .getRunning().longValue();
+                               long pending = traceSt.getSoft_irq_states().get(softIrqId)
+                                               .getPending().longValue();
+
+                               String softIrqStateMode;
+                               if (running > 0) {
+                                       softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_BUSY
+                                                       .getInName();
+                               } else if (pending > 0) {
+                                       softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_PENDING
+                                                       .getInName();
+                               } else {
+                                       softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_IDLE
+                                                       .getInName();
+                               }
+
+                               return softIrqStateMode;
+                       }
+
+               };
+
+               return resource;
+       }
+
+       private TimeRangeEventResource createBdevResource(int newId,
+                       long newStartTime, long newStopTime, String newName,
+                       String newGroupName, String newClassName, ResourceTypes newType,
+                       Long newResourceId, long insertionTime) {
+
+               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
+                               newStartTime, newStopTime, newName, newGroupName, newClassName,
+                               newType, newResourceId, insertionTime) {
+
+                       @Override
+                       public String getStateMode(LttngTraceState traceSt) {
+                               // Get the resource state mode
+                               String bdevStateMode = traceSt.getBdev_states().get(
+                                               getResourceId()).peekFromBdevStack().getInName();
+
+                               return bdevStateMode;
+                       }
+
+               };
+
+               return resource;
+       }
+
+       private TimeRangeEventResource createCpuResource(int newId,
+                       long newStartTime, long newStopTime, String newName,
+                       String newGroupName, String newClassName, ResourceTypes newType,
+                       Long newResourceId, long insertionTime) {
+
+               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
+                               newStartTime, newStopTime, newName, newGroupName, newClassName,
+                               newType, newResourceId, insertionTime) {
+
+                       @Override
+                       public String getStateMode(LttngTraceState traceSt) {
+                               // Get the resource state mode
+                           LTTngCPUState cpuState = traceSt.getCpu_states().get(
+                        getResourceId());
+                           
+                               String cpuStateMode = ""; //$NON-NLS-1$
+                               if (cpuState != null) { 
+                                   cpuStateMode = traceSt.getCpu_states().get(
+                                           getResourceId())
+                                           .peekFromCpuStack().getInName();
+                               }
+
+                               return cpuStateMode;
+                       }
+
+               };
+
+               return resource;
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/TimeRangeViewerProvider.java
new file mode 100644 (file)
index 0000000..1cab1bf
--- /dev/null
@@ -0,0 +1,240 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.model.trange;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+import java.util.Map.Entry;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.BdevMode;\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.CpuMode;\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ExecutionMode;\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.IRQMode;\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ProcessStatus;\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.SoftIRQMode;\r
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.TrapMode;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;\r
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider;\r
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;\r
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
+\r
+public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Data\r
+    // ------------------------------------------------------------------------\r
+\r
+    protected Map<String, StateColor> procStateToColor = new HashMap<String, StateColor>(16);\r
+    protected Map<String, StateColor> bdevStateToColor = new HashMap<String, StateColor>(4);\r
+    protected Map<String, StateColor> softIrqStateToColor = new HashMap<String, StateColor>(4);\r
+    protected Map<String, StateColor> trapStateToColor = new HashMap<String, StateColor>(4);\r
+    protected Map<String, StateColor> irqStateToColor = new HashMap<String, StateColor>(4);\r
+    protected Map<String, StateColor> cpuStateToColor = new HashMap<String, StateColor>(8);\r
+\r
+    private final ParamsUpdater fviewParameters;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    public TimeRangeViewerProvider(ParamsUpdater paramsUpdater) {\r
+       // Fill the state mode to color maps\r
+       fillProcessStateToColor();\r
+       fillBdevStateToColor();\r
+       fillSoftIRQStateToColor();\r
+       fillTrapStateToColor();\r
+       fillIrqStateToColor();\r
+       fillCpuStateToColor();\r
+       fviewParameters = paramsUpdater;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Methods\r
+    // ------------------------------------------------------------------------\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventColor(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent)\r
+     */\r
+    @Override\r
+    public StateColor getEventColor(ITimeEvent event) {\r
+       StateColor retColor = null;\r
+\r
+       if (event instanceof TimeRangeEvent) {\r
+           TimeRangeEvent devent = (TimeRangeEvent) event;\r
+           String stateMode = devent.getStateMode();\r
+           switch (devent.getEventType()) {\r
+           case PROCESS_MODE:\r
+               retColor = procStateToColor.get(stateMode);\r
+               break;\r
+           case BDEV_MODE:\r
+               retColor = bdevStateToColor.get(stateMode);\r
+               break;\r
+           case IRQ_MODE:\r
+               retColor = irqStateToColor.get(stateMode);\r
+               break;\r
+           case SOFT_IRQ_MODE:\r
+               retColor = softIrqStateToColor.get(stateMode);\r
+               break;\r
+           case CPU_MODE:\r
+               retColor = cpuStateToColor.get(stateMode);\r
+               break;\r
+           case TRAP_MODE:\r
+               retColor = trapStateToColor.get(stateMode);\r
+               break;\r
+           }\r
+       }\r
+\r
+       if (retColor == null) {\r
+           return StateColor.MAGENTA3;\r
+       }\r
+       return retColor;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider.StateColor)\r
+     */\r
+    @Override\r
+    public String getStateName(StateColor color) {\r
+       // Override to multiple instances of the widget, the same color can have\r
+       // multiple meanings\r
+       return "Not mapped"; //$NON-NLS-1$\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventHoverToolTipInfo(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent)\r
+     */\r
+    @Override\r
+    public Map<String, String> getEventHoverToolTipInfo(ITimeEvent revent) {\r
+       Map<String, String> toolTipEventMsgs = new HashMap<String, String>();\r
+       // if the selected resource is a Process, add the Process type to the\r
+       // tool tip\r
+       if (revent instanceof TimeRangeComponent) {\r
+           ITimeRangeComponent parent = ((TimeRangeComponent) revent).getEventParent();\r
+\r
+           // if the event start time is unknown, indicate it to the user\r
+           String extraInfo = "\n" + Messages.TimeRangeViewerProvider_BadRangeExtraInfo; //$NON-NLS-1$\r
+           long eventStart = revent.getTime();\r
+           if (eventStart < fviewParameters.getStartTime()) {\r
+               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_StartTime, Messages.TimeRangeViewerProvider_UndefinedStartTime + extraInfo);\r
+               // avoid repeated details\r
+               extraInfo = ""; //$NON-NLS-1$\r
+           }\r
+\r
+           long eventEnd = revent.getTime() + revent.getDuration();\r
+           if (eventEnd > fviewParameters.getEndTime()) {\r
+               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_EndTime, Messages.TimeRangeViewerProvider_UndefinedEndTime + extraInfo);\r
+           }\r
+\r
+           if (parent != null && parent instanceof TimeRangeEventProcess) {\r
+               TimeRangeEventProcess localProcess = (TimeRangeEventProcess) parent;\r
+               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_ProcessType, localProcess.getProcessType());\r
+           }\r
+       }\r
+\r
+       return toolTipEventMsgs;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent, boolean, boolean)\r
+     */\r
+    @Override\r
+    public String getEventName(ITimeEvent event, boolean upper, boolean extInfo) {\r
+       String name = null;\r
+       // The relevant event name for the time range is the actual state mode\r
+       if (event instanceof TimeRangeEvent) {\r
+           TimeRangeEvent devent = (TimeRangeEvent) event;\r
+           StringBuilder sb = new StringBuilder(devent.getStateMode());\r
+           name = sb.toString();\r
+       }\r
+\r
+       if (name == null) {\r
+           return "Unknown"; //$NON-NLS-1$\r
+       }\r
+       return name;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getTraceClassName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry)\r
+     */\r
+    @Override\r
+    public String getTraceClassName(ITmfTimeAnalysisEntry trace) {\r
+       String name = ""; //$NON-NLS-1$\r
+       if (trace instanceof TimeRangeComposite) {\r
+           TimeRangeComposite dTrace = (TimeRangeComposite) trace;\r
+           name = dTrace.getClassName();\r
+       }\r
+       return name;\r
+    }\r
+\r
+    private void fillCpuStateToColor() {\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_UNKNOWN.getInName(), StateColor.BLACK);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_IDLE.getInName(), StateColor.GRAY);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_BUSY.getInName(), StateColor.LIGHT_BLUE);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_IRQ.getInName(), StateColor.ORANGE);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_SOFT_IRQ.getInName(), StateColor.PURPLE1);\r
+       cpuStateToColor.put(CpuMode.LTTV_CPU_TRAP.getInName(), StateColor.GOLD);\r
+    }\r
+\r
+    private void fillIrqStateToColor() {\r
+       irqStateToColor.put(IRQMode.LTTV_IRQ_UNKNOWN.getInName(), StateColor.BLACK);\r
+       irqStateToColor.put(IRQMode.LTTV_IRQ_IDLE.getInName(), StateColor.GRAY);\r
+       irqStateToColor.put(IRQMode.LTTV_IRQ_BUSY.getInName(), StateColor.ORANGE);\r
+    }\r
+\r
+    private void fillTrapStateToColor() {\r
+       trapStateToColor.put(TrapMode.LTTV_TRAP_UNKNOWN.getInName(), StateColor.BLACK);\r
+       trapStateToColor.put(TrapMode.LTTV_TRAP_IDLE.getInName(), StateColor.GRAY);\r
+       trapStateToColor.put(TrapMode.LTTV_TRAP_BUSY.getInName(), StateColor.GOLD);\r
+    }\r
+\r
+    private void fillSoftIRQStateToColor() {\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_UNKNOWN.getInName(), StateColor.BLACK);\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_IDLE.getInName(), StateColor.GRAY);\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_PENDING.getInName(), StateColor.PINK1);\r
+       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_BUSY.getInName(), StateColor.PURPLE1);\r
+    }\r
+\r
+    private void fillBdevStateToColor() {\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_UNKNOWN.getInName(), StateColor.BLACK);\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_IDLE.getInName(), StateColor.GRAY);\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_READING.getInName(), StateColor.DARK_BLUE);\r
+       softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_WRITING.getInName(), StateColor.RED);\r
+    }\r
+\r
+    private void fillProcessStateToColor() {\r
+       // Process Status\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_UNNAMED.getInName(), StateColor.GRAY);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_DEAD.getInName(), StateColor.BLACK);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_FORK.getInName(), StateColor.DARK_GREEN);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_CPU.getInName(), StateColor.DARK_YELLOW);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_EXIT.getInName(), StateColor.MAGENTA3);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_ZOMBIE.getInName(), StateColor.PURPLE1);\r
+       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT.getInName(), StateColor.RED);\r
+\r
+       // Execution Mode\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_MODE_UNKNOWN.getInName(), StateColor.BLACK);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_USER_MODE.getInName(), StateColor.GREEN);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_SYSCALL.getInName(), StateColor.DARK_BLUE);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_TRAP.getInName(), StateColor.GOLD);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_IRQ.getInName(), StateColor.ORANGE);\r
+       procStateToColor.put(ExecutionMode.LTTV_STATE_SOFT_IRQ.getInName(), StateColor.PINK1);\r
+    }\r
+    \r
+    protected String findObject(StateColor Value, Map<String, StateColor> map) {\r
+        for (Entry<String, StateColor> entry : map.entrySet()) {\r
+            if (entry.getValue().equals(Value)) {\r
+                return entry.getKey();\r
+            }\r
+        }\r
+               return "Not Found"; //$NON-NLS-1$\r
+       }\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/model/trange/messages.properties
new file mode 100644 (file)
index 0000000..86fb8ff
--- /dev/null
@@ -0,0 +1,6 @@
+TimeRangeViewerProvider_BadRangeExtraInfo=(i.e. outside of data time window)
+TimeRangeViewerProvider_EndTime=Stop Time
+TimeRangeViewerProvider_ProcessType=Process Type
+TimeRangeViewerProvider_StartTime=Start Time
+TimeRangeViewerProvider_UndefinedEndTime=Actual Event Stop Time is undefined
+TimeRangeViewerProvider_UndefinedStartTime=Actual Event Start Time is undefined
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/Messages.java
new file mode 100644 (file)
index 0000000..49b14eb
--- /dev/null
@@ -0,0 +1,26 @@
+package org.eclipse.linuxtools.internal.lttng.ui.project.dialogs;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.project.dialogs.messages"; //$NON-NLS-1$
+    public static String NewProjectWizard_Title;
+       public static String NewProjectWizard_Description;
+       public static String TraceLibraryPath_label;
+       public static String TraceLibraryPath_browseBtn;
+       public static String TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists;
+       public static String TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists;
+       public static String TraceLibraryPathWizardPage_Title;
+       public static String TraceLibraryPathWizardPage_Description;
+       public static String TraceLibraryPathWizard_Message;
+       public static String TraceLibraryPathProperty_Message;
+       public static String TraceLibraryPath_Note;
+       public static String TraceLibraryPath_Message;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/NewLTTngProjectMainWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/NewLTTngProjectMainWizardPage.java
new file mode 100644 (file)
index 0000000..684f2f9
--- /dev/null
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.project.dialogs;
+
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+/**
+ * <b><u>NewProjectMainWizardPage</u></b>
+ * <p>
+ *
+ * TODO: Implement me. Please.
+ */
+public class NewLTTngProjectMainWizardPage extends WizardNewProjectCreationPage {
+
+    /**
+     * @param pageName
+     */
+    public NewLTTngProjectMainWizardPage(String pageName) {
+        super(pageName);
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/NewLTTngProjectWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/NewLTTngProjectWizard.java
new file mode 100644 (file)
index 0000000..9bfc53e
--- /dev/null
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *   Yufen Kuo       (ykuo@mvista.com) - add support to allow user specify trace library path
+ *   Francois Chouinard - Rebase on TMF NewProjectWizard
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.project.dialogs;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.linuxtools.internal.lttng.core.LTTngProjectNature;
+import org.eclipse.linuxtools.internal.lttng.core.TraceHelper;
+import org.eclipse.linuxtools.tmf.core.TmfProjectNature;
+import org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard;
+
+/**
+ * <b><u>NewLTTngProjectWizard</u></b>
+ * <p>
+ */
+public class NewLTTngProjectWizard extends NewTmfProjectWizard {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+
+    private static final String TRACE_LIBRARY_PATH = "traceLibraryPath"; //$NON-NLS-1$
+
+    // ------------------------------------------------------------------------
+    // Variables
+    // ------------------------------------------------------------------------
+
+    private TraceLibraryPathWizardPage traceLibraryPathPage;
+
+    // ------------------------------------------------------------------------
+    // Construction
+    // ------------------------------------------------------------------------
+
+    public NewLTTngProjectWizard() {
+        this(Messages.NewProjectWizard_Title, Messages.NewProjectWizard_Description);
+    }
+
+    public NewLTTngProjectWizard(String title, String desc) {
+        super(title, desc);
+    }
+
+    // ------------------------------------------------------------------------
+    // NewProjectWizard
+    // ------------------------------------------------------------------------
+
+    @Override
+    public void addPages() {
+        super.addPages();
+        traceLibraryPathPage = new TraceLibraryPathWizardPage(Messages.NewProjectWizard_Title);
+        traceLibraryPathPage.setTitle(Messages.TraceLibraryPathWizardPage_Title);
+        traceLibraryPathPage.setDescription(Messages.TraceLibraryPathWizardPage_Description);
+        addPage(traceLibraryPathPage);
+    }
+
+    @Override
+    public boolean performFinish() {
+        // Create the tracing project
+        super.performFinish();
+
+        // Add the LTTng nature
+        try {
+            IProjectDescription description = fProject.getDescription();
+            description.setNatureIds(new String[] { TmfProjectNature.ID, LTTngProjectNature.ID });
+            fProject.setDescription(description, null);
+        } catch (CoreException e) {
+        }
+
+        // Set the library path
+        String traceLibraryPath = traceLibraryPathPage.getPath();
+        if (traceLibraryPath != null) {
+            return TraceHelper.setProjectPreference(fProject, TRACE_LIBRARY_PATH, traceLibraryPath);
+        }
+
+        return true;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    public IProject getProject() {
+        return fProject;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/TraceLibraryPathPropertyPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/TraceLibraryPathPropertyPage.java
new file mode 100644 (file)
index 0000000..389c54a
--- /dev/null
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2011 MontaVista Software
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yufen Kuo (ykuo@mvista.com) - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.project.dialogs;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.linuxtools.internal.lttng.core.TraceHelper;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class TraceLibraryPathPropertyPage extends PropertyPage {
+
+    private static final String LTTVTRACEREAD_LOADER_LIBNAME = "lttvtraceread_loader"; //$NON-NLS-1$
+    private Button browsePathButton;
+    private Text traceLibraryPath;
+
+    @Override
+    protected Control createContents(Composite parent) {
+        Composite client = new Composite(parent, SWT.NONE);
+        client.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+        GridLayout layout = new GridLayout(3, false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        client.setLayout(layout);
+
+        Label label = new Label(client, SWT.NONE);
+        label.setText(Messages.TraceLibraryPath_label);
+        traceLibraryPath = new Text(client, SWT.BORDER);
+        traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
+                false));
+        traceLibraryPath.addModifyListener(new ModifyListener() {
+
+            @Override
+            public void modifyText(ModifyEvent e) {
+                setValid(validateInputs());
+            }
+
+        });
+        browsePathButton = new Button(client, SWT.PUSH);
+        browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false,
+                false));
+        browsePathButton.setText(Messages.TraceLibraryPath_browseBtn);
+        browsePathButton.addSelectionListener(new SelectionAdapter() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                String dir = new DirectoryDialog(Display.getDefault()
+                        .getActiveShell()).open();
+                if (dir != null) {
+                    traceLibraryPath.setText(dir);
+                }
+
+            }
+
+        });
+
+        Label noLabel = new Label(client, SWT.NONE);
+        noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
+
+        Label descTextLabel = new Label(client, SWT.WRAP);
+        descTextLabel.setText(Messages.TraceLibraryPathProperty_Message);
+        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+        gd.widthHint = 400;
+        gd.horizontalSpan = 2;
+        descTextLabel.setLayoutData(gd);
+
+        Label noteBoldLabel = new Label(client, SWT.BOLD);
+        noteBoldLabel.setText(Messages.TraceLibraryPath_Note);
+        noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false,
+                false));
+        Font font = noteBoldLabel.getFont();
+        if (font.getFontData().length > 0)
+            noteBoldLabel.setFont(new Font(client.getDisplay(), font
+                    .getFontData()[0].getName(), font.getFontData()[0]
+                    .getHeight(), SWT.BOLD));
+
+        Label noteTextLabel = new Label(client, SWT.WRAP);
+        noteTextLabel.setText(Messages.TraceLibraryPath_Message);
+        gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+        gd.widthHint = 400;
+        gd.horizontalSpan = 2;
+        noteTextLabel.setLayoutData(gd);
+                
+        performDefaults();
+        return client;
+    }
+
+    public boolean validateInputs() {
+        String path = traceLibraryPath.getText();
+        if (path != null && !path.trim().isEmpty()) {
+            File file = new File(path);
+            if (file.exists() && file.isDirectory()) {
+                File loaderLib = new File(path,
+                        System.mapLibraryName(LTTVTRACEREAD_LOADER_LIBNAME));
+                if (!loaderLib.exists()) {
+                    setErrorMessage(Messages.TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists);
+                    return false;
+                }
+            } else {
+                setErrorMessage(Messages.TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists);
+                return false;
+            }
+        }
+        setErrorMessage(null);
+        return true;
+    }
+
+    @Override
+    protected void performDefaults() {
+        IResource resource = (IResource) getElement().getAdapter(
+                IResource.class);
+        IProject project = resource.getProject();
+        if (project != null) {
+            String traceLibDir = TraceHelper.getTraceLibDirFromProject(project);
+            if (traceLibDir != null) {
+                traceLibraryPath.setText(traceLibDir);
+            }
+        }
+        super.performDefaults();
+    }
+
+    @Override
+    public boolean performOk() {
+        IResource resource = (IResource) getElement().getAdapter(
+                IResource.class);
+        IProject project = resource.getProject();
+        boolean ok = false;
+        if (project != null) {
+            String libPath = traceLibraryPath.getText();
+            if (libPath == null || libPath.trim().isEmpty())
+                ok = TraceHelper.removeProjectPreference(project, "traceLibraryPath"); //$NON-NLS-1$
+            else
+                ok = TraceHelper.setProjectPreference(project, "traceLibraryPath", traceLibraryPath.getText()); //$NON-NLS-1$
+        }
+        return ok && super.performOk();
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/TraceLibraryPathWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/TraceLibraryPathWizardPage.java
new file mode 100644 (file)
index 0000000..342881f
--- /dev/null
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2011 MontaVista Software
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yufen Kuo (ykuo@mvista.com) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.project.dialogs;
+
+import java.io.File;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class TraceLibraryPathWizardPage extends WizardPage {
+    private static final String LTTVTRACEREAD_LOADER_LIBNAME = "lttvtraceread_loader"; //$NON-NLS-1$
+    private Button browsePathButton;
+    private Text traceLibraryPath;
+
+    protected TraceLibraryPathWizardPage(String pageName) {
+        super(pageName);
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+        Composite client = new Composite(parent, SWT.NONE);
+        client.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+        GridLayout layout = new GridLayout(3, false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        client.setLayout(layout);
+
+        Label label = new Label(client, SWT.NONE);
+        label.setText(Messages.TraceLibraryPath_label);
+        traceLibraryPath = new Text(client, SWT.BORDER);
+        traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        traceLibraryPath.addModifyListener(new ModifyListener() {
+
+            @Override
+            public void modifyText(ModifyEvent e) {
+                boolean valid = validatePage();
+                setPageComplete(valid);
+            }
+
+        });
+        browsePathButton = new Button(client, SWT.PUSH);
+        browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
+        browsePathButton.setText(Messages.TraceLibraryPath_browseBtn);
+        browsePathButton.addSelectionListener(new SelectionAdapter() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                String dir = new DirectoryDialog(Display.getDefault()
+                        .getActiveShell()).open();
+                if (dir != null) {
+                    traceLibraryPath.setText(dir);
+                }
+
+            }
+
+        });
+
+        Label noLabel = new Label(client, SWT.NONE);
+        noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
+
+        Label descTextLabel = new Label(client, SWT.WRAP);
+        descTextLabel.setText(Messages.TraceLibraryPathWizard_Message);
+        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+        gd.widthHint = 400;
+        gd.horizontalSpan = 2;
+        descTextLabel.setLayoutData(gd);
+
+        Label noteBoldLabel = new Label(client, SWT.BOLD);
+        noteBoldLabel.setText(Messages.TraceLibraryPath_Note);
+        noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
+        Font font = noteBoldLabel.getFont();
+        if (font.getFontData().length > 0)
+            noteBoldLabel.setFont(new Font(client.getDisplay(), font
+                    .getFontData()[0].getName(), font.getFontData()[0]
+                    .getHeight(), SWT.BOLD));
+
+        Label noteTextLabel = new Label(client, SWT.WRAP);
+        noteTextLabel.setText(Messages.TraceLibraryPath_Message);
+        gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+        gd.widthHint = 400;
+        gd.horizontalSpan = 2;
+        noteTextLabel.setLayoutData(gd);
+        setControl(client);
+
+    }
+
+    public String getPath() {
+        if (traceLibraryPath != null && !traceLibraryPath.isDisposed()) {
+            String path = traceLibraryPath.getText();
+            if (path != null && !path.trim().isEmpty())
+                return path;
+        }
+        return null;
+    }
+
+    private boolean validatePage() {
+        String path = getPath();
+        if (path != null) {
+            File file = new File(path);
+            if (file.exists() && file.isDirectory()) {
+                File loaderLib = new File(path,
+                        System.mapLibraryName(LTTVTRACEREAD_LOADER_LIBNAME));
+                if (!loaderLib.exists()) {
+                    setErrorMessage(Messages.TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists);
+                    return false;
+                }
+            } else {
+                setErrorMessage(Messages.TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists);
+                return false;
+            }
+        }
+        setErrorMessage(null);
+        return true;
+
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/project/dialogs/messages.properties
new file mode 100644 (file)
index 0000000..4d8158a
--- /dev/null
@@ -0,0 +1,19 @@
+NewProjectWizard_Title=LTTng Project
+NewProjectWizard_Description=Create an LTTng Project
+
+TraceLibraryPath_label = Trace Library Path:
+TraceLibraryPath_browseBtn = Browse...
+
+TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists = Specified trace library directory does not exist!
+TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists = Trace loader library not found at the specified path!
+TraceLibraryPathWizardPage_Title = LTTng Parsing Library
+TraceLibraryPathWizardPage_Description = Specify the directory which contains the LTTng parsing libraries
+TraceLibraryPathWizard_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\n\
+    The field is project specific and can be modified at any time from the LTTng project Properties page.\n\
+
+TraceLibraryPathProperty_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\
+
+TraceLibraryPath_Note = Note:
+TraceLibraryPath_Message = If you set this field, the parser library 'liblttvtraceread_loader.so' must be accessible from the path provided.\n\n\
+    In addition, the library 'liblttvtraceread_loader.so' must have 'RUNPATH' set with ${ORIGIN} so it can find the dependent libraries. \
+    'RUNPATH' can be set in the makefile or by using the patchelf utility.
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/Messages.java
new file mode 100644 (file)
index 0000000..6731e44
--- /dev/null
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.messages"; //$NON-NLS-1$
+    
+    public static String Property_Type_Provider_Filter;
+    public static String Property_Type_Provider;
+    
+    public static String Lttng_Resource_Root;
+    public static String Lttng_Resource_Target;
+    public static String Lttng_Resource_Provider;
+    public static String Lttng_Resource_Trace;
+    public static String Lttng_Resource_Marker;
+    public static String Lttng_Resource_Channel;
+    
+    public static String Filter_Provider_Dlg_Title;
+    public static String Filter_Provider_Page_Title;
+    public static String Filter_Provider_Page_Text;
+
+    public static String Filter_Target_Dlg_Title;
+    public static String Filter_Target_Page_Title;
+    public static String Filter_Target_Page_Text;
+    public static String Filter_Target_Target_Prompt_label;
+
+    public static String Filter_Trace_Dlg_Title;
+    public static String Filter_Trace_Page_Title;
+    public static String Filter_Trace_Page_Text;
+    public static String Filter_Trace_Target_Prompt_Label;
+    
+    public static String AllProviders;
+
+    public static String Trace_Connector_Service_Name;
+    public static String Trace_Connector_Service_Description;
+    public static String Trace_Connector_Service_Connect_Msg;
+    public static String Trace_Connector_Service_Disconnect_Msg;
+    public static String Trace_Connector_Service_Canceled_Msg;
+    
+    public static String Lttng_Control_Unknown_Event_Msg;
+    
+    public static String Lttng_Control_CommandError;
+
+    public static String Lttng_Control_ErrorNewTrace;
+    public static String Lttng_Control_ErrorConfigureTrace;
+    public static String Lttng_Control_ErrorConfigureMarkers;
+    public static String Lttng_Control_ErrorGetMarkers;
+    public static String Lttng_Control_ErrorGetMarkerInfo;
+    public static String Lttng_Control_ErrorStart;
+    public static String Lttng_Control_ErrorPause;
+    public static String Lttng_Control_ErrorStop;
+    public static String Lttng_Control_ErrorBrowse;
+    
+    public static String Lttng_Control_GetProvidersError;
+    public static String Lttng_Control_GetTargetsError;
+    public static String Lttng_Control_GetTracesError;
+    public static String Lttng_Control_GetMarkersError;
+    public static String Lttng_Control_GetMarkerInfoError;
+    
+    public static String Ltt_Controller_Service_Not_Connected_Msg;
+    public static String Ltt_Controller_Service_Unsupported_Msg;
+
+    public static String Lttng_Control_ErrorSetChannelEnable;
+    public static String Lttng_Control_ErrorSetChannelOverwrite;
+    public static String Lttng_Control_ErrorSetSubbufNum;
+    public static String Lttng_Control_ErrorSetSubbufSize;
+    public static String Lttng_Control_ErrorSetChannelTimer;
+    
+    public static String Lttng_Control_ErrorCreateTracePath;
+    
+    // Trace resource properties
+    public static String Ltt_Trace_Property_TracePathName;
+    public static String Ltt_Trace_Property_TracePathDescription;
+    public static String Ltt_Trace_Property_NumberOfChannelsName;
+    public static String Ltt_Trace_Property_NumberOfChannelsDescr;
+    public static String Ltt_Trace_Property_FlighRecorderModeName;
+    public static String Ltt_Trace_Property_FlighRecorderModeDesc;
+    public static String Ltt_Trace_Property_NormalModeName;
+    public static String Ltt_Trace_Property_NormalModeDesc;
+    public static String Ltt_Trace_Property_NetworkTraceName;
+    public static String Ltt_Trace_Property_NetWorkTraceDescr;
+    public static String Ltt_Trace_Property_TraceTransportName;
+    public static String Ltt_Trace_Property_TraceTransportDesc;
+    
+    public static String Ltt_ShutdownWarning;
+    public static String Ltt_NetworkTraceRunningWarning;
+    
+    public static String Ltt_TimeoutMsg;
+    
+    public static String ConfigureMarkersDialog_Select_All;
+    public static String ConfigureMarkersDialog_Call;
+    public static String ConfigureMarkersDialog_Cancel;
+    public static String ConfigureMarkersDialog_EventId;
+    public static String ConfigureMarkersDialog_Format;
+    public static String ConfigureMarkersDialog_Location;
+    public static String ConfigureMarkersDialog_NameColumn;
+    public static String ConfigureMarkersDialog_Ok;
+    public static String ConfigureMarkersDialog_Probe_Single;
+    public static String ConfigureMarkersDialog_Deselect_All;
+    public static String ConfigureMarkersDialog_Title;
+    
+    public static String ConfigureTraceDialog_Append;
+    public static String ConfigureTraceDialog_Browse;
+    public static String ConfigureTraceDialog_Cancel;
+    public static String ConfigureTraceDialog_Finish;
+    public static String ConfigureTraceDialog_Mode_Flight_Recorder;
+    public static String ConfigureTraceDialog_Host;
+    public static String ConfigureTraceDialog_Target;
+    public static String ConfigureTraceDialog_Mode_None;
+    public static String ConfigureTraceDialog_Mode_Normal;
+    public static String ConfigureTraceDialog_Num_Lttd_Threads;
+    public static String ConfigureTraceDialog_Error_Invalid_Folder;
+    public static String ConfigureTraceDialog_Error_Invalid_Path;
+    public static String ConfigureTraceDialog_Error_Multiple_Seps;
+    public static String ConfigureTraceDialog_Error_File_Exists;
+    public static String ConfigureTraceDialog_Error_Can_Not_Write;
+    public static String ConfigureTraceDialog_Title;
+    public static String ConfigureTraceDialog_Trace_Location;
+    public static String ConfigureTraceDialog_Trace_Mode;
+    public static String ConfigureTraceDialog_Trace_Path;
+    public static String ConfigureTraceDialog_Trace_Transport;
+    
+    public static String NewTraceDialog_Title;
+    public static String NewTraceDialog_TraceName;
+    public static String NewTraceDialog_Tracing_Project;
+    public static String NewTraceDialog_Error_No_Name;
+    public static String NewTraceDialog_Error_No_Path;
+    public static String NewTraceDialog_Error_No_NumLttdThreads;
+    public static String NewTraceDialog_Error_No_Project;
+    public static String NewTraceDialog_Error_Already_Exists;
+    public static String NewTraceDialog_Error_Invalid_First_Char;
+    public static String NewTraceDialog_Error_Invalid_Name;
+    
+    public static String SeletctTracePathDialog_Title;
+    
+    public static String DeleteTrace_ConfirmMessage;
+       public static String DeleteTrace_ConfirmTitle;
+
+       public static String ImportToProject_AlreadyExists;
+       public static String ImportToProject_ImportFailed;
+       public static String ImportToProject_NoFileServiceSubsystem;
+       public static String ImportToProject_NoProjectTraceFolder;
+       public static String ImportToProject_NoRemoteTraceFolder;
+       
+       public static String ImportTraceDialog_ImportButton;
+       public static String ImportTraceDialog_LinkOnly;
+       public static String ImportTraceDialog_NameLabel;
+       public static String ImportTraceDialog_ProjectColumn;
+       public static String ImportTraceDialog_TableLabel;
+       public static String ImportTraceDialog_Title;
+       
+       public static String ChannelConfigPage_BufferOverrideTooltip;
+    public static String ChannelConfigPage_ChannelEnabled;
+    public static String ChannelConfigPage_ChannelEnabledTooltip;
+    public static String ChannelConfigPage_ChannelName;
+    public static String ChannelConfigPage_ChannelNameTooltip;
+    public static String ChannelConfigPage_ChannelOverride;
+    public static String ChannelConfigPage_ChannelTimer;
+    public static String ChannelConfigPage_ChannelTimerTooltip;
+    public static String ChannelConfigPage_NumSubBuf;
+    public static String ChannelConfigPage_NumSubBufTooltip;
+    public static String ChannelConfigPage_PageTitle;
+    public static String ChannelConfigPage_SubBufSize;
+    public static String ChannelConfigPage_SubBufSizeTooltip;
+    
+    public static String ChannelConfigPage_EnableAll;
+    public static String ChannelConfigPage_DisableAll;
+    public static String ChannelConfigPage_EnableAllBufferOverride;
+    public static String ChannelConfigage_DisableAllBufferOverride;
+    public static String ChannelConfigPage_SetAll;
+    public static String ChannelConfigPage_SetAllNumSubBuf;
+    public static String channelConfigPage_SetAllSubBufSize;
+    public static String ChannelConfigPage_SetAllChannelTimer;
+
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/TraceControlConstants.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/TraceControlConstants.java
new file mode 100644 (file)
index 0000000..413d80b
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol;
+
+
+@SuppressWarnings("nls")
+public class TraceControlConstants {
+
+    // LTTng Resource Constants
+    public static final String Rse_Provider_Resource_Remote_Type_Category = "providers";
+    public static final String Rse_Provider_Resource_Remote_Type = "provider";
+    public static final String Rse_Target_Resource_Remote_Type_Category = "targets";
+    public static final String Rse_Target_Resource_Remote_Type = "target";
+    public static final String Rse_Trace_Resource_Remote_Type_Category = "traces";
+    public static final String Rse_Trace_Resource_Remote_Type = "trace";
+    public static final String Lttng_Providers_Name = "Providers";
+    public static final String Lttng_Ust_TraceName = "auto";
+    public static final String Lttng_Trace_Transport_Relay = "relay";
+    public static final String Lttng_Control_AllChannels = "all";
+    public static final String Lttng_Control_New_Event_Data = "new_trace_data";
+    public static final String Lttng_Control_Unwrite_Trace_Data_Event = "unwrite_trace_data";
+    public static final String Lttng_Control_Trace_Done_Event = "trace_done";
+
+    // the parameter names have to be coordinated with lttctltraceinfo.c in lttng-agent
+    public static final String ACTIVE_TRACE_INFO_PARAM_DESTINATION = "destination";
+    public static final String ACTIVE_TRACE_INFO_PARAM_NUM_THREAD = "numThread";
+    public static final String ACTIVE_TRACE_INFO_PARAM_NORMAL_ONLY = "normal_only";
+    public static final String ACTIVE_TRACE_INFO_PARAM_FLIGHT_ONLY = "flight_only";
+    public static final String ACTIVE_TRACE_INFO_PARAM_ENABLED = "enabled";
+
+    // the destination prefixes have to be coordinated with lttctlkerntransfer.c in lttng-agent
+    public static final String ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL = "local:";
+    public static final String ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK = "network:";
+
+    // Default timeout for TCF tasks (in seconds)
+    public static final int DEFAULT_TCF_TASK_TIMEOUT = 10;
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ConfigureMarkers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ConfigureMarkers.java
new file mode 100644 (file)
index 0000000..d35cd53
--- /dev/null
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs.ConfigureMarkersDialog;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>ConfigureMarkers</u></b>
+ * <p>
+ * Action implementation to configure markers.
+ * </p>
+ */
+public class ConfigureMarkers implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private List<TargetResource> fSelectedTargets;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    public ConfigureMarkers() {
+        fSelectedTargets = new ArrayList<TargetResource>();
+    }
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+
+    }
+
+    /**
+     * Returns the first of all selected targets.
+     * 
+     * @return first selected target.
+     */
+    protected TargetResource getFirstSelectedTarget() {
+        if (fSelectedTargets.size() > 0) {
+            return (TargetResource) fSelectedTargets.get(0);
+        }
+        return null;
+    }
+
+    /**
+     * Returns the SubSystem reference for the selected targets.
+     * 
+     * @return Trace SubSystem
+     */
+    protected ISubSystem getSubSystem() {
+        return getFirstSelectedTarget().getSubSystem();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+        Shell shell = getShell();
+
+        final TargetResource tr = (TargetResource) fSelectedTargets.get(0);
+        TraceSubSystem subSystem = (TraceSubSystem)tr.getSubSystem();
+
+        ConfigureMarkersDialog dialog = new ConfigureMarkersDialog(shell, subSystem);
+        Map<String, Boolean> map = dialog.open(tr);
+        if (map == null) {
+            return;
+        }
+
+        for (Iterator<Map.Entry<String, Boolean>> it = map.entrySet().iterator(); it.hasNext();) {
+            Map.Entry<String, Boolean> entry = (Map.Entry<String, Boolean>) it.next();
+            final String key = (String) entry.getKey();
+
+            final Boolean value = (Boolean) entry.getValue();
+
+            try {
+
+                final ILttControllerService service = subSystem.getControllerService();
+
+                // Create future task
+                @SuppressWarnings("unused")
+                Boolean ok = new TCFTask<Boolean>() {
+                    @Override
+                    public void run() {
+
+                        // Set marker enable using Lttng controller service proxy
+                        service.setMarkerEnable(tr.getParent().getName(), tr.getName(), key, value.booleanValue(), new ILttControllerService.DoneSetMarkerEnable() {
+
+                            @Override
+                            public void doneSetMarkerEnable(IToken token, Exception error, Object str) {
+                                if (error != null) {
+                                    // Notify with error
+                                    error(error);
+                                    return;
+                                }
+
+                                // Notify about success
+                                done(Boolean.valueOf(true));
+                            }
+                        });
+                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            } catch (Exception e) {
+                SystemMessageException sysExp;
+                if (e instanceof SystemMessageException) {
+                    sysExp = (SystemMessageException)e;
+                } else {
+                    sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+                }
+                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorConfigureMarkers + " (" +  //$NON-NLS-1$
+                        Messages.Lttng_Resource_Target + ": "  + tr.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            fSelectedTargets.clear();
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TargetResource) {
+                    fSelectedTargets.add((TargetResource)obj);
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ConfigureTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ConfigureTrace.java
new file mode 100644 (file)
index 0000000..d7a593c
--- /dev/null
@@ -0,0 +1,471 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards.ConfigureTraceWizard;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>ConfigureTrace</u></b>
+ * <p>
+ * Action implementation to configure a trace.
+ * </p>
+ */
+public class ConfigureTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private TraceResource fSelectedTrace = null;
+    private IStructuredSelection fSelection = null;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    public ConfigureTrace() {
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+        ConfigureTraceWizard wizard = new ConfigureTraceWizard();
+        wizard.init(SystemBasePlugin.getActiveWorkbenchWindow().getWorkbench(), fSelection);
+        WizardDialog wDialog= new WizardDialog(getShell(), wizard);
+        wDialog.open();
+        if (wDialog.getReturnCode() != Window.OK) {
+            return;
+        }
+        
+        final TraceConfig result = wizard.getTraceConfig();
+
+        if (result != null) {
+//            try {
+
+                // Update channel settings
+                TraceChannels channels = result.getTraceChannels();
+
+                for (Iterator<String> iterator = channels.keySet().iterator(); iterator.hasNext();) {
+                    String chanName = (String) iterator.next();
+                    TraceChannel chan = channels.get(chanName);
+
+                    boolean doIt = false;
+
+                    // If we channel settings have been updated send the relevant command to the agent
+                    TraceChannel other = new TraceChannel(chan.getName());
+
+                    if (fSelectedTrace.getTraceConfig() == null || fSelectedTrace.getTraceConfig().getTraceChannels() == null) {
+                        // Do the update since channels haven't been configured previously (or we re-connected to the agent)  
+                        doIt = true; 
+                    } else if (fSelectedTrace.getTraceConfig() != null && fSelectedTrace.getTraceConfig().getTraceChannels() != null) {
+                        // Channels has been configured previously, compare new settings with old. Do the update if necessary 
+                        TraceChannel other2 = fSelectedTrace.getTraceConfig().getTraceChannels().get(chanName);
+                        if (other2 != null) {
+                            other = other2;
+                        }
+
+                        doIt = !(chan.equals(other));
+                    }
+
+                    // Please note that currently, the agent doesn't support the retrieval of channel settings. 
+                    // Therefore, the current settings might not be known!
+
+                    if (doIt) {
+                        if (!fSelectedTrace.isUst()) {
+                            // Update kernel tracing related parameters (not applicable for UST)
+
+                            if (chan.isEnabledStatusKnown()) {
+                                if(!other.isEnabledStatusKnown() || (chan.isEnabled() != other.isEnabled()) ) {
+                                    setChannelEnable(chan.getName(), chan.isEnabled());
+                                }
+                            }
+
+                            if (chan.isChannelOverrideStatusKnown()) {
+                                if(!other.isChannelOverrideStatusKnown() || (chan.isChannelOverride() != other.isChannelOverride())) {
+                                    setChannelOverwrite(chanName, chan.isChannelOverride());
+                                }
+                            }
+
+                            if (chan.getSubbufNum() != other.getSubbufNum()) {
+                                setChannelSubbufNum(chanName, chan.getSubbufNum());
+                            }
+
+                            if (chan.getSubbufSize() != other.getSubbufSize()) {
+                                setChannelSubbufSize(chanName, chan.getSubbufSize());
+                            }
+                        }
+
+                        if (chan.getTimer() != other.getTimer()) {
+                            setChannelTimer(chanName, chan.getTimer());    
+                        }
+                    }
+                }
+                // Update state of trace
+                if (fSelectedTrace.getTraceState() == TraceState.CREATED) {
+                    fSelectedTrace.setTraceState(TraceState.CONFIGURED);
+                }
+
+                fSelectedTrace.setTraceConfig(result);
+
+                ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+                registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, fSelectedTrace, fSelectedTrace.getParent(), fSelectedTrace.getSubSystem(), null);
+
+//            } catch (SystemMessageException e) {
+//                SystemMessageException sysExp;
+//                if (e instanceof SystemMessageException) {
+//                    sysExp = (SystemMessageException)e;
+//                } else {
+//                    sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
+//                }
+//                
+//                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorConfigureTrace + " (" +  //$NON-NLS-1$
+//                        Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+//            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            fSelection = (IStructuredSelection) selection;
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TraceResource) {
+                    fSelectedTrace = (TraceResource)obj;
+                    break;
+                }
+            }
+        }
+        else {
+            fSelection = null;
+        }
+        
+    }
+
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+    
+    /*
+     * Enable or disable a channel on the remote system. 
+     */
+    private void setChannelEnable(final String channelName, final boolean enabled) {
+        try {
+            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
+
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Set marker enable using Lttng controller service proxy
+                    service.setChannelEnable(fSelectedTrace.getParent().getParent().getName(),
+                            fSelectedTrace.getParent().getName(), 
+                            fSelectedTrace.getName(), 
+                            channelName, 
+                            enabled,  
+                            new ILttControllerService.DoneSetChannelEnable() {
+
+                        @Override
+                        public void doneSetChannelEnable(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException)e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetChannelEnable + " (" +  //$NON-NLS-1$
+                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+
+    // setChannelOverwrite* provider target trace channel enable
+    private void setChannelOverwrite(final String channelName, final boolean override) {
+        try {
+            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
+
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Set marker enable using Lttng controller service proxy
+                    service.setChannelOverwrite(fSelectedTrace.getParent().getParent().getName(),
+                            fSelectedTrace.getParent().getName(), 
+                            fSelectedTrace.getName(), 
+                            channelName, 
+                            override,  
+                            new ILttControllerService.DoneSetChannelOverwrite() {
+
+                        @Override
+                        public void doneSetChannelOverwrite(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException)e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetChannelOverwrite + " (" +  //$NON-NLS-1$
+                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+    
+    /*
+     * Setup the number of sub-buffers on the remote system.
+     */
+    private void setChannelSubbufNum(final String channelName, final long numSubBuf) {
+        try {
+            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
+
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Set marker enable using Lttng controller service proxy
+                    service.setChannelSubbufNum(fSelectedTrace.getParent().getParent().getName(),
+                            fSelectedTrace.getParent().getName(), 
+                            fSelectedTrace.getName(), 
+                            channelName, 
+                            numSubBuf,  
+                            new ILttControllerService.DoneSetChannelSubbufNum() {
+
+                        @Override
+                        public void doneSetChannelSubbufNum(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException)e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetSubbufNum + " (" +  //$NON-NLS-1$
+                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+
+    /*
+     * Setup the size of the sub-buffer on the remote system.
+     */
+    private void setChannelSubbufSize(final String channelName, final long subBufSize) {
+        try {
+            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
+
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Set marker enable using Lttng controller service proxy
+                    service.setChannelSubbufSize(fSelectedTrace.getParent().getParent().getName(),
+                            fSelectedTrace.getParent().getName(), 
+                            fSelectedTrace.getName(), 
+                            channelName, 
+                            subBufSize,  
+                            new ILttControllerService.DoneSetChannelSubbufSize() {
+
+                        @Override
+                        public void doneSetChannelSubbufSize(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException)e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetSubbufSize + " (" +  //$NON-NLS-1$
+                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+    
+    /*
+     * Setup up the channel timer on the remote system.
+     */
+    private void setChannelTimer(final String channelName, final long timer) {
+        try {
+            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
+
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Set marker enable using Lttng controller service proxy
+                    service.setChannelTimer(fSelectedTrace.getParent().getParent().getName(),
+                            fSelectedTrace.getParent().getName(), 
+                            fSelectedTrace.getName(), 
+                            channelName, 
+                            timer,  
+                            new ILttControllerService.DoneSetChannelTimer() {
+
+                        @Override
+                        public void doneSetChannelTimer(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException)e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetChannelTimer + " (" +  //$NON-NLS-1$
+                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+        }        
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/CreateNewTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/CreateNewTrace.java
new file mode 100644 (file)
index 0000000..c5f852e
--- /dev/null
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs.NewTraceDialog;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>CreateNewTrace</u></b>
+ * <p>
+ * Action implementation to create a new trace.
+ * </p>
+ */
+public class CreateNewTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private final List<TargetResource> fSelectedFiles;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor for CreateNewTrace.
+     */
+    public CreateNewTrace() {
+        fSelectedFiles = new ArrayList<TargetResource>();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
+     * action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+    }
+
+    /**
+     * Returns the first selected target resource.
+     * 
+     * @return first selected target resource
+     */
+    protected TargetResource getFirstSelectedTarget() {
+        if (fSelectedFiles.size() > 0) {
+            return fSelectedFiles.get(0);
+        }
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction action) {
+        Shell shell = getShell();
+        final TargetResource targetResource = getFirstSelectedTarget();
+        TraceSubSystem subSystem = (TraceSubSystem) targetResource.getSubSystem();
+        NewTraceDialog dialog = new NewTraceDialog(shell, subSystem, targetResource);
+
+        final TraceConfig traceConfig = dialog.open();
+
+        if (traceConfig == null) {
+            return;
+        }
+
+        try {
+            final ILttControllerService service = subSystem.getControllerService();
+
+            TraceResource trace = new TraceResource(targetResource.getSubSystem(), service);
+            trace.setName(traceConfig.getTraceName());
+            trace.setParent(targetResource);
+            trace.setTraceConfig(traceConfig);
+
+            if (targetResource.isUst()) {
+                boolean ok = setupUstLocation(service, targetResource, traceConfig);
+                if (!ok) {
+                    return;
+                }
+            }
+
+            trace.setupTrace();
+
+            if (!targetResource.isUst()) {
+
+                // Enable all channels by default
+                trace.setChannelEnable(TraceControlConstants.Lttng_Control_AllChannels, true);
+
+                // Set overwrite mode for all channels according to user
+                // selection (true for flight recorder, false for normal)
+                trace.setChannelOverwrite(TraceControlConstants.Lttng_Control_AllChannels, traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE);
+
+                // Set channel timer for all channels
+                final long period = 1000;
+                trace.setChannelTimer(TraceControlConstants.Lttng_Control_AllChannels, period);
+
+                // Set subbuffer size for all channels
+                final long subbufSize = 16384;
+                trace.setChannelSubbufSize(TraceControlConstants.Lttng_Control_AllChannels, subbufSize);
+
+                // Set number of subbuffers for all channels
+                final long subbufNum = 2;
+                trace.setChannelSubbufNum(TraceControlConstants.Lttng_Control_AllChannels, subbufNum);
+            }
+
+            if (traceConfig.isNetworkTrace()) {
+
+                File newDir = new File(traceConfig.getTracePath());
+                if (!newDir.exists()) {
+                    boolean created = newDir.mkdirs();
+                    if (!created) {
+                        throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
+                    }
+                }
+            }
+
+            if (trace.isUst()) {
+                // in UST the tracing is started after setupTrace!!
+                trace.setTraceState(TraceState.STARTED);
+            } else {
+                trace.setTraceState(TraceState.CONFIGURED);
+            }
+
+            targetResource.addTrace(trace);
+
+            ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+            registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, trace, targetResource, subSystem, null);
+
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException) e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorNewTrace + " (" + //$NON-NLS-1$
+                    Messages.Lttng_Resource_Trace + ": " + traceConfig.getTraceName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+
+            return;
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
+     * .IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    public void selectionChanged(IAction action, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            fSelectedFiles.clear();
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TargetResource) {
+                    fSelectedFiles.add((TargetResource) obj);
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.
+     * IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+
+    /*
+     * Setup the trace location for UST.
+     */
+    private boolean setupUstLocation(final ILttControllerService service, final TargetResource targetResource, final TraceConfig traceConfig)
+            throws Exception {
+        if (traceConfig.isNetworkTrace()) {
+            File localDir = new File(traceConfig.getTracePath());
+            if (!localDir.exists()) {
+                boolean success = localDir.mkdirs();
+                if (!success) {
+                    return false;
+                }
+            }
+
+            // Create future task
+            boolean ok = new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Setup trace location using Lttng controller service proxy
+                    service.writeTraceNetwork(targetResource.getParent().getName(), targetResource.getName(), traceConfig.getTracePath(), traceConfig.getTraceName(),
+                            traceConfig.getNumChannel(), traceConfig.getIsAppend(), traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE,
+                            traceConfig.getMode() == TraceConfig.NORMAL_MODE, new ILttControllerService.DoneWriteTraceNetwork() {
+
+                                @Override
+                                public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
+                                    if (error != null) {
+                                        // Notify with error
+                                        error(error);
+                                        return;
+                                    }
+
+                                    // Notify about success
+                                    done(true);
+                                }
+                            });
+                }
+            }.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            return ok;
+        } else {
+            // Create future task
+            boolean ok = new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Setup trace location using Lttng controller service proxy
+                    service.writeTraceLocal(targetResource.getParent().getName(), targetResource.getName(), traceConfig.getTraceName(),
+                            traceConfig.getTracePath(), traceConfig.getNumChannel(), traceConfig.getIsAppend(),
+                            traceConfig.getMode() == TraceConfig.NORMAL_MODE, traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE,
+                            new ILttControllerService.DoneWriteTraceLocal() {
+
+                                @Override
+                                public void doneWriteTraceLocal(IToken token, Exception error, Object str) {
+                                    if (error != null) {
+                                        // Notify with error
+                                        error(error);
+                                        return;
+                                    }
+
+                                    // Notify about success
+                                    done(true);
+                                }
+                            });
+                }
+            }.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            return ok;
+        }
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/DeleteTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/DeleteTrace.java
new file mode 100644 (file)
index 0000000..23b5e27
--- /dev/null
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>DeleteTrace</u></b>
+ * <p>
+ * Action implementation to delete a new trace.
+ * </p>
+ */
+public class DeleteTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private List<TraceResource> fSelectedTraces;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    
+    public DeleteTrace() {
+        fSelectedTraces = new ArrayList<TraceResource>();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+    }
+
+    /**
+     * Gets the first selected target.
+     * 
+     * @return first selected target.
+     */
+    protected TraceResource getSelectedTarget() {
+        if (fSelectedTraces.size() > 0) {
+            return (TraceResource) fSelectedTraces.get(0);
+        }
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+       
+               boolean confirm = MessageDialog.openConfirm(getShell(),
+                               Messages.DeleteTrace_ConfirmTitle,
+                               Messages.DeleteTrace_ConfirmMessage);
+               if (!confirm) {
+                       return;
+               }
+
+        int size = fSelectedTraces.size();
+        for (int i = 0; i < size; i++) {
+
+            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
+
+            trace.getParent().removeTrace(trace);
+            
+            ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+            registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, trace, trace.getParent(), trace.getSubSystem(), null);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        
+        if (selection instanceof IStructuredSelection) {
+            fSelectedTraces.clear();
+
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TraceResource) {
+                    fSelectedTraces.add((TraceResource)obj);
+                }
+            }
+        }
+
+    }
+
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ImportToProject.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/ImportToProject.java
new file mode 100644 (file)
index 0000000..28dc8f4
--- /dev/null
@@ -0,0 +1,346 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs.ImportTraceDialog;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.services.files.IFileService;
+import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
+import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+
+/**
+ * <b><u>ImportToProject</u></b>
+ * <p>
+ * Action implementation to import a trace to a LTTng project.
+ * </p>
+ */
+public class ImportToProject implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+
+       public static final String TRACE_FOLDER_NAME = "Traces"; //$NON-NLS-1$
+       
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private List<TraceResource> fSelectedTraces;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    public ImportToProject() {
+        fSelectedTraces = new ArrayList<TraceResource>();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+    }
+
+    /**
+     * Gets the first selected trace.
+     * @return first selected trace
+     */
+    protected TraceResource getFirstSelectedTrace() {
+        if (fSelectedTraces.size() > 0) {
+            return (TraceResource) fSelectedTraces.get(0);
+        }
+        return null;
+    }
+
+    /**
+     * Gets the trace SubSystem for the selected trace.
+     * 
+     * @return trace SubSystem
+     */
+    protected ISubSystem getSubSystem() {
+        return getFirstSelectedTrace().getSubSystem();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+        for (int i = 0; i < fSelectedTraces.size(); i++) {
+
+            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
+            ImportTraceDialog dialog = new ImportTraceDialog(getShell(), trace);
+            int result = dialog.open();
+            if (result == Dialog.OK) {
+               IProject project = dialog.getProject();
+               String traceName = dialog.getTraceName();
+               if (trace.getTraceConfig().isNetworkTrace()) {
+                       if (dialog.getLinkOnly()) {
+                               linkTrace(getShell(), trace, project, traceName);
+                       } else {
+                               copyTrace(trace, project, traceName);
+                       }
+               } else {
+                       downloadTrace(trace, project, traceName);
+               }
+            }
+        }
+    }
+
+    /*
+     * method to download a trace from the remote system.
+     */
+    private void downloadTrace(TraceResource trace, IProject project, String traceName) {
+               try {
+                       IHost host = trace.getSubSystem().getHost();
+                       ISubSystem[] sss = RSECorePlugin.getTheSystemRegistry().getSubsystems(host, IFileServiceSubSystem.class);
+                       if (sss.length == 0 || !(sss[0] instanceof FileServiceSubSystem)) {
+                               MessageDialog.openWarning(getShell(),
+                                               Messages.ImportToProject_ImportFailed,
+                                               Messages.ImportToProject_NoFileServiceSubsystem);
+                               return;
+                       }
+                       FileServiceSubSystem fsss = (FileServiceSubSystem) sss[0];
+                       
+                       IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
+                       if (!traceFolder.exists()) {
+                               MessageDialog.openWarning(getShell(),
+                                               Messages.ImportToProject_ImportFailed,
+                                               Messages.ImportToProject_NoProjectTraceFolder);
+                               return;
+                       }
+
+                       IRemoteFile remoteFolder = fsss.getRemoteFileObject(trace.getTraceConfig().getTracePath(), new NullProgressMonitor());
+                       if (remoteFolder == null || !remoteFolder.exists()) {
+                               MessageDialog.openWarning(getShell(),
+                                               Messages.ImportToProject_ImportFailed,
+                                               Messages.ImportToProject_NoRemoteTraceFolder);
+                               return;
+                       }
+                       
+                       IFolder folder = traceFolder.getFolder(traceName);
+                       if (folder.exists()) {
+                               MessageDialog.openWarning(getShell(),
+                                               Messages.ImportToProject_ImportFailed,
+                                               Messages.ImportToProject_AlreadyExists);
+                               return;
+                       } else {
+                               folder.create(true, true, null);
+                       }
+                       
+                       IRemoteFile[] sources = fsss.list(remoteFolder, IFileService.FILE_TYPE_FILES, new NullProgressMonitor());
+
+                       String[] destinations = new String[sources.length];
+                       String[] encodings = new String[sources.length];
+                       for (int i = 0; i < sources.length; i++) {
+                               destinations[i] = folder.getLocation().addTrailingSeparator().append(sources[i].getName()).toString();
+                               encodings[i] = null;
+                       }
+                       
+                       fsss.downloadMultiple(sources, destinations, encodings, new NullProgressMonitor());
+                       
+               } catch (SystemMessageException e) {
+                       MessageDialog.openWarning(getShell(),
+                                       Messages.ImportToProject_ImportFailed,
+                                       e.getMessage());
+               } catch (CoreException e) {
+                       MessageDialog.openWarning(getShell(),
+                                       Messages.ImportToProject_ImportFailed,
+                                       e.getMessage());
+               }
+       }
+
+    /*
+     * Method to copy a trace residing on the local host. 
+     */
+       private void copyTrace(TraceResource trace, IProject project, String traceName) {
+               IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
+               if (!traceFolder.exists()) {
+                       MessageDialog.openWarning(getShell(),
+                                       Messages.ImportToProject_ImportFailed,
+                                       Messages.ImportToProject_NoProjectTraceFolder);
+                       return;
+               }
+               
+               IPath containerPath = traceFolder.getFullPath().addTrailingSeparator().append(traceName);
+               
+               File sourceFolder = new File(trace.getTraceConfig().getTracePath());
+               
+               IOverwriteQuery overriteImplementor = new IOverwriteQuery(){
+                       @Override
+                       public String queryOverwrite(String pathString) {
+                               MessageDialog.openWarning(getShell(),
+                                               Messages.ImportToProject_ImportFailed,
+                                               Messages.ImportToProject_AlreadyExists);
+                               return IOverwriteQuery.NO_ALL;
+                       }};
+               
+               ImportOperation operation = new ImportOperation(
+                               containerPath,
+                               sourceFolder,
+                               FileSystemStructureProvider.INSTANCE,
+                               overriteImplementor);
+               operation.setCreateContainerStructure(false);
+               
+               try {
+                       operation.run(new NullProgressMonitor());
+               } catch (InvocationTargetException e) {
+                       MessageDialog.openWarning(getShell(),
+                                       Messages.ImportToProject_ImportFailed,
+                                       e.getMessage());
+               } catch (InterruptedException e) {
+                       MessageDialog.openWarning(getShell(),
+                                       Messages.ImportToProject_ImportFailed,
+                                       e.getMessage());
+               }
+       }
+
+    /*
+     * Method to create a symbolic link to a trace residing on the local host. 
+     */
+    public static void linkTrace(Shell shell, TraceResource trace, IProject project, String traceName) {
+        IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
+        if (!traceFolder.exists()) {
+            MessageDialog.openWarning(shell,
+                    Messages.ImportToProject_ImportFailed,
+                    Messages.ImportToProject_NoProjectTraceFolder);
+            return;
+        }
+
+        IFolder folder = traceFolder.getFolder(traceName);
+        if (folder.exists()) {
+            MessageDialog.openWarning(shell,
+                    Messages.ImportToProject_ImportFailed,
+                    Messages.ImportToProject_AlreadyExists);
+            return;
+        }
+
+        File sourceFolder = new File(trace.getTraceConfig().getTracePath());
+
+        try {
+            folder.createLink(sourceFolder.toURI(), IResource.REPLACE, null);
+            // Set the trace properties for this resource
+            // FIXME: update from extension point properties
+            folder.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, Activator.PLUGIN_ID);
+            folder.setPersistentProperty(TmfTraceElement.TRACETYPE, "org.eclipse.linuxtools.lttng.tracetype.kernel"); //$NON-NLS-1$
+            folder.setPersistentProperty(TmfTraceElement.TRACEICON, "icons/obj16/tux2.png"); //$NON-NLS-1$
+        } catch (CoreException e) {
+            MessageDialog.openWarning(shell,
+                    Messages.ImportToProject_ImportFailed,
+                    e.getMessage());
+        }
+    }
+
+       /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            fSelectedTraces.clear();
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TraceResource) {
+                    fSelectedTraces.add((TraceResource)obj);
+                }
+            }
+        }
+    }
+
+    /**
+     * Set selected traces
+     * @param traces
+     */
+    public void setSelectedTraces(List<TraceResource> traces) {
+        fSelectedTraces = traces; 
+    }
+    
+    
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/PauseTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/PauseTrace.java
new file mode 100644 (file)
index 0000000..aba32e6
--- /dev/null
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>PauseTrace</u></b>
+ * <p>
+ * Action implementation to pause a trace.
+ * </p>
+ */
+public class PauseTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private List<TraceResource> fSelectedTraces;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    public PauseTrace() {
+        fSelectedTraces = new ArrayList<TraceResource>();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+        for (int i = 0; i < fSelectedTraces.size(); i++) {
+
+            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
+            TraceSubSystem subSystem = (TraceSubSystem)trace.getSubSystem();
+            
+            try {
+                final ILttControllerService service = subSystem.getControllerService();
+
+                // Create future task
+                @SuppressWarnings("unused")
+                Boolean success = new TCFTask<Boolean>() {
+                    @Override
+                    public void run() {
+
+                        // Setup trace  using Lttng controller service proxy
+                        service.pauseTrace(trace.getParent().getParent().getName(), trace.getParent().getName(), trace.getName(), new ILttControllerService.DonePauseTrace() {
+
+                            @Override
+                            public void donePauseTrace(IToken token, Exception error, Object str) {
+                                if (error != null) {
+                                    // Notify with error
+                                    error(error);
+                                    return;
+                                }
+
+                                // Notify about success
+                                done(Boolean.valueOf(true));
+                            }
+                        });
+                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+                    trace.setTraceState(TraceState.PAUSED);
+                    
+                    ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+                    registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
+                         
+            } catch (Exception e) {
+                SystemMessageException sysExp;
+                if (e instanceof SystemMessageException) {
+                    sysExp = (SystemMessageException)e;
+                } else {
+                    sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+                }
+                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorPause + " (" +  //$NON-NLS-1$
+                        Messages.Lttng_Resource_Trace + ": "  + trace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            fSelectedTraces.clear();
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TraceResource) {
+                    fSelectedTraces.add((TraceResource)obj);
+                }
+            }
+        }
+    }
+
+    /**
+     * Set selected traces
+     * @param traces
+     */
+    public void setSelectedTraces(List<TraceResource> traces) {
+        fSelectedTraces = traces; 
+    }
+    
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/StartTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/StartTrace.java
new file mode 100644 (file)
index 0000000..7d5e87c
--- /dev/null
@@ -0,0 +1,367 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs.SelectTracePathDialog;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>StartTrace</u></b>
+ * <p>
+ * Action implementation to start and resume a trace. Starting a trace the first time will allocate all 
+ * necessary resources and configure all necessary parameters on the remote system.
+ * </p>
+ */
+public class StartTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private List<TraceResource> fSelectedTraces;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    public StartTrace() {
+        fSelectedTraces = new ArrayList<TraceResource>();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+        for (int i = 0; i < fSelectedTraces.size(); i++) {
+
+            TraceResource trace = (TraceResource) fSelectedTraces.get(i);
+            TraceSubSystem subSystem = (TraceSubSystem)trace.getSubSystem();
+
+            TraceConfig traceConfig = trace.getTraceConfig();
+            if (traceConfig != null) {
+                try {
+                    ILttControllerService service = subSystem.getControllerService();
+                    if (trace.getTraceState() == TraceState.CONFIGURED) {
+                        setTraceTransport(service, trace, traceConfig);
+                        allocTrace(service, trace, traceConfig);
+                       setupLocation(service, trace, traceConfig);
+                    }
+                    // for network traces and if trace path is not available, open a dialog box for the user to specify the trace path
+                    else if (traceConfig.isNetworkTrace() && (TraceConfig.InvalidTracePath.equals(traceConfig.getTracePath()))) {
+                        
+                        SelectTracePathDialog selectDialog = new SelectTracePathDialog(SystemBasePlugin.getActiveWorkbenchShell());
+
+                        if (selectDialog.open() == Window.OK) {
+                            traceConfig.setTracePath(selectDialog.getTracePath());
+                        }
+                        else {
+                            // we don't have place to store the trace files ... go to the next trace
+                            continue;
+                        }
+                    }
+
+                    startTrace(service, trace, traceConfig);
+
+                    trace.setTraceState(TraceState.STARTED);
+
+                    if (trace.isNetworkTraceAndStarted()) {
+                        LiveTraceManager.setLiveTrace(trace.getTraceConfig().getTracePath(), true);
+                    }
+
+                    // Refresh display
+                    ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+                    registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
+
+                } catch (Exception e) {
+                    SystemMessageException sysExp;
+                    if (e instanceof SystemMessageException) {
+                        sysExp = (SystemMessageException)e;
+                    } else {
+                        sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+                    }
+                    SystemBasePlugin.logError(Messages.Lttng_Control_ErrorStart + " (" +  //$NON-NLS-1$
+                            Messages.Lttng_Resource_Trace + ": "  + trace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+                } 
+           }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            fSelectedTraces.clear();
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TraceResource) {
+                    fSelectedTraces.add((TraceResource)obj);
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow arg0) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+
+    /*
+     * Setup trace transport on the remote system
+     */
+    private void setTraceTransport(final ILttControllerService service, final TraceResource trace, final TraceConfig oldConfig) throws Exception {
+        // Create future task
+        new TCFTask<Boolean>() {
+            @Override
+            public void run() {
+
+                // Setup trace transport using Lttng controller service proxy
+                service.setTraceTransport(trace.getParent().getParent().getName(), 
+                        trace.getParent().getName(), 
+                        oldConfig.getTraceName(), 
+                        oldConfig.getTraceTransport(), 
+                        new ILttControllerService.DoneSetTraceTransport() {
+
+                    @Override
+                    public void doneSetTraceTransport(IToken token, Exception error, Object str) {
+                        if (error != null) {
+                            // Notify with error
+                            error(error);
+                            return;
+                        }
+
+                        // Notify about success
+                        done(Boolean.valueOf(true));
+                    }
+                });
+            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+    }
+
+    /*
+     * Allocate trace resources on the remote system.
+     */
+    private void allocTrace(final ILttControllerService service, final TraceResource trace, final TraceConfig oldConfig) throws Exception {
+        new TCFTask<Boolean>() {
+        @Override
+        public void run() {
+
+            // Setup trace transport using Lttng controller service proxy
+            service.allocTrace(trace.getParent().getParent().getName(), 
+                    trace.getParent().getName(), 
+                    trace.getName(),  
+                    new ILttControllerService.DoneAllocTrace() {
+
+                @Override
+                public void doneAllocTrace(IToken token, Exception error, Object str) {
+                    if (error != null) {
+                        // Notify with error
+                        error(error);
+                        return;
+                    }
+
+                    // Notify about success
+                    done(Boolean.valueOf(true));
+                }
+            });
+        }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+    }
+
+    /*
+     * Setup the trace location. Only normal channels are written while trace is started.  
+     */
+    private void setupLocation(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
+        if (traceConfig.isNetworkTrace()) {
+
+            File newDir = new File(traceConfig.getTracePath());
+            if (!newDir.exists()) {
+                boolean created = newDir.mkdirs();
+                if (!created) {
+                    throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
+                }
+            }
+            
+            if (traceConfig.getProject() != null) {
+                ImportToProject.linkTrace(getShell(), trace, traceConfig.getProject(), traceConfig.getTraceName());
+            }
+            
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Setup trace transport using Lttng controller service proxy
+                    service.writeTraceNetwork(trace.getParent().getParent().getName(), 
+                            trace.getParent().getName(), 
+                            traceConfig.getTraceName(), 
+                            traceConfig.getTracePath(), 
+                            traceConfig.getNumChannel(), 
+                            traceConfig.getIsAppend(), 
+                            false, 
+                            true, // write only normal channels 
+                            new ILttControllerService.DoneWriteTraceNetwork() {
+
+                        @Override
+                        public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            
+        } else {
+            
+            // Create future task
+            new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Setup trace transport using Lttng controller service proxy
+                    service.writeTraceLocal(trace.getParent().getParent().getName(), 
+                            trace.getParent().getName(), 
+                            traceConfig.getTraceName(), 
+                            traceConfig.getTracePath(), 
+                            traceConfig.getNumChannel(),
+                            traceConfig.getIsAppend(), 
+                            false, 
+                            true, // write only normal channels 
+                            new ILttControllerService.DoneWriteTraceLocal() {
+
+                        @Override
+                        public void doneWriteTraceLocal(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        }
+    }
+
+    /*
+     * Starts the trace on the remote system.
+     */
+    private void startTrace(final ILttControllerService service, final TraceResource trace, final TraceConfig oldConfig) throws Exception {
+        new TCFTask<Boolean>() {
+        @Override
+        public void run() {
+
+            // Setup trace transport using Lttng controller service proxy
+            service.startTrace(trace.getParent().getParent().getName(), trace.getParent().getName(), oldConfig.getTraceName(), new ILttControllerService.DoneStartTrace() {
+
+                @Override
+                public void doneStartTrace(IToken token, Exception error, Object str) {
+                    if (error != null) {
+                        
+                        // Notify with error
+                        error(error);
+                        return;
+                    }
+
+                    // Notify about success
+                    done(Boolean.valueOf(true));
+                }
+            });
+        }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS );
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/StopTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/actions/StopTrace.java
new file mode 100644 (file)
index 0000000..b608f11
--- /dev/null
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * <b><u>StopTrace</u></b>
+ * <p>
+ * Action implementation to stop a trace which deallocates all resources on the remote system.
+ * </p>
+ */
+public class StopTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private List<TraceResource> fSelectedTraces;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    
+    public StopTrace() {
+        fSelectedTraces = new ArrayList<TraceResource>();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    @Override
+    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    @Override
+    public void run(IAction arg0) {
+        int size = fSelectedTraces.size();
+        for (int i = 0; i < size; i++) {
+
+            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
+            TraceSubSystem subSystem = (TraceSubSystem)trace.getSubSystem();
+
+            try {
+                final ILttControllerService service = subSystem.getControllerService();
+                
+                TraceConfig traceConfig = trace.getTraceConfig();
+                if (traceConfig != null && traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE) {
+                       setupLocation(service, trace, traceConfig);
+                }
+                
+                // Create future task
+                @SuppressWarnings("unused")
+                Boolean success = new TCFTask<Boolean>() {
+                    @Override
+                    public void run() {
+
+                        // Setup trace  using Lttng controller service proxy
+                        service.destroyTrace(trace.getParent().getParent().getName(), trace.getParent().getName(), trace.getName(), new ILttControllerService.DoneDestroyTrace() {
+
+                            @Override
+                            public void doneDestroyTrace(IToken token, Exception error, Object str) {
+                                if (error != null) {
+                                    // Notify with error
+                                    error(error);
+                                    return;
+                                }
+
+                                // Notify about success
+                                done(Boolean.valueOf(true));
+                            }
+                        });
+                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+                    
+                    trace.setTraceState(TraceState.STOPPED);
+
+                    if (trace.getTraceConfig() != null) {
+                        LiveTraceManager.setLiveTrace(trace.getTraceConfig().getTracePath(), false);
+                    }
+
+                    ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+                    registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
+
+            } catch (Exception e) {
+                SystemMessageException sysExp;
+                if (e instanceof SystemMessageException) {
+                    sysExp = (SystemMessageException)e;
+                } else {
+                    sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+                }
+                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorStop + " (" +  //$NON-NLS-1$
+                        Messages.Lttng_Resource_Trace + ": "  + trace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        
+        if (selection instanceof IStructuredSelection) {
+            fSelectedTraces.clear();
+
+            // store the selected targets to be used when running
+            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
+            while (theSet.hasNext()) {
+                Object obj = theSet.next();
+                if (obj instanceof TraceResource) {
+                    fSelectedTraces.add((TraceResource)obj);
+                }
+            }
+        }
+
+    }
+
+    /**
+     * Returns the active workbench shell of this plug-in.
+     * 
+     * @return active workbench shell.
+     */
+    protected Shell getShell() {
+        return SystemBasePlugin.getActiveWorkbenchShell();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    @Override
+    public void init(IWorkbenchWindow window) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+     */
+    @Override
+    public void init(IViewPart view) {
+    }
+    
+    /*
+     * Setup the trace location. Only flight recorder channels are written when trace is stopped.
+     */
+    private void setupLocation(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
+       boolean success = false;
+       
+        if (traceConfig.isNetworkTrace()) {
+
+            // Create future task
+            success = new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Setup trace transport using Lttng controller service proxy
+                    service.writeTraceNetwork(trace.getParent().getParent().getName(), 
+                            trace.getParent().getName(), 
+                            traceConfig.getTraceName(), 
+                            traceConfig.getTracePath(), 
+                            traceConfig.getNumChannel(), 
+                            traceConfig.getIsAppend(), 
+                            true, // write only flight recorder channels 
+                            false, 
+                            new ILttControllerService.DoneWriteTraceNetwork() {
+
+                        @Override
+                        public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            
+        } else {
+            
+            // Create future task
+            success = new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Setup trace transport using Lttng controller service proxy
+                    service.writeTraceLocal(trace.getParent().getParent().getName(), 
+                            trace.getParent().getName(), 
+                            traceConfig.getTraceName(), 
+                            traceConfig.getTracePath(), 
+                            traceConfig.getNumChannel(),
+                            traceConfig.getIsAppend(), 
+                            true, // write only flight recorder channels 
+                            false, 
+                            new ILttControllerService.DoneWriteTraceLocal() {
+
+                        @Override
+                        public void doneWriteTraceLocal(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(Boolean.valueOf(true));
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        }
+        
+        if (success) {
+            //FIXME: wait 2 seconds to allow time for channels to be written before destroying the trace
+            try {
+                               Thread.sleep(2000);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+        }
+    }
+
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/connectorservice/TraceConnectorService.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/connectorservice/TraceConnectorService.java
new file mode 100644 (file)
index 0000000..c4608e7
--- /dev/null
@@ -0,0 +1,385 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation (based on TCFConnectorService)
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.connectorservice;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.LttControllerServiceProxy;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.utility.DownloadProxy;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.CommunicationsEvent;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.rse.ui.subsystems.StandardConnectorService;
+import org.eclipse.tm.tcf.core.AbstractPeer;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IChannel.IEventListener;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.tcf.protocol.IService;
+import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.tcf.services.ILocator;
+
+/**
+ * <b><u>TraceConnectorService</u></b>
+ * <p>
+ * Implementation of the Trace Connector class to connect to the remote agent.
+ * </p>
+ */
+public class TraceConnectorService extends StandardConnectorService {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private final static int INVOCATION_TIMEOUT = 1000;
+    private boolean fIsConnected = false;
+    private IChannel fChannel;
+    private Throwable fChannelError;
+
+    private final List<Runnable> fWaitList = new ArrayList<Runnable>();
+    private boolean fPollTimerStarted;
+    private DownloadProxy fDownloadProxy = null;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * Constructor for TraceConnectorService.
+     * 
+     * @param host - host reference
+     * @param port - port
+     */
+    public TraceConnectorService(IHost host, int port) {
+        super(Messages.Trace_Connector_Service_Name, Messages.Trace_Connector_Service_Description, host, port);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.IConnectorService#isConnected()
+     */
+    @Override
+    public boolean isConnected() {
+        return fIsConnected;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalConnect(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    protected void internalConnect(final IProgressMonitor monitor) throws Exception {
+        assert !Protocol.isDispatchThread();
+        final Exception[] res = new Exception[1];
+        // Fire comm event to signal state about to change
+        fireCommunicationsEvent(CommunicationsEvent.BEFORE_CONNECT);
+        monitor.beginTask(Messages.Trace_Connector_Service_Connect_Msg + " " + getHostName(), 1); //$NON-NLS-1$
+        synchronized (res) {
+            Protocol.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    if (!connectTCFChannel(res, monitor)) {
+                        add_to_wait_list(this);
+                    }
+                }
+            });
+            res.wait();
+        }
+        monitor.done();
+        if (res[0] != null) {
+            throw res[0];
+        }
+        // pretend. Normally, we'd connect to our remote server-side code here
+        fIsConnected = true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalDisconnect(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void internalDisconnect(final IProgressMonitor monitor) throws Exception {
+        assert !Protocol.isDispatchThread();
+        final Exception[] res = new Exception[1];
+        // Fire comm event to signal state about to change
+        fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT);
+        monitor.beginTask(Messages.Trace_Connector_Service_Disconnect_Msg + " " + getHostName(), 1); //$NON-NLS-1$
+        synchronized (res) {
+            Protocol.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    if (!disconnectTCFChannel(res, monitor)) {
+                        add_to_wait_list(this);
+                    }
+                }
+            });
+            res.wait();
+        }
+        monitor.done();
+        if (res[0] != null) {
+            throw res[0];
+        }
+        fIsConnected = false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsRemoteServerLaunching()
+     */
+    @Override
+    public boolean supportsRemoteServerLaunching() {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsServerLaunchProperties()
+     */
+    @Override
+    public boolean supportsServerLaunchProperties() {
+        return false;
+    }
+
+    /*
+     * Add Runnable to wait list.
+     */
+    private void add_to_wait_list(Runnable cb) {
+        fWaitList.add(cb);
+        if (fPollTimerStarted) {
+            return;
+        }
+        Protocol.invokeLater(INVOCATION_TIMEOUT, new Runnable() {
+            @Override
+            public void run() {
+                fPollTimerStarted = false;
+                run_wait_list();
+            }
+        });
+        fPollTimerStarted = true;
+    }
+
+    /*
+     * Run the runnables of the wait list.
+     */
+    private void run_wait_list() {
+        if (fWaitList.isEmpty()) {
+            return;
+        }
+        Runnable[] runnables = fWaitList.toArray(new Runnable[fWaitList.size()]);
+        fWaitList.clear();
+        for (int i = 0; i < runnables.length; i++) {
+            runnables[i].run();
+        }
+    }
+
+    /*
+     * Connect the TCF channel.
+     */
+    private boolean connectTCFChannel(Exception[] res, IProgressMonitor monitor) {
+        if (fChannel != null) {
+            switch (fChannel.getState()) {
+            case IChannel.STATE_OPEN:
+            case IChannel.STATE_CLOSED:
+                synchronized (res) {
+                    if (fChannelError instanceof Exception) {
+                        res[0] = (Exception) fChannelError;
+                    }
+                    else if (fChannelError != null) {
+                        res[0] = new Exception(fChannelError);
+                    }
+                    else {
+                        res[0] = null;
+                    }
+                    res.notifyAll();
+                    return true;
+                }
+                default:
+            }
+        }
+        if (monitor.isCanceled()) {
+            synchronized (res) {
+                res[0] = new Exception(Messages.Trace_Connector_Service_Canceled_Msg); 
+                if (fChannel != null) {
+                    fChannel.terminate(res[0]);
+                }
+                res.notifyAll();
+                return true;
+            }
+        }
+        if (fChannel == null) {
+            String host = getHostName().toLowerCase();
+            int port = getConnectPort();
+            if (port <= 0) {
+                // Default fallback
+                port = TraceConnectorServiceManager.TCF_PORT;
+            }
+            IPeer peer = null;
+            String port_str = Integer.toString(port);
+            ILocator locator = Protocol.getLocator();
+            for (IPeer p : locator.getPeers().values()) {
+                Map<String, String> attrs = p.getAttributes();
+                if ("TCP".equals(attrs.get(IPeer.ATTR_TRANSPORT_NAME)) &&  //$NON-NLS-1$
+                        host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) && port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) {
+                    peer = p;
+                    break;
+                }
+            }
+            if (peer == null) {
+                Map<String, String> attrs = new HashMap<String, String>();
+                attrs.put(IPeer.ATTR_ID, "RSE:" + host + ":" + port_str);  //$NON-NLS-1$ //$NON-NLS-2$
+                attrs.put(IPeer.ATTR_NAME, getName());
+                attrs.put(IPeer.ATTR_TRANSPORT_NAME, "TCP");  //$NON-NLS-1$
+                attrs.put(IPeer.ATTR_IP_HOST, host);
+                attrs.put(IPeer.ATTR_IP_PORT, port_str);
+                peer = new AbstractPeer(attrs);
+            }
+            fChannel = peer.openChannel();
+            fChannel.addChannelListener(new IChannel.IChannelListener() {
+                @Override
+                public void onChannelOpened() {
+                    assert fChannel != null;
+
+                    // Check if remote server provides LTTng service
+                    if (fChannel.getRemoteService(ILttControllerService.NAME) == null) {
+                        return;
+                    }
+                    // Create service proxy, passing the fChannel to the proxy
+                    ILttControllerService controllerService = new LttControllerServiceProxy(fChannel);
+
+                    fChannel.setServiceProxy(ILttControllerService.class, controllerService);
+
+                    ISubSystem[] subSystems = getSubSystems();
+
+                    for (int i = 0; i < subSystems.length; i++) {
+                        if (subSystems[i] instanceof TraceSubSystem) {
+                            // There is only one trace subsystem per trace connector service 
+                            fDownloadProxy = new DownloadProxy((TraceSubSystem)subSystems[i]);
+                        }
+                    }
+
+                    final IEventListener listener = new IEventListener() {
+
+                        @Override
+                        public void event(String name, byte[] data) {
+                            if (fDownloadProxy != null) {
+                                if (name.compareTo(TraceControlConstants.Lttng_Control_New_Event_Data) == 0) {
+                                    fDownloadProxy.writeDownloadedTrace(data);
+                                    }
+                                else if (name.compareTo(TraceControlConstants.Lttng_Control_Unwrite_Trace_Data_Event) == 0) {
+                                        // only for UST
+                                        // TODO implement handling
+                                    }
+                                else if (name.compareTo(TraceControlConstants.Lttng_Control_Trace_Done_Event) == 0) {
+                                    // finished 
+                                    fDownloadProxy.handleTraceDoneEvent(data);
+                                } else {
+                                    try {
+                                        throw new IOException(LttngConstants.Lttng_Control_Command + ": " + Messages.Lttng_Control_Unknown_Event_Msg + ": " + name);  //$NON-NLS-1$ //$NON-NLS-2$  
+                                    } catch (IOException e) {
+                                        SystemBasePlugin.logError("TraceConnectorService", e); //$NON-NLS-1$
+                                    }
+                                }
+                            }
+                        }
+                    };
+                    fChannel.addEventListener(controllerService, listener);
+                    run_wait_list();
+                }
+
+                @Override
+                public void congestionLevel(int level) {
+                }
+
+                @Override
+                public void onChannelClosed(Throwable error) {
+                    assert fChannel != null;
+                    fChannel.removeChannelListener(this);
+                    fChannelError = error;
+                    if (fWaitList.isEmpty()) {
+                        fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR);
+                    } else {
+                        run_wait_list();
+                    }
+                    fChannel = null;
+                    fChannelError = null;
+                }
+
+            });
+
+            assert fChannel.getState() == IChannel.STATE_OPENING;
+        }
+        return false;
+    }
+
+    /*
+     * Disconnect the TCF channel.
+     */
+    private boolean disconnectTCFChannel(Exception[] res, IProgressMonitor monitor) {
+        if (fChannel == null || fChannel.getState() == IChannel.STATE_CLOSED) {
+            synchronized (res) {
+                res[0] = null;
+                res.notifyAll();
+                return true;
+            }
+        }
+        if (monitor.isCanceled()) {
+            synchronized (res) {
+                res[0] = new Exception("Canceled"); //$NON-NLS-1$
+                res.notifyAll();
+                return true;
+            }
+        }
+        if (fChannel.getState() == IChannel.STATE_OPEN) {
+            fChannel.close();
+        }
+        return false;
+    }
+
+    /**
+     * Retrieve the remote service for given service interface.
+     * 
+     * @param <V>
+     * @param service_interface
+     * @return Service
+     * @throws Exception
+     */
+    public <V extends IService> V getService(Class<V> service_interface) throws Exception {
+        if (fChannel == null || fChannel.getState() != IChannel.STATE_OPEN) {
+            throw new Exception(Messages.Ltt_Controller_Service_Not_Connected_Msg + ": " + service_interface.getName()); //$NON-NLS-1$
+        }
+        V service = fChannel.getRemoteService(service_interface);
+        if (service == null) {
+            throw new Exception(Messages.Ltt_Controller_Service_Unsupported_Msg + ": " + service_interface.getName()); //$NON-NLS-1$
+        }
+        return service;
+    }
+
+    /**
+     * Retrieve the LTTng remote service.
+     * 
+     * @return LTTng remote Service
+     * @throws Exception
+     */
+    public LttControllerServiceProxy getControllerService() throws Exception {
+        return (LttControllerServiceProxy)getService(ILttControllerService.class);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/connectorservice/TraceConnectorServiceManager.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/connectorservice/TraceConnectorServiceManager.java
new file mode 100644 (file)
index 0000000..c940f81
--- /dev/null
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.connectorservice;
+
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.ITCFSubSystem;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.ITraceSubSystem;
+import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+
+/**
+ * <b><u>TraceConnectorServiceManager</u></b>
+ * <p>
+ * Implementation of the Trace Connector Service Manager class for the creation 
+ * of the Trace Connector service.
+ * </p>
+ */
+public class TraceConnectorServiceManager extends AbstractConnectorServiceManager {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private static TraceConnectorServiceManager INSTANCE = new TraceConnectorServiceManager();
+
+    public static final int TCF_PORT = 1534;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * Return singleton instance
+     */
+    public static TraceConnectorServiceManager getInstance() {
+        if (INSTANCE == null) {
+            INSTANCE = new TraceConnectorServiceManager();
+        }
+        return INSTANCE;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#createConnectorService(org.eclipse.rse.core.model.IHost)
+     */
+    @Override
+    public IConnectorService createConnectorService(IHost host) {
+        return new TraceConnectorService(host, TCF_PORT);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#sharesSystem(org.eclipse.rse.core.subsystems.ISubSystem)
+     */
+    @Override
+    public boolean sharesSystem(ISubSystem otherSubSystem) {
+        return (otherSubSystem instanceof ITCFSubSystem);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#getSubSystemCommonInterface(org.eclipse.rse.core.subsystems.ISubSystem)
+     */
+    @Override
+    public Class<ITraceSubSystem> getSubSystemCommonInterface(ISubSystem subsystem) {
+        return ITraceSubSystem.class;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/ConfigureMarkersDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/ConfigureMarkersDialog.java
new file mode 100644 (file)
index 0000000..da09db6
--- /dev/null
@@ -0,0 +1,403 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+
+/**
+ * <b><u>ConfigureMarkersDialog</u></b>
+ * <p>
+ * Dialog box to configure markers for a given target resource.
+ * </p>
+ */
+public class ConfigureMarkersDialog extends Dialog {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    
+    private String[] fMarkersList;
+    private TargetResource fTarget;
+    private Boolean fOkClicked;
+    Map<String, Boolean> fMap;
+    private TableItem[] fTableLines;
+    private Boolean[] fInitialMarkersStates;
+
+    private TraceSubSystem fSubSystem;
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor 
+     * 
+     * @param parent The parent shell
+     * @param subSystem The trace SubSystem
+     */
+    public ConfigureMarkersDialog(Shell parent, TraceSubSystem subSystem) {
+        super(parent);
+        fOkClicked = false;
+        fSubSystem = subSystem;
+    }
+
+    /**
+     * Constructor
+     * 
+     * @param parent The parent shell
+     * @param style The dialog box style
+     * @param subSystem The trace SubSystem
+
+     */
+    public ConfigureMarkersDialog(Shell parent, int style, TraceSubSystem subSystem) {
+        super(parent, style);
+        fOkClicked = false;
+        fSubSystem = subSystem;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    public Map<String, Boolean> open(TargetResource aTarget) {
+        fTarget = aTarget;
+        
+        Shell parent = getParent();
+        final Display display = parent.getDisplay();
+        final Shell shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE);
+        shell.setText(Messages.ConfigureMarkersDialog_Title);
+        shell.setImage(Activator.getDefault().getImage(Activator.ICON_ID_CONFIG_MARKERS));
+        shell.setLayout(new FillLayout());
+        Composite composite = new Composite(shell, SWT.NONE);
+        composite.setLayout(new GridLayout());
+
+        try {
+
+            final ILttControllerService service = fSubSystem.getControllerService();
+
+            // Create future task
+            fMarkersList = new TCFTask<String[]>() {
+                @Override
+                public void run() {
+
+                    // Get markers using Lttng controller service proxy
+                    service.getMarkers(fTarget.getParent().getName(), fTarget.getName(), new ILttControllerService.DoneGetMarkers() {
+
+                        @Override
+                        public void doneGetMarkers(IToken token, Exception error, String[] str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(str);
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            SystemMessageException sysExp;
+            if (e instanceof SystemMessageException) {
+                sysExp = (SystemMessageException)e;
+            } else {
+                sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+            }
+            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorGetMarkers + " (" +  //$NON-NLS-1$
+                    Messages.Lttng_Resource_Target + ": "  + fTarget.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+            return null;
+        }
+
+        for (int i = 0; i < fMarkersList.length; i++) {
+            fMarkersList[i] = fMarkersList[i].trim();
+        }
+        final Table table = new Table(composite, SWT.BORDER | SWT.CHECK);
+        TableColumn tc0 = new TableColumn(table, SWT.LEFT | SWT.CENTER);
+        TableColumn tc1 = new TableColumn(table, SWT.LEFT);
+        TableColumn tc2 = new TableColumn(table, SWT.LEFT);
+        TableColumn tc3 = new TableColumn(table, SWT.LEFT);
+        TableColumn tc4 = new TableColumn(table, SWT.LEFT);
+        TableColumn tc5 = new TableColumn(table, SWT.LEFT);
+        TableColumn tc6 = new TableColumn(table, SWT.LEFT);
+        tc1.setText(Messages.ConfigureMarkersDialog_NameColumn);
+        tc2.setText(Messages.ConfigureMarkersDialog_Location);
+        tc3.setText(Messages.ConfigureMarkersDialog_Format);
+        tc4.setText(Messages.ConfigureMarkersDialog_EventId);
+        tc5.setText(Messages.ConfigureMarkersDialog_Call);
+        tc6.setText(Messages.ConfigureMarkersDialog_Probe_Single);
+        tc0.setWidth(25);
+        tc1.setWidth(100);
+        tc2.setWidth(100);
+        tc3.setWidth(170);
+        tc4.pack();
+        tc5.setWidth(100);
+        tc6.setWidth(100);
+        table.setHeaderVisible(true);
+        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+        fTableLines = new TableItem[fMarkersList.length];
+        fInitialMarkersStates = new Boolean[fMarkersList.length];
+
+        for (int i = 0; i < fMarkersList.length; i++) {
+            fTableLines[i] = new TableItem(table, SWT.NONE);
+            String markerInfoResult = null;
+            final String currentMarker = fMarkersList[i];
+            
+            try {
+
+                final ILttControllerService service = fSubSystem.getControllerService();
+                
+                // Create future task
+                markerInfoResult = new TCFTask<String>() {
+                    @Override
+                    public void run() {
+
+                        // Get marker info using Lttng controller service proxy
+                        service.getMarkerInfo(fTarget.getParent().getName(), fTarget.getName(), currentMarker, new ILttControllerService.DoneGetMarkerInfo() {
+
+                            @Override
+                            public void doneGetMarkerInfo(IToken token, Exception error, String str) {
+                                if (error != null) {
+                                    // Notify with error
+                                    error(error);
+                                    return;
+                                }
+
+                                // Notify about success
+                                done(str);
+                            }
+                        });
+                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            } catch (Exception e) {
+                SystemMessageException sysExp;
+                if (e instanceof SystemMessageException) {
+                    sysExp = (SystemMessageException)e;
+                } else {
+                    sysExp = new SystemMessageException(Activator.getDefault().getMessage(e));    
+                }
+                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorGetMarkerInfo + " (" +  //$NON-NLS-1$
+                        Messages.Lttng_Resource_Target + ": "  + fTarget.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+                        Messages.Lttng_Resource_Marker + ": " + currentMarker + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
+                return null;
+            }
+
+            String markerInfos = markerInfoResult.substring(1, markerInfoResult.length() - 1);
+            // System.out.println("markerInfos " + markerInfos);
+
+            // HACK!!!
+            // BAD : payload CAN contain comma!!!
+            /*
+             * String[] infosList = markerInfos.split(","); for(int j=0 ; j<infosList.length ; j++) { infosList[j] = infosList[j].trim(); String[] tempTable = infosList[j].split("="); infosList[j] = tempTable[1]; System.out.print(infosList[j] + " ");
+             * } System.out.println("");
+             */
+
+            // QUICK FIX :
+            int nbOfEqualsHack = 0;
+            for (int x = 0; x < markerInfos.length(); x++) {
+                if (markerInfos.charAt(x) == '=') {
+                    nbOfEqualsHack++;
+                }
+            }
+
+            if (nbOfEqualsHack > 0) { 
+                String[] infosList = new String[nbOfEqualsHack];
+                String value = ""; //$NON-NLS-1$
+
+                int prevPos = 0;
+                int curPos = 0;
+                int eqPos = 0;
+                int nbDone = 0;
+
+                while ((curPos < markerInfos.length()) && (eqPos >= 0)) {
+                    eqPos = markerInfos.indexOf("=", curPos); //$NON-NLS-1$
+
+                    if (eqPos >= 0) {
+                        prevPos = markerInfos.lastIndexOf(",", eqPos); //$NON-NLS-1$
+                    } else {
+                        prevPos = markerInfos.length() - 1;
+                    }
+
+                    if (prevPos >= 0) {
+                        value = markerInfos.substring(curPos, prevPos);
+
+                        infosList[nbDone] = value;
+                        nbDone++;
+                    }
+                    curPos = eqPos + 1;
+                }
+
+                fTableLines[i].setText(new String[] { null, fMarkersList[i], infosList[3], infosList[4], infosList[2], infosList[0], infosList[5] });
+
+                if (infosList[1].compareTo("1") == 0) { //$NON-NLS-1$
+                    fTableLines[i].setChecked(true);
+                    fInitialMarkersStates[i] = true;
+                } else {
+                    fTableLines[i].setForeground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
+                    fInitialMarkersStates[i] = false;
+                }
+            }
+        }
+
+        table.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                if (event.detail == SWT.CHECK) {
+                    TableItem ti = (TableItem) event.item;
+                    if (!ti.getChecked()) {
+                        ti.setForeground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
+                    } else {
+                        ti.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
+                    }
+                }
+            }
+        });
+
+        final Composite buttonComposite = new Composite(composite, SWT.NONE);
+        buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        GridLayout gl = new GridLayout(4, false);
+        gl.verticalSpacing = 10;
+        buttonComposite.setLayout(gl);
+
+        Label shadow_sep_h = new Label(buttonComposite, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
+        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
+        shadow_sep_h.setLayoutData(gd);
+
+        Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
+        selectAllButton.setText(Messages.ConfigureMarkersDialog_Select_All);
+        gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+        gd.widthHint = 100;
+        selectAllButton.setLayoutData(gd);
+        selectAllButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                for (int i = 0; i < fTableLines.length; i++) {
+                    fTableLines[i].setChecked(true);
+                    fTableLines[i].setForeground(display.getSystemColor(SWT.COLOR_BLACK));
+                }
+            }
+        });
+
+        Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
+        deselectAllButton.setText(Messages.ConfigureMarkersDialog_Deselect_All);
+        gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+        gd.widthHint = 100;
+        deselectAllButton.setLayoutData(gd);
+        deselectAllButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                for (int i = 0; i < fTableLines.length; i++) {
+                    fTableLines[i].setChecked(false);
+                    fTableLines[i].setForeground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
+                }
+            }
+        });
+
+        Button cancelButton = new Button(buttonComposite, SWT.PUSH);
+        cancelButton.setText(Messages.ConfigureMarkersDialog_Cancel);
+        gd = new GridData();
+        gd = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
+        gd.widthHint = 100;
+        cancelButton.setLayoutData(gd);
+        cancelButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                fOkClicked = Boolean.valueOf(false);
+                shell.dispose();
+            }
+        });
+
+        Button okButton = new Button(buttonComposite, SWT.PUSH);
+        okButton.setText(Messages.ConfigureMarkersDialog_Ok);
+        gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+        gd.widthHint = 100;
+        okButton.setLayoutData(gd);
+        okButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                fOkClicked = Boolean.valueOf(true);
+                fMap = new HashMap<String, Boolean>();
+                for (int k = 0; k < fTableLines.length; k++) {
+                    Boolean isChecked = fTableLines[k].getChecked();
+                    if (isChecked.booleanValue() != fInitialMarkersStates[k].booleanValue()) {
+                        if (isChecked) {
+                            fMap.put(fMarkersList[k], Boolean.valueOf(true));
+                        } else {
+                            fMap.put(fMarkersList[k], Boolean.valueOf(false));
+                        }
+                    }
+                }
+                shell.dispose();
+            }
+        });
+
+        shell.addListener(SWT.Traverse, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                if (event.detail == SWT.TRAVERSE_ESCAPE) {
+                    event.doit = false;
+                }
+            }
+        });
+        
+        TableItem[] items = table.getItems();
+        for (int i = 0; i < items.length; i++) {
+            if ((i % 2) != 0) {
+                items[i].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
+            }
+        }
+        
+        Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+        shell.setMinimumSize(shell.computeSize(minSize.x, minSize.y).x, 200);
+        shell.setSize(shell.computeSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300));
+        shell.open();
+
+        while (!shell.isDisposed()) {
+            if (!display.readAndDispatch()) {
+                display.sleep();
+            }
+        }
+        if (!fOkClicked) {
+            return null;
+        }
+
+        return fMap;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/ImportTraceDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/ImportTraceDialog.java
new file mode 100644 (file)
index 0000000..d2d1099
--- /dev/null
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Patrick Tasse - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.linuxtools.internal.lttng.core.LTTngProjectNature;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <b><u>ImportTraceDialog</u></b>
+ * <p>
+ * Dialog box to import a trace a LTTng project.
+ * </p>
+ */
+public class ImportTraceDialog extends Dialog {
+
+       // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+       private TraceResource fTrace;
+       private Table fTable;
+       private Text fNameText;
+       private Button fLinkOnlyButton;
+       private IProject fProject;
+       private String fTraceName;
+       private boolean fLinkOnly = false;
+       
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+       /**
+        * Constructor
+        *  
+        * @param parentShell The parent shell
+        * @param trace The trace to import
+        */
+       public ImportTraceDialog(Shell parentShell, TraceResource trace) {
+               super(parentShell);
+               fTrace = trace;
+       }
+
+       // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+        */
+       @Override
+       protected Control createDialogArea(Composite parent) {
+               getShell().setText(Messages.ImportTraceDialog_Title);
+               getShell().setImage(Activator.getDefault().getImage(Activator.ICON_ID_IMPORT_TRACE));
+               
+               Composite composite = new Composite(parent, SWT.NONE);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+        composite.setLayout(new GridLayout(1, false));
+        
+        Label tableLabel = new Label(composite, SWT.NONE);
+        tableLabel.setText(Messages.ImportTraceDialog_TableLabel);
+               
+        fTable = new Table(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+        fTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+        fTable.setHeaderVisible(true);
+        fTable.setLinesVisible(true);
+
+        TableColumn column = new TableColumn(fTable, SWT.CENTER);
+        column.setText(Messages.ImportTraceDialog_ProjectColumn);
+
+        for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+               try {
+                               if (project.isOpen() && project.hasNature(LTTngProjectNature.ID)) {
+                           TableItem item = new TableItem(fTable, SWT.LEFT);
+                           item.setText(0, project.getName());
+                           item.setData(project);
+                               }
+                       } catch (CoreException e) {
+                           SystemBasePlugin.logError("ImportTraceDialog", e); //$NON-NLS-1$
+                       }
+        }
+        
+        for (int i = 0; i < fTable.getColumnCount(); i++) {
+               fTable.getColumn(i).pack();
+        }
+
+        Composite nameComposite = new Composite(composite, SWT.NONE);
+        nameComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        GridLayout gl = new GridLayout(2, false);
+        gl.marginWidth = 0;
+        gl.marginHeight = 0;
+        nameComposite.setLayout(gl);
+        
+        Label nameLabel = new Label(nameComposite, SWT.NONE);
+        nameLabel.setText(Messages.ImportTraceDialog_NameLabel);
+
+        fNameText = new Text(nameComposite, SWT.BORDER);
+        fNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        fNameText.setText(fTrace.getName());
+
+        if (fTrace.getTraceConfig().isNetworkTrace()) {
+               fLinkOnlyButton = new Button(composite, SWT.CHECK);
+               fLinkOnlyButton.setText(Messages.ImportTraceDialog_LinkOnly);
+               fLinkOnlyButton.setSelection(true);
+               fLinkOnly = true;
+               if (fTrace.getTraceState() != TraceState.STOPPED) {
+                       // if the trace is not stopped, link is the only allowed option
+                       fLinkOnlyButton.setEnabled(false);
+               }
+        }
+        
+               return composite;
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+        */
+    @Override
+    protected void createButtonsForButtonBar(Composite parent) {
+        super.createButtonsForButtonBar(parent);
+        getButton(IDialogConstants.OK_ID).setText(Messages.ImportTraceDialog_ImportButton);
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
+    @Override
+       protected void okPressed() {
+       TableItem[] selection = fTable.getSelection();
+       if (selection.length > 0) {
+               fProject = (IProject) selection[0].getData();
+       }
+       fTraceName = fNameText.getText();
+       if (fLinkOnlyButton != null) {
+               fLinkOnly = fLinkOnlyButton.getSelection();
+       }
+       super.okPressed();
+       }
+
+    /**
+     * Returns the project to import to.
+     * 
+     * @return project to import to.
+     */
+       public IProject getProject() {
+       return fProject;
+    }
+    
+       /**
+        * Gets the name of the trace in the LTTng project. 
+        * 
+        * @return
+        */
+    public String getTraceName() {
+       return fTraceName;
+    }
+    
+    /**
+     * Returns if trace should be linked or copied to the project.
+     * Only applicable for traces residing on local host.
+     * 
+     * @return true if trace should be linked to the project, 
+     *         false if it should be copied 
+     */
+    public boolean getLinkOnly() {
+       return fLinkOnly;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/NewTraceDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/NewTraceDialog.java
new file mode 100644 (file)
index 0000000..338949f
--- /dev/null
@@ -0,0 +1,631 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.linuxtools.internal.lttng.core.LTTngProjectNature;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <b><u>NewTraceDialog</u></b>
+ * <p>
+ * Dialog box to create a new trace.
+ * </p>
+ */
+public class NewTraceDialog extends Dialog {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private String fTraceName;
+    private String fTraceTransport;
+    private String fTracePath;
+    private int fMode;
+    private int fNumChannel;
+    private Boolean fIsAppend;
+    private Boolean fIsLocal;
+    private Text fNameText;
+    private Text fTransportText;
+    private Text fPathText;
+    private Text fNumLttdThreadsText;
+    private Button fFinishButton;
+    private Button fHostButton;
+    private Button fTargetButton;
+    private Button fIsAppendButton;
+    private Button fFlightRecorderButton;
+    private Button fNormalButton;
+    private Boolean fFinishButtonClicked;
+    private Display fDisplay;
+    private String fTraceNameError;
+    private String fTracePathError;
+    private Label fErrorLabel;
+    private Button fBrowseButton;
+    
+    private TraceSubSystem fSubSystem;
+    private TargetResource fTargetResource;
+    
+    private IProject fProject;
+    private static IProject defaultProject;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor 
+     * 
+     * @param parent The parent shell
+     * @param subSystem The trace SubSystem
+     * @param targetResource The parent target resource
+     */
+    public NewTraceDialog(Shell parent, TraceSubSystem subSystem, TargetResource targetResource) {
+        super(parent);
+        fSubSystem = subSystem;
+        fTargetResource = targetResource;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /**
+     * Makes the dialog visible and returns the trace configuration of the new trace.
+     * 
+     * @return trace configuration
+     */
+    public TraceConfig open() {
+        Shell parent = getParent();
+        final Shell shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
+        shell.setText(Messages.NewTraceDialog_Title);
+
+        shell.setLayout(new GridLayout());
+        shell.setImage(Activator.getDefault().getImage(Activator.ICON_ID_NEW_TRACE));
+
+        GridData griddata = new GridData();
+        fFinishButtonClicked = Boolean.valueOf(false);
+        fTraceNameError = ""; //$NON-NLS-1$
+        fTracePathError = ""; //$NON-NLS-1$
+
+        griddata = new GridData();
+        Composite composite1 = new Composite(shell, SWT.NONE);
+        GridLayout compositeLayout1 = new GridLayout(2, false);
+        composite1.setSize(520, 300);
+        composite1.setLayout(compositeLayout1);
+        griddata.horizontalSpan = 3;
+        griddata.widthHint = 520;
+        griddata.minimumWidth = 520;
+        composite1.setLayoutData(griddata);
+
+        Label nameLabel = new Label(composite1, SWT.NULL);
+        nameLabel.setText(Messages.NewTraceDialog_TraceName + ":"); //$NON-NLS-1$
+        griddata = new GridData();
+        griddata.verticalIndent = 20;
+        nameLabel.setLayoutData(griddata);
+
+        fNameText = new Text(composite1, SWT.SINGLE | SWT.BORDER);
+        if (fTargetResource.isUst()) {
+               fNameText.setText(TraceControlConstants.Lttng_Ust_TraceName);
+               fNameText.setEnabled(false);
+        }
+
+        griddata = new GridData();
+        griddata.horizontalAlignment = SWT.FILL;
+        griddata.grabExcessHorizontalSpace = true;
+        griddata.verticalIndent = 20;
+        fNameText.setLayoutData(griddata);
+        fNameText.setSize(500, 50);
+
+        Label transportLabel = new Label(composite1, SWT.NULL);
+        transportLabel.setText(Messages.ConfigureTraceDialog_Trace_Transport + ":"); //$NON-NLS-1$
+        griddata = new GridData();
+        transportLabel.setLayoutData(griddata);
+
+        fTransportText = new Text(composite1, SWT.SINGLE | SWT.BORDER);
+        griddata = new GridData();
+        griddata.horizontalAlignment = SWT.FILL;
+        griddata.grabExcessHorizontalSpace = true;
+        fTransportText.setLayoutData(griddata);
+        fTransportText.setSize(500, 50);
+        fTransportText.setText(TraceControlConstants.Lttng_Trace_Transport_Relay);
+        fTransportText.setEnabled(false); // relay is the only allowed value
+
+        griddata = new GridData();
+        Group composite21 = new Group(composite1, SWT.SHADOW_OUT);
+        composite21.setSize(300, 300);
+        composite21.setText(Messages.ConfigureTraceDialog_Trace_Location);
+        griddata.horizontalAlignment = SWT.FILL;
+        griddata.horizontalSpan = 2;
+        griddata.verticalIndent = 10;
+        griddata.widthHint = 300;
+        griddata.minimumWidth = 300;
+        composite21.setLayoutData(griddata);
+        GridLayout compositeLayout21 = new GridLayout(4, false);
+        composite21.setLayout(compositeLayout21);
+        fTargetButton = new Button(composite21, SWT.RADIO);
+        fTargetButton.setText(Messages.ConfigureTraceDialog_Target);
+        fTargetButton.setSelection(true);
+        fHostButton = new Button(composite21, SWT.RADIO);
+        fHostButton.setText(Messages.ConfigureTraceDialog_Host);
+        griddata = new GridData();
+        griddata.horizontalSpan = 3;
+        fHostButton.setLayoutData(griddata);
+        fIsLocal = false;
+        fHostButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                if (fHostButton.getSelection()) {
+                    fIsLocal = true;
+                    fBrowseButton.setEnabled(true);
+                } else {
+                    fIsLocal = false;
+                    fBrowseButton.setEnabled(false);
+                }
+                validatePathName(fPathText.getText());
+                validate();
+            }
+        });
+
+        Label pathLabel = new Label(composite21, SWT.NULL);
+        pathLabel.setText(Messages.ConfigureTraceDialog_Trace_Path);
+        griddata = new GridData();
+        griddata.verticalIndent = 10;
+        pathLabel.setLayoutData(griddata);
+
+        fPathText = new Text(composite21, SWT.SINGLE | SWT.BORDER);
+        griddata = new GridData();
+        griddata.horizontalAlignment = SWT.FILL;
+        griddata.grabExcessHorizontalSpace = true;
+        griddata.verticalIndent = 10;
+        fPathText.setLayoutData(griddata);
+        fPathText.setData(""); //$NON-NLS-1$
+
+        fBrowseButton = new Button(composite21, SWT.PUSH);
+        fBrowseButton.setText(Messages.ConfigureTraceDialog_Browse + "...");  //$NON-NLS-1$
+        griddata = new GridData();
+        griddata.grabExcessHorizontalSpace = false;
+        griddata.widthHint = 100;
+        griddata.verticalIndent = 10;
+        fBrowseButton.setLayoutData(griddata);
+        fBrowseButton.setEnabled(false);
+        fBrowseButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                DirectoryDialog dialog = new DirectoryDialog(shell);
+                String newPath = dialog.open();
+                if (newPath != null) {
+                    fPathText.setText(newPath);
+                }
+            }
+        });
+
+        fNameText.addListener(SWT.Modify, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+               validateTraceName(fNameText.getText());
+               validate();
+            }
+        });
+
+        fTransportText.addListener(SWT.Modify, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+               validate();
+            }
+        });
+
+        fPathText.addListener(SWT.Modify, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+               if (!fPathText.isEnabled()) {
+                       return;
+               }
+                validatePathName(fPathText.getText());
+                validate();
+            }
+        });
+
+        Composite projectComposite = new Composite(composite1, SWT.NONE);
+        projectComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+        GridLayout gl = new GridLayout(2, false);
+        gl.marginWidth = 0;
+        gl.marginHeight = 10;
+        projectComposite.setLayout(gl);
+
+        Label projectLabel = new Label(projectComposite, SWT.NONE);
+        projectLabel.setText(Messages.NewTraceDialog_Tracing_Project + ":"); //$NON-NLS-1$);
+
+        final Combo projectCombo = new Combo(projectComposite, SWT.READ_ONLY);
+        projectCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+            try {
+                if (project.isOpen() && project.hasNature(LTTngProjectNature.ID)) {
+                    projectCombo.add(project.getName());
+                    projectCombo.setData(project.getName(), project);
+                    if (fProject == null  || project.equals(defaultProject)) {
+                        projectCombo.select(projectCombo.getItemCount() - 1);
+                        fProject = project;
+                    }
+                }
+            } catch (CoreException e) {
+                SystemBasePlugin.logError("NewTraceDialog", e); //$NON-NLS-1$
+            }
+        }
+        projectCombo.addSelectionListener(new SelectionListener() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                fProject = (IProject) projectCombo.getData(projectCombo.getText());
+            }
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }});
+
+        griddata = new GridData();
+        Composite composite2 = new Composite(composite1, SWT.NONE);
+        GridLayout compositeLayout2 = new GridLayout(2, false);
+        compositeLayout2.marginWidth = 0;
+        composite2.setLayout(compositeLayout2);
+        griddata.horizontalSpan = 2;
+        composite2.setLayoutData(griddata);
+
+        Label numLttdThreadsLabel = new Label(composite2, SWT.NULL);
+        numLttdThreadsLabel.setText(Messages.ConfigureTraceDialog_Num_Lttd_Threads + ":"); //$NON-NLS-1$);
+
+        fNumLttdThreadsText = new Text(composite2, SWT.SINGLE | SWT.BORDER);
+        griddata = new GridData();
+        griddata.horizontalAlignment = SWT.BEGINNING;
+        griddata.widthHint = 50;
+        griddata.minimumWidth = 50;
+        fNumLttdThreadsText.setLayoutData(griddata);
+        if (fTargetResource.isUst()) {
+               fNumLttdThreadsText.setText("1"); //$NON-NLS-1$
+               fNumLttdThreadsText.setEnabled(false);
+        } else {
+               fNumLttdThreadsText.setText("2"); //$NON-NLS-1$
+        }
+
+        fNumLttdThreadsText.addListener(SWT.Verify, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                String string = e.text;
+                char[] chars = new char[string.length()];
+                string.getChars(0, chars.length, chars, 0);
+                for (int i = 0; i < chars.length; i++) {
+                    if (!('0' <= chars[i] && chars[i] <= '9')) {
+                        e.doit = false;
+                        return;
+                    }
+                }
+            }
+        });
+
+        fNumLttdThreadsText.addListener(SWT.Modify, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+               validate();
+            }
+        });
+
+        fIsAppendButton = new Button(composite1, SWT.CHECK);
+        fIsAppendButton.setText(Messages.ConfigureTraceDialog_Append);
+        griddata = new GridData();
+        griddata.horizontalAlignment = SWT.BEGINNING;
+        griddata.horizontalSpan = 2;
+        griddata.verticalIndent = 10;
+        fIsAppendButton.setLayoutData(griddata);
+        fIsAppend = Boolean.valueOf(false);
+        fIsAppendButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                if (fIsAppendButton.getSelection()) {
+                    fIsAppend = true;
+                }
+                else {
+                    fIsAppend = false;
+                }
+            }
+        });
+        if (fTargetResource.isUst()) {
+               fIsAppendButton.setEnabled(false);
+        }
+
+        griddata = new GridData();
+        Group composite22 = new Group(composite1, SWT.SHADOW_OUT);
+        composite22.setText(Messages.ConfigureTraceDialog_Trace_Mode);
+        griddata.horizontalSpan = 2;
+        griddata.verticalIndent = 10;
+        composite22.setLayoutData(griddata);
+        GridLayout compositeLayout22 = new GridLayout(2, false);
+        composite22.setLayout(compositeLayout22);
+        fNormalButton = new Button(composite22, SWT.RADIO);
+        fNormalButton.setText(Messages.ConfigureTraceDialog_Mode_Normal);
+        fFlightRecorderButton = new Button(composite22, SWT.RADIO);
+        fFlightRecorderButton.setText(Messages.ConfigureTraceDialog_Mode_Flight_Recorder);
+        fMode = TraceConfig.NORMAL_MODE;
+        fNormalButton.setSelection(true);
+        fNormalButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event e) {
+                if (fNormalButton.getSelection()) {
+                    fMode = TraceConfig.NORMAL_MODE;
+                }
+            }
+        });
+        fFlightRecorderButton.addListener(SWT.Selection, new Listener() {
+               @Override
+               public void handleEvent(Event e) {
+                       if (fFlightRecorderButton.getSelection()) {
+                               fMode = TraceConfig.FLIGHT_RECORDER_MODE;
+                       }
+               }
+        });
+        if (fTargetResource.isUst()) {
+               fFlightRecorderButton.setEnabled(false);
+               fNormalButton.setEnabled(false);
+        }
+
+        fErrorLabel = new Label(shell, SWT.NULL);
+        fDisplay = parent.getDisplay();
+        fErrorLabel.setForeground(fDisplay.getSystemColor(SWT.COLOR_RED));
+        griddata = new GridData();
+        griddata.widthHint = 400;
+        griddata.minimumWidth = 400;
+        fErrorLabel.setLayoutData(griddata);
+
+        Label shadow_sep_h = new Label(shell, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
+        griddata = new GridData();
+        griddata.horizontalAlignment = SWT.FILL;
+        griddata.grabExcessHorizontalSpace = true;
+        griddata.verticalIndent = 20;
+        shadow_sep_h.setLayoutData(griddata);
+
+        Composite buttonComposite = new Composite(shell, SWT.NONE);
+        buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        buttonComposite.setLayout(new GridLayout(2, false));
+
+        Button cancelButton = new Button(buttonComposite, SWT.PUSH);
+        cancelButton.setText(Messages.ConfigureTraceDialog_Cancel);
+        cancelButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
+
+        fFinishButton = new Button(buttonComposite, SWT.PUSH);
+        fFinishButton.setText(Messages.ConfigureTraceDialog_Finish);
+        fFinishButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+        fFinishButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                fFinishButtonClicked = true;
+                shell.dispose();
+            }
+        });
+        validate();
+        
+        cancelButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                fTraceName = null;
+                fTraceTransport = null;
+                fTracePath = null;
+                shell.dispose();
+            }
+        });
+
+        shell.addListener(SWT.Traverse, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                if (event.detail == SWT.TRAVERSE_ESCAPE) {
+                    event.doit = false;
+                }
+            }
+        });
+        shell.pack();
+        shell.open();
+
+        Display display = parent.getDisplay();
+        while (!shell.isDisposed()) {
+            if (!display.readAndDispatch()) {
+                display.sleep();
+            }
+        }
+        if ((fTraceName == null) || (fTraceTransport == null) || (fTracePath == null) || (!fFinishButtonClicked)) {
+            return null;
+        }
+        TraceConfig result = new TraceConfig();
+        result.setTraceName(fTraceName);
+        result.setTraceTransport(fTraceTransport);
+        result.setTracePath(fTracePath);
+        result.setNetworkTrace(fIsLocal);
+        result.setIsAppend(fIsAppend);
+        result.setMode(fMode);
+        result.setNumChannel(fNumChannel);
+        result.setProject(fProject);
+        defaultProject = fProject;
+        return result;
+    }
+
+    /*
+     * Validates the trace name which has to be unique.
+     */
+    private boolean validateTraceName(String name) {
+        if (name.length() > 0) {
+            TraceResource[] traces = new TraceResource[0];
+            try {
+                traces = fSubSystem.getAllTraces();
+            } catch (SystemMessageException e) {
+                SystemBasePlugin.logError("NewTraceDialog ", e); //$NON-NLS-1$
+            }
+            for (int i = 0; i < traces.length; i++) {
+                if (traces[i].getName().compareTo(name) == 0) {
+                    fTraceNameError = Messages.NewTraceDialog_Error_Already_Exists;
+                    fErrorLabel.setText(fTraceNameError);
+                    return false;
+                }
+            }
+            final char[] chars = name.toCharArray();
+            for (int x = 0; x < chars.length; x++) {
+                final char c = chars[x];
+                if ((x == 0) && !(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) {
+                    fTraceNameError = Messages.NewTraceDialog_Error_Invalid_First_Char;
+                    fErrorLabel.setText(fTraceNameError);
+                    return false;
+                } else if (x != 0) {
+                    if (!((c >= 'a') && (c <= 'z')) && !((c >= 'A') && (c <= 'Z')) && !((c >= '0') && (c <= '9'))) {
+                        fTraceNameError = Messages.NewTraceDialog_Error_Invalid_Name;
+                        fErrorLabel.setText(fTraceNameError);
+                        return false;
+                    }
+                }
+            }
+        }
+        if (fTracePathError.length() > 0) {
+               fErrorLabel.setText(fTracePathError);
+        } else {
+               fErrorLabel.setText(""); //$NON-NLS-1$
+        }
+        fTraceNameError = ""; //$NON-NLS-1$
+        return true;
+    }
+
+    /*
+     * Validates the trace path.
+     */
+    private boolean validatePathName(String path) {
+        if (path.length() > 0) {
+            final char c0 = path.charAt(0);
+            if (c0 != '/') {
+                fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Path;
+                fErrorLabel.setText(fTracePathError);
+                return false;
+            } else {
+                String[] folders = path.split("/"); //$NON-NLS-1$
+                for (int i = 0; i < folders.length; i++) {
+                    final char[] chars = folders[i].toCharArray();
+                    for (int x = 0; x < chars.length; x++) {
+                        final char c = chars[x];
+                        if ((c >= 'a') && (c <= 'z')) {
+                            continue; // lowercase
+                        }
+                        if ((c >= 'A') && (c <= 'Z')) {
+                            continue; // uppercase
+                        }
+                        if ((c >= '0') && (c <= '9')) {
+                            continue; // numeric
+                        }
+                        fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Folder;
+                        fErrorLabel.setText(fTracePathError);
+                        return false;
+                    }
+                }
+                if (path.length() > 1) {
+                    for (int i = 0; i < path.length() - 1; i++) {
+                        if ((path.charAt(i) == '/') && (path.charAt(i + 1) == '/')) {
+                            fTracePathError = Messages.ConfigureTraceDialog_Error_Multiple_Seps;
+                            fErrorLabel.setText(fTracePathError);
+                            return false;
+                        }
+                    }
+                }
+            }
+            if (fIsLocal) {
+                File file = new File(path);
+                if (file.isFile()) {
+                    fTracePathError = Messages.ConfigureTraceDialog_Error_File_Exists;
+                    fErrorLabel.setText(fTracePathError);
+                    return false;
+                }
+                if (path.length() > 1 && !file.getParentFile().canWrite()) {
+                    fTracePathError = Messages.ConfigureTraceDialog_Error_Can_Not_Write;
+                    fErrorLabel.setText(fTracePathError);
+                    return false;
+                }
+            }
+        }
+        if (fTraceNameError.length() > 0) {
+               fErrorLabel.setText(fTraceNameError);
+        } else {
+               fErrorLabel.setText(""); //$NON-NLS-1$
+        }
+        fTracePathError = ""; //$NON-NLS-1$
+        return true;
+    }
+    
+    /*
+     * It validates all input values.
+     */
+    private void validate() {
+        if ((fTracePathError.length() > 0) || (fTraceNameError.length() > 0)) {
+            fFinishButton.setEnabled(false);
+            return;
+        }
+        if ((fNameText.getText() == null) || (fNameText.getText().length() == 0)) {
+            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_Name);
+            fFinishButton.setEnabled(false);
+            return;
+        }
+        if ((fTransportText.getText() == null) || (fTransportText.getText().length() == 0)) {
+            fFinishButton.setEnabled(false);
+            return;
+        }
+        if (fPathText.getText().length() == 0) {
+            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_Path);
+            fFinishButton.setEnabled(false);
+            return;
+        }
+        if (fProject == null) {
+            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_Project);
+            fFinishButton.setEnabled(false);
+            return;
+        }
+        if ((fNumLttdThreadsText.getText().length() == 0) || (fNumLttdThreadsText.getText().length() == 0)) {
+            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_NumLttdThreads);
+            fFinishButton.setEnabled(false);
+            return;
+        }
+        fErrorLabel.setText(""); //$NON-NLS-1$
+        fTraceName = fNameText.getText();
+        fTraceTransport = fTransportText.getText();
+        fTracePath = fPathText.getText();
+        fNumChannel = Integer.parseInt(fNumLttdThreadsText.getText());
+        fFinishButton.setEnabled(true);
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/SelectTracePathDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/dialogs/SelectTracePathDialog.java
new file mode 100644 (file)
index 0000000..ed7455f
--- /dev/null
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.dialogs;
+
+import java.io.File;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <b><u>SelectTracePathDialog</u></b>
+ * <p>
+ * Dialog box to configure and select a trace path.
+ * </p>
+ */
+public class SelectTracePathDialog extends Dialog {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private Text fPath = null;
+    private String fPathName = null;
+    private String fTracePathError = null;
+    private Label fErrorLabel = null;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     * 
+     * @param parentShell The paren shell
+     */
+    public SelectTracePathDialog(Shell parentShell) {
+        super(parentShell);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    @Override
+    protected void configureShell(Shell newShell) {
+        super.configureShell(newShell);
+        newShell.setText(Messages.SeletctTracePathDialog_Title);    
+        newShell.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    protected Control createDialogArea(Composite parent) {
+        //Main dialog panel
+        Composite composite = new Composite(parent, SWT.RESIZE);
+        GridLayout mainLayout = new GridLayout(1, true);
+        composite.setLayout(mainLayout);
+        
+        fErrorLabel = new Label(composite, SWT.LEFT);
+        fErrorLabel.setLayoutData(new GridData(GridData.FILL, 
+                GridData.CENTER, true, false, 6, 1));
+        fErrorLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
+        
+        Group group = new Group(composite, SWT.SHADOW_OUT);
+        group.setText(Messages.ConfigureTraceDialog_Trace_Location);
+        group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
+        
+        GridLayout groupLayout = new GridLayout(6, true);
+        group.setLayout(groupLayout);
+
+        Label tracePathLabel = new Label(group, SWT.LEFT);
+        tracePathLabel.setText(Messages.ConfigureTraceDialog_Trace_Path);
+        tracePathLabel.setLayoutData(new GridData(GridData.FILL, 
+                GridData.CENTER, true, false, 1, 1));
+        
+        fPath = new Text(group, SWT.LEFT);
+        fPath.setLayoutData(new GridData(GridData.FILL, 
+                GridData.CENTER, true, false, 4, 1));
+        
+        fPath.addListener(SWT.Modify, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                Button ok = getButton(IDialogConstants.OK_ID);
+                ok.setEnabled(validatePathName(fPath.getText()));
+            }
+        });
+        
+        Button browseButton = new Button(group, SWT.PUSH);
+        browseButton.setText(Messages.ConfigureTraceDialog_Browse + "...");  //$NON-NLS-1$
+        browseButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
+        
+        browseButton.setEnabled(true);
+        browseButton.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                DirectoryDialog dialog = new DirectoryDialog(getShell());
+                String newPath = dialog.open();
+                if (newPath != null) {
+                    fPath.setText(newPath);
+                }
+            }
+        });
+        return composite;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    protected void createButtonsForButtonBar(Composite parent) {
+        Button ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+        
+        ok.setEnabled(false);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
+    @Override
+    protected void okPressed() {
+        fPathName = fPath.getText();
+
+        File newDir = new File(fPathName);
+        if (!newDir.exists()) {
+            try {
+                newDir.mkdirs();
+            } catch (Exception e) {
+                // Should not happen
+            }
+        }
+
+        super.okPressed();
+    }
+
+    /*
+     * Validates the trace path.
+     */
+    private boolean validatePathName(String path) {
+        if (path.length() > 0) {
+            final char c0 = path.charAt(0);
+            if (c0 != '/') {
+                fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Path;
+                fErrorLabel.setText(fTracePathError);
+                return false;
+            } else {
+                String[] folders = path.split("/"); //$NON-NLS-1$
+                for (int i = 0; i < folders.length; i++) {
+                    final char[] chars = folders[i].toCharArray();
+                    for (int x = 0; x < chars.length; x++) {
+                        final char c = chars[x];
+                        if ((c >= 'a') && (c <= 'z')) {
+                            continue; // lowercase
+                        }
+                        if ((c >= 'A') && (c <= 'Z')) {
+                            continue; // uppercase
+                        }
+                        if ((c >= '0') && (c <= '9')) {
+                            continue; // numeric
+                        }
+                        fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Folder;
+                        fErrorLabel.setText(fTracePathError);
+                        return false;
+                    }
+                }
+                if (path.length() > 1) {
+                    for (int i = 0; i < path.length() - 1; i++) {
+                        if ((path.charAt(i) == '/') && (path.charAt(i + 1) == '/')) {
+                            fTracePathError = Messages.ConfigureTraceDialog_Error_Multiple_Seps;
+                            fErrorLabel.setText(fTracePathError);
+                            return false;
+                        }
+                    }
+                }
+            }
+            
+            File file = new File(path);
+            if (file.isFile()) {
+                fTracePathError = Messages.ConfigureTraceDialog_Error_File_Exists;
+                fErrorLabel.setText(fTracePathError);
+                return false;
+            }
+            if (path.length() > 1 && !file.getParentFile().canWrite()) {
+                fTracePathError = Messages.ConfigureTraceDialog_Error_Can_Not_Write;
+                fErrorLabel.setText(fTracePathError);
+                return false;
+            }
+        }
+        fErrorLabel.setText(""); //$NON-NLS-1$
+        fTracePathError = ""; //$NON-NLS-1$
+        return true;
+    }
+
+    /**
+     * Returns the trace path.
+     * 
+     * @return trace path
+     */
+    public String getTracePath() {
+        return fPathName;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/messages.properties
new file mode 100644 (file)
index 0000000..adad6e8
--- /dev/null
@@ -0,0 +1,165 @@
+Property_Type_Provider_Filter=Providers filter
+Property_Type_Provider=Remote system filter
+
+Filter_Provider_Dlg_Title=Change Provider Filter
+Filter_Provider_Page_Title=Provider Filter
+Filter_Provider_Page_Text=Create a new filter to list providers
+
+Filter_Target_Dlg_Title=Change Target Filter
+Filter_Target_Page_Title=Target Filter
+Filter_Target_Page_Text=Create a new filter to list targets
+Filter_Target_Target_Prompt_label=Parent provider
+
+Filter_Trace_Dlg_Title=Change Trace Filter
+Filter_Trace_Page_Title=Trace Filter
+Filter_Trace_Page_Text=Create a new filter to list trace
+Filter_Trace_Target_Prompt_Label=Parent target
+
+Lttng_Resource_Root=root
+Lttng_Resource_Target=Target
+Lttng_Resource_Provider=Provider
+Lttng_Resource_Trace=Trace
+Lttng_Resource_Marker=Marker
+Lttng_Resource_Channel=Channel
+
+AllProviders=All Providers
+
+Trace_Connector_Service_Name=TCF
+Trace_Connector_Service_Description=Target Communication Framework
+Trace_Connector_Service_Connect_Msg=Connecting
+Trace_Connector_Service_Disconnect_Msg=Disconnecting
+Trace_Connector_Service_Canceled_Msg=Canceled
+
+Lttng_Control_Unknown_Event_Msg=Unknown event
+
+Lttng_Control_CommandError=lttng_control failed
+
+Lttng_Control_ErrorNewTrace=Create new trace failed
+Lttng_Control_ErrorConfigureTrace=Configure trace failed
+Lttng_Control_ErrorConfigureMarkers=Configure markers failed
+Lttng_Control_ErrorGetMarkers=Get markers failed
+Lttng_Control_ErrorGetMarkerInfo=Get marker info failed
+Lttng_Control_ErrorStart=Start tracing failed
+Lttng_Control_ErrorPause=Pause tracing failed
+Lttng_Control_ErrorStop=Destroy trace failed
+Lttng_Control_ErrorBrowse=Browse trace failed
+
+Lttng_Control_GetProvidersError=
+Lttng_Control_GetTargetsError=
+Lttng_Control_GetTracesError=   
+Lttng_Control_GetMarkersError=
+Lttng_Control_GetMarkerInfoError= 
+
+Ltt_Controller_Service_Not_Connected_Msg=Service not connected
+Ltt_Controller_Service_Unsupported_Msg=Remote peer does not support service
+
+Lttng_Control_ErrorSetChannelEnable=Set Channel Enable failed
+Lttng_Control_ErrorSetChannelOverwrite=Set Channel Overwrite failed
+Lttng_Control_ErrorSetSubbufNum=Set Number of Sub Buffers Enable failed
+Lttng_Control_ErrorSetSubbufSize=Set Sub Buffer size failed
+Lttng_Control_ErrorSetChannelTimer=Set Channel timer failed
+Lttng_Control_ErrorCreateTracePath=Can't create trace path.
+
+#Trace resource properties
+Ltt_Trace_Property_TracePathName=Trace path
+Ltt_Trace_Property_TracePathDescription=Location of trace
+Ltt_Trace_Property_NumberOfChannelsName=Number of channels
+Ltt_Trace_Property_NumberOfChannelsDescr=Number of channels
+Ltt_Trace_Property_FlighRecorderModeName=Flight recorder mode
+Ltt_Trace_Property_FlighRecorderModeDesc=Flight recorder mode (true or false)
+Ltt_Trace_Property_NormalModeName=Normal mode
+Ltt_Trace_Property_NormalModeDesc=Normal mode only (true or false)
+Ltt_Trace_Property_NetworkTraceName=Network trace
+Ltt_Trace_Property_NetWorkTraceDescr=Network trace (true or false)
+Ltt_Trace_Property_TraceTransportName=Trace transport
+Ltt_Trace_Property_TraceTransportDesc=Trace transport
+
+Ltt_ShutdownWarning=Shutdown Warning
+Ltt_NetworkTraceRunningWarning=One or more traces from type network are still running!\n\nThe following traces will be paused before disconnecting
+
+Ltt_TimeoutMsg=Timeout
+
+ConfigureMarkersDialog_Select_All=Select All
+ConfigureMarkersDialog_Call=Call
+ConfigureMarkersDialog_Cancel=Cancel
+ConfigureMarkersDialog_EventId=Event_id
+ConfigureMarkersDialog_Format=Format
+ConfigureMarkersDialog_Location=Location
+ConfigureMarkersDialog_NameColumn=Name
+ConfigureMarkersDialog_Ok=OK
+ConfigureMarkersDialog_Probe_Single=Probe single
+ConfigureMarkersDialog_Deselect_All=Deselect All
+ConfigureMarkersDialog_Title=Configure markers
+
+ConfigureTraceDialog_Append=Append
+ConfigureTraceDialog_Browse=Browse
+ConfigureTraceDialog_Cancel=Cancel
+ConfigureTraceDialog_Finish=Finish
+ConfigureTraceDialog_Mode_Flight_Recorder=Flight recorder
+ConfigureTraceDialog_Host=Host
+ConfigureTraceDialog_Target=Target
+ConfigureTraceDialog_Mode_None=None
+ConfigureTraceDialog_Mode_Normal=Normal
+ConfigureTraceDialog_Num_Lttd_Threads=Number of lttd threads
+ConfigureTraceDialog_Error_Invalid_Folder=Trace path error: folder is not alphanumeric
+ConfigureTraceDialog_Error_Invalid_Path=Trace path error: first character is not a slash
+ConfigureTraceDialog_Error_Multiple_Seps=Trace path error: the trace path contains 2 successive slashes
+ConfigureTraceDialog_Error_File_Exists=Trace path error: file exists
+ConfigureTraceDialog_Error_Can_Not_Write=Trace path error: can not write
+ConfigureTraceDialog_Title=Trace configuration
+ConfigureTraceDialog_Trace_Location=Trace location
+ConfigureTraceDialog_Trace_Mode=Trace mode
+ConfigureTraceDialog_Trace_Path=Trace path
+ConfigureTraceDialog_Trace_Transport=Trace transport
+
+NewTraceDialog_Title=Create a new trace
+NewTraceDialog_TraceName=Name
+NewTraceDialog_Tracing_Project=Tracing Project
+NewTraceDialog_Error_No_Name=No trace name entered
+NewTraceDialog_Error_No_Path=No trace path entered
+NewTraceDialog_Error_No_NumLttdThreads=No number of lttd threads entered
+NewTraceDialog_Error_No_Project=No tracing project selected
+NewTraceDialog_Error_Already_Exists=Trace name error: trace exists
+NewTraceDialog_Error_Invalid_First_Char=Trace name error: first character is not alphabetic
+NewTraceDialog_Error_Invalid_Name=Trace name error: char is not alphanumeric
+
+SeletctTracePathDialog_Title=Select local trace path
+
+ChannelConfigPage_BufferOverrideTooltip=Buffer override enabled flag
+ChannelConfigPage_ChannelEnabled=Enabled
+ChannelConfigPage_ChannelEnabledTooltip=Channel enabled flag
+ChannelConfigPage_ChannelName=Name
+ChannelConfigPage_ChannelNameTooltip=Name of channel
+ChannelConfigPage_ChannelOverride=Buffer Override
+ChannelConfigPage_ChannelTimer=Channel Timer
+ChannelConfigPage_ChannelTimerTooltip=Channel timer in milliseconds
+ChannelConfigPage_NumSubBuf=Number of Sub Buffers
+ChannelConfigPage_NumSubBufTooltip=Number of sub buffers
+ChannelConfigPage_PageTitle=Configure channel information
+ChannelConfigPage_SubBufSize=Sub Buffer Size
+ChannelConfigPage_SubBufSizeTooltip=Size of sub buffers
+
+ChannelConfigPage_EnableAll=Enable All
+ChannelConfigPage_DisableAll=Disable All
+ChannelConfigPage_EnableAllBufferOverride=Enable All (Buffer Overwrite)
+ChannelConfigage_DisableAllBufferOverride=Disable All (Buffer Overwrite)
+ChannelConfigPage_SetAll=Set All
+ChannelConfigPage_SetAllNumSubBuf=Set All (Number of Sub Buffers)
+channelConfigPage_SetAllSubBufSize=Set All (Size of Sub Buffers)
+ChannelConfigPage_SetAllChannelTimer=Set All (Channel Timer)
+
+DeleteTrace_ConfirmMessage=Are you sure you want to delete the selected trace?
+DeleteTrace_ConfirmTitle=Delete Trace
+
+ImportToProject_AlreadyExists=A trace with that name already exists in the project.
+ImportToProject_ImportFailed=Import failed
+ImportToProject_NoFileServiceSubsystem=Can't find file service subsystem.
+ImportToProject_NoProjectTraceFolder=Can't find file trace folder in selected project.
+ImportToProject_NoRemoteTraceFolder=Can't find remote trace folder.
+
+ImportTraceDialog_ImportButton=Import
+ImportTraceDialog_LinkOnly=Link Only
+ImportTraceDialog_NameLabel=Trace name:
+ImportTraceDialog_ProjectColumn=Project
+ImportTraceDialog_TableLabel=Import to project:
+ImportTraceDialog_Title=Import Trace
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/ProviderResourceAdapter.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/ProviderResourceAdapter.java
new file mode 100644 (file)
index 0000000..93d3627
--- /dev/null
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * <b><u>ProviderResourceAdapter</u></b>
+ * <p>
+ * This is the adapter which enables us to work with our remote provider resources.
+ * </p>
+ */
+public class ProviderResourceAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * Default Constructor.
+     */
+    public ProviderResourceAdapter() {
+        super();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
+     */
+    @Override
+    public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor(Object element) {
+        return Activator.getDefault().getImageDescriptor(Activator.ICON_ID_PROVIDER);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#getText(java.lang.Object)
+     */
+    @Override
+    public String getText(Object element) {
+        return ((ProviderResource) element).getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
+     */
+    @Override
+    public String getAbsoluteName(Object object) {
+        ProviderResource provider = (ProviderResource) object;
+        return Messages.Lttng_Resource_Provider + "_" + provider.getName(); //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
+     */
+    @Override
+    public String getType(Object element) {
+        return Messages.Lttng_Resource_Provider;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
+     */
+    @Override
+    public Object getParent(Object element) {
+        return null; // not really used, which is good because it is ambiguous
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
+        return ((ProviderResource) element).getTargets();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
+     */
+    @Override
+    protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
+     */
+    @Override
+    protected Object internalGetPropertyValue(Object key) {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#canRename(java.lang.Object)
+     * 
+     * Intercept of parent method to indicate these objects can be renamed using the RSE-supplied rename action.
+     */
+    @Override
+    public boolean canRename(Object element) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object)
+     */
+    @Override
+    public boolean showDelete(Object element) {
+        return false;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
+     */
+    @Override
+    public boolean showRefresh(Object element) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object)
+     */
+    @Override
+    public boolean showRename(Object element) {
+        return false;
+    }
+
+    // --------------------------------------
+    // ISystemRemoteElementAdapter methods...
+    // --------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
+     */
+    @Override
+    public String getAbsoluteParentName(Object element) {
+        return Messages.Lttng_Resource_Root; // not really applicable as we have no unique hierarchy
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getSubSystemConfigurationId(java.lang.Object)
+     */
+    @Override
+    public String getSubSystemConfigurationId(Object element) {
+        return "org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystemConfiguration"; // as declared in extension in plugin.xml  //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
+     */
+    @Override
+    public String getRemoteTypeCategory(Object element) {
+        return TraceControlConstants.Rse_Provider_Resource_Remote_Type_Category; // Course grained. Same for all our remote resources.
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
+     */
+    @Override
+    public String getRemoteType(Object element) {
+        return TraceControlConstants.Rse_Provider_Resource_Remote_Type; // Fine grained. Unique to this resource type.
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
+     */
+    @Override
+    public String getRemoteSubType(Object element) {
+        return null; // Very fine grained. We don't use it.
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public boolean refreshRemoteObject(Object oldElement, Object newElement) {
+        ProviderResource oldProvider = (ProviderResource) oldElement;
+        ProviderResource newProvider = (ProviderResource) newElement;
+        newProvider.setName(oldProvider.getName());
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
+     */
+    @Override
+    public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception {
+        TraceSubSystem ourSS = (TraceSubSystem) getSubSystem(element);
+        ProviderResource[] allProviders = ourSS.getAllProviders();
+        String[] allNames = new String[allProviders.length];
+        for (int idx = 0; idx < allProviders.length; idx++) {
+            allNames[idx] = allProviders[idx].getName();
+        }
+        return allNames; // Return list of all team names
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public boolean hasChildren(IAdaptable element) {
+        return ((((ProviderResource) element).getTargets() != null) && (((ProviderResource) element).getTargets().length > 0));
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TargetResourceAdapter.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TargetResourceAdapter.java
new file mode 100644 (file)
index 0000000..1e7d497
--- /dev/null
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * <b><u>TargetResourceAdapter</u></b>
+ * <p>
+ * This is the adapter which enables us to work with our remote target resources.
+ * </p>
+ */
+public class TargetResourceAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     */
+    public TargetResourceAdapter() {
+        super();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
+     */
+    @Override
+    public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor(Object object) {
+        return Activator.getDefault().getImageDescriptor(Activator.ICON_ID_TARGET);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#getText(java.lang.Object)
+     */
+    @Override
+    public String getText(Object element) {
+        return ((TargetResource) element).getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
+     */
+    @Override
+    public String getAbsoluteName(Object object) {
+        TargetResource tar = (TargetResource) object;
+        return tar.getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
+     */
+    @Override
+    public String getType(Object element) {
+        return Messages.Lttng_Resource_Target;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
+     */
+    @Override
+    public Object getParent(Object object) {
+        return ((TargetResource) object).getParent(); // not really used, which is good because it is ambiguous
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
+        return ((TargetResource) element).getTraces();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
+     */
+    @Override
+    protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
+     */
+    @Override
+    protected Object internalGetPropertyValue(Object key) {
+        return null;
+    }
+
+    // --------------------------------------
+    // ISystemRemoteElementAdapter methods...
+    // --------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
+     */
+    @Override
+    public String getAbsoluteParentName(Object element) {
+        return Messages.Lttng_Resource_Root; // not really applicable as we have no unique hierarchy
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getSubSystemConfigurationId(java.lang.Object)
+     */
+    @Override
+    public String getSubSystemConfigurationId(Object element) {
+        return "org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteTypeCategory(java.lang.Object)
+     */
+    @Override
+    public String getRemoteTypeCategory(Object element) {
+        return TraceControlConstants.Rse_Target_Resource_Remote_Type_Category; // Course grained. Same for all our remote resources.
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteType(java.lang.Object)
+     */
+    @Override
+    public String getRemoteType(Object element) {
+        return TraceControlConstants.Rse_Target_Resource_Remote_Type; // Fine grained. Unique to this resource type.
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteSubType(java.lang.Object)
+     */
+    @Override
+    public String getRemoteSubType(Object element) {
+        return null; // Very fine grained. We don't use it.
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public boolean refreshRemoteObject(Object oldElement, Object newElement) {
+        TargetResource oldDevr = (TargetResource) oldElement;
+        TargetResource newDevr = (TargetResource) newElement;
+        newDevr.setName(oldDevr.getName());
+        return true;
+    }
+
+    public boolean supportsUserDefinedActions(Object object) {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public boolean hasChildren(IAdaptable element) {
+        return ((((TargetResource) element).getTraces() != null) && (((TargetResource) element).getTraces().length > 0));
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object)
+     */
+    @Override
+    public boolean showDelete(Object element) {
+        return false;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
+     */
+    @Override
+    public boolean showRefresh(Object element) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object)
+     */
+    @Override
+    public boolean showRename(Object element) {
+        return false;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#saveExpansionState(java.lang.Object)
+     */
+    @Override
+    public boolean saveExpansionState(Object element) {
+        return true;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
+     */
+    @Override
+    public boolean testAttribute(Object target, String name, String value) {
+        
+        if (target instanceof TargetResource) {
+            if ((name.compareTo("canCreateNewTrace") == 0) && (((TargetResource)target).getCanCreateNewTrace().compareTo(value) == 0)) { //$NON-NLS-1$ 
+                return true;
+            }
+        }
+        
+        return super.testAttribute(target, name, value);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceAdapterFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceAdapterFactory.java
new file mode 100644 (file)
index 0000000..45e1ec4
--- /dev/null
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * <b><u>TargetResourceAdapter</u></b>
+ * <p>
+ * This factory maps requests for an adapter object from a given remote object.
+ * </p>
+ */
+public class TraceAdapterFactory extends AbstractSystemRemoteAdapterFactory implements IAdapterFactory {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private ProviderResourceAdapter providerAdapter = new ProviderResourceAdapter();
+    private TargetResourceAdapter targetAdapter = new TargetResourceAdapter();
+    private TraceResourceAdapter traceAdapter = new TraceResourceAdapter();
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor for TraceAdapterFactory.
+     */
+    public TraceAdapterFactory() {
+        super();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+     */
+    @SuppressWarnings("rawtypes")
+    @Override
+    public Object getAdapter(Object adaptableObject, Class adapterType) {
+        ISystemViewElementAdapter adapter = null;
+        if (adaptableObject instanceof ProviderResource) {
+            adapter = providerAdapter;
+        }
+        else if (adaptableObject instanceof TargetResource) {
+            adapter = targetAdapter;
+        }
+        else if (adaptableObject instanceof TraceResource) {
+            adapter = traceAdapter;
+        }
+        // these lines are very important!
+        if ((adapter != null) && (adapterType == IPropertySource.class)) {
+            adapter.setPropertySourceInput(adaptableObject);
+        }
+        return adapter;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceResourceAdapter.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/TraceResourceAdapter.java
new file mode 100644 (file)
index 0000000..76aff98
--- /dev/null
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.PropertyInfo;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+/**
+ * <b><u>TargetResourceAdapter</u></b>
+ * <p>
+ * This is the adapter which enables us to work with our remote trace resources.
+ * </p>
+ */
+public class TraceResourceAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter {
+
+ // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     */
+    public TraceResourceAdapter() {
+        super();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
+     */
+    @Override
+    public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) {
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor(Object object) {
+        return Activator.getDefault().getImageDescriptor(Activator.ICON_ID_TRACE);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#getText(java.lang.Object)
+     */
+    @Override
+    public String getText(Object element) {
+        return ((TraceResource) element).getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
+     */
+    @Override
+    public String getAbsoluteName(Object object) {
+        TraceResource tar = (TraceResource) object;
+        return tar.getName();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
+     */
+    @Override
+    public String getType(Object element) {
+        return Messages.Lttng_Resource_Trace;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
+     */
+    @Override
+    public Object getParent(Object object) {
+        return ((TraceResource) object).getParent();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
+     */
+    @Override
+    protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
+        // propertySourceInput holds the currently selected object
+        TraceResource trace = (TraceResource)propertySourceInput;
+
+        Map<String, PropertyInfo> properties = trace.getPropertyInfo();
+
+        PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[properties.size()];
+
+        Set<String> keys = properties.keySet();
+        int i = 0;
+        for (Iterator<String> iterator = keys.iterator(); iterator.hasNext();) {
+            String key = iterator.next();
+            PropertyInfo info = properties.get(key);
+            propertyDescriptors[i++] = createSimplePropertyDescriptor(key, info.getName(), info.getDescription());
+        }
+
+        return propertyDescriptors;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
+     */
+    @Override
+    protected Object internalGetPropertyValue(Object key) {
+        // propertySourceInput holds the currently selected object
+        TraceResource trace = (TraceResource)propertySourceInput;
+        return trace.getProperty((String)key);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object)
+     */
+    @Override
+    public boolean showDelete(Object element) {
+        return false;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
+     */
+    @Override
+    public boolean showRefresh(Object element) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object)
+     */
+    @Override
+    public boolean showRename(Object element) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#supportsDeferredQueries(org.eclipse.rse.core.subsystems.ISubSystem)
+     */
+    @Override
+    public boolean supportsDeferredQueries(ISubSystem subSys) {
+        return false;
+    }
+    // --------------------------------------
+    // ISystemRemoteElementAdapter methods...
+    // --------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
+     */
+    @Override
+    public String getAbsoluteParentName(Object element) {
+        return Messages.Lttng_Resource_Root; // not really applicable as we have no unique hierarchy
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getSubSystemConfigurationId(java.lang.Object)
+     */
+    @Override
+    public String getSubSystemConfigurationId(Object element) {
+        return "org.eclipse.linuxtools.lttng.rse.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteTypeCategory(java.lang.Object)
+     */
+    @Override
+    public String getRemoteTypeCategory(Object element) {
+        return TraceControlConstants.Rse_Trace_Resource_Remote_Type_Category; // Course grained. Same for all our remote resources.
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteType(java.lang.Object)
+     */
+    @Override
+    public String getRemoteType(Object element) {
+        return TraceControlConstants.Rse_Trace_Resource_Remote_Type; // Fine grained. Unique to this resource type.
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteSubType(java.lang.Object)
+     */
+    @Override
+    public String getRemoteSubType(Object element) {
+        return null; // Very fine grained. We don't use it.
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public boolean refreshRemoteObject(Object oldElement, Object newElement) {
+        TraceResource oldDevr = (TraceResource) oldElement;
+        TraceResource newDevr = (TraceResource) newElement;
+        newDevr.setName(oldDevr.getName());
+        return true;
+    }
+
+     /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
+     */
+    public boolean supportsUserDefinedActions(Object object) {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception {
+        return null; // leave as null if this is the root
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception {
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public boolean hasChildren(IAdaptable arg0) {
+        return false;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public boolean testAttribute(Object target, String name, String value) {
+        if(target instanceof TraceResource) {
+            TraceResource trace = (TraceResource) target;
+            if (name.equals("canConfigure") && value.equals("yes")) {
+                if (trace.getTraceState() != TraceState.STOPPED) {
+                    return true;
+                }
+            }
+            else if (name.equals("canStart") && value.equals("yes")) {
+                if (trace.getTraceState() == TraceState.CONFIGURED|| trace.getTraceState() == TraceState.PAUSED) {
+                    return true;
+                }
+            }
+            else if (name.equals("canPause") && value.equals("yes")) {
+                if (trace.getTraceState() == TraceState.STARTED) {
+                    return true;
+                }
+            }
+            else if (name.equals("canStop") && value.equals("yes")) {
+                if (trace.getTraceState() == TraceState.CREATED || trace.getTraceState() == TraceState.PAUSED || trace.getTraceState() == TraceState.CONFIGURED) {
+                    return true;
+                }
+            }
+            else if (name.equals("canBrowse") && value.equals("yes")) {
+                if ((trace.getTraceConfig() != null) && trace.getTraceConfig().isNetworkTrace() && (trace.getTraceState() == TraceState.STOPPED)) {
+                    return true;
+                }
+            }
+            else if (name.equals("canDelete") && value.equals("yes")) {
+                if (trace.getTraceState() == TraceState.STOPPED) {
+                    return true;
+                }
+            }
+            else if (name.equals("canImport") && value.equals("yes")) {
+                if (trace.getTraceState() == TraceState.STOPPED) {
+                    return true;
+                } else if (trace.getTraceState() != TraceState.CREATED && trace.getTraceConfig().isNetworkTrace()) {
+                       return true;
+                }
+            }
+        }
+        return super.testAttribute(target, name, value);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelCellModifier.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelCellModifier.java
new file mode 100644 (file)
index 0000000..8155776
--- /dev/null
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config;
+
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards.KernelTraceChannelConfigurationPage;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * <b><u>TraceChannelCellModifier</u></b>
+ * <p>
+ *  ICellModifier implementation for TableViewers in order to modify cells of a table used for 
+ *  for displaying and configuring trace channel information.  
+ * </p>
+ */
+public class TraceChannelCellModifier implements ICellModifier {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // -----------------------------------------------------------------------
+    KernelTraceChannelConfigurationPage fConfigPage;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // -----------------------------------------------------------------------
+    
+    /**
+     * Constructor
+     * 
+     * @param configPage The trace configuration reference
+     */
+    public TraceChannelCellModifier(KernelTraceChannelConfigurationPage configPage) {
+        fConfigPage = configPage;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
+     */
+    @Override
+    public boolean canModify(Object element, String property) {
+        // Find the index of the column
+        int columnIndex = fConfigPage.getColumnProperties().indexOf(property);
+
+        switch (columnIndex) {
+            case 0: // Name
+                return false;
+            case 1: // Enabled
+            case 2: // Buffer Overwrite
+            case 3: // SubbufNum
+            case 4: // SubbufSize
+                if ((fConfigPage.getTraceState() == TraceState.CREATED) || (fConfigPage.getTraceState() == TraceState.CONFIGURED)) {
+                    return true;
+                }
+                break;
+            case 5: // Channel Timer
+                if (fConfigPage.isLocalTrace() && ((fConfigPage.getTraceState() == TraceState.CREATED) || (fConfigPage.getTraceState() == TraceState.CONFIGURED))) {
+                    return true;
+                }
+                break;
+            default:  
+        }
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
+     */
+    @Override
+    public Object getValue(Object element, String property) {
+        
+        // Find the index of the column
+        int columnIndex = fConfigPage.getColumnProperties().indexOf(property);
+
+        Object result = null;
+        TraceChannel chan = (TraceChannel) element;
+        
+        switch (columnIndex) {
+            case 0: // Name
+                result = chan.getName();
+                break;
+            case 1: // Enabled
+                result = Boolean.valueOf(chan.isEnabled());
+                break;
+            case 2: // Buffer Overwrite
+                result = Boolean.valueOf(chan.isChannelOverride());
+                break;
+            case 3: // SubbufNum
+                result = String.valueOf(chan.getSubbufNum());
+                break;
+            case 4: // SubbufSize
+                result = String.valueOf(chan.getSubbufSize());
+                break;
+            case 5: // Channel Timer
+                result = String.valueOf(chan.getTimer());
+                break;
+            default:
+                    result = "";  //$NON-NLS-1$
+        }
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void modify(Object element, String property, Object value) {
+        //  Find the index of the column
+        int columnIndex = fConfigPage.getColumnProperties().indexOf(property);
+
+        TableItem item = (TableItem) element;
+        TraceChannel chan = (TraceChannel) item.getData();
+        String valueString;
+
+        switch (columnIndex) {
+        case 0:
+            chan.setName(((String) value).trim());
+            break;
+        case 1: // Name
+            chan.setIsEnabled(((Boolean) value).booleanValue());
+            break;
+        case 2: 
+            chan.setIsChannelOverride(((Boolean) value).booleanValue());
+            break;
+        case 3: // SubbufNum
+            valueString = ((String) value).trim();
+            if (valueString.length() == 0) {
+                valueString = "0"; //$NON-NLS-1$
+            }
+            else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
+                chan.setSubbufNum(TraceChannel.UNKNOWN_VALUE);
+            }
+            else {
+                chan.setSubbufNum(Integer.parseInt(valueString));
+            }
+            break;
+        case 4: // SubbufSize
+            valueString = ((String) value).trim();
+            if (valueString.length() == 0) {
+                valueString = "0"; //$NON-NLS-1$
+            }
+            else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
+                chan.setSubbufSize(TraceChannel.UNKNOWN_VALUE);
+            }
+            else {
+                chan.setSubbufSize(Integer.parseInt(valueString));
+            }
+            break;
+        case 5:  // Channel Timer
+            valueString = ((String) value).trim();
+            if (valueString.length() == 0) {
+                valueString = "0"; //$NON-NLS-1$
+            }
+            else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
+                chan.setTimer(TraceChannel.UNKNOWN_VALUE);
+            }
+            else {
+                chan.setTimer(Integer.parseInt(valueString));
+            }
+            break;
+        default:
+        }
+        fConfigPage.refresh();
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelTableContentProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelTableContentProvider.java
new file mode 100644 (file)
index 0000000..69d7c64
--- /dev/null
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
+
+/**
+ * <b><u>TraceChannelTableContentProvider</u></b>
+ * <p>
+ *  IStructuredContentProvider implementation for TableViewers in order to provide the content of a table 
+ *  used for displaying and configuring trace channel information.  
+ * </p>
+ */
+public class TraceChannelTableContentProvider implements IStructuredContentProvider {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // -----------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // -----------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // -----------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    @Override
+    public Object[] getElements(Object inputElement) {
+        if (inputElement instanceof TraceChannels) {
+            return ((TraceChannels)inputElement).values().toArray();
+        }
+        return null;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelTableLabelProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/model/config/TraceChannelTableLabelProvider.java
new file mode 100644 (file)
index 0000000..9e66fb3
--- /dev/null
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * <b><u>TraceChannelTableLabelProvider</u></b>
+ * <p>
+ *  ITableLabelProvider implementation for TableViewers in order to provide the labels of a table 
+ *  used for displaying and configuring trace channel information.  
+ * </p>
+ */
+public class TraceChannelTableLabelProvider implements ITableLabelProvider {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // -----------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // -----------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // -----------------------------------------------------------------------
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+     */
+    @Override
+    public void addListener(ILabelProviderListener listener) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+     */
+    @Override
+    public void dispose() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+     */
+    @Override
+    public boolean isLabelProperty(Object element, String property) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+     */
+    @Override
+    public void removeListener(ILabelProviderListener listener) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+     */
+    @Override
+    public Image getColumnImage(Object element, int columnIndex) {
+        if (element instanceof TraceChannel) {
+            TraceChannel chan = (TraceChannel) element;
+            switch (columnIndex) {
+            case 1: 
+                return getImage(chan.isEnabled() && chan.isEnabledStatusKnown());
+            case 2: 
+                return getImage(chan.isChannelOverride() && chan.isChannelOverrideStatusKnown());    
+            default:
+            }
+        }
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+     */
+    @Override
+    public String getColumnText(Object element, int columnIndex) {
+        if (element instanceof TraceChannel) {
+            TraceChannel chan = (TraceChannel) element;
+            switch (columnIndex) {
+            case 0: 
+                return chan.getName();
+            case 1: 
+                if (!chan.isEnabledStatusKnown())  {
+                    return TraceChannel.UNKNOWN_STRING;
+                }
+                break;
+            case 2:
+                if (!chan.isChannelOverrideStatusKnown()) { 
+                    return TraceChannel.UNKNOWN_STRING;
+                }
+                break;
+            case 3:
+                if (chan.getSubbufNum() == TraceChannel.UNKNOWN_VALUE) {
+                    return TraceChannel.UNKNOWN_STRING;
+                }
+                return String.valueOf(chan.getSubbufNum());
+            case 4: 
+                if (chan.getSubbufSize() == TraceChannel.UNKNOWN_VALUE) {
+                    return TraceChannel.UNKNOWN_STRING;
+                }
+                return String.valueOf(chan.getSubbufSize());
+            case 5:
+                if (chan.getTimer() == TraceChannel.UNKNOWN_VALUE) { 
+                    return TraceChannel.UNKNOWN_STRING;
+                }
+                return String.valueOf(chan.getTimer());
+            default:
+                // fall through
+            }
+        }
+        return null;
+    }
+
+    /*
+     * Gets the checked or unchecked image.
+     */
+    private Image getImage(boolean isSelected) {
+        if (isSelected) {
+            return Activator.getDefault().getImage(Activator.ICON_ID_CHECKED);
+        }
+        return Activator.getDefault().getImage(Activator.ICON_ID_UNCHECKED);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/ITCFSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/ITCFSubSystem.java
new file mode 100644 (file)
index 0000000..df2b901
--- /dev/null
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Wind River Systems - initial API and implementation
+ *     Bernd Hufmann - Adapted for Lttng
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems;
+
+import org.eclipse.rse.core.subsystems.ISubSystem;
+
+/**
+ * A subsystem can implement this interface to indicate that it can share TCF connection with
+ * other subsystems on same host.
+ */
+public interface ITCFSubSystem extends ISubSystem {
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/ITraceSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/ITraceSubSystem.java
new file mode 100644 (file)
index 0000000..2453699
--- /dev/null
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems;
+
+/**
+ * A subsystem can implement this interface to indicate that this subsystem is a Trace Subsystem.
+ */
+public interface ITraceSubSystem extends ITCFSubSystem {
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java
new file mode 100644 (file)
index 0000000..09f6ff8
--- /dev/null
@@ -0,0 +1,819 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Vector;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.LttControllerServiceProxy;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.ImportToProject;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.actions.PauseTrace;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.connectorservice.TraceConnectorService;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
+import org.eclipse.rse.core.events.SystemResourceChangeEvent;
+import org.eclipse.rse.core.filters.ISystemFilter;
+import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemMessageObject;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemMessageObject;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.core.subsystems.CommunicationsEvent;
+import org.eclipse.rse.core.subsystems.ICommunicationsListener;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.SubSystem;
+import org.eclipse.rse.services.clientserver.NamePatternMatcher;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFTask;
+
+/**
+ * <b><u>TraceSubSystem</u></b>
+ * <p>
+ * Implementation of the trace subsystem. Provides methods to initialize connections
+ * to the remote system, connection handling, filtering and retrival of remote
+ * system configuration. 
+ * </p>
+ */
+public class TraceSubSystem extends SubSystem implements ICommunicationsListener {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private ProviderResource[] fProviders; // master list of Providers
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * @param host
+     * @param connectorService
+     */
+    public TraceSubSystem(IHost host, IConnectorService connectorService) {
+        super(host, connectorService);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void initializeSubSystem(IProgressMonitor monitor) {
+        getConnectorService().addCommunicationsListener(this);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void uninitializeSubSystem(IProgressMonitor monitor) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String)
+     *
+     * For drag and drop, and clipboard support of remote objects.
+     * 
+     * Return the remote object within the subsystem that corresponds to the specified unique ID. Because each subsystem maintains it's own objects, it's the responsability of the subsystem to determine how an ID (or key) for a given object maps to
+     * the real object. By default this returns null.
+     */
+    @Override
+    public Object getObjectWithAbsoluteName(String key) {
+        return null;
+    }
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException {
+        
+        ProviderResource[] allProviders;
+
+        try {
+             allProviders = getAllProviders();
+        } catch (SystemMessageException e) {
+            SystemBasePlugin.logError("TraceSubSystem", e); //$NON-NLS-1$
+            Object[] children = new SystemMessageObject[1];
+            children[0] = new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null);
+            return children;
+        }
+
+        // Now, subset master list, based on filter string...
+        NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
+        Vector<ProviderResource> v = new Vector<ProviderResource>();
+        for (int idx = 0; idx < allProviders.length; idx++) {
+            if (subsetter.matches(allProviders[idx].getName())) {
+                v.addElement(allProviders[idx]);
+            }
+        }
+        return allProviders;
+    }
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(java.lang.Object, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#filterEventFilterCreated(java.lang.Object, org.eclipse.rse.core.filters.ISystemFilter)
+     */
+    @Override
+    public void filterEventFilterCreated(Object selectedObject, ISystemFilter newFilter) {
+        super.filterEventFilterCreated(selectedObject, newFilter);
+        ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+        registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null));
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystem#filterEventFilterPoolReferenceCreated(org.eclipse.rse.core.filters.ISystemFilterPoolReference)
+     */
+    @Override
+    public void filterEventFilterPoolReferenceCreated(ISystemFilterPoolReference newPoolRef) {
+        super.filterEventFilterPoolReferenceCreated(newPoolRef);
+        if (getSystemFilterPoolReferenceManager().getSystemFilterPoolReferenceCount() == 1) {
+            ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+            registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null));
+        }
+    }
+    
+    /**
+     * Retrieves all provider resources from the remote system and updates local references.  
+     * 
+     * @return provider resources
+     * @throws SystemMessageException
+     * @throws InterruptedException
+     */
+    public ProviderResource[] getAllProviders() throws SystemMessageException, InterruptedException {
+        ProviderResource[] providers = createProviders(); 
+        if (fProviders == null) {
+            fProviders = providers;
+        }
+        else {
+            for (int i = 0; i < fProviders.length; i++) {
+                for (int j = 0; j < providers.length; j++) {
+                    if(fProviders[i].getName().equals(providers[j].getName())) {
+                        // Check if all targets already exist
+                        fProviders[i].refreshTargets(providers[j].getTargets());
+                    }
+                }
+            }
+        }
+        return (fProviders != null) ? Arrays.copyOf(fProviders, fProviders.length) : null;
+    }
+
+    /**
+     * Get the list of all targets.
+     * 
+     * @return targets The list of targets.
+     * @throws SystemMessageException
+     */
+    public TargetResource[] getAllTargets() throws SystemMessageException {
+       ArrayList<TargetResource> targets = new ArrayList<TargetResource>();
+       if (fProviders != null) {
+            for (int i = 0; i < fProviders.length; i++) {
+                targets.addAll(Arrays.asList(fProviders[i].getTargets()));
+            }
+       }
+        return targets.toArray(new TargetResource[0]);
+    }
+
+    /**
+     * Get the list of all traces.
+     * 
+     * @return traces The list of traces.
+     * @throws SystemMessageException
+     */
+    public TraceResource[] getAllTraces() throws SystemMessageException {
+       ArrayList<TraceResource> traces = new ArrayList<TraceResource>();
+       if (fProviders != null) {
+            for (int i = 0; i < fProviders.length; i++) {
+               ProviderResource provider = fProviders[i];
+               int numTargets = provider.getTargets().length;
+                for (int j = 0; j < numTargets; j++) {
+                       TargetResource target = provider.getTargets()[j];
+                       if (provider.getName().equals(LttngConstants.Lttng_Provider_Kernel)) {
+                               traces.addAll(Arrays.asList(target.getTraces()));
+                       }
+                }
+            }
+        }
+        return traces.toArray(new TraceResource[0]);
+    }
+
+    /**
+     * Get the list of all traces for given provider and target.
+     * 
+     * @param provider
+     * @param target
+     * @returns trace resources
+     */
+    public TraceResource[] getAllTraces(String providerName, String targetName) throws SystemMessageException {
+        ArrayList<TraceResource> traces = new ArrayList<TraceResource>();
+        ProviderResource selectedProvider = null;
+        if (fProviders != null) {
+            for (int i = 0; i < fProviders.length; i++) {
+                ProviderResource provider = fProviders[i];
+                if (provider.getName().equals(providerName)) {
+                    selectedProvider = fProviders[i];
+                    break;
+                }
+            }
+            
+            if (selectedProvider != null) {
+                int numTargets = selectedProvider.getTargets().length;
+                for (int j = 0; j < numTargets; j++) {
+                    TargetResource target = selectedProvider.getTargets()[j];
+                    if (target.getName().equals(targetName)) {
+                        traces.addAll(Arrays.asList(target.getTraces()));
+                        break;
+                    }
+                }
+            }
+        }
+        return traces.toArray(new TraceResource[0]);
+    }
+    
+    /**
+     * Finds a trace resource within a given provider and target for a given trace name 
+     * 
+     * @param targetName - target name to be searched 
+     * @param traceName - trace name to be searched
+     * @return trace resource or null (if not found)
+     */
+    public TraceResource findTrace(String providerName, String targetName, String traceName) {
+        TraceResource trace = null;
+        TraceResource[] traces;
+        try {
+            traces = getAllTraces(providerName, targetName);
+            for (int i = 0; i < traces.length; i++) {
+                if (traces[i].getName().equals(traceName)) {
+                    trace = traces[i];
+                    break;
+                }
+            }
+        } catch (SystemMessageException e) {
+            SystemBasePlugin.logError("TraceSubSystem", e); //$NON-NLS-1$
+        }
+
+        return trace;
+    }
+    
+    /*
+     * Retrieves the providers from the remote system.
+     */
+    private ProviderResource[] createProviders() throws SystemMessageException {
+        ProviderResource[] providers = null;
+        try {
+            
+            final ILttControllerService service = getControllerService();
+
+            // Create future task
+            providers = new TCFTask<ProviderResource[]>() {
+                @Override
+                public void run() {
+
+                    // Get provider using Lttng controller service proxy
+                    service.getProviders(new ILttControllerService.DoneGetProviders() {
+
+                        @Override
+                        public void doneGetProviders(IToken token, Exception error, String[] str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Create provider list
+                            ProviderResource[] providers = new ProviderResource[str.length]; 
+
+                            for (int i = 0; i < str.length; i++) {
+                                ProviderResource tempProvider = new ProviderResource(TraceSubSystem.this);
+                                tempProvider.setName(str[i]);
+                                providers[i] = tempProvider;
+                            }
+
+                            // Notify with provider list
+                            done(providers);
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            if (e instanceof SystemMessageException) throw (SystemMessageException)e;
+            throw new SystemMessageException(Activator.getDefault().getMessage(e));
+        }
+
+        for (int i = 0; i < providers.length; i++) {
+            createTargets(providers[i]);
+        }
+
+        return providers;
+    }
+
+    /*
+     * Retrieves the targets for given provider from the remote system.
+     */
+    private TargetResource[] createTargets(final ProviderResource provider) throws SystemMessageException {
+       TargetResource[] targets;
+       try {
+            final ILttControllerService service = getControllerService();
+
+            // Create future task
+            targets = new TCFTask<TargetResource[]>() {
+                @Override
+                public void run() {
+                    
+                    // Get targets using Lttng controller service proxy
+                    service.getTargets(provider.getName(), new ILttControllerService.DoneGetTargets() {
+
+                        @Override
+                        public void doneGetTargets(IToken token, Exception error, String[] str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Create targets
+                            TargetResource[] targets = new TargetResource[str.length];
+                            for (int i = 0; i < str.length; i++) {
+                                TargetResource tempTarget = new TargetResource(TraceSubSystem.this);
+                                tempTarget.setName(str[i]);
+                                tempTarget.setParent(provider);
+                                targets[i] = tempTarget;
+                            }
+                            // Notify with target list
+                            done(targets);
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+               provider.setTargets(new TargetResource[0]);
+            if (e instanceof SystemMessageException) throw (SystemMessageException)e;
+            throw new SystemMessageException(Activator.getDefault().getMessage(e));
+        }
+
+        provider.setTargets(targets);
+        for (int i = 0; i < targets.length; i++) {
+               if (targets[i].getParent().getName().equals(LttngConstants.Lttng_Provider_Kernel)) {
+                   createTraces(targets[i]);
+               }
+        }
+
+        return targets;
+    }
+
+    /*
+     * Retrieves the trace instances for a given target from the remote system.
+     */
+    private TraceResource[] createTraces(final TargetResource target) throws SystemMessageException {
+       TraceResource[] traces;
+        try {
+            final ILttControllerService service = getControllerService();
+
+            // Create future task
+            traces = new TCFTask<TraceResource[]>() {
+                @Override
+                public void run() {
+                    // Get targets using Lttng controller service proxy
+                    service.getTraces(target.getParent().getName(), target.getName(), new ILttControllerService.DoneGetTraces() {
+
+                        @Override
+                        public void doneGetTraces(IToken token, Exception error, String[] str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+                            
+                            // Create trace list
+                            TraceResource[] traces = new TraceResource[str.length];
+                            for (int i = 0; i < str.length; i++) {
+                                TraceResource trace = new TraceResource(TraceSubSystem.this, service);
+                                trace.setName(str[i]);
+                                trace.setParent(target);
+                                trace.setTraceState(TraceState.CREATED);
+                                traces[i] = trace;
+                            }
+
+                            // Notify with trace list
+                            done(traces);
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+        } catch (Exception e) {
+            target.setTraces(new TraceResource[0]);
+            if (e instanceof SystemMessageException) throw (SystemMessageException)e;
+            throw new SystemMessageException(Activator.getDefault().getMessage(e));
+        }
+
+        target.setTraces(traces);
+
+        // get active trace information (is only supported for kernel traces)
+        createTraceConfigurations(target, traces);
+        return traces;
+    }
+
+    /*
+     * Retrieves the trace configurations for the given trace from the remote system.
+     */
+    private void createTraceConfigurations(final TargetResource target, TraceResource[] traces) throws SystemMessageException {
+        if (!target.isUst() && (traces.length > 0)) {
+            // get active traces 
+            String[] activeTraceNames;
+            try {
+                final ILttControllerService service = getControllerService();
+                activeTraceNames = new TCFTask<String[]>() {
+                    @Override
+                    public void run() {
+                        // Get targets using Lttng controller service proxy
+                        service.getActiveTraces(target.getParent().getName(), target.getName(), new ILttControllerService.DoneGetActiveTraces() {
+
+                            @Override
+                            public void doneGetActiveTraces(IToken token, Exception error, String[] str) {
+                                if (error != null) {
+                                    // Notify with error
+                                    error(error);
+                                    return;
+                                }
+
+                                // Notify with active trace list
+                                done(str);
+                            }
+                        });
+                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+            } catch (Exception e) {
+                if (e instanceof SystemMessageException) throw (SystemMessageException)e;
+                throw new SystemMessageException(Activator.getDefault().getMessage(e));
+            }
+            
+            // get active trace information
+            for (int j = 0; j < activeTraceNames.length; j++) {
+                final TraceResource trace = target.getTrace(activeTraceNames[j]);
+                if (trace != null) {
+                    // get trace info
+                    TraceConfig traceConfig;
+
+                    try {
+                        final ILttControllerService service = getControllerService();
+                        traceConfig = new TCFTask<TraceConfig>() {
+                            @Override
+                            public void run() {
+                                // Get targets using Lttng controller service proxy
+                                service.getActiveTraceInfo(target.getParent().getName(), target.getName(), trace.getName(), new ILttControllerService.DoneGetActiveTraceInfo() {
+
+                                    @Override
+                                    public void doneGetActiveTraceInfo(IToken token, Exception error, String[] strArray) {
+                                        if (error != null) {
+                                            // Notify with error
+                                            error(error);
+                                            return;
+                                        }
+
+                                        TraceConfig config = new TraceConfig();
+                                        config.setTraceName(trace.getName());
+                                        config.setTraceTransport(TraceControlConstants.Lttng_Trace_Transport_Relay); 
+                                        config.setIsAppend(false); 
+                                        for (String pair : strArray) {
+                                            String[] pairArray = pair.split(LttngConstants.Lttng_Control_GetActiveTraceInfoSeparator);
+                                            if (pairArray.length != 2) {
+                                                continue;
+                                            }
+                                            String param = pairArray[0];
+                                            String value = pairArray[1];
+                                            if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_DESTINATION)) {
+                                                if (value.startsWith(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL)) {
+                                                    config.setNetworkTrace(false);
+                                                    config.setTracePath(value.substring(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL.length()));
+                                                } else if (value.startsWith(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK)) {
+                                                    config.setNetworkTrace(true);
+                                                    config.setTracePath(value.substring(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK.length()));
+                                                }
+                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_NUM_THREAD)) {
+                                                config.setNumChannel(Integer.valueOf(value));
+                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_NORMAL_ONLY)) {
+                                                if (value.equals(Boolean.toString(true))) {
+                                                    config.setMode(TraceConfig.NORMAL_MODE);
+                                                }
+                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_FLIGHT_ONLY)) {
+                                                if (value.equals(Boolean.toString(true))) {
+                                                    config.setMode(TraceConfig.FLIGHT_RECORDER_MODE);
+                                                }
+                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_ENABLED)) {
+                                                if (value.equals(Boolean.toString(true))) {
+                                                    trace.setTraceState(TraceState.STARTED);
+                                                } else {
+                                                    trace.setTraceState(TraceState.PAUSED);  
+                                                }
+                                            }
+                                        }
+
+                                        // Notify with active trace list
+                                        done(config);
+                                    }
+                                });
+                            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+                        trace.setTraceConfig(traceConfig);
+                        if (traceConfig != null) {
+                            if (traceConfig.isNetworkTrace()) {
+                                // stop and restart the network transfer since TCF channel may be different
+                                if (fProviders == null) { // do this only on startup, not on refresh
+                                    restartTraceNetwork(service, trace, traceConfig);
+                                }
+                                LiveTraceManager.setLiveTrace(traceConfig.getTracePath(), true);
+                            }
+                        }
+                    } catch (Exception e) {
+                        if (e instanceof SystemMessageException) throw (SystemMessageException)e;
+                        throw new SystemMessageException(Activator.getDefault().getMessage(e));
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent)
+     */
+    @Override
+    public void communicationsStateChange(CommunicationsEvent e) {
+        switch (e.getState())
+        {
+        case CommunicationsEvent.BEFORE_CONNECT :
+            break;
+        case CommunicationsEvent.AFTER_CONNECT :
+            break;
+        case CommunicationsEvent.BEFORE_DISCONNECT :
+            
+            try {
+                final TraceResource[] traces = getAllTraces();
+
+                StringBuffer traceNames = new StringBuffer("");  //$NON-NLS-1$
+                String filler = ""; //$NON-NLS-1$
+                for (int j = 0; j < traces.length; j++) {
+                    // For network traces, ask user to pause tracing
+                    if (traces[j].isNetworkTraceAndStarted()) {
+                        traceNames.append(filler);
+                        traceNames.append(traces[j].getName());
+                    }
+                    filler = ", "; //$NON-NLS-1$
+                }
+                if (!"".equals(traceNames.toString())) { //$NON-NLS-1$
+                    final String finalTraceNames = traceNames.toString();
+                    Display.getDefault().syncExec(new Runnable() {
+
+                        @Override
+                        public void run() {
+                            MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.Ltt_ShutdownWarning, Messages.Ltt_NetworkTraceRunningWarning + ":\n" + finalTraceNames); //$NON-NLS-1$
+
+                            // Pause tracing
+                            PauseTrace pauseAction = new PauseTrace();
+                            pauseAction.setSelectedTraces(new ArrayList<TraceResource>(Arrays.asList(traces)));
+                            pauseAction.run(null);
+                            try {
+                                Thread.sleep(2000); // allow time for target to pause traces before disconnecting the channel
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+
+                if (fProviders != null) {
+                    // reset all providers and it's children
+                    for (int i = 0; i < fProviders.length; i++) {
+                        fProviders[i].removeAllTargets();
+                    }
+                    fProviders = null;
+                }
+
+            } catch (SystemMessageException ex) {
+                SystemBasePlugin.logError("TraceSubSystem", ex); //$NON-NLS-1$
+            }
+            break;
+        case CommunicationsEvent.AFTER_DISCONNECT :
+            getConnectorService().removeCommunicationsListener(this);
+            break;
+        case CommunicationsEvent.CONNECTION_ERROR :
+            // TODO notify user about the lost connection ?!
+            getConnectorService().removeCommunicationsListener(this);
+            try {
+                this.disconnect();
+            } catch (Exception e1) {
+                // Nothing to do
+            }
+            break;
+        default :
+            break;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#isPassiveCommunicationsListener()
+     */
+    @Override
+    public boolean isPassiveCommunicationsListener() {
+        return true;    
+    }
+    
+    /**
+     * Returns the trace controller service.
+     * 
+     * @return trace controller service
+     * @throws Exception
+     */
+    public LttControllerServiceProxy getControllerService() throws Exception {
+        return ((TraceConnectorService)getConnectorService()).getControllerService();
+    }
+
+    /*
+     * Stop and restart the network transfer. Only normal channels are written while trace is started.  
+     */
+    private void restartTraceNetwork(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
+        File newDir = new File(traceConfig.getTracePath());
+        if (!newDir.exists()) {
+            boolean created = newDir.mkdirs();
+            if (!created) {
+                throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
+            }
+            if (traceConfig.getProject() != null) {
+                ImportToProject.linkTrace(getShell(), trace, traceConfig.getProject(), traceConfig.getTraceName());
+            }
+        }
+
+        // stop the previous lttd
+        boolean ok = new TCFTask<Boolean>() {
+            @Override
+            public void run() {
+
+                // Setup trace transport using Lttng controller service proxy
+                service.stopWriteTraceNetwork(trace.getParent().getParent().getName(), 
+                        trace.getParent().getName(), 
+                        traceConfig.getTraceName(), 
+                        new ILttControllerService.DoneStopWriteTraceNetwork() {
+
+                    @Override
+                    public void doneStopWriteTraceNetwork(IToken token, Exception error, Object str) {
+                        if (error != null) {
+                            // Notify with error
+                            error(error);
+                            return;
+                        }
+
+                        // Notify about success
+                        done(true);
+                    }
+                });
+            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+        if (!ok) {
+            return;
+        }
+
+        // lttd will only perform the shutdown after stopWriteTraceNetwork
+        // when it receives the next on_read_subbuffer callback
+
+        if (trace.getTraceState() == TraceState.PAUSED) {
+            // we need to start the trace to make sure that the network transfer is stopped
+            ok = new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Start the trace
+                    service.startTrace(trace.getParent().getParent().getName(), 
+                            trace.getParent().getName(), 
+                            traceConfig.getTraceName(), 
+                            new ILttControllerService.DoneStartTrace() {
+
+                        @Override
+                        public void doneStartTrace(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(true);
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+            if (!ok) {
+                return;
+            }
+
+            trace.setTraceState(TraceState.STARTED);
+
+            // wait for the lttd shutdown
+            Thread.sleep(1000);
+
+            // return to paused state
+            ok = new TCFTask<Boolean>() {
+                @Override
+                public void run() {
+
+                    // Pause the trace
+                    service.pauseTrace(trace.getParent().getParent().getName(), 
+                            trace.getParent().getName(), 
+                            traceConfig.getTraceName(), 
+                            new ILttControllerService.DonePauseTrace() {
+
+                        @Override
+                        public void donePauseTrace(IToken token, Exception error, Object str) {
+                            if (error != null) {
+                                // Notify with error
+                                error(error);
+                                return;
+                            }
+
+                            // Notify about success
+                            done(true);
+                        }
+                    });
+                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+
+            if (!ok) {
+                return;
+            }
+
+            trace.setTraceState(TraceState.PAUSED);
+
+        } else {
+            // wait for the lttd shutdown
+            Thread.sleep(1000);
+        }
+
+        // start a new lttd
+        new TCFTask<Boolean>() {
+            @Override
+            public void run() {
+
+                // Setup trace transport using Lttng controller service proxy
+                service.writeTraceNetwork(trace.getParent().getParent().getName(), 
+                        trace.getParent().getName(), 
+                        traceConfig.getTraceName(), 
+                        traceConfig.getTracePath(), 
+                        traceConfig.getNumChannel(), 
+                        traceConfig.getIsAppend(), 
+                        false, 
+                        true, // write only normal channels 
+                        new ILttControllerService.DoneWriteTraceNetwork() {
+
+                    @Override
+                    public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
+                        if (error != null) {
+                            // Notify with error
+                            error(error);
+                            return;
+                        }
+
+                        // Notify about success
+                        done(true);
+                    }
+                });
+            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/TraceSubSystemConfiguration.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/subsystems/TraceSubSystemConfiguration.java
new file mode 100644 (file)
index 0000000..52f0743
--- /dev/null
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.connectorservice.TraceConnectorServiceManager;
+import org.eclipse.rse.core.filters.ISystemFilter;
+import org.eclipse.rse.core.filters.ISystemFilterPool;
+import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
+
+/**
+ * <b><u>TraceSubSystemConfiguration</u></b>
+ * <p>
+ * Implementation of the subsystem configuration to define the trace subsystem configuration.
+ * </p>
+ */
+public class TraceSubSystemConfiguration extends SubSystemConfiguration {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor for TraceSubSystemConfiguration.
+     */
+    public TraceSubSystemConfiguration() {
+        super();
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(org.eclipse.rse.core.model.IHost)
+     */
+    @Override
+    public ISubSystem createSubSystemInternal(IHost conn) {
+        return new TraceSubSystem(conn, getConnectorService(conn));
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getConnectorService(org.eclipse.rse.core.model.IHost)
+     */
+    @Override
+    public IConnectorService getConnectorService(IHost host) {
+        return TraceConnectorServiceManager.getInstance().getConnectorService(host, ITCFSubSystem.class);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createDefaultFilterPool(org.eclipse.rse.core.filters.ISystemFilterPoolManager)
+     */
+    @Override
+    protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr) {
+        ISystemFilterPool defaultPool = null;
+        try {
+            defaultPool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), false); // true=>is deletable by user
+            defaultPool.setDeletable(false);
+            defaultPool.setNonRenamable(true);
+            List<String> strings = new Vector<String>();
+            strings.add("*"); //$NON-NLS-1$
+            ISystemFilter filter = mgr.createSystemFilter(defaultPool, Messages.AllProviders, strings);
+            filter.setNonChangable(false);
+            filter.setSingleFilterStringOnly(false);
+            filter.setNonDeletable(true);
+            filter.setNonRenamable(true);
+        } catch (Exception exc) {
+        }
+        return defaultPool;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getTranslatedFilterTypeProperty(org.eclipse.rse.core.filters.ISystemFilter)
+     *
+     * Intercept of parent method so we can supply our own value shown in the property sheet for the "type" property when a filter is selected within our subsystem.
+     * 
+     * Requires this line in LTTngServicesResources.properties: property.type.providerfilter=Lttng_Resource_Provider filter
+     */
+    @Override
+    public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter) {
+        return Messages.Property_Type_Provider_Filter;
+    }
+
+    public boolean supportsUserId() {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)
+     */
+    @Override
+    public boolean supportsServerLaunchProperties(IHost host) {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()
+     */
+    @Override
+    public boolean supportsFilters() {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilterChildren()
+     */
+    @Override
+    public boolean supportsFilterChildren() {
+        return true;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/utility/DownloadProxy.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/utility/DownloadProxy.java
new file mode 100644 (file)
index 0000000..c314833
--- /dev/null
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Polytechnique Montréal - Initial API and implementation
+ *   Bernd Hufmann - Productification, enhancements and fixes
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.utility;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.tm.tcf.protocol.JSON;
+
+/**
+ * <b><u>DownloadProxy</u></b>
+ * <p>
+ * Proxy implementation for storing trace data locally on host where client is running. (writeTraceNetwork)
+ * </p>
+ */
+public class DownloadProxy {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    TraceSubSystem fSubSystem;
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     *  
+     * @param subSystem The trace SubSystem
+     */
+    public DownloadProxy(TraceSubSystem subSystem) {
+        fSubSystem = subSystem;
+    }
+    
+ // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    
+    /**
+     * Writes trace data to traces files. 
+     * 
+     * @param data binary data
+     */
+    public void writeDownloadedTrace(byte[] data) {
+        Object[] args = null;
+        try {
+            args = JSON.parseSequence(data);
+        } catch (IOException e) {
+            SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
+        }
+        if (args != null) {
+            byte[] traceData = JSON.toByteArray(args[4]);
+            TraceResource trace = fSubSystem.findTrace(args[0].toString(), args[1].toString(), args[2].toString());
+            if (trace != null) {
+                TraceConfig conf = trace.getTraceConfig();
+                FileOutputStream fos = null;
+                if (conf != null && !TraceConfig.InvalidTracePath.equals(conf.getTracePath())) {
+                    String fileName = conf.getTracePath() + "/" + args[3].toString();  //$NON-NLS-1$
+                    try {
+                        fos = new FileOutputStream(fileName, true);
+                        fos.write(traceData);
+                        fos.close();
+                        // ((TraceResource) args[2]).setSize(sizeFile.length());
+                    } catch (FileNotFoundException e) {
+                        SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
+                    } catch (IOException e) {
+                        SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
+                    }
+                }
+            }
+        }
+    }
+    
+    /**
+     * Method for UST 
+     * 
+     * @param data
+     */
+    public void handleUnwriteTraceDataEvent(byte [] data) {
+        try {
+            Object[] args = null;
+            args = JSON.parseSequence(data);
+            // Check if it is an ust trace
+            TraceResource trace = fSubSystem.findTrace(args[0].toString(), args[1].toString(), args[2].toString());
+            if ((trace != null) && trace.isUst()) {
+                // TODO
+            }
+
+        } catch (IOException e) {
+            SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
+        }
+        
+    }
+    
+    /**
+     * Method that handles trace done event which is sent at the end of the trace session.
+     * 
+     * @param data Binary data
+     */
+    public void handleTraceDoneEvent(byte [] data) {
+        // Nothing to do!
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/ConfigureTraceWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/ConfigureTraceWizard.java
new file mode 100644 (file)
index 0000000..db3dfa2
--- /dev/null
@@ -0,0 +1,182 @@
+/*******************************************************************************\r
+ * Copyright (c) 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Bernd Hufmann - Initial API and implementation\r
+ *   \r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards;\r
+\r
+import java.util.Iterator;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.jface.wizard.Wizard;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;\r
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;\r
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;\r
+import org.eclipse.linuxtools.lttng.ui.Activator;\r
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;\r
+import org.eclipse.rse.ui.SystemBasePlugin;\r
+import org.eclipse.tm.tcf.protocol.IToken;\r
+import org.eclipse.tm.tcf.util.TCFTask;\r
+import org.eclipse.ui.INewWizard;\r
+import org.eclipse.ui.IWorkbench;\r
+\r
+/**\r
+ * <b><u>ConfigureTraceWizard</u></b>\r
+ * <p>\r
+ *  Wizard implementation to configure a trace.\r
+ * </p>\r
+ */\r
+public class ConfigureTraceWizard extends Wizard implements INewWizard {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    ITraceChannelConfigurationPage channelConfigPage;\r
+    TraceConfigurationPage traceConfigPage;\r
+\r
+    private TraceResource fSelectedTrace = null;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    public ConfigureTraceWizard() {\r
+        super();\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.wizard.Wizard#performFinish()\r
+     */\r
+    @Override\r
+    public boolean performFinish() {\r
+        return true;\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.wizard.Wizard#addPages()\r
+     */\r
+    @Override\r
+       public void addPages() {\r
+        traceConfigPage = new TraceConfigurationPage(this);\r
+        addPage(traceConfigPage);\r
+\r
+        if (fSelectedTrace.isUst()) {\r
+            // User space trace\r
+            TraceChannels channels = null;\r
+            if ((fSelectedTrace.getTraceConfig()) != null && fSelectedTrace.getTraceConfig().getTraceChannels() != null) {\r
+                channels = fSelectedTrace.getTraceConfig().getTraceChannels().clone(); \r
+            }\r
+            else {\r
+                channels = new TraceChannels();\r
+                channels.put(TraceChannel.UST_TRACE_CHANNEL_NAME, new TraceChannel(TraceChannel.UST_TRACE_CHANNEL_NAME));\r
+            }\r
+            channelConfigPage = new UstTraceChannelConfigurationPage(channels);\r
+            addPage(channelConfigPage);\r
+        } else {\r
+            // Kernel trace \r
+            TraceChannels channels = null;\r
+            if ((fSelectedTrace.getTraceConfig()) != null && (fSelectedTrace.getTraceConfig().getTraceChannels() != null)) {\r
+                channels = fSelectedTrace.getTraceConfig().getTraceChannels().clone(); \r
+            }\r
+            else {\r
+                String[] channelNames = new String[0];\r
+                try {\r
+                    final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();\r
+                    channelNames = new TCFTask<String[]>() {\r
+                        @Override\r
+                        public void run() {\r
+                            // Get targets using Lttng controller service proxy\r
+                            service.getChannels(fSelectedTrace.getParent().getParent().getName(), fSelectedTrace.getParent().getName(), fSelectedTrace.getName(), new ILttControllerService.DoneGetChannels() {\r
+\r
+                                @Override\r
+                                public void doneGetChannels(IToken token, Exception error, String[] str) {\r
+                                    if (error != null) {\r
+                                        // Notify with error\r
+                                        error(error);\r
+                                        return;\r
+                                    }\r
+                                    // Notify with active trace list\r
+                                    done(str);\r
+                                }\r
+                            });\r
+                        }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);\r
+                } catch (Exception e) {\r
+                    if (e instanceof SystemMessageException) {\r
+                        SystemBasePlugin.logError("Trace Configuration", e); //$NON-NLS-1$;\r
+                    }\r
+                    else {\r
+                        SystemBasePlugin.logError("TraceSubSystem", new SystemMessageException(Activator.getDefault().getMessage(e))); //$NON-NLS-1$\r
+                    }\r
+                }\r
+\r
+                channels = new TraceChannels();\r
+                channels.putAll(channelNames);\r
+            }\r
+\r
+            channelConfigPage = new KernelTraceChannelConfigurationPage(channels, fSelectedTrace.getTraceState());\r
+            addPage(channelConfigPage);\r
+        }\r
+\r
+        getShell().setImage(Activator.getDefault().getImage(Activator.ICON_ID_CONFIG_TRACE));\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)\r
+     */\r
+    @Override\r
+    @SuppressWarnings("unchecked")\r
+       public void init(IWorkbench workbench, IStructuredSelection selection) {\r
+\r
+        fSelectedTrace = null;\r
+\r
+        // store the selected targets to be used when running\r
+        Iterator<IStructuredSelection> theSet = selection.iterator();\r
+        while (theSet.hasNext()) {\r
+            Object obj = theSet.next();\r
+            if (obj instanceof TraceResource) {\r
+                fSelectedTrace = (TraceResource)obj;\r
+                break; // only one is allowed\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Gets the relevant selected trace that will be configured.\r
+     * \r
+     * @return selected trace.\r
+     */\r
+    public TraceResource getSelectedTrace() {\r
+        return fSelectedTrace;\r
+    }\r
+    \r
+    /**\r
+     * Gets the new trace configuration of the trace.\r
+     *  \r
+     * @return trace configuration\r
+     */\r
+    public TraceConfig getTraceConfig() {\r
+        TraceConfig config = traceConfigPage.getTraceConfig();\r
+        config.setTraceChannels(channelConfigPage.getTraceChannels());\r
+        return config;\r
+    }\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/ITraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/ITraceChannelConfigurationPage.java
new file mode 100644 (file)
index 0000000..b7d8395
--- /dev/null
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
+
+public interface ITraceChannelConfigurationPage extends IWizardPage {
+
+    public TraceChannels getTraceChannels();
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java
new file mode 100644 (file)
index 0000000..b815d46
--- /dev/null
@@ -0,0 +1,590 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config.TraceChannelCellModifier;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config.TraceChannelTableContentProvider;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.config.TraceChannelTableLabelProvider;
+import org.eclipse.linuxtools.lttng.ui.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <b><u>KernelTraceChannelConfigurationPage</u></b>
+ * <p>
+ *  Wizard page implementation to configure the kernel trace channels.
+ * </p>
+ */
+public class KernelTraceChannelConfigurationPage extends WizardPage implements ITraceChannelConfigurationPage {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    
+    private TraceChannels fChannels;
+    private TraceState fTraceState;
+    private Composite container;
+    private TableViewer tableViewer;
+    List<String> fColumnNames;
+    
+    Action enableAllAction;
+    Action disableAllAction;
+    Action setOverrideAllAction;
+    Action resetOverideAllAction;
+    Action setNumSubbufAction;
+    Action setSubbufSizeAction;
+    Action setChanTimerAction;
+
+    private ColumnData[] columnDataList = new ColumnData[] {
+            new ColumnData(Messages.ChannelConfigPage_ChannelName, 150, SWT.LEFT, Messages.ChannelConfigPage_ChannelNameTooltip, new ViewerComparator() {
+                    @Override
+                    public int compare(Viewer viewer, Object e1, Object e2) {
+                        TraceChannel chan1 = (TraceChannel) e1;
+                        TraceChannel chan2 = (TraceChannel) e2;
+                        return chan1.getName().compareTo(chan2.getName());
+                    }
+            }),
+            new ColumnData(Messages.ChannelConfigPage_ChannelEnabled, 150, SWT.LEFT, Messages.ChannelConfigPage_ChannelEnabledTooltip, null),
+            new ColumnData(Messages.ChannelConfigPage_ChannelOverride, 150, SWT.LEFT, Messages.ChannelConfigPage_BufferOverrideTooltip, null),
+            new ColumnData(Messages.ChannelConfigPage_NumSubBuf, 175, SWT.LEFT, Messages.ChannelConfigPage_NumSubBufTooltip, null),
+            new ColumnData(Messages.ChannelConfigPage_SubBufSize, 150, SWT.LEFT, Messages.ChannelConfigPage_SubBufSizeTooltip, null),
+            new ColumnData(Messages.ChannelConfigPage_ChannelTimer, 150, SWT.LEFT, Messages.ChannelConfigPage_ChannelTimerTooltip, null)};
+    
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     * 
+     * @param channels The current channels information
+     * @param state The trace state
+     */
+    protected KernelTraceChannelConfigurationPage(TraceChannels channels, TraceState state) {
+        super("TraceChannelConfigurationPage"); //$NON-NLS-1$
+        fChannels = channels;
+        fTraceState = state;
+        setTitle(Messages.ChannelConfigPage_PageTitle);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createControl(Composite parent) {
+        container = new Composite(parent, SWT.NULL);
+        container.setLayout(new GridLayout());
+        setControl(container);
+
+        Composite headerComposite = new Composite(container, SWT.FILL);
+        GridLayout headerLayout = new GridLayout(1, true);
+        headerLayout.marginHeight = 0;
+        headerLayout.marginWidth = 0;
+        headerComposite.setLayout(headerLayout);
+        headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+        
+        tableViewer = new TableViewer(headerComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION );
+        tableViewer.setUseHashlookup(true);
+        
+        Table table = tableViewer.getTable(); 
+        table.setHeaderVisible(true);
+
+        fColumnNames = new ArrayList<String>();
+        for (int i = 0; i < columnDataList.length; i++) {
+
+            final ColumnData columnData = columnDataList[i];
+            fColumnNames.add(columnData.header);
+            final TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
+            tableColumn.setText(columnData.header);
+            tableColumn.setWidth(columnData.width);
+            tableColumn.setAlignment(columnData.alignment);
+            tableColumn.setToolTipText(columnData.tooltip);
+            tableColumn.setMoveable(false);
+            if (columnData.comparator != null) {
+                tableColumn.addSelectionListener(new SelectionAdapter() {
+                    @Override
+                    public void widgetSelected(SelectionEvent e) {
+                        if (tableViewer.getTable().getSortDirection() == SWT.UP || (tableViewer.getTable().getSortColumn() != tableColumn)) {
+                            tableViewer.setComparator(columnData.comparator);
+                            tableViewer.getTable().setSortDirection(SWT.DOWN);
+                        } else {
+                            tableViewer.setComparator(new ViewerComparator() {
+                                @Override
+                                public int compare(Viewer viewer,Object e1, Object e2) {
+                                    return -1 * columnData.comparator.compare(viewer, e1,e2);
+                                }
+                            });
+                            tableViewer.getTable().setSortDirection(SWT.UP);
+                        }
+                        tableViewer.getTable().setSortColumn(tableColumn);
+                    }
+                });
+            }
+        }
+
+        tableViewer.setColumnProperties(fColumnNames.toArray(new String[0]));
+        
+        // Create the cell editors
+        CellEditor[] editors = new CellEditor[columnDataList.length];
+
+        // Column 1 : Completed (Checkbox)
+        TextCellEditor textEditor = new TextCellEditor(table);
+        editors[0] = textEditor;
+
+        // Column 2 : Description (Free text)
+        editors[1] = new CheckboxCellEditor(table);
+
+        // Column 3 : Owner (Combo Box) 
+        editors[2] = new CheckboxCellEditor(table);
+
+        // Column 4 : Percent complete (Text with digits only)
+         textEditor = new TextCellEditor(table);
+        ((Text) textEditor.getControl()).addVerifyListener(
+        
+            new VerifyListener() {
+                
+                @Override
+                public void verifyText(VerifyEvent e) {
+                    e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+                }
+            });
+        editors[3] = textEditor;
+
+        textEditor = new TextCellEditor(table);
+        ((Text) textEditor.getControl()).addVerifyListener(
+        
+            new VerifyListener() {
+                
+                @Override
+                public void verifyText(VerifyEvent e) {
+                    e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+                }
+            });
+        editors[4] = textEditor;
+        
+        textEditor = new TextCellEditor(table);
+        ((Text) textEditor.getControl()).addVerifyListener(
+        
+            new VerifyListener() {
+                
+                @Override
+                public void verifyText(VerifyEvent e) {
+                    e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+                }
+            });
+        editors[5] = textEditor;
+
+        // Assign the cell editors to the viewer 
+        tableViewer.setCellEditors(editors);
+        tableViewer.setCellModifier(new TraceChannelCellModifier(this));
+
+        tableViewer.setContentProvider(new TraceChannelTableContentProvider());
+        tableViewer.setLabelProvider(new TraceChannelTableLabelProvider());
+        
+        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+        makeActions();
+        addContextMenu();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+     */
+    @Override
+    public void dispose() {
+        super.dispose();
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
+     */
+    @Override
+    public void setVisible(boolean visible) {
+        if (visible && (fChannels != null)) {
+            // Get new channels configuration
+            tableViewer.setInput(fChannels);
+            
+            Table table = tableViewer.getTable();
+            TableItem[] items = table.getItems();
+            for (int i = 0; i < items.length; i++) {
+                if ((i % 2) != 0) {
+                    items[i].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
+                }
+                
+                if ((fTraceState != TraceState.CREATED)  && (fTraceState != TraceState.CONFIGURED)) {
+                    items[i].setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
+                }    
+            }
+
+            container.layout();
+        }
+        super.setVisible(visible);
+    }
+
+    /**
+     * Gets the list of column names.
+     * 
+     * @return list of column names
+     */
+    public List<String> getColumnProperties() {
+        return fColumnNames;
+    }
+    
+    /*
+     * Refreshes the table.
+     */
+    public void refresh() {
+        tableViewer.refresh();
+    }
+    
+    /**
+     * Gets the trace state.
+     * 
+     * @return trace state
+     */
+    public TraceState getTraceState() {
+        return fTraceState;
+    }
+    
+    /**
+     * Gets if trace is a local trace (i.e. if trace output is stored on host 
+     * where client is running)
+     * 
+     * @return isLocalTrace
+     */
+    public boolean isLocalTrace() {
+        TraceConfigurationPage configPage = (TraceConfigurationPage) getPreviousPage();
+        return configPage.isLocalTrace();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.rse.ui.wizards.ITraceChannelConfigurationPage#getTraceChannels()
+     */
+    @Override
+    public TraceChannels getTraceChannels() {
+        return fChannels;
+    }
+    
+    /*
+     * Local class to configure table columns
+     */
+    private static final class ColumnData {
+        // Name of the column.
+        public final String header;
+        // Width of the column.
+        public final int width;
+        // Alignment of the column.
+        public final int alignment;
+        // Tooltip of the column.
+        public final String tooltip;
+        // Used to sort elements of this column. Can be null.
+        public final ViewerComparator comparator;
+
+        public ColumnData(String h, int w, int a, String t, ViewerComparator c) {
+            header = h;
+            width = w;
+            alignment = a;
+            tooltip = t;
+            comparator = c;
+        }
+    };
+    
+    /*
+     * Creates actions for context sensitive menu. 
+     */
+    private void makeActions() {
+
+        // Create the context menu actions
+        enableAllAction = new Action(Messages.ChannelConfigPage_EnableAll, Activator.getDefault().getImageDescriptor(Activator.ICON_ID_CHECKED)) {
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                for (int i = 0; i < items.length; i++) {
+                    TraceChannel chan = (TraceChannel)items[i].getData();
+                    chan.setIsEnabled(true);
+                }
+                tableViewer.refresh();
+            }
+        };
+
+        disableAllAction = new Action(Messages.ChannelConfigPage_DisableAll, Activator.getDefault().getImageDescriptor(Activator.ICON_ID_UNCHECKED)) {
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                for (int i = 0; i < items.length; i++) {
+                    TraceChannel chan = (TraceChannel)items[i].getData();
+                    chan.setIsEnabled(false);
+                }
+                tableViewer.refresh();
+            }
+        };
+        setOverrideAllAction = new Action(Messages.ChannelConfigPage_EnableAllBufferOverride, Activator.getDefault().getImageDescriptor(Activator.ICON_ID_CHECKED)) {
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                for (int i = 0; i < items.length; i++) {
+                    TraceChannel chan = (TraceChannel)items[i].getData();
+                    chan.setIsChannelOverride(true);
+                }
+                tableViewer.refresh();
+            }
+        };
+        resetOverideAllAction= new Action(Messages.ChannelConfigage_DisableAllBufferOverride, Activator.getDefault().getImageDescriptor(Activator.ICON_ID_UNCHECKED)) {
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                for (int i = 0; i < items.length; i++) {
+                    TraceChannel chan = (TraceChannel)items[i].getData();
+                    chan.setIsChannelOverride(false);
+                }
+                tableViewer.refresh();
+            }
+        };
+        setNumSubbufAction = new Action(Messages.ChannelConfigPage_SetAllNumSubBuf, Activator.getDefault().getImageDescriptor(Activator.ICON_ID_EDIT)) {
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                SetDialog setDialog = new SetDialog(getShell(), Messages.ChannelConfigPage_NumSubBuf);
+                if (setDialog.open() == Window.OK) {
+
+                    for (int i = 0; i < items.length; i++) {
+                        TraceChannel chan = (TraceChannel)items[i].getData();
+                        chan.setSubbufNum(setDialog.getValue());
+                    }
+
+                    tableViewer.refresh();
+                }
+            }
+        };
+        setSubbufSizeAction = new Action(Messages.channelConfigPage_SetAllSubBufSize, Activator.getDefault().getImageDescriptor(Activator.ICON_ID_EDIT)) {
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                SetDialog setDialog = new SetDialog(getShell(), Messages.ChannelConfigPage_SubBufSize);
+                if (setDialog.open() == Window.OK) {
+
+                    for (int i = 0; i < items.length; i++) {
+                        TraceChannel chan = (TraceChannel)items[i].getData();
+                        chan.setSubbufSize(setDialog.getValue());
+                    }
+
+                    tableViewer.refresh();
+                }
+            }
+        };
+        setChanTimerAction = new Action(Messages.ChannelConfigPage_SetAllChannelTimer, Activator.getDefault().getImageDescriptor("ICON_ID_EDIT")) { //$NON-NLS-1$
+            @Override
+            public void run() {
+                TableItem[] items = tableViewer.getTable().getItems();
+                SetDialog setDialog = new SetDialog(getShell(), Messages.ChannelConfigPage_ChannelTimer);
+                if (setDialog.open() == Window.OK) {
+
+                    for (int i = 0; i < items.length; i++) {
+                        TraceChannel chan = (TraceChannel)items[i].getData();
+                        chan.setTimer(setDialog.getValue());
+                    }
+
+                    tableViewer.refresh();
+                }
+            }
+        };
+    }
+
+    /*
+     * Adds context sensitive menu to table.
+     */
+    private void addContextMenu() {
+        MenuManager manager = new MenuManager("configChanPopupMenu"); //$NON-NLS-1$
+        manager.setRemoveAllWhenShown(true);
+        manager.addMenuListener(new IMenuListener() {
+            
+            @Override
+            public void menuAboutToShow(IMenuManager manager) {
+                
+                if ((fTraceState != TraceState.CREATED)  && (fTraceState != TraceState.CONFIGURED)) {
+                    return;
+                }
+                manager.add(enableAllAction);
+                manager.add(disableAllAction);
+                manager.add(setOverrideAllAction);
+                manager.add(resetOverideAllAction);
+                manager.add(setNumSubbufAction);
+                manager.add(setSubbufSizeAction);
+                manager.add(setChanTimerAction);
+            }
+        });
+        
+        Menu menu = manager.createContextMenu(tableViewer.getControl());
+        tableViewer.getControl().setMenu(menu);
+    }
+    
+    /**
+     * Local class dialog box implementation for setting values for all
+     * rows for a given column  
+     */
+    private static final class SetDialog extends Dialog {
+
+        // ------------------------------------------------------------------------
+        // Attributes
+        // ------------------------------------------------------------------------
+
+        private String fWhat = null;
+        private Text fValueText = null;
+        private Long fValue = null;
+
+        // ------------------------------------------------------------------------
+        // Constructors
+        // ------------------------------------------------------------------------
+
+        public SetDialog(Shell parentShell, String what) {
+            super(parentShell);
+            fWhat = what;
+        }
+
+        // ------------------------------------------------------------------------
+        // Operations
+        // ------------------------------------------------------------------------
+
+        /*
+         * (non-Javadoc)
+         * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+         */
+        @Override
+        protected void configureShell(Shell newShell) {
+            super.configureShell(newShell);
+            newShell.setText(Messages.ChannelConfigPage_SetAll);    
+            newShell.setImage(Activator.getDefault().getImage(Activator.ICON_ID_EDIT));
+        }
+
+        /*
+         * (non-Javadoc)
+         * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+         */
+        @Override
+        protected Control createDialogArea(Composite parent) {
+            //Main dialog panel
+            Composite composite = new Composite(parent, SWT.RESIZE);
+            GridLayout mainLayout = new GridLayout(3, true);
+            composite.setLayout(mainLayout);
+            Label what = new Label(composite, SWT.LEFT);
+            what.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
+            what.setText(fWhat);
+            
+            fValueText = new Text(composite, SWT.LEFT);
+            fValueText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
+            
+            fValueText.addVerifyListener(
+                    new VerifyListener() {
+                        
+                        @Override
+                        public void verifyText(VerifyEvent e) {
+                            e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+                        }
+                    });
+            
+            fValueText.addListener(SWT.Modify, new Listener() {
+                @Override
+                public void handleEvent(Event event) {
+                    Button ok = getButton(IDialogConstants.OK_ID);
+                    ok.setEnabled(validateInput(fValueText.getText()));
+                }
+            });
+            
+            return composite;
+        }
+        
+        /*
+         * (non-Javadoc)
+         * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+         */
+        @Override
+        protected void createButtonsForButtonBar(Composite parent) {
+            Button ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+            createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+            
+            ok.setEnabled(false);
+        }
+
+        /*
+         * (non-Javadoc)
+         * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+         */
+        @Override
+        protected void okPressed() {
+            fValue = Long.valueOf(fValueText.getText());
+            super.okPressed();
+        }
+
+        /*
+         * Method to validate input.
+         */
+        private boolean validateInput(String path) {
+            return (path.trim().length() > 0);
+        }
+
+        /**
+         * Gets value that the user input. 
+         * 
+         * @return value
+         */
+        public Long getValue() {
+            return fValue;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/TraceConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/TraceConfigurationPage.java
new file mode 100644 (file)
index 0000000..f850980
--- /dev/null
@@ -0,0 +1,572 @@
+/*******************************************************************************\r
+ * Copyright (c) 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Bernd Hufmann - Initial API and implementation\r
+ *   \r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards;\r
+\r
+import java.io.File;\r
+\r
+import org.eclipse.jface.wizard.WizardPage;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;\r
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;\r
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;\r
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.TraceControlConstants;\r
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.subsystems.TraceSubSystem;\r
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;\r
+import org.eclipse.rse.ui.SystemBasePlugin;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.VerifyEvent;\r
+import org.eclipse.swt.events.VerifyListener;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.DirectoryDialog;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Group;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.Listener;\r
+import org.eclipse.swt.widgets.Text;\r
+\r
+/**\r
+ * <b><u>UstTraceChannelConfigurationPage</u></b>\r
+ * <p>\r
+ *  Wizard page implementation to configure a trace (Kernel and UST).\r
+ * </p>\r
+ */\r
+public class TraceConfigurationPage extends WizardPage {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+    private ConfigureTraceWizard fWizard;\r
+    private String fTraceName;\r
+    private String fTraceTransport;\r
+    private String fTracePath;\r
+    private int fMode;\r
+    private int fNumChannel;\r
+    private boolean fIsAppend;\r
+    private boolean fIsNetwork;\r
+    private Text fNameText;\r
+    private Text fTransportText;\r
+    private Text fPathText;\r
+    private Text fNumLttdThreadsText;\r
+    private Button fHostButton;\r
+    private Button fTargetButton;\r
+    private Button fIsAppendButton;\r
+    private Button fFlightRecorderButton;\r
+    private Button fNormalButton;\r
+    private Display fDisplay;\r
+    private String fTraceNameError;\r
+    private String fTracePathError;\r
+    private Button fBrowseButton;\r
+    \r
+    private TraceResource fTraceResource;\r
+    private TraceConfig   fOldTraceConfig;\r
+    private TraceSubSystem fSubSystem;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructore\r
+     * \r
+     * @param wizard\r
+     */\r
+    public TraceConfigurationPage(ConfigureTraceWizard wizard) {\r
+        super("TraceConfigurationPage"); //$NON-NLS-1$\r
+        setTitle(Messages.ConfigureTraceDialog_Title);\r
+//        setDescription("set description..."); \r
+        this.fWizard = wizard;\r
+        setPageComplete(false);\r
+        fTraceNameError = ""; //$NON-NLS-1$\r
+        fTracePathError = ""; //$NON-NLS-1$\r
+        fTraceResource = this.fWizard.getSelectedTrace();\r
+        fOldTraceConfig = fTraceResource.getTraceConfig();\r
+        fSubSystem = (TraceSubSystem)this.fWizard.getSelectedTrace().getSubSystem();\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+       public void createControl(Composite parent) {\r
+        GridData griddata = new GridData();\r
+\r
+        griddata = new GridData();\r
+        Composite composite1 = new Composite(parent, SWT.NONE);\r
+        GridLayout compositeLayout1 = new GridLayout(4, false);\r
+        composite1.setSize(520, 300);\r
+        composite1.setLayout(compositeLayout1);\r
+        griddata.horizontalSpan = 3;\r
+        griddata.widthHint = 520;\r
+        griddata.minimumWidth = 520;\r
+        composite1.setLayoutData(griddata);\r
+        fDisplay = this.getShell().getDisplay();\r
+        setControl(composite1);\r
+        Label nameLabel = new Label(composite1, SWT.NULL);\r
+        nameLabel.setText(Messages.NewTraceDialog_TraceName + ":"); //$NON-NLS-1$\r
+        griddata = new GridData();\r
+        griddata.verticalIndent = 20;\r
+        nameLabel.setLayoutData(griddata);\r
+\r
+        fNameText = new Text(composite1, SWT.SINGLE | SWT.BORDER);\r
+        if (fTraceResource.isUst()) {\r
+            fNameText.setText(TraceControlConstants.Lttng_Ust_TraceName);\r
+            fNameText.setEnabled(false);\r
+        }\r
+\r
+        griddata = new GridData();\r
+        griddata.horizontalAlignment = SWT.FILL;\r
+        griddata.grabExcessHorizontalSpace = true;\r
+        griddata.verticalIndent = 20;\r
+        griddata.horizontalSpan = 3;\r
+        fNameText.setLayoutData(griddata);\r
+        fNameText.setText(fTraceResource.getName());\r
+        fNameText.setEnabled(false);\r
+\r
+        Label transportLabel = new Label(composite1, SWT.NULL);\r
+        transportLabel.setText(Messages.ConfigureTraceDialog_Trace_Transport + ":"); //$NON-NLS-1$\r
+        griddata = new GridData();\r
+        transportLabel.setLayoutData(griddata);\r
+\r
+        fTransportText = new Text(composite1, SWT.SINGLE | SWT.BORDER);\r
+        griddata = new GridData();\r
+        griddata.horizontalAlignment = SWT.FILL;\r
+        griddata.grabExcessHorizontalSpace = true;\r
+        griddata.horizontalSpan = 3;\r
+        fTransportText.setLayoutData(griddata);\r
+        fTransportText.setText(TraceControlConstants.Lttng_Trace_Transport_Relay);\r
+        fTransportText.setEnabled(false); // relay is the only allowed value\r
+        if (fOldTraceConfig != null) {\r
+            fTransportText.setText(fOldTraceConfig.getTraceTransport());\r
+        }\r
+\r
+        griddata = new GridData();\r
+        Group composite21 = new Group(composite1, SWT.SHADOW_OUT);\r
+        composite21.setSize(300, 300);\r
+        composite21.setText(Messages.ConfigureTraceDialog_Trace_Location);\r
+        griddata.horizontalAlignment = SWT.FILL;\r
+        griddata.horizontalSpan = 4;\r
+        griddata.verticalIndent = 10;\r
+        griddata.widthHint = 300;\r
+        griddata.minimumWidth = 300;\r
+        composite21.setLayoutData(griddata);\r
+        GridLayout compositeLayout21 = new GridLayout(4, false);\r
+        composite21.setLayout(compositeLayout21);\r
+        fTargetButton = new Button(composite21, SWT.RADIO);\r
+        fTargetButton.setText(Messages.ConfigureTraceDialog_Target);\r
+        fTargetButton.setSelection(true);\r
+        fIsNetwork = false;\r
+        fHostButton = new Button(composite21, SWT.RADIO);\r
+        fHostButton.setText(Messages.ConfigureTraceDialog_Host);\r
+        griddata = new GridData();\r
+        griddata.horizontalSpan = 3;\r
+        fHostButton.setLayoutData(griddata);\r
+        fHostButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event e) {\r
+                if (fHostButton.getSelection()) {\r
+                    fBrowseButton.setEnabled(true);\r
+                } else {\r
+                    fBrowseButton.setEnabled(false);\r
+                }\r
+                fIsNetwork = fHostButton.getSelection();\r
+                validatePathName(fPathText.getText());\r
+                validate();\r
+            }\r
+        });\r
+        \r
+        Label pathLabel = new Label(composite21, SWT.NULL);\r
+        pathLabel.setText(Messages.ConfigureTraceDialog_Trace_Path);\r
+        griddata = new GridData();\r
+        griddata.verticalIndent = 10;\r
+        pathLabel.setLayoutData(griddata);\r
+\r
+        fPathText = new Text(composite21, SWT.SINGLE | SWT.BORDER);\r
+        griddata = new GridData();\r
+        griddata.horizontalAlignment = SWT.FILL;\r
+        griddata.grabExcessHorizontalSpace = true;\r
+        griddata.verticalIndent = 10;\r
+        fPathText.setLayoutData(griddata);\r
+        fPathText.setData(""); //$NON-NLS-1$\r
+\r
+        fBrowseButton = new Button(composite21, SWT.PUSH);\r
+        fBrowseButton.setText(Messages.ConfigureTraceDialog_Browse + "...");  //$NON-NLS-1$\r
+        griddata = new GridData();\r
+        griddata.grabExcessHorizontalSpace = false;\r
+        griddata.widthHint = 100;\r
+        griddata.verticalIndent = 10;\r
+        fBrowseButton.setLayoutData(griddata);\r
+        fBrowseButton.setEnabled(false);\r
+        fBrowseButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                DirectoryDialog dialog = new DirectoryDialog(fDisplay.getActiveShell());\r
+                String newPath = dialog.open();\r
+                if (newPath != null) {\r
+                    fPathText.setText(newPath);\r
+                }\r
+            }\r
+        });\r
+\r
+        fNameText.addListener(SWT.Modify, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                validateTraceName(fNameText.getText());\r
+                validate();\r
+            }\r
+        });\r
+\r
+        fTransportText.addListener(SWT.Modify, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                validate();\r
+            }\r
+        });\r
+\r
+        fPathText.addListener(SWT.Modify, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                if (!fPathText.isEnabled()) {\r
+                    return;\r
+                }\r
+                validatePathName(fPathText.getText());\r
+                validate();\r
+            }\r
+        });\r
+\r
+        griddata = new GridData();\r
+        Composite composite2 = new Composite(composite1, SWT.NONE);\r
+        GridLayout compositeLayout2 = new GridLayout(2, false);\r
+        composite2.setLayout(compositeLayout2);\r
+        griddata.horizontalSpan = 4;\r
+        griddata.widthHint = 500;\r
+        griddata.minimumWidth = 500;\r
+        composite2.setLayoutData(griddata);\r
+\r
+        Label numLttdThreadsLabel = new Label(composite2, SWT.NULL);\r
+        numLttdThreadsLabel.setText(Messages.ConfigureTraceDialog_Num_Lttd_Threads + ":"); //$NON-NLS-1$);\r
+        griddata = new GridData();\r
+        griddata.verticalIndent = 10;\r
+        numLttdThreadsLabel.setLayoutData(griddata);\r
+\r
+        fNumLttdThreadsText = new Text(composite2, SWT.SINGLE | SWT.BORDER);\r
+        griddata = new GridData();\r
+        griddata.horizontalAlignment = SWT.BEGINNING;\r
+        griddata.verticalIndent = 10;\r
+        griddata.widthHint = 50;\r
+        griddata.minimumWidth = 50;\r
+        fNumLttdThreadsText.setLayoutData(griddata);\r
+        if (fTraceResource.isUst()) {\r
+            fNumLttdThreadsText.setText("1"); //$NON-NLS-1$\r
+            fNumLttdThreadsText.setEnabled(false);\r
+        } else {\r
+            fNumLttdThreadsText.setText("2"); //$NON-NLS-1$\r
+        }\r
+\r
+        fNumLttdThreadsText.addVerifyListener(new VerifyListener() {\r
+            @Override\r
+            public void verifyText(VerifyEvent e) {\r
+                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$\r
+            }\r
+        });\r
+\r
+        fNumLttdThreadsText.addListener(SWT.Modify, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                validate();\r
+            }\r
+        });\r
+\r
+        fIsAppendButton = new Button(composite1, SWT.CHECK);\r
+        fIsAppendButton.setText(Messages.ConfigureTraceDialog_Append);\r
+        griddata = new GridData();\r
+        griddata.horizontalAlignment = SWT.BEGINNING;\r
+        griddata.horizontalSpan = 4;\r
+        griddata.verticalIndent = 10;\r
+        fIsAppendButton.setLayoutData(griddata);\r
+        fIsAppend = false;\r
+        fIsAppendButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event e) {\r
+                fIsAppend = fIsAppendButton.getSelection();\r
+            }\r
+        });\r
+        if (fTraceResource.isUst()) {\r
+            fIsAppendButton.setEnabled(false);\r
+        }\r
+\r
+        griddata = new GridData();\r
+        Group composite22 = new Group(composite1, SWT.SHADOW_OUT);\r
+        composite22.setText(Messages.ConfigureTraceDialog_Trace_Mode);\r
+        griddata.horizontalSpan = 4;\r
+        griddata.verticalIndent = 10;\r
+        composite22.setLayoutData(griddata);\r
+        GridLayout compositeLayout22 = new GridLayout(2, false);\r
+        composite22.setLayout(compositeLayout22);\r
+        fNormalButton = new Button(composite22, SWT.RADIO);\r
+        fNormalButton.setText(Messages.ConfigureTraceDialog_Mode_Normal);\r
+        fFlightRecorderButton = new Button(composite22, SWT.RADIO);\r
+        fFlightRecorderButton.setText(Messages.ConfigureTraceDialog_Mode_Flight_Recorder);\r
+        fMode = TraceConfig.NORMAL_MODE;\r
+        fNormalButton.setSelection(true);\r
+        fNormalButton.addListener(SWT.Selection, new Listener() {\r
+               @Override\r
+               public void handleEvent(Event e) {\r
+                       if (fNormalButton.getSelection()) {\r
+                               fMode = TraceConfig.NORMAL_MODE;\r
+                       }\r
+               }\r
+        });\r
+        fFlightRecorderButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event e) {\r
+                if (fFlightRecorderButton.getSelection()) {\r
+                    fMode = TraceConfig.FLIGHT_RECORDER_MODE;\r
+                }\r
+            }\r
+        });\r
+        if (fTraceResource.isUst()) {\r
+            fFlightRecorderButton.setEnabled(false);\r
+            fNormalButton.setEnabled(false);\r
+        }\r
+\r
+        if(fOldTraceConfig != null) {\r
+            fPathText.setText(fOldTraceConfig.getTracePath());\r
+            fTargetButton.setSelection(!fOldTraceConfig.isNetworkTrace());\r
+            fHostButton.setSelection(fOldTraceConfig.isNetworkTrace());\r
+            fIsNetwork = fOldTraceConfig.isNetworkTrace();\r
+            fBrowseButton.setEnabled(true);\r
+            fNumLttdThreadsText.setText(String.valueOf(fOldTraceConfig.getNumChannel()));\r
+            fIsAppendButton.setSelection(fOldTraceConfig.getIsAppend());\r
+            fIsAppend = fOldTraceConfig.getIsAppend();\r
+            fFlightRecorderButton.setSelection(fOldTraceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE);\r
+            fNormalButton.setSelection(fOldTraceConfig.getMode() == TraceConfig.NORMAL_MODE);\r
+        }\r
+\r
+        // Depending on the state disable fields, it's only informational then\r
+        if ((fTraceResource.getTraceState() == TraceState.STARTED) || (fTraceResource.getTraceState() == TraceState.PAUSED)) {\r
+            fPathText.setEnabled(false);\r
+            fBrowseButton.setEnabled(false);\r
+            fTargetButton.setEnabled(false);\r
+            fHostButton.setEnabled(false);\r
+            fIsAppendButton.setEnabled(false);\r
+            fNumLttdThreadsText.setEnabled(false);\r
+            fFlightRecorderButton.setEnabled(false);\r
+            fNormalButton.setEnabled(false);\r
+        }\r
+\r
+        validate();\r
+\r
+        fDisplay.getActiveShell().addListener(SWT.Traverse, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                if (event.detail == SWT.TRAVERSE_ESCAPE) {\r
+                    event.doit = false;\r
+                }\r
+            }\r
+        });\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.dialogs.DialogPage#dispose()\r
+     */\r
+    @Override\r
+    public void dispose() {\r
+        super.dispose();\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)\r
+     */\r
+    @Override\r
+    public void setVisible(boolean visible) {\r
+        if (visible) {\r
+            validate();\r
+        }\r
+        super.setVisible(visible);\r
+    }\r
+    \r
+    /*\r
+     * Validates the trace name which has to be unique.\r
+     */\r
+    protected boolean validateTraceName(String name) {\r
+        if (name.length() > 0) {\r
+            TraceResource[] traces = new TraceResource[0];\r
+            try {\r
+                traces = fSubSystem.getAllTraces();\r
+            } catch (SystemMessageException e) {\r
+                SystemBasePlugin.logError("TraceConfigurationPage ", e); //$NON-NLS-1$\r
+            }\r
+            for (int i = 0; i < traces.length; i++) {\r
+                if (traces[i].getName().compareTo(name) == 0) {\r
+                    fTraceNameError = Messages.NewTraceDialog_Error_Already_Exists;\r
+                    setErrorMessage(fTraceNameError);\r
+                    return false;\r
+                }\r
+            }\r
+            final char[] chars = name.toCharArray();\r
+            for (int x = 0; x < chars.length; x++) {\r
+                final char c = chars[x];\r
+                if ((x == 0) && !(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) {\r
+                    fTraceNameError = Messages.NewTraceDialog_Error_Invalid_First_Char;\r
+                    setErrorMessage(fTraceNameError);\r
+                    return false;\r
+                } else if (x != 0) {\r
+                    if (!((c >= 'a') && (c <= 'z')) && !((c >= 'A') && (c <= 'Z')) && !((c >= '0') && (c <= '9'))) {\r
+                        fTraceNameError = Messages.NewTraceDialog_Error_Invalid_Name;\r
+                        setErrorMessage(fTraceNameError);\r
+                        return false;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        if (fTracePathError.length() > 0) {\r
+            setErrorMessage(fTracePathError);\r
+        } else {\r
+            setErrorMessage(null);\r
+        }\r
+        fTraceNameError = ""; //$NON-NLS-1$\r
+        return true;\r
+    }\r
+\r
+    /*\r
+     * Validates the trace path.\r
+     */\r
+    private boolean validatePathName(String path) {\r
+        if (path.length() > 0) {\r
+            final char c0 = path.charAt(0);\r
+            if (c0 != '/') {\r
+                fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Path;\r
+                setErrorMessage(fTracePathError);\r
+                return false;\r
+            } else {\r
+                String[] folders = path.split("/"); //$NON-NLS-1$\r
+                for (int i = 0; i < folders.length; i++) {\r
+                    final char[] chars = folders[i].toCharArray();\r
+                    for (int x = 0; x < chars.length; x++) {\r
+                        final char c = chars[x];\r
+                        if ((c >= 'a') && (c <= 'z')) {\r
+                            continue; // lowercase\r
+                        }\r
+                        if ((c >= 'A') && (c <= 'Z')) {\r
+                            continue; // uppercase\r
+                        }\r
+                        if ((c >= '0') && (c <= '9')) {\r
+                            continue; // numeric\r
+                        }\r
+                        fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Folder;\r
+                        setErrorMessage(fTracePathError);\r
+                        return false;\r
+                    }\r
+                }\r
+                if (path.length() > 1) {\r
+                    for (int i = 0; i < path.length() - 1; i++) {\r
+                        if ((path.charAt(i) == '/') && (path.charAt(i + 1) == '/')) {\r
+                            fTracePathError = Messages.ConfigureTraceDialog_Error_Multiple_Seps;\r
+                            setErrorMessage(fTracePathError);\r
+                            return false;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+            if (fHostButton.getSelection()) {\r
+                File file = new File(path);\r
+                if (file.isFile()) {\r
+                    fTracePathError = Messages.ConfigureTraceDialog_Error_File_Exists;\r
+                    setErrorMessage(fTracePathError);\r
+                    return false;\r
+                }\r
+                if (path.length() > 1 && !file.getParentFile().canWrite()) {\r
+                    fTracePathError = Messages.ConfigureTraceDialog_Error_Can_Not_Write;\r
+                    setErrorMessage(fTracePathError);\r
+                    return false;\r
+                }\r
+            }\r
+        }\r
+        if (fTraceNameError.length() > 0) {\r
+            setErrorMessage(fTraceNameError);\r
+        } else {\r
+            setErrorMessage(null);\r
+        }\r
+        fTracePathError = ""; //$NON-NLS-1$\r
+        return true;\r
+    }\r
+    \r
+    /*\r
+     * Validates all input values.\r
+     */\r
+    private void validate() {\r
+        if ((fNameText.getText() == null) || (fTransportText.getText() == null) || (fTransportText.getText().length() == 0) || (fNameText.getText().length() == 0)\r
+                || (fNumLttdThreadsText.getText().length() == 0) || (fNumLttdThreadsText.getText().length() == 0)) {\r
+            setPageComplete(false);\r
+            return;\r
+        }\r
+        if (fPathText.getText().length() == 0) {\r
+            setPageComplete(false);\r
+            return;\r
+        }\r
+        if ((fTracePathError.length() > 0) || (fTraceNameError.length() > 0)) {\r
+            setPageComplete(false);\r
+            return;\r
+        }\r
+        fTraceName = fNameText.getText();\r
+        fTraceTransport = fTransportText.getText();\r
+        fTracePath = fPathText.getText();\r
+        fNumChannel = Integer.parseInt(fNumLttdThreadsText.getText());\r
+        \r
+        if (fTraceNameError.length() == 0) {\r
+            setErrorMessage(null);\r
+            setPageComplete(true);\r
+       } else {\r
+            setErrorMessage(fTraceNameError);\r
+            setPageComplete(false);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Gets the trace configuration. \r
+     * \r
+     * @return trace configuration\r
+     */\r
+    public TraceConfig getTraceConfig() {\r
+        TraceConfig newTraceConfig = new TraceConfig();\r
+        newTraceConfig.setTraceName(fTraceName);\r
+        newTraceConfig.setTraceTransport(fTraceTransport);\r
+        newTraceConfig.setTracePath(fTracePath);\r
+        newTraceConfig.setNetworkTrace(fIsNetwork);\r
+        newTraceConfig.setIsAppend(fIsAppend);\r
+        newTraceConfig.setMode(fMode);\r
+        newTraceConfig.setNumChannel(fNumChannel);\r
+\r
+        return newTraceConfig;\r
+    }\r
+\r
+    /**\r
+     * Gets if trace is a local trace (i.e. if trace output is stored on host \r
+     * where client is running)\r
+     * \r
+     * @return isLocalTrace\r
+     */\r
+    public boolean isLocalTrace() {\r
+        return fHostButton.getSelection();\r
+    }\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/UstTraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/tracecontrol/wizards/UstTraceChannelConfigurationPage.java
new file mode 100644 (file)
index 0000000..e13315c
--- /dev/null
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *   
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <b><u>UstTraceChannelConfigurationPage</u></b>
+ * <p>
+ *  Wizard page implementation to configure the UST trace channels.
+ * </p>
+ */
+public class UstTraceChannelConfigurationPage extends WizardPage implements ITraceChannelConfigurationPage {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private TraceChannels fChannels;
+    private Composite fContainer;
+    private Text fChannelTimerText;
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     * 
+     * @param channels
+     */
+    protected UstTraceChannelConfigurationPage(TraceChannels channels) {
+        super("UstTraceChannelConfigurationPage"); //$NON-NLS-1$
+        fChannels = channels;
+        setTitle(Messages.ChannelConfigPage_PageTitle);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createControl(Composite parent) {
+        fContainer = new Composite(parent, SWT.NULL);
+        fContainer.setLayout(new GridLayout());
+        setControl(fContainer);
+
+        Composite headerComposite = new Composite(fContainer, SWT.FILL);
+        GridLayout headerLayout = new GridLayout(4, true);
+        headerLayout.marginHeight = 0;
+        headerLayout.marginWidth = 0;
+        headerComposite.setLayout(headerLayout);
+        headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+        
+        Label label = new Label(headerComposite, SWT.LEFT);
+        label.setText(Messages.ChannelConfigPage_ChannelTimer + ":"); //$NON-NLS-1$
+        label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+        
+        fChannelTimerText = new Text(headerComposite, SWT.LEFT);
+        fChannelTimerText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
+        fChannelTimerText.setToolTipText(Messages.ChannelConfigPage_ChannelTimerTooltip);
+        
+        TraceChannel chan = fChannels.get(TraceChannel.UST_TRACE_CHANNEL_NAME);
+        if (chan.getTimer() == TraceChannel.UNKNOWN_VALUE) {
+            fChannelTimerText.setText(TraceChannel.UNKNOWN_STRING);    
+        }
+        else { 
+            fChannelTimerText.setText(String.valueOf(chan.getTimer()));
+        }
+        
+        fChannelTimerText.addVerifyListener(new VerifyListener() {
+            @Override
+            public void verifyText(VerifyEvent e) {
+                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+            }
+        });
+        
+        fChannelTimerText.addListener(SWT.Modify, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                String valueString = fChannelTimerText.getText();
+                TraceChannel chan = fChannels.get(TraceChannel.UST_TRACE_CHANNEL_NAME);
+                if (valueString.length() == 0) {
+                    valueString = "0"; //$NON-NLS-1$
+                }
+                else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
+                    chan.setTimer(TraceChannel.UNKNOWN_VALUE);
+                }
+                else {
+                    chan.setTimer(Integer.parseInt(valueString));
+                }
+            }
+        });
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+     */
+    @Override
+    public void dispose() {
+        super.dispose();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.rse.ui.wizards.ITraceChannelConfigurationPage#getTraceChannels()
+     */
+    @Override
+    public TraceChannels getTraceChannels() {
+        return fChannels;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/PerspectiveFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/PerspectiveFactory.java
new file mode 100644 (file)
index 0000000..53ac450
--- /dev/null
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views;
+
+import org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.ControlFlowView;
+import org.eclipse.linuxtools.internal.lttng.ui.views.resources.ResourcesView;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.StatisticsView;
+import org.eclipse.linuxtools.tmf.ui.views.events.TmfEventsView;
+import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/**
+ * <b><u>PerspectiveFactory</u></b>
+ * <p>
+ * The default LTTng perspective.
+ */
+public class PerspectiveFactory implements IPerspectiveFactory {
+
+    // Perspective ID
+    public static final String ID = "org.eclipse.linuxtools.lttng.ui.perspective"; //$NON-NLS-1$
+
+    // LTTng views
+    private static final String EVENTS_VIEW_ID = TmfEventsView.ID;
+    private static final String CONTROL_FLOW_VIEW_ID = ControlFlowView.ID;
+    private static final String RESOURCES_VIEW_ID = ResourcesView.ID;
+    private static final String STATISTICS_VIEW_ID = StatisticsView.ID;
+    private static final String HISTOGRAM_VIEW_ID = HistogramView.ID;
+
+    // Standard Eclipse views
+    private static final String PROJECT_VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER;
+    private static final String PROPERTIES_VIEW_ID = IPageLayout.ID_PROP_SHEET;
+    private static final String BOOKMARKS_VIEW_ID = IPageLayout.ID_BOOKMARKS;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
+     */
+    @Override
+    public void createInitialLayout(IPageLayout layout) {
+
+        layout.setEditorAreaVisible(false);
+
+        addFastViews(layout);
+        addViewShortcuts(layout);
+        addPerspectiveShortcuts(layout);
+
+        // Create the top left folder
+        IFolderLayout topLeftFolder = layout.createFolder(
+                "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
+        topLeftFolder.addView(PROJECT_VIEW_ID);
+
+        // Create the top right folder
+        IFolderLayout topRightFolder = layout.createFolder(
+                "topRightFolder", IPageLayout.TOP, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
+        topRightFolder.addView(CONTROL_FLOW_VIEW_ID);
+        topRightFolder.addView(RESOURCES_VIEW_ID);
+        topRightFolder.addView(STATISTICS_VIEW_ID);
+
+        // Create the middle right folder
+        IFolderLayout middleRightFolder = layout.createFolder(
+                "middleRightFolder", IPageLayout.BOTTOM, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ 
+        middleRightFolder.addView(EVENTS_VIEW_ID);
+
+        // Create the bottom right folder
+        IFolderLayout bottomRightFolder = layout.createFolder(
+                "bottomRightFolder", IPageLayout.BOTTOM, 0.50f, "middleRightFolder"); //$NON-NLS-1$ //$NON-NLS-2$
+        bottomRightFolder.addView(HISTOGRAM_VIEW_ID);
+        bottomRightFolder.addView(PROPERTIES_VIEW_ID);
+        bottomRightFolder.addView(BOOKMARKS_VIEW_ID);
+    }
+
+    /**
+     * Add fast views to the perspective
+     * 
+     * @param layout
+     */
+    private void addFastViews(IPageLayout layout) {
+        // TODO Auto-generated method stub
+    }
+
+    /**
+     * Add view shortcuts to the perspective
+     * 
+     * @param layout
+     */
+    private void addViewShortcuts(IPageLayout layout) {
+        // TODO Auto-generated method stub
+    }
+
+    /**
+     * Add perspective shortcuts to the perspective
+     * 
+     * @param layout
+     */
+    private void addPerspectiveShortcuts(IPageLayout layout) {
+        // TODO Auto-generated method stub
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/AbsTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/AbsTRangeUpdate.java
new file mode 100644 (file)
index 0000000..8427a68
--- /dev/null
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors: Alvaro Sanchez-Leon - Initial implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.common;
+
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.state.AbsStateProcessing;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+
+public abstract class AbsTRangeUpdate extends AbsStateProcessing implements
+               ILttngEventProcessor {
+
+    private static final long MINORBITS = 20;
+    
+       // ========================================================================
+       // General methods
+       // =======================================================================
+    
+    /**
+     * Get the mkdev node id<br>
+     * <br>
+     * This is an implementation of a KERNEL macro used in Lttv
+     * 
+     */
+    public long getMkdevId(long major, long minor) {
+        return (((major) << MINORBITS) | (minor));
+    }
+
+       /**
+        * Get the pixels per Nano second, either from active widgets or initialise
+        * with the experiment time range values
+        * 
+        * @param traceSt
+        * @param params
+        * 
+        * @return double
+        */
+    protected double getPixelsPerNs(LttngTraceState traceSt, ParamsUpdater params) {
+        double pixPerNs = params.getPixelsPerNs();
+        if (pixPerNs == 0.0) {
+            TmfTimeRange tsetRange = traceSt.getContext().getExperimentTimeWindow();
+            
+            long startTime = tsetRange.getStartTime().getValue();
+            long endTime = tsetRange.getEndTime().getValue();
+            long delta = endTime - startTime;
+            
+            if (delta > 0) {
+                pixPerNs = (double) params.getWidth() / (double) delta;
+                params.setPixelsPerNs(pixPerNs);
+            }
+        }
+        return pixPerNs;
+       }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/AbsTimeUpdateView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/AbsTimeUpdateView.java
new file mode 100644 (file)
index 0000000..45d2784
--- /dev/null
@@ -0,0 +1,823 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *   Bernd Hufmann - Bug fixes
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.common;
+
+import java.util.Arrays;
+
+import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
+import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
+import org.eclipse.linuxtools.internal.lttng.core.control.LttngSyntheticEventProvider;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngSyntheticEvent;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
+import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
+import org.eclipse.linuxtools.internal.lttng.core.request.IRequestStatusListener;
+import org.eclipse.linuxtools.internal.lttng.core.request.LttngSyntEventRequest;
+import org.eclipse.linuxtools.internal.lttng.core.request.RequestCompletedSignal;
+import org.eclipse.linuxtools.internal.lttng.core.request.RequestStartedSignal;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ITransEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.ItemContainer;
+import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+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.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITimeAnalysisViewer;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+import org.eclipse.linuxtools.tmf.ui.views.TmfView;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * <p>
+ * Abstract class used as a base for views handling specific time range data
+ * requests
+ * </p>
+ * <p>
+ * The class handles a single element queue of data requests, i.e. request can
+ * be triggered from different sources e.g. opening a file as well as a new
+ * selected time window
+ * </p>
+ * 
+ * @author alvaro
+ * 
+ */
+public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatusListener {
+
+       // ========================================================================
+       // Data
+       // ========================================================================
+
+//      private static final long INITIAL_WINDOW_OFFSET = (1L * 1    * 1000 * 1000); // .001sec
+//      private static final long INITIAL_WINDOW_OFFSET = (1L * 10   * 1000 * 1000); // .01sec
+        private static final long INITIAL_WINDOW_OFFSET = (1L * 100  * 1000 * 1000); // .1sec
+//      private static final long INITIAL_WINDOW_OFFSET = (1L * 1000 * 1000 * 1000); // 1sec
+
+       /**
+        * Number of events before a GUI refresh
+        */
+       protected static final Long INPUT_CHANGED_REFRESH = 75000L;
+       private static final long DEFAULT_OFFSET = 0;
+
+       protected boolean synch = true; // time synchronization, used to be an option
+       protected ITimeAnalysisViewer tsfviewer = null;
+
+       private LttngSyntEventRequest fCurrentRequest = null;
+
+       protected LttngSyntheticEventProvider fProvider = LttngCoreProviderFactory.getEventProvider(getProviderId());
+       
+       // ========================================================================
+       // Constructor
+       // ========================================================================
+       public AbsTimeUpdateView(String viewID) {
+               super(viewID);
+               // freqState = UiCommonFactory.getQueue(this);
+       }
+
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       
+       /**
+        * Returns the number of events after which the relevant display will 
+        * be refreshed
+        * 
+        * @return  
+        */
+       protected Long getInputChangedRefresh() {
+           return INPUT_CHANGED_REFRESH;
+       }
+
+   /**
+     * Cancel the ongoing request if another experiment is being selected
+     * @param experimentDisposedSignal
+     */
+    @TmfSignalHandler
+    public void experimentDisposed(TmfExperimentDisposedSignal<? extends TmfEvent> experimentDisposedSignal) {
+        if (experimentDisposedSignal.getExperiment() != TmfExperiment.getCurrentExperiment()) {
+            return;
+        }
+        fProvider.conditionallyCancelRequests();
+    }
+       
+       /*
+        * (non-Javadoc)
+        * 
+        * @seeorg.eclipse.linuxtools.lttng.state.IStateDataRequestListener#
+        * processingStarted(org.eclipse.linuxtools.lttng.state.StateDataRequest)
+        */
+       @Override
+       @TmfSignalHandler
+       public synchronized void processingStarted(RequestStartedSignal signal) {
+               LttngSyntEventRequest request = signal.getRequest();
+               if (request != null) {
+                       // update queue with the id of the current request.
+                       // freqState.requestStarted(request);
+
+                       // if there was no new request then this one is still on
+                       // prepare for the reception of new data
+                       waitCursor(true);
+
+                       // no new time range for zoom orders
+                       TmfTimeRange trange = null;
+                       // Time Range will be used to filter out events which are
+                       // not visible in one pixel
+                       trange = request.getRange();
+
+                       // indicate if the data model needs to be cleared e.g. a new
+                       // experiment is being selected
+                       boolean clearData = request.isclearDataInd();
+                       // Indicate if current data needs to be cleared and if so
+                       // specify the new experiment time range that applies
+                       modelUpdatePrep(trange, clearData);
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @seeorg.eclipse.linuxtools.lttng.state.IStateDataRequestListener#
+        * processingCompleted(org.eclipse.linuxtools.lttng.state.StateDataRequest)
+        */
+       @Override
+       @TmfSignalHandler
+       public void processingCompleted(RequestCompletedSignal signal) {
+               ILttngSyntEventRequest request = signal.getRequest();
+
+               if (request == null) {
+                       return;
+               }
+
+               // Update wait cursor
+               waitCursor(false);
+
+               // No data refresh actions for cancelled requests.
+               if (request.isCancelled() || request.isFailed()) {
+                       if (TraceDebug.isDEBUG()) {
+                               TmfTimeRange trange = request.getRange();
+                               if (request.isCancelled()) {
+                                       TraceDebug.debug("Request cancelled " //$NON-NLS-1$
+                                                       + trange.getStartTime() + "-" + trange.getEndTime() //$NON-NLS-1$
+                                                       + " Handled Events: " + request.getSynEventCount() //$NON-NLS-1$
+                                                       + " " + request.toString(), 15); //$NON-NLS-1$
+                               } else if (request.isFailed()) {
+                                       TraceDebug.debug("Request Failed " + trange.getStartTime() //$NON-NLS-1$
+                                                       + "-" + trange.getEndTime() + " Handled Events: " //$NON-NLS-1$ //$NON-NLS-2$
+                                                       + request.getSynEventCount() + " " //$NON-NLS-1$
+                                                       + request.toString());
+                               }
+                       }
+
+                       return;
+               } else {
+                       modelInputChanged(request, true);
+               }
+       }
+
+       /**
+        * Registers as listener of time selection from other views
+        * 
+        * @param signal
+        */
+       public void synchToTime(TmfTimeSynchSignal signal) {
+        if (signal == null)
+               return;
+               if (synch) {
+                       Object source = signal.getSource();
+                       if (source != null && source != this) {
+
+                               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+
+                                       // Check for GUI thread
+                                       if (Display.getCurrent() != null) {
+                                               // GUI thread - execute update right away.
+                                               
+                                               // Internal value is expected in nano seconds.
+                                               long selectedTime = signal.getCurrentTime().getValue();
+                                               if (tsfviewer != null) {
+                                                       tsfviewer.setSelectedTime(selectedTime, true, source);
+
+                                                       ParamsUpdater paramUpdater = getParamsUpdater();
+                                                   Long savedSelTime = paramUpdater.getSelectedTime();
+                                                   if ((savedSelTime == null) || (savedSelTime != selectedTime)) {
+                                                   // Update the parameter updater to save the selected time
+                                                   paramUpdater.setSelectedTime(selectedTime);   
+                                               }
+                                               }
+                                       } else {
+                                               // Perform the updates on the UI thread
+                                               
+                                               // We need to clone the timestamp in the signal so that it won't be overwritten duo to multipe thread access 
+                                               final TmfTimeSynchSignal savedSignal = new TmfTimeSynchSignal(signal.getSource(), signal.getCurrentTime().clone());
+                                               tsfviewer.getControl().getDisplay().asyncExec(new Runnable() {
+                                                       @Override
+                                                       public void run() {
+                                                               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+                                                                       synchToTime(savedSignal);
+                                                               }
+                                                       }
+                                               });
+                                       }
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Process the reception of time window adjustment in this view if the
+        * source of the update is not this view.
+        * 
+        * @param signal
+        * @param clearingData
+        */
+       public void synchToTimeRange(TmfRangeSynchSignal signal, boolean clearingData) {
+           if (signal == null)
+                return;
+               if (synch) {
+                       Object source = signal.getSource();
+                       if (source != null && source != this) {
+                               // Internal value is expected in nano seconds.
+                               TmfTimeRange trange = signal.getCurrentRange();
+                               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
+                               if (experiment == null) {
+                                       TraceDebug.debug("Current selected experiment is null"); //$NON-NLS-1$
+                                       return;
+                               }
+
+                               // Clearing of process data is configurable
+                               eventRequest(trange, experiment.getTimeRange(), clearingData, ExecutionType.FOREGROUND);
+                       }
+               }
+       }
+
+       /**
+        * Trigger time synchronisation to other views this method shall be called
+        * when a check has been performed to note that an actual change of time has
+        * been performed vs a pure re-selection of the same time
+        * 
+        * @param time
+        * @param source
+        */
+       protected void synchTimeNotification(long time, Object source) {
+               // if synchronisation selected
+               if (synch) {
+                       // Notify other views
+                       TmfSignalManager.dispatchSignal(new TmfTimeSynchSignal(source, new LttngTimestamp(time)));
+               }
+       }
+
+       /**
+        * Common implementation of ITmfTimeSelectionListener, not used by all the
+        * views extending this abstract class
+        * 
+        * @param event
+        */
+       protected void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) {
+               Object source = event.getSource();
+               if (source == null) {
+                       return;
+               }
+
+               ParamsUpdater paramUpdater = getParamsUpdater();
+               Long savedSelTime = paramUpdater.getSelectedTime();
+
+               long selTimens = event.getSelectedTime();
+
+               // make sure the new selected time is different than saved before
+               // executing update
+               if (savedSelTime == null || savedSelTime != selTimens) {
+                       // Notify listener views.
+                       synchTimeNotification(selTimens, source);
+
+                       // Update the parameter updater to save the selected time
+                       paramUpdater.setSelectedTime(selTimens);
+
+                       if (TraceDebug.isDEBUG()) {
+                               TraceDebug.debug("Selected Time: " + new LttngTimestamp(selTimens) + "\n\t\t" + getName()); //$NON-NLS-1$ //$NON-NLS-2$
+                       }
+               }
+       }
+
+       /**
+        * Common implementation of ITmfTimeScaleSelectionListener, not used by all
+        * the views extending this abstract class
+        * 
+        * @param event
+        */
+       protected void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
+        // source needed to keep track of source values
+        Object source = event.getSource();
+
+        boolean newParams = false;
+        TmfTimeRange trange = null;
+        Long selectedTime = null;
+
+        // update all information and get relevant data
+           synchronized (this) {
+               if (source != null) {
+                   // Update the parameter updater before carrying out a read request
+                   ParamsUpdater paramUpdater = getParamsUpdater();
+                   newParams = paramUpdater.processTimeScaleEvent(event);
+
+                   if (newParams) {
+                       // Read the updated time window
+                       trange = paramUpdater.getTrange();
+                       if (trange != null) {
+                           selectedTime = paramUpdater.getSelectedTime();
+                       }
+                   }
+               }
+           }
+
+           // Check for selectedTime is sufficient since it is only set if
+           // newParams is true and trange is not null
+               if (selectedTime != null) {
+                   // Notify listener views. to perform data requests
+            // upon this notification
+
+                   // Note that this has to be done outside the synchronized statement
+                   // because otherwise we could end-up in a deadlock if a ongoing 
+                   // request needs to be canceled.
+            synchTimeRangeNotification(trange, selectedTime, source);              
+               }
+       }
+
+       /**
+        * Inform registered listeners about the new time range
+        * 
+        * @param trange
+        * @param selectedTime
+        * @param source
+        */
+       protected void synchTimeRangeNotification(TmfTimeRange trange, Long selectedTime, Object source) {
+               // if synchronisation selected
+               if (synch) {
+                       // Notify other views
+                       TmfSignalManager.dispatchSignal(new TmfRangeSynchSignal(source, trange, new LttngTimestamp(selectedTime)));
+               }
+       }
+
+       /**
+        * @param zoomedTRange
+        * @param experimentTRange
+        * @param clearingData
+        * @param execType 
+        */
+       public void eventRequest(TmfTimeRange zoomedTRange, TmfTimeRange experimentTRange, boolean clearingData, ExecutionType execType) {
+
+               // timeRange is the Experiment time range
+               boolean sent = processDataRequest(zoomedTRange, experimentTRange, DEFAULT_OFFSET, TmfDataRequest.ALL_DATA, clearingData, execType);
+
+               if (sent) {
+                       waitCursor(true);
+               }
+       }
+
+       /**
+        * @param offset
+        * @param nbRequested
+        * @param startTime
+        * @param clearingData
+        * @param execType 
+        */
+       public void eventRequest(long offset, TmfTimeRange range, boolean clearingData, ExecutionType execType) {
+
+               // timeRange is the Experiment time range
+               boolean sent = processDataRequest(range, null, offset, TmfDataRequest.ALL_DATA, clearingData, execType);
+
+               if (sent) {
+                       waitCursor(true);
+               }
+       }
+
+//     /**
+//      * @param zoomedTRange
+//      * @param experimentTRange
+//      * @param execType 
+//      */
+//     public void dataRequest(TmfTimeRange zoomedTRange,
+//                     TmfTimeRange experimentTRange, boolean clearingData) {
+//
+//             // timeRange is the Experiment time range
+//              boolean sent = processDataRequest(zoomedTRange, experimentTRange, clearingData);
+//
+//             if (sent) {
+//                     waitCursor(true);
+//             }
+//     }
+
+       /**
+        * send data request directly e.g. doesn't use a queue
+        * 
+        * @param requestTrange
+        * @param listener
+        * @param experimentTRange
+        * @param execType 
+        * @param processor
+        * @return
+        */
+       private boolean processDataRequest(TmfTimeRange requestTrange,
+                       TmfTimeRange experimentTRange, long offset, int nbRequested, boolean clearingData, ExecutionType execType) {
+               // Validate input
+               if (requestTrange == null) {
+                       TraceDebug.debug("Invalid input"); //$NON-NLS-1$
+                       return false;
+               }
+
+               // Cancel the currently executing request before starting a new one
+               fProvider.conditionallyCancelRequests();
+               fCurrentRequest = new LttngSyntEventRequest(
+                               requestTrange, offset, nbRequested,
+                               LttngConstants.DEFAULT_BLOCK_SIZE, this, experimentTRange, getEventProcessor(), 
+                               TmfExperiment.getCurrentExperiment().getName(), execType) {
+       
+                       Long fCount = getSynEventCount();
+                       ITransEventProcessor processor = getProcessor();
+                       ITmfTimestamp frunningTimeStamp;
+       
+                       /*
+                        * (non-Javadoc)
+                        * 
+                        * @see
+                        * org.eclipse.linuxtools.lttng.request.LttngSyntEventRequest#handleData
+                        * ()
+                        */
+////                   int handleDataCount = 0;
+////                   int handleDataValidCount = 0;
+//                     @Override
+//                     public void handleData() {
+//                             LttngSyntheticEvent[] result = getData();
+//     
+//                             TmfEvent evt = (result.length > 0) ? result[0] : null;
+////                           handleDataCount++;
+
+                       @Override
+                       public void handleData(LttngSyntheticEvent event) {
+                               super.handleData(event);
+                               if (event != null) {
+//                                     handleDataValidCount++;
+                                       LttngSyntheticEvent synEvent = (LttngSyntheticEvent) event;
+                                       // process event
+                                       switch (synEvent.getSynType()) {
+
+                                           case STARTREQ: {
+                                               handleRequestStarted();
+                                               break;
+                                           }
+
+                                           case BEFORE: {
+                                               processor.process(event, synEvent.getTraceModel());
+                                               fCount++;
+                                               if ((fCount != 0) && (fCount % getInputChangedRefresh() == 0)) {
+                                                   // send partial update
+                                                   modelInputChanged(this, false);
+  
+                                                   if (TraceDebug.isDEBUG()) {
+                                                       frunningTimeStamp = event.getTimestamp();
+                                                       TraceDebug.debug("handled: " + fCount + " sequence: " + synEvent.getSynType()); //$NON-NLS-1$ //$NON-NLS-2$
+                                                   }
+                                               }
+                                               break;
+                                           }
+
+                                           case AFTER:
+                                               // fall-through
+                                           case ENDREQ:{
+                                               processor.process(event, synEvent.getTraceModel());
+                                               break;
+                                           }
+
+                                           default:
+                          // nothing to do
+                          break;
+                                   }
+                               }
+                       }
+       
+                       public void handleRequestStarted() {
+                               notifyStarting();
+                       }
+
+                       @Override
+                       public void done() {
+//                             if (TraceDebug.isDEBUG()) {
+//                                     TraceDebug.debug("AbsTimeUpdateView: Received=" + handleDataCount + ", Valid=" + handleDataCount + ", fCount=" + fCount);
+//                             }
+                               super.done();
+                       }
+       
+                       @Override
+                       public void handleCompleted() {
+                               super.handleCompleted();
+
+                               // Data is not complete and should be handled as such
+                               if (isFailed() || isCancelled()) {
+                                       modelIncomplete(this);
+                               }
+
+                               if (TraceDebug.isDEBUG()) {
+                                       if (frunningTimeStamp != null) {
+                                               TraceDebug.debug("Last event time stamp: " + frunningTimeStamp.getValue()); //$NON-NLS-1$
+                                       }
+                               }
+                       }
+               };
+       
+               // send the request to TMF
+               fCurrentRequest.startRequestInd(fProvider);
+               fCurrentRequest.setclearDataInd(clearingData);
+               return true;
+       }
+
+       /**
+        * Returns an initial smaller window to allow the user to select the area of
+        * interest
+        * 
+        * @param experimentTRange
+        * @return
+        */
+       protected TmfTimeRange getInitTRange(TmfTimeRange experimentTRange) {
+               ITmfTimestamp expStartTime = experimentTRange.getStartTime();
+               ITmfTimestamp expEndTime = experimentTRange.getEndTime();
+               ITmfTimestamp initialEndOfWindow = new LttngTimestamp(expStartTime
+                               .getValue()
+                               + INITIAL_WINDOW_OFFSET);
+               if (initialEndOfWindow.compareTo(expEndTime, false) < 0) {
+                       return new TmfTimeRange(expStartTime, initialEndOfWindow);
+               }
+
+               // The original size of the experiment is smaller than proposed adjusted
+               // time
+               return experimentTRange;
+       }
+
+       /**
+        * Request the Time Analysis widget to enable or disable the wait cursor
+        * e.g. data request in progress or data request completed
+        * 
+        * @param waitInd
+        */
+       protected void waitCursor(final boolean waitInd) {
+               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+                       Display display = tsfviewer.getControl().getDisplay();
+
+                       // Perform the updates on the UI thread
+                       display.asyncExec(new Runnable() {
+                               @Override
+                               public void run() {
+                                       if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+                                               tsfviewer.waitCursor(waitInd);
+                                       }
+                               }
+                       });
+               }
+       }
+
+       /**
+        * View preparation to override the current local information
+        * 
+        * @param timeRange
+        *            - new total time range e.g. Experiment level
+        * @param clearAllData
+        */
+       protected void modelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) {
+               ItemContainer<?> itemContainer = getItemContainer();
+               if (clearAllData) {
+                       // start fresh e.g. new experiment selected
+                       itemContainer.clearItems();
+               } else {
+                       // clear children but keep processes
+                       itemContainer.clearChildren();
+               }
+
+               // Obtain the current resource array
+               ITmfTimeAnalysisEntry[] itemArr = itemContainer.readItems();
+
+               // clean up data and boundaries
+               displayModel(itemArr, -1, -1, false, -1, -1, null);
+
+               ParamsUpdater updater = getParamsUpdater();
+               if (updater != null) {
+                       // Start over
+                       updater.setEventsDiscarded(0);
+
+                       // Update new visible time range if available
+                       if (timeRange != null) {
+                               updater.update(timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue());
+                       }
+               }
+       }
+
+       /**
+        * Initialize the model and view before reloading items
+        * 
+        * @param boundaryRange
+        * @param visibleRange
+        * @param source
+        */
+       protected void modelUpdateInit(TmfTimeRange boundaryRange, TmfTimeRange visibleRange, Object source) {
+               // Update the view boundaries
+               if (boundaryRange != null) {
+                       ItemContainer<?> itemContainer = getItemContainer();
+                       if (itemContainer != null) {
+                               itemContainer.clearItems();
+                               // Obtain the current process array
+                               ITmfTimeAnalysisEntry[] itemArr = itemContainer.readItems();
+
+                               long startTime = boundaryRange.getStartTime().getValue();
+                               long endTime = boundaryRange.getEndTime().getValue();
+
+                               // Update the view part
+                               displayModel(itemArr, startTime, endTime, true, visibleRange.getStartTime().getValue(), visibleRange
+                                               .getEndTime().getValue(), source);
+                       }
+               }
+
+               // update the view filtering parameters
+               if (visibleRange != null) {
+                       ParamsUpdater updater = getParamsUpdater();
+                       if (updater != null) {
+                               // Start over
+                               updater.setEventsDiscarded(0);
+                               // Update new visible time range if available
+                               updater.update(visibleRange.getStartTime().getValue(), visibleRange.getEndTime().getValue());
+                       }
+               }
+       }
+
+       /**
+        * Actions taken by the view to refresh its widget(s) with the updated data
+        * model
+        * 
+        * @param request
+        * @param complete
+        *            true: yes, false: partial update
+        */
+       @SuppressWarnings("deprecation")
+       protected void modelInputChanged(ILttngSyntEventRequest request, boolean complete) {
+               long experimentStartTime = -1;
+               long experimentEndTime = -1;
+               TmfTimeRange experimentTimeRange = request.getExperimentTimeRange();
+               if (experimentTimeRange != null) {
+                       experimentStartTime = experimentTimeRange.getStartTime().getValue();
+                       experimentEndTime = experimentTimeRange.getEndTime().getValue();
+               }
+
+               // Obtain the current resource list
+               ITmfTimeAnalysisEntry[] itemArr = getItemContainer().readItems();
+
+               if (itemArr != null) {
+                       // Sort the array by pid
+                       Arrays.sort(itemArr);
+
+                       // Update the view part
+                       displayModel(itemArr, experimentStartTime, experimentEndTime, false, request.getRange().getStartTime()
+                                       .getValue(), request.getRange().getEndTime().getValue(), request.getSource());
+               }
+
+               if (complete) {
+                       // reselect to original time
+                       ParamsUpdater paramUpdater = getParamsUpdater();
+                       if ((paramUpdater != null) && (tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+                               final Long selTime = paramUpdater.getSelectedTime();
+                               if (selTime != null) {
+                                       TraceDebug.debug("View: " + getName() + "\n\t\tRestoring the selected time to: " + selTime); //$NON-NLS-1$ //$NON-NLS-2$
+                                       Display display = tsfviewer.getControl().getDisplay();
+                                       display.asyncExec(new Runnable() {
+                                               @Override
+                                               public void run() {
+                                                       if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+                                                               tsfviewer.setSelectedTime(selTime, false, this);
+                                                       }
+                                               }
+                                       });
+                               }
+
+//                             System.out.println(System.currentTimeMillis() + ": AbsTimeUpdate (" + getName() + ") completed");
+
+                               if (TraceDebug.isDEBUG()) {
+                                       int eventCount = 0;
+                                       Long count = request.getSynEventCount();
+                                       for (int pos = 0; pos < itemArr.length; pos++) {
+                                               eventCount += itemArr[pos].getTraceEvents().size();
+                                       }
+
+                                       int discarded = paramUpdater.getEventsDiscarded();
+                                       int discardedOutofOrder = paramUpdater.getEventsDiscardedWrongOrder();
+                                       int discardedOutofViewRange = paramUpdater.getEventsDiscardedOutOfViewRange();
+                                       int dicardedNotVisible = paramUpdater.getEventsDiscardedNotVisible();
+
+                                       TmfTimeRange range = request.getRange();
+                                       StringBuilder sb = new StringBuilder("View: " + getName() + ", Events handled: " + count //$NON-NLS-1$ //$NON-NLS-2$
+                                                       + ", Events loaded in view: " + eventCount + ", Number of events discarded: " + discarded //$NON-NLS-1$ //$NON-NLS-2$
+                                                       + "\n\tNumber of events discarded with start time earlier than next good time: " //$NON-NLS-1$
+                                                       + discardedOutofOrder + "\n\tDiscarded Not visible: " + dicardedNotVisible //$NON-NLS-1$
+                                                       + "\n\tDiscarded out of view Range: " + discardedOutofViewRange); //$NON-NLS-1$
+
+                                       sb.append("\n\t\tRequested Time Range: " + range.getStartTime() + "-" + range.getEndTime()); //$NON-NLS-1$ //$NON-NLS-2$
+                                       sb.append("\n\t\tExperiment Time Range: " + experimentStartTime + "-" + experimentEndTime); //$NON-NLS-1$ //$NON-NLS-2$
+                                       TraceDebug.debug(sb.toString());
+                               }
+                       }
+
+               }
+       }
+
+       // /**
+       // * Obtains the remainder fraction on unit Seconds of the entered value in
+       // * nanoseconds. e.g. input: 1241207054171080214 ns The number of seconds
+       // can
+       // * be obtain by removing the last 9 digits: 1241207054 the fractional
+       // * portion of seconds, expressed in ns is: 171080214
+       // *
+       // * @param v
+       // * @return
+       // */
+       // protected String formatNs(long v) {
+       // StringBuffer str = new StringBuffer();
+       // boolean neg = v < 0;
+       // if (neg) {
+       // v = -v;
+       // str.append('-');
+       // }
+       //
+       // String strVal = String.valueOf(v);
+       // if (v < 1000000000) {
+       // return strVal;
+       // }
+       //
+       // // Extract the last nine digits (e.g. fraction of a S expressed in ns
+       // return strVal.substring(strVal.length() - 9);
+       // }
+
+       /**
+        * The request was stopped, the data is incomplete
+        * 
+        * @param request
+        */
+       protected abstract void modelIncomplete(ILttngSyntEventRequest request);
+
+       /**
+        * Returns the Event processor instance related to a specific view
+        * 
+        * @return
+        */
+       protected abstract ITransEventProcessor getEventProcessor();
+
+       /**
+        * To be overridden by some sub-classes although may not be needed in some
+        * e.g. statistics view
+        * 
+        * @param items
+        * @param startBoundTime
+        * @param endBoundTime
+        * @param updateTimeBounds
+        *            - Time bounds updated needed e.g. if a new Experiment or trace
+        *            is selected
+        * @param startVisibleWindow
+        * @param endVisibleWindow
+        * @param source
+        */
+       protected abstract void displayModel(final ITmfTimeAnalysisEntry[] items, final long startBoundTime,
+                       final long endBoundTime, final boolean updateTimeBounds, final long startVisibleWindow,
+                       final long endVisibleWindow, final Object source);
+
+       /**
+        * To be overridden by some sub-classes although may not be needed in some
+        * e.g. statistics view
+        * 
+        * @return
+        */
+       protected abstract ParamsUpdater getParamsUpdater();
+
+       /**
+        * Returns the model's item container
+        * 
+        * @return
+        */
+       protected abstract ItemContainer<?> getItemContainer();
+
+       /**
+        * Returns LTTng Synthetic Provider ID used for current view
+        * 
+        * @return  
+        */
+       protected abstract int getProviderId();
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/ParamsUpdater.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/common/ParamsUpdater.java
new file mode 100644 (file)
index 0000000..4290ee1
--- /dev/null
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.common;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
+
+/**
+ * 
+ * Preserve the time and space width parameters applicable to a particular view
+ * in order to facilitate filtering of events and request handling.
+ * 
+ * @author alvaro
+ * 
+ */
+public class ParamsUpdater {
+       // ========================================================================
+       // Data
+       // ========================================================================
+
+    private long startTime = 0;
+    private long endTime = Long.MAX_VALUE;
+    private static Long selectedTime = null;
+    private final int DEFAULT_WIDTH = 2000; // number of estimated pixels that
+                                            // can hold the time range space
+    private int width = DEFAULT_WIDTH; // width in pixels used to represent the
+                                       // time interval
+    private double pixelsPerNs = 0;
+    private int eventsDiscarded = 0;
+    private int eventsDiscardedOutOfView = 0;
+    private int eventsDiscardedNotVisible = 0;
+    private int eventsDiscardedWrongOrder = 0;
+    private TmfTimeRange trange = null;
+
+    public static final int OUT_OF_VIEWRANGE = 0;
+    public static final int NOT_VISIBLE = 1;
+
+       // ========================================================================
+       // Methods
+       // ========================================================================
+
+       /**
+        * @param event
+        * @return
+        */
+       public synchronized boolean processTimeScaleEvent(
+                       TmfTimeScaleSelectionEvent event) {
+
+               boolean updated = false;
+               if (event != null) {
+                       long time0 = event.getTime0();
+                       long time1 = event.getTime1();
+                       int dwidth = event.getWidth();
+
+                       updated = update(time0, time1, dwidth);
+
+                       // initialization only, otherwise wait for the actual selection
+                       // event to update its value. Note that the time must be different
+                       // upon selection of a new time in order to trigger an update to all
+                       if (selectedTime == null) {
+                               setSelectedTime(event.getSelectedTime());
+                       }
+
+               }
+
+               return updated;
+
+       }
+
+       /**
+        * Save the selected time
+        * @param selTime
+        */
+       public void setSelectedTime(long selTime) {
+               TraceDebug.debug("Selected time changed from: \n\t" + selectedTime //$NON-NLS-1$
+                               + " to: \n\t" + selTime); //$NON-NLS-1$
+               selectedTime = selTime;
+       }
+
+       /**
+        * May return null, if the selected time is invalid
+        * 
+        * @return
+        */
+       public Long getSelectedTime() {
+               return selectedTime;
+       }
+
+       /**
+        * Update time range but keep width as is
+        * 
+        * @param time0
+        * @param time1
+        * @return
+        */
+       public boolean update(long time0, long time1) {
+               return update(time0, time1, width);
+       }
+
+       /**
+        * Only positive attributes are expected
+        * 
+        * @param time0
+        * @param time1
+        * @param dwidth
+        * @return
+        */
+       public boolean update(long time0, long time1, int dwidth) {
+               boolean updated = false;
+
+               if (time0 == startTime && time1 == endTime && dwidth == width) {
+                       // No updated needed
+                       return updated;
+               }
+
+               // Negatives are invalid
+               time0 = time0 > 0 ? time0 : 0;
+               time1 = time1 > 0 ? time1 : 0;
+               dwidth = dwidth > 0 ? dwidth : 0;
+
+               if (time1 > time0) {
+                       // Store the new values as long as they are within range
+                       startTime = time0;
+                       endTime = time1;
+                       width = dwidth;
+
+                       pixelsPerNs = (double) width / (double) (endTime - startTime);
+
+                       TmfTimestamp fTimeStart = new LttngTimestamp(startTime);
+                       TmfTimestamp fTimeEnd = new LttngTimestamp(endTime);
+                       trange = new TmfTimeRange(fTimeStart, fTimeEnd);
+
+                       // make sure the selected time is within the new range or else set
+                       // mark it as invalid
+                       if (selectedTime != null) {
+                               setSelectedTime(selectedTime);
+                       }
+
+                       // update succeeded
+                       updated = true;
+
+                       TraceDebug.debug("Configuration updated to: StartTime: " /* */ //$NON-NLS-1$
+                                       + fTimeStart /* */
+                                       + "-" /* */ //$NON-NLS-1$
+                                       + fTimeEnd /* */
+                                       + " width: " /* */ //$NON-NLS-1$
+                                       + width + " k: " + pixelsPerNs); /* */ //$NON-NLS-1$
+               } else {
+                       TraceDebug
+                                       .debug("End time is not greater than start time, start time: " //$NON-NLS-1$
+                                                       + time0 + " end time: " + time1); //$NON-NLS-1$
+               }
+
+               return updated;
+       }
+
+       /**
+        * @return
+        */
+       public long getStartTime() {
+               return startTime;
+       }
+
+       /**
+        * @return
+        */
+       public long getEndTime() {
+               return endTime;
+       }
+
+       /**
+        * @return
+        */
+       public int getWidth() {
+               if (width == 0) {
+                       TraceDebug
+                                       .debug("Unexpected width value of 0 pixels, returning default"); //$NON-NLS-1$
+                       return DEFAULT_WIDTH;
+               }
+
+               return width;
+       }
+
+       /**
+        * Return the current constant "K" of pixels per nano second used for the
+        * widest time space widget registered in this instance.
+        * 
+        * @return
+        */
+       public double getPixelsPerNs() {
+               return pixelsPerNs;
+       }
+
+       /**
+        * Set the value of pixels per nano second as long as the value is grater
+        * positive
+        * 
+        * @return
+        */
+       public void setPixelsPerNs(double pixperNsec) {
+               if (pixperNsec > 0) {
+                       pixelsPerNs = pixperNsec;
+               }
+       }
+
+       /**
+        * @param value
+        */
+       public void setEventsDiscarded(int value) {
+               eventsDiscarded = value;
+               if (value == 0) {
+                       eventsDiscardedWrongOrder = 0;
+                       eventsDiscardedNotVisible = 0;
+                       eventsDiscardedOutOfView = 0;
+               }
+       }
+
+       /**
+        * 
+        */
+       public void incrementEventsDiscarded(int reason) {
+               if (reason == OUT_OF_VIEWRANGE) {
+                       this.eventsDiscardedOutOfView++;
+               }
+
+               if (reason == NOT_VISIBLE) {
+                       this.eventsDiscardedNotVisible++;
+               }
+
+               this.eventsDiscarded++;
+       }
+
+       /**
+        * @return
+        */
+       public int getEventsDiscarded() {
+               return eventsDiscarded;
+       }
+
+       /**
+        * increase the number of events discarder since they were not received in a
+        * later time than previous events
+        */
+       public void incrementEventsDiscardedWrongOrder() {
+               this.eventsDiscarded++;
+               this.eventsDiscardedWrongOrder++;
+       }
+
+       /**
+        * @return
+        */
+       public int getEventsDiscardedWrongOrder() {
+               return eventsDiscardedWrongOrder;
+
+       }
+
+       /**
+        * @return
+        */
+       public int getEventsDiscardedNotVisible() {
+               return eventsDiscardedNotVisible;
+
+       }
+
+       /**
+        * @return
+        */
+       public int getEventsDiscardedOutOfViewRange() {
+               return eventsDiscardedOutOfView;
+
+       }
+
+       /**
+        * @return
+        */
+       public TmfTimeRange getTrange() {
+               return trange;
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/control/ControlView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/control/ControlView.java
new file mode 100644 (file)
index 0000000..c9f86b7
--- /dev/null
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.control;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * <b><u>ControlView</u></b>
+ * <p>
+ * TODO: Implement me. Please.
+ */
+@Deprecated
+public class ControlView extends ViewPart {
+
+    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.control"; //$NON-NLS-1$
+
+    /**
+        * 
+        */
+    public ControlView() {
+        // TODO Auto-generated constructor stub
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createPartControl(Composite parent) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    @Override
+    public void setFocus() {
+        // TODO Auto-generated method stub
+
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/ControlFlowView.java
new file mode 100644 (file)
index 0000000..27c4f20
--- /dev/null
@@ -0,0 +1,1161 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * 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.internal.lttng.ui.views.controlflow;
+
+import java.util.Vector;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
+import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ITransEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.ItemContainer;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventProcess;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.AbsTimeUpdateView;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+import org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor.FlowEventToHandlerFactory;
+import org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model.FlowModelFactory;
+import org.eclipse.linuxtools.internal.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.TmfExperimentUpdatedSignal;
+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;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeSelectionListener;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeFilterSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * <b><u>ControlFlowView</u></b>
+ */
+/**
+ * @author alvaro
+ * 
+ */
+public class ControlFlowView extends AbsTimeUpdateView implements
+               ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener,
+               ITmfTimeFilterSelectionListener {
+
+    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.controlflow"; //$NON-NLS-1$
+    
+       // ========================================================================
+       // Table data
+       // ========================================================================
+
+    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,/* */
+       PID_COLUMN,/* */
+       TGID_COLUMN,/* */
+       PPID_COLUMN,/* */
+       CPU_COLUMN, /* */
+       BIRTH_SEC_COLUMN,/* */
+       BIRTH_NSEC_COLUMN,/* */
+       TRACE /* */
+       };
+
+       // ========================================================================
+       // Data
+       // ========================================================================
+       private TableViewer tableViewer;
+       // private int totalNumItems = 0;
+       // Actions
+       private Action doubleClickAction;
+       private Action resetScale;
+       private Action nextEvent;
+       private Action prevEvent;
+       private Action nextTrace;
+       private Action prevTrace;
+       private Action showLegend;
+       private Action filterTraces;
+       private Action zoomIn;
+       private Action zoomOut;
+       private Action zoomFilter;
+
+       private ViewProcessFilter tableFilter = null;
+       private ScrolledComposite scrollFrame = null;
+       
+       private TmfTimeRange initTimeRange = TmfTimeRange.NULL_RANGE;
+
+       // private static SimpleDateFormat stimeformat = new SimpleDateFormat(
+       // "yy/MM/dd HH:mm:ss");
+
+       // private TraceModelImplFactory fact;
+
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       /*
+        * The content provider class is responsible for providing objects to the
+        * view. It can wrap existing objects in adapters or simply return objects
+        * as-is. These objects may be sensitive to the current input of the view,
+        * or ignore it and always show the same content (like Task List, for
+        * example).
+        */
+
+       static class ViewContentProvider implements
+       /* ILazyContentProvider, */IStructuredContentProvider {
+               private TableViewer cviewer = null;
+               private ITmfTimeAnalysisEntry[] elements = null;
+
+               public ViewContentProvider(TableViewer v) {
+                       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); //$NON-NLS-1$
+                       } else {
+                               TraceDebug.debug("New input = null"); //$NON-NLS-1$
+                       }
+               }
+
+               @Override
+               public void dispose() {
+
+               }
+
+               // Needed with the use of virtual tables in order to initialize items
+               // which were not initially visible.
+               public void updateElement(int index) {
+                       cviewer.replace(elements[index], index);
+               }
+
+               @Override
+               public Object[] getElements(Object inputElement) {
+                       return elements;
+               }
+       }
+
+       static class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
+               @Override
+               public String getColumnText(Object obj, int index) {
+                       String strRes = ""; //$NON-NLS-1$
+                       LttngTimestamp time;
+                       if (obj instanceof TimeRangeEventProcess) {
+                               TimeRangeEventProcess process = (TimeRangeEventProcess) obj;
+                               switch (index) {
+                               case 0:
+                                       strRes = process.getName();
+                                       break;
+                               case 1:
+                                       strRes = process.getBrand();
+                                       break;
+                               case 2:
+                                       strRes = process.getPid().toString();
+                                       break;
+                               case 3:
+                                       strRes = process.getTgid().toString();
+                                       break;
+                               case 4:
+                                       strRes = process.getPpid().toString();
+                                       break;
+                               case 5:
+                                       strRes = process.getCpu().toString();
+                                       break;
+                               case 6:
+                                       time = new LttngTimestamp(process.getCreationTime()
+                                                       .longValue());
+                                       strRes = time.getSeconds();
+                                       break;
+                               case 7:
+                                       time = new LttngTimestamp(process.getCreationTime()
+                                                       .longValue());
+                                       strRes = time.getNanoSeconds();
+                                       break;
+                               case 8:
+                                       strRes = process.getTraceID();
+                                       break;
+                               default:
+                                       break;
+                               }
+                       } else {
+                               return getText(obj);
+                       }
+
+                       return strRes;
+               }
+
+               @Override
+               public Image getColumnImage(Object obj, int index) {
+                       return getImage(obj);
+               }
+
+               @Override
+               public Image getImage(Object obj) {
+                       // No image needed for the time being
+                       // return PlatformUI.getWorkbench().getSharedImages().getImage(
+                       // ISharedImages.IMG_OBJ_ELEMENT);
+                       return null;
+               }
+       }
+
+       static class ViewProcessFilter extends ViewerFilter {
+
+               private Vector<ITmfTimeAnalysisEntry> filteredSet = new Vector<ITmfTimeAnalysisEntry>();
+               StructuredViewer viewer;
+
+               public ViewProcessFilter(StructuredViewer rviewer) {
+                       this.viewer = rviewer;
+               }
+
+               public void setFilter(Vector<ITmfTimeAnalysisEntry> filtered) {
+                       if (filtered != null) {
+                               this.filteredSet = filtered;
+                               viewer.refresh();
+                       }
+               }
+
+               @Override
+               public boolean select(Viewer viewer, Object parentElement,
+                               Object element) {
+                       boolean filteredIn = true;
+                       if (element instanceof ITmfTimeAnalysisEntry) {
+                               ITmfTimeAnalysisEntry process = (ITmfTimeAnalysisEntry) element;
+                               if (filteredSet.contains(process)) {
+                                       // The element is marked to be filtered out
+                                       return false;
+                               }
+                       } else {
+                               TraceDebug.debug("Unexpected type of filter element received: " //$NON-NLS-1$
+                                               + element.toString());
+                       }
+                       // Compare element versus a list of filtered out
+                       return filteredIn;
+               }
+       }
+
+       /**
+        * The constructor.
+        */
+       public ControlFlowView() {
+               super(ID);
+       }
+
+       /**
+        * This is a callback that will allow us to create the viewer and initialize
+        * it.
+        */
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.tmf.ui.views.TmfView#createPartControl(org.eclipse
+        * .swt.widgets.Composite)
+        */
+       @Override
+       public void createPartControl(Composite parent) {
+
+               scrollFrame = new ScrolledComposite(parent, SWT.V_SCROLL);
+               
+               scrollFrame.setExpandVertical(true);
+               scrollFrame.setExpandHorizontal(true);
+               scrollFrame.setAlwaysShowScrollBars(true);
+               
+               SashForm sash = new SashForm(scrollFrame, SWT.NONE);
+               scrollFrame.setContent(sash);
+
+               tableViewer = new TableViewer(sash, SWT.FULL_SELECTION | SWT.H_SCROLL);
+               tableViewer.setContentProvider(new ViewContentProvider(tableViewer));
+               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()) {
+                                       Object firstSel = null;
+                                       if (sel instanceof IStructuredSelection) {
+                                               firstSel = ((IStructuredSelection) sel).getFirstElement();
+
+                                               // Make sure the selection is visible
+                                               updateScrollOrigin();
+
+                                               if (firstSel instanceof ITmfTimeAnalysisEntry) {
+                                                       ITmfTimeAnalysisEntry trace = (ITmfTimeAnalysisEntry) firstSel;
+                                                       tsfviewer.setSelectedTrace(trace);
+                                               }
+                                       }
+                               }
+                       }
+
+                       /**
+                        * Make sure the selected item is visible
+                        */
+                       private void updateScrollOrigin() {
+                               Table table = tableViewer.getTable();
+                               if (table != null && table.getItemCount() > 0) {
+                                       TableItem item = table.getSelection()[0];
+                                       if (item == null) {
+                                               // no selected reference to go up or down
+                                               return;
+                                       }
+
+                                       Rectangle itemRect = item.getBounds();
+                                       int step = itemRect.height;
+
+                                       // calculate height of horizontal bar
+                                       int hscrolly = 0;
+                                       ScrollBar hbar = scrollFrame.getHorizontalBar();
+                                       if (hbar != null) {
+                                               hscrolly = hbar.getSize().y;
+                                       }
+
+                                       int visibleHeight = scrollFrame.getSize().y - hscrolly;
+
+                                       // the current scrollbar offset to adjust i.e. start
+                                       // of
+                                       // the visible window
+                                       Point origin = scrollFrame.getOrigin();
+                                       // end of visible window
+                                       int endy = origin.y + visibleHeight;
+
+                                       int itemStartPos = itemRect.y + table.getHeaderHeight() + table.getBorderWidth()
+                                                       + table.getParent().getBorderWidth();
+
+                                       // Item End Position
+                                       int itemEndPos = itemStartPos + step;
+
+                                       // check if need to go up
+                                       if (origin.y >= step && itemStartPos < origin.y) {
+                                               // one step up
+                                               scrollFrame.setOrigin(origin.x, origin.y - step);
+
+                                       }
+
+                                                       // check if it needs to go down
+                                       if (itemEndPos > endy) {
+                                               // one step down
+                                               scrollFrame.setOrigin(origin.x, origin.y + step);
+
+                                                       }
+                               }
+                       }
+               });
+               
+               // 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();
+                               if (table == null || table.getItemCount() < 1) {
+                                       // nothing to page
+                                       return;
+                               }
+
+                               switch (e.keyCode) {
+                               case SWT.PAGE_DOWN:
+                                       updateScrollPageDown();
+                                       break;
+                               case SWT.PAGE_UP:
+                                       updateScrollUp();
+                                       break;
+                               case SWT.HOME:
+                                       // Go to the top
+                                       scrollFrame.setOrigin(origin.x, 0);
+                                       break;
+                               case SWT.END:
+                                       // End Selected
+                                       int count = table.getItemCount();
+                                       TableItem item = table.getItem(count - 1);
+                                       int itemStartPos = item.getBounds().y;
+                                       // Get to the bottom
+                                       scrollFrame.setOrigin(origin.x, itemStartPos);
+                                       break;
+                               default:
+                                       break;
+                               }
+                       }
+
+                       @Override
+                       public void keyReleased(KeyEvent e) {
+                               // Nothing to do
+
+                       }
+
+                       /**
+                        * Scroll one page down
+                        */
+                       private void updateScrollPageDown() {
+                               // null protection before calling private method
+                               Table table = tableViewer.getTable();
+                               int step = table.getItemHeight();
+
+                               int hscrolly = 0;
+                               ScrollBar hbar = scrollFrame.getHorizontalBar();
+                               if (hbar != null) {
+                                       hscrolly = hbar.getSize().y;
+                               }
+
+                               Point origin = scrollFrame.getOrigin();
+                               int visibleHeight = scrollFrame.getSize().y - hscrolly;
+                               int endy = origin.y + visibleHeight;
+
+                               scrollFrame.setOrigin(origin.x, endy - step);
+                       }
+
+                       /**
+                        * Scroll one page up
+                        */
+                       private void updateScrollUp() {
+                               // null protection before calling private method
+                               Table table = tableViewer.getTable();
+                               int step = table.getItemHeight();
+
+                               int hscrolly = 0;
+                               ScrollBar hbar = scrollFrame.getHorizontalBar();
+                               if (hbar != null) {
+                                       hscrolly = hbar.getSize().y;
+                               }
+
+                               Point origin = scrollFrame.getOrigin();
+                               int visibleHeight = scrollFrame.getSize().y - hscrolly;
+                               int pageUpPos = origin.y - visibleHeight + step;
+                               pageUpPos = pageUpPos > 0 ? pageUpPos : 0;
+                               scrollFrame.setOrigin(origin.x, pageUpPos);
+                       }
+
+               });
+               // Describe table
+               applyTableLayout(table);
+
+               int borderWidth = table.getBorderWidth();
+
+               int itemHeight = table.getItemHeight() + getTableItemHeightAdjustement();
+               int headerHeight = table.getHeaderHeight();
+               table.getVerticalBar().setVisible(false);
+
+               tsfviewer = TmfViewerFactory.createViewer(sash, new FlowTimeRangeViewerProvider(getParamsUpdater()));
+
+               // Traces shall not be grouped to allow synchronisation
+               tsfviewer.groupTraces(false);
+               tsfviewer.setItemHeight(itemHeight);
+               tsfviewer.setBorderWidth(borderWidth);
+               tsfviewer.setHeaderHeight(headerHeight);
+               tsfviewer.setVisibleVerticalScroll(false);
+               // Names provided by the table
+               tsfviewer.setNameWidthPref(0);
+               tsfviewer.setAcceptSelectionAPIcalls(true);
+
+               // Viewer to notify selection to this class
+               // This class will synchronise selections with table.
+               tsfviewer.addWidgetSelectionListner(this);
+               tsfviewer.addFilterSelectionListner(this);
+               tsfviewer.addWidgetTimeScaleSelectionListner(this);
+
+               sash.setWeights(new int[] { 1, 1 });
+               // Create the help context id for the viewer's control
+               // TODO: Associate with help system
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(
+                               tableViewer.getControl(),
+                               "org.eclipse.linuxtools.lttnng.ui.views.flow.viewer"); //$NON-NLS-1$
+
+               makeActions();
+               hookContextMenu();
+               hookDoubleClickAction();
+               contributeToActionBars();
+
+               // scrollFrame.addControlListener(new ControlAdapter() {
+               //
+               // @Override
+               // public void controlResized(ControlEvent e) {
+               // tsfviewer.resizeControls();
+               // updateScrolls(scrollFrame);
+               // }
+               // });
+
+               // set the initial view parameter values
+               // Experiment start and end time
+               // as well as time space width in pixels, used by the time analysis
+               // widget
+               // Read relevant values
+//             int timeSpaceWidth = tsfviewer.getTimeSpace();
+//             if (timeSpaceWidth < 0) {
+//                     timeSpaceWidth = -timeSpaceWidth;
+//             }
+
+               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
+               if (experiment != null) {
+                       TmfTimeRange experimentTRange = experiment.getTimeRange();
+
+                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
+                               // 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 hookContextMenu() {
+               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);
+                       }
+               });
+               Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
+               tableViewer.getControl().setMenu(menu);
+               getSite().registerContextMenu(menuMgr, tableViewer);
+       }
+
+       private void contributeToActionBars() {
+               IActionBars bars = getViewSite().getActionBars();
+               fillLocalPullDown(bars.getMenuManager());
+               fillLocalToolBar(bars.getToolBarManager());
+       }
+
+       private void fillLocalPullDown(IMenuManager manager) {
+               manager.add(new Separator());
+               manager.add(showLegend);
+               manager.add(new Separator());
+               manager.add(resetScale);
+               manager.add(nextEvent);
+               manager.add(prevEvent);
+               manager.add(nextTrace);
+               manager.add(prevTrace);
+               // manager.add(filterTraces);
+               manager.add(zoomIn);
+               manager.add(zoomOut);
+               manager.add(zoomFilter);
+               manager.add(new Separator());
+       }
+
+       private void fillContextMenu(IMenuManager manager) {
+               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(filterTraces);
+               manager.add(zoomIn);
+               manager.add(zoomOut);
+               manager.add(zoomFilter);
+               manager.add(new Separator());
+               manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+       }
+
+       private void fillLocalToolBar(IToolBarManager manager) {
+               manager.add(showLegend);
+               manager.add(new Separator());
+               manager.add(resetScale);
+               manager.add(nextEvent);
+               manager.add(prevEvent);
+               manager.add(nextTrace);
+               manager.add(prevTrace);
+               // manager.add(filterTraces);
+               manager.add(zoomIn);
+               manager.add(zoomOut);
+               manager.add(zoomFilter);
+               manager.add(new Separator());
+       }
+
+       private void makeActions() {
+               // resetScale
+               resetScale = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.resetStartFinishTime();
+                               }
+
+                       }
+               };
+               resetScale.setText(Messages.getString("ControlFlowView.Action.Reset")); //$NON-NLS-1$
+               resetScale.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.Reset.ToolTip")); //$NON-NLS-1$
+               resetScale.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                                               "icons/elcl16/home_nav.gif")); //$NON-NLS-1$
+
+               // nextEvent
+               nextEvent = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectNextEvent();
+                               }
+                       }
+               };
+               nextEvent.setText(Messages
+                               .getString("ControlFlowView.Action.NextEvent")); //$NON-NLS-1$
+               nextEvent.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.NextEvent.Tooltip")); //$NON-NLS-1$
+               nextEvent.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                                               "icons/elcl16/next_event.gif")); //$NON-NLS-1$
+
+               // prevEvent
+               prevEvent = new Action() {
+               @Override
+               public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectPrevEvent();
+                               }
+                       }
+               };
+               prevEvent.setText(Messages
+                               .getString("ControlFlowView.Action.PrevEvent")); //$NON-NLS-1$
+               prevEvent.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.PrevEvent.Tooltip")); //$NON-NLS-1$
+               prevEvent.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                                               "icons/elcl16/prev_event.gif")); //$NON-NLS-1$
+
+               // nextTrace
+               nextTrace = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectNextTrace();
+                               }
+                       }
+               };
+               nextTrace.setText(Messages
+                               .getString("ControlFlowView.Action.NextProcess")); //$NON-NLS-1$
+               nextTrace.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.NextProcess.ToolTip")); //$NON-NLS-1$
+               nextTrace.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                                               "icons/elcl16/next_item.gif")); //$NON-NLS-1$
+
+               // prevTrace
+               prevTrace = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectPrevTrace();
+                               }
+                       }
+               };
+               prevTrace.setText(Messages
+                               .getString("ControlFlowView.Action.PreviousProcess")); //$NON-NLS-1$
+               prevTrace.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.PreviousProcess.Tooltip")); //$NON-NLS-1$
+               prevTrace.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                                               "icons/elcl16/prev_item.gif")); //$NON-NLS-1$
+
+               // showLegend
+               showLegend = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.showLegend();
+                               }
+                       }
+               };
+               showLegend.setText(Messages.getString("ControlFlowView.Action.Legend")); //$NON-NLS-1$
+               showLegend.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.Legend.ToolTip")); //$NON-NLS-1$
+
+               // filterTraces
+               filterTraces = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.filterTraces();
+                               }
+                       }
+               };
+               filterTraces.setText(Messages
+                               .getString("ControlFlowView.Action.Filter")); //$NON-NLS-1$
+               filterTraces.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.Filter.ToolTip")); //$NON-NLS-1$
+               filterTraces.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                                               "icons/elcl16/filter_items.gif")); //$NON-NLS-1$
+
+               // zoomIn
+               zoomIn = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.zoomIn();
+                               }
+                       }
+               };
+               zoomIn.setText(Messages.getString("ControlFlowView.Action.ZoomIn")); //$NON-NLS-1$
+               zoomIn.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.ZoomIn.Tooltip")); //$NON-NLS-1$
+               zoomIn.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+                               Messages.getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                               "icons/elcl16/zoomin_nav.gif")); //$NON-NLS-1$
+
+               // zoomOut
+               zoomOut = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.zoomOut();
+                               }
+                       }
+               };
+               zoomOut.setText(Messages.getString("ControlFlowView.Action.ZoomOut")); //$NON-NLS-1$
+               zoomOut.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.ZoomOut.tooltip")); //$NON-NLS-1$
+               zoomOut.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+                               Messages.getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
+                               "icons/elcl16/zoomout_nav.gif")); //$NON-NLS-1$
+
+               // zoomFilter
+               zoomFilter = new Action() {
+                       @Override
+                       public void run() {
+                               // Nothing to do, however the selection status is needed by the
+                               // application
+                       }
+               };
+               zoomFilter.setText(Messages
+                               .getString("ControlFlowView.Action.ZoomFilter")); //$NON-NLS-1$
+               zoomFilter.setToolTipText(Messages
+                               .getString("ControlFlowView.Action.ZoomFilter.tooltip")); //$NON-NLS-1$
+               zoomFilter.setImageDescriptor(AbstractUIPlugin
+                               .imageDescriptorFromPlugin(Messages
+                                               .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);
+
+               doubleClickAction = new Action() {
+                       @Override
+                       public void run() {
+                               ISelection selection = tableViewer.getSelection();
+                               Object obj = ((IStructuredSelection) selection)
+                                               .getFirstElement();
+                               showMessage("Double-click detected on " + obj.toString()); //$NON-NLS-1$
+                       }
+               };
+       }
+
+       private void hookDoubleClickAction() {
+               tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+                       @Override
+                       public void doubleClick(DoubleClickEvent event) {
+                               doubleClickAction.run();
+                       }
+               });
+       }
+
+       private void showMessage(String message) {
+               MessageDialog.openInformation(tableViewer.getControl().getShell(),
+                               Messages.getString("ControlFlowView.msgSlogan"), message); //$NON-NLS-1$
+       }
+
+       /**
+        * Passing the focus request to the viewer's control.
+        */
+       @Override
+       public void setFocus() {
+               tableViewer.getControl().setFocus();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * tsfTmProcessSelEvent
+        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent
+        * )
+        */
+       @Override
+       public void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) {
+               // common implementation
+               super.tsfTmProcessSelEvent(event);
+
+               // Reselect the table viewer to widget selection
+               ISelection sel = tsfviewer.getSelectionTrace();
+               if (sel != null && !sel.isEmpty()) {
+                       tableViewer.setSelection(sel);
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
+        * ITmfTimeScaleSelectionListener
+        * #tsfTmProcessTimeScaleEvent(org.eclipse.linuxtools
+        * .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent)
+        */
+       @Override
+       public void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
+               super.tsfTmProcessTimeScaleEvent(event);
+       }
+
+       private void applyTableLayout(Table table) {
+               for (int i = 0; i < columnNames.length; i++) {
+                       TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
+                       tableColumn.setText(columnNames[i]);
+                       tableColumn.pack();
+               }
+               table.setHeaderVisible(true);
+               table.setLinesVisible(true);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel
+        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry[], long, long, boolean, long, long,
+        * java.lang.Object)
+        */
+       @Override
+       public void displayModel(final ITmfTimeAnalysisEntry[] items,
+                       final long startBoundTime, final long endBoundTime,
+                       final boolean updateTimeBounds, final long startVisibleWindow,
+                       final long endVisibleWindow, final Object source) {
+               
+               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() {
+                                       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);
+                                }
+                            }
+                        });
+                                       }
+                               }
+                       });
+               }
+       }
+
+       @Override
+       public void dispose() {
+               // dispose parent resources
+               super.dispose();
+
+               tsfviewer.removeFilterSelectionListner(this);
+               tsfviewer.removeWidgetSelectionListner(this);
+               tsfviewer.removeWidgetTimeScaleSelectionListner(this);
+               tableViewer = null;
+               tsfviewer = null;
+       }
+
+       /**
+        * @param tableComposite
+        * @param table
+        */
+       private synchronized void resizeTableColumns(Table table) {
+               if (table != null) {
+                       TableColumn[] columns = table.getColumns();
+                       for (TableColumn column : columns) {
+                               column.pack();
+                       }
+               }
+       }
+
+       @Override
+       public void tmfTaProcessFilterSelection(TmfTimeFilterSelectionEvent event) {
+               if (tableFilter != null) {
+                       Vector<ITmfTimeAnalysisEntry> filteredout = event.getFilteredOut();
+                       if (filteredout != null) {
+                               tableFilter.setFilter(filteredout);
+                       } else {
+                               tableFilter.setFilter(new Vector<ITmfTimeAnalysisEntry>());
+                       }
+                       tableViewer.refresh();
+               }
+       }
+
+       /**
+        * @param scrollFrame
+        * @param wrapper
+        */
+       private void updateScrolls(final ScrolledComposite scrollFrame) {
+               scrollFrame.setMinSize(tableViewer.getTable().computeSize(SWT.DEFAULT, SWT.DEFAULT));
+       }
+
+       /**
+        * Registers as listener of time selection from other views
+        * 
+        * @param signal
+        */
+       @Override
+       @TmfSignalHandler
+       public void synchToTime(TmfTimeSynchSignal signal) {
+               super.synchToTime(signal);
+       }
+
+       /**
+        * Annotation Registers as listener of time range selection from other views
+        * The implementation handles the entry of the signal.
+        * 
+        * @param signal
+        */
+       @TmfSignalHandler
+       public void synchToTimeRange(TmfRangeSynchSignal signal) {
+               if (zoomFilter != null) {
+                       synchToTimeRange(signal, zoomFilter.isChecked());
+               }
+       }
+
+       @Override
+       public void modelIncomplete(ILttngSyntEventRequest request) {
+               // Nothing to do
+               // The data will be refreshed on the next request
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getEventProcessor()
+        */
+       @Override
+       public ITransEventProcessor getEventProcessor() {
+               return FlowEventToHandlerFactory.getInstance();
+       }
+
+       /**
+        * @param signal
+        */
+       @TmfSignalHandler
+       public void experimentSelected(
+                       TmfExperimentSelectedSignal<? extends TmfEvent> signal) {
+               if (signal != null) {
+                       TmfTimeRange experimentTRange = signal.getExperiment()
+                                       .getTimeRange();
+
+                       initTimeRange = TmfTimeRange.NULL_RANGE;
+                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
+                               // 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_RANGE && signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
+                       TmfTimeRange experimentTRange = signal.getRange();
+
+                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
+                               // prepare time intervals in widget
+                               modelUpdateInit(experimentTRange, experimentTRange, signal.getSource());
+
+                               // request initial data
+                               initialExperimentDataRequest(signal.getSource(), experimentTRange);
+                       }
+               }
+       }
+
+    @TmfSignalHandler
+    public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
+        if (signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
+            final TmfTimeRange range = signal.getExperiment().getTimeRange();
+            if (range != TmfTimeRange.NULL_RANGE) {
+                Display.getDefault().asyncExec(new Runnable() {
+                    @Override
+                    public void run() {
+                        tsfviewer.setTimeBounds(range.getStartTime().getValue(), range.getEndTime().getValue());
+                    }});
+            }
+        }
+    }
+
+       /**
+        * @param source
+        * @param experimentTRange
+        * @return Adjusted time window used for the request (smaller window to
+        *         initialize view)
+        */
+       private TmfTimeRange initialExperimentDataRequest(Object source,
+                       TmfTimeRange experimentTRange) {
+               // Adjust the initial time window to a shorter interval to allow
+               // user to select the interesting area based on the perspective
+               TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
+
+               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;
+       }
+       
+       /*
+        * 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 ajustement;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getParamsUpdater()
+        */
+       @Override
+       protected ParamsUpdater getParamsUpdater() {
+               return FlowModelFactory.getParamsUpdater();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getItemContainer()
+        */
+       @Override
+       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; 
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/Messages.java
new file mode 100644 (file)
index 0000000..8f2a195
--- /dev/null
@@ -0,0 +1,33 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow;\r
+\r
+import java.util.MissingResourceException;\r
+import java.util.ResourceBundle;\r
+\r
+public class Messages {\r
+       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.messages"; //$NON-NLS-1$\r
+\r
+       private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle\r
+                       .getBundle(BUNDLE_NAME);\r
+\r
+       private Messages() {\r
+       }\r
+\r
+       public static String getString(String key) {\r
+               try {\r
+                       return RESOURCE_BUNDLE.getString(key);\r
+               } catch (MissingResourceException e) {\r
+                       return '!' + key + '!';\r
+               }\r
+       }\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java
new file mode 100644 (file)
index 0000000..ffa3904
--- /dev/null
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon - Initial implementation
+ *   Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor;
+
+import java.util.Vector;
+
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ProcessStatus;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeComponent;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEvent;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventProcess;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEvent.Type;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.AbsTRangeUpdate;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+import org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model.FlowModelFactory;
+import org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model.FlowProcessContainer;
+
+public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILttngEventProcessor {
+
+       // ========================================================================
+       // Data
+       // =======================================================================
+
+       protected FlowProcessContainer procContainer = FlowModelFactory.getProcContainer();
+       protected ParamsUpdater params = FlowModelFactory.getParamsUpdater();
+       protected static final Long ANY_CPU = 0L;
+
+
+       // ========================================================================
+       // Methods
+       // =======================================================================
+       protected TimeRangeEventProcess addLocalProcess(LttngProcessState stateProcess, long traceStartTime, long traceEndTime, String traceId) {
+               // TimeRangeEventProcess localProcess = new TimeRangeEventProcess(id, name, startTime, stopTime, groupName, className)
+               TimeRangeEventProcess localProcess = new TimeRangeEventProcess(
+                               procContainer.getUniqueId(), stateProcess.getName(),
+                               traceStartTime, traceEndTime, "", stateProcess.getType() //$NON-NLS-1$
+                                               .getInName(), stateProcess.getCpu(), stateProcess
+                                               .getInsertion_time());
+               
+               
+               localProcess.setCreationTime(stateProcess.getCreation_time());
+               localProcess.setPid(stateProcess.getPid());
+               localProcess.setTgid(stateProcess.getTgid());
+               localProcess.setPpid(stateProcess.getPpid());
+               localProcess.setName(stateProcess.getName());
+               localProcess.setBrand(stateProcess.getBrand());
+               localProcess.setTraceID(traceId);
+               localProcess.setProcessType(stateProcess.getType().getInName());
+               procContainer.addItem(localProcess);
+
+               if (TraceDebug.isCFV()) {
+                       TraceDebug.traceCFV("addLocalProcess():" + localProcess); //$NON-NLS-1$
+               }
+
+               return localProcess;
+       }
+       
+       /**
+        * Used to check if the event is visible within the current visible time
+        * window
+        * 
+        * @return
+        */
+       protected boolean withinViewRange(long stime, long etime) {
+               long windowStartTime = params.getStartTime();
+               long windowEndTime = params.getEndTime();
+
+               // start time is within window
+               if (stime >= windowStartTime && stime <= windowEndTime) {
+                       // The event or part of it shall be displayed.
+                       return true;
+               }
+
+               // end time is within window
+               if (etime >= windowStartTime && etime <= windowEndTime) {
+                       // The event or part of it shall be displayed.
+                       return true;
+               }
+
+               // check that a portion is within the window
+               if (stime < windowStartTime && etime > windowEndTime) {
+                       // The time range is bigger than the selected time window and
+                       // crosses it
+                       return true;
+               }
+
+               return false;
+       }
+
+       /**
+        * @param traceSt
+        * @param startTime
+        * @param endTime
+        * @param localProcess
+        * @param params
+        * @param stateMode
+        * @return
+        */
+       @SuppressWarnings("deprecation")
+       protected boolean makeDraw(LttngTraceState traceSt, long startTime,
+                       long endTime, TimeRangeEventProcess localProcess,
+                       ParamsUpdater params, String stateMode) {
+
+               if (TraceDebug.isCFV()) {
+                       TraceDebug.traceCFV("makeDraw():[" + localProcess + //$NON-NLS-1$ 
+                                       ",candidate=[stime=" + startTime +  //$NON-NLS-1$
+                                       ",etime=" + endTime +  //$NON-NLS-1$
+                                       ",state=" + stateMode + "]]"); //$NON-NLS-1$ //$NON-NLS-2$
+               }
+
+               // Determine start and end times to establish duration
+               Long stime = startTime;
+               Long etime = endTime;
+
+               if (!withinViewRange(stime, etime)) {
+                       // No use to process the event since it's outside
+                       // the visible time range of the window
+                       params.incrementEventsDiscarded(ParamsUpdater.OUT_OF_VIEWRANGE);
+                       return false;
+               }
+
+               if (etime < stime) {
+                       // Validate the sequential order of events
+                       params.incrementEventsDiscardedWrongOrder();
+                       return false;
+               }
+
+               // Store the next good time to start drawing the next event
+               // this is done this early to display an accurate start time of the
+               // first event
+               // within the display window
+               // ****** moved at the end since it produces gaps among the coloured rectangles
+               // localProcess.setNext_good_time(etime);
+
+               // If First event of a process, initialise start time half page before to enable pagination to the left
+               if (stime < params.getStartTime()) {
+                       // event start time is before the visible time window
+                       long insertion = localProcess.getInsertionTime();
+                       if (stime.longValue() == insertion) {
+                               // if start time is equal to insertion this is the first event to be drawn for this process
+                               long halfPage = (params.getEndTime() - params.getStartTime()) / 2;
+                               long initTime = params.getStartTime() - halfPage;
+                               if (initTime > insertion) {
+                                       // start time of this event is unknown, place it half page before visible window to allow left side
+                                       // pagination when selecting previous event
+                                       stime = initTime;
+                               }
+                       }
+               }
+
+               // Determine if the time range event will fit it the current
+               // pixel map
+               double duration = etime - stime;
+               double k = getPixelsPerNs(traceSt, params);
+               double pixels = duration * k;
+
+               // Visibility check
+               // Display a "more information" indication by allowing non visible event
+               // as long as its previous event is visible.
+               boolean visible = true;
+               if (pixels < 1.0) {
+                       boolean prevEventVisibility = true;
+                       // Get the visibility indication on previous event for
+                       // this process
+                       Vector<TimeRangeComponent> inMemEvents = localProcess
+                                       .getTraceEvents();
+                       if (inMemEvents.size() != 0) {
+                               TimeRangeComponent prevEvent = inMemEvents.get(inMemEvents
+                                               .size() - 1);
+                               prevEventVisibility = prevEvent.isVisible();
+
+                               // if previous event visibility is false and the time span
+                               // between events less than two pixels, there is no need to
+                               // load it in memory i.e. not visible and a more indicator is
+                               // within two pixels.
+                               // return i.e. event discarded to free up memory
+                               Long eventSpan = stime - prevEvent.getStartTime();
+                               if (prevEventVisibility == false
+                                               && ((double) eventSpan * k) < 2.0) {
+
+                                       // discard the item
+                                       params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
+                                       return false;
+
+                               }
+                       }
+
+                       // if previous event is visible, set this one to not
+                       // visible and continue
+                       visible = false;
+               }
+
+               // Create the time-range event
+               TimeRangeEvent time_window = new TimeRangeEvent(stime, etime,
+                               localProcess, Type.PROCESS_MODE, stateMode);
+
+               time_window.setVisible(visible);
+               localProcess.getTraceEvents().add(time_window);
+               localProcess.setNext_good_time(etime);
+
+               return false;
+       }
+
+       /**
+        * @param traceSt
+        * @param evTime
+        * @param process
+        * @param localProcess
+        * @param params
+        * @return
+        */
+       protected boolean makeDraw(LttngTraceState traceSt, long evTime,
+                       LttngProcessState process, TimeRangeEventProcess localProcess,
+                       ParamsUpdater params) {
+
+               // TmfTimestamp stime = process.getState().getChange_LttTime();
+               long stime = localProcess.getNext_good_time();
+
+               String stateMode;
+               ProcessStatus procStatus = process.getState().getProc_status();
+               // Use Execution mode if process state is RUN otherwise use the actual
+               // process state,
+               // this selection will determine the actual color selected for the event
+               if (procStatus == ProcessStatus.LTTV_STATE_RUN) {
+                       stateMode = process.getState().getExec_mode().getInName();
+               } else {
+                       stateMode = procStatus.getInName();
+               }
+
+               return makeDraw(traceSt, stime, evTime, localProcess, params, stateMode);
+
+       }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java
new file mode 100644 (file)
index 0000000..cc119a1
--- /dev/null
@@ -0,0 +1,387 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *   Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Fields;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventProcess;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+
+/**
+ * Creates instances of specific after state update handlers, per corresponding
+ * event.
+ * 
+ * @author alvaro
+ * 
+ */
+class FlowAfterUpdateHandlers {
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SCHED_SCHEDULE
+        * </p>
+        * Replace C function "after_schedchange_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getSchedChangeHandler() {
+               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                               
+                               // get event time, cpu, trace_number, process, pid
+                               LttngProcessState process_in = traceSt.getRunning_process().get(trcEvent.getCpuId());
+                               
+                               // pid_out is never used, even in LTTv!
+                               //Long pid_out = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_PREV_PID);
+                               Long pid_in = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_NEXT_PID);
+                               
+                               if ( !(pid_in.equals(process_in.getPid())) ) {
+                                   TraceDebug.debug("pid_in != PID!  (getSchedChangeHandler)"); //$NON-NLS-1$
+                }
+                               
+                               //hashed_process_data = processlist_get_process_data(process_list,pid_out,process->cpu,&birth,trace_num);
+                               TimeRangeEventProcess localProcess = procContainer.findProcess(pid_in, process_in.getCpu(), traceSt
+                                               .getTraceId(), process_in.getCreation_time());
+                               
+                               if (localProcess == null) {
+                                       if ((pid_in == 0) || !pid_in.equals(process_in.getPpid())) {
+                                           TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                           addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
+                                       }
+                                       else {
+                                               TraceDebug
+                                                               .debug("pid_in is not 0 or pid_in == PPID!  (getSchedChangeHandler)"); //$NON-NLS-1$
+                                       }
+                               }
+
+                               // There is no drawing done by the C code below, only refreshing
+                               // the references to the current hash data to make it ready for
+                               // next event
+
+                               // This current implementation does not support the use of
+                               // current hashed data
+                               // although an equivalent would be good in order to improve the
+                               // time to find the currently running process per cpu.
+                               /*
+                               if(ltt_time_compare(hashed_process_data_in->next_good_time, evtime) <= 0)
+                               {
+                                   TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab);
+                                 
+                                       #ifdef EXTRA_CHECK
+                                   if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1)
+                                      return FALSE;
+                                       #endif //EXTRA_CHECK
+                               
+                                   Drawing_t *drawing = control_flow_data->drawing;
+                                   guint width = drawing->width;
+                                   guint new_x;
+                                     
+                                   convert_time_to_pixels(time_window,evtime,width,&new_x);
+                                       
+                                   if(hashed_process_data_in->x.middle != new_x) {
+                                       hashed_process_data_in->x.middle = new_x;
+                                       hashed_process_data_in->x.middle_used = FALSE;
+                                       hashed_process_data_in->x.middle_marked = FALSE;
+                                   }
+                               }*/
+                               
+                               return false;
+
+                       }
+               };
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_PROCESS_FORK
+        * </p>
+        * Replace C function "after_process_fork_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_CHILD_PID
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getProcessForkHandler() {
+           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {  
+                           
+                Long child_pid = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_CHILD_PID);
+                LttngProcessState process_child = lttv_state_find_process(traceSt, trcEvent.getCpuId(), child_pid );
+                           
+                           if (process_child != null) {
+                               TimeRangeEventProcess localProcess = procContainer.findProcess(process_child.getPid(), process_child.getCpu(), traceSt.getTraceId(), process_child.getCreation_time() );
+                               
+                               if (localProcess == null) {
+                                   if (child_pid == 0 || !child_pid.equals(process_child.getPpid())) {            
+                                       TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                            addLocalProcess(process_child, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
+                                   }
+                                   else {
+                                       TraceDebug.debug("localProcess is null with child_pid not 0 or child_pid equals PPID (getProcessForkHandler)"); //$NON-NLS-1$
+                                   }
+                                       } else {
+                                               // If we found the process, the Ppid and the Tgid might
+                                               // be missing, let's add them
+                                               localProcess.setPpid(process_child.getPpid());
+                                               localProcess.setTgid(process_child.getTgid());
+                               }
+                           }
+                           else {
+                               TraceDebug.debug("process_child is null! (getProcessForkHandler)"); //$NON-NLS-1$
+                           }
+                     
+                               return false;
+                       }
+               };
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_PROCESS_EXIT
+        * </p>
+        * Replace C function "after_process_exit_hook" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getProcessExitHandler() {
+           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                           
+                           LttngProcessState process = traceSt.getRunning_process().get(trcEvent.getCpuId());
+
+                           if (process != null) {
+                               
+                                       // *** TODO: ***
+                                       // We shall look into a way to find the current process
+                                       // faster, see the c library
+                                       // (current_hash) in order to speed up the find. see c-code
+                               //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
+                           //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
+                           //   }
+                               TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(), process.getCpu(), traceSt.getTraceId(),  process.getCreation_time());
+                               
+                               if (localProcess == null) {
+                                   if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) {                                 
+                                       TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                                   addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
+                                   }
+                                   else {
+                                       TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExitHandler)"); //$NON-NLS-1$
+                                   }
+                                       }
+                           }
+                           else {
+                               TraceDebug.debug("process is null! (getProcessExitHandler)"); //$NON-NLS-1$
+                           }                       
+                           
+                               return false;
+                       }
+               };
+               return handler;
+       }
+
+       
+       /**
+        * <p>
+        * Handles: LTT_EVENT_EXEC
+        * </p>
+        * Replace C function "after_fs_exec_hook" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getProcessExecHandler() {
+           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                           
+                           LttngProcessState process = traceSt.getRunning_process().get(trcEvent.getCpuId());
+
+                if (process != null) {
+                    
+                    TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(),  process.getCpu(), traceSt.getTraceId(), process.getCreation_time());
+                    
+                    if (localProcess == null) {
+                        if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) {
+                            TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                            addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
+                        }
+                        else {
+                            TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExecHandler)"); //$NON-NLS-1$
+                        }
+                    }
+                    else {
+                        // If we found the process, the name might be missing. Let's add it here.
+                        localProcess.setName(process.getName());
+                    }
+                }
+                else {
+                    TraceDebug.debug("process is null! (getProcessExecHandler)"); //$NON-NLS-1$
+                }
+                
+                               return false;
+                       }
+               };
+               return handler;
+       }
+       
+       /**
+        * <p>
+        * LTT_EVENT_THREAD_BRAND
+        * </p>
+        * Replace C function "after_user_generic_thread_brand_hook" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor GetThreadBrandHandler() {
+           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                           
+                           LttngProcessState process = traceSt.getRunning_process().get(trcEvent.getCpuId());
+
+                if (process != null) {
+                    
+                                       // Similar to above comments, implement a faster way to find
+                                       // the local process
+                    //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
+                    //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
+                    //   }
+                    TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(), process.getCpu(), traceSt.getTraceId(), process.getCreation_time());
+                    
+                    if (localProcess == null) {
+                        if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) {                         
+                            TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                            addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
+                        }
+                        else {
+                            TraceDebug.debug("process pid is not 0 or pid equals ppid! (GetThreadBrandHandler)"); //$NON-NLS-1$
+                        }
+                    }
+                    else {
+                                               // If we found the process, the brand might be missing
+                                               // on it, add it.
+                        localProcess.setBrand(process.getBrand());
+                    }
+                }
+                else {
+                    TraceDebug.debug("process is null! (GetThreadBrandHandler)"); //$NON-NLS-1$
+                }
+                
+                return false;
+                           
+                       }
+               };
+               return handler;
+       }
+
+       /**
+        * <p>
+        * LTT_EVENT_PROCESS_STATE
+        * </p>
+        * Replace C function "after_event_enum_process_hook" in eventhooks.c
+        * <p>
+        * <p>
+        * Creates the processlist entry for the child process. Put the last
+        * position in x at the current time value.
+        * </p>
+        * 
+        * <p>
+        * Fields: LTT_FIELD_PID
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getEnumProcessStateHandler() {
+           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                           
+                               int first_cpu;
+                               int nb_cpus;
+                           
+                               Long pid_in = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_PID);
+                           
+                           if ( pid_in != null  ) {
+                           if(pid_in == 0L) {
+                                               first_cpu = 0;
+                                               nb_cpus = traceSt.getNumberOfCPUs();
+                           } 
+                           else {
+                                               first_cpu = ANY_CPU.intValue();
+                                               nb_cpus = ANY_CPU.intValue() + 1;
+                           }
+                           
+                                       for (int cpu = first_cpu; cpu < nb_cpus; cpu++) {
+                                               LttngProcessState process_in = lttv_state_find_process(traceSt, Long.valueOf(cpu), pid_in);
+                               
+                               if ( process_in != null ) {
+                                   TimeRangeEventProcess localProcess = procContainer.findProcess(process_in.getPid(), process_in.getCpu(), traceSt.getTraceId(), process_in.getCreation_time());
+                           
+                                   if (localProcess == null) {
+                                           if (process_in.getPid() == 0 || !process_in.getPid().equals(process_in.getPpid())) {
+                                    TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                                    localProcess = addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
+                                }
+                                else {
+                                    TraceDebug.debug("process pid is not 0 or pid equals ppid! (getEnumProcessStateHandler)"); //$NON-NLS-1$
+                                    return false;
+                                }
+                                   }
+
+                                                       // If the process was found, it might be missing
+                                                       // informations, add it here
+                                                       localProcess.setName(process_in.getName());
+                                                       localProcess.setPpid(process_in.getPpid());
+                                                       localProcess.setTgid(process_in.getTgid());
+                               }
+                               else {
+                                   TraceDebug.debug("process_in is null! This should never happen. (getEnumProcessStateHandler)"); //$NON-NLS-1$
+                               }
+                           }
+                           }
+                           else {
+                               TraceDebug.debug("pid_in is null! This should never happen, really... (getEnumProcessStateHandler)"); //$NON-NLS-1$
+                           }
+                           
+                               return false;
+                       }
+               };
+               return handler;
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowBeforeUpdateHandlers.java
new file mode 100644 (file)
index 0000000..efd09a3
--- /dev/null
@@ -0,0 +1,396 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *   Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Fields;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventProcess;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+
+/**
+ * Creates instances of specific before state update handlers, per corresponding
+ * event.
+ * 
+ * @author alvaro
+ * 
+ */
+class FlowBeforeUpdateHandlers {
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SYSCALL_ENTRY
+        * </p>
+        * Replace C function named "before_execmode_hook" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getStateModesHandler() {
+               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               Long cpu = trcEvent.getCpuId();
+                               LttngProcessState stateProcess = traceSt.getRunning_process()
+                                               .get(cpu);
+                               // TraceDebug.debug("Before handler called");
+                               String traceId = traceSt.getTraceId();
+
+                               if (stateProcess != null) {
+                                       // Find process within the list of registered time-range
+                                       // related
+                                       // processes
+
+                                       // key process attributes to look for it or store it
+                                       // are: pid, birth, trace_num, note: cpu not relevant since
+                                       // it
+                                       // may change
+                                       TimeRangeEventProcess localProcess = procContainer
+                                                       .findProcess(stateProcess.getPid(), stateProcess.getCpu(), traceId, stateProcess
+                                    .getCreation_time());
+
+                                       // Add process to process list if not present
+                                       if (localProcess == null) {
+                                               TmfTimeRange timeRange = traceSt.getContext()
+                                                               .getTraceTimeWindow();
+                                               localProcess = addLocalProcess(stateProcess, timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceId);
+                                       }
+
+                                       // Do the actual drawing
+                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                       stateProcess, localProcess, params);
+                               } else {
+                                       TraceDebug
+                                                       .debug("Running state process is null! (getStateModesHandler)"); //$NON-NLS-1$
+                               }
+
+                               return false;
+                       }
+               };
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SCHED_SCHEDULE
+        * </p>
+        * Replace C function named "before_schedchange_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE (?)
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getBeforeSchedChangeHandler() {
+               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               Long pid_out = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_PREV_PID);
+                               Long pid_in = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_NEXT_PID);
+
+                               // This is useless even in Lttv !!
+                               // Long state_out = getAFieldLong(trcEvent, traceSt,
+                               // Fields.LTT_FIELD_PREV_STATE);
+
+                               // We need to process information.
+                               LttngProcessState process = traceSt.getRunning_process().get(
+                                               trcEvent.getCpuId());
+
+                               if (process != null) {
+                                       if (process.getPid().equals(pid_out) == false) {
+                                               // To replace :
+                                               // process = lttv_state_find_process(ts,tfs->cpu,
+                                               // pid_out);
+                                               process = lttv_state_find_process(traceSt, trcEvent
+                                                               .getCpuId(), pid_out);
+                                               // Also, removed :
+                                               // guint trace_num = ts->parent.index;
+                                       }
+
+                                       if (process != null) {
+                                               // TODO: Implement something similar to current hash in
+                                               // order to keep track of the current process and speed
+                                               // up finding the local resource.
+
+                                               // HashedProcessData *hashed_process_data = NULL;
+                                               // hashed_process_data =
+                                               // processlist_get_process_data(process_list,pid_out,process->cpu,&birth,trace_num);
+                                               TimeRangeEventProcess localProcess = procContainer
+                                                               .findProcess(process.getPid(), process.getCpu(), traceSt
+                                                                               .getTraceId(), process.getCreation_time());
+
+                                               // Add process to process list if not present
+                                               // Replace C Call :
+                                               // processlist_add(process_list,drawing,pid_out,process->tgid,process->cpu,process->ppid,&birth,trace_num,process->name,process->brand,&pl_height,&process_info,&hashed_process_data);
+                                               if (localProcess == null) {
+                                                       TmfTimeRange timeRange = traceSt.getContext()
+                                                                       .getTraceTimeWindow();
+                                                       localProcess = addLocalProcess(process, timeRange
+                                                                       .getStartTime().getValue(), timeRange
+                                                                       .getEndTime().getValue(), traceSt
+                                                                       .getTraceId());
+                                               }
+
+                                               // Do the actual drawing
+                                               makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                               process,
+                                                               localProcess, params);
+                                       } else {
+                                               // Process may be null if the process started BEFORE the
+                                               // trace start
+                                               // TraceDebug.debug("Process is null for pid_out! (getBeforeSchedChangeHandler)");
+                                       }
+
+                                       // PID_IN section
+                                       process = lttv_state_find_process(traceSt, trcEvent
+                                                       .getCpuId(), pid_in);
+
+                                       if (process != null) {
+                                               // HashedProcessData *hashed_process_data = NULL;
+                                               // hashed_process_data =
+                                               // processlist_get_process_data(process_list, pid_in,
+                                               // tfs->cpu, &birth, trace_num);
+                                               TimeRangeEventProcess localProcess = procContainer
+                                                               .findProcess(process.getPid(), process.getCpu(), traceSt
+                                                                               .getTraceId(), process.getCreation_time());
+
+                                               // Add process to process list if not present
+                                               // Replace C Call :
+                                               // processlist_add(process_list, drawing, pid_in,
+                                               // process->tgid, tfs->cpu, process->ppid, &birth,
+                                               // trace_num, process->name, process->brand, &pl_height,
+                                               // &process_info, &hashed_process_data);
+                                               if (localProcess == null) {
+                                                       TmfTimeRange timeRange = traceSt.getContext()
+                                                                       .getTraceTimeWindow();
+                                                       localProcess = addLocalProcess(process, timeRange
+                                                                       .getStartTime().getValue(), timeRange
+                                                                       .getEndTime().getValue(), traceSt
+                                                                       .getTraceId());
+                                               }
+
+                                               // Do the actual drawing
+                                               makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                               process,
+                                                               localProcess, params);
+
+                                       } else {
+                                               // Process can be null if it started AFTER the trace
+                                               // end. Do nothing...
+                                               // TraceDebug.debug("No process found for pid_in! Something is wrong? (getBeforeSchedChangeHandler)");
+                                       }
+                               } else {
+                                       TraceDebug
+                                                       .debug("Running process is null! (getBeforeSchedChangeHandler)"); //$NON-NLS-1$
+                               }
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_PROCESS_EXIT
+        * </p>
+        * Replace C function named "before_process_exit_hook" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getProcessExitHandler() {
+               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               // We need to process information.
+                               LttngProcessState process = traceSt.getRunning_process().get(
+                                               trcEvent.getCpuId());
+
+                               if (process != null) {
+                                       // TODO: Implement a similar method to track the current
+                                       // local process in order to speed up finding the local
+                                       // resource
+
+                                       // hashed_process_data =
+                                       // processlist_get_process_data(process_list, pid,
+                                       // process->cpu, &birth,trace_num);
+                                       TimeRangeEventProcess localProcess = procContainer
+                                                       .findProcess(process.getPid(), process.getCpu(), traceSt
+                                                                       .getTraceId(), process.getCreation_time());
+
+                                       // Add process to process list if not present
+                                       // Replace C Call :
+                                       // processlist_add(process_list, drawing, pid,
+                                       // process->tgid, process->cpu, process->ppid, &birth,
+                                       // trace_num, process->name, process->brand,&pl_height,
+                                       // &process_info, &hashed_process_data);
+                                       if (localProcess == null) {
+                                               TmfTimeRange timeRange = traceSt.getContext()
+                                                               .getTraceTimeWindow();
+                                               localProcess = addLocalProcess(process, timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId());
+                                       }
+
+                                       // Call the function that does the actual drawing
+                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                       process, localProcess, params);
+
+                               } else {
+                                       TraceDebug
+                                                       .debug("Running process is null! (getProcessExitHandler)"); //$NON-NLS-1$
+                               }
+
+                               return false;
+                       }
+               };
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_PROCESS_FREE
+        * </p>
+        * Replace C function named "before_process_release_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_PID
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getProcessFreeHandler() {
+               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                               // PID of the process to release
+                               Long release_pid = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_PID);
+
+                               if ((release_pid != null)) {
+                                       LttngProcessState process = lttv_state_find_process(
+                                                       traceSt, ANY_CPU, release_pid);
+                                       if (process != null) {
+
+                                               // Replace the C call :
+                                               // hashed_process_data =
+                                               // processlist_get_process_data(process_list,pid,process->cpu,&birth,trace_num);
+                                               TimeRangeEventProcess localProcess = procContainer
+                                                               .findProcess(process.getPid(), process.getCpu(), traceSt
+                                                                               .getTraceId(), process
+                                        .getCreation_time());
+
+                                               // This is as it was in the C ... ?
+                                               if (localProcess == null) {
+                                                       return false;
+                                               }
+
+                                               // Perform the drawing
+                                               makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                               process,
+                                                               localProcess, params);
+                                       }
+                               } else {
+                                       TraceDebug
+                                                       .debug("Release_pid is null! (getProcessFreeHandler)"); //$NON-NLS-1$
+                               }
+
+                               return false;
+                       }
+               };
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_STATEDUMP_END
+        * </p>
+        * Replace C function named "before_statedump_end" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getStateDumpEndHandler() {
+               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               // What's below should replace the following call in C :
+                               // ClosureData closure_data;
+                               // closure_data.events_request = events_request;
+                               // closure_data.tss = tss;
+                               // closure_data.end_time = evtime;
+                               // convert_time_to_pixels(time_window,evtime,width,&closure_data.x_end);
+                               // g_hash_table_foreach(process_list->process_hash,
+                               // draw_closure,(void*)&closure_data);
+                               //
+                               // And the draw is always the same then...
+
+                               // The c-library loops through the local processes, search for
+                               // the local processes in the state provider and then draws
+                               // If it's present is the local processes why shuldn't they be
+                               // present in the state provider?
+                               // This seems more direct. and makes sure all processes are
+                               // reflected in the control flow view.
+                               LttngProcessState[] processes = traceSt.getProcesses();
+                               for (int pos=0; pos < processes.length; pos++) {
+                                       LttngProcessState process = processes[pos];
+                                       
+                                       // Replace the C call :
+                                       // hashed_process_data =
+                                       // processlist_get_process_data(process_list,pid,process->cpu,&birth,trace_num);
+                                       TimeRangeEventProcess localProcess = procContainer
+                                                       .findProcess(process.getPid(), process.getCpu(), traceSt
+                                                                       .getTraceId(), process
+                                    .getCreation_time());
+
+                                       // Add process to process list if not present
+                                       if (localProcess == null) {
+                                               TmfTimeRange timeRange = traceSt.getContext()
+                                                               .getTraceTimeWindow();
+                                               localProcess = addLocalProcess(process, timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId());
+                                       }
+
+                                       // Call the function that will does the actual
+                                       // drawing
+                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                       process, localProcess, params);
+                               }
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowEventToHandlerFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowEventToHandlerFactory.java
new file mode 100644 (file)
index 0000000..46482fc
--- /dev/null
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+
+/**
+ * Builds a Map from string event name to a processing handler object, the
+ * processors implement the same interface to facilitate transparent methods
+ * call,
+ * 
+ * The map key STring is the entry point of the raw events, using a hash speeds
+ * up the resolution of the appropriate processor
+ * 
+ * @author alvaro
+ * 
+ */
+public class FlowEventToHandlerFactory extends AbsEventToHandlerResolver {
+       // ========================================================================
+       // Data
+       // =======================================================================
+       private final Map<String, ILttngEventProcessor> eventNametoBeforeProcessor = new HashMap<String, ILttngEventProcessor>();
+       private final Map<String, ILttngEventProcessor> eventNametoAfterProcessor = new HashMap<String, ILttngEventProcessor>();
+       private ILttngEventProcessor finishProcesor = null;
+       private static FlowEventToHandlerFactory instance = null;
+       private FlowBeforeUpdateHandlers instantiateBeforeHandler = new FlowBeforeUpdateHandlers();
+       private FlowAfterUpdateHandlers instantiateAfterHandler = new FlowAfterUpdateHandlers();
+
+       // ========================================================================
+       // Constructors
+       // =======================================================================
+       private FlowEventToHandlerFactory() {
+               super();
+               // Create one instance of each individual event handler and add the
+               // instance to the map
+
+               // BEFORE HOOKS
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SYSCALL_ENTRY.getInName(),
+                               instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SYSCALL_EXIT.getInName(),
+                               instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_ENTRY
+                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_EXIT
+                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_ENTRY.getInName(),
+                               instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_EXIT.getInName(),
+                               instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
+                                               .getInName(), instantiateBeforeHandler
+                                               .getStateModesHandler());
+
+               eventNametoBeforeProcessor
+                               .put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
+                                               .getInName(), instantiateBeforeHandler
+                                               .getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_ENTRY
+                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_EXIT
+                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_ENTRY.getInName(),
+                               instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_EXIT.getInName(),
+                               instantiateBeforeHandler.getStateModesHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
+                               instantiateBeforeHandler.getBeforeSchedChangeHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PROCESS_EXIT.getInName(),
+                               instantiateBeforeHandler.getProcessExitHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PROCESS_FREE.getInName(),
+                               instantiateBeforeHandler.getProcessFreeHandler());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_STATEDUMP_END.getInName(),
+                               instantiateBeforeHandler.getStateDumpEndHandler());
+
+
+               // AFTER HOOKS
+               eventNametoAfterProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
+                               instantiateAfterHandler.getSchedChangeHandler());
+
+               eventNametoAfterProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PROCESS_FORK.getInName(),
+                               instantiateAfterHandler.getProcessForkHandler());
+
+               eventNametoAfterProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PROCESS_EXIT.getInName(),
+                               instantiateAfterHandler.getProcessExitHandler());
+
+               eventNametoAfterProcessor.put(StateStrings.Events.LTT_EVENT_EXEC
+                               .getInName(), instantiateAfterHandler.getProcessExecHandler());
+
+               eventNametoAfterProcessor.put(
+                               StateStrings.Events.LTT_EVENT_THREAD_BRAND.getInName(),
+                               instantiateAfterHandler.GetThreadBrandHandler());
+
+               eventNametoAfterProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PROCESS_STATE.getInName(),
+                               instantiateAfterHandler.getEnumProcessStateHandler());
+
+               finishProcesor = new FlowFinishUpdateHandler();
+       }
+
+       // ========================================================================
+       // Public methods
+       // =======================================================================
+       /**
+        * The event processors are common to all traces an multiple instances will
+        * use more memory unnecessarily
+        * 
+        * @return
+        */
+       public static AbsEventToHandlerResolver getInstance() {
+               if (instance == null) {
+                       instance = new FlowEventToHandlerFactory();
+               }
+               return instance;
+       }
+
+       @Override
+       public ILttngEventProcessor getAfterProcessor(String eventType) {
+               return eventNametoAfterProcessor.get(eventType);
+       }
+
+       @Override
+       public ILttngEventProcessor getBeforeProcessor(String eventType) {
+               return eventNametoBeforeProcessor.get(eventType);
+       }
+
+       @Override
+       public ILttngEventProcessor getfinishProcessor() {
+               return finishProcesor;
+       }
+
+       @Override
+       public ILttngEventProcessor getStateUpdaterProcessor(String eventType) {
+               return null;
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowFinishUpdateHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/evProcessor/FlowFinishUpdateHandler.java
new file mode 100644 (file)
index 0000000..2bf11c6
--- /dev/null
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon - Initial implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.evProcessor;
+
+import java.util.Vector;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeComponent;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEvent;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventProcess;
+
+/**
+ * Creates specific finish state data request
+ * 
+ * @author alvaro
+ * 
+ */
+public class FlowFinishUpdateHandler extends AbsFlowTRangeUpdate
+               implements ILttngEventProcessor {
+
+       public Events getEventHandleType() {
+               // No specific event
+               return null;
+       }
+
+       @SuppressWarnings("deprecation")
+       @Override
+       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+               // The end of the last state is unknown since it's beyond the requested time range window. Create this last
+               // event to half page after the visible window but not beyond the end of trace
+               long endOfTrace = traceSt.getContext().getTraceTimeWindow().getEndTime().getValue();
+               long halfWindow = (params.getEndTime() - params.getStartTime()) / 2;
+
+               // End of event common to all processes within the trace for this specific request
+               long endOfEvent = params.getEndTime() + halfWindow;
+               if (endOfEvent > endOfTrace) {
+                       endOfEvent = endOfTrace;
+               }
+
+               TraceDebug.debug("Number of localProcesses: " + procContainer.readItems().length); //$NON-NLS-1$
+               // to identify the process relevant to the traceState
+               String traceId = traceSt.getTraceId();
+               int numLocalFound = 0;
+               int numLocalNotFound = 0;
+               int numWithNoChildren = 0;
+               for (TimeRangeEventProcess localProcess : procContainer.readItems()) {
+                       LttngProcessState stateProcess = lttv_state_find_process(traceSt,
+                                       localProcess.getCpu(), localProcess.getPid());
+
+                       // Drawing the last state for processes related to the current trace
+                       // id.
+                       if (!localProcess.getTraceID().equals(traceId)) {
+                               continue;
+                       }
+
+                       // Check if the process is in the state provider, it is the case
+                       // when the requested time frame did not include any events for a
+                       // process
+                       if (stateProcess == null) {
+                               // Get Start time from the end time of previous event
+                               Vector<TimeRangeComponent> childrenEvents = localProcess
+                                               .getTraceEvents();
+                               long nextGoodTime;
+                               String stateMode;
+                               if (childrenEvents.size() > 0) {
+                                       TimeRangeComponent prevEvent = childrenEvents
+                                                       .get(childrenEvents.size() - 1);
+                                       if (prevEvent instanceof TimeRangeEvent) {
+                                               TimeRangeEvent prevTimeRange = (TimeRangeEvent) prevEvent;
+                                               // calculate the next good time to draw the event
+                                               // nextGoodTime = prevTimeRange.getStopTime() + 1;
+                                               nextGoodTime = localProcess.getNext_good_time();
+                                               stateMode = prevTimeRange.getStateMode();
+
+                                               // Draw with the Local information since the current
+                                               // request did
+                                               // not contain events related to this process
+                                               makeDraw(traceSt, nextGoodTime, endOfEvent, localProcess, params, stateMode);
+                                       } else {
+                                               TraceDebug.debug("previous event not instance of TimeRangeEvent?: " //$NON-NLS-1$
+                                                               + prevEvent.getClass().getSimpleName());
+                                       }
+                               } else {
+                                       numWithNoChildren++;
+                               }
+
+                               numLocalNotFound++;
+                               continue;
+                       }
+
+                       numLocalFound++;
+                       // Draw the last state for this process
+                       makeDraw(traceSt, endOfEvent, stateProcess, localProcess, params);
+               }
+
+               TraceDebug.debug("Print Last Event: NumLocalFound " + numLocalFound      //$NON-NLS-1$
+                               + "; NumLocalNotFound: " + numLocalNotFound //$NON-NLS-1$
+                               + "; NumWithNoChildren: " + numWithNoChildren); //$NON-NLS-1$
+
+               return false;
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/messages.properties
new file mode 100644 (file)
index 0000000..9c42384
--- /dev/null
@@ -0,0 +1,35 @@
+ControlFlowView.Action.Filter=Filter\r
+ControlFlowView.Action.Filter.ToolTip=Process Filter options\r
+ControlFlowView.Action.Legend=Legend\r
+ControlFlowView.Action.Legend.ToolTip=Show Legend\r
+ControlFlowView.Action.LoadData=LoadData\r
+ControlFlowView.Action.LoadData.ToolTip=Load data from external plug-in\r
+ControlFlowView.Action.NextEvent=NextEv\r
+ControlFlowView.Action.NextEvent.Tooltip=Next Event\r
+ControlFlowView.Action.NextProcess=NextProcess\r
+ControlFlowView.Action.NextProcess.ToolTip=Select Next Process\r
+ControlFlowView.Action.PrevEvent=PrevEv\r
+ControlFlowView.Action.PrevEvent.Tooltip=Previous Event\r
+ControlFlowView.Action.PreviousProcess=PreviousProcess\r
+ControlFlowView.Action.PreviousProcess.Tooltip=Select Previous Process\r
+ControlFlowView.Action.Reset=Reset\r
+ControlFlowView.Action.Reset.ToolTip=Reset the Time Scale to Default\r
+ControlFlowView.Action.Synchronize=Synchronize\r
+ControlFlowView.Action.Synchronize.ToolTip=Synchronize by listening to external API selection calls\r
+ControlFlowView.Action.ZoomIn=Zoom In\r
+ControlFlowView.Action.ZoomIn.Tooltip=Zoom In\r
+ControlFlowView.Action.ZoomOut=Zoom Out\r
+ControlFlowView.Action.ZoomOut.tooltip=Zoom Out\r
+ControlFlowView.Action.ZoomFilter=Zoom Filter\r
+ControlFlowView.Action.ZoomFilter.tooltip=Display elements with events within the zoomed time window\r
+ControlFlowView.birthNSecColumn=Birth nsec\r
+ControlFlowView.birthSecColumn=Birth sec\r
+ControlFlowView.brandColumn=Brand\r
+ControlFlowView.cpuColumn=CPU\r
+ControlFlowView.msgSlogan=Control Flow View\r
+ControlFlowView.pidColumn=PID\r
+ControlFlowView.ppidColumn=PPID\r
+ControlFlowView.processColumn=Process\r
+ControlFlowView.tgidColumn=TGID\r
+ControlFlowView.tmf.UI=org.eclipse.linuxtools.tmf.ui\r
+ControlFlowView.TraceNameColumn=TRACE\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowModelFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowModelFactory.java
new file mode 100644 (file)
index 0000000..7047c07
--- /dev/null
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model;
+
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+
+/**
+ * Instantiates the entry point classes to build the data model for this view
+ * 
+ * @author alvaro
+ * 
+ */
+public class FlowModelFactory {
+       // ========================================================================
+       // Data
+       // ========================================================================
+       private static FlowProcessContainer procContainer = null;
+       private static ParamsUpdater updater = null;
+       
+       
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       /**
+        * Get Process data container
+        * @return
+        */
+       public static FlowProcessContainer getProcContainer() {
+               if (procContainer == null) {
+                       procContainer = new FlowProcessContainer();
+               }
+               return procContainer;
+       }
+       
+       public static ParamsUpdater getParamsUpdater() {
+               if (updater == null) {
+                       updater = new ParamsUpdater();
+               }
+               return updater;
+       }
+       
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowProcessContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowProcessContainer.java
new file mode 100644 (file)
index 0000000..6b2c78e
--- /dev/null
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.linuxtools.internal.lttng.core.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.ItemContainer;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventProcess;
+
+/**
+ * Contains the processes in use by the Control flow view
+ * 
+ * @author alvaro
+ * 
+ */
+public class FlowProcessContainer implements ItemContainer<TimeRangeEventProcess> {
+       // ========================================================================
+       // Data
+       // ========================================================================
+       private final HashMap<ProcessKey, TimeRangeEventProcess> allProcesses = new HashMap<ProcessKey, TimeRangeEventProcess>();
+       private static Integer uniqueId = 0;
+       
+       // ========================================================================
+       // Constructor
+       // ========================================================================
+
+       /**
+        * Package level constructor
+        */
+       FlowProcessContainer() {
+
+       }
+
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       /**
+        * Interface to add a new process.<p>
+        * 
+        * Note : Process with the same key will be overwritten, it's calling function job to make sure the new process is unique.
+        * 
+        * @param newProcess   The process to add
+        */
+       @Override
+       public void addItem(TimeRangeEventProcess newItem) {
+               if (newItem != null) {
+                       allProcesses.put(new ProcessKey(newItem), newItem);
+               }
+       }
+       
+       /**
+     * Request a unique ID
+     * 
+     * @return Integer
+     */
+    @Override
+       public Integer getUniqueId() {
+        return uniqueId++;
+    }
+    
+    /**
+     * This method is intended for read only purposes in order to keep the
+     * internal data structure in synch
+     * 
+     * @return TimeRangeEventProcess[]
+     */
+       @Override
+       public TimeRangeEventProcess[] readItems() {
+               
+           // This allow us to return an Array of the correct type of the exact correct dimension, without looping
+               return allProcesses.values().toArray(new TimeRangeEventProcess[allProcesses.size()]);
+       }
+       
+       /**
+        * Clear the children information for processes e.g. just before refreshing
+        * data with a new time range
+        */
+       @Override
+       public void clearChildren() {
+           TimeRangeEventProcess process = null;
+        Iterator<ProcessKey> iterator = allProcesses.keySet().iterator();
+        
+        while (iterator.hasNext()) {
+            process = allProcesses.get(iterator.next());
+                       process.reset();
+        }
+       }
+       
+       /**
+     * Clear all process items
+     */
+    @Override
+       public void clearItems() {
+        allProcesses.clear();
+    }
+       
+    /**
+     * Remove the process related to a specific trace e.g. during trace
+     * removal
+     * 
+     * @param traceId   The trace unique id (trace name?) on which we want to remove process
+     */
+       @Override
+       public void removeItems(String traceId) {
+           ProcessKey iterKey = null;
+
+        Iterator<ProcessKey> iterator = allProcesses.keySet().iterator();
+        while (iterator.hasNext()) {
+            iterKey = iterator.next();
+            
+            if (allProcesses.get(iterKey).getTraceID().equals(traceId)) {
+                allProcesses.remove(iterKey);
+            }
+        }
+       }
+       
+    /**
+     * Search by keys (pid, cpuId, traceId and creationTime)<p>
+     * 
+     * A match is returned if the four arguments received match an entry
+     *  Otherwise null is returned
+     *  
+     * @param searchedPid       The processId (Pid) we are looking for
+     * @param searchedCpuId     The cpu Id we are looking for
+     * @param searchedTraceID   The traceId (trace name?) we are looking for
+     * @param searchedCreationtime The creation time we are looking for
+     * 
+     * @return TimeRangeEventProcess
+     */
+    public TimeRangeEventProcess findProcess(Long searchedPid, Long searchedCpuId, String searchedTraceID, Long searchedCreationtime) {
+       // Get the TimeRangeEventProcess associated to a key we create here
+        TimeRangeEventProcess foundProcess = allProcesses.get( new ProcessKey(searchedPid, searchedCpuId, searchedTraceID, searchedCreationtime) );
+        
+        return foundProcess;
+    }
+}
+
+
+class ProcessKey {
+    private TimeRangeEventProcess valueRef = null;
+    
+    private Long    pid = null;
+    private Long    cpuId = null;
+    private String  traceId = null;
+    private Long    creationtime = null;
+    
+    @SuppressWarnings("unused")
+    private ProcessKey() { }
+    
+    public ProcessKey(TimeRangeEventProcess newRef) {
+        valueRef = newRef;
+    }
+    
+    public ProcessKey(Long newPid, Long newCpuId, String newTraceId, Long newCreationTime) {
+        pid = newPid;
+        cpuId = newCpuId;
+        traceId = newTraceId;
+        creationtime = newCreationTime;
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this)
+            return true;
+        if (obj == null)
+            return false;
+
+        boolean isSame = false;
+        
+        if ( obj instanceof ProcessKey ) {
+               ProcessKey procKey = (ProcessKey) obj;
+               
+                       if (valueRef != null) {
+                               if ((procKey.getPid().equals(valueRef.getPid()))
+                                               && (procKey.getTraceId().equals(valueRef.getTraceID()))
+                                               && (procKey.getCreationtime().equals(valueRef.getCreationTime()))) {
+                                       // use the cpu value to validate pid 0
+                                       if (valueRef.getPid().longValue() == 0L && !procKey.getCpuId().equals(valueRef.getCpu())) {
+                                               isSame = false;
+                                       } else {
+                                               isSame = true;
+                                       }
+                               }
+                       } else {
+                               if ((procKey.getPid().equals(this.pid)) && (procKey.getTraceId().equals(this.traceId))
+                                               && (procKey.getCreationtime().equals(this.creationtime))) {
+                                       // use the cpu value to validate pid 0
+                                       if (this.pid.longValue() == 0L && !procKey.getCpuId().equals(this.cpuId)) {
+                                               isSame = false;
+                                       } else {
+                                               isSame = true;
+                                       }
+                               }
+                       }
+        }
+        else {
+               TraceDebug.debug("ERROR : The given key is not of the type ProcessKey!" + obj.getClass().toString()); //$NON-NLS-1$
+        }
+        
+        return isSame;
+    }
+    
+    // *** WARNING : Everything in there work because the check "valueRef != null" is the same for ALL getter
+    // Do NOT change this check without checking.
+    public Long getPid() {
+       if ( valueRef != null ) {
+            return valueRef.getPid();
+        }
+        else {
+            return pid;
+        }
+    }
+
+    public Long getCpuId() {
+        if ( valueRef != null ) {
+            return valueRef.getCpu();
+        }
+        else {
+            return cpuId;
+        }
+    }
+    
+    public String getTraceId() {
+        if ( valueRef != null ) {
+            return valueRef.getTraceID();
+        }
+        else {
+            return traceId;
+        }
+    }
+    
+    public Long getCreationtime() {
+        if ( valueRef != null ) {
+            return valueRef.getCreationTime();
+        }
+        else {
+            return creationtime;
+        }
+    }
+    
+    @Override
+    public int hashCode() {
+       return this.toString().hashCode();
+    }
+    
+    
+       @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+        if ( valueRef != null ) {
+                       // return (valueRef.getPid().toString() + ":" +
+                       // valueRef.getCpu().toString() + ":"
+                       // + valueRef.getTraceID().toString() + ":" +
+                       // valueRef.getCreationTime().toString());
+                       return (valueRef.getPid().toString() + ":" + valueRef.getTraceID().toString() + ":" + valueRef
+                                       .getCreationTime().toString());
+        } 
+        
+               // return (pid.toString() + ":" + cpuId.toString() + ":" +
+               // traceId.toString() + ":" + creationtime.toString());
+
+               return (pid.toString() + ":" + traceId.toString() + ":" + creationtime.toString());
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowTimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/controlflow/model/FlowTimeRangeViewerProvider.java
new file mode 100644 (file)
index 0000000..76e8ab7
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.controlflow.model;
+
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeViewerProvider;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+
+public class FlowTimeRangeViewerProvider extends TimeRangeViewerProvider {
+
+       public FlowTimeRangeViewerProvider(ParamsUpdater paramsUpdater) {
+               super(paramsUpdater);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider
+        * #getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
+        * TmfTimeAnalysisProvider.StateColor)
+        */
+       @Override
+       public String getStateName(StateColor color) {
+               // Override to multiple instances of the widget, the same color can have
+               // multiple meanings
+               boolean isInProcess = procStateToColor.containsValue(color);
+               
+               if (isInProcess) {
+                       return findObject(color, procStateToColor);
+               }
+               return super.getStateName(color);
+       }
+
+       
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/DistributionData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/DistributionData.java
new file mode 100644 (file)
index 0000000..0fc3b5f
--- /dev/null
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model;
+
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.Config;
+import org.eclipse.linuxtools.tmf.ui.views.distribution.model.BaseDistributionData;
+
+/**
+ * <b><u>DistributionData</u></b>
+ * <p>
+ * The algorithm is based on the algorithm for the Histogram. The difference is that
+ * it supports two dimensions. For more details about the model principle 
+ * @see org.eclipse.linuxtools.lttng.ui.views.histogram.HistogramDataModel 
+ * <p>
+ */
+abstract public class DistributionData extends BaseDistributionData {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * Flag to indicate if given timestamp is the first one to count 
+     */
+    protected boolean fIsFirst;
+    
+    /**
+     *  reference to fBuckets
+     */
+    protected final int [][] fBuckets;
+    
+    /**
+     * Time limit (current available longest time)
+     */
+    protected long fTimeLimit;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    public DistributionData(int[][] buckets) {
+        this(Config.DEFAULT_NUMBER_OF_BUCKETS, buckets);
+    }
+
+    public DistributionData(int nbBuckets, int[][] buckets) {
+        super(nbBuckets);
+        fBuckets = buckets;
+        clear();
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+   
+    public long getTimeLimit() {
+        return fTimeLimit;
+    }
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.BaseDistributionData#clear()
+     */
+    @Override
+    public void clear() {
+        super.clear();
+        fIsFirst = true;
+        updateEndTime();
+    }
+
+    public boolean isFirst() {
+        return fIsFirst;
+    }
+
+    public int countEvent(long timestamp) {
+
+        // Set the start/end time if not already done
+        if (fIsFirst) {
+            fIsFirst = false;
+            fFirstBucketTime = timestamp;
+            fFirstEventTime = timestamp;
+
+            updateEndTime();
+        }
+
+        // save first event time if necessary 
+        if (timestamp < fFirstEventTime) {
+            fFirstEventTime = timestamp;
+        }
+
+        // save last event time if necessary
+        if (fLastEventTime < timestamp) {
+            fLastEventTime = timestamp;
+        }
+
+        
+        if (timestamp >= fFirstBucketTime) {
+            // Compact as needed
+            while (timestamp >= fTimeLimit) {
+                mergeBuckets();
+            }
+
+        } else {
+
+            // Get offset for buckets adjustment
+            int offset = getOffset(timestamp);
+
+            // Compact as needed
+            while (fLastBucket + offset >= fNbBuckets) {
+                mergeBuckets();
+                offset = getOffset(timestamp);
+            }
+
+            // Move buckets with offset (to right)
+            moveBuckets(offset);
+
+            // Adjust start/end time and index 
+            fLastBucket = fLastBucket + offset;
+            fFirstBucketTime = fFirstBucketTime - offset * fBucketDuration;
+            updateEndTime();
+        }
+
+        // Increment the right bucket
+        int index = (int) ((timestamp - fFirstBucketTime) / fBucketDuration);
+
+        if (fLastBucket < index) {
+            fLastBucket = index;
+        }
+
+        return index;
+    }
+
+    // ------------------------------------------------------------------------
+    // Abstract 
+    // ------------------------------------------------------------------------
+    
+    /**
+     * Moves content of buckets with the given offset in positive direction. 
+     * It has to be implemented accordingly in the relevant sub-classes for 
+     * horizontal and vertical direction.  
+     * 
+     * @param buckets - 2-dimensional array of buckets 
+     * @param offset - offset to move
+     */
+    abstract protected void moveBuckets(int offset);
+    
+    /**
+     * Merges buckets if end time is exceeded. It has to be implemented 
+     * accordingly in the relevant sub-classes for horizontal and 
+     * vertical direction.
+     * @param buckets
+     */
+    abstract protected void mergeBuckets();
+
+    // ------------------------------------------------------------------------
+    // Helper Functions
+    // ------------------------------------------------------------------------
+    protected int getOffset(long timestamp) {
+        int offset = (int) ((fFirstBucketTime - timestamp) / fBucketDuration);
+        if ((fFirstBucketTime - timestamp) % fBucketDuration != 0) {
+            offset++;
+        }
+        return offset;
+    }
+    
+    protected void updateEndTime() {
+        fTimeLimit = fFirstBucketTime + fNbBuckets * fBucketDuration;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/HorDistributionData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/HorDistributionData.java
new file mode 100644 (file)
index 0000000..30363bd
--- /dev/null
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model;
+
+/**
+ * <b><u>HorDistributionData</u></b>
+ * <p>
+ * Implementation of DistributionData for horizontal direction.
+ */
+public class HorDistributionData extends DistributionData {
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    public HorDistributionData(int nbBuckets, int[][] buckets) {
+        super(nbBuckets, buckets);
+    }
+
+    // ------------------------------------------------------------------------
+    // Abstract function implementation
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#moveBuckets(int)
+     */
+    @Override
+    protected void moveBuckets(int offset) {
+        for (int j = 0; j < fNbBuckets; j++) {
+
+            for(int i = fNbBuckets - 1; i >= offset; i--) {
+                fBuckets[i][j] = fBuckets[i-offset][j]; 
+            }
+
+            for (int i = 0; i < offset; i++) {
+                fBuckets[i][j] = 0;
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#mergeBuckets()
+     */
+    @Override
+    protected void mergeBuckets() {
+
+        for (int y = 0; y < fNbBuckets; y++) {
+            for (int i = 0; i < fNbBuckets / 2; i++) {
+                fBuckets[i][y] = fBuckets[2 * i][y] + fBuckets[2 * i + 1][y];
+            }
+
+            for (int i = fNbBuckets / 2; i < fNbBuckets; i++) {
+                fBuckets[i][y] = 0;
+            }
+        }
+        fBucketDuration = fBucketDuration * 2;
+        updateEndTime();
+        fLastBucket = fNbBuckets / 2 - 1;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/VerDistributionData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/distribution/model/VerDistributionData.java
new file mode 100644 (file)
index 0000000..2cd2fa8
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model;
+
+/**
+ * <b><u>VerDistributionData</u></b>
+ * 
+ * Implementation of DistributionData for vertical direction. 
+ * <p>
+ */
+public class VerDistributionData extends DistributionData {
+    
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+    public VerDistributionData(int nbBuckets, int[][] buckets) {
+        super(nbBuckets, buckets);
+    }
+
+    // ------------------------------------------------------------------------
+    // Abstract function implementation
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#moveBuckets(int)
+     */
+    @Override
+    protected void moveBuckets(int offset) {
+        for (int j = 0; j < fNbBuckets; j++) {
+
+            for(int i = fNbBuckets - 1; i >= offset; i--) {
+                fBuckets[j][i] = fBuckets[j][i-offset]; 
+            }
+
+            for (int i = 0; i < offset; i++) {
+                fBuckets[j][i] = 0;
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#mergeBuckets()
+     */
+    @Override
+    protected void mergeBuckets() {
+        for (int x = 0; x < fNbBuckets; x++) {
+            for (int i = 0; i < fNbBuckets / 2; i++) {
+                fBuckets[x][i] = fBuckets[x][2 * i] + fBuckets[x][2 * i + 1];
+            }
+            for (int i = fNbBuckets / 2; i < fNbBuckets; i++) {
+                fBuckets[x][i] = 0;
+            }
+        }
+        fBucketDuration = fBucketDuration * 2;
+        updateEndTime();
+        fLastBucket = fNbBuckets / 2 - 1;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/EventsTable.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/EventsTable.java
new file mode 100644 (file)
index 0000000..8952ba7
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009, 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Francois Chouinard - Initial API and implementation\r
+ *   Francois Chouinard - Aligned columns with domain terminology\r
+ *******************************************************************************/\r
+\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.events;\r
+\r
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;\r
+import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;\r
+import org.eclipse.linuxtools.tmf.ui.widgets.ColumnData;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+\r
+public class EventsTable extends TmfEventsTable {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Table data\r
+    // ------------------------------------------------------------------------\r
+\r
+    // Table column names\r
+    static private final String TIMESTAMP_COLUMN = Messages.EventsTable_timestampColumn;\r
+    static private final String TRACE_COLUMN = Messages.EventsTable_traceColumn;\r
+    static private final String MARKER_COLUMN = Messages.EventsTable_markerColumn;\r
+    static private final String CONTENT_COLUMN = Messages.EventsTable_contentColumn;\r
+    static private final String[] COLUMN_NAMES = new String[] {\r
+            TIMESTAMP_COLUMN,\r
+            TRACE_COLUMN,\r
+            MARKER_COLUMN,\r
+            CONTENT_COLUMN\r
+    };\r
+\r
+    static private final ColumnData[] COLUMN_DATA = new ColumnData[] {\r
+            new ColumnData(COLUMN_NAMES[0], 150, SWT.LEFT),\r
+            new ColumnData(COLUMN_NAMES[1], 120, SWT.LEFT),\r
+            new ColumnData(COLUMN_NAMES[2], 200, SWT.LEFT),\r
+            new ColumnData(COLUMN_NAMES[3], 100, SWT.LEFT)\r
+    };\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructor\r
+    // ------------------------------------------------------------------------\r
+\r
+    public EventsTable(Composite parent, int cacheSize) {\r
+        super(parent, cacheSize, COLUMN_DATA);\r
+        fTable.getColumns()[0].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP);\r
+        fTable.getColumns()[1].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_REFERENCE);\r
+        fTable.getColumns()[2].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TYPE);\r
+        fTable.getColumns()[3].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_CONTENT);\r
+    }\r
+\r
+    /**\r
+     * @param event\r
+     * @return\r
+     */\r
+    @Override\r
+    protected ITmfEventField[] extractItemFields(TmfEvent event) {\r
+        ITmfEventField[] fields = new TmfEventField[0];\r
+        if (event != null) {\r
+            fields = new TmfEventField[] {\r
+                     new TmfEventField(ITmfEvent.EVENT_FIELD_TIMESTAMP, ((Long) event.getTimestamp().getValue()).toString()),\r
+                     new TmfEventField(ITmfEvent.EVENT_FIELD_REFERENCE, event.getReference()),\r
+                     new TmfEventField(ITmfEvent.EVENT_FIELD_TYPE, event.getType().getName()),\r
+                     new TmfEventField(ITmfEvent.EVENT_FIELD_CONTENT, event.getContent().toString())\r
+                    };\r
+        }\r
+        return fields;\r
+    }\r
+\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/Messages.java
new file mode 100644 (file)
index 0000000..5e51094
--- /dev/null
@@ -0,0 +1,18 @@
+package org.eclipse.linuxtools.internal.lttng.ui.views.events;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.events.messages"; //$NON-NLS-1$
+       public static String EventsTable_traceColumn;
+       public static String EventsTable_timestampColumn;
+       public static String EventsTable_markerColumn;
+    public static String EventsTable_contentColumn;
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+       }
+
+       private Messages() {
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/events/messages.properties
new file mode 100644 (file)
index 0000000..4e6dfa8
--- /dev/null
@@ -0,0 +1,4 @@
+EventsTable_traceColumn=Trace
+EventsTable_timestampColumn=Timestamp
+EventsTable_markerColumn=Marker
+EventsTable_contentColumn=Content
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/AbstractViewer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/AbstractViewer.java
new file mode 100644 (file)
index 0000000..889ae3c
--- /dev/null
@@ -0,0 +1,255 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.AbstractMouseListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.AbstractMouseTrackListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.AbstractPaintListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.ZoomListener;\r
+import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.SWTException;\r
+import org.eclipse.swt.widgets.Canvas;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Display;\r
+\r
+/**\r
+ * <b><u>AbstractViewer</u></b>\r
+ * <p>\r
+ * Abstract viewer.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public abstract class AbstractViewer extends Canvas {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Parent composite node.\r
+     */\r
+    protected Composite fParent;\r
+\r
+    /**\r
+     * Paint listener.\r
+     */\r
+    protected AbstractPaintListener fPaintListener;\r
+\r
+    /**\r
+     * Zoom listener, to zoom in and out of a graph using the scroll wheel.\r
+     */\r
+    protected ZoomListener fZoomListener;\r
+\r
+    /**\r
+     * Tool tip listener.\r
+     */\r
+    protected AbstractMouseTrackListener fMouseTraceListener;\r
+\r
+    /**\r
+     * Mouse listener\r
+     */\r
+    protected AbstractMouseListener fMouseListener;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructor\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Constructor.\r
+     * @param parent\r
+     *            The parent composite node.\r
+     * @param style\r
+     *            The SWT style to use to render the view.\r
+     */\r
+    public AbstractViewer(Composite parent, int style) {\r
+        super(parent, style);\r
+\r
+        fParent = parent;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Abstract interface\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Clears the view.\r
+     */\r
+    abstract public void clear();\r
+\r
+    /**\r
+     * Clears the background of the view but keeps min and max values.\r
+     */\r
+    abstract public void clearBackground();\r
+\r
+    /**\r
+     * Method to increase bar width\r
+     */\r
+    abstract public void increaseBarWidth();\r
+    \r
+    /**\r
+     * Method to decrease bar width\r
+     */\r
+    abstract public void decreaseBarWidth();\r
+\r
+    /**\r
+     * Return data model\r
+     */\r
+    abstract public IBaseDistributionModel getModel();\r
+    \r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Accessors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Returns the zoom factor for the canvas.\r
+     * @return The zoom factor for the canvas.\r
+     */\r
+    public int getZoomFactor() {\r
+        if (fZoomListener != null) {\r
+            return fZoomListener.getZoomFactor();\r
+        } else {\r
+            return 1;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Returns the zoom increment for the canvas.\r
+     * @return The zoom increment for the canvas.\r
+     */\r
+    public int getZoomIncrement() {\r
+        if (fZoomListener != null) {\r
+            return fZoomListener.getZoomIncrement();\r
+        } else {\r
+            return 1;\r
+        }\r
+    }\r
+\r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Draw horizontal label each "nbTicks" ticks.\r
+     * @param nbTicks\r
+     *            The draw interval.\r
+     */\r
+    public void setDrawLabelEachNTicks(int nbTicks) {\r
+        fPaintListener.setDrawLabelEachNTicks(nbTicks);\r
+    }\r
+\r
+    /**\r
+     * Sets the title of the graph.\r
+     * @param graphTitle\r
+     *            The title of the graph.\r
+     */\r
+    public void setGraphTitle(String graphTitle) {\r
+        fPaintListener.setGraphTitle(graphTitle);\r
+    }\r
+\r
+    /**\r
+     * Sets the horizontal axis label.\r
+     * @param xLabel\r
+     *            The horizontal axis label.\r
+     * @param offset\r
+     *            The horizontal axis draw offset (in pixels).\r
+     */\r
+    public void setXAxisLabel(String xLabel, int offset) {\r
+        fPaintListener.setXAxisLabel(xLabel, offset);\r
+    }\r
+\r
+    /**\r
+     * Sets the vertical axis label.\r
+     * @param yLabel\r
+     *            The vertical axis label.\r
+     */\r
+    public void setYAxisLabel(String yLabel) {\r
+        fPaintListener.setYAxisLabel(yLabel);\r
+    }\r
+\r
+    /**\r
+     * Asks for the view to be redrawn, synchronously or asynchronously.\r
+     * @param asyncRedraw\r
+     *            If "true", the view will be redrawn asynchronously, otherwise it will be redraw synchronously.\r
+     */\r
+    public void askForRedraw(boolean asyncRedraw) {\r
+        if (asyncRedraw == true) {\r
+            Display.getDefault().asyncExec(new Runnable() {\r
+                @Override\r
+                public void run() {\r
+                    try {\r
+                        redraw();\r
+                    } catch (SWTException e) {\r
+                        // ...\r
+                    }\r
+                }\r
+            });\r
+        } else {\r
+            Display.getDefault().syncExec(new Runnable() {\r
+                @Override\r
+                public void run() {\r
+                    try {\r
+                        redraw();\r
+                    } catch (SWTException e) {\r
+                        // ...\r
+                    }\r
+                }\r
+            });\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Asks for the view to be redrawn (asynchronously).\r
+     */\r
+    public void askForRedraw() {\r
+        askForRedraw(true);\r
+    }\r
+\r
+    /**\r
+     * Redraws the title after a zoom to display the new zoom factor.\r
+     */\r
+    public void redrawTitle() {\r
+        fPaintListener.paintGraphTitle();\r
+    }\r
+\r
+    /**\r
+     * Removes the view's listeners before disposing of it.\r
+     */\r
+    @Override\r
+    public void dispose() {\r
+        try {\r
+            if (fPaintListener != null) {\r
+                removePaintListener(fPaintListener);\r
+                fPaintListener = null;\r
+            }\r
+            if (fZoomListener != null) {\r
+                removeListener(SWT.MouseWheel, fZoomListener);\r
+                fZoomListener = null;\r
+            }\r
+            if (fMouseTraceListener != null) {\r
+                removeListener(SWT.MouseMove, fMouseTraceListener);\r
+                fMouseTraceListener = null;\r
+            }\r
+        } catch (SWTException e) {\r
+            // This exception will be thrown if the user closes the view\r
+            // while it is receiving data from the Analyzer.\r
+\r
+            // ...\r
+        }\r
+\r
+        super.dispose();\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/GraphViewer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/GraphViewer.java
new file mode 100644 (file)
index 0000000..ee4593f
--- /dev/null
@@ -0,0 +1,158 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.GraphMouseListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.GraphPaintListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.TimePointerListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.IGraphDataModel;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.IGraphModelListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.LatencyGraphModel;\r
+import org.eclipse.swt.widgets.Composite;\r
+\r
+/**\r
+ * <b><u>GraphViewer</u></b>\r
+ * <p>\r
+ * Graph viewer.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class GraphViewer extends AbstractViewer implements IGraphModelListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Latency graph model\r
+     */\r
+    private LatencyGraphModel fModel;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+       /**\r
+        * Constructor.\r
+        * @param parent The parent composite node.\r
+        * @param style The SWT style to use to render the view.\r
+        */\r
+       public GraphViewer(Composite parent, int style) {\r
+               super(parent, style);\r
+\r
+               // Register the paint listener\r
+               fPaintListener = new GraphPaintListener(this);\r
+               addPaintListener(fPaintListener);\r
+\r
+               // Register the mouse track listener\r
+               fMouseTraceListener = new TimePointerListener(this, (GraphPaintListener)fPaintListener);\r
+               addMouseTrackListener(fMouseTraceListener);\r
+\r
+               // Register mouse listener\r
+               fMouseListener = new GraphMouseListener(this, (GraphPaintListener)fPaintListener);\r
+               addMouseListener(fMouseListener);\r
+\r
+               fModel = new LatencyGraphModel();\r
+        fModel.addGraphModelListener(this);\r
+       }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+       \r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#dispose()\r
+        */\r
+       @Override\r
+       public void dispose() {\r
+           fModel.removeGraphModelListener(this);\r
+           fPaintListener.dispose();\r
+           super.dispose();\r
+       }\r
+       \r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clear()\r
+        */\r
+       @Override\r
+       public void clear() {\r
+               fPaintListener.clear();\r
+       }\r
+       \r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clearBackground()\r
+        */\r
+       @Override\r
+       public void clearBackground() {\r
+               fPaintListener.clear();\r
+       }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#increaseBarWidth()\r
+     */\r
+    @Override\r
+    public void increaseBarWidth() {\r
+        fPaintListener.increaseBarWitdh();\r
+        graphModelUpdated();\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#decreaseBarWidth()\r
+     */\r
+    @Override\r
+    public void decreaseBarWidth() {\r
+        fPaintListener.decreaseBarWitdh();\r
+        graphModelUpdated();\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#getModel()\r
+     */\r
+    @Override\r
+    public IGraphDataModel getModel() {\r
+        return fModel;\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#graphModelUpdated()\r
+     */\r
+    @Override\r
+    public void graphModelUpdated() {\r
+        if (!isDisposed() && getDisplay() != null) {\r
+            getDisplay().asyncExec(new Runnable() {\r
+                @Override\r
+                public void run() {\r
+                    if (!isDisposed()) {\r
+                        redraw();\r
+                    }\r
+                }\r
+            });\r
+        }\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#currentEventUpdated()\r
+     */\r
+    @Override\r
+    public void currentEventUpdated(long currentEventTime) {\r
+        graphModelUpdated();\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/HistogramViewer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/HistogramViewer.java
new file mode 100644 (file)
index 0000000..4576cda
--- /dev/null
@@ -0,0 +1,157 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.HistogramPaintListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.TooltipListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners.ZoomListener;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramModelListener;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+\r
+/**\r
+ * <b><u>HistogramViewer</u></b>\r
+ * <p>\r
+ * \r
+ * Histogram viewer.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class HistogramViewer extends AbstractViewer implements IHistogramModelListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+       /**\r
+        * Usable width for data plotting.\r
+        */\r
+       protected int fUsableWidth;\r
+\r
+       /**\r
+        * Latency histogram model.\r
+        */\r
+       private HistogramDataModel fModel;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+       /**\r
+        * Constructor.\r
+        * @param parent The parent composite node.\r
+        * @param style The SWT style to use to render the view.\r
+        */\r
+       public HistogramViewer(Composite parent, int style) {\r
+               super(parent, style);\r
+               \r
+               // Register the paint listener\r
+               fPaintListener = new HistogramPaintListener(this);\r
+               addPaintListener(fPaintListener);\r
+               \r
+               // Register the zoom listener\r
+               fZoomListener = new ZoomListener(this);\r
+               addListener(SWT.MouseWheel, fZoomListener);\r
+               \r
+               // Register the mouse click listener\r
+               fMouseTraceListener = new TooltipListener(this, (HistogramPaintListener)fPaintListener);\r
+               addMouseTrackListener(fMouseTraceListener);\r
+               \r
+               fModel = new HistogramDataModel();\r
+               fModel.addHistogramListener(this);\r
+       }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#dispose()\r
+        */\r
+       @Override\r
+       public void dispose() {\r
+           fModel.removeHistogramListener(this);\r
+           fPaintListener.dispose();\r
+           super.dispose();\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clear()\r
+        */\r
+       @Override\r
+       public void clear() {\r
+               fPaintListener.clear();\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clearBackground()\r
+        */\r
+       @Override\r
+       public void clearBackground() {\r
+               fPaintListener.clear();\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#increaseBarWidth()\r
+        */\r
+       @Override\r
+    public void increaseBarWidth() {\r
+           fPaintListener.increaseBarWitdh();\r
+           modelUpdated();\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#decreaseBarWidth()\r
+        */\r
+       @Override\r
+    public void decreaseBarWidth() {\r
+           fPaintListener.decreaseBarWitdh();\r
+           modelUpdated();\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#getModel()\r
+        */\r
+       @Override\r
+    public IHistogramDataModel getModel() {\r
+        return fModel;\r
+    }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * @see org.eclipse.linuxtools.lttng.ui.views.histogram.IHistogramModelListener#modelUpdated()\r
+        */\r
+    @Override\r
+    public void modelUpdated() {\r
+        \r
+        if (!isDisposed() && getDisplay() != null) {\r
+            getDisplay().asyncExec(new Runnable() {\r
+                @Override\r
+                public void run() {\r
+                    if (!isDisposed()) {\r
+                        redraw();\r
+                    }\r
+                }\r
+            });\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/LatencyView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/LatencyView.java
new file mode 100644 (file)
index 0000000..ebc14f4
--- /dev/null
@@ -0,0 +1,481 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency;\r
+\r
+import org.eclipse.jface.action.Action;\r
+import org.eclipse.jface.action.IMenuManager;\r
+import org.eclipse.jface.action.IToolBarManager;\r
+import org.eclipse.jface.action.Separator;\r
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs.AddDialog;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs.DeleteDialog;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs.ListDialog;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.Config;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.IGraphModelListener;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.LatencyController;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.LatencyGraphModel;\r
+import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;\r
+import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;\r
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;\r
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;\r
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
+import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.ControlEvent;\r
+import org.eclipse.swt.events.ControlListener;\r
+import org.eclipse.swt.layout.FillLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.IActionBars;\r
+import org.eclipse.ui.plugin.AbstractUIPlugin;\r
+\r
+/**\r
+ * <b><u>LatencyView</u></b>\r
+ * <p>\r
+ * TmfView displaying the latency views (i.e. the two latency charts).\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class LatencyView extends TmfView implements IGraphModelListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+    \r
+    // The initial window span (in nanoseconds)\r
+    public static final long INITIAL_WINDOW_SPAN = (1L * 100 * 1000 * 1000); // .1sec\r
+\r
+    /**\r
+     * The view's unique ID.\r
+     */\r
+    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.latency.LatencyView"; //$NON-NLS-1$\r
+\r
+    /**\r
+     * A reference to the currently selected experiment.\r
+     */\r
+    protected TmfExperiment<LttngEvent> fExperiment = null;\r
+\r
+    /**\r
+     * Parent composite.\r
+     */\r
+    protected Composite fParent;\r
+\r
+    /**\r
+     * Graph view.\r
+     */\r
+    protected GraphViewer fGraphViewer;\r
+    \r
+    /**\r
+     * Histogram view.\r
+     */\r
+    protected HistogramViewer fHistogramViewer;\r
+\r
+    /**\r
+     * Action executed when the user wants to see the list of matching events.\r
+     */\r
+    protected Action fListMatchingEvents;\r
+    \r
+    /**\r
+     * Action executed when the user wants to add matching events.\r
+     */\r
+    protected Action fAddMatchingEvents;\r
+    \r
+    /**\r
+     * Action executed when the user wants to delete matching events.\r
+     */\r
+    protected Action fDeleteMatchingEvents;\r
+    \r
+    /**\r
+     * Action executed when the user wants to increase the width of the histogram bars.\r
+     */\r
+    protected Action fIncreaseBarWidth;\r
+    \r
+    /**\r
+     * Action executed when the user wants to decrease the width of the histogram bars.\r
+     */\r
+    protected Action fDecreaseBarWidth;\r
+\r
+    /**\r
+     * The current histogram window time range.\r
+     */\r
+    protected TmfTimeRange fTimeRange = null;\r
+\r
+    /**\r
+     * Controller of the latency model which is responsible to retrieve data from the trace\r
+     */\r
+    final private LatencyController fController;\r
+\r
+    /**\r
+     * Flag to notify that TimeSyncSignal was received and is being processed.\r
+     */\r
+    private boolean fSyncSignalReceived = false;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructor\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     */\r
+    public LatencyView() {\r
+        super(Messages.LatencyView_ViewName);\r
+        fController = LatencyController.getInstance();\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Create the UI controls of this view.\r
+     * \r
+     * @param parent\r
+     *            The composite parent of this view.\r
+     */\r
+    @Override\r
+    public void createPartControl(Composite parent) {\r
+        // Save the parent\r
+        fParent = parent;\r
+\r
+        makeActions();\r
+        contributeToActionBars();\r
+\r
+        // Add a control listener to handle the view resize events (to redraw the canvas)\r
+        fParent.addControlListener(new ControlListener() {\r
+            @Override\r
+            public void controlMoved(ControlEvent event) {\r
+                fHistogramViewer.clearBackground();\r
+                fGraphViewer.clearBackground();\r
+                fController.handleCompleted();\r
+            }\r
+\r
+            @Override\r
+            public void controlResized(ControlEvent event) {\r
+                fHistogramViewer.clearBackground();\r
+                fGraphViewer.clearBackground();\r
+                fController.handleCompleted();\r
+            }\r
+        });\r
+\r
+        // ///////////////////////////////////////////////////////////////////////////////////\r
+        // Layout for the whole view, other elements will be in a child composite of this one\r
+        // Contains :\r
+        // Composite layoutSelectionWindow\r
+        // Composite layoutTimesSpinner\r
+        // Composite layoutExperimentHistogram\r
+        // ///////////////////////////////////////////////////////////////////////////////////\r
+        Composite layoutFullView = new Composite(fParent, SWT.FILL);\r
+        FillLayout gridFullView = new FillLayout();\r
+        gridFullView.marginHeight = 0;\r
+        gridFullView.marginWidth = 0;\r
+        layoutFullView.setLayout(gridFullView);\r
+\r
+        // Create the graph views\r
+        fGraphViewer = new GraphViewer(layoutFullView, SWT.DOUBLE_BUFFERED);\r
+        fGraphViewer.setDrawLabelEachNTicks(2);\r
+        fGraphViewer.setGraphTitle(Messages.LatencyView_Graphs_Graph_Title);\r
+        fGraphViewer.setXAxisLabel(Messages.LatencyView_Graphs_Graph_XAxisLabel, 40);\r
+        fGraphViewer.setYAxisLabel(Messages.LatencyView_Graphs_Graph_YAxisLabel);\r
+\r
+        fHistogramViewer = new HistogramViewer(layoutFullView, SWT.DOUBLE_BUFFERED);\r
+        fHistogramViewer.setDrawLabelEachNTicks(2);\r
+        fHistogramViewer.setGraphTitle(Messages.LatencyView_Graphs_Histogram_Title);\r
+        fHistogramViewer.setXAxisLabel(Messages.LatencyView_Graphs_Histogram_XAxisLabel, 55);\r
+        fHistogramViewer.setYAxisLabel(Messages.LatencyView_Graphs_Histogram_YAxisLabel);\r
+\r
+        fController.registerModel(fGraphViewer.getModel());\r
+        fController.registerModel(fHistogramViewer.getModel());\r
+        \r
+        ((LatencyGraphModel)fGraphViewer.getModel()).addGraphModelListener(this);\r
+        \r
+        @SuppressWarnings("unchecked")\r
+        TmfExperiment<TmfEvent> experiment = (TmfExperiment<TmfEvent>) TmfExperiment.getCurrentExperiment();\r
+        if (experiment != null) {\r
+\r
+            TmfTimeRange experimentTRange = experiment.getTimeRange();\r
+\r
+            if (experimentTRange != TmfTimeRange.NULL_RANGE) {\r
+                TmfExperimentSelectedSignal<TmfEvent> signal = new TmfExperimentSelectedSignal<TmfEvent>(this, experiment);\r
+                experimentSelected(signal);\r
+            }\r
+        }\r
+    }\r
+\r
+    @SuppressWarnings("nls")\r
+    @Override\r
+    public String toString() {\r
+        return "["+ Messages.LatencyView_ViewName+"]";\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Signal handlers\r
+    // ------------------------------------------------------------------------\r
+\r
+    @SuppressWarnings("unchecked")\r
+    @TmfSignalHandler\r
+    public void experimentSelected(TmfExperimentSelectedSignal<TmfEvent> signal) {\r
+        // Clear the views\r
+        fGraphViewer.clear();\r
+        fHistogramViewer.clear();\r
+\r
+        if (fParent != null) {\r
+            // Update the trace reference\r
+            fExperiment = (TmfExperiment<LttngEvent>) signal.getExperiment();\r
+\r
+            fTimeRange = TmfTimeRange.NULL_RANGE;\r
+            TmfTimeRange experimentTRange = fExperiment.getTimeRange();\r
+\r
+            if (!experimentTRange.equals(TmfTimeRange.NULL_RANGE)) {\r
+                fTimeRange = new TmfTimeRange(experimentTRange.getStartTime(), \r
+                        new TmfTimestamp(experimentTRange.getStartTime().getValue() + INITIAL_WINDOW_SPAN, experimentTRange.getStartTime().getScale(), experimentTRange.getStartTime().getPrecision()));\r
+                fController.refreshModels(fExperiment, fTimeRange);\r
+            }\r
+        }\r
+    }    \r
+    @TmfSignalHandler\r
+    public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {\r
+        if (fTimeRange == TmfTimeRange.NULL_RANGE && signal.getExperiment().equals(fExperiment)) {\r
+            TmfTimeRange experimentTRange = signal.getRange();\r
+\r
+            if (experimentTRange != TmfTimeRange.NULL_RANGE) {\r
+                fTimeRange = new TmfTimeRange(experimentTRange.getStartTime(), \r
+                        new TmfTimestamp(experimentTRange.getStartTime().getValue() + INITIAL_WINDOW_SPAN, experimentTRange.getStartTime().getScale(), experimentTRange.getStartTime().getPrecision()));\r
+                fController.refreshModels(fExperiment, fTimeRange);\r
+            }\r
+        }\r
+    }\r
+    \r
+    @TmfSignalHandler\r
+    public void experimentDisposed(TmfExperimentDisposedSignal<TmfEvent> signal) {\r
+        if (signal.getExperiment() != fExperiment) {\r
+            return;\r
+        }\r
+        fTimeRange = TmfTimeRange.NULL_RANGE;\r
+        fExperiment = null;\r
+        fController.clear();\r
+    }\r
+\r
+    /**\r
+     * Called when the LatencyView is closed: disposes of the canvas and unregisters models from views.\r
+     */\r
+    @Override\r
+    public void dispose() {\r
+        fController.dispose();\r
+        fController.deregisterModel(fGraphViewer.getModel());\r
+        fController.deregisterModel(fHistogramViewer.getModel());\r
+        ((LatencyGraphModel)fGraphViewer.getModel()).removeGraphModelListener(this);\r
+\r
+        fGraphViewer.dispose();\r
+        fHistogramViewer.dispose();\r
+\r
+        super.dispose();\r
+    }\r
+\r
+    /**\r
+     * Method called when synchronization is active and that the user select an event.\r
+     * \r
+     * The models will be updated with the new current selected time.\r
+     * \r
+     * @param signal\r
+     *            Signal received from the framework. Contain the event.\r
+     */\r
+    @TmfSignalHandler\r
+    public void currentTimeUpdated(TmfTimeSynchSignal signal) {\r
+        if (signal.getSource() != this) {\r
+            fSyncSignalReceived = true;\r
+            fController.setCurrentEventTime(signal.getCurrentTime().getValue());\r
+            fSyncSignalReceived = false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Method called when synchronization is active and that the user changed the current time range.\r
+\r
+     * The models will be updated with the new time range.\r
+     * \r
+     * @param signal\r
+     *            Signal received from the framework. Contain the new time range.\r
+     */\r
+    @TmfSignalHandler\r
+    public void synchToTimeRange(TmfRangeSynchSignal signal) {\r
+        if (signal.getSource() != this) {\r
+            // Erase the graph views\r
+            fGraphViewer.clear();\r
+            fHistogramViewer.clear();\r
+            \r
+            ITmfTimestamp startTime = signal.getCurrentRange().getStartTime();\r
+            ITmfTimestamp endTime = signal.getCurrentRange().getEndTime();\r
+            fTimeRange = new TmfTimeRange(startTime, endTime);\r
+\r
+            fController.refreshModels(fExperiment, fTimeRange);\r
+        }\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#graphModelUpdated()\r
+     */\r
+    @Override\r
+    public void graphModelUpdated() {\r
+        // Nothing to do - update of viewers will be done in the viewers\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#currentEventUpdated(long)\r
+     */\r
+    @Override\r
+    public void currentEventUpdated(final long currentEventTime) {\r
+        if (fExperiment != null && \r
+                !fSyncSignalReceived && // Don't broadcast the current time that was received just before with a time sync signal\r
+                currentEventTime != Config.INVALID_EVENT_TIME) {\r
+\r
+            // Queue update in the event request queue \r
+            TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(currentEventTime, Config.TIME_SCALE), TmfTimestamp.BIG_CRUNCH);\r
+            TmfEventRequest<LttngEvent> request = new TmfEventRequest<LttngEvent>(LttngEvent.class, timeRange, 0, 1, ExecutionType.FOREGROUND) {\r
+                @Override\r
+                public void handleCompleted() {\r
+                    broadcast(new TmfTimeSynchSignal(this, new TmfTimestamp(currentEventTime, Config.TIME_SCALE)));\r
+                }\r
+            };\r
+            fExperiment.sendRequest(request);\r
+        }\r
+    }\r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Helper functions\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Fills the local pull down menu.\r
+     * @param manager\r
+     *            The menu manager.\r
+     */\r
+    private void fillLocalPullDown(IMenuManager manager) {\r
+        manager.add(new Separator());\r
+        manager.add(fIncreaseBarWidth);\r
+        manager.add(fDecreaseBarWidth);\r
+        manager.add(new Separator());\r
+        manager.add(fListMatchingEvents);\r
+        manager.add(fAddMatchingEvents);\r
+        manager.add(fDeleteMatchingEvents);\r
+        manager.add(new Separator());\r
+    }\r
+\r
+    /**\r
+     * Fills the local toolbar.\r
+     * @param manager\r
+     *            The toolbar manager\r
+     */\r
+    private void fillLocalToolBar(IToolBarManager manager) {\r
+        manager.add(new Separator());\r
+        manager.add(fIncreaseBarWidth);\r
+        manager.add(fDecreaseBarWidth);\r
+        manager.add(new Separator());\r
+        manager.add(fListMatchingEvents);\r
+        manager.add(fAddMatchingEvents);\r
+        manager.add(fDeleteMatchingEvents);\r
+        manager.add(new Separator());\r
+    }\r
+\r
+    /**\r
+     * Creates the actions required by the dialog events.\r
+     */\r
+    private void makeActions() {\r
+        // Increase the histogram bar width\r
+        fIncreaseBarWidth = new Action() {\r
+            @Override\r
+            public void run() {\r
+                fHistogramViewer.increaseBarWidth();\r
+                fGraphViewer.increaseBarWidth();\r
+            }\r
+        };\r
+        String tooltipText = Messages.LatencyView_Action_IncreaseBarWidth_Tooltip;\r
+        fIncreaseBarWidth.setText(tooltipText);\r
+        fIncreaseBarWidth.setToolTipText(tooltipText);\r
+        fIncreaseBarWidth.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/increasebar_button.gif")); //$NON-NLS-1$\r
+\r
+        // Decrease the histogram bar width\r
+        fDecreaseBarWidth = new Action() {\r
+            @Override\r
+            public void run() {\r
+                fHistogramViewer.decreaseBarWidth();\r
+                fGraphViewer.decreaseBarWidth();\r
+            }\r
+        };\r
+        tooltipText = Messages.LatencyView_Action_DecreaseBarWidth_Tooltip;\r
+        fDecreaseBarWidth.setText(tooltipText);\r
+        fDecreaseBarWidth.setToolTipText(tooltipText);\r
+        fDecreaseBarWidth.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/decreasebar_button.gif")); //$NON-NLS-1$\r
+\r
+        // List matching events dialog\r
+        fListMatchingEvents = new Action() {\r
+            @Override\r
+            public void run() {\r
+                ListDialog listDialog = new ListDialog(fParent.getShell(), Messages.LatencyView_Dialogs_ListEvents_Title, Messages.LatencyView_Dialogs_ListEvents_Message);\r
+                listDialog.create();\r
+                listDialog.open();\r
+            }\r
+        };\r
+        tooltipText = Messages.LatencyView_Action_ListEvents_Tooltip;\r
+        fListMatchingEvents.setText(tooltipText);\r
+        fListMatchingEvents.setToolTipText(tooltipText);\r
+        fListMatchingEvents.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/eview16/events_view.gif")); //$NON-NLS-1$\r
+\r
+        // Add matching events dialog\r
+        fAddMatchingEvents = new Action() {\r
+            @Override\r
+            public void run() {\r
+                AddDialog addDialog = new AddDialog(fParent.getShell(), Messages.LatencyView_Dialogs_AddEvents_Title, Messages.LatencyView_Dialogs_AddEvents_Message);\r
+                addDialog.create();\r
+                addDialog.open();\r
+            }\r
+        };\r
+        tooltipText = Messages.LatencyView_Action_AddEvents_Tooltip;\r
+        fAddMatchingEvents.setText(tooltipText);\r
+        fAddMatchingEvents.setToolTipText(tooltipText);\r
+        fAddMatchingEvents.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/add_button.gif")); //$NON-NLS-1$\r
+\r
+        // Remove matching events dialog\r
+        fDeleteMatchingEvents = new Action() {\r
+            @Override\r
+            public void run() {\r
+                DeleteDialog deleteDialog = new DeleteDialog(fParent.getShell(), Messages.LatencyView_Dialogs_DeleteEvents_Title,\r
+                        Messages.LatencyView_Dialogs_DeleteEvents_Message);\r
+                deleteDialog.create();\r
+                deleteDialog.open();\r
+            }\r
+        };\r
+        tooltipText = Messages.LatencyView_Action_DeleteEvents_Tooltip;\r
+        fDeleteMatchingEvents.setText(tooltipText);\r
+        fDeleteMatchingEvents.setToolTipText(tooltipText);\r
+        fDeleteMatchingEvents.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/delete_button.gif")); //$NON-NLS-1$\r
+    }\r
+\r
+    /**\r
+     * Build the toolbar and menu by adding action buttons for dialogs.\r
+     */\r
+    private void contributeToActionBars() {\r
+        IActionBars bars = getViewSite().getActionBars();\r
+        fillLocalPullDown(bars.getMenuManager());\r
+        fillLocalToolBar(bars.getToolBarManager());\r
+    }\r
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/Messages.java
new file mode 100644 (file)
index 0000000..d2f1c6f
--- /dev/null
@@ -0,0 +1,81 @@
+/*******************************************************************************\r
+ * Copyright (c) 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Updated    \r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency;\r
+\r
+import org.eclipse.osgi.util.NLS;\r
+\r
+/**\r
+ * Returns localized strings from the resource bundle (i.e. "messages.properties").\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class Messages extends NLS {\r
+\r
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.latency.messages"; //$NON-NLS-1$\r
+\r
+    public static String LatencyView_ViewName;\r
+    public static String LatencyView_Action_IncreaseBarWidth_Tooltip;\r
+    public static String LatencyView_Action_DecreaseBarWidth_Tooltip;\r
+    public static String LatencyView_Action_AddEvents_Tooltip;\r
+    public static String LatencyView_Action_DeleteEvents_Tooltip;\r
+    public static String LatencyView_Action_ListEvents_Tooltip;\r
+    public static String LatencyView_Dialogs_AddEvents_Title;\r
+    public static String LatencyView_Dialogs_AddEvents_Message;\r
+    public static String LatencyView_Dialogs_AddEvents_Buttons_Add;\r
+    public static String LatencyView_Dialogs_AddEvents_Buttons_Close;\r
+    public static String LatencyView_Dialogs_AddEvents_Columns_Start;\r
+    public static String LatencyView_Dialogs_AddEvents_Columns_End;\r
+    public static String LatencyView_Dialogs_AddEvents_Columns_List_Trigger;\r
+    public static String LatencyView_Dialogs_AddEvents_Columns_List_End;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_NoSelection;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_StartNotSelected;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_EndNotSelected;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_SameSelected;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_AlreadyMatched;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_StartAlreadyMatched;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_EndAlreadyMatched;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_StartAsEnd;\r
+    public static String LatencyView_Dialogs_AddEvents_Errors_EndAsStart;\r
+    public static String LatencyView_Dialogs_DeleteEvents_Title;\r
+    public static String LatencyView_Dialogs_DeleteEvents_Message;\r
+    public static String LatencyView_Dialogs_DeleteEvents_Buttons_Close;\r
+    public static String LatencyView_Dialogs_DeleteEvents_Buttons_Delete;\r
+    public static String LatencyView_Dialogs_DeleteEvents_Confirm_Title;\r
+    public static String LatencyView_Dialogs_DeleteEvents_Confirm_Message;\r
+    public static String LatencyView_Dialogs_ListEvents_Title;\r
+    public static String LatencyView_Dialogs_ListEvents_Message;\r
+    public static String LatencyView_Dialogs_ListEvents_Buttons_Close;\r
+    public static String LatencyView_Dialogs_ListEvents_Buttons_Reset;\r
+    public static String LatencyView_Dialogs_ListEvents_Columns_Trigger;\r
+    public static String LatencyView_Dialogs_ListEvents_Columns_End;\r
+    public static String LatencyView_Dialogs_ListEvents_Confirm_Title;\r
+    public static String LatencyView_Dialogs_ListEvents_Confirm_Message;\r
+    public static String LatencyView_Graphs_Graph_Title;\r
+    public static String LatencyView_Graphs_Graph_XAxisLabel;\r
+    public static String LatencyView_Graphs_Graph_YAxisLabel;\r
+    public static String LatencyView_Graphs_Histogram_Title;\r
+    public static String LatencyView_Graphs_Histogram_XAxisLabel;\r
+    public static String LatencyView_Graphs_Histogram_YAxisLabel;\r
+    public static String LatencyView_msgSlogan;\r
+    public static String LatencyView_tmf_UI;\r
+    public static String LatencyView_ClippingWarning;\r
+    \r
+    static {\r
+        // initialize resource bundle\r
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
+    }\r
+\r
+    private Messages() {\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/AbstractDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/AbstractDialog.java
new file mode 100644 (file)
index 0000000..a27e4f9
--- /dev/null
@@ -0,0 +1,240 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs;\r
+\r
+import java.util.Vector;\r
+\r
+import org.eclipse.jface.dialogs.IDialogSettings;\r
+import org.eclipse.jface.dialogs.IMessageProvider;\r
+import org.eclipse.jface.dialogs.TitleAreaDialog;\r
+import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
+import org.eclipse.linuxtools.internal.lttng.core.util.EventsPair;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.LatencyController;\r
+import org.eclipse.linuxtools.lttng.ui.Activator;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+/**\r
+ * <b><u>AbstractDialog</u></b>\r
+ * <p> \r
+ * Includes the main functions shared by all the different dialogs.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public abstract class AbstractDialog extends TitleAreaDialog {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * The dialog window title.\r
+     */\r
+    protected String fDialogTitle;\r
+    /**\r
+     * The dialog window message.\r
+     */\r
+    protected String fDialogMessage;\r
+\r
+    /**\r
+     * The code returned by the dialog when the user closes the "Add" dialog.\r
+     */\r
+    public static final int ADD = 53445;\r
+    /**\r
+     * The code returned by the dialog when the user closes the "Delete" dialog.\r
+     */\r
+    public static final int DELETE = ADD + 1;\r
+    /**\r
+     * The code returned by the dialog when the user resets the latency pair to default.\r
+     */\r
+    public static final int RESET = DELETE + 1;\r
+\r
+    /**\r
+     * String ID of the number of pairs saved in the settings file.\r
+     */\r
+    protected static final String LATENCY_NB_MATCH_PAIRS = "NB_LATENCY_MATCH_PAIRS"; //$NON-NLS-1$\r
+    /**\r
+     * String ID of the start event pairs saved in the settings file.\r
+     */\r
+    protected static final String LATENCY_PAIRS_START = "LATENCY_PAIRS_START"; //$NON-NLS-1$\r
+    /**\r
+     * String ID of the end event pairs saved in the settings file.\r
+     */\r
+    protected static final String LATENCY_PAIRS_END = "LATENCY_PAIRS_END"; //$NON-NLS-1$\r
+\r
+    /**\r
+     * Dialog settings, saves the event pairs across sessions.\r
+     */\r
+    protected IDialogSettings fSettings;\r
+\r
+    /**\r
+     * Do the graphs canvas need to be redrawn due to latency pairs changes ?\r
+     */\r
+    protected boolean fRedrawGraphs = false;\r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param parentShell\r
+     *            The parent shell.\r
+     * @param title\r
+     *            The dialog window's title.\r
+     * @param message\r
+     *            The dialog window's message.\r
+     */\r
+    public AbstractDialog(Shell parentShell, String title, String message) {\r
+        super(parentShell);\r
+        fDialogTitle = title;\r
+        fDialogMessage = message;\r
+\r
+        fSettings = Activator.getDefault().getDialogSettings();\r
+    }\r
+\r
+    /**\r
+     * Constructor\r
+     * @param parentShell\r
+     *            The parent shell.\r
+     * @param title\r
+     *            The dialog window's title.\r
+     */\r
+    @SuppressWarnings("nls")\r
+    public AbstractDialog(Shell parentShell, String title) {\r
+        this(parentShell, title, "");\r
+    }\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param parentShell\r
+     *            The parent shell.\r
+     */\r
+    @SuppressWarnings("nls")\r
+    public AbstractDialog(Shell parentShell) {\r
+        this(parentShell, "", "");\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Creates the dialog.\r
+     * \r
+     * <b>Note :</b> Since there is an issue with the table's vertical scroll bar, this dialog "resize" is necessary to\r
+     * ensure a minimal height for the window.\r
+     */\r
+    @Override\r
+    public void create() {\r
+        super.create();\r
+        // Set the title\r
+        setTitle(fDialogTitle);\r
+        // Set the message\r
+        setMessage(fDialogMessage, IMessageProvider.INFORMATION);\r
+\r
+        // Position the dialog at the center of the screen\r
+        int windowWidth = Display.getCurrent().getPrimaryMonitor().getBounds().width;\r
+        int windowHeight = Display.getCurrent().getPrimaryMonitor().getBounds().height;\r
+        int dialogWidth = getShell().getSize().x;\r
+        int dialogHeight = windowHeight / 2;\r
+\r
+        int x = (windowWidth - dialogWidth) / 2;\r
+        int y = (windowHeight - dialogHeight) / 2;\r
+\r
+        getShell().setSize(getShell().getSize().x, dialogHeight);\r
+        getShell().setLocation(x, y);\r
+    }\r
+\r
+    /**\r
+     * Formats the "#" of the event in the table by adding "00" before it.\r
+     * @param number\r
+     *            The number to format.\r
+     * @param max\r
+     *            The maximum number of event pairs in the list.\r
+     * @return The formatted string.\r
+     */\r
+    @SuppressWarnings("nls")\r
+    protected String formatListNumber(int number, int max) {\r
+        return String.format("%0" + max + "d", number);\r
+    }\r
+\r
+    /**\r
+     * Returns the match pairs saved in the settings file.\r
+     * @return The match pairs saved in the settings file.\r
+     */\r
+    protected EventsPair getMatchPairs() {\r
+        try {\r
+            // Check if the settings file has already some data (i.e. try provoking an exception)\r
+            fSettings.getInt(LATENCY_NB_MATCH_PAIRS);\r
+\r
+            String[] starts = fSettings.getArray(LATENCY_PAIRS_START);\r
+            String[] ends = fSettings.getArray(LATENCY_PAIRS_END);\r
+\r
+            EventMatcher.getInstance().resetMatches();\r
+            for (int i = 0; i < starts.length; i++) {\r
+                EventMatcher.getInstance().addMatch(starts[i], ends[i]);\r
+            }\r
+\r
+            return EventMatcher.getInstance().getEvents();\r
+        } catch (NumberFormatException e) {\r
+            return EventMatcher.getInstance().getEvents();\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Saves the event match pairs to a settings file.\r
+     * @param start\r
+     *            The start event types.\r
+     * @param end\r
+     *            The end event types.\r
+     */\r
+    protected void saveMatchPairs(Vector<String> start, Vector<String> end) {\r
+        fSettings.put(LATENCY_NB_MATCH_PAIRS, start.size());\r
+        fSettings.put(LATENCY_PAIRS_START, start.toArray(new String[] {}));\r
+        fSettings.put(LATENCY_PAIRS_END, end.toArray(new String[] {}));\r
+    }\r
+\r
+    /**\r
+     * Ask the LatencyView to send a new analysis request to the views, so that they can be redrawn.\r
+     */\r
+    protected void redrawGraphs() {\r
+        LatencyController.getInstance().refreshModels();\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected abstract Control createDialogArea(Composite parent);\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected abstract void createButtonsForButtonBar(Composite parent);\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.jface.dialogs.Dialog#isResizable()\r
+     */\r
+    @Override\r
+    protected boolean isResizable() {\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/AddDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/AddDialog.java
new file mode 100644 (file)
index 0000000..e709b27
--- /dev/null
@@ -0,0 +1,488 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs;\r
+\r
+import java.util.Vector;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
+import org.eclipse.linuxtools.internal.lttng.core.util.EventsPair;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.Messages;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Listener;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.swt.widgets.Table;\r
+import org.eclipse.swt.widgets.TableColumn;\r
+import org.eclipse.swt.widgets.TableItem;\r
+\r
+/**\r
+ * <b><u>AddDialog</u></b>\r
+ * <p>\r
+ * Add dialog, lets the user add custom start/end event pairs.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class AddDialog extends AbstractDialog {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * The dialog's start table.\r
+     */\r
+    protected Table fStartTable;\r
+\r
+    /**\r
+     * The dialog's end table.\r
+     */\r
+    protected Table fEndTable;\r
+\r
+    /**\r
+     * The dialog's list table.\r
+     */\r
+    protected Table fListTable;\r
+\r
+    /**\r
+     * Start table columns.\r
+     */\r
+    protected TableColumn[] fStartColumns;\r
+\r
+    /**\r
+     * End table columns.\r
+     */\r
+    protected TableColumn[] fEndColumns;\r
+\r
+    /**\r
+     * List table columns.\r
+     */\r
+    protected TableColumn[] fListColumns;\r
+\r
+    /**\r
+     * Start table column names (header titles).\r
+     */\r
+    static final String[] START_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_Start }; //$NON-NLS-1$\r
+\r
+    /**\r
+     * End table column names (header titles).\r
+     */\r
+    static final String[] END_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_End }; //$NON-NLS-1$\r
+\r
+    /**\r
+     * List table column names (header titles).\r
+     */\r
+    static final String[] LIST_COLUMN_NAMES = {\r
+            "#", //$NON-NLS-1$\r
+            Messages.LatencyView_Dialogs_AddEvents_Columns_List_Trigger,\r
+            Messages.LatencyView_Dialogs_AddEvents_Columns_List_End };\r
+\r
+    /**\r
+     * Column widths.\r
+     */\r
+    static final int[] COLUMN_WIDTHS = { 25, 250, 250 };\r
+\r
+    /**\r
+     * Possible event types.\r
+     */\r
+    protected Vector<String> fEventTypes = new Vector<String>();\r
+\r
+    /**\r
+     * Start event types.\r
+     */\r
+    protected Vector<String> fEventStartTypes;\r
+\r
+    /**\r
+     * End event types.\r
+     */\r
+    protected Vector<String> fEventEndTypes;\r
+\r
+    /**\r
+     * Selected start type.\r
+     */\r
+    protected String fStartType;\r
+\r
+    /**\r
+     * Selected end type.\r
+     */\r
+    protected String fEndType;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param parentShell\r
+     *            The parent shell.\r
+     * @param title\r
+     *            The dialog's window title.\r
+     * @param message\r
+     *            The dialog's window message.\r
+     */\r
+    public AddDialog(Shell parentShell, String title, String message) {\r
+        super(parentShell, title, message);\r
+\r
+        // Get the possible events from the list\r
+        fEventTypes = EventMatcher.getInstance().getTypeList();\r
+\r
+        // Get the list of start and end types from the EventMatcher\r
+        EventsPair pair = getMatchPairs();\r
+        fEventStartTypes = pair.getFirst();\r
+        fEventEndTypes = pair.getSecond();\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Creates the start table's columns (i.e. the table header).\r
+     */\r
+    protected void createStartColumns() {\r
+        fStartColumns = new TableColumn[START_COLUMN_NAMES.length];\r
+        for (int i = 0; i < START_COLUMN_NAMES.length; i++) {\r
+            fStartColumns[i] = new TableColumn(fStartTable, SWT.LEFT);\r
+            fStartColumns[i].setText(START_COLUMN_NAMES[i]);\r
+            fStartColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Creates the end table's columns (i.e. the table header).\r
+     */\r
+    protected void createEndColumns() {\r
+        fEndColumns = new TableColumn[END_COLUMN_NAMES.length];\r
+        for (int i = 0; i < END_COLUMN_NAMES.length; i++) {\r
+            fEndColumns[i] = new TableColumn(fEndTable, SWT.LEFT);\r
+            fEndColumns[i].setText(END_COLUMN_NAMES[i]);\r
+            fEndColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Creates the list table's columns (i.e. the table header).\r
+     */\r
+    protected void createListColumns() {\r
+        fListColumns = new TableColumn[LIST_COLUMN_NAMES.length];\r
+        for (int i = 0; i < LIST_COLUMN_NAMES.length; i++) {\r
+            fListColumns[i] = new TableColumn(fListTable, SWT.LEFT);\r
+            fListColumns[i].setText(LIST_COLUMN_NAMES[i]);\r
+            fListColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Creates the start column list.\r
+     * @param parent\r
+     *            The parent composite.\r
+     */\r
+    protected void createStartColumn(Composite parent) {\r
+        final int style = SWT.SINGLE | SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
+        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
+        fStartTable = new Table(parent, style);\r
+        fStartTable.setLayoutData(layoutData);\r
+\r
+        // Some cosmetic enhancements\r
+        fStartTable.setHeaderVisible(true);\r
+        fStartTable.setLinesVisible(true);\r
+\r
+        createStartColumns();\r
+\r
+        for (int i = 0; i < fEventTypes.size(); i++) {\r
+            TableItem item = new TableItem(fStartTable, SWT.RIGHT);\r
+\r
+            String[] columns = { fEventTypes.get(i), fEventTypes.get(i) };\r
+\r
+            item.setText(columns);\r
+        }\r
+\r
+        fStartTable.setItemCount(fEventTypes.size());\r
+\r
+        fStartTable.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                if (event.detail == SWT.CHECK) {\r
+                    TableItem[] items = fStartTable.getItems();\r
+                    for (TableItem item : items) {\r
+                        if (item != event.item) {\r
+                            item.setChecked(false);\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        });\r
+    }\r
+\r
+    /**\r
+     * Creates the end column list.\r
+     * @param parent\r
+     *            The parent composite.\r
+     */\r
+    protected void createEndColumn(Composite parent) {\r
+        final int style = SWT.SINGLE | SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
+        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
+        fEndTable = new Table(parent, style);\r
+        fEndTable.setLayoutData(layoutData);\r
+\r
+        // Some cosmetic enhancements\r
+        fEndTable.setHeaderVisible(true);\r
+        fEndTable.setLinesVisible(true);\r
+\r
+        createEndColumns();\r
+\r
+        for (int i = 0; i < fEventTypes.size(); i++) {\r
+            TableItem item = new TableItem(fEndTable, SWT.RIGHT);\r
+\r
+            String[] columns = { fEventTypes.get(i), fEventTypes.get(i) };\r
+\r
+            item.setText(columns);\r
+        }\r
+\r
+        fEndTable.setItemCount(fEventTypes.size());\r
+\r
+        fEndTable.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                if (event.detail == SWT.CHECK) {\r
+                    TableItem[] items = fEndTable.getItems();\r
+                    for (TableItem item : items) {\r
+                        if (item != event.item) {\r
+                            item.setChecked(false);\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        });\r
+    }\r
+\r
+    /**\r
+     * Creates the list column for already existing event pairs.\r
+     * @param parent\r
+     *            The parent composite.\r
+     */\r
+    protected void createListColumn(Composite parent) {\r
+        final int style = SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
+        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
+        layoutData.horizontalSpan = 2;\r
+        fListTable = new Table(parent, style);\r
+        fListTable.setLayoutData(layoutData);\r
+\r
+        // Some cosmetic enhancements\r
+        fListTable.setHeaderVisible(true);\r
+        fListTable.setLinesVisible(true);\r
+\r
+        createListColumns();\r
+\r
+        for (int i = 0; i < fEventStartTypes.size(); i++) {\r
+            TableItem item = new TableItem(fListTable, SWT.RIGHT);\r
+\r
+            String max = String.valueOf(fEventStartTypes.size());\r
+            String number = formatListNumber(i + 1, max.length());\r
+\r
+            String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
+\r
+            item.setText(columns);\r
+        }\r
+\r
+        fListTable.setItemCount(103);\r
+        fListTable.remove(fEventTypes.size(), 103 - 1);\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected Control createDialogArea(Composite parent) {\r
+        GridLayout layout = new GridLayout(2, true);\r
+        parent.setLayout(layout);\r
+\r
+        createStartColumn(parent);\r
+        createEndColumn(parent);\r
+        createListColumn(parent);\r
+\r
+        return parent;\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected void createButtonsForButtonBar(Composite parent) {\r
+        GridData gridData = new GridData();\r
+        gridData.verticalAlignment = GridData.FILL;\r
+        gridData.horizontalSpan = 1;\r
+        gridData.grabExcessHorizontalSpace = true;\r
+        gridData.grabExcessVerticalSpace = true;\r
+        gridData.horizontalAlignment = SWT.RIGHT;\r
+\r
+        parent.setLayoutData(gridData);\r
+\r
+        // Create the "Add" button\r
+        Button addButton = createButton(parent, ADD, Messages.LatencyView_Dialogs_AddEvents_Buttons_Add, false);\r
+        addButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                if (isValidInput()) {\r
+                    // Add the event pair to the EventMatcher and save the pairs\r
+                    EventMatcher.getInstance().addMatch(fStartType, fEndType);\r
+                    fEventStartTypes.add(fStartType);\r
+                    fEventEndTypes.add(fEndType);\r
+                    saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
+\r
+                    EventsPair pairs = EventMatcher.getInstance().getEvents();\r
+                    fEventStartTypes = pairs.getFirst();\r
+                    fEventEndTypes = pairs.getSecond();\r
+\r
+                    fListTable.removeAll();\r
+\r
+                    for (int i = 0; i < fEventStartTypes.size(); i++) {\r
+                        TableItem item = new TableItem(fListTable, SWT.RIGHT);\r
+\r
+                        String max = String.valueOf(fEventStartTypes.size());\r
+                        String number = formatListNumber(i + 1, max.length());\r
+\r
+                        String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
+\r
+                        item.setText(columns);\r
+                    }\r
+\r
+                    saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
+                }\r
+\r
+                fRedrawGraphs = true;\r
+            }\r
+        });\r
+\r
+        // Create the "Close" button\r
+        Button closeButton = createButton(parent, CANCEL, Messages.LatencyView_Dialogs_AddEvents_Buttons_Close, false);\r
+        closeButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                setReturnCode(CANCEL);\r
+\r
+                if (fRedrawGraphs == true)\r
+                    redrawGraphs();\r
+\r
+                close();\r
+            }\r
+        });\r
+    }\r
+\r
+    /**\r
+     * Validate the list before adding event pairs.\r
+     * @return "true" if the input is valid, "false" otherwise.\r
+     */\r
+    protected boolean isValidInput() {\r
+        // Remove the previous error message\r
+        setErrorMessage(null);\r
+\r
+        boolean valid = true;\r
+\r
+        // Check if an item from the start list is selected\r
+        TableItem[] items = fStartTable.getItems();\r
+        fStartType = null;\r
+        boolean startHasSelectedItem = false;\r
+        for (int i = 0; i < items.length && !startHasSelectedItem; i++) {\r
+            if (items[i].getChecked() == true) {\r
+                fStartType = items[i].getText();\r
+                startHasSelectedItem = true;\r
+            }\r
+        }\r
+\r
+        // Check if an item from the end list is selected\r
+        items = fEndTable.getItems();\r
+        fEndType = null;\r
+        boolean endHasSelectedItem = false;\r
+        for (int i = 0; i < items.length && !endHasSelectedItem; i++) {\r
+            if (items[i].getChecked() == true) {\r
+                fEndType = items[i].getText();\r
+                endHasSelectedItem = true;\r
+            }\r
+        }\r
+\r
+        // Print error message if needed.\r
+        if (!startHasSelectedItem && !endHasSelectedItem) {\r
+            setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_NoSelection);\r
+            valid = false;\r
+        } else if (!startHasSelectedItem) {\r
+            setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_StartNotSelected);\r
+            valid = false;\r
+        } else if (!endHasSelectedItem) {\r
+            setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_EndNotSelected);\r
+            valid = false;\r
+        }\r
+\r
+        // Check if the same item is selected in both lists\r
+        if (startHasSelectedItem && endHasSelectedItem) {\r
+            if (fStartType.equalsIgnoreCase(fEndType)) {\r
+                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_SameSelected);\r
+                valid = false;\r
+            }\r
+        }\r
+\r
+        // Check if the selected item is already in the list\r
+        if (startHasSelectedItem && endHasSelectedItem) {\r
+            EventsPair pairs = getMatchPairs();\r
+            Vector<String> startEvents = pairs.getFirst();\r
+            Vector<String> endEvents = pairs.getSecond();\r
+\r
+            boolean startAlreadyUsed = false;\r
+            boolean endAlreadyUsed = false;\r
+            boolean startAsEndAlreadyUsed = false;\r
+            boolean endAsStartAlreadyUsed = false;\r
+\r
+            if (startEvents.contains(fStartType)) {\r
+                startAlreadyUsed = true;\r
+            }\r
+            if (endEvents.contains(fEndType)) {\r
+                endAlreadyUsed = true;\r
+            }\r
+            if (startEvents.contains(fEndType)) {\r
+                endAsStartAlreadyUsed = true;\r
+            }\r
+            if (endEvents.contains(fStartType)) {\r
+                startAsEndAlreadyUsed = true;\r
+            }\r
+\r
+            if (startAlreadyUsed && endAlreadyUsed) {\r
+                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_AlreadyMatched);\r
+                valid = false;\r
+            } else if (startAlreadyUsed) {\r
+                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_StartAlreadyMatched);\r
+                valid = false;\r
+            } else if (endAlreadyUsed) {\r
+                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_EndAlreadyMatched);\r
+                valid = false;\r
+            }\r
+\r
+            if (startAsEndAlreadyUsed) {\r
+                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_StartAsEnd);\r
+                valid = false;\r
+            }\r
+            if (endAsStartAlreadyUsed) {\r
+                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_EndAsStart);\r
+                valid = false;\r
+            }\r
+        }\r
+\r
+        return valid;\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/DeleteDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/DeleteDialog.java
new file mode 100644 (file)
index 0000000..05d6588
--- /dev/null
@@ -0,0 +1,155 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs;\r
+\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.Messages;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Listener;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.swt.widgets.TableItem;\r
+\r
+/**\r
+ * <b><u>DeleteDialog</u></b>\r
+ * <p>\r
+ * Remove dialog, lets the user remove start/end event pairs.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class DeleteDialog extends ListDialog {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param parentShell\r
+     *            The parent shell.\r
+     * @param title\r
+     *            The dialog's window title.\r
+     * @param message\r
+     *            The dialog's window message.\r
+     */\r
+    public DeleteDialog(Shell parentShell, String title, String message) {\r
+        super(parentShell, title, message);\r
+\r
+        // Set the table style\r
+        fStyle = SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.ListDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected void createButtonsForButtonBar(Composite parent) {\r
+        GridData gridData = new GridData();\r
+        gridData.verticalAlignment = GridData.FILL;\r
+        gridData.horizontalSpan = 1;\r
+        gridData.grabExcessHorizontalSpace = true;\r
+        gridData.grabExcessVerticalSpace = true;\r
+        gridData.horizontalAlignment = SWT.RIGHT;\r
+\r
+        parent.setLayoutData(gridData);\r
+\r
+        // Create the "Delete" button\r
+        Button deleteButton = createButton(parent, DELETE, Messages.LatencyView_Dialogs_DeleteEvents_Buttons_Delete, false);\r
+        deleteButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                TableItem selectedItem = fTable.getSelection()[0];\r
+                if (selectedItem == null)\r
+                    return;\r
+\r
+                int[] selectedIndices = fTable.getSelectionIndices();\r
+\r
+                StringBuffer deletePairs = new StringBuffer(""); //$NON-NLS-1$\r
+                for (int i = 0; i < selectedIndices.length; i++) {\r
+                    int index = selectedIndices[i];\r
+                    deletePairs.append("\t* ").append(fEventStartTypes.get(index)).append(" / ").append(fEventEndTypes.get(index)); //$NON-NLS-1$ //$NON-NLS-2$\r
+\r
+                    if (i < selectedIndices.length - 1) {\r
+                        deletePairs.append("\n"); //$NON-NLS-1$\r
+                    }\r
+                }\r
+\r
+                boolean confirmDeletion = MessageDialog.openQuestion(getShell(), Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Title,\r
+                        Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Message + "\n\n" + deletePairs.toString()); //$NON-NLS-1$\r
+\r
+                if (confirmDeletion) {\r
+                    // Remove the events starting from the end of the list, otherwise the TableItem elements will lose\r
+                    // their index from the table and may trigger an exception when removing an index that is no longer\r
+                    // valid.\r
+                    for (int i = selectedIndices.length - 1; i >= 0; i--) {\r
+                        int selectedIndex = selectedIndices[i];\r
+                        EventMatcher.getInstance().removeMatch(fEventStartTypes.get(selectedIndex), fEventEndTypes.get(selectedIndex));\r
+\r
+                        fTable.remove(selectedIndex);\r
+\r
+                        // Update the list of events\r
+                        fEventStartTypes.remove(selectedIndex);\r
+                        fEventEndTypes.remove(selectedIndex);\r
+                    }\r
+\r
+                    // Save the events pairs in the settings file so it can be retrieved in the next session\r
+                    saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
+\r
+                    fTable.setItemCount(fEventStartTypes.size());\r
+\r
+                    TableItem[] newItems = fTable.getItems();\r
+                    fTable.removeAll();\r
+                    for (int i = 0; i < newItems.length; i++) {\r
+                        TableItem item = new TableItem(fTable, SWT.RIGHT);\r
+\r
+                        String max = String.valueOf(fEventStartTypes.size());\r
+                        String number = formatListNumber(i + 1, max.length());\r
+\r
+                        String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
+\r
+                        item.setText(columns);\r
+                    }\r
+\r
+                    fRedrawGraphs = true;\r
+                }\r
+            }\r
+        });\r
+\r
+        // Create the "Close" button\r
+        Button closeButton = createButton(parent, CANCEL, Messages.LatencyView_Dialogs_AddEvents_Buttons_Close, false);\r
+        closeButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                // Remember the user's list\r
+                saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
+\r
+                setReturnCode(CANCEL);\r
+\r
+                if (fRedrawGraphs == true)\r
+                    redrawGraphs();\r
+\r
+                close();\r
+            }\r
+        });\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/ListDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/dialogs/ListDialog.java
new file mode 100644 (file)
index 0000000..0fb2b93
--- /dev/null
@@ -0,0 +1,252 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.dialogs;\r
+\r
+import java.util.Vector;\r
+\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
+import org.eclipse.linuxtools.internal.lttng.core.util.EventsPair;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.Messages;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Listener;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.swt.widgets.Table;\r
+import org.eclipse.swt.widgets.TableColumn;\r
+import org.eclipse.swt.widgets.TableItem;\r
+\r
+/**\r
+ * <b><u>ListDialog</u></b>\r
+ * <p>\r
+ * List dialog, shows the list of start/end event pairs.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class ListDialog extends AbstractDialog {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * The dialog's table.\r
+     */\r
+    protected Table fTable;\r
+\r
+    /**\r
+     * Start event types.\r
+     */\r
+    protected Vector<String> fEventStartTypes;\r
+\r
+    /**\r
+     * End event types.\r
+     */\r
+    protected Vector<String> fEventEndTypes;\r
+\r
+    /**\r
+     * Table columns\r
+     */\r
+    protected TableColumn[] fColumns;\r
+\r
+    /**\r
+     * Column names (header titles).\r
+     */\r
+    static final String[] COLUMN_NAMES = { "#", Messages.LatencyView_Dialogs_ListEvents_Columns_Trigger, Messages.LatencyView_Dialogs_ListEvents_Columns_End }; //$NON-NLS-1$\r
+\r
+    /**\r
+     * Column widths.\r
+     */\r
+    static final int[] COLUMN_WIDTHS = { 25, 250, 250 };\r
+\r
+    /**\r
+     * The table style.\r
+     */\r
+    protected int fStyle;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructor\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param parentShell\r
+     *            The parent shell.\r
+     * @param title\r
+     *            The dialog's window title.\r
+     * @param message\r
+     *            The dialog's window message.\r
+     */\r
+    public ListDialog(Shell parentShell, String title, String message) {\r
+        super(parentShell, title, message);\r
+\r
+        // Set the table style\r
+        fStyle = SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
+\r
+        // Get the list of start and end types from the EventMatcher\r
+        EventsPair pair = getMatchPairs();\r
+        fEventStartTypes = pair.getFirst();\r
+        fEventEndTypes = pair.getSecond();\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Creates the table's column (i.e. the table header).\r
+     */\r
+    protected void createColumns() {\r
+        fColumns = new TableColumn[COLUMN_NAMES.length];\r
+        for (int i = 0; i < COLUMN_NAMES.length; i++) {\r
+            fColumns[i] = new TableColumn(fTable, SWT.LEFT);\r
+            fColumns[i].setText(COLUMN_NAMES[i]);\r
+            fColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
+        }\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected Control createDialogArea(Composite parent) {\r
+        GridLayout layout = new GridLayout(1, true);\r
+        parent.setLayout(layout);\r
+\r
+        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
+        fTable = new Table(parent, fStyle);\r
+        fTable.setLayoutData(layoutData);\r
+\r
+        // Some cosmetic enhancements\r
+        fTable.setHeaderVisible(true);\r
+        fTable.setLinesVisible(true);\r
+\r
+        createColumns();\r
+\r
+        for (int i = 0; i < fEventStartTypes.size(); i++) {\r
+            TableItem item = new TableItem(fTable, SWT.RIGHT);\r
+\r
+            String max = String.valueOf(fEventStartTypes.size());\r
+            String number = formatListNumber(i + 1, max.length());\r
+\r
+            String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
+\r
+            item.setText(columns);\r
+        }\r
+\r
+        return parent;\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
+     */\r
+    @Override\r
+    protected void createButtonsForButtonBar(Composite parent) {\r
+        GridData gridData = new GridData();\r
+        gridData.verticalAlignment = GridData.FILL;\r
+        gridData.horizontalSpan = 1;\r
+        gridData.grabExcessHorizontalSpace = true;\r
+        gridData.grabExcessVerticalSpace = true;\r
+        gridData.horizontalAlignment = SWT.RIGHT;\r
+\r
+        parent.setLayoutData(gridData);\r
+\r
+        // Create the "Reset" button\r
+        Button resetButton = createButton(parent, RESET, Messages.LatencyView_Dialogs_ListEvents_Buttons_Reset, false);\r
+        resetButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                boolean confirmDeletion = MessageDialog.openQuestion(getShell(), Messages.LatencyView_Dialogs_ListEvents_Confirm_Title,\r
+                        Messages.LatencyView_Dialogs_ListEvents_Confirm_Message);\r
+\r
+                if (confirmDeletion) {\r
+                    EventMatcher.getInstance().resetMatches();\r
+\r
+                    fTable.removeAll();\r
+\r
+                    Vector<String> defaultStarts = new Vector<String>();\r
+                    Vector<String> defaultEnds = new Vector<String>();\r
+\r
+                    defaultStarts.add(EventMatcher.PAGE_FAULT_GET_USER_ENTRY);\r
+                    defaultEnds.add(EventMatcher.PAGE_FAULT_GET_USER_EXIT);\r
+                    defaultStarts.add(EventMatcher.TASKLET_LOW_ENTRY);\r
+                    defaultEnds.add(EventMatcher.TASKLET_LOW_EXIT);\r
+                    defaultStarts.add(EventMatcher.PAGE_FAULT_ENTRY);\r
+                    defaultEnds.add(EventMatcher.PAGE_FAULT_EXIT);\r
+                    defaultStarts.add(EventMatcher.SYSCALL_ENTRY);\r
+                    defaultEnds.add(EventMatcher.SYSCALL_EXIT);\r
+                    defaultStarts.add(EventMatcher.IRQ_ENTRY);\r
+                    defaultEnds.add(EventMatcher.IRQ_EXIT);\r
+                    defaultStarts.add(EventMatcher.READ);\r
+                    defaultEnds.add(EventMatcher.WRITE);\r
+                    defaultStarts.add(EventMatcher.OPEN);\r
+                    defaultEnds.add(EventMatcher.CLOSE);\r
+                    defaultStarts.add(EventMatcher.BUFFER_WAIT_START);\r
+                    defaultEnds.add(EventMatcher.BUFFER_WAIT_END);\r
+                    defaultStarts.add(EventMatcher.START_COMMIT);\r
+                    defaultEnds.add(EventMatcher.END_COMMIT);\r
+                    defaultStarts.add(EventMatcher.WAIT_ON_PAGE_START);\r
+                    defaultEnds.add(EventMatcher.WAIT_ON_PAGE_END);\r
+\r
+                    saveMatchPairs(defaultStarts, defaultEnds);\r
+\r
+                    for (int i = 0; i < defaultStarts.size(); i++) {\r
+                        EventMatcher.getInstance().addMatch(defaultStarts.get(i), defaultEnds.get(i));\r
+                    }\r
+\r
+                    // Get the list of start and end types from the EventMatcher\r
+                    EventsPair pair = getMatchPairs();\r
+                    fEventStartTypes = pair.getFirst();\r
+                    fEventEndTypes = pair.getSecond();\r
+\r
+                    for (int i = 0; i < fEventStartTypes.size(); i++) {\r
+                        TableItem item = new TableItem(fTable, SWT.RIGHT);\r
+\r
+                        String max = String.valueOf(fEventStartTypes.size());\r
+                        String number = formatListNumber(i + 1, max.length());\r
+\r
+                        String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
+\r
+                        item.setText(columns);\r
+                    }\r
+\r
+                    fTable.setItemCount(fEventStartTypes.size());\r
+\r
+                    fRedrawGraphs = true;\r
+                }\r
+            }\r
+        });\r
+\r
+        // Create the "Close" button\r
+        Button closeButton = createButton(parent, CANCEL, Messages.LatencyView_Dialogs_ListEvents_Buttons_Close, false);\r
+        closeButton.addListener(SWT.Selection, new Listener() {\r
+            @Override\r
+            public void handleEvent(Event event) {\r
+                setReturnCode(CANCEL);\r
+\r
+                if (fRedrawGraphs == true)\r
+                    redrawGraphs();\r
+\r
+                close();\r
+            }\r
+        });\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractMouseListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractMouseListener.java
new file mode 100644 (file)
index 0000000..5677e14
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;
+
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+
+/**
+ * <b><u>AbstractMouseListener</u></b>
+ * <p>
+ */
+public abstract class AbstractMouseListener implements MouseListener {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * Mouse x-coordinate.
+     */
+    protected int fMouseX;
+    
+    /**
+     * Mouse y-coordinate.
+     */
+    protected int fMouseY;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
+     */
+    @Override
+    public void mouseDoubleClick(MouseEvent e) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
+     */
+    @Override
+    public void mouseDown(MouseEvent e) {
+        fMouseX = e.x;
+        fMouseY = e.y;
+        display();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
+     */
+    @Override
+    public void mouseUp(MouseEvent e) {
+    }
+    
+    /**
+     * Callback to display information at the current x-y position
+     */
+    protected abstract void display();
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractMouseTrackListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractMouseTrackListener.java
new file mode 100644 (file)
index 0000000..1c730a8
--- /dev/null
@@ -0,0 +1,77 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors: \r
+ * Philippe Sawicki (INF4990.A2010@gmail.com) - Initial API and implementation \r
+ * Mathieu Denis (mathieu.denis55@gmail.com) - Refactored code\r
+ * Bernd Hufmann - Changed implemented interface to MouseTraceListener\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import org.eclipse.swt.events.MouseEvent;\r
+import org.eclipse.swt.events.MouseTrackListener;\r
+\r
+/**\r
+ *  <b><u>AbstractMouseListener</u></b>\r
+ * <p>\r
+ * AbstractMouseListener, base class for the canvas mouse listener.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public abstract class AbstractMouseTrackListener implements MouseTrackListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Mouse x-coordinate.\r
+     */\r
+    protected int fMouseX;\r
+    /**\r
+     * Mouse y-coordinate.\r
+     */\r
+    protected int fMouseY;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)\r
+     */\r
+    @Override\r
+    public void mouseEnter(MouseEvent event) {\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)\r
+     */\r
+    @Override\r
+    public void mouseExit(MouseEvent event) {\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)\r
+     */\r
+    @Override\r
+    public void mouseHover(MouseEvent event) {\r
+        fMouseX = event.x;\r
+        fMouseY = event.y;\r
+        display();\r
+    }\r
+\r
+    /**\r
+     * Tooltip display callback.\r
+     */\r
+    protected abstract void display();\r
+\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractPaintListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/AbstractPaintListener.java
new file mode 100644 (file)
index 0000000..4b99915
--- /dev/null
@@ -0,0 +1,735 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design, display improvements\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.AbstractViewer;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.Config;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.PaintEvent;\r
+import org.eclipse.swt.events.PaintListener;\r
+import org.eclipse.swt.graphics.Color;\r
+import org.eclipse.swt.graphics.Font;\r
+import org.eclipse.swt.graphics.GC;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.graphics.Rectangle;\r
+import org.eclipse.swt.widgets.Display;\r
+\r
+/**\r
+ * <b><u>AbstractPaintListener</u></b>\r
+ * <p> \r
+ * Abstract paint listener. Draws the graphs on the view canvas.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public abstract class AbstractPaintListener implements PaintListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     *  Default colors and fonts\r
+     */\r
+    protected final Color DEFAULT_DATA_COLOR = new Color(Display.getDefault(), 74, 112, 139);\r
+    protected final static Color DEFAULT_LABEL_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);\r
+    protected final static Color DEFAULT_TEXT_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);\r
+    protected final static Color DEFAULT_DATA_BACKGROUND_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);\r
+    protected final static Color DEFAULT_CURRENT_EVENT_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_RED);\r
+\r
+    protected final Font DEFAULT_TITLE_FONT = new Font(Display.getDefault(), "Arial", 10, SWT.BOLD); //$NON-NLS-1$\r
+    protected final Font DEFAULT_VALUES_FONT = new Font(Display.getDefault(), "Arial", 7, SWT.NORMAL); //$NON-NLS-1$\r
+    protected final Font DEFAULT_LABEL_FONT = new Font(Display.getDefault(), "Arial", 8, SWT.NORMAL); //$NON-NLS-1$\r
+    \r
+    /**\r
+     * A reference to the listener's view.\r
+     */\r
+    protected AbstractViewer fViewer;\r
+\r
+    /**\r
+     * Graph title\r
+     */\r
+    protected String fGraphTitle;\r
+\r
+    /**\r
+     * X-axis label.\r
+     */\r
+    protected String fXAxisLabel;\r
+    \r
+    /**\r
+     * Y-axis label.\r
+     */\r
+    protected String fYAxisLabel;\r
+\r
+    /**\r
+     * Horizontal offset for the x-axis label.\r
+     */\r
+    protected int fXAxisLabelOffset;\r
+\r
+    /**\r
+     * Vertical offset for the horizontal axis offset.\r
+     */\r
+    protected int fHorizontalAxisYOffset = 20;\r
+\r
+    /**\r
+     * Graph padding.\r
+     */\r
+    protected int fPadding = Config.GRAPH_PADDING;\r
+\r
+    /**\r
+     * Graph client area.\r
+     */\r
+    protected Rectangle fClientArea = new Rectangle(0, 0, 1, 1);\r
+\r
+    /**\r
+     * Foreground color.\r
+     */\r
+    protected Color fForegroundColor;\r
+    \r
+    /**\r
+     * Background color.\r
+     */\r
+    protected Color fBackgroundColor;\r
+    \r
+    /**\r
+     * Data plotting color.\r
+     */\r
+    protected Color fDataColor;\r
+    \r
+    /**\r
+     * Axis label color.\r
+     */\r
+    protected Color fLabelColor;\r
+    \r
+    /**\r
+     * Text color.\r
+     */\r
+    protected Color fTextColor;\r
+    \r
+    /**\r
+     * Data background color.\r
+     */\r
+    protected Color fDataBackgroundColor;\r
+\r
+    /**\r
+     * Color for current event time line.\r
+     */\r
+    protected Color fCurrentEventColor;\r
+\r
+    /**\r
+     * Original canvas font.\r
+     */\r
+    protected Font fOriginalFont;\r
+\r
+    /**\r
+     * Font for the title of the graph.\r
+     */\r
+    protected Font fTitleFont;\r
+\r
+    /**\r
+     * Font for the values on the horizontal and vertical axis.\r
+     */\r
+    protected Font fValuesFont;\r
+\r
+    /**\r
+     * Font for the horizontal and vertical labels.\r
+     */\r
+    protected Font fLabelFont;\r
+\r
+    /**\r
+     * Horizontal offset for the axis arrow.\r
+     */\r
+    protected final int ARROW_DELTA_X = 10;\r
+\r
+    /**\r
+     * Vertical offset for the axis arrow.\r
+     */\r
+    protected final int ARROW_DELTA_Y = 4;\r
+\r
+    /**\r
+     * Max horizontal distance between ticks.\r
+     */\r
+    protected final int MAX_WIDTH_BETWEEN_TICKS = 40;\r
+\r
+    /**\r
+     * Max vertical distance between ticks.\r
+     */\r
+    protected final int MAX_HEIGHT_BETWEEN_TICKS = 30;\r
+\r
+    /**\r
+     * Max characters that can be displayed on the vertical axis.\r
+     */\r
+    protected final int MAX_CHAR_VERTICAL_DISPLAY = 5;\r
+\r
+    /**\r
+     * Draw label each "drawLabelEachNTicks_" ticks.\r
+     */\r
+    protected int fDrawLabelEachNTicks = 1;\r
+\r
+    /**\r
+     * Image drawn on the canvas.\r
+     */\r
+    protected Image fImage;\r
+\r
+    /**\r
+     * Paint canvas, where the values are plotted.\r
+     */\r
+    protected GC fAxisImage;\r
+\r
+    /**\r
+     * Is the paint listener initialized ?\r
+     */\r
+    protected boolean fInitialized = false;\r
+\r
+    /**\r
+     * Draw area.\r
+     */\r
+    protected Rectangle fDrawArea;\r
+\r
+    /**\r
+     * Right padding (in pixels).\r
+     */\r
+    protected int fPaddingRight = Config.GRAPH_PADDING;\r
+\r
+    /**\r
+     * Top padding (in pixels).\r
+     */\r
+    protected int fPaddingTop = Config.GRAPH_PADDING;\r
+\r
+    /**\r
+     * Vertical axis offset (in pixels).\r
+     */\r
+    protected int fVerticalAxisOffset = 2 * Config.GRAPH_PADDING;\r
+\r
+    /**\r
+     * Vertical axis factor for values (10^delta). When values larger than MAX_CHAR_VERTICAL_DISPLAY.\r
+     */\r
+    protected int fDelta = 0;\r
+\r
+    /**\r
+     * The barWidth of a bar\r
+     */\r
+    protected int fBarWith = Config.DEFAULT_HISTOGRAM_BAR_WIDTH;\r
+\r
+    /**\r
+     * Minimum value on horizontal axis\r
+     */\r
+    protected long fXMin = -1;\r
+\r
+    /**\r
+     * Maximum value on horizontal axis\r
+     */\r
+    protected long fXMax = -1;\r
+\r
+    /**\r
+     * Minimum value on vertical axis\r
+     */\r
+    protected long fYMin = -1;\r
+\r
+    /**\r
+     * Maximum value on vertical axis\r
+     */\r
+    protected long fYMax = -1;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Constructor.\r
+     * @param view\r
+     *            A reference to the listener's view.\r
+     */\r
+    public AbstractPaintListener(AbstractViewer view) {\r
+        fViewer = view;\r
+        fDataColor = DEFAULT_DATA_COLOR;\r
+        fLabelColor = DEFAULT_LABEL_COLOR;\r
+        fTextColor = DEFAULT_TEXT_COLOR;\r
+        fDataBackgroundColor = DEFAULT_DATA_BACKGROUND_COLOR;\r
+        fCurrentEventColor = DEFAULT_CURRENT_EVENT_COLOR;\r
+        \r
+        fTitleFont = DEFAULT_TITLE_FONT;\r
+        fValuesFont = DEFAULT_VALUES_FONT;\r
+        fLabelFont = DEFAULT_LABEL_FONT;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Accessors\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Returns the draw area height.\r
+     * @return The draw area height.\r
+     */\r
+    public double getHeight() {\r
+        return (fClientArea.height - 2.0 * fPadding - fHorizontalAxisYOffset - fPaddingTop);\r
+    }\r
+\r
+    /**\r
+     * Returns the histogram's draw area width.\r
+     * @return The histogram's draw area width.\r
+     */\r
+    public double getWidth() {\r
+        return (fClientArea.width - 2.0 * fPadding - fVerticalAxisOffset - fPaddingRight);  // width of the plot area;\r
+    }\r
+\r
+    /**\r
+     * Returns the histogram's draw area padding.\r
+     * @return The histogram's draw area padding.\r
+     */\r
+    public int getPadding() {\r
+        return fPadding;\r
+    }\r
+\r
+    /**\r
+     * Returns the histogram's draw area top padding.\r
+     * @return The histogram's draw area top padding.\r
+     */\r
+    public int getPaddingTop() {\r
+        return fPaddingTop;\r
+    }\r
+\r
+    /**\r
+     * Returns the histogram's vertical axis offset.\r
+     * @return The histogram's vertical axis offset.\r
+     */\r
+    public int getVerticalAxisOffset() {\r
+        return fVerticalAxisOffset;\r
+    }\r
+\r
+    /**\r
+     * Returns the histogram's horizontal axis offset.\r
+     * @return The histogram's horizontal axis offset.\r
+     */\r
+    public int getHorizontalAxisYOffset() {\r
+        return fHorizontalAxisYOffset;\r
+    }\r
+\r
+    /**\r
+     *  Returns the horizontal minimum value\r
+     *  @return The horizontal minimum value.\r
+     */\r
+    public long getXMin() {\r
+        return fXMin;\r
+    }\r
+\r
+    /**\r
+     *  Returns the horizontal maximum value\r
+     *  @return The horizontal maximum value.\r
+     */\r
+    public long getXMax() {\r
+        return fXMax;\r
+    }\r
+\r
+    /**\r
+     *  Returns the horizontal minimum value\r
+     *  @return The horizontal minimum value.\r
+     */\r
+    public long getYMin() {\r
+        return fYMin;\r
+    }\r
+\r
+    /**\r
+     *  Returns the vertical maximum value\r
+     *  @return The vertical maximum value.\r
+     */\r
+    public long getYMax() {\r
+        return fYMax;\r
+    }\r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Disposes local resources (e.g. colors or fonts)\r
+     */\r
+    public void dispose() {\r
+        DEFAULT_DATA_COLOR.dispose();\r
+        DEFAULT_TITLE_FONT.dispose();\r
+        DEFAULT_VALUES_FONT.dispose();\r
+        DEFAULT_LABEL_FONT.dispose();\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)\r
+     */\r
+    @Override\r
+    public void paintControl(PaintEvent e) {\r
+        fClientArea = fViewer.getClientArea();\r
+\r
+        fForegroundColor = e.gc.getForeground();\r
+        fBackgroundColor = e.gc.getBackground();\r
+        fOriginalFont = e.gc.getFont();\r
+\r
+        scale();\r
+        \r
+        if (!fInitialized) {\r
+            fImage = new Image(Display.getDefault(), fViewer.getBounds());\r
+\r
+            fAxisImage = new GC(fImage);\r
+\r
+            fAxisImage.setForeground(fForegroundColor);\r
+            fAxisImage.setBackground(fBackgroundColor);\r
+            fAxisImage.fillRectangle(fImage.getBounds());\r
+\r
+            fInitialized = true;\r
+        }\r
+        \r
+        paintGraphTitle();\r
+        paintBackground();     \r
+        paintHorizontalAxis();\r
+        paintVerticalAxis();\r
+        paintContent();\r
+\r
+        e.gc.drawImage(fImage, 0, 0);\r
+    }\r
+\r
+    /**\r
+     * Paints the title of the graph.\r
+     */\r
+    public void paintGraphTitle() {\r
+        if (fGraphTitle != null) {\r
+            fAxisImage.setFont(fTitleFont);\r
+            fAxisImage.setForeground(fLabelColor);\r
+            fAxisImage.setBackground(fBackgroundColor);\r
+\r
+            int zoomFactor = fViewer.getZoomFactor() / fViewer.getZoomIncrement() + 1;\r
+            int labelWidth = fAxisImage.stringExtent(fGraphTitle).x;\r
+            // Draws the zoom factor in the title only if there is one\r
+            if (fViewer.getZoomFactor() > 1)\r
+                fAxisImage.drawText(fGraphTitle + " (" + zoomFactor + "x)", (fViewer.getBounds().width - fPadding - labelWidth) / 2, 0); //$NON-NLS-1$ //$NON-NLS-2$\r
+            else\r
+                fAxisImage.drawText(fGraphTitle, (fViewer.getBounds().width - fPadding - labelWidth) / 2, 0);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Paints the background of the draw area.\r
+     */\r
+    public void paintBackground() {\r
+        fAxisImage.setBackground(fDataBackgroundColor);\r
+\r
+        fAxisImage.fillRectangle(fPadding + fVerticalAxisOffset, fPadding + fPaddingTop, (int)getWidth() + 1, (int)getHeight());\r
+    }\r
+\r
+    /**\r
+     * Paints the horizontal axis.\r
+     */\r
+    public void paintHorizontalAxis() {\r
+        fAxisImage.setForeground(fForegroundColor);\r
+\r
+        int y = fClientArea.height - fPadding - fHorizontalAxisYOffset;\r
+\r
+        fAxisImage.drawLine(fClientArea.x + fPadding + fVerticalAxisOffset, y, fClientArea.width - fPadding, y);\r
+\r
+        paintHorizontalArrow(fClientArea.width - fPadding, y);\r
+        // Draw the axis graphic details only if there are some data points (i.e. do not draw the axis graphic details\r
+        // if the window timerange is so small that no latency can be computed, or if there are no matching events in\r
+        // the timerange (for example, when an experiment has many traces with a large time gap between the logged\r
+        // events sets).\r
+        if (fXMin != Long.MAX_VALUE && fXMax != Long.MIN_VALUE && fXMin != fXMax) {\r
+            paintHorizontalTicks(y);\r
+            paintHorizontalAxisValues(y + 30);\r
+        }\r
+        paintHorizontalAxisLabel(y + fHorizontalAxisYOffset - 5);\r
+    }\r
+\r
+    /**\r
+     * Paints the vertical axis.\r
+     */\r
+    public void paintVerticalAxis() {\r
+        fAxisImage.setForeground(fForegroundColor);\r
+\r
+        int x = fClientArea.x + fPadding + fVerticalAxisOffset;\r
+\r
+        fAxisImage.drawLine(x, fPadding, x, fClientArea.height - fPadding - fHorizontalAxisYOffset);\r
+\r
+        paintVerticalArrow(x, fClientArea.y + fPadding);\r
+        // Draw the axis graphic details only if there are some data points (i.e. do not draw the axis graphic details\r
+        // if the window timerange is so small that no latency can be computed, or if there are no matching events in\r
+        // the timerange (for example, when an experiment has many traces with a large time gap between the logged\r
+        // events sets).\r
+        if (fXMin != Long.MAX_VALUE && fXMax != Long.MIN_VALUE && fXMin != fXMax) {\r
+            paintVerticalTicks(x);\r
+            paintVerticalAxisValues(x);\r
+        }\r
+        paintVerticalAxisLabel(x);\r
+    }\r
+\r
+    /**\r
+     * Paints the arrow on the horizontal axis.\r
+     * @param x\r
+     *            The x-coordinate of the point where the arrow points.\r
+     * @param y\r
+     *            The y-coordinate of the point where the arrow points.\r
+     */\r
+    public void paintHorizontalArrow(int x, int y) {\r
+        // Arrow top line\r
+        fAxisImage.drawLine(x - ARROW_DELTA_X, y - ARROW_DELTA_Y, x, y);\r
+        // Arrow bottom line\r
+        fAxisImage.drawLine(x - ARROW_DELTA_X, y + ARROW_DELTA_Y, x, y);\r
+    }\r
+\r
+    /**\r
+     * Paints the arrow on the vertical axis.\r
+     * @param x\r
+     *            The x-coordinate of the point where the arrow points.\r
+     * @param y\r
+     *            The y-coordinate of the point where the arrow points.\r
+     */\r
+    public void paintVerticalArrow(int x, int y) {\r
+        // Arrow left line\r
+        fAxisImage.drawLine(x - ARROW_DELTA_Y, y + ARROW_DELTA_X, x, y);\r
+        // Arrow right line\r
+        fAxisImage.drawLine(x + ARROW_DELTA_Y, y + ARROW_DELTA_X, x, y);\r
+    }\r
+\r
+    /**\r
+     * Paints the horizontal ticks.\r
+     * @param y\r
+     *            The y coordinate where to draw the axis.\r
+     */\r
+    public void paintHorizontalTicks(int y) {\r
+        if (fXMin >= 0L && fXMax >= 0L) {\r
+            int nbTicks = (int)(getWidth()) / MAX_WIDTH_BETWEEN_TICKS + 1;\r
+\r
+            for (int i = 0; i < nbTicks; i++) {\r
+                if (i % fDrawLabelEachNTicks == 0) {\r
+                    int x = i * MAX_WIDTH_BETWEEN_TICKS + fPadding + fVerticalAxisOffset;\r
+                    fAxisImage.drawLine(x, y, x, y + 3);\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Paints the horizontal axis values.\r
+     * @param y\r
+     *            The y coordinate where to draw the axis.\r
+     */\r
+    public void paintHorizontalAxisValues(int y) {\r
+        if (fXMin >= 0L && fXMax >= 0L) {\r
+            fAxisImage.setForeground(fTextColor);\r
+            fAxisImage.setBackground(fBackgroundColor);\r
+\r
+            double width = getWidth();\r
+            int nbTicks = ((int)getWidth()) / MAX_WIDTH_BETWEEN_TICKS + 1;\r
+\r
+            for (int i = 0; i < nbTicks; i++) {\r
+                if (i % fDrawLabelEachNTicks == 0) {\r
+                    int x = i * MAX_WIDTH_BETWEEN_TICKS + fPadding + fVerticalAxisOffset;\r
+                    \r
+                    long currentValue = (i * MAX_WIDTH_BETWEEN_TICKS)* (long)((fXMax - fXMin) / width) + fXMin;\r
+                    String currentLabel = formatStringForHorizontalAxis(currentValue);\r
+\r
+                    fAxisImage.setFont(fValuesFont);\r
+                    fAxisImage.drawText(currentLabel, x, y - 24);\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Paints the horizontal axis label.\r
+     * @param y\r
+     *            The y-coordinate where to draw the label.\r
+     */\r
+    public void paintHorizontalAxisLabel(int y) {\r
+        if (fXAxisLabel != null) {\r
+            fAxisImage.setFont(fLabelFont);\r
+            fAxisImage.setForeground(fLabelColor);\r
+\r
+            int labelWidth = fAxisImage.stringExtent(fXAxisLabel).x;\r
+\r
+            fAxisImage.drawText(fXAxisLabel, fClientArea.width - fPadding - labelWidth, y);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Paints the vertical axis ticks.\r
+     * @param x\r
+     *            The x-coordinate where to draw the ticks.\r
+     */\r
+    public void paintVerticalTicks(int x) {\r
+        if (fYMin != 0L && fYMax != 0L) {\r
+            int nbTicks = (int)(getHeight() / MAX_HEIGHT_BETWEEN_TICKS + 1);\r
+\r
+            for (int i = 0; i < nbTicks; i++) {\r
+                int y = fClientArea.height - fPadding - fHorizontalAxisYOffset - i * MAX_HEIGHT_BETWEEN_TICKS;\r
+                fAxisImage.drawLine(x - 3, y, x, y);\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Paints the vertical axis values.\r
+     * @param x\r
+     *            The x-coordinate where to draw the values.\r
+     */\r
+    public void paintVerticalAxisValues(int x) {\r
+        if (fYMin >= 0L && fYMax >= 0L) {\r
+            fAxisImage.setForeground(fTextColor);\r
+            fAxisImage.setBackground(fBackgroundColor);\r
+\r
+            double height = getHeight();\r
+            int nbTicks = (int)(height / MAX_HEIGHT_BETWEEN_TICKS + 1);\r
+\r
+            // System.out.println("nbTicks = " + nbTicks);\r
+\r
+            for (int i = 0; i < nbTicks; i++) {\r
+                int y = fClientArea.height - fPadding - fHorizontalAxisYOffset - i * MAX_HEIGHT_BETWEEN_TICKS;\r
+\r
+                long currentValue = (i * MAX_HEIGHT_BETWEEN_TICKS)* (long)((fYMax - fYMin) / height) + fYMin;\r
+                String currentLabel = formatStringForVerticalAxis(currentValue);\r
+\r
+                fAxisImage.setFont(fValuesFont);\r
+\r
+                Point textDimensions = fAxisImage.stringExtent(currentLabel);\r
+                fAxisImage.drawText(currentLabel, x - textDimensions.x - 5, y - textDimensions.y / 2);\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Increases the bar width. \r
+     */\r
+    public void increaseBarWitdh() {\r
+        fBarWith = fBarWith << 1;\r
+        if (fBarWith > Config.MAX_HISTOGRAM_BAR_WIDTH) {\r
+            fBarWith = Config.MAX_HISTOGRAM_BAR_WIDTH;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Decreases the bar width. \r
+     */\r
+    public void decreaseBarWitdh() {\r
+        fBarWith = fBarWith >> 1;\r
+        if (fBarWith < Config.MIN_HISTOGRAM_BAR_WIDTH) {\r
+            fBarWith = Config.MIN_HISTOGRAM_BAR_WIDTH; \r
+        }\r
+    }\r
+\r
+    \r
+    /**\r
+     * Paints the vertical axis label.\r
+     * @param x\r
+     *            The x-coordinate where to draw the label.\r
+     */\r
+    public void paintVerticalAxisLabel(int x) {\r
+        if (fYAxisLabel != null) {\r
+            fAxisImage.setFont(fLabelFont);\r
+            fAxisImage.setForeground(fLabelColor);\r
+            fAxisImage.setBackground(fBackgroundColor);\r
+\r
+            if (fDelta >= 1)\r
+                fAxisImage.drawText(fYAxisLabel + " (x10^" + fDelta + ")", x + 10, fHorizontalAxisYOffset - 5);  //$NON-NLS-1$//$NON-NLS-2$\r
+            else\r
+                fAxisImage.drawText(fYAxisLabel, x + 10, fPadding);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Adds points to the graph and draws them to the canvas.\r
+     * @param points\r
+     *            The buffer of points to draw.\r
+     * @param nbPoints\r
+     *            The number of points in the buffer.\r
+     */\r
+    abstract public String formatToolTipLabel(int x, int y);\r
+\r
+    /**\r
+     * Method to be implemented to scale the model data to the actual screen size.\r
+     */\r
+    abstract public void scale();\r
+    \r
+    /**\r
+     * Called for drawing elements after points are added to the graph.\r
+     */\r
+    abstract public void paintContent();\r
+\r
+    /**\r
+     * Clears the image and prepares it for redrawing.\r
+     */\r
+    public void clear() {\r
+        fInitialized = false;\r
+        fXMin = -1;\r
+        fXMax = -1;\r
+        fYMin = -1;\r
+        fYMax = -1;\r
+    }\r
+    \r
+    /**\r
+     * Draw horizontal label each "nbTicks" ticks.\r
+     * @param nbTicks\r
+     *            The draw interval.\r
+     */\r
+    public void setDrawLabelEachNTicks(int nbTicks) {\r
+        fDrawLabelEachNTicks = nbTicks;\r
+    }\r
+\r
+    /**\r
+     * Sets the title of the graph.\r
+     * @param graphTitle\r
+     *            The title of the graph.\r
+     */\r
+    public void setGraphTitle(String graphTitle) {\r
+        fGraphTitle = graphTitle;\r
+    }\r
+\r
+    /**\r
+     * Sets the horizontal axis label.\r
+     * @param xAxisLabel\r
+     *            The horizontal axis label.\r
+     * @param offset\r
+     *            The horizontal axis draw offset (in pixels).\r
+     */\r
+    public void setXAxisLabel(String xAxisLabel, int offset) {\r
+        fXAxisLabel = xAxisLabel;\r
+        fXAxisLabelOffset = offset;\r
+    }\r
+\r
+    /**\r
+     * Sets the vertical axis label.\r
+     * @param yAxisLabel\r
+     *            The vertical axis label.\r
+     */\r
+    public void setYAxisLabel(String yAxisLabel) {\r
+        fYAxisLabel = yAxisLabel;\r
+    }\r
+\r
+    /**\r
+     * Returns a string representing the given value. \r
+     * \r
+     * @param value\r
+     *            The numeric value to convert to String.\r
+     * @return The String-formatted value.\r
+     */\r
+    public String formatStringForHorizontalAxis(long value) {\r
+        return String.valueOf(value);\r
+    }\r
+\r
+    /**\r
+     * Returns a string representing the given value. \r
+     * \r
+     * @param value\r
+     *            The numeric value to convert to String.\r
+     * @return The String-formatted value.\r
+     */\r
+    public String formatStringForVerticalAxis(long value) {\r
+        return String.valueOf(value);\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/GraphMouseListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/GraphMouseListener.java
new file mode 100644 (file)
index 0000000..4cdd2df
--- /dev/null
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;
+
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.GraphViewer;
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.LatencyGraphModel;
+
+/**
+ * <b><u>GraphMouseListener</u></b>
+ * <p>
+ */
+public class GraphMouseListener extends AbstractMouseListener {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * A reference to the observed view.
+     */
+    protected GraphViewer fView;
+
+    /**
+     * A reference to the HistogramPaintListener.
+     */
+    protected GraphPaintListener fGraph;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+    
+    /**
+     * Constructor.
+     * @param view
+     *            A reference to the observed view.
+     * @param histogramPaintListener
+     *            A reference to the histogram's paintListener.
+     */
+    public GraphMouseListener(GraphViewer view, GraphPaintListener graphPaintListener) {
+        fView = view;
+        fGraph = graphPaintListener;
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseListener#display()
+     */
+    @Override
+    protected void display() {
+        long currentTime = fGraph.getCurrentTimeFromHorizontalValue(fMouseX);
+        ((LatencyGraphModel)fView.getModel()).setCurrentEventNotifyListeners(currentTime);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/GraphPaintListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/GraphPaintListener.java
new file mode 100644 (file)
index 0000000..6016121
--- /dev/null
@@ -0,0 +1,227 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design, display improvements\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import java.text.DecimalFormat;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.AbstractViewer;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.GraphViewer;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.Config;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.GraphScaledData;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.model.IGraphDataModel;\r
+import org.eclipse.linuxtools.tmf.ui.views.distribution.model.BaseDistributionData;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramUtils;\r
+\r
+/**\r
+ * <b><u>GraphPaintListener</u></b>\r
+ * <p>\r
+ * Graph paint listener.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class GraphPaintListener extends AbstractPaintListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Scaled data from data model\r
+     */\r
+    protected GraphScaledData fScaledData;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param viewer\r
+     *            A reference to the listener's viewer.\r
+     */\r
+    public GraphPaintListener(AbstractViewer view) {\r
+        super(view);\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#scale()\r
+     */\r
+    @Override\r
+    public void scale() {\r
+         \r
+         // width of the plot area\r
+         double width = getWidth();\r
+         // height of the plot area\r
+         double height = getHeight();\r
+\r
+         IGraphDataModel model = ((GraphViewer)fViewer).getModel();\r
+         fScaledData = model.scaleTo((int)width, (int)height, fBarWith);\r
+\r
+         fXMin = fScaledData.getHorFirstBucketTime() > 0 ? fScaledData.getHorFirstBucketTime() : 0;\r
+         fXMax = 0;\r
+         if (fScaledData.getHorLastBucket() > 0) {\r
+             fXMax = fScaledData.getHorBucketEndTime(fScaledData.getHorNbBuckets() - 1);\r
+         }\r
+         \r
+         fYMin = fScaledData.getVerFirstBucketTime() > 0 ? fScaledData.getVerFirstBucketTime() : 0;\r
+         fYMax = 0;\r
+         if (fScaledData.getVerLastBucket() > 0) {\r
+             fYMax = fScaledData.getVerBucketEndTime(fScaledData.getVerNbBuckets() - 1);\r
+         }\r
+     }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintContent()\r
+     */\r
+    @Override\r
+    public void paintContent() {\r
+        if (fXMin >= 0 && fXMax >= 0 && fYMin >= 0 && fYMax >= 0 && fScaledData != null) {\r
+            \r
+            fAxisImage.setForeground(fDataColor);\r
+            fAxisImage.setBackground(fDataColor);\r
+\r
+            double height = getHeight();\r
+\r
+            int xLen = fScaledData.getHorNbBuckets();\r
+            int yLen = fScaledData.getVerNbBuckets();\r
+\r
+            int barWidth = fScaledData.getBarWidth();\r
+            \r
+            for (int i = 0; i < xLen; i++) {\r
+                for (int j = 0; j < yLen; j++) {\r
+                    if (fScaledData.getEventCount(i, j) > 0) {\r
+\r
+                        double x = fPadding + i * barWidth + fVerticalAxisOffset + 1;\r
+                        double y = fPadding + fPaddingTop + height - j * barWidth;\r
+\r
+                        // Avoid over-drawing background area\r
+                        int yBarWidth = fBarWith;\r
+                        if (y - yBarWidth < fPadding + fPaddingTop) {\r
+                            yBarWidth = (int) (y - fPadding - fPaddingTop);\r
+                        }\r
+                        int xBarWidth = fBarWith;\r
+                        if(x + xBarWidth > fClientArea.width - fPadding - fPaddingRight) {\r
+                            xBarWidth =  (int)(fClientArea.width - fPadding - fPaddingRight - x);    \r
+                        }\r
+                        fAxisImage.fillRectangle((int) x, (int) y - (int) yBarWidth, (int) xBarWidth, (int) yBarWidth);\r
+                    }\r
+                }\r
+            }\r
+            \r
+            if (fScaledData.isCurrentEventTimeValid()) {\r
+                // Draw vertical line\r
+                int index = fScaledData.getHorBucketIndex(fScaledData.getCurrentEventTime());\r
+\r
+                int x = fPadding + index * barWidth + fVerticalAxisOffset + 1;\r
+                fAxisImage.setForeground(fCurrentEventColor);\r
+                fAxisImage.setBackground(fCurrentEventColor);\r
+                fAxisImage.drawLine(x, fPadding + fPaddingTop, x, fClientArea.height - fPadding - fHorizontalAxisYOffset);\r
+            }\r
+        }\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatStringForVerticalAxis(long)\r
+     */\r
+    @Override\r
+    public String formatStringForVerticalAxis(long value) {\r
+        DecimalFormat formatter = new DecimalFormat("0.0E0"); //$NON-NLS-1$\r
+        return formatter.format(value);\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatStringForHorizontalAxis(long)\r
+     */\r
+    @Override\r
+    public String formatStringForHorizontalAxis(long value) {\r
+        return HistogramUtils.nanosecondsToString(value);\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatToolTipLabel(int, int)\r
+     */\r
+    @Override\r
+    public String formatToolTipLabel(int x, int y) {\r
+\r
+        int index = getIndexFromHorizontalValue(x);\r
+        int yIndex = getIndexFromVerticalValue(y);\r
+\r
+        if (index != BaseDistributionData.OUT_OF_RANGE_BUCKET && yIndex != BaseDistributionData.OUT_OF_RANGE_BUCKET) {\r
+            if (fScaledData.getEventCount(index, yIndex) > 0) {\r
+                StringBuffer buffer = new StringBuffer();\r
+                buffer.append("Time Range in s = ["); //$NON-NLS-1$\r
+                // TODO change Utility\r
+                long startTime = fScaledData.getHorBucketStartTime(index) > 0 ? fScaledData.getHorBucketStartTime(index) : 0;\r
+                buffer.append(HistogramUtils.nanosecondsToString(startTime));\r
+                buffer.append(","); //$NON-NLS-1$\r
+                buffer.append(HistogramUtils.nanosecondsToString(fScaledData.getHorBucketEndTime(index)));\r
+                buffer.append("]\n"); //$NON-NLS-1$\r
+                buffer.append("Latency Range in s = ["); //$NON-NLS-1$\r
+                long yStartTime = fScaledData.getVerBucketStartTime(yIndex) > 0 ? fScaledData.getVerBucketStartTime(yIndex) : 0;\r
+                buffer.append(HistogramUtils.nanosecondsToString(yStartTime));\r
+                buffer.append(","); //$NON-NLS-1$\r
+                buffer.append(HistogramUtils.nanosecondsToString(fScaledData.getVerBucketEndTime(yIndex)));\r
+                buffer.append("]\n"); //$NON-NLS-1$\r
+                buffer.append("Latency count = "); //$NON-NLS-1$\r
+                buffer.append(fScaledData.getEventCount(index, yIndex));\r
+                return buffer.toString();\r
+            }\r
+        }\r
+        return ""; //$NON-NLS-1$\r
+    }\r
+    \r
+    public int getIndexFromHorizontalValue(int x) {\r
+        if (fScaledData != null) {\r
+            double barWidth = fScaledData.getBarWidth();\r
+            \r
+            int index = (int) ((x - fPadding - fVerticalAxisOffset - 1) / barWidth);\r
+            if ((index >= 0) && (fScaledData.getHorNbBuckets() > index)) {\r
+                return index;\r
+            }\r
+        }\r
+        return BaseDistributionData.OUT_OF_RANGE_BUCKET;\r
+    }\r
+    \r
+    public int getIndexFromVerticalValue(int y) {\r
+        if (fScaledData != null) {\r
+            double barWidth = fScaledData.getBarWidth();\r
+            double height = getHeight();     // height of the plot area\r
+            \r
+            int index = (int) ((height - (y - fPadding - fPaddingTop)) / barWidth);\r
+            if (index >= 0 && fScaledData.getVerNbBuckets() > index) {\r
+                return index;\r
+            }\r
+        }\r
+        return BaseDistributionData.OUT_OF_RANGE_BUCKET;\r
+    }\r
+\r
+    public long getCurrentTimeFromHorizontalValue(int x) {\r
+        if (fXMin >= 0 && fXMax >= 0) {\r
+            int index = getIndexFromHorizontalValue(x);\r
+            if (index != BaseDistributionData.OUT_OF_RANGE_BUCKET) {\r
+                return fScaledData.getHorBucketStartTime(index);\r
+            }\r
+        }\r
+        return Config.INVALID_EVENT_TIME;\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/HistogramPaintListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/HistogramPaintListener.java
new file mode 100644 (file)
index 0000000..fb7c96b
--- /dev/null
@@ -0,0 +1,355 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Adapted to new model-view-controller design, display improvements\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import java.text.DecimalFormat;\r
+import java.util.Collections;\r
+import java.util.Vector;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.AbstractViewer;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.HistogramViewer;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.Messages;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramScaledData;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramUtils;\r
+import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.ui.plugin.AbstractUIPlugin;\r
+\r
+/**\r
+ * <b><u>HistogramPaintListener</u></b>\r
+ * <p>\r
+ * Histogram paint listener.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class HistogramPaintListener extends AbstractPaintListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Is a histogram bar so high that it is clipped from the draw area ?\r
+     */\r
+    private boolean fBarIsClipped = false;\r
+\r
+    /**\r
+     * Scaled data from data model\r
+     */\r
+    protected HistogramScaledData fScaledData;\r
+\r
+    /**\r
+     * Warning Image\r
+     */\r
+    protected Image fWarningImage;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Constructor.\r
+     * @param view\r
+     *            A reference to the listener's viewer.\r
+     */\r
+    public HistogramPaintListener(AbstractViewer viewer) {\r
+        super(viewer);\r
+        fWarningImage = AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/warning.gif").createImage(Display.getCurrent()); //$NON-NLS-1$\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Accessors\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Returns the histogram's bar Width.\r
+     * @return The histogram's bar Width.\r
+     */\r
+    public int getBarWidth() {\r
+        return fBarWith;\r
+    }\r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#dispose()\r
+     */\r
+    @Override\r
+    public void dispose() {\r
+        fWarningImage.dispose();\r
+        super.dispose();\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#scale()\r
+     */\r
+    @Override\r
+    public void scale() {\r
+        // width of the plot area\r
+        double width = getWidth();\r
+        // height of the plot area\r
+        double height = getHeight();\r
+\r
+        int barWidth = getBarWidth();\r
+\r
+        IHistogramDataModel model = ((HistogramViewer)fViewer).getModel();\r
+        fScaledData = model.scaleTo((int)width, (int)height, barWidth);\r
+\r
+        fYMin = 0;\r
+        fYMax = fScaledData.fMaxValue;\r
+\r
+        fXMin = fScaledData.getFirstBucketTime();\r
+        fXMin = fXMin > 0 ? fXMin : 0; \r
+        fXMax = fScaledData.getBucketEndTime(fScaledData.fLastBucket - 1);\r
+\r
+        // No data to display - set end time to 0 \r
+        if (fYMax == 0) {\r
+            fXMax = 0;\r
+        }\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintVerticalTicks(int)\r
+     */\r
+    @Override\r
+    public void paintVerticalTicks(int x) {\r
+        // done in method paintVerticalAxisValues()\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintVerticalAxisValues(int)\r
+     */\r
+    @Override\r
+    public void paintVerticalAxisValues(int x) {\r
+        int zoomFactor = 1;\r
+\r
+        zoomFactor = fViewer.getZoomFactor();\r
+\r
+        if (fYMin >= 0L && fYMax != 0L) {\r
+            fAxisImage.setForeground(fTextColor);\r
+            fAxisImage.setBackground(fBackgroundColor);\r
+\r
+            // Apply the zoom to the max value of the graph for the next calculations\r
+            long yMax = fYMax / zoomFactor;\r
+\r
+            int nbTicks = ((int)getHeight()) / MAX_HEIGHT_BETWEEN_TICKS + 1;\r
+\r
+            Vector<Integer> values = new Vector<Integer>();\r
+            boolean multipleSameValues = true;\r
+            while (multipleSameValues) {\r
+                double valueStep = (double) (yMax - fYMin) / (double) (nbTicks);\r
+\r
+                for (int i = 0; i < nbTicks; i++) {\r
+                    double currentValue = (double) (fYMin + i * valueStep) / (Math.pow(10, fDelta));\r
+\r
+                    values.add((int) currentValue);\r
+                }\r
+\r
+                Collections.sort(values);\r
+                boolean hasRepetition = false;\r
+                for (int i = 1; i < values.size(); i++) {\r
+                    if (values.get(i) == values.get(i - 1)) {\r
+                        hasRepetition = true;\r
+                        break;\r
+                    }\r
+                }\r
+\r
+                if (hasRepetition) {\r
+                    nbTicks--;\r
+                    values.clear();\r
+                } else {\r
+                    multipleSameValues = false;\r
+\r
+                    // Draw rectangle over the old values\r
+                    int height = fViewer.getBounds().height - 2 * fPadding - fPaddingTop - fHorizontalAxisYOffset;\r
+                    fAxisImage.fillRectangle(0, fPadding + fPaddingTop, fPadding + fVerticalAxisOffset, height);\r
+\r
+                    double pixelStep = (getHeight()) / values.size() + 1;\r
+\r
+                    for (int i = 0; i < values.size(); i++) {\r
+                        double currentValue = values.get(i);\r
+\r
+                        int y = (int)  (fClientArea.height - fPadding - fHorizontalAxisYOffset -  i * pixelStep);\r
+                        String currentLabel = formatStringForVerticalAxis((long) currentValue);\r
+\r
+                        fAxisImage.setFont(fValuesFont);\r
+\r
+                        Point textDimensions = fAxisImage.stringExtent(currentLabel);\r
+                        fAxisImage.drawText(currentLabel, x - textDimensions.x - 5, y - textDimensions.y / 2);\r
+                        fAxisImage.drawLine(x - 3, y, x, y);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintContent()\r
+     */\r
+    @Override\r
+    public void paintContent() {\r
+        double zoomFactor = fViewer.getZoomFactor();\r
+\r
+        // Calculate the vertical axis factor and see if it has changed\r
+        double tmpDelta = fDelta;\r
+        fDelta = 0;\r
+        if (Long.toString(fYMax / (long) zoomFactor).length() > MAX_CHAR_VERTICAL_DISPLAY) {\r
+            fDelta = Long.toString(fYMax / (long) zoomFactor).length() - MAX_CHAR_VERTICAL_DISPLAY;\r
+        }\r
+        if (tmpDelta != fDelta) {\r
+            fViewer.clearBackground();\r
+        }\r
+\r
+        paintBackground();\r
+        paintVerticalAxis();\r
+        paintHorizontalAxis();\r
+\r
+        fAxisImage.setForeground(fDataColor);\r
+        fAxisImage.setBackground(fDataColor);\r
+\r
+        // height of the plot area\r
+        double height = getHeight();\r
+\r
+        int barWidth = getBarWidth();\r
+        \r
+        // axisImage_.setBackground(backgroundColor_);\r
+        // 1.a Iterate over the points, from 0 to nbPoints\r
+        // 1.b Find the max counter value\r
+        // 2. Assign the max value to the "yMax_" class attribute\r
+        // 3. Draw the histogram bars using "axisImage_.fillRectangle(...)"\r
+        boolean oneBarIsClipped = false;\r
+\r
+        for (int i = 0; i < fScaledData.fData.length; i++) {\r
+            double pointY = fScaledData.fData[i];\r
+\r
+            // in pixels\r
+            double x = fPadding + i * barWidth + fVerticalAxisOffset + 1;\r
+\r
+            if (i == fScaledData.fData.length - 1)\r
+                x -= 1.0;\r
+            double barHeight = zoomFactor * ((double)(pointY - fYMin) / (double)(fYMax - fYMin)) * height;\r
+\r
+            if (barHeight > height + 1) {\r
+                barHeight = height;\r
+                oneBarIsClipped = true;\r
+\r
+                fAxisImage.drawImage(fWarningImage, 5, 3);\r
+            }\r
+\r
+            // Only draw the bars that have a barHeight of more than 1 pixel\r
+            if (barHeight > 0) {\r
+                double y = fPadding + fPaddingTop + height - barHeight;\r
+                fAxisImage.setBackground(fDataColor);\r
+\r
+                if (barHeight > height - 1) {\r
+                    fAxisImage.fillRectangle((int) x, (int) y, (int) barWidth, (int) (barHeight + 1));\r
+                } else {\r
+                    fAxisImage.fillRectangle((int) x, (int) y, (int) barWidth, (int) (barHeight + 2));\r
+                }\r
+            }\r
+        }\r
+\r
+        if (oneBarIsClipped)\r
+            fBarIsClipped = true;\r
+        else\r
+            fBarIsClipped = false;\r
+    }\r
+    \r
+    /**\r
+     * Paints the histogram horizontal axis values in engineering notation in which the exponent is a multiple of three.\r
+     * @param value\r
+     *            The numeric value to convert to engineering notation.\r
+     * @return The given value formatted according to the engineering notation.\r
+     */\r
+    @Override\r
+    public String formatStringForHorizontalAxis(long value) {\r
+        DecimalFormat formatter = new DecimalFormat("##0.#E0"); //$NON-NLS-1$\r
+        return formatter.format(value);\r
+    }\r
+\r
+    /**\r
+     * Sets the bar width.\r
+     * @param barWidth \r
+     *            bar width to set\r
+     */\r
+    public void setBarWidth(int barWidth) {\r
+        fBarWith = barWidth;\r
+    }\r
+    \r
+    /**\r
+     * Returns "true" if a histogram bar is so high that it cannot be drawn in the draw area, "false" otherwise.\r
+     * @return "true" if a histogram bar is so high that it cannot be drawn in the draw area, "false" otherwise.\r
+     */\r
+    public boolean barIsClipped() {\r
+        return fBarIsClipped;\r
+    }\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatToolTipLabel(int, int)\r
+     */\r
+    @Override\r
+    public String formatToolTipLabel(int x, int y) {\r
+        if (fScaledData != null) {\r
+\r
+            double barWidth = getBarWidth();\r
+            double height = getHeight();     // height of the plot area\r
+            \r
+            double zoomFactor = fViewer.getZoomFactor();\r
+\r
+            int index = (int) ((x - fPadding - fVerticalAxisOffset - 1) / barWidth);\r
+\r
+            double barHeight = 0.0;\r
+            if (index >= 0 && index <= fScaledData.fLastBucket) {\r
+                barHeight = (zoomFactor * height * (fScaledData.fData[index] - fYMin) / (fYMax - fYMin));\r
+            }\r
+\r
+            long fMouseY = (long) (height - (y - fPadding - fPaddingTop));\r
+\r
+            // Verifying mouse pointer is over histogram bar\r
+            if (index >= 0 && fScaledData.fLastBucket >= index && fMouseY >= 0 && fMouseY < barHeight && fMouseY < height && x >= (fVerticalAxisOffset + fPadding)) {\r
+\r
+                fScaledData.fCurrentBucket = index;\r
+\r
+                long startTime = fScaledData.getBucketStartTime(index);\r
+                // negative values are possible if time values came into the model in decreasing order\r
+                if (startTime < 0) {\r
+                    startTime = 0;\r
+                }\r
+                long endTime = fScaledData.getBucketEndTime(index);\r
+                int nbEvents = fScaledData.fData[index];\r
+\r
+                StringBuffer buffer = new StringBuffer();\r
+                buffer.append("Latency Range in s = ["); //$NON-NLS-1$\r
+                buffer.append(HistogramUtils.nanosecondsToString(startTime));\r
+                buffer.append(","); //$NON-NLS-1$\r
+                buffer.append(HistogramUtils.nanosecondsToString(endTime));\r
+                buffer.append("]\n"); //$NON-NLS-1$\r
+                buffer.append("Latency count = "); //$NON-NLS-1$\r
+                buffer.append(nbEvents);\r
+                return buffer.toString();\r
+            }\r
+        }\r
+        return ""; //$NON-NLS-1$\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/TimePointerListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/TimePointerListener.java
new file mode 100644 (file)
index 0000000..eb09dde
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *   Bernd Hufmann - Changed display interface implementation \r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.AbstractViewer;\r
+\r
+/**\r
+ * <b><u>TimePointerListener</u></b>\r
+ * <p>\r
+ * Displays a tooltip showing the approximate values of the point under the mouse cursor.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class TimePointerListener extends AbstractMouseTrackListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * A reference to the observed view.\r
+     */\r
+    protected AbstractViewer fView;\r
+\r
+    /**\r
+     * A reference to the HistogramPaintListener.\r
+     */\r
+    protected GraphPaintListener fGraph;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Constructor.\r
+     * @param view\r
+     *            A reference to the observed view.\r
+     * @param histogramPaintListener\r
+     *            A reference to the histogram's paintListener.\r
+     */\r
+    public TimePointerListener(AbstractViewer view, GraphPaintListener graphPaintListener) {\r
+        fView = view;\r
+        fGraph = graphPaintListener;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseTrackListener#display()\r
+     */\r
+    @Override\r
+    protected void display() {\r
+        fView.setToolTipText(fGraph.formatToolTipLabel(fMouseX, fMouseY));\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/TooltipListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/TooltipListener.java
new file mode 100644 (file)
index 0000000..e02d41b
--- /dev/null
@@ -0,0 +1,100 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com) - Initial API and implementation\r
+ *   Bernd Hufmann - Changed display interface implementation\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.AbstractViewer;\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.Messages;\r
+\r
+/**\r
+ * <b><u>TooltipListener</u></b>\r
+ * <p>\r
+ * Tooltip listener, displays the event count for each latency selected by the mouse click area on histogram.\r
+ * \r
+ * @author Ali Jawhar\r
+ */\r
+public class TooltipListener extends AbstractMouseTrackListener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * A reference to the observed view.\r
+     */\r
+    protected AbstractViewer fView;\r
+\r
+    /**\r
+     * A reference to the HistogramPaintListener.\r
+     */\r
+    protected HistogramPaintListener fHistogram;\r
+\r
+    /**\r
+     * Is the mouse over the warning icon, indicating that a bar is higher than the draw area due to zooming ?\r
+     */\r
+    protected boolean fDisplayWarning = false;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Constructor.\r
+     * @param view\r
+     *            A reference to the observed view.\r
+     * @param histogramPaintListener\r
+     *            A reference to the histogram's paintListener.\r
+     */\r
+    public TooltipListener(AbstractViewer view, HistogramPaintListener histogramPaintListener) {\r
+        fView = view;\r
+        fHistogram = histogramPaintListener;\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseTrackListener#display()\r
+     */\r
+    @Override\r
+    protected void display() {\r
+        displayWarningTooltip();\r
+        displayTooltip();\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Helper Functions\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /**\r
+     * Displays a tooltip if the mouse is over the warning icon indication that a bar cannot be draw entirely due to the\r
+     * zoom factor.\r
+     */\r
+    protected void displayWarningTooltip() {\r
+        if (fHistogram.barIsClipped() && fMouseX > 5 && fMouseX < 21 && fMouseY > 3 && fMouseY < 18) {\r
+            fView.setToolTipText(Messages.LatencyView_ClippingWarning);\r
+            fDisplayWarning = true;\r
+        } else {\r
+            fDisplayWarning = false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Displays the tooltip showing the details of the histogram bar pointed by the mouse.\r
+     */\r
+    protected void displayTooltip() {\r
+        if (!fDisplayWarning)\r
+            fView.setToolTipText(fHistogram.formatToolTipLabel(fMouseX, fMouseY));\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/ZoomListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/listeners/ZoomListener.java
new file mode 100644 (file)
index 0000000..0c93b36
--- /dev/null
@@ -0,0 +1,134 @@
+/*******************************************************************************\r
+ * Copyright (c) 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.listeners;\r
+\r
+import org.eclipse.linuxtools.internal.lttng.ui.views.latency.AbstractViewer;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Canvas;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Listener;\r
+\r
+/**\r
+ * <b><u>ZoomListener</u></b>\r
+ * <p>\r
+ * \r
+ * Canvas zoom listener.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class ZoomListener implements Listener {\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Attributes\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * A reference to the observed view.\r
+     */\r
+    protected AbstractViewer fView;\r
+    /**\r
+     * Default zoom factor.\r
+     */\r
+    protected int fZoomFactor;\r
+    /**\r
+     * Zoom increment.\r
+     */\r
+    protected int fZoomIncrement = 30;\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Constructors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param view\r
+     *            A reference to the observed view.\r
+     * @param defaultZoomFactor\r
+     *            Default zoom factor.\r
+     */\r
+    public ZoomListener(AbstractViewer view, int defaultZoomFactor) {\r
+        fView = view;\r
+        fZoomFactor = defaultZoomFactor;\r
+    }\r
+\r
+    /**\r
+     * Constructor.\r
+     * @param view\r
+     *            A reference to the observed view.\r
+     */\r
+    public ZoomListener(AbstractViewer view) {\r
+        this(view, 1);\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // Accessors\r
+    // ------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Returns the zoom factor.\r
+     * @return The zoom factor.\r
+     */\r
+    public int getZoomFactor() {\r
+        if (fZoomFactor < 1)\r
+            return 1;\r
+        else\r
+            return fZoomFactor;\r
+    }\r
+\r
+    /**\r
+     * Returns the zoom increment.\r
+     * @return The zoom increment.\r
+     */\r
+    public int getZoomIncrement() {\r
+        return fZoomIncrement;\r
+    }\r
+    \r
+    // ------------------------------------------------------------------------\r
+    // Operations\r
+    // ------------------------------------------------------------------------\r
+    \r
+    /*\r
+     * (non-Javadoc)\r
+     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)\r
+     */\r
+    @Override\r
+    public void handleEvent(Event event) {\r
+        switch (event.type) {\r
+            case SWT.MouseWheel:\r
+                boolean scrollDown = (event.count == 0 ? false : (event.count > 0 ? false : true));\r
+                int zoomStep = fZoomIncrement;\r
+                if (scrollDown)\r
+                    zoomStep = -fZoomIncrement;\r
+                fZoomFactor = Math.max(0, fZoomFactor + zoomStep);\r
+\r
+                Canvas canvas = (Canvas) event.widget;\r
+                if (fView != null) {\r
+                    // clear the background to allow redraw of values of the vertical axis.\r
+                    fView.clearBackground();\r
+                    fView.redrawTitle();\r
+                    fView.askForRedraw();\r
+                }\r
+                canvas.redraw();\r
+                break;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Sets the zoom increment.\r
+     * @param zoomIncrement\r
+     *            The new zoom increment.\r
+     */\r
+    public void setZoomIncrement(int zoomIncrement) {\r
+        fZoomIncrement = zoomIncrement;\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/messages.properties
new file mode 100644 (file)
index 0000000..cf907c0
--- /dev/null
@@ -0,0 +1,59 @@
+#*******************************************************************************\r
+# Copyright (c) 2011 Ericsson\r
+#  \r
+# All rights reserved. This program and the accompanying materials are\r
+# made available under the terms of the Eclipse Public License v1.0 which\r
+# accompanies this distribution, and is available at\r
+# http://www.eclipse.org/legal/epl-v10.html\r
+#  \r
+# Contributors:\r
+#   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+#   Bernd Hufmann - Updated and added properties    \r
+# *******************************************************************************/\r
+\r
+LatencyView_ViewName=LatencyView\r
+LatencyView_Action_IncreaseBarWidth_Tooltip=Increase bar width/height\r
+LatencyView_Action_DecreaseBarWidth_Tooltip=Decrease bar width/height\r
+LatencyView_Action_AddEvents_Tooltip=Add matching events\r
+LatencyView_Action_DeleteEvents_Tooltip=Delete matching events\r
+LatencyView_Action_ListEvents_Tooltip=List matching events\r
+LatencyView_Dialogs_AddEvents_Title=Add event pairs\r
+LatencyView_Dialogs_AddEvents_Message=Select a pair of events to add it to the match list :\r
+LatencyView_Dialogs_AddEvents_Buttons_Add=Add\r
+LatencyView_Dialogs_AddEvents_Buttons_Close=Close\r
+LatencyView_Dialogs_AddEvents_Columns_Start=Start event types\r
+LatencyView_Dialogs_AddEvents_Columns_End=End event types\r
+LatencyView_Dialogs_AddEvents_Columns_List_Trigger=Trigger event type\r
+LatencyView_Dialogs_AddEvents_Columns_List_End=End event type\r
+LatencyView_Dialogs_AddEvents_Errors_NoSelection=You must select one item from both lists_\r
+LatencyView_Dialogs_AddEvents_Errors_StartNotSelected=You must select one item from the start event list_\r
+LatencyView_Dialogs_AddEvents_Errors_EndNotSelected=You must select one item from the end event list_\r
+LatencyView_Dialogs_AddEvents_Errors_SameSelected=The same event cannot be selected in both list at the same time_\r
+LatencyView_Dialogs_AddEvents_Errors_AlreadyMatched=The start and end events are already matched_\r
+LatencyView_Dialogs_AddEvents_Errors_StartAlreadyMatched=The start event is already matched_\r
+LatencyView_Dialogs_AddEvents_Errors_EndAlreadyMatched=The end event is already matched_\r
+LatencyView_Dialogs_AddEvents_Errors_StartAsEnd=The start event is already matched as an end event_\r
+LatencyView_Dialogs_AddEvents_Errors_EndAsStart=The end event is already matched as a start event_\r
+LatencyView_Dialogs_DeleteEvents_Title=Delete event pairs\r
+LatencyView_Dialogs_DeleteEvents_Message=Select a pair of matched events to remove it from the list :\r
+LatencyView_Dialogs_DeleteEvents_Buttons_Close=Close\r
+LatencyView_Dialogs_DeleteEvents_Buttons_Delete=Delete\r
+LatencyView_Dialogs_DeleteEvents_Confirm_Title=Confirm event deletion\r
+LatencyView_Dialogs_DeleteEvents_Confirm_Message=Are you sure you want to delete these event pairs?\r
+LatencyView_Dialogs_ListEvents_Title=Matched events list\r
+LatencyView_Dialogs_ListEvents_Message=List of matched events for latency computation :\r
+LatencyView_Dialogs_ListEvents_Buttons_Close=Close\r
+LatencyView_Dialogs_ListEvents_Buttons_Reset=Reset to default pairs\r
+LatencyView_Dialogs_ListEvents_Columns_Trigger=Trigger event type\r
+LatencyView_Dialogs_ListEvents_Columns_End=End event type\r
+LatencyView_Dialogs_ListEvents_Confirm_Title=Confirm pairs reset\r
+LatencyView_Dialogs_ListEvents_Confirm_Message=Are you sure you want to reset the event pairs to their default values?\r
+LatencyView_Graphs_Graph_Title=Latency vs Time\r
+LatencyView_Graphs_Graph_XAxisLabel=time (s)\r
+LatencyView_Graphs_Graph_YAxisLabel=latency (ms)\r
+LatencyView_Graphs_Histogram_Title=Latency Distribution\r
+LatencyView_Graphs_Histogram_XAxisLabel=latency (ms)\r
+LatencyView_Graphs_Histogram_YAxisLabel=# events\r
+LatencyView_msgSlogan=Latency View\r
+LatencyView_tmf_UI=org.eclipse.linuxtools.lttng.ui\r
+LatencyView_ClippingWarning=One or more bars are higher than the drawing area due to zooming
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/Config.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/Config.java
new file mode 100644 (file)
index 0000000..d9533b5
--- /dev/null
@@ -0,0 +1,76 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2011 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
+ *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactor code\r
+ *   Bernd Hufmann - Added and updated constants\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;\r
+\r
+/**\r
+ * <b><u>Config</u></b>\r
+ * <p>\r
+ * Configuration class, holds some application constants.\r
+ * \r
+ * @author Philippe Sawicki\r
+ */\r
+public class Config {\r
+\r
+    /**\r
+     * Private constructor to defeat instantiation.\r
+     */\r
+    private Config() {\r
+    }\r
+\r
+    /**\r
+     * Time scale for TMF events;\r
+     */\r
+    public static final byte TIME_SCALE = -9;\r
+    \r
+    /**\r
+     * Size of the point buffer holding point values before sending them to the view.\r
+     */\r
+    public static final int POINT_BUFFER_SIZE = 10000;\r
+\r
+    /**\r
+     * Histogram bar width.\r
+     */\r
+    public static final int DEFAULT_HISTOGRAM_BAR_WIDTH = 2;\r
+    \r
+    /**\r
+     * Histogram bar width increase step.\r
+     */\r
+    public static final int MIN_HISTOGRAM_BAR_WIDTH = 1;\r
+\r
+    /**\r
+     * Histogram bar width increase step.\r
+     */\r
+    public static final int MAX_HISTOGRAM_BAR_WIDTH = 16;\r
+\r
+    \r
+    /**\r
+     * Diameter of a point drawn on the chart (in pixels).\r
+     */\r
+    public static final int GRAPH_POINT_DIAMETER = 1;\r
+\r
+    /**\r
+     * Graph padding.\r
+     */\r
+    public static final int GRAPH_PADDING = 10;\r
+\r
+    /**\r
+     * Default number of buckets used in data models\r
+     */\r
+    public static final int DEFAULT_NUMBER_OF_BUCKETS = 2 * 1000;\r
+    \r
+    /**\r
+     * Invalid event time\r
+     */\r
+    public static final long INVALID_EVENT_TIME = -1;\r
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/GraphScaledData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/GraphScaledData.java
new file mode 100644 (file)
index 0000000..010389a
--- /dev/null
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
+
+/**
+ * <b><u>GraphScaledData</u></b>
+ * Convenience class for scaled distribution data.  
+ * <p>
+ */
+import java.util.Arrays;
+
+import org.eclipse.linuxtools.tmf.ui.views.distribution.model.BaseDistributionData;
+
+public class GraphScaledData {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private int fWidth;
+    private int fHeight;
+    private int fBarWidth;
+    private int[][] fData;
+    private BaseDistributionData fHorDistributionData;
+    private BaseDistributionData fVerDistributionData;
+    private long fCurrentEventTime;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    public GraphScaledData(int width, int height, int barWidth) {
+        fWidth = width;
+        fHeight = height;
+        fBarWidth = barWidth;
+        int horNbBuckets = (int)width/barWidth;
+        int verNbBuckets = (int)height/barWidth; 
+        fData = new int[horNbBuckets][verNbBuckets];
+        for (int[] row : fData) {
+            Arrays.fill(row, 0);    
+        }
+        fHorDistributionData = new BaseDistributionData(horNbBuckets);
+        fHorDistributionData.clear();
+        
+        fVerDistributionData = new BaseDistributionData(verNbBuckets);
+        fVerDistributionData.clear();
+        
+        fCurrentEventTime = Config.INVALID_EVENT_TIME;
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    public int getWidth() {
+        return fWidth;
+    }
+
+    public int getHeight() {
+        return fHeight;
+    }
+
+    public int getBarWidth() {
+        return fBarWidth;
+    }
+
+    public int[][] getData() {
+        return fData;
+    }
+
+    public int getHorNbBuckets() {
+        return fHorDistributionData.getNbBuckets();
+    }
+    
+    public int getVerNbBuckets() {
+        return fVerDistributionData.getNbBuckets();
+    }
+
+    public long getHorFirstBucketTime() {
+        return fHorDistributionData.getFirstBucketTime();
+    }
+
+    public long getVerFirstBucketTime() {
+        return fVerDistributionData.getFirstBucketTime();
+    }
+
+    public long getHorLastBucketTime() {
+        return fHorDistributionData.getLastBucketTime();
+    }
+
+    public long getVerLastBucketTime() {
+        return fVerDistributionData.getLastBucketTime();
+    }
+    
+    public long getHorFirstEventTime() {
+        return fHorDistributionData.getFirstEventTime();
+    }
+
+    public long getVerFirstEventTime() {
+        return fVerDistributionData.getFirstEventTime();
+    }
+
+    public long getHorLastEventTime() {
+        return fHorDistributionData.getLastEventTime();
+    }
+
+    public long getVerLastEventTime() {
+        return fVerDistributionData.getLastEventTime();
+    }
+    
+    public long getHorBucketDuration() {
+        return fHorDistributionData.getBucketDuration();
+    }
+
+    public long getVerBucketDuration() {
+        return fVerDistributionData.getBucketDuration();
+    }
+
+    public int getHorLastBucket() {
+        return fHorDistributionData.getLastBucket();
+    }
+
+    public int getVerLastBucket() {
+        return fVerDistributionData.getLastBucket();
+    }
+
+    public long getHorBucketStartTime(int index) {
+        return  fHorDistributionData.getBucketStartTime(index);
+    }
+    
+    public long getHorBucketEndTime(int index) {
+        return fHorDistributionData.getBucketEndTime(index);
+    }
+    
+    public long getVerBucketStartTime(int index) {
+        return  fVerDistributionData.getBucketStartTime(index);
+    }
+    
+    public long getVerBucketEndTime(int index) {
+        return fVerDistributionData.getBucketEndTime(index);
+    }
+    
+    public int getEventCount(int horIndex, int verIndex) {
+        return fData[horIndex][verIndex];
+    }
+    
+    public long getCurrentEventTime() {
+        return fCurrentEventTime;
+    }
+
+    public boolean isCurrentEventTimeValid() {
+        if (fCurrentEventTime == Config.INVALID_EVENT_TIME || fCurrentEventTime < getHorFirstEventTime() || fCurrentEventTime > getHorLastEventTime()) {
+            return false;
+        }
+        return true;
+    }
+    
+    public int getHorBucketIndex(long time) {
+         return fHorDistributionData.getIndex(time);
+    }
+    
+    public int getVerBucketIndex(long time) {
+        return fVerDistributionData.getIndex(time);
+    }
+    
+    public boolean isHorIndexValid(int index) {
+        return fHorDistributionData.isIndexValid(index);
+    }
+    
+    public boolean isVerIndexValid(int index) {
+        return fVerDistributionData.isIndexValid(index);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    public void setWidth(int width) {
+        fWidth = width;
+    }
+
+    public void setHeight(int height) {
+        fHeight = height;
+    }
+    
+    public void setBarWidth(int barWidth) {
+        fBarWidth = barWidth;
+    }
+
+    public void setData(int[][] data) {
+        fData = data;
+    }
+
+    public void setHorFirstBucketTime(long firstBucketTime) {
+        fHorDistributionData.setFirstBucketTime(firstBucketTime);
+    }
+
+    public void setVerFirstBucketTime(long firstBucketTime) {
+        fVerDistributionData.setFirstBucketTime(firstBucketTime);
+    }
+
+    public void setHorFirstEventTime(long firstEventTime) {
+        fHorDistributionData.setFirstEventTime(firstEventTime);
+    }
+
+    public void setVerFirstEventTime(long firstEventTime) {
+        fVerDistributionData.setFirstEventTime(firstEventTime);
+    }
+
+    public void setHorLastEventTime(long lastEventTime) {
+        fHorDistributionData.setLastEventTime(lastEventTime);
+    }
+
+    public void setVerLastEventTime(long lastEventTime) {
+        fVerDistributionData.setLastEventTime(lastEventTime);
+    }
+
+    public void setHorBucketDuration(long bucketDuration) {
+        fHorDistributionData.setBucketDuration(bucketDuration);
+    }
+
+    public void setVerBucketDuration(long bucketDuration) {
+        fVerDistributionData.setBucketDuration(bucketDuration);
+    }
+
+    public void setHorLastBucket(int lastBucket) {
+        fHorDistributionData.setLastBucket(lastBucket);
+    }
+
+    public void setVerLastBucket(int lastBucket) {
+        fVerDistributionData.setLastBucket(lastBucket);
+    }
+
+    public void setCurrentEventTime(long currentEventTime) {
+        fCurrentEventTime = currentEventTime;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/IGraphDataModel.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/IGraphDataModel.java
new file mode 100644 (file)
index 0000000..f1a19c3
--- /dev/null
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
+
+import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;
+
+/**
+ * <b><u>IGraphDataModel</u></b>
+ * <p>
+ */
+public interface IGraphDataModel extends IBaseDistributionModel {
+
+    /**
+     * Add event to the correct bucket, compacting the if needed.
+     * 
+     * @param eventCount - the event count
+     * @param timestamp - the timestamp (x-coordinate) of the event to count
+     * @param time - the time (y-coordinate) of the event to count
+     */
+    public void countEvent(int eventCount, long timestamp, long time);
+    
+    /**
+     * Scale the model data to the width and height requested.
+     * 
+     * @param width - width of graph
+     * @param height - height of graph
+     * @param barWidth - width of bar
+     * @return the result array of size [width] and where the highest value
+     *         doesn't exceed [height]
+     */
+    public GraphScaledData scaleTo(int width, int height, int barWidth);
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/IGraphModelListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/IGraphModelListener.java
new file mode 100644 (file)
index 0000000..086b563
--- /dev/null
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
+
+/**
+ * <b><u>IGraphModelListener</u></b>
+ * <p>
+ */
+public interface IGraphModelListener {
+    
+    /**
+     * Method to notify listeners about model updates 
+     */
+    public void graphModelUpdated();
+
+    /**
+     * Method to inform listeners about current time updates 
+     */
+    public void currentEventUpdated(long currentEventTime);
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyController.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyController.java
new file mode 100644 (file)
index 0000000..4f610f9
--- /dev/null
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;
+import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel;
+
+/**
+ * <b><u>LatencyController</u></b>
+ * <p>
+ */
+public class LatencyController {
+   
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private static LatencyController fInstance = null;
+    
+    private LatencyEventRequest fEventRequest;
+    
+    private TmfEventProvider<?> fProvider;
+    
+    private final ListenerList fModels;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    private LatencyController() {
+        fModels = new ListenerList();
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+    public static LatencyController getInstance() {
+        if (fInstance == null) {
+            fInstance = new LatencyController();
+        }
+        return fInstance;
+    }
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /**
+     * Refresh all registered models
+     * 
+     * @param provider - TmfEventProvider to request data from
+     * @param timeRange - time range of request
+     */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public void refreshModels(TmfEventProvider<?> provider, TmfTimeRange timeRange) {
+        // save provider
+        fProvider = provider;
+        if (fProvider != null) {
+            if (fEventRequest != null && !fEventRequest.isCompleted()) {
+                fEventRequest.cancel();
+            }
+            clear();
+            fEventRequest = new LatencyEventRequest(this, timeRange, ExecutionType.FOREGROUND);
+            fProvider.sendRequest((TmfDataRequest)fEventRequest);
+        }
+    }
+
+    /**
+     * Refreshes registered models by re-sending previous request to saved provider
+     */
+    public void refreshModels() {
+        if (fProvider != null && fEventRequest != null) {
+            refreshModels(fProvider, fEventRequest.getRange());
+        }
+    }
+
+    /**
+     * Clear all models
+     */
+    public void clear() {
+        Object models[] = fModels.getListeners();
+        
+        for (int i = 0; i < models.length; i++) {
+            ((IBaseDistributionModel)models[i]).clear();
+        }
+    }
+    
+    /**
+     * Dispose of controller
+     */
+    public void dispose() {
+        if (fEventRequest != null && !fEventRequest.isCompleted()) {
+            fEventRequest.cancel();
+        }
+        fProvider = null;
+    }
+    
+    /**
+     * Register given model.
+     * @param model - model to register
+     */
+    public void registerModel(IBaseDistributionModel model) {
+        fModels.add(model);
+    }
+    
+    /**
+     * Deregister given model.
+     * 
+     * @param model - model to deregister
+     */
+    public void deregisterModel(IBaseDistributionModel model) {
+        fModels.remove(model);
+    }
+    
+    /**
+     * Handle data of event request and pass it information to the registered models
+     * 
+     * @param eventCount - event count
+     * @param timestamp - start timestamp of latency calculation
+     * @param latency - latency value (startTimestamp - endTimestamp)
+     */
+    public void handleData(int eventCount, long timestamp, long latency) {
+        Object[] models = fModels.getListeners();
+        for (int i = 0; i < models.length; i++) {
+            IBaseDistributionModel model = (IBaseDistributionModel)models[i];
+            if (model instanceof IHistogramDataModel) {
+                ((IHistogramDataModel)model).countEvent(eventCount, latency);
+            } else if (model instanceof IGraphDataModel) {
+                ((IGraphDataModel)model).countEvent(eventCount, timestamp, latency);
+            }
+        }
+    }
+
+    /**
+     * Handle complete indication from request.
+     */
+    public void handleCompleted() {
+        Object[] models = fModels.getListeners();
+        for (int i = 0; i < models.length; i++) {
+            ((IBaseDistributionModel)models[i]).complete();
+        }
+    }
+
+    /**
+     * Handle cancel indication from request.
+     */
+    public void handleCancel() {
+        clear();
+    }
+    
+    /**
+     * Set event provider for refresh.
+     * 
+     * @param provider
+     */
+    public void setEventProvider(TmfEventProvider<?> provider) {
+        fProvider = provider;
+    }
+    
+    /**
+     * Set current event time in model(s).
+     * 
+     * @param timestamp
+     */
+    public void setCurrentEventTime(long timestamp) {
+        Object[] models = fModels.getListeners();
+        for (int i = 0; i < models.length; i++) {
+            IBaseDistributionModel model = (IBaseDistributionModel)models[i];
+            if (model instanceof LatencyGraphModel) {
+                ((LatencyGraphModel)model).setCurrentEventNotifyListeners(timestamp);
+            }
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyEventRequest.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyEventRequest.java
new file mode 100644 (file)
index 0000000..5aab107
--- /dev/null
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
+
+import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+
+/**
+ * <b><u>LatencyEventRequest</u></b>
+ * <p>
+ */
+public class LatencyEventRequest extends TmfEventRequest<LttngEvent> {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    final private LatencyController fController;
+    
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    public LatencyEventRequest(LatencyController controller, TmfTimeRange range, int rank, int nbEvents, ITmfDataRequest.ExecutionType execType) {
+        super(LttngEvent.class, range, rank, nbEvents, LttngConstants.DEFAULT_BLOCK_SIZE, execType);
+        fController = controller;
+        EventMatcher.getInstance().clearStack();
+    }
+
+    public LatencyEventRequest(LatencyController controller, TmfTimeRange range, ITmfDataRequest.ExecutionType execType) {
+        this(controller, range, 0, ALL_DATA, execType);
+    }
+
+    public LatencyEventRequest(LatencyController controller, TmfTimeRange range, int rank, ITmfDataRequest.ExecutionType execType) {
+        this(controller, range, rank, ALL_DATA, execType);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.event.TmfData)
+     */
+    @Override
+    public void handleData(LttngEvent event) {
+        super.handleData(event);
+        
+        LttngEvent startEvent = EventMatcher.getInstance().process(event);
+
+        if (startEvent != null) {
+            long latency = event.getTimestamp().getValue() - startEvent.getTimestamp().getValue(); 
+            fController.handleData(getNbRead(), startEvent.getTimestamp().getValue(), latency);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCompleted()
+     */
+    @Override
+    public void handleCompleted() {
+        fController.handleCompleted();
+        super.handleCompleted();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCancel()
+     */
+    @Override
+    public void handleCancel() {
+        EventMatcher.getInstance().clearStack();
+        fController.handleCancel();
+        super.handleCancel();
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyGraphModel.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/latency/model/LatencyGraphModel.java
new file mode 100644 (file)
index 0000000..fd5d2dc
--- /dev/null
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
+
+import java.util.Arrays;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model.DistributionData;
+import org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model.HorDistributionData;
+import org.eclipse.linuxtools.internal.lttng.ui.views.distribution.model.VerDistributionData;
+
+/**
+ * <b><u>LatencyGraphModel</u></b>
+ * <p>
+ */
+public class LatencyGraphModel implements IGraphDataModel {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private final int fNbBuckets;
+    private final int [][] fBuckets;
+    private final DistributionData fHorDistributionData;
+    private final DistributionData fVerDistributionData;
+    private long fCurrentEventTime;
+    
+    // private listener lists
+    private final ListenerList fModelListeners;
+
+    private final ReentrantLock fLock;
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    public LatencyGraphModel() {
+        this(Config.DEFAULT_NUMBER_OF_BUCKETS);
+    }
+
+    public LatencyGraphModel(int nbBuckets) {
+        fNbBuckets = nbBuckets;
+        fBuckets = new int[nbBuckets][nbBuckets];
+        fHorDistributionData = new HorDistributionData(nbBuckets, fBuckets);
+        fVerDistributionData = new VerDistributionData(nbBuckets, fBuckets);
+        fCurrentEventTime = Config.INVALID_EVENT_TIME;
+       
+        fModelListeners = new ListenerList();
+        fLock = new ReentrantLock();
+        clear();
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+    
+    public int getNbBuckets() {
+        return fNbBuckets;
+    }
+    
+    public long getHorBucketDuration() {
+        fLock.lock(); 
+        try {
+            return fHorDistributionData.getBucketDuration();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getVerBucketDuration() {
+        fLock.lock(); 
+        try {
+            return fVerDistributionData.getBucketDuration();
+        } finally {
+            fLock.unlock();
+        }
+    }
+    
+    public long getHorFirstBucketTime() {
+        fLock.lock(); 
+        try {
+            return fHorDistributionData.getFirstBucketTime();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getVerFirstBucketTime() {
+        fLock.lock(); 
+        try {
+            return fVerDistributionData.getFirstBucketTime();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getHorFirstEventTime() {
+        fLock.lock(); 
+        try {
+            return fHorDistributionData.getFirstEventTime();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getVerFirstEventTime() {
+        fLock.lock(); 
+        try {
+            return fVerDistributionData.getFirstEventTime();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getHorLastEventTime() {
+        fLock.lock(); 
+        try {
+            return fHorDistributionData.getLastEventTime();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getVerLastEventTime() {
+        fLock.lock(); 
+        try {
+            return fVerDistributionData.getLastEventTime();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getHorTimeLimit() {
+        fLock.lock(); 
+        try {
+            return fHorDistributionData.getTimeLimit();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public long getVerTimeLimit() {
+        fLock.lock(); 
+        try {
+            return fVerDistributionData.getTimeLimit();
+        } finally {
+            fLock.unlock();
+        }
+    }
+    
+    public int getHorLastBucket() {
+        fLock.lock(); 
+        try {
+            return fHorDistributionData.getLastBucket();
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    public int getVerLastBucket() {
+        fLock.lock(); 
+        try {
+            return fVerDistributionData.getLastBucket();
+        } finally {
+            fLock.unlock();
+        }
+    }
+    
+    public long getCurrentEventTime() {
+        fLock.lock();
+        try {
+            return fCurrentEventTime;
+        } finally {
+            fLock.unlock();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Listener interface
+    // ------------------------------------------------------------------------
+    public void addGraphModelListener(IGraphModelListener listener) {
+        fModelListeners.add(listener);        
+    }
+    
+    public void removeGraphModelListener(IGraphModelListener listener) {
+        fModelListeners.remove(listener);
+    }
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.IBaseDataModel#clear()
+     */
+    @Override
+    public void clear() {
+        fLock.lock();
+        try {
+            for (int[] row : fBuckets) {
+                Arrays.fill(row, 0, fNbBuckets, 0);
+            }
+            fHorDistributionData.clear();
+            fVerDistributionData.clear();
+        } finally {
+            fLock.unlock();
+        }
+        fireModelUpdateNotification();
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphDataModel#countEvent(int, long, long)
+     */
+    @Override
+    public void countEvent(int eventCount, long timestamp, long time) {
+        fLock.lock();
+        try {
+            int horIndex = fHorDistributionData.countEvent(timestamp);
+            int verIndex = fVerDistributionData.countEvent(time);
+
+            fBuckets[horIndex][verIndex]++;
+        } finally {
+            fLock.unlock();
+        }
+
+        fireModelUpdateNotification(eventCount);
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphDataModel#scaleTo(int, int, int)
+     */
+    @Override
+    public GraphScaledData scaleTo(int width, int height, int barWidth) {
+        GraphScaledData scaledData = new GraphScaledData(width, height, barWidth);
+        fLock.lock();
+        try {
+            if (!fHorDistributionData.isFirst() && !fVerDistributionData.isFirst() ) {
+
+                // Basic validation
+                if (width <= 0 ||  height <= 0 || barWidth <= 0)
+                    throw new AssertionError("Invalid histogram dimensions (" + width + "x" + height + ", barWidth=" + barWidth + ")");   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
+
+                // Scale horizontally
+                int nbBars = width / barWidth;
+                int bucketsPerBar = fHorDistributionData.getLastBucket() / nbBars + 1;
+
+                int horData[][] = new int[nbBars][fNbBuckets];  
+                for (int y = 0; y < fNbBuckets; y++) {
+                    for (int i = 0; i < nbBars; i++) {
+                        int count = 0;
+                        for (int j = i * bucketsPerBar; j < (i + 1) * bucketsPerBar; j++) {
+                            if (fNbBuckets <= j)
+                                break;
+                            count += fBuckets[j][y];
+                        }
+                        horData[i][y] = count;
+                    }
+                }
+
+                // Scale vertically
+                int nbVerBars = height / barWidth;
+                int bucketsPerVerBar = fVerDistributionData.getLastBucket() / nbVerBars + 1;
+
+                int verData[][] = new int[nbBars][nbVerBars];  
+                for (int x = 0; x < nbBars; x++) {
+                    for (int i = 0; i < nbVerBars; i++) {
+                        int count = 0;
+                        for (int j = i * bucketsPerVerBar; j < (i + 1) * bucketsPerVerBar; j++) {
+                            if (fNbBuckets <= j)
+                                break;
+                            count += horData[x][j];
+                        }
+                        verData[x][i] = count;
+                    }
+                }
+
+                scaledData.setData(verData);
+                scaledData.setHorFirstBucketTime(fHorDistributionData.getFirstBucketTime());
+                scaledData.setVerFirstBucketTime(fVerDistributionData.getFirstBucketTime());
+                scaledData.setHorFirstEventTime(fHorDistributionData.getFirstEventTime());
+                scaledData.setVerFirstEventTime(fVerDistributionData.getFirstEventTime());
+                scaledData.setHorLastEventTime(fHorDistributionData.getLastEventTime());
+                scaledData.setVerLastEventTime(fVerDistributionData.getLastEventTime());
+                scaledData.setHorBucketDuration(bucketsPerBar * fHorDistributionData.getBucketDuration());
+                scaledData.setVerBucketDuration(bucketsPerVerBar * fVerDistributionData.getBucketDuration());
+                scaledData.setHorLastBucket(fHorDistributionData.getLastBucket() / bucketsPerBar);
+                scaledData.setVerLastBucket(fVerDistributionData.getLastBucket() / bucketsPerVerBar);
+                scaledData.setCurrentEventTime(fCurrentEventTime);
+            }
+        } finally {
+            fLock.unlock();
+        }
+
+        return scaledData;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.IBaseDataModel#complete()
+     */
+    @Override
+    public void complete() {
+        fireModelUpdateNotification();
+    }
+
+    /**
+     * Sets the current event time but don't notify listeners.
+     * 
+     * @param timestamp
+     */
+    public void setCurrentEvent(long timestamp) {
+        fLock.lock();
+        try {
+            fCurrentEventTime = timestamp;
+        } finally {
+            fLock.unlock();
+        }   
+    }
+
+    /**
+     * Sets the current event time and notify listeners.
+     * 
+     * @param timestamp
+     */
+    public void setCurrentEventNotifyListeners(long timestamp) {
+        fLock.lock();
+        try {
+            fCurrentEventTime = timestamp;
+        } finally {
+            fLock.unlock();
+        }
+        fireCurrentEventUpdateNotification();
+    }
+   
+    // ------------------------------------------------------------------------
+    // Helper functions
+    // ------------------------------------------------------------------------
+
+    /*
+     * Notify listeners immediately
+     */
+    private void fireModelUpdateNotification() {
+        fireModelUpdateNotification(0);
+    }
+    
+    /*
+     * Notify listeners with certain refresh rate.
+     */
+    private void fireModelUpdateNotification(int count) {
+        if (count % Config.POINT_BUFFER_SIZE == 0) {
+            Object[] listeners = fModelListeners.getListeners();
+            for (int i = 0; i < listeners.length; i++) {
+                IGraphModelListener listener = (IGraphModelListener) listeners[i];
+                listener.graphModelUpdated();
+            }
+        }
+    }
+
+    /*
+     * Notify listeners immediately
+     */
+    private void fireCurrentEventUpdateNotification() {
+        Object[] listeners = fModelListeners.getListeners();
+        for (int i = 0; i < listeners.length; i++) {
+            IGraphModelListener listener = (IGraphModelListener) listeners[i];
+            listener.currentEventUpdated(fCurrentEventTime);
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/Messages.java
new file mode 100644 (file)
index 0000000..1d15a15
--- /dev/null
@@ -0,0 +1,33 @@
+/*******************************************************************************\r
+ * Copyright (c) 2009 Ericsson\r
+ * \r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ * Contributors:\r
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
+ *******************************************************************************/\r
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources;\r
+\r
+import java.util.MissingResourceException;\r
+import java.util.ResourceBundle;\r
+\r
+public class Messages {\r
+       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.resources.messages"; //$NON-NLS-1$\r
+\r
+       private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle\r
+                       .getBundle(BUNDLE_NAME);\r
+\r
+       private Messages() {\r
+       }\r
+\r
+       public static String getString(String key) {\r
+               try {\r
+                       return RESOURCE_BUNDLE.getString(key);\r
+               } catch (MissingResourceException e) {\r
+                       return '!' + key + '!';\r
+               }\r
+       }\r
+}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/ResourcesView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/ResourcesView.java
new file mode 100644 (file)
index 0000000..6babf7d
--- /dev/null
@@ -0,0 +1,596 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors: 
+ *   Alvaro Sanchez-Leon - Initial implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
+import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ITransEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.ItemContainer;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.AbsTimeUpdateView;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+import org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor.ResourcesEventToHandlerFactory;
+import org.eclipse.linuxtools.internal.lttng.ui.views.resources.model.ResourceModelFactory;
+import org.eclipse.linuxtools.internal.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.TmfExperimentUpdatedSignal;
+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;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author alvaro
+ * 
+ */
+public class ResourcesView extends AbsTimeUpdateView implements
+               ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener {
+
+       // ========================================================================
+       // Data
+       // ========================================================================
+       public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.resources"; //$NON-NLS-1$
+
+       // private int totalNumItems = 0;
+       // Actions
+       private Action resetScale;
+       private Action nextEvent;
+       private Action prevEvent;
+       private Action nextTrace;
+       private Action prevTrace;
+       private Action showLegend;
+       private Action filterTraces;
+       private Action zoomIn;
+       private Action zoomOut;
+       private Action zoomFilter;
+       private Composite top;
+
+       private TmfTimeRange initTimeRange = TmfTimeRange.NULL_RANGE;
+
+       // private static SimpleDateFormat stimeformat = new SimpleDateFormat(
+       // "yy/MM/dd HH:mm:ss");
+
+       // private TraceModelImplFactory fact;
+
+       // ========================================================================
+       // Constructor
+       // ========================================================================
+
+       /**
+        * The constructor.
+        */
+       public ResourcesView() {
+               super(ID);
+       }
+
+       // ========================================================================
+       // Methods
+       // ========================================================================
+
+       /**
+        * This is a callback that will allow us to create the viewer and initialize
+        * it.
+        */
+       @Override
+       public void createPartControl(Composite parent) {
+               top = new Composite(parent, SWT.BORDER);
+
+               top.setLayout(new FillLayout());
+               tsfviewer = TmfViewerFactory.createViewer(top, new ResourcesTimeRangeViewerProvider(getParamsUpdater()));
+
+               tsfviewer.addWidgetSelectionListner(this);
+               tsfviewer.addWidgetTimeScaleSelectionListner(this);
+
+               // Traces shall not be grouped to allow synchronisation
+               tsfviewer.groupTraces(true);
+               tsfviewer.setAcceptSelectionAPIcalls(true);
+
+               // Viewer to notify selection to this class
+               // This class will synchronise selections with table.
+//             tsfviewer.addWidgetSelectionListner(this);
+//             tsfviewer.addWidgetTimeScaleSelectionListner(this);
+
+               // Create the help context id for the viewer's control
+               // TODO: Associate with help system
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(
+                               tsfviewer.getControl(),
+                               "org.eclipse.linuxtools.lttng.ui.views.resource.view"); //$NON-NLS-1$
+
+               makeActions();
+               hookContextMenu();
+               contributeToActionBars();
+
+//             // Read relevant values
+//             int timeSpaceWidth = tsfviewer.getTimeSpace();
+//             if (timeSpaceWidth < 0) {
+//                     timeSpaceWidth = -timeSpaceWidth;
+//             }
+
+               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
+               if (experiment != null) {
+                       TmfTimeRange experimentTRange = experiment.getTimeRange();
+                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
+                               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);
+                       }
+               } else {
+                       TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
+               }
+       }
+
+       private void hookContextMenu() {
+               MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+               menuMgr.setRemoveAllWhenShown(true);
+               menuMgr.addMenuListener(new IMenuListener() {
+                       @Override
+                       public void menuAboutToShow(IMenuManager manager) {
+                               ResourcesView.this.fillContextMenu(manager);
+                       }
+               });
+
+               Menu menu = menuMgr.createContextMenu(tsfviewer.getControl());
+               tsfviewer.getControl().setMenu(menu);
+               getSite()
+                               .registerContextMenu(menuMgr, tsfviewer.getSelectionProvider());
+       }
+
+       private void contributeToActionBars() {
+               IActionBars bars = getViewSite().getActionBars();
+               fillLocalPullDown(bars.getMenuManager());
+               fillLocalToolBar(bars.getToolBarManager());
+       }
+
+       private void fillLocalPullDown(IMenuManager manager) {
+               manager.add(new Separator());
+               manager.add(showLegend);
+               manager.add(new Separator());
+               manager.add(resetScale);
+               manager.add(nextEvent);
+               manager.add(prevEvent);
+               manager.add(nextTrace);
+               manager.add(prevTrace);
+               // manager.add(filterTraces);
+               manager.add(zoomIn);
+               manager.add(zoomOut);
+               manager.add(zoomFilter);
+               manager.add(new Separator());
+       }
+
+       private void fillContextMenu(IMenuManager manager) {
+               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(filterTraces);
+               manager.add(zoomIn);
+               manager.add(zoomOut);
+               manager.add(zoomFilter);
+               manager.add(new Separator());
+               manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+       }
+
+       private void fillLocalToolBar(IToolBarManager manager) {
+               manager.add(showLegend);
+               manager.add(new Separator());
+               manager.add(resetScale);
+               manager.add(nextEvent);
+               manager.add(prevEvent);
+               manager.add(nextTrace);
+               manager.add(prevTrace);
+               // manager.add(filterTraces);
+               manager.add(zoomIn);
+               manager.add(zoomOut);
+               manager.add(zoomFilter);
+               manager.add(new Separator());
+       }
+
+       private void makeActions() {
+               // action4
+               resetScale = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.resetStartFinishTime();
+                               }
+
+                       }
+               };
+               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/elcl16/home_nav.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+
+               // action5
+               nextEvent = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectNextEvent();
+                               }
+                       }
+               };
+               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/elcl16/next_event.gif"));  //$NON-NLS-1$//$NON-NLS-2$
+
+               // action6
+               prevEvent = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectPrevEvent();
+                               }
+                       }
+               };
+               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/elcl16/prev_event.gif")); //$NON-NLS-1$//$NON-NLS-2$
+
+               // action7
+               nextTrace = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectNextTrace();
+                               }
+                       }
+               };
+               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/elcl16/next_item.gif")); //$NON-NLS-1$//$NON-NLS-2$
+
+               // action8
+               prevTrace = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.selectPrevTrace();
+                               }
+                       }
+               };
+               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/elcl16/prev_item.gif"));  //$NON-NLS-1$//$NON-NLS-2$
+
+               // action9
+               showLegend = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.showLegend();
+                               }
+                       }
+               };
+               showLegend.setText(Messages.getString("ResourcesView.Action.Legend")); //$NON-NLS-1$
+               showLegend.setToolTipText(Messages.getString("ResourcesView.Action.Legend.ToolTip")); //$NON-NLS-1$
+
+               // action10
+               filterTraces = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.filterTraces();
+                               }
+                       }
+               };
+               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/elcl16/filter_items.gif"));  //$NON-NLS-1$//$NON-NLS-2$
+
+               // action10
+               zoomIn = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.zoomIn();
+                               }
+                       }
+               };
+               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/elcl16/zoomin_nav.gif"));  //$NON-NLS-1$//$NON-NLS-2$
+
+               // action10
+               zoomOut = new Action() {
+                       @Override
+                       public void run() {
+                               if (tsfviewer != null) {
+                                       tsfviewer.zoomOut();
+                               }
+                       }
+               };
+               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/elcl16/zoomout_nav.gif"));  //$NON-NLS-1$//$NON-NLS-2$
+
+               // zoomFilter
+               zoomFilter = new Action() {
+                       @Override
+                       public void run() {
+                               // Nothing to do, however the selection status is needed by the
+                               // application
+                       }
+               };
+
+               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/elcl16/filter_items.gif"));  //$NON-NLS-1$//$NON-NLS-2$
+               zoomFilter.setChecked(false);
+
+               // PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_SYNCED);
+       }
+
+       /**
+        * Passing the focus request to the viewer's control.
+        */
+       @Override
+       public void setFocus() {
+               tsfviewer.getControl().setFocus();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * tsfTmProcessSelEvent
+        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent
+        * )
+        */
+       @Override
+       public void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) {
+               // common implementation
+               super.tsfTmProcessSelEvent(event);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
+        * ITmfTimeScaleSelectionListener
+        * #tsfTmProcessTimeScaleEvent(org.eclipse.linuxtools
+        * .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent)
+        */
+       @Override
+       public void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
+               super.tsfTmProcessTimeScaleEvent(event);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel
+        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry[], long, long, boolean, long, long,
+        * java.lang.Object)
+        */
+       @Override
+       public void displayModel(final ITmfTimeAnalysisEntry[] items, final long startBoundTime,
+                       final long endBoundTime, final boolean updateTimeBounds, final long startVisibleWindow,
+                       final long endVisibleWindow, final Object source) {
+               
+               // Return if disposed
+               if ((tsfviewer == null) || (tsfviewer.getControl().isDisposed())) return;
+               
+               Display display = tsfviewer.getControl().getDisplay();
+               display.asyncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+                                       tsfviewer.display(items, startBoundTime, endBoundTime, updateTimeBounds);
+                                       // validate visible boundaries
+                                       if (startVisibleWindow > -1 && endVisibleWindow > -1) {
+                                               tsfviewer.setSelectVisTimeWindow(startVisibleWindow, endVisibleWindow, source);
+                                       }
+                                       tsfviewer.resizeControls();
+                               }
+                       }
+               });
+       }
+
+       @Override
+       public void dispose() {
+               // dispose parent resources
+               super.dispose();
+
+               tsfviewer.removeWidgetSelectionListner(this);
+               tsfviewer.removeWidgetTimeScaleSelectionListner(this);
+               tsfviewer = null;
+       }
+
+       /**
+        * Registers as listener of time selection from other tmf views
+        * 
+        * @param signal
+        */
+       @Override
+       @TmfSignalHandler
+       public void synchToTime(TmfTimeSynchSignal signal) {
+               super.synchToTime(signal);
+       }
+
+       /**
+        * Annotation Registers as listener of time range selection from other views
+        * The implementation handles the entry of the signal.
+        * 
+        * @param signal
+        */
+       @TmfSignalHandler
+       public void synchToTimeRange(TmfRangeSynchSignal signal) {
+               if (zoomFilter != null) {
+                       synchToTimeRange(signal, zoomFilter.isChecked());
+               }
+       }
+
+       @Override
+       public void modelIncomplete(ILttngSyntEventRequest request) {
+               // Nothing to do
+               // The data will be refreshed on the next request
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getEventProcessor()
+        */
+       @Override
+       public ITransEventProcessor getEventProcessor() {
+               return ResourcesEventToHandlerFactory.getInstance();
+       }
+
+       /**
+        * @param signal
+        */
+       @TmfSignalHandler
+       public void experimentSelected(TmfExperimentSelectedSignal<? extends TmfEvent> signal) {
+               if (signal != null) {
+                       TmfTimeRange experimentTRange = signal.getExperiment().getTimeRange();
+
+                       initTimeRange = TmfTimeRange.NULL_RANGE;
+                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
+                               // 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_RANGE && signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
+                       TmfTimeRange experimentTRange = signal.getRange();
+
+                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
+                               // prepare time intervals in widget
+                               modelUpdateInit(experimentTRange, experimentTRange, signal.getSource());
+
+                               // request initial data
+                               initialExperimentDataRequest(signal.getSource(), experimentTRange);
+                       }
+               }
+       }
+
+    @TmfSignalHandler
+    public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
+        if (signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
+            final TmfTimeRange range = signal.getExperiment().getTimeRange();
+            if (range != TmfTimeRange.NULL_RANGE) {
+                Display.getDefault().asyncExec(new Runnable() {
+                    @Override
+                    public void run() {
+                        tsfviewer.setTimeBounds(range.getStartTime().getValue(), range.getEndTime().getValue());
+                    }});
+            }
+        }
+    }
+
+       /**
+        * @param source
+        * @param experimentTRange
+        * @return Adjusted time window used for the request (smaller window to
+        *         initialize view)
+        */
+       private TmfTimeRange initialExperimentDataRequest(Object source, TmfTimeRange experimentTRange) {
+               // Adjust the initial time window to a shorter interval to allow
+               // user to select the interesting area based on the perspective
+               TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
+
+               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;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getParamsUpdater()
+        */
+       @Override
+       protected ParamsUpdater getParamsUpdater() {
+               return ResourceModelFactory.getParamsUpdater();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getItemContainer()
+        */
+       @Override
+       protected ItemContainer<?> getItemContainer() {
+               return ResourceModelFactory.getResourceContainer();
+       }
+       
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getProviderId()
+        */
+       @Override
+    protected int getProviderId() { 
+        return LttngCoreProviderFactory.RESOURCE_LTTNG_SYTH_EVENT_PROVIDER; 
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java
new file mode 100644 (file)
index 0000000..d8c35d5
--- /dev/null
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;
+
+import java.util.Vector;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeComponent;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEvent;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeResourceFactory;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEvent.Type;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.AbsTRangeUpdate;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+import org.eclipse.linuxtools.internal.lttng.ui.views.resources.model.ResourceContainer;
+import org.eclipse.linuxtools.internal.lttng.ui.views.resources.model.ResourceModelFactory;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+
+public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
+               implements ILttngEventProcessor {
+
+       // ========================================================================
+       // Data
+       // =======================================================================
+       protected ResourceContainer resContainer = ResourceModelFactory
+                       .getResourceContainer();
+       protected ParamsUpdater params = ResourceModelFactory.getParamsUpdater();
+       protected static final Long ANY_CPU = 0L;
+
+       // ========================================================================
+       // Methods
+       // =======================================================================
+       protected TimeRangeEventResource addLocalResource(long traceStartTime,
+                       long traceEndTime, String traceId, ResourceTypes type, Long resId,
+                       long insertionTime) {
+
+               String resourceName = type.toString() + " " + resId.toString(); //$NON-NLS-1$
+               // Note : the "traceid" here is assigned to the "groupname" as we group
+               // by trace in the UI
+               TimeRangeEventResource localRessource = TimeRangeResourceFactory
+                               .getInstance().createResource(resContainer.getUniqueId(),
+                                               traceStartTime, traceEndTime, resourceName, traceId,
+                                               "", type, resId, insertionTime); //$NON-NLS-1$
+               resContainer.addItem(localRessource);
+
+               if (TraceDebug.isRV()) {
+                       TraceDebug.traceRV("addLocalResource():" + localRessource); //$NON-NLS-1$
+               }
+
+               return localRessource;
+       }
+
+       /**
+        * Used to check if the event is visible within the current visible time
+        * window
+        * 
+        * @return
+        */
+       protected boolean withinViewRange(long stime, long etime) {
+               long windowStartTime = params.getStartTime();
+               long windowEndTime = params.getEndTime();
+
+               // Start of event is already out of range
+               if (stime > windowEndTime) {
+                       return false;
+               }
+
+               // End time within or beyond start of window as long as the start time
+               // is before the end of the window (condition above)
+               if (etime >= windowStartTime) {
+                       return true;
+               }
+
+               // // start time is within window
+               // if (stime >= windowStartTime && stime <= windowEndTime) {
+               // // The event or part of it shall be displayed.
+               // return true;
+               // }
+               //
+               // // end time is within window
+               // if (etime >= windowStartTime && etime <= windowEndTime) {
+               // // The event or part of it shall be displayed.
+               // return true;
+               // }
+
+               // crosses the window
+               if (stime <= windowStartTime && etime >= windowEndTime) {
+                       // The time range is bigger than the selected time window and
+                       // crosses it
+                       return true;
+               }
+
+               return false;
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_bdev(
+                       LttngTraceState traceState, Long resourceId) {
+               return resourcelist_obtain_generic(resourceId, ResourceTypes.BDEV,
+                               traceState.getTraceId());
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_trap(
+                       LttngTraceState traceState, Long resourceId) {
+               return resourcelist_obtain_generic(resourceId, ResourceTypes.TRAP,
+                               traceState.getTraceId());
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_irq(
+                       LttngTraceState traceState, Long resourceId) {
+               return resourcelist_obtain_generic(resourceId, ResourceTypes.IRQ,
+                               traceState.getTraceId());
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_soft_irq(
+                       LttngTraceState traceState, Long resourceId) {
+               return resourcelist_obtain_generic(resourceId, ResourceTypes.SOFT_IRQ,
+                               traceState.getTraceId());
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_cpu(
+                       LttngTraceState traceState, Long resourceId) {
+               return resourcelist_obtain_generic(resourceId, ResourceTypes.CPU,
+                               traceState.getTraceId());
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_machine(
+                       LttngTraceState traceState, Long resourceId) {
+               // *** VERIFY ***
+               // Does "UNKNOWN" make sense for "obtain_machine" ?
+               // It seems to be the only choice, thought...
+               return resourcelist_obtain_generic(resourceId, ResourceTypes.UNKNOWN,
+                               traceState.getTraceId());
+       }
+
+       public TimeRangeEventResource resourcelist_obtain_generic(Long resourceId,
+                       ResourceTypes resourceType, String traceId) {
+               return resContainer.findItem(resourceId, resourceType, traceId);
+       }
+
+       protected boolean globalProcessBeforeExecmode(LttngEvent trcEvent,
+                       LttngTraceState traceSt) {
+
+               // TODO: Implement the tracking of current resource in order ot speed up
+               // searching for the relevant resource similar to current_hash_data in
+               // the C implementation
+               // e.g.
+               // hashed_process_data =
+               // process_list->current_hash_data[trace_num][cpu];
+
+               TimeRangeEventResource localResource = resourcelist_obtain_cpu(traceSt,
+                               trcEvent.getCpuId());
+               Long cpu = trcEvent.getCpuId();
+               if (localResource == null) {
+                       TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
+                       localResource = addLocalResource(timeRange.getStartTime()
+                                       .getValue(), timeRange.getEndTime().getValue(),
+                                       traceSt.getTraceId(), ResourceTypes.CPU, cpu, trcEvent
+                                       .getTimestamp().getValue());
+               }
+
+               // get the start time
+               long stime = localResource.getNext_good_time();
+               // Get the resource state mode
+               String cpuStateMode = localResource.getStateMode(traceSt);
+               // Call the makeDraw function
+               makeDraw(traceSt, stime, trcEvent.getTimestamp().getValue(),
+                               localResource, params, cpuStateMode);
+
+               return false;
+       }
+
+       /**
+        * @param traceSt
+        * @param startTime
+        * @param endTime
+        * @param localResource
+        * @param params
+        * @param stateMode
+        * @return
+        */
+       @SuppressWarnings("deprecation")
+       protected boolean makeDraw(LttngTraceState traceSt, long stime, long etime,
+                       TimeRangeEventResource localResource, ParamsUpdater params,
+                       String stateMode) {
+
+               if (TraceDebug.isRV()) {
+                       TraceDebug.traceRV("makeDraw():[" + localResource + ",candidate=[stime=" + stime + ",etime=" + etime + ",state=" + stateMode + "]]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+               }
+
+               // Check if the event is out of range
+               if (!withinViewRange(stime, etime)) {
+                       params.incrementEventsDiscarded(ParamsUpdater.OUT_OF_VIEWRANGE);
+                       return false;
+               }
+
+               // Check if the time range is consistent.
+               if (etime < stime) {
+                       params.incrementEventsDiscardedWrongOrder();
+                       return false;
+               }
+
+               // Store the next good time to start drawing the next event
+               // this is done this early to display an accurate start time of the
+               // first event
+               // within the display window
+               // Moved at the end since it produces space gaps among events
+               // localResource.setNext_good_time(etime);
+
+               // If First event of a resource, initialise start time half page before to enable pagination to the left
+               if (stime < params.getStartTime()) {
+                       // event start time is before the visible time window
+                       long insertion = localResource.getInsertionTime();
+                       if (stime == insertion) {
+                               // if start time is equal to insertion this is the first event to be drawn for this resource
+                               long halfPage = (params.getEndTime() - params.getStartTime()) / 2;
+                               long initTime = params.getStartTime() - halfPage;
+                               if (initTime > insertion) {
+                                       // start time of this event is unknown, place it half page before visible window to allow left side
+                                       // pagination when selecting previous event
+                                       stime = initTime;
+                               }
+                       }
+               }
+
+               // Determine if the time range event will fit it the current
+               // pixel map
+               double duration = etime - stime;
+               double k = getPixelsPerNs(traceSt, params);
+               double pixels = duration * k;
+
+               // Visibility check
+               // Display a "more information" indication by allowing non visible event
+               // as long as its previous event is visible.
+               boolean visible = true;
+               if (pixels < 1.0) {
+                       boolean prevEventVisibility = true;
+                       // Get the visibility indication on previous event for
+                       // this process
+                       Vector<TimeRangeComponent> inMemEvents = localResource
+                                       .getTraceEvents();
+                       if (inMemEvents.size() != 0) {
+                               TimeRangeComponent prevEvent = inMemEvents.get(inMemEvents
+                                               .size() - 1);
+                               prevEventVisibility = prevEvent.isVisible();
+
+                               // if previous event visibility is false and the time span
+                               // between events less than two pixels, there is no need to
+                               // load it in memory i.e. not visible and a more indicator is
+                               // within two pixels.
+                               // return i.e. event discarded to free up memory
+                               Long eventSpan = stime - prevEvent.getStartTime();
+                               if (prevEventVisibility == false
+                                               && ((double) eventSpan * k) < 2.0) {
+                                       params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
+                                       return false;
+                               }
+                       }
+
+                       // if previous event is visible, set this one to not
+                       // visible and continue
+                       visible = false;
+               }
+
+               Type eventType = getEventType(localResource);
+               if (eventType != null) {
+                       TimeRangeEvent time_window = new TimeRangeEvent(stime, etime,
+                                       localResource, eventType, stateMode);
+
+                       time_window.setVisible(visible);
+                       localResource.addChildren(time_window);
+
+                       localResource.setNext_good_time(etime);
+               }
+
+               return false;
+       }
+
+       /**
+        * Convert between resource type and timeRange event type
+        * 
+        * @param resource
+        * @return
+        */
+       private Type getEventType(TimeRangeEventResource resource) {
+               // TODO: Can we merge into one type
+               ResourceTypes resType = resource.getType();
+               Type eventType = null;
+
+               switch (resType) {
+               case CPU:
+                       eventType = Type.CPU_MODE;
+                       break;
+               case IRQ:
+                       eventType = Type.IRQ_MODE;
+                       break;
+               case SOFT_IRQ:
+                       eventType = Type.SOFT_IRQ_MODE;
+                       break;
+               case TRAP:
+                       eventType = Type.TRAP_MODE;
+                       break;
+               case BDEV:
+                       eventType = Type.BDEV_MODE;
+                       break;
+               default:
+                       eventType = Type.PROCESS_MODE;
+                       break;
+               }
+
+               return eventType;
+       }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesAfterUpdateHandlers.java
new file mode 100644 (file)
index 0000000..095baa6
--- /dev/null
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+
+/**
+ * Creates instances of specific after state update handlers, per corresponding
+ * event.
+ * 
+ * @author alvaro
+ * 
+ */
+public class ResourcesAfterUpdateHandlers {
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SCHED_SCHEDULE
+        * </p>
+        * Replace C function named "after_schedchange_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getAfterSchedChangeHandler() {
+               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
+
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               // TODO: After sched scheduler handler should implement an
+                               // update to the current resource data, similar to
+                               // current_hash_data in C
+                               // We don't keep track of current hashed resource, we look in
+                               // the hash table every time. keeping track of current hash may
+                               // improve performance, although needs to be bench marked to
+                               // verify
+                               // if there's is a real gain.
+
+                               // process_list->current_hash_data[trace_num][process_in->cpu] =
+                               // hashed_process_data_in;
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+       /**
+        * Drawing stuff ?
+        */
+       // int after_request(void *hook_data, void *call_data)
+       // int after_chunk(void *hook_data, void *call_data)
+       // int before_statedump_end(void *hook_data, void *call_data)
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesBeforeUpdateHandlers.java
new file mode 100644 (file)
index 0000000..8e2211d
--- /dev/null
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Channels;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Fields;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+
+/**
+ * Creates instances of specific before state update handlers, per corresponding
+ * event.
+ * 
+ * @author alvaro
+ * 
+ */
+public class ResourcesBeforeUpdateHandlers {
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SCHED_SCHEDULE
+        * </p>
+        * Replace C function named "before_schedchange_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID(?), LTT_FIELD_PREV_STATE
+        * (?)
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getBeforeSchedChangeHandler() {
+               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                               // Create a time range for the cpu.
+                               globalProcessBeforeExecmode(trcEvent, traceSt);
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_IRQ_ENTRY, LTT_EVENT_IRQ_EXIT
+        * </p>
+        * Replace C function named "before_execmode_hook_irq" in eventhooks.c
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getBeforeExecutionModeIrq() {
+               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               Long irqId = null;
+
+                               // According to Ltt, we should not draw anything if the channel
+                               // is the kernel one
+                               if (trcEvent.getChannelName().equals(
+                                               Channels.LTT_CHANNEL_KERNEL.name())) {
+                                       return false;
+                               } else {
+
+                                       if (trcEvent.getMarkerName().equals(
+                                                       Events.LTT_EVENT_IRQ_ENTRY.getInName())) {
+                                               irqId = getAFieldLong(trcEvent, traceSt,
+                                                               Fields.LTT_FIELD_IRQ_ID);
+                                       } else if (trcEvent.getMarkerName().equals(
+                                                       Events.LTT_EVENT_IRQ_EXIT.getInName())) {
+                                               long cpu = trcEvent.getCpuId();
+                                               irqId = traceSt.getCpu_states().get(cpu)
+                                                               .peekFromIrqStack();
+                                               if (irqId.equals(-1L)) {
+                                                       // nothing to update
+                                                       return false;
+                                               }
+                                       }
+
+
+                                       // softIrqId is the resource id here
+                                       TimeRangeEventResource localResource = resourcelist_obtain_irq(
+                                                       traceSt, irqId);
+
+                                       // If the resource is missing in the list, add it
+                                       if (localResource == null) {
+                                               TmfTimeRange timeRange = traceSt.getContext()
+                                                               .getTraceTimeWindow();
+                                               localResource = addLocalResource(timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId(),
+                                                               ResourceTypes.IRQ, irqId, trcEvent
+                                                                               .getTimestamp().getValue());
+                                       }
+
+                                       // get the start time
+                                       long stime = localResource.getNext_good_time();
+
+                                       // Get the resource state mode
+                                       String irqStateMode = localResource.getStateMode(traceSt);
+
+                                       // Call the makeDraw function
+                                       makeDraw(traceSt, stime,
+                                                       trcEvent.getTimestamp().getValue(), localResource,
+                                                       params, irqStateMode);
+
+                                       // Call the globalProcessBeforeExecmode() after, as
+                                       // it is needed by all
+                                       // getBeforeExecmode*SOMETHING*()
+                                       globalProcessBeforeExecmode(trcEvent, traceSt);
+                               }
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY,
+        * LTT_EVENT_SOFT_IRQ_EXIT,
+        * </p>
+        * Replace C function named "before_execmode_hook_soft_irq" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_SOFT_IRQ_ID
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getBeforeExecutionModeSoftIrq() {
+               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               Long softIrqId = null;
+
+                               // According to Ltt, we should not draw anything if the channel
+                               // is the kernel one
+                               if (trcEvent.getChannelName().equals(
+                                               Channels.LTT_CHANNEL_KERNEL.name())) {
+                                       return false;
+                               } else {
+
+                                       if ((trcEvent.getMarkerName()
+                                                       .equals(Events.LTT_EVENT_SOFT_IRQ_RAISE.getInName()))
+                                                       || (trcEvent.getMarkerName()
+                                                                       .equals(Events.LTT_EVENT_SOFT_IRQ_ENTRY
+                                                                                       .getInName()))) {
+                                               softIrqId = getAFieldLong(trcEvent, traceSt,
+                                                               Fields.LTT_FIELD_SOFT_IRQ_ID);
+                                       } else if (trcEvent.getMarkerName().equals(
+                                                       Events.LTT_EVENT_SOFT_IRQ_EXIT.getInName())) {
+                                               long cpu = trcEvent.getCpuId();
+                                               softIrqId = traceSt.getCpu_states().get(cpu)
+                                                               .peekFromSoftIrqStack();
+                                               if (softIrqId < 0) {
+                                                       // nothing to update
+                                                       return false;
+                                               }
+                                       }
+
+                                       // Add the resource to the resource list
+                                       // softIrqId is the resource id here
+                                       TimeRangeEventResource localResource = resourcelist_obtain_soft_irq(
+                                                       traceSt, softIrqId);
+
+                                       // If the resource is missing in the list, add it
+                                       if (localResource == null) {
+                                               TmfTimeRange timeRange = traceSt.getContext()
+                                                               .getTraceTimeWindow();
+                                               localResource = addLocalResource(timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId(),
+                                                               ResourceTypes.SOFT_IRQ, softIrqId, trcEvent
+                                                                               .getTimestamp().getValue());
+                                       }
+
+                                       // get the start time
+                                       long stime = localResource.getNext_good_time();
+
+                                       // Get the resource state mode
+                                       String softIrqStateMode = localResource
+                                                       .getStateMode(traceSt);
+
+                                       // Call the makeDraw function
+                                       makeDraw(traceSt, stime,
+                                                       trcEvent.getTimestamp().getValue(), localResource,
+                                                       params, softIrqStateMode);
+
+                                       // Call the globalProcessBeforeExecmode() after, as
+                                       // it is needed by all
+                                       // getBeforeExecmode*SOMETHING*()
+                                       globalProcessBeforeExecmode(trcEvent, traceSt);
+
+                               }
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_TRAP_ENTRY, LTT_EVENT_TRAP_EXIT,
+        * LTT_EVENT_PAGE_FAULT_ENTRY, LTT_EVENT_PAGE_FAULT_EXIT,
+        * LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY, LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
+        * </p>
+        * Replace C function named "before_execmode_hook_trap" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_TRAP_ID
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getBeforeExecutionModeTrap() {
+               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+
+                               Long trapId = null;
+
+                               // According to Ltt, we should not draw anything if the channel
+                               // is the kernel one
+                               if (trcEvent.getChannelName().equals(
+                                               Channels.LTT_CHANNEL_KERNEL.name())) {
+                                       return false;
+                               } else {
+
+                                       if ((trcEvent.getMarkerName()
+                                                       .equals(Events.LTT_EVENT_TRAP_ENTRY.getInName()))
+                                                       || (trcEvent.getMarkerName()
+                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_ENTRY
+                                                                                       .getInName()))
+                                                       || (trcEvent.getMarkerName()
+                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
+                                                                                       .getInName()))) {
+                                               trapId = getAFieldLong(trcEvent, traceSt,
+                                                               Fields.LTT_FIELD_TRAP_ID);
+                                       } else if ((trcEvent.getMarkerName()
+                                                       .equals(Events.LTT_EVENT_TRAP_EXIT.getInName()))
+                                                       || (trcEvent.getMarkerName()
+                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_EXIT
+                                                                                       .getInName()))
+                                                       || (trcEvent.getMarkerName()
+                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
+                                                                                       .getInName()))) {
+                                               long cpu = trcEvent.getCpuId();
+                                               trapId = traceSt.getCpu_states().get(cpu)
+                                                               .peekFromTrapStack();
+
+                                               if (trapId.equals(-1L)) {
+                                                       // Nothing to update
+                                                       return false;
+                                               }
+                                       } else {
+                                               return false;
+                                       }
+
+                                       // Add the resource to the resource list
+                                       // trapId is the resource id here
+                                       TimeRangeEventResource localResource = resourcelist_obtain_trap(
+                                                       traceSt, trapId);
+
+                                       // If the resource is missing in the list, add it
+                                       if (localResource == null) {
+                                               TmfTimeRange timeRange = traceSt.getContext()
+                                                               .getTraceTimeWindow();
+                                               localResource = addLocalResource(timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId(),
+                                                               ResourceTypes.TRAP, trapId, trcEvent
+                                                                               .getTimestamp().getValue());
+                                       }
+
+                                       // Determine the trap state.
+                                       String trapStateMode = localResource.getStateMode(traceSt);
+
+                                       long stime = localResource.getNext_good_time();
+                                       makeDraw(traceSt, stime,
+                                                       trcEvent.getTimestamp().getValue(), localResource,
+                                                       params, trapStateMode);
+
+                                       // Call the globalProcessBeforeExecmode() after, as
+                                       // it is needed by all
+                                       // getBeforeExecmode*SOMETHING*()
+                                       globalProcessBeforeExecmode(trcEvent, traceSt);
+
+                               }
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles: LTT_EVENT_REQUEST_ISSUE, LTT_EVENT_REQUEST_COMPLETE
+        * </p>
+        * Replace C function named "before_bdev_event_hook" in eventhooks.c
+        * <p>
+        * Fields: LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION (?)
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getBeforeBdevEvent() {
+               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
+
+                       // @Override
+                       @Override
+                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+                               Long major = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_MAJOR);
+                               Long minor = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_MINOR);
+                               // This is useless even in LTTv!
+                               // Long oper = getAFieldLong(trcEvent, traceSt,
+                               // Fields.LTT_FIELD_OPERATION);
+
+                               Long bdevId = getMkdevId(major, minor);
+
+                               // According to Lttv, bdevId (obtain from MKDEV macro) is
+                               // the id here
+                               TimeRangeEventResource localResource = resourcelist_obtain_bdev(
+                                               traceSt, bdevId);
+
+                               if (localResource == null) {
+                                       TmfTimeRange timeRange = traceSt.getContext()
+                                                       .getTraceTimeWindow();
+                                       localResource = addLocalResource(timeRange.getStartTime()
+                                                       .getValue(), timeRange.getEndTime().getValue(),
+                                                       traceSt.getTraceId(), ResourceTypes.BDEV, bdevId,
+                                                       trcEvent.getTimestamp().getValue());
+                               }
+
+                               // get the start time
+                               long stime = localResource.getNext_good_time();
+                               // Get the resource state mode
+                               String bdevStateMode = localResource.getStateMode(traceSt);
+                               // Call the makeDraw function
+                               makeDraw(traceSt, stime, trcEvent.getTimestamp().getValue(),
+                                               localResource, params, bdevStateMode);
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesEventToHandlerFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesEventToHandlerFactory.java
new file mode 100644 (file)
index 0000000..698499a
--- /dev/null
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngSyntheticEvent;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngSyntheticEvent.SequenceInd;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+
+/**
+ * Builds a Map from string event name to a processing handler object, the
+ * processors implement the same interface to facilitate transparent methods
+ * call,
+ * 
+ * The map key String is the entry point of the raw events. Using a hash speeds
+ * up the resolution of the appropriate processor
+ * 
+ * @author alvaro
+ * 
+ */
+public class ResourcesEventToHandlerFactory extends AbsEventToHandlerResolver {
+       // ========================================================================
+       // Data
+       // =======================================================================
+       private final Map<String, ILttngEventProcessor> eventNametoBeforeProcessor = new HashMap<String, ILttngEventProcessor>();
+       private final Map<String, ILttngEventProcessor> eventNametoAfterProcessor = new HashMap<String, ILttngEventProcessor>();
+       private ResourcesFinishUpdateHandler finishProcessor = null;
+       private static ResourcesEventToHandlerFactory instance = null;
+       private ResourcesBeforeUpdateHandlers instantiateBeforeHandler = new ResourcesBeforeUpdateHandlers();
+       private ResourcesAfterUpdateHandlers instantiateAfterHandler = new ResourcesAfterUpdateHandlers();
+
+       private ResourcesEventToHandlerFactory() {
+               super();
+               // Create one instance of each individual event handler and add the
+               // instance to the map
+
+               // *** BEFORE HOOKS ***
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
+                               instantiateBeforeHandler.getBeforeSchedChangeHandler());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_ENTRY
+                               .getInName(), instantiateBeforeHandler
+                               .getBeforeExecutionModeTrap());
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_EXIT
+                               .getInName(), instantiateBeforeHandler
+                               .getBeforeExecutionModeTrap());
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_ENTRY.getInName(),
+                               instantiateBeforeHandler.getBeforeExecutionModeTrap());
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_EXIT.getInName(),
+                               instantiateBeforeHandler.getBeforeExecutionModeTrap());
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
+                                               .getInName(), instantiateBeforeHandler
+                                               .getBeforeExecutionModeTrap());
+               eventNametoBeforeProcessor
+                               .put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
+                                               .getInName(), instantiateBeforeHandler
+                                               .getBeforeExecutionModeTrap());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_ENTRY
+                               .getInName(), instantiateBeforeHandler
+                               .getBeforeExecutionModeIrq());
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_EXIT
+                               .getInName(), instantiateBeforeHandler
+                               .getBeforeExecutionModeIrq());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_RAISE.getInName(),
+                               instantiateBeforeHandler.getBeforeExecutionModeSoftIrq());
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_ENTRY.getInName(),
+                               instantiateBeforeHandler.getBeforeExecutionModeSoftIrq());
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_EXIT.getInName(),
+                               instantiateBeforeHandler.getBeforeExecutionModeSoftIrq());
+
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_REQUEST_ISSUE.getInName(),
+                               instantiateBeforeHandler.getBeforeBdevEvent());
+               eventNametoBeforeProcessor.put(
+                               StateStrings.Events.LTT_EVENT_REQUEST_COMPLETE.getInName(),
+                               instantiateBeforeHandler.getBeforeBdevEvent());
+
+               // *** AFTER HOOKS ***
+               eventNametoAfterProcessor.put(
+                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
+                               instantiateAfterHandler.getAfterSchedChangeHandler());
+
+               finishProcessor = new ResourcesFinishUpdateHandler();
+       }
+
+       /**
+     * 
+     */
+       public static AbsEventToHandlerResolver getInstance() {
+               if (instance == null) {
+                       instance = new ResourcesEventToHandlerFactory();
+               }
+               return instance;
+       }
+
+       @Override
+       public ILttngEventProcessor getAfterProcessor(String eventType) {
+               return eventNametoAfterProcessor.get(eventType);
+       }
+
+       @Override
+       public ILttngEventProcessor getBeforeProcessor(String eventType) {
+               return eventNametoBeforeProcessor.get(eventType);
+       }
+
+       @Override
+       public ILttngEventProcessor getfinishProcessor() {
+               return finishProcessor;
+       }
+
+       @Override
+       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+               if (trcEvent instanceof LttngSyntheticEvent) {
+
+                       LttngSyntheticEvent synEvent = (LttngSyntheticEvent) trcEvent;
+                       String eventType = synEvent.getMarkerName();
+                       ILttngEventProcessor processor = null;
+                       if (synEvent.getSynType() == SequenceInd.BEFORE) {
+                               processor = getBeforeProcessor(eventType);
+                       }
+
+                       if (synEvent.getSynType() == SequenceInd.AFTER) {
+                               processor = getAfterProcessor(eventType);
+                       }
+
+                       if (synEvent.getSynType() == SequenceInd.ENDREQ) {
+                               processor = getfinishProcessor();
+                       }
+
+                       if (processor != null) {
+                               processor.process(trcEvent, traceSt);
+                       }
+               }
+               return false;
+       }
+
+       @Override
+       public ILttngEventProcessor getStateUpdaterProcessor(String eventType) {
+               return null;
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesFinishUpdateHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/evProcessor/ResourcesFinishUpdateHandler.java
new file mode 100644 (file)
index 0000000..9102c6f
--- /dev/null
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource;
+
+/**
+ * Creates specific finish state data request
+ * 
+ * @author alvaro
+ * 
+ */
+public class ResourcesFinishUpdateHandler extends
+ AbsResourcesTRangeUpdate
+               implements ILttngEventProcessor {
+
+       public Events getEventHandleType() {
+               // No specific event
+               return null;
+       }
+
+       @Override
+       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
+               // The end of the last state is unknown since it's beyond the requested time range window. Create this last
+               // event to half page after the visible window but not beyond the end of trace
+               long endOfTrace = traceSt.getContext().getTraceTimeWindow().getEndTime().getValue();
+               long halfWindow = (params.getEndTime() - params.getStartTime()) / 2;
+
+               // End of event common to all resources within the trace for this specific request
+               long endOfEvent = params.getEndTime() + halfWindow;
+               if (endOfEvent > endOfTrace) {
+                       endOfEvent = endOfTrace;
+               }
+               
+               TraceDebug.debug("Number of localResources: " //$NON-NLS-1$
+                               + resContainer.readItems().length);
+
+               // for each existing resource
+               for (TimeRangeEventResource localResource : resContainer
+                               .readItems()) {
+
+                       // get the start time
+                       long stime = localResource.getNext_good_time();
+
+                       // Get the resource state mode
+                       String stateMode = localResource.getStateMode(traceSt);
+
+                       // Insert an instance from previous time to end request time with
+                       // the current state
+                       makeDraw(traceSt, stime, endOfEvent, localResource, params, stateMode);
+               }
+
+               return false;
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/messages.properties
new file mode 100644 (file)
index 0000000..032d20a
--- /dev/null
@@ -0,0 +1,26 @@
+ResourcesView.Action.Filter=Filter\r
+ResourcesView.Action.Filter.ToolTip=Resource Filter options\r
+ResourcesView.Action.Legend=Legend\r
+ResourcesView.Action.Legend.ToolTip=Show Legend\r
+ResourcesView.Action.LoadData=LoadData\r
+ResourcesView.Action.LoadData.ToolTip=Load data from external plug-in\r
+ResourcesView.Action.NextEvent=NextEv\r
+ResourcesView.Action.NextEvent.Tooltip=Next Event\r
+ResourcesView.Action.NextResource=NextResource\r
+ResourcesView.Action.NextResource.ToolTip=Select Next Resource\r
+ResourcesView.Action.PrevEvent=PrevEv\r
+ResourcesView.Action.PrevEvent.Tooltip=Previous Event\r
+ResourcesView.Action.PreviousResource=PreviousResource\r
+ResourcesView.Action.PreviousResource.Tooltip=Select Previous Resource\r
+ResourcesView.Action.Reset=Reset\r
+ResourcesView.Action.Reset.ToolTip=Reset the Time Scale to Default\r
+ResourcesView.Action.Synchronize=Synchronise\r
+ResourcesView.Action.Synchronize.ToolTip=Synchronise by listening to external API selection calls\r
+ResourcesView.Action.ZoomIn=Zoom In\r
+ResourcesView.Action.ZoomIn.Tooltip=Zoom In\r
+ResourcesView.Action.ZoomOut=Zoom Out\r
+ResourcesView.Action.ZoomOut.tooltip=Zoom Out\r
+ResourcesView.Action.ZoomFilter=Zoom Filter\r
+ResourcesView.Action.ZoomFilter.tooltip=Display elements with events within the zoomed time window\r
+ResourcesView.msgSlogan=Resources View\r
+ResourcesView.tmf.UI=org.eclipse.linuxtools.tmf.ui\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourceContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourceContainer.java
new file mode 100644 (file)
index 0000000..b41d5a8
--- /dev/null
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.linuxtools.internal.lttng.core.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.ItemContainer;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
+
+/**
+ * Common location to allocate the resources in use by the resource view
+ * 
+ * @author alvaro
+ * 
+ */
+public class ResourceContainer implements ItemContainer<TimeRangeEventResource> {
+       // ========================================================================
+       // Data
+       // ========================================================================
+       private final HashMap<ResourceKey, TimeRangeEventResource> resources = new HashMap<ResourceKey, TimeRangeEventResource>();
+       private static Integer uniqueId = 0;
+       
+       
+       // ========================================================================
+       // Constructor
+       // ========================================================================
+       /**
+        * Package level constructor
+        */
+       public ResourceContainer() { }
+       
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#addItem
+        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry)
+        */
+       @Override
+       public void addItem(TimeRangeEventResource newItem) {
+               if (newItem != null) {
+                   resources.put( new ResourceKey(newItem),newItem);
+               }
+       }
+       
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#getUniqueId()
+        */
+    @Override
+       public Integer getUniqueId() {
+        return uniqueId++;
+    }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#readItems()
+        */
+       @Override
+       public TimeRangeEventResource[] readItems() {
+               return resources.values().toArray(
+                               new TimeRangeEventResource[resources.size()]);
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#clearChildren()
+        */
+       @Override
+       public void clearChildren() {
+           TimeRangeEventResource newRes = null;
+        Iterator<ResourceKey> iterator = resources.keySet().iterator();
+        
+        while (iterator.hasNext()) {
+                       newRes = resources.get(iterator.next());
+                       newRes.reset();
+        }
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#clearItems()
+        */
+       @Override
+       public void clearItems() {
+               resources.clear();
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#removeItems(java.lang.String)
+        */
+       @Override
+       public void removeItems(String traceId) {
+           ResourceKey newKey = null;
+
+           Iterator<ResourceKey> iterator = resources.keySet().iterator();
+        while (iterator.hasNext()) {
+            newKey = iterator.next();
+            
+            if (resources.get(newKey).getTraceId().equals(traceId)) {
+                resources.remove(newKey);
+            }
+        }
+       }
+       
+       
+       /**
+        * Search by keys (resourceId, traceId and type)
+        * <p>
+        * 
+        * A match is returned if the three arguments received match an entry
+        * Otherwise null is returned
+        * 
+        * @param searchedId
+        *            The ressourceId we are looking for
+        * @param searchedType
+        *            The ressourceType we are looking for
+        * @param searchedTraceId
+        *            The traceId (trace name?) we are looking for
+        * 
+        * @return TimeRangeEventResource
+        */
+    public TimeRangeEventResource findItem(Long searchedId, ResourceTypes searchedType, String searchedTraceId) {
+               // Get the EventResource associated to a key we create here
+        TimeRangeEventResource foundResource = resources.get( new ResourceKey(searchedId, searchedTraceId, searchedType) );
+        
+        return foundResource;
+    }
+}
+
+class ResourceKey {
+    
+    private TimeRangeEventResource valueRef = null;
+    
+    private Long       resourceId = null;
+    private String        traceId = null;
+    private ResourceTypes type = null;
+    
+    @SuppressWarnings("unused")
+    private ResourceKey() { }
+    
+    public ResourceKey(TimeRangeEventResource newRef) {
+        valueRef = newRef;
+    }
+    
+    public ResourceKey(Long newId, String newTraceId, ResourceTypes newType) {
+        resourceId = newId;
+        traceId = newTraceId;
+        type = newType;
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this)
+            return true;
+        if (obj == null)
+            return false;
+        
+        boolean isSame = false;
+        
+        if ( obj instanceof ResourceKey ) {
+               if ( valueRef != null )  {
+                   if ( (  ((ResourceKey)obj).getResourceId().equals(valueRef.getResourceId()) ) &&
+                        (  ((ResourceKey)obj).getTraceId().equals(valueRef.getTraceId()) ) &&
+                        (  ((ResourceKey)obj).getType().equals(valueRef.getType()) ) )
+                   {
+                       isSame = true;
+                   }
+               }
+               else {
+                       if ( (  ((ResourceKey)obj).getResourceId().equals(this.resourceId)) &&
+                        (  ((ResourceKey)obj).getTraceId().equals(this.traceId)) &&
+                        (  ((ResourceKey)obj).getType().equals(this.type)) )
+                   {
+                       isSame = true;
+                   }
+               }
+        }
+        else {
+               TraceDebug.debug("ERROR : The given key is not of the type ProcessKey!" + obj.getClass().toString()); //$NON-NLS-1$
+        }
+        
+        return isSame;
+    }
+    
+    // *** WARNING : Everything in there work because the check "valueRef != null" is the same for ALL getter
+    // Do NOT change this check without checking.
+    public Long getResourceId() {
+        if ( valueRef != null ) {
+            return valueRef.getResourceId();
+        }
+        else {
+            return resourceId;
+        }
+    }
+
+    public String getTraceId() {
+        if ( valueRef != null ) {
+            return valueRef.getTraceId();
+        }
+        else {
+            return traceId;
+        }
+    }
+
+    public ResourceTypes getType() {
+        if ( valueRef != null ) {
+            return valueRef.getType();
+        }
+        else {
+            return type;
+        }
+    }
+
+    @Override
+    public int hashCode() { 
+        return this.toString().hashCode();
+    }
+    
+    
+    @Override
+       @SuppressWarnings("nls")
+       public String toString() {
+        if ( valueRef != null ) {
+            return (valueRef.getResourceId().toString() + ":" + valueRef.getTraceId().toString() + ":" + valueRef.getType().toString());
+        }
+        return (resourceId + ":" + traceId + ":" + type);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourceModelFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourceModelFactory.java
new file mode 100644 (file)
index 0000000..3e04595
--- /dev/null
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.model;
+
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+
+/**
+ * Instantiates the entry point classes to build the data model for this view
+ * 
+ * @author alvaro
+ * 
+ */
+public class ResourceModelFactory {
+       // ========================================================================
+       // Data
+       // ========================================================================
+       private static ResourceContainer resContainer = null;
+       private static ParamsUpdater updater = null;
+       
+       
+       // ========================================================================
+       // Methods
+       // ========================================================================
+       /**
+        * Get Process data container
+        * @return
+        */
+       public static ResourceContainer getResourceContainer() {
+               if (resContainer == null) {
+                       resContainer = new ResourceContainer();
+               }
+               return resContainer;
+       }
+       
+       
+       public static ParamsUpdater getParamsUpdater() {
+               if (updater == null) {
+                       updater = new ParamsUpdater();
+               }
+               return updater;
+       }
+       
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourcesTimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/resources/model/ResourcesTimeRangeViewerProvider.java
new file mode 100644 (file)
index 0000000..d8f75d1
--- /dev/null
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.resources.model;
+
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeViewerProvider;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+
+public class ResourcesTimeRangeViewerProvider extends TimeRangeViewerProvider {
+
+       public ResourcesTimeRangeViewerProvider(ParamsUpdater paramsUpdater) {
+               super(paramsUpdater);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider
+        * #getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
+        * TmfTimeAnalysisProvider.StateColor)
+        */
+       @Override
+       public String getStateName(StateColor color) {
+               // Override to multiple instances of the widget, the same color can have
+               // multiple meanings
+               boolean isInBlockDevice = bdevStateToColor.containsValue(color);
+               boolean isInSoftIrq = softIrqStateToColor.containsValue(color);
+               boolean isInTrap = trapStateToColor.containsValue(color);
+               boolean isInIrq = irqStateToColor.containsValue(color);
+               boolean isInCpu = cpuStateToColor.containsValue(color);
+               if (isInCpu) {
+                       return findObject(color, cpuStateToColor);
+               } else if (isInIrq) {
+                       return findObject(color, irqStateToColor);
+               } else if (isInTrap) {
+                       return findObject(color, trapStateToColor);
+               } else if (isInSoftIrq) {
+                       return findObject(color, softIrqStateToColor);
+               } else if (isInBlockDevice) {
+                       return findObject(color, bdevStateToColor);
+               }
+               return super.getStateName(color);
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/Messages.java
new file mode 100644 (file)
index 0000000..59c0354
--- /dev/null
@@ -0,0 +1,24 @@
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.statistics.messages"; //$NON-NLS-1$
+    public static String StatisticsView_CPUTimeColumn;
+    public static String StatisticsView_CPUTimeTip;
+    public static String StatisticsView_CumCPUTimeColumn;
+    public static String StatisticsView_CumCPUTimeTip;
+    public static String StatisticsView_ElapsedTimeColumn;
+    public static String StatisticsView_ElapsedTimeTip;
+    public static String StatisticsView_LevelColumn;
+    public static String StatisticsView_LevelColumnTip;
+    public static String StatisticsView_NbEventsColumn;
+    public static String StatisticsView_NbEventsTip;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/StatisticsView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/StatisticsView.java
new file mode 100644 (file)
index 0000000..b89c081
--- /dev/null
@@ -0,0 +1,816 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin    (dhaemon@gmail.com)    - Implementation
+ *   Francois Chouinard (fchouinard@gmail.com) - Initial API
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics;
+
+import java.text.DecimalFormat;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.model.LTTngTreeNode;
+import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
+import org.eclipse.linuxtools.internal.lttng.core.state.experiment.StateManagerFactory;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.model.trange.ItemContainer;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.AbsTimeUpdateView;
+import org.eclipse.linuxtools.internal.lttng.ui.views.common.ParamsUpdater;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor.StatsTimeCountHandlerFactory;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.KernelStatisticsData;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsTreeNode;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsTreeRootFactory;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+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.TmfSignalHandler;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <b><u>StatisticsView</u></b>
+ * <p>
+ * The Statistics View displays statistics for traces.
+ * 
+ * It is implemented according to the MVC pattern. - The model is a
+ * StatisticsTreeNode built by the State Manager. - The view is built with a
+ * TreeViewer. - The controller that keeps model and view synchronised is an
+ * observer of the model.
+ */
+public class StatisticsView extends AbsTimeUpdateView {
+       public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.statistics"; //$NON-NLS-1$
+       private TreeViewer treeViewer;
+
+       // Table column names
+       private final String LEVEL_COLUMN = Messages.StatisticsView_LevelColumn;
+       private final String EVENTS_COUNT_COLUMN = Messages.StatisticsView_NbEventsColumn;
+       private final String CPU_TIME_COLUMN = Messages.StatisticsView_CPUTimeColumn;
+       private final String CUMULATIVE_CPU_TIME_COLUMN = Messages.StatisticsView_CumCPUTimeColumn;
+       private final String ELAPSED_TIME_COLUMN = Messages.StatisticsView_ElapsedTimeColumn;
+
+       // Table column tooltips
+       private final String LEVEL_COLUMN_TIP = Messages.StatisticsView_LevelColumnTip;
+       private final String EVENTS_COUNT_COLUMN_TIP = Messages.StatisticsView_NbEventsTip;
+       private final String CPU_TIME_COLUMN_TIP = Messages.StatisticsView_CPUTimeTip;
+       private final String CUMULATIVE_CPU_TIME_COLUMN_TIP = Messages.StatisticsView_CumCPUTimeTip;
+       private final String ELAPSED_TIME_COLUMN_TIP = Messages.StatisticsView_ElapsedTimeTip;
+
+       // Level for which statistics should not be displayed.
+    private Set<Integer> folderLevels = new HashSet<Integer>(Arrays
+                   .asList(new Integer[] { KernelStatisticsData.HEADER_CPUS_INT, 
+                                           KernelStatisticsData.HEADER_EVENT_TYPES_INT, 
+                                           KernelStatisticsData.HEADER_FUNCTIONS_INT, 
+                                           KernelStatisticsData.HEADER_MODES_INT, 
+                                           KernelStatisticsData.HEADER_PROCESSES_INT, 
+                                           KernelStatisticsData.HEADER_SUBMODES_INT }));
+
+       // Levels for which sub-levels should not contain time-related statistics.
+       private Set<Integer> levelsWithEmptyTime = new HashSet<Integer>(Arrays
+                   .asList(new Integer[] { KernelStatisticsData.HEADER_EVENT_TYPES_INT }));
+
+       private DecimalFormat decimalFormat = new DecimalFormat("0.#########"); //$NON-NLS-1$
+
+       private Cursor fwaitCursor = null;
+
+       private static final Long STATS_INPUT_CHANGED_REFRESH = 5000L;
+       
+       // Used to draw bar charts in columns.
+       private interface ColumnPercentageProvider {
+               public double getPercentage(StatisticsTreeNode node);
+       }
+
+    private boolean fStatisticsUpdateBusy = false;
+    private boolean fStatisticsUpdatePending = false;
+    private TmfTimeRange fStatisticsUpdateRange = null;
+    private final Object fStatisticsUpdateSyncObj = new Object();
+    private boolean fClearData = true;
+    // Flag to force request the data from trace
+    private boolean fRequestData = false;
+
+       /**
+        * Contains all the information necessary to build a column of the table.
+        */
+       private static class ColumnData {
+               // Name of the column.
+               public final String header;
+               // Width of the column.
+               public final int width;
+               // Alignment of the column.
+               public final int alignment;
+               // Tooltip of the column.
+               public final String tooltip;
+               // Adapts a StatisticsTreeNode into the content of it's corresponding
+               // cell for that column.
+               public final ColumnLabelProvider labelProvider;
+               // Used to sort elements of this column. Can be null.
+               public final ViewerComparator comparator;
+               // Used to draw bar charts in this column. Can be null.
+               public final ColumnPercentageProvider percentageProvider;
+
+               public ColumnData(String h, int w, int a, String t,
+                               ColumnLabelProvider l, ViewerComparator c,
+                               ColumnPercentageProvider p) {
+                       header = h;
+                       width = w;
+                       alignment = a;
+                       tooltip = t;
+                       labelProvider = l;
+                       comparator = c;
+                       percentageProvider = p;
+               }
+       };
+
+       // List that will be used to create the table.
+       private ColumnData[] columnDataList = new ColumnData[] {
+                       new ColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP,
+                                       new ColumnLabelProvider() {
+                                               @Override
+                                               public String getText(Object element) {
+                                                   StatisticsTreeNode node = (StatisticsTreeNode) element;
+                            if (folderLevels.contains(node.getKey())) {
+                                return (KernelStatisticsData.getCategoryFromId(node.getKey().intValue()));
+                            } else {
+                                return node.getName();
+                            }
+                                               }
+
+                                               @Override
+                                               public Image getImage(Object element) {
+                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
+                                                       if (folderLevels.contains(node.getKey())) {
+                                                               return PlatformUI.getWorkbench()
+                                                                               .getSharedImages().getImage(
+                                                                                               ISharedImages.IMG_OBJ_FOLDER);
+                                                       } else {
+                                                               return PlatformUI.getWorkbench()
+                                                                               .getSharedImages().getImage(
+                                                                                               ISharedImages.IMG_OBJ_ELEMENT);
+                                                       }
+                                               }
+                                       }, new ViewerComparator() {
+                                               @Override
+                                               public int compare(Viewer viewer, Object e1, Object e2) {
+                                                       StatisticsTreeNode n1 = (StatisticsTreeNode) e1;
+                                                       StatisticsTreeNode n2 = (StatisticsTreeNode) e2;
+                                                       
+//                                                     return n1.getKey().compareTo(n2.getKey());
+                                                       return n1.compareTo(n2);
+                                               }
+                                       }, null),
+                       new ColumnData(EVENTS_COUNT_COLUMN, 125, SWT.LEFT,
+                                       EVENTS_COUNT_COLUMN_TIP, new ColumnLabelProvider() {
+                                               @Override
+                                               public String getText(Object element) {
+                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
+                                                       if (!folderLevels.contains(node.getKey())) {
+                                                               return Long.toString(node.getValue().nbEvents);
+                                                       } else {
+                                                               return ""; //$NON-NLS-1$
+                                                       }
+                                               }
+                                       }, new ViewerComparator() {
+                                               @Override
+                                               public int compare(Viewer viewer, Object e1, Object e2) {
+                                                       StatisticsTreeNode n1 = (StatisticsTreeNode) e1;
+                                                       StatisticsTreeNode n2 = (StatisticsTreeNode) e2;
+
+                                                       return (int) (n1.getValue().nbEvents - n2
+                                                                       .getValue().nbEvents);
+                                               }
+                                       }, new ColumnPercentageProvider() {
+                                               @Override
+                                               public double getPercentage(StatisticsTreeNode node) {
+                                                       StatisticsTreeNode parent = node;
+                                                       do {
+                                                               parent = parent.getParent();
+                                                       } while (parent != null
+                                                                       && parent.getValue().nbEvents == 0);
+
+                                                       if (parent == null) {
+                                                               return 0;
+                                                       } else {
+                                                               return (double) node.getValue().nbEvents
+                                                                               / parent.getValue().nbEvents;
+                                                       }
+                                               }
+                                       }),
+                       new ColumnData(CPU_TIME_COLUMN, 125, SWT.LEFT, CPU_TIME_COLUMN_TIP,
+                                       new ColumnLabelProvider() {
+                                               @Override
+                                               public String getText(Object element) {
+                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
+
+                                                       if (folderLevels.contains(node.getKey())) {
+                                                               return ""; //$NON-NLS-1$
+                                                       } else if (node.getParent() != null
+                                                                       && levelsWithEmptyTime.contains(node
+                                                                                       .getParent().getKey())) {
+                                                               return ""; //$NON-NLS-1$
+                                                       } else {
+                                                               return decimalFormat
+                                                                               .format(node.getValue().cpuTime
+                                                                                               / Math.pow(10, 9));
+                                                       }
+                                               }
+                                       }, null, null),
+                       new ColumnData(CUMULATIVE_CPU_TIME_COLUMN, 155, SWT.LEFT,
+                                       CUMULATIVE_CPU_TIME_COLUMN_TIP, new ColumnLabelProvider() {
+                                               @Override
+                                               public String getText(Object element) {
+                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
+                                                       if (folderLevels.contains(node.getKey())) {
+                                                               return ""; //$NON-NLS-1$
+                                                       } else if (node.getParent() != null
+                                                                       && levelsWithEmptyTime.contains(node
+                                                                                       .getParent().getKey())) {
+                                                               return ""; //$NON-NLS-1$
+                                                       } else {
+                                                               return decimalFormat
+                                                                               .format(node.getValue().cumulativeCpuTime
+                                                                                               / Math.pow(10, 9));
+                                                       }
+                                               }
+                                       }, null, null),
+                       new ColumnData(ELAPSED_TIME_COLUMN, 100, SWT.LEFT,
+                                       ELAPSED_TIME_COLUMN_TIP, new ColumnLabelProvider() {
+                                               @Override
+                                               public String getText(Object element) {
+                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
+                                                       if (folderLevels.contains(node.getKey())) {
+                                                               return ""; //$NON-NLS-1$
+                                                       } else if (node.getParent() != null
+                                                                       && levelsWithEmptyTime.contains(node
+                                                                                       .getParent().getKey())) {
+                                                               return ""; //$NON-NLS-1$
+                                                       } else {
+                                                               return decimalFormat
+                                                                               .format(node.getValue().elapsedTime
+                                                                                               / Math.pow(10, 9));
+                                                       }
+                                               }
+                                       }, null, null) };
+
+       /**
+        * Adapter TreeViewers can use to interact with StatisticsTreeNode objects.
+        * 
+        * @see org.eclipse.jface.viewers.ITreeContentProvider
+        */
+       private static class TreeContentProvider implements ITreeContentProvider {
+               /*
+                * (non-Javadoc)
+                * 
+                * @see
+                * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang
+                * .Object)
+                */
+               @Override
+               public Object[] getChildren(Object parentElement) {
+                       return ((StatisticsTreeNode) parentElement).getChildren().toArray();
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see
+                * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang
+                * .Object)
+                */
+               @Override
+               public Object getParent(Object element) {
+                       return ((StatisticsTreeNode) element).getParent();
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see
+                * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang
+                * .Object)
+                */
+               @Override
+               public boolean hasChildren(Object element) {
+                       return ((StatisticsTreeNode) element).hasChildren();
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see
+                * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(
+                * java.lang.Object)
+                */
+               @Override
+               public Object[] getElements(Object inputElement) {
+                       return getChildren(inputElement);
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+                */
+               @Override
+               public void dispose() {
+               }
+
+               /*
+                * (non-Javadoc)
+                * 
+                * @see
+                * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse
+                * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+                */
+               // @Override
+               @Override
+               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+               }
+       }
+
+       public StatisticsView(String viewName) {
+               super(viewName);
+       }
+
+       private static final String STATISTICS_VIEW = "StatisticsView"; //$NON-NLS-1$
+       public StatisticsView() {
+               this(STATISTICS_VIEW);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+        * .Composite)
+        */
+       @Override
+       public void createPartControl(Composite parent) {
+               parent.setLayout(new FillLayout());
+
+               treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL
+                               | SWT.V_SCROLL);
+               treeViewer.setContentProvider(new TreeContentProvider());
+               treeViewer.getTree().setHeaderVisible(true);
+               treeViewer.setUseHashlookup(true);
+
+               for (final ColumnData columnData : columnDataList) {
+                       final TreeViewerColumn treeColumn = new TreeViewerColumn(
+                                       treeViewer, columnData.alignment);
+                       treeColumn.getColumn().setText(columnData.header);
+                       treeColumn.getColumn().setWidth(columnData.width);
+                       treeColumn.getColumn().setToolTipText(columnData.tooltip);
+                       if (columnData.comparator != null) {
+                               treeColumn.getColumn().addSelectionListener(
+                                               new SelectionAdapter() {
+                                                       @Override
+                                                       public void widgetSelected(SelectionEvent e) {
+                                                               if (treeViewer.getTree().getSortDirection() == SWT.UP
+                                                                               || treeViewer.getTree().getSortColumn() != treeColumn
+                                                                                               .getColumn()) {
+                                                                       treeViewer
+                                                                                       .setComparator(columnData.comparator);
+                                                                       treeViewer.getTree().setSortDirection(
+                                                                                       SWT.DOWN);
+                                                               } else {
+                                                                       treeViewer
+                                                                                       .setComparator(new ViewerComparator() {
+                                                                                               @Override
+                                                                                               public int compare(
+                                                                                                               Viewer viewer,
+                                                                                                               Object e1, Object e2) {
+                                                                                                       return -1
+                                                                                                                       * columnData.comparator
+                                                                                                                                       .compare(
+                                                                                                                                                       viewer,
+                                                                                                                                                       e1,
+                                                                                                                                                       e2);
+                                                                                               }
+                                                                                       });
+                                                                       treeViewer.getTree().setSortDirection(
+                                                                                       SWT.UP);
+                                                               }
+                                                               treeViewer.getTree().setSortColumn(
+                                                                               treeColumn.getColumn());
+                                                       }
+                                               });
+                       }
+                       treeColumn.setLabelProvider(columnData.labelProvider);
+               }
+
+               // Handler that will draw the bar charts.
+               treeViewer.getTree().addListener(SWT.EraseItem, new Listener() {
+                       // @Override
+                       @Override
+                       public void handleEvent(Event event) {
+                               if (columnDataList[event.index].percentageProvider != null) {
+                                       StatisticsTreeNode node = (StatisticsTreeNode) event.item
+                                                       .getData();
+
+                                       double percentage = columnDataList[event.index].percentageProvider
+                                                       .getPercentage(node);
+                                       if (percentage == 0) {
+                                               return;
+                                       }
+
+                                       if ((event.detail & SWT.SELECTED) > 0) {
+                                               Color oldForeground = event.gc.getForeground();
+                                               event.gc.setForeground(event.item.getDisplay()
+                                                               .getSystemColor(SWT.COLOR_LIST_SELECTION));
+                                               event.gc.fillRectangle(event.x, event.y, event.width,
+                                                               event.height);
+                                               event.gc.setForeground(oldForeground);
+                                               event.detail &= ~SWT.SELECTED;
+                                       }
+
+                                       int barWidth = (int) ((treeViewer.getTree().getColumn(1)
+                                                       .getWidth() - 8) * percentage);
+                                       int oldAlpha = event.gc.getAlpha();
+                                       Color oldForeground = event.gc.getForeground();
+                                       Color oldBackground = event.gc.getBackground();
+                                       event.gc.setAlpha(64);
+                                       event.gc.setForeground(event.item.getDisplay()
+                                                       .getSystemColor(SWT.COLOR_BLUE));
+                                       event.gc.setBackground(event.item.getDisplay()
+                                                       .getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+                                       event.gc.fillGradientRectangle(event.x, event.y, barWidth,
+                                                       event.height, true);
+                                       event.gc.drawRectangle(event.x, event.y, barWidth,
+                                                       event.height);
+                                       event.gc.setForeground(oldForeground);
+                                       event.gc.setBackground(oldBackground);
+                                       event.gc.setAlpha(oldAlpha);
+                                       event.detail &= ~SWT.BACKGROUND;
+                               }
+                       }
+               });
+
+               treeViewer.setComparator(columnDataList[0].comparator);
+               treeViewer.getTree().setSortColumn(treeViewer.getTree().getColumn(0));
+               treeViewer.getTree().setSortDirection(SWT.DOWN);
+
+               // Read current data if any available
+               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
+               if (experiment != null) {
+                       
+                       @SuppressWarnings({ "rawtypes", "unchecked" })
+                       TmfExperimentSelectedSignal<?> signal = new TmfExperimentSelectedSignal(this, experiment);
+                       fRequestData = true;
+                       experimentSelected(signal);
+                       
+               } else {
+                       TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
+               }
+       }
+
+       @Override
+       public void dispose() {
+               super.dispose();
+               if (fwaitCursor != null) {
+                       fwaitCursor.dispose();
+               }
+
+               // clean the model
+               StatisticsTreeRootFactory.removeAll();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+        */
+       @Override
+       public void setFocus() {
+               treeViewer.getTree().setFocus();
+       }
+
+       
+       /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getInputChangedRefresh()
+     */
+    @Override
+    protected Long getInputChangedRefresh() {
+        return STATS_INPUT_CHANGED_REFRESH;
+    }
+
+       /**
+        * @return
+        */
+       @Override
+       public AbsEventToHandlerResolver getEventProcessor() {
+               return StatsTimeCountHandlerFactory.getInstance();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#waitCursor
+        * (boolean)
+        */
+       @Override
+       protected void waitCursor(final boolean waitInd) {
+               if ((treeViewer == null) || (treeViewer.getTree().isDisposed())) {
+                       return;
+               }
+
+               Display display = treeViewer.getControl().getDisplay();
+               if (fwaitCursor == null) {
+                       fwaitCursor = new Cursor(display, SWT.CURSOR_WAIT);
+               }
+
+               // Perform the updates on the UI thread
+               display.asyncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               if ((treeViewer != null) && (!treeViewer.getTree().isDisposed())) {
+                                       Cursor cursor = null; /* indicates default */
+                                       if (waitInd) {
+                                               cursor = fwaitCursor;
+                                       }
+                                       treeViewer.getControl().setCursor(cursor);
+                               }
+                       }
+               });
+       }
+
+       @Override
+       public void modelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) {
+               Object input = treeViewer.getInput();
+               if ((input != null) && (input instanceof StatisticsTreeNode) && (!treeViewer.getTree().isDisposed())) {
+                       if (clearAllData) {
+                               ((StatisticsTreeNode) input).reset();
+                       }
+                       treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
+                               // @Override
+                               @Override
+                               public void run() {
+                                       if (!treeViewer.getTree().isDisposed())
+                                               treeViewer.refresh();
+                               }
+                       });
+               }
+       }
+
+       @Override
+       public void modelInputChanged(ILttngSyntEventRequest request, boolean complete) {
+               // Ignore update if disposed
+               if (treeViewer.getTree().isDisposed()) return;
+               
+               if(TraceDebug.isSV() && complete) {
+                   // print results
+
+                   TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
+                   if(experiment != null) {
+                       StatisticsTreeNode node = StatisticsTreeRootFactory.getStatTreeRoot(experiment.getName());
+                       printRecursively(node);
+
+                   }
+               }
+               
+               treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
+                       // @Override
+                       @Override
+                       public void run() {
+                               if (!treeViewer.getTree().isDisposed())
+                                       treeViewer.refresh();
+                       }
+               });
+               
+               if (complete) {
+                       synchronized (fStatisticsUpdateSyncObj) {
+                               fStatisticsUpdateBusy = false;
+                               if (fStatisticsUpdatePending) {
+                                       fStatisticsUpdatePending = false;
+                                       requestData(TmfExperiment.getCurrentExperiment(), fStatisticsUpdateRange, false);
+                               }
+                       }
+               }
+
+       }
+
+       private static int level = 0;
+    private void printRecursively(StatisticsTreeNode node) {
+        StringBuffer tab = new StringBuffer(""); //$NON-NLS-1$
+        for (int i = 0; i < level; i++) {
+            tab.append("\t"); //$NON-NLS-1$
+        }
+        level++;
+        TraceDebug.traceSV(tab + node.getContent());
+        if (node.hasChildren()) {
+            LinkedList<StatisticsTreeNode> childreen = (LinkedList<StatisticsTreeNode>)node.getChildren();
+            Collections.sort(childreen);
+
+            for (Iterator<StatisticsTreeNode> iterator = childreen.iterator(); iterator.hasNext();) {
+                StatisticsTreeNode statisticsTreeNode = (StatisticsTreeNode) iterator.next();
+                printRecursively(statisticsTreeNode);
+            }
+        }
+        level--;
+    }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * modelIncomplete
+        * (org.eclipse.linuxtools.lttng.request.ILttngSyntEventRequest)
+        */
+       @Override
+       public void modelIncomplete(ILttngSyntEventRequest request) {
+        // Do not remove incomplete statistics, they can be completed upon next selection
+       }
+
+       /**
+        * @param signal
+        */
+       @TmfSignalHandler
+       public void experimentSelected(TmfExperimentSelectedSignal<? extends ITmfEvent> signal) {
+               if (signal != null) {
+                       TmfExperiment<?> experiment = signal.getExperiment();
+                       String experimentName =  experiment.getName();
+
+                       if (StatisticsTreeRootFactory.containsTreeRoot(experimentName)) {
+                               // The experiment root is already present
+                               StatisticsTreeNode experimentTreeNode = StatisticsTreeRootFactory.getStatTreeRoot(experimentName);
+
+                               @SuppressWarnings("rawtypes")
+                ITmfTrace[] traces = experiment.getTraces();
+                               
+                               LTTngTreeNode expNode = StateManagerFactory.getExperimentManager().getSelectedExperiment();
+                               
+                               // check if there is partial data loaded in the experiment
+                               int numTraces = experiment.getTraces().length;
+                               int numNodeTraces = experimentTreeNode.getNbChildren();
+
+                               if (numTraces == numNodeTraces) {
+                                       boolean same = true;
+                                       // Detect if the experiment contains the same traces as when
+                                       // previously selected
+                                       for (int i = 0; i < numTraces; i++) {
+                                               String traceName = traces[i].getName();
+                                               LTTngTreeNode child = expNode.getChildByName(traceName);
+                                               if ((child == null) || (!experimentTreeNode.containsChild(child.getId().intValue()))) {
+                                                        same = false;
+                                                        break;
+                                               }
+                                       }
+
+                                       if (same) {
+                                               treeViewer.setInput(experimentTreeNode);
+                                               synchronized (fStatisticsUpdateSyncObj) {
+                                                       fStatisticsUpdateBusy = false;
+                                                       fStatisticsUpdatePending = false;
+                                               }
+                                               // request in case current data is incomplete
+                                               requestData(experiment, experiment.getTimeRange(), false);
+                                               return;
+                                       }
+                               }
+                       }
+
+                       StatisticsTreeNode treeModelRoot = StatisticsTreeRootFactory.getStatTreeRoot(experiment.getName());
+
+                       // if the model has contents, clear to start over
+                       if (treeModelRoot.hasChildren()) {
+                               treeModelRoot.reset();
+                       }
+
+                       // set input to a clean data model
+                       treeViewer.setInput(treeModelRoot);
+
+                       synchronized (fStatisticsUpdateSyncObj) {
+                               fStatisticsUpdateBusy = false;
+                               fStatisticsUpdatePending = false;
+                       }
+
+                       // if the data is not available or has changed, reload it
+                       fClearData = true;
+                       if(fRequestData) {
+                           requestData(experiment, experiment.getTimeRange(), fClearData);
+                           fRequestData = false;
+                       }
+               }
+       }
+
+       /**
+        * @param signal
+        */
+       @SuppressWarnings("unchecked")
+       @TmfSignalHandler
+       public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {
+               TmfExperiment<LttngEvent> experiment = (TmfExperiment<LttngEvent>) signal.getExperiment();
+               // validate
+               if (! experiment.equals(TmfExperiment.getCurrentExperiment())) {
+                       return;
+               }
+
+               requestData(experiment, signal.getRange(), fClearData);
+               fClearData = false;
+       }
+
+       /**
+        * @param experiment
+        */
+       private void requestData(TmfExperiment<?> experiment, TmfTimeRange range, boolean clearingData) {
+               if (experiment != null) {
+                       synchronized (fStatisticsUpdateSyncObj) {
+                               if (fStatisticsUpdateBusy) {
+                                       fStatisticsUpdatePending = true;
+                                       fStatisticsUpdateRange = range;
+                                       return;
+                               } else {
+                                       fStatisticsUpdateBusy = true;
+                               }
+                       }
+
+                       int index = 0;
+                       for (StatisticsTreeNode node : ((StatisticsTreeNode) treeViewer.getInput()).getChildren()) {
+                               index += (int) node.getValue().nbEvents;
+                       }
+
+                       // send the initial request, to start filling up model
+                       eventRequest(index, range, clearingData, ExecutionType.BACKGROUND);
+               } else {
+                       TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel
+        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
+        * ITmfTimeAnalysisEntry[], long, long, boolean, long, long,
+        * java.lang.Object)
+        */
+       @Override
+       protected void displayModel(ITmfTimeAnalysisEntry[] items, long startBoundTime, long endBoundTime,
+                       boolean updateTimeBounds, long startVisibleWindow, long endVisibleWindow, Object source) {
+               // No applicable to statistics view
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
+        * getParamsUpdater()
+        */
+       @Override
+       protected ParamsUpdater getParamsUpdater() {
+               // Not applicable to statistics view
+               return null;
+       }
+
+       @Override
+       protected ItemContainer<?> getItemContainer() {
+               // Not applicable to statistics view
+               return null;
+       }
+       
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getProviderId()
+        */
+       @Override
+       protected int getProviderId() { 
+           return LttngCoreProviderFactory.STATISTICS_LTTNG_SYTH_EVENT_PROVIDER; 
+       }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/AbstractStatsEventHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/AbstractStatsEventHandler.java
new file mode 100644 (file)
index 0000000..91da678
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsData;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsTreeRootFactory;
+
+abstract class AbstractStatsEventHandler implements ILttngEventProcessor {
+       private Events fEventType;
+       
+       public AbstractStatsEventHandler(Events eventType) {
+               super();
+               fEventType = eventType;
+       }
+
+       /**
+        * @return root of of the tree for this experiment.
+        */
+       protected StatisticsData getStatisticsTree(LttngTraceState trcState) {
+               String experimentName = trcState.getContext().getExperimentName();
+               return StatisticsTreeRootFactory.getStatTree(experimentName);
+       }
+       
+       public Events getEventHandleType() {
+               return fEventType;
+       }
+       
+       protected void stepCount(LttngEvent event, LttngTraceState traceState) {
+               StatisticsData tree = getStatisticsTree(traceState);
+               tree.registerEvent(event, traceState);
+       }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsModeChangeHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsModeChangeHandler.java
new file mode 100644 (file)
index 0000000..a21733b
--- /dev/null
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsData;
+
+class StatsModeChangeHandler extends AbstractStatsEventHandler {
+       
+       public StatsModeChangeHandler(Events eventType) {
+               super(eventType);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+        */
+       @Override
+       public boolean process(LttngEvent event, LttngTraceState traceState) {
+               StatisticsData tree = getStatisticsTree(traceState);
+               tree.increase(event, traceState, StatisticsData.Values.CPU_TIME | StatisticsData.Values.STATE_CUMULATIVE_CPU_TIME);
+               return false;
+       }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsModeEndHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsModeEndHandler.java
new file mode 100644 (file)
index 0000000..44ab8bf
--- /dev/null
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsData;
+
+class StatsModeEndHandler extends AbstractStatsEventHandler {
+       
+       public StatsModeEndHandler(Events eventType) {
+               super(eventType);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+        */
+       @Override
+       public boolean process(LttngEvent event, LttngTraceState traceState) {
+               StatisticsData tree = getStatisticsTree(traceState);
+               tree.increase(event, traceState, StatisticsData.Values.CPU_TIME | StatisticsData.Values.ELAPSED_TIME | StatisticsData.Values.CUMULATIVE_CPU_TIME);
+               return false;
+       }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsProcessExitHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsProcessExitHandler.java
new file mode 100644 (file)
index 0000000..87e810c
--- /dev/null
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsData;
+
+/**
+ * <h4>Handler for process exit event statistics</h4>
+ */
+public class StatsProcessExitHandler extends AbstractStatsEventHandler {
+       /**
+        * <h4>Constructor</h4>
+        * <p>
+        * Define the LTT_EVENT_PROCESS_EXIT type.
+        * </p>
+        */
+       public StatsProcessExitHandler() {
+               super(Events.LTT_EVENT_PROCESS_EXIT);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+        */
+       @Override
+       public boolean process(LttngEvent event, LttngTraceState traceState) {
+               StatisticsData tree = getStatisticsTree(traceState);
+               tree.process_exit(event, traceState);
+
+               return false;
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlerFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlerFactory.java
new file mode 100644 (file)
index 0000000..f4ae74b
--- /dev/null
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+
+/**
+ * Provide the handlers that will count the CPU Time, Cumulative CPU Time and
+ * Elapsed Time and update the appropriate tree.
+ * 
+ * Builds a Map from string event name to a processing handler object, the
+ * processors implement the same interface to facilitate transparent methods
+ * call,
+ * 
+ * The map key STring is the entry point of the raw events, using a hash speeds
+ * up the resolution of the appropriate processor
+ * 
+ * @author alvaro
+ * 
+ */
+public class StatsTimeCountHandlerFactory extends AbsEventToHandlerResolver {
+
+       // -----------------------------------------------------------------------
+       // Data
+       // -----------------------------------------------------------------------
+
+       private final Map<String, ILttngEventProcessor> eventNametoBeforeProcessor = new HashMap<String, ILttngEventProcessor>();
+       ILttngEventProcessor afterhandler;
+       private static StatsTimeCountHandlerFactory instance = null;
+       private StatsTimeCountHandlers instantiateHandler = new StatsTimeCountHandlers();
+
+       // -----------------------------------------------------------------------
+       // Constructors
+       // -----------------------------------------------------------------------
+
+       private StatsTimeCountHandlerFactory() {
+               super();
+               //create one instance of each individual event handler and add the instance to the map
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SYSCALL_ENTRY
+                               .getInName(), instantiateHandler.getSyscallEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SYSCALL_EXIT
+                               .getInName(), instantiateHandler.getsySyscallExitBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_ENTRY
+                               .getInName(), instantiateHandler.getTrapEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_EXIT
+                               .getInName(), instantiateHandler.getTrapExitBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_ENTRY
+                               .getInName(), instantiateHandler.getTrapEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_EXIT
+                               .getInName(), instantiateHandler.getTrapExitBeforeHandler());
+
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
+                               .getInName(), instantiateHandler.getTrapEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
+                               .getInName(), instantiateHandler.getTrapExitBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_ENTRY
+                               .getInName(), instantiateHandler.getIrqEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_EXIT
+                               .getInName(), instantiateHandler.getIrqExitBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SOFT_IRQ_ENTRY
+                               .getInName(), instantiateHandler.getSoftIrqEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SOFT_IRQ_EXIT
+                               .getInName(), instantiateHandler.getSoftIrqExitBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_FUNCTION_ENTRY
+                               .getInName(), instantiateHandler.getFunctionEntryBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_FUNCTION_EXIT
+                               .getInName(), instantiateHandler.getFunctionExitBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE
+                               .getInName(), instantiateHandler.getSchedChangeBeforeHandler());
+               
+               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PROCESS_EXIT
+                               .getInName(), instantiateHandler.getProcessExitHandler());
+               
+               afterhandler = instantiateHandler.getAfterHandler();
+
+       }
+
+       // -----------------------------------------------------------------------
+       // Public methods
+       // -----------------------------------------------------------------------
+       /**
+        * The event processors are common to all traces an multiple instances will
+        * use more memory unnecessarily
+        * 
+        * @return
+        */
+       public static AbsEventToHandlerResolver getInstance() {
+               if (instance == null) {
+                       instance = new StatsTimeCountHandlerFactory();
+               }
+               return instance;
+       }
+
+
+       @Override
+       public ILttngEventProcessor getAfterProcessor(String eventType) {
+               return afterhandler;
+       }
+
+       @Override
+       public ILttngEventProcessor getBeforeProcessor(String eventType) {
+               return eventNametoBeforeProcessor.get(eventType);
+       }
+
+       @Override
+       public ILttngEventProcessor getfinishProcessor() {
+               return instantiateHandler.getTracesetEndHandler();
+       }
+
+       @Override
+       public ILttngEventProcessor getStateUpdaterProcessor(String eventType) {
+               return null;
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlers.java
new file mode 100644 (file)
index 0000000..98f8f3b
--- /dev/null
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+
+/**
+ * Process the system call entry event
+ * 
+ * @author alvaro
+ * 
+ */
+class StatsTimeCountHandlers {
+       
+       /**
+        * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getSyscallEntryBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SYSCALL_ENTRY);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_SYSCALL_EXIT
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getsySyscallExitBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SYSCALL_EXIT);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_TRAP_ENTRY
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getTrapEntryBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_TRAP_ENTRY);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_TRAP_EXIT
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getTrapExitBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_TRAP_EXIT);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_IRQ_ENTRY
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getIrqEntryBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_IRQ_ENTRY);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_IRQ_EXIT
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getIrqExitBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_IRQ_EXIT);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_SOFT_IRQ_ENTRY
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getSoftIrqEntryBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SOFT_IRQ_ENTRY);
+               return handler;
+       }
+       
+       /**
+        * Method to handle the event: LTT_EVENT_SOFT_IRQ_EXIT
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getSoftIrqExitBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SOFT_IRQ_EXIT);
+               return handler;
+       }
+
+       /**
+        * <p>
+        * Handles event: LTT_EVENT_FUNCTION_ENTRY
+        * </p>
+        * <p>
+        * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getFunctionEntryBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_FUNCTION_ENTRY);
+               return handler;
+       }
+
+       /**
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getFunctionExitBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_FUNCTION_EXIT);
+               return handler;
+       }
+       
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SCHED_SCHEDULE
+        * </p>
+        * <p>
+        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getSchedChangeBeforeHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SCHED_SCHEDULE);
+               return handler;
+       }
+       
+       /**
+        * <p>
+        * Handles: LTT_EVENT_SCHED_SCHEDULE
+        * </p>
+        * <p>
+        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
+        * </p>
+        * 
+        * @return
+        */
+       final ILttngEventProcessor getAfterHandler() {
+               AbstractStatsEventHandler handler = new StatsModeChangeHandler(null) {
+                       int sched_hash = StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName().hashCode();
+                       @Override
+                       public boolean process(LttngEvent event, LttngTraceState traceState) {
+                               // Step the event counter for any after event
+                               stepCount(event, traceState);
+
+                               int eventNameHash = event.getMarkerName().hashCode();
+                               // specific processing for after sched schedule
+                               if (sched_hash == eventNameHash
+                                               && event.getMarkerName().equals(StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName())) {
+                                       return super.process(event, traceState);
+                               }
+
+                               return false;
+                       }
+               };
+
+               return handler;
+       }
+       /**
+        * <h4>Get the trace end handler</h4>
+        * <p>Allow to do some calculations when the trace is finished.</p>
+        * @return The handler.
+        */
+       ILttngEventProcessor getTracesetEndHandler() {
+               return new StatsTracesetEndHandler();
+       }
+       /**
+        * <h4>Get the process exit handler</h4>
+        * <p> Handles: {@link org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events#LTT_EVENT_PROCESS_EXIT}.</p>
+        * @return The handler.
+        */
+       ILttngEventProcessor getProcessExitHandler() {
+               return new StatsProcessExitHandler();
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTracesetEndHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/evProcessor/StatsTracesetEndHandler.java
new file mode 100644 (file)
index 0000000..0fe23ca
--- /dev/null
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.evProcessor;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.StatisticsData;
+
+/**
+ * <h4>Handler for the traceset end</h4>
+ * <p>This class allow to react to the end of the traceset.</p>
+ */
+public class StatsTracesetEndHandler extends AbstractStatsEventHandler {
+       /**
+        * <h4>Constructor</h4>
+        */
+       public StatsTracesetEndHandler() {
+               super(null);
+       }
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+        */
+       @Override
+       public boolean process(LttngEvent event, LttngTraceState traceState) {
+               StatisticsData tree = getStatisticsTree(traceState);
+               tree.endTraceset(event, traceState);
+               return false;
+       }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/messages.properties
new file mode 100644 (file)
index 0000000..aafff50
--- /dev/null
@@ -0,0 +1,10 @@
+StatisticsView_CPUTimeColumn=CPU Time
+StatisticsView_CPUTimeTip=Total amount of time the CPU was used excluding wait times(I/O, etc.) at that level.
+StatisticsView_CumCPUTimeColumn=Cumulative CPU Time
+StatisticsView_CumCPUTimeTip=Total amount of time between the first and last event excluding wait times in a level.
+StatisticsView_ElapsedTimeColumn=Elapsed Time
+StatisticsView_ElapsedTimeTip=Total amount of time the CPU was used including wait times(I/O, etc.) at that level.
+StatisticsView_LevelColumn=Level
+StatisticsView_LevelColumnTip=Level at which statistics apply.
+StatisticsView_NbEventsColumn=Number of Events
+StatisticsView_NbEventsTip=Total amount of events that are tied to given resource.
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/FixedArray.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/FixedArray.java
new file mode 100644 (file)
index 0000000..58967e5
--- /dev/null
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+import java.util.Arrays;
+import java.util.RandomAccess;
+
+/**
+ * <h4>Allow to create a List object that contain an already existing array.</h4>
+ * <p>Works like {@link java.util.Arrays#asList} but offers more functions : 
+ * <ul>
+ *     <li>{@link #hashCode()}</li>
+ *     <li>{@link #equals(Object)}</li>
+ * </ul></p>
+ * <p>Those functions allow to use the FixedArray as the key of a {@link java.util.HashMap}.</p>
+ *
+ * @param <T> Type of the array content.
+ */
+public final class FixedArray implements RandomAccess, Cloneable {
+       /**
+        * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist in java 5.
+        * @param array Original array to copy from.
+        * @param newLength Length of the copy to be returned.
+        * @return A new array consisting of the elements specified.
+        */
+       private static int[] copyOf(final int[] array, int newLength) {
+               int[] result = new int[newLength]; // Is it useful to use newInstance?
+               System.arraycopy(array, 0, result, 0, Math.min(array.length, newLength));
+               return result;
+       }
+
+       /**
+        * Replace {@link java.util.Arrays#copyOfRange(Object[], int, int)} that do not exist in java 5.
+        * @param <E> Content of the array.
+        * @param array Original array to copy from.
+        * @param start Starting position of the range.
+        * @param end Ending position of the range.
+        * @return A new array consisting of the elements specified.
+        */
+       private static int[] copyOfRange(final int[] array, int start, int end) {
+               int[] result = new int[end - start];
+               System.arraycopy(array, start, result, 0, end - start);
+               return result;
+       }
+       /**
+        * The array.
+        */
+       private final int[] fArray;
+       
+       /**
+        * Constructor.
+        * @param array Array to use. WILL NOT BE COPIED.
+        */
+       public FixedArray(final int... array) {
+               fArray = array;
+       }
+       /**
+        * Append a FixedArray to this FixedArray.
+        * @param value The FixedArray to append.
+        * @return A new FixedArray with the elements of the two FixedArray.
+        */
+       public FixedArray append(final FixedArray value) {
+               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + value.size()));
+               System.arraycopy(value.fArray, 0, result.fArray, fArray.length, value.fArray.length);
+               return result;
+       }
+       /**
+        * Append in order many FixedArray to this FixedArray.
+        * @param values The FixedArrays to append.
+        * @return A new FixedArray with the element of all the FixedArray.
+        */
+       public FixedArray append(final FixedArray... values) {
+               int newLength = 0;
+               for(FixedArray value : values)
+                       newLength += value.size();
+               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + newLength));
+               newLength = fArray.length;
+               for(FixedArray value : values)
+               {
+                       System.arraycopy(value.fArray, 0, result.fArray, newLength, value.fArray.length);
+                       newLength += value.fArray.length;
+               }
+               return result;
+       }
+       /**
+        * Append an element to the array.
+        * @param value Element to append.
+        * @return A new FixedArray with the element appended.
+        */
+       public FixedArray append(final int value) {
+               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + 1));
+               result.fArray[fArray.length] = value;
+               return result;
+       }
+       /**
+        * Append an array of element to the array.
+        * @param values Elements array to append.
+        * @return A new FixedArray with the elements appended.
+        */
+       public FixedArray append(final int... values) {
+               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + values.length));
+               for(int i = 0; i < values.length; ++i)
+                       result.fArray[fArray.length + i] =  values[i];
+               return result;
+       }
+       /*
+        * (non-Javadoc)
+        * @see java.lang.Object#clone()
+        */
+       @Override
+       public Object clone() {
+               return new FixedArray(copyOf(fArray, fArray.length));
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see java.lang.Object#equals(java.lang.Object)
+        */
+       @Override
+    public boolean equals(Object other) {
+        if (this == other)
+            return true;
+        if (other == null)
+            return false;
+        if (!(other instanceof FixedArray))
+            return false;
+        FixedArray array = (FixedArray) other;
+        return Arrays.equals(fArray, array.fArray);
+    }
+
+       /**
+        * Gets value of given index.
+        * @param index 
+        * @return Value of given index
+        */
+       public int get(int index) {
+               return fArray[index];
+       }
+       /**
+        * Get the array reference.
+        * @return The array reference.
+        * @see #toArray FixedArray.toArray() to get a copy of the array.
+        */
+       public int[] getArray() {
+               return fArray;
+       }
+       /*
+        * (non-Javadoc)
+        * @see java.lang.Object#hashCode()
+        */
+       @Override
+       public int hashCode() {
+           return Arrays.hashCode(fArray);
+       }
+       /**
+        * Sets value at given index.
+        * @param index
+        * @param value
+        * @return returns old value.
+        */
+       public int set(int index, int value) {
+               int temp = fArray[index];
+               fArray[index] = value;
+               return temp;
+       }
+       /**
+        * Gets the size of the array.
+        * @return Size of the array.
+        */
+       public int size() {
+               return fArray.length;
+       }
+       /**
+        * Get a array covering only a part of the array.
+        * @param start Starting position of the new array.
+        * @return A new array covering the elements specified.
+        */
+       public FixedArray subArray(int start) {
+               return new FixedArray(copyOfRange(fArray, start, fArray.length - 1));
+       }
+       /**
+        * Get a array covering only a part of the array.
+        * @param start Starting position of the new array.
+        * @param length Number of element to include in the new array.
+        * @return A new array covering the elements specified.
+        */
+       public FixedArray subArray(int start, int length) {
+               return new FixedArray(copyOfRange(fArray, start, length + start));
+       }
+       /*
+        * (non-Javadoc)
+        * @see java.lang.Object#toString()
+        */
+       @Override
+       public String toString() {
+               return Arrays.toString(fArray);
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/KernelStatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/KernelStatisticsData.java
new file mode 100644 (file)
index 0000000..b4a420f
--- /dev/null
@@ -0,0 +1,1126 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ExecutionMode;
+import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ProcessStatus;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+
+/**
+ * <h4>Class that process the LTTng kernel events.</h4>
+ */
+public class KernelStatisticsData extends StatisticsData {
+    /**
+     * <h4>Header for the CPU categories.</h4>
+     */
+    public static final String HEADER_CPUS = Messages.KernelStatisticsData_CPUs;
+    public static final int HEADER_CPUS_INT = 256 | LttngConstants.STATS_CATEGORY_ID;
+    /**
+     * <h4>Header for the event types categories.</h4>
+     */
+    public static final String HEADER_EVENT_TYPES = Messages.KernelStatisticsData_EventTypes;
+    public static final int HEADER_EVENT_TYPES_INT = (HEADER_CPUS_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
+    /**
+     * <h4>Header for the function categories.</h4>
+     */
+    public static final String HEADER_FUNCTIONS = Messages.KernelStatisticsData_Functions;
+    public static final int HEADER_FUNCTIONS_INT = (HEADER_EVENT_TYPES_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
+    /**
+     * <h4>Header for the mode categories.</h4>
+     */
+    public static final String HEADER_MODES = Messages.KernelStatisticsData_Modes;
+    public static final int HEADER_MODES_INT = (HEADER_FUNCTIONS_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
+    /**
+     * <h4>Header for the processes categories.</h4>
+     */
+    public static final String HEADER_PROCESSES = Messages.KernelStatisticsData_Processes;
+    public static final int HEADER_PROCESSES_INT = (HEADER_MODES_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
+    /**
+     * <h4>Header for the submode categories.</h4>
+     */
+    public static final String HEADER_SUBMODES = Messages.KernelStatisticsData_SubModes;
+    public static final int HEADER_SUBMODES_INT = (HEADER_PROCESSES_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
+
+    /**
+     * <h4>Class to generate unique IDs for processes.</h4>
+     */
+    private ProcessKeyProvider fPidKeys = new ProcessKeyProvider(LttngConstants.STATS_PROCESS_ID);
+
+    /**
+     * <h4>Class to generate unique Ids for event types.</h4>
+     */
+    private KeyProvider fTypeKeys = new KeyProvider(LttngConstants.STATS_TYPE_ID);
+    /**
+     * <h4>Class to generate unique Ids for subModes.</h4>
+     */
+    private KeyProvider fSubModeKeys = new KeyProvider();
+
+    /**
+     * <h4>Place Holder in path.</h4>
+     */
+    private static final int PLACE_HOLDER = 0;
+
+    /**
+     * For performance reason the following algorithm is applied to the paths:
+     * 
+     * Each array entry has to be unique to form a unique path. To generate
+     * unique entries a bit mask is used, where the bit mask is applied to the
+     * upper N bits of an integer value. It is assumed, that each value that
+     * will be filled in the place holder below is smaller than 2 ^ (32 - N).
+     */
+
+    /**
+     * <h4>Pre-created paths for type statistics, which will be filled for each
+     * relevant event.</h4>
+     */
+    private final FixedArray[] fTypedPaths = { new FixedArray(PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), };
+    /**
+     * <h4>Pre-created paths for other statistics, which will be filled for each
+     * relevant event.</h4>
+     */
+    final FixedArray[] fNormalPaths = { new FixedArray(PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER),
+            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), };
+
+    /**
+     * <h4>Indicate that it's a value.</h4>
+     * <p>
+     * Used when checking the possible child node for a node.
+     * </p>
+     * <p>
+     * It differentiate a category of a value by being appended to a value.
+     * </p>
+     */
+    private static final Integer NODE = -1;
+    private static final Integer ROOT_NODE_KEY = -2;
+
+    /**
+     * <h4>Constructor.</h4>
+     * 
+     * @param traceName
+     */
+    public KernelStatisticsData(String traceName) {
+        super();
+        Map<Integer, Set<Integer>> keys = getKeys();
+
+        // //////////// Adding category sets
+        keys.put(HEADER_PROCESSES_INT, new HashSet<Integer>());
+        keys.put(HEADER_MODES_INT, new HashSet<Integer>());
+        keys.put(HEADER_CPUS_INT, new HashSet<Integer>(4)); // Over 4 CPUs is
+                                                            // not common
+        keys.put(HEADER_SUBMODES_INT, new HashSet<Integer>());
+        keys.put(HEADER_EVENT_TYPES_INT, new HashSet<Integer>());
+        keys.put(HEADER_FUNCTIONS_INT, new HashSet<Integer>(4)); // Seems to be
+                                                                 // always one.
+
+        // /////////// Adding value sets
+        // Under a trace
+        Set<Integer> temp = new HashSet<Integer>(8);
+        temp.add(HEADER_PROCESSES_INT);
+        temp.add(HEADER_MODES_INT);
+        temp.add(HEADER_CPUS_INT);
+        temp.add(HEADER_EVENT_TYPES_INT);
+        keys.put(ROOT_NODE_KEY, temp);
+        // Under a process
+        temp = new HashSet<Integer>(4);
+        temp.add(HEADER_MODES_INT);
+        temp.add(HEADER_CPUS_INT);
+        temp.add(HEADER_EVENT_TYPES_INT);
+        keys.put(HEADER_PROCESSES_INT * NODE, temp);
+        // Under a CPUs : Functions is a special case
+        temp = new HashSet<Integer>(4);
+        temp.add(HEADER_MODES_INT);
+        temp.add(HEADER_EVENT_TYPES_INT);
+        keys.put(HEADER_CPUS_INT * NODE, temp);
+        // Under a functions
+        temp = new HashSet<Integer>(4);
+        temp.add(HEADER_MODES_INT);
+        temp.add(HEADER_EVENT_TYPES_INT);
+        keys.put(HEADER_FUNCTIONS_INT * NODE, temp);
+        // Under a mode
+        temp = new HashSet<Integer>(4);
+        temp.add(HEADER_SUBMODES_INT);
+        temp.add(HEADER_EVENT_TYPES_INT);
+        keys.put(HEADER_MODES_INT * NODE, temp);
+        // Under a submodes
+        temp = new HashSet<Integer>(2);
+        temp.add(HEADER_EVENT_TYPES_INT);
+        keys.put(HEADER_SUBMODES_INT * NODE, temp);
+        // Under an event type
+        temp = new HashSet<Integer>(16);
+        keys.put(HEADER_EVENT_TYPES_INT * NODE, temp);
+
+        // //////////// CREATE root
+        keys.put(ROOT.get(0), new HashSet<Integer>(2)); // 1 trace at the time
+        StatisticsTreeNode node = getOrCreate(ROOT);
+        node.setName("root"); //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #endTraceset(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+     */
+    @Override
+    public void endTraceset(LttngEvent event, LttngTraceState traceState) {
+        // TODO Should we uncomment the rest?
+        // It include in the cpu time the time between the last event of each
+        // cpu and the time of the last global event.
+        // Because we know that there won't be a change of mode or process
+        // between those time.
+        /*
+         * if(last_ == null) return;
+         * 
+         * LttngProcessState process = traceState.getRunning_process().get(0L);
+         * System.out.println(process.getState().getChange_LttTime()); for(long
+         * cpu : traceState.getRunning_process().keySet()) { LttngEventType
+         * newType = new LttngEventType(last_.getType().getTracefileName(), cpu,
+         * last_.getType().getMarkerName(), last_.getType().getLabels());
+         * last_.setType(newType); increase(last_, traceState, Values.CPU_TIME |
+         * Values.CUMULATIVE_CPU_TIME | Values.ELAPSED_TIME |
+         * Values.STATE_CUMULATIVE_CPU_TIME); // TODO Are all those values
+         * required? }
+         */
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #getChildren
+     * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
+     */
+    @Override
+    public Collection<StatisticsTreeNode> getChildren(final FixedArray path) {
+        LinkedList<StatisticsTreeNode> result = new LinkedList<StatisticsTreeNode>();
+
+        if (path.size() % 2 == 0) { // if we are at a Category
+            StatisticsTreeNode current = null;
+            for (int value : getKeys().get(path.get(path.size() - 1))) {
+                current = get(path.append(value));
+                if (current != null && current.getValue().nbEvents != 0)
+                    result.add(current);
+            }
+        } else if (path.size() == 1) { // Special case.
+            if (path.equals(ROOT)) // Asking for the root.
+                for (int value : getKeys().get(ROOT.get(0)))
+                    result.add(getOrCreate(new FixedArray(value)));
+            else
+                // Get value under the root
+                for (int value : getKeys().get(ROOT_NODE_KEY)) {
+                    StatisticsTreeNode node = getOrCreate(path.append(value));
+                    node.setName(getCategoryFromId(value));
+                    result.add(node);
+                }
+        } else {// If we are at a value
+            for (int value : getKeys().get((path.get(path.size() - 2) * NODE))) { // Search
+                                                                                  // the
+                                                                                  // parent
+                                                                                  // name
+                                                                                  // +
+                                                                                  // NODE
+                StatisticsTreeNode node = getOrCreate(path.append(value));
+                node.setName(getCategoryFromId(value));
+                result.add(node);
+            }
+
+            if (path.size() == 5 && path.get(3) == HEADER_CPUS_INT) { // Special
+                                                                      // the
+                                                                      // Functions
+                                                                      // is just
+                                                                      // there.
+                                                                      // We want
+                                                                      // the
+                                                                      // fourth
+                                                                      // element
+                                                                      // but it
+                                                                      // start
+                                                                      // at 0.
+                                                                      // So #3
+                StatisticsTreeNode node = getOrCreate(path.append(HEADER_FUNCTIONS_INT));
+                node.setName(getCategoryFromId(HEADER_FUNCTIONS_INT));
+                result.add(node);
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * <h4>Get the standard paths for an event.</h4>
+     * 
+     * @param event
+     *            Event to get the path for.
+     * @param traceState
+     *            State of the trace for this event.
+     * @return Array of FixedArray representing the paths.
+     */
+    private FixedArray[] getNormalPaths(LttngEvent event, LttngTraceState traceState) {
+        int trace = (int) traceState.getContext().getIdentifier(); // No need
+                                                                   // for the
+                                                                   // identifier
+                                                                   // (already
+                                                                   // applied)
+        Long cpu = event.getCpuId();
+        int cpus = cpu.intValue() | LttngConstants.STATS_CPU_ID;
+        LttngProcessState process = traceState.getRunning_process().get(cpu);
+        int processName = fPidKeys.getUniqueId(process.getPid().intValue(), process.getCpu().intValue(), process.getCreation_time());
+        int mode = process.getState().getExec_mode().ordinal() | LttngConstants.STATS_MODE_ID;
+        int submode = fSubModeKeys.getUniqueId(process.getState().getExec_submode_id(), process.getState().getExec_submode());
+        int function = process.getCurrent_function().intValue() | LttngConstants.STATS_FUNCTION_ID;
+
+        /*
+         * Note that it's faster to re-use the path object, set the relevant
+         * fields and clone the path later when it's time to add to the map
+         */
+
+        // FixedArray(trace)
+        fNormalPaths[0].set(0, trace);
+
+        // FixedArray(trace,HEADER_MODES_INT,mode)
+        fNormalPaths[1].set(0, trace);
+        fNormalPaths[1].set(2, mode);
+
+        // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
+        fNormalPaths[2].set(0, trace);
+        fNormalPaths[2].set(2, mode);
+        fNormalPaths[2].set(4, submode);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName)
+        fNormalPaths[3].set(0, trace);
+        fNormalPaths[3].set(2, processName);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus)
+        fNormalPaths[4].set(0, trace);
+        fNormalPaths[4].set(2, processName);
+        fNormalPaths[4].set(4, cpus);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function)
+        fNormalPaths[5].set(0, trace);
+        fNormalPaths[5].set(2, processName);
+        fNormalPaths[5].set(4, cpus);
+        fNormalPaths[5].set(6, function);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,
+        // HEADER_MODES_INT, mode)
+        fNormalPaths[6].set(0, trace);
+        fNormalPaths[6].set(2, processName);
+        fNormalPaths[6].set(4, cpus);
+        fNormalPaths[6].set(6, function);
+        fNormalPaths[6].set(8, mode);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,
+        // HEADER_MODES_INT, mode, HEADER_SUBMODES_INT, submode)
+        fNormalPaths[7].set(0, trace);
+        fNormalPaths[7].set(2, processName);
+        fNormalPaths[7].set(4, cpus);
+        fNormalPaths[7].set(6, function);
+        fNormalPaths[7].set(8, mode);
+        fNormalPaths[7].set(10, submode);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode)
+        fNormalPaths[8].set(0, trace);
+        fNormalPaths[8].set(2, processName);
+        fNormalPaths[8].set(4, cpus);
+        fNormalPaths[8].set(6, mode);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
+        fNormalPaths[9].set(0, trace);
+        fNormalPaths[9].set(2, processName);
+        fNormalPaths[9].set(4, cpus);
+        fNormalPaths[9].set(6, mode);
+        fNormalPaths[9].set(8, submode);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode)
+        fNormalPaths[10].set(0, trace);
+        fNormalPaths[10].set(2, processName);
+        fNormalPaths[10].set(4, mode);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
+        fNormalPaths[11].set(0, trace);
+        fNormalPaths[11].set(2, processName);
+        fNormalPaths[11].set(4, mode);
+        fNormalPaths[11].set(6, submode);
+
+        // FixedArray(trace,HEADER_CPUS_INT,cpus)
+        fNormalPaths[12].set(0, trace);
+        fNormalPaths[12].set(2, cpus);
+
+        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode)
+        fNormalPaths[13].set(0, trace);
+        fNormalPaths[13].set(2, cpus);
+        fNormalPaths[13].set(4, mode);
+
+        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
+        fNormalPaths[14].set(0, trace);
+        fNormalPaths[14].set(2, cpus);
+        fNormalPaths[14].set(4, mode);
+        fNormalPaths[14].set(6, submode);
+
+        return fNormalPaths;
+
+    }
+
+    /**
+     * <h4>Get the event types paths.</h4>
+     * 
+     * @param event
+     *            Event to get the path for.
+     * @param traceState
+     *            State of the trace for this event.
+     * @return Array of FixedArray representing the paths.
+     */
+    private FixedArray[] getTypePaths(LttngEvent event, LttngTraceState traceState) {
+        int trace = (int) traceState.getContext().getIdentifier(); // No need
+                                                                   // for the
+                                                                   // identifier
+                                                                   // (already
+                                                                   // applied)
+        Long cpu = event.getCpuId();
+        int cpus = cpu.intValue() | LttngConstants.STATS_CPU_ID;
+        LttngProcessState process = traceState.getRunning_process().get(cpu);
+        int processName = fPidKeys.getUniqueId(process.getPid().intValue(), process.getCpu().intValue(), process.getCreation_time());
+        int mode = process.getState().getExec_mode().ordinal() | LttngConstants.STATS_MODE_ID;
+        int submode = fSubModeKeys.getUniqueId(process.getState().getExec_submode_id(), process.getState().getExec_submode());
+        int function = process.getCurrent_function().intValue() | LttngConstants.STATS_FUNCTION_ID;
+        int type = fTypeKeys.getUniqueId(event.getMarkerId(), event.getMarkerName());
+
+        /*
+         * Note that it's faster to re-use the path object, set the relevant
+         * fields and clone the path later when it's time to add to the map
+         */
+
+        // FixedArray(trace,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[0].set(0, trace);
+        fTypedPaths[0].set(2, type);
+
+        // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[1].set(0, trace);
+        fTypedPaths[1].set(2, mode);
+        fTypedPaths[1].set(4, type);
+
+        // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[2].set(0, trace);
+        fTypedPaths[2].set(2, mode);
+        fTypedPaths[2].set(4, submode);
+        fTypedPaths[2].set(6, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[3].set(0, trace);
+        fTypedPaths[3].set(2, processName);
+        fTypedPaths[3].set(4, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[4].set(0, trace);
+        fTypedPaths[4].set(2, processName);
+        fTypedPaths[4].set(4, cpus);
+        fTypedPaths[4].set(6, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[5].set(0, trace);
+        fTypedPaths[5].set(2, processName);
+        fTypedPaths[5].set(4, cpus);
+        fTypedPaths[5].set(6, function);
+        fTypedPaths[5].set(8, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[6].set(0, trace);
+        fTypedPaths[6].set(2, processName);
+        fTypedPaths[6].set(4, cpus);
+        fTypedPaths[6].set(6, function);
+        fTypedPaths[6].set(8, mode);
+        fTypedPaths[6].set(10, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,
+        // HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[7].set(0, trace);
+        fTypedPaths[7].set(2, processName);
+        fTypedPaths[7].set(4, cpus);
+        fTypedPaths[7].set(6, function);
+        fTypedPaths[7].set(8, mode);
+        fTypedPaths[7].set(10, submode);
+        fTypedPaths[7].set(12, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[8].set(0, trace);
+        fTypedPaths[8].set(2, processName);
+        fTypedPaths[8].set(4, cpus);
+        fTypedPaths[8].set(6, mode);
+        fTypedPaths[8].set(8, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[9].set(0, trace);
+        fTypedPaths[9].set(2, processName);
+        fTypedPaths[9].set(4, cpus);
+        fTypedPaths[9].set(6, mode);
+        fTypedPaths[9].set(8, submode);
+        fTypedPaths[9].set(10, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[10].set(0, trace);
+        fTypedPaths[10].set(2, processName);
+        fTypedPaths[10].set(4, mode);
+        fTypedPaths[10].set(6, type);
+
+        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[11].set(0, trace);
+        fTypedPaths[11].set(2, processName);
+        fTypedPaths[11].set(4, mode);
+        fTypedPaths[11].set(6, submode);
+        fTypedPaths[11].set(8, type);
+
+        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[12].set(0, trace);
+        fTypedPaths[12].set(2, cpus);
+        fTypedPaths[12].set(4, type);
+
+        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[13].set(0, trace);
+        fTypedPaths[13].set(2, cpus);
+        fTypedPaths[13].set(4, mode);
+        fTypedPaths[13].set(6, type);
+
+        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
+        fTypedPaths[14].set(0, trace);
+        fTypedPaths[14].set(2, cpus);
+        fTypedPaths[14].set(4, mode);
+        fTypedPaths[14].set(6, submode);
+        fTypedPaths[14].set(8, type);
+
+        return fTypedPaths;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #process_exit(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+     */
+    @Override
+    public void process_exit(LttngEvent event, LttngTraceState traceState) {
+        FixedArray[] paths = getNormalPaths(event, traceState);
+        Long cpu = event.getCpuId();
+        LttngProcessState process = traceState.getRunning_process().get(cpu);
+
+        for (int j = 0; j < paths.length; ++j) {
+            StatisticsTreeNode node = getOrCreate(paths[j], event, traceState, j, false);
+
+            if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+            }
+        }
+        // TODO Unstacks cumulative CPU time
+        // TODO Elapsed time?
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #increase(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState, int)
+     */
+    @Override
+    public void increase(LttngEvent event, LttngTraceState traceState, int values) {
+        FixedArray[] paths = getNormalPaths(event, traceState);
+        Long cpu = event.getCpuId();
+               LttngProcessState process = traceState.getRunning_process().get(cpu);
+
+        // Updating the cumulative CPU time
+        if ((values & Values.STATE_CUMULATIVE_CPU_TIME) != 0) {
+            if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                long cumulativeCpuTime = process.getState().getCum_cpu_time();
+                long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+                process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
+            }
+        }
+        if ((values & Values.CUMULATIVE_CPU_TIME) != 0) {
+            if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                long cumulativeCpuTime = process.getState().getCum_cpu_time();
+                long delta = event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
+                long newCumulativeCpuTime = cumulativeCpuTime + delta;
+                process.getState().setCum_cpu_time(newCumulativeCpuTime);
+            } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                long cumulativeCpuTime = process.getState().getCum_cpu_time();
+                long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+                long newCumulativeCpuTime = cumulativeCpuTime + delta;
+                process.getState().setCum_cpu_time(newCumulativeCpuTime);
+            }
+        }
+
+               for (int j = 0; j < paths.length; ++j) {
+                       StatisticsTreeNode node = getOrCreate(paths[j], event, traceState, j, false);
+
+            if ((values & Values.CPU_TIME) != 0) {
+                // TODO Uncomment if the event after process_exit need to be
+                // count.
+                if ((process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) /*
+                                                                                               * || process.getState().
+                                                                                               * getProc_status
+                                                                                               * ().equals(ProcessStatus
+                                                                                               * .LTTV_STATE_EXIT)
+                                                                                               */) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                    node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
+                }
+            }
+            if ((values & Values.CUMULATIVE_CPU_TIME) != 0) {
+                if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                    node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
+                } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                     node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
+                }
+            }
+            if ((values & Values.ELAPSED_TIME) != 0) {
+                if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
+                    node.getValue().elapsedTime += event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
+                }
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #registerEvent(org.eclipse.linuxtools.lttng.event.LttngEvent,
+     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
+     */
+    @Override
+    public void registerEvent(LttngEvent event, LttngTraceState traceState) {
+        FixedArray[] paths = getNormalPaths(event, traceState);
+        for (int i = 0; i < paths.length; ++i)
+            ++(getOrCreate(paths[i], event, traceState, i, false).getValue().nbEvents);
+
+        paths = getTypePaths(event, traceState);
+        for (int i = 0; i < paths.length; ++i)
+            ++(getOrCreate(paths[i], event, traceState, i, true).getValue().nbEvents);
+
+        // last_ = event; // TODO Used by endTraceset
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
+     * #registerName
+     * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
+     */
+    @Override
+    protected void registerName(final FixedArray path) {
+        if (path.size() == 1) {
+            if (!path.equals(ROOT))
+                getKeys().get(ROOT.get(0)).add(path.get(0));
+        } else if (path.size() % 2 != 0)
+            getKeys().get(path.get(path.size() - 2)).add(path.get(path.size() - 1));
+    }
+
+    /**
+     * <h4>Get or create a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @param event
+     *            The current event
+     * @param traceState
+     *            The current trace state
+     * @param index
+     *            The corresponding index of the statistic
+     * @param isType
+     *            The type of statistic (type or other)
+     * @return The node.
+     */
+    public StatisticsTreeNode getOrCreate(final FixedArray path, LttngEvent event, LttngTraceState traceState, int index, boolean isType) {
+        StatisticsTreeNode current = get(path);
+        if (current == null) {
+            // We have to clone the path since the object for the path is
+            // re-used for performance reasons!
+            FixedArray newPath = (FixedArray) path.clone();
+
+            // Note that setting of the name is done here only when the node is
+            // created (for performance reasons).
+            String name = (isType) ? getTypeStatsName(event, traceState, index) : getOtherStatsName(event, traceState, index);
+            registerName(path);
+            current = new StatisticsTreeNode(newPath, this, name);
+            put(newPath, current);
+        }
+        else {
+            // Special case: Update name if event is of type "exec". This is necessary because the 
+            // process name can change at this point (See Bug333114))
+            if ((index == 3) && !isType && Events.LTT_EVENT_EXEC.getInName().equals(event.getMarkerName())) {
+                String name = getOtherStatsName(event, traceState, index);
+                current.setName(name);
+            }
+        }
+        return current;
+    }
+
+    /**
+     * <h4>Get the name to be displayed for other statistics than type
+     * statistics</h4>
+     * 
+     * @param event
+     *            The current event
+     * @param traceState
+     *            The current trace state
+     * @param The
+     *            corresponding index of the statistic
+     * @return The name
+     */
+    private String getOtherStatsName(LttngEvent event, LttngTraceState traceState, int index) {
+        Long cpu = event.getCpuId();
+        LttngProcessState process = traceState.getRunning_process().get(cpu);
+
+        switch (index) {
+        case 0:
+            return traceState.getContext().getTraceId();
+        case 1:
+            return process.getState().getExec_mode().getInName();
+        case 2:
+            return process.getState().getExec_submode();
+        case 3:
+            return getProcessName(process);
+        case 4:
+            return String.valueOf(cpu);
+        case 5:
+            return process.getCurrent_function().toString();
+        case 6:
+            return process.getState().getExec_mode().getInName();
+        case 7:
+            return process.getState().getExec_submode();
+        case 8:
+            return process.getState().getExec_mode().getInName();
+        case 9:
+            return process.getState().getExec_submode();
+        case 10:
+            return process.getState().getExec_mode().getInName();
+        case 11:
+            return process.getState().getExec_submode();
+        case 12:
+            return String.valueOf(cpu);
+        case 13:
+            return process.getState().getExec_mode().getInName();
+        case 14:
+            return process.getState().getExec_submode();
+        default:
+            return ""; //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * <h4>Get the name to be displayed for type statistics</h4>
+     * 
+     * @param event
+     *            The current event
+     * @param traceState
+     *            The current state
+     * @param index
+     *            The corresponding index of the statistic
+     * @return The strings in a array
+     */
+    private String getTypeStatsName(LttngEvent event, LttngTraceState traceState, int index) {
+        return event.getMarkerName();
+    }
+
+    /**
+     * <h4>Get the name of a process.</h4>
+     * 
+     * @param process
+     *            The process.
+     * @return The name of the process. //TODO Adding the creation time of the
+     *         process may be needed to differentiate two process.
+     */
+    private String getProcessName(LttngProcessState process) {
+        if (process.getPid() == -1)
+            return Messages.StatisticsData_UnknowProcess;
+        if (process.getName() == null)
+            return mergeString(Messages.StatisticsData_UnknowProcess + " - ", String.valueOf(process.getPid())); //$NON-NLS-1$
+        if (process.getName().equals("")) //$NON-NLS-1$
+            return process.getPid().toString();
+        else
+            return mergeString(process.getName(), " - ", String.valueOf(process.getPid())); //$NON-NLS-1$
+    }
+
+    /**
+     * <h4>Converts the integer representation of the category to string.</h4>
+     * 
+     * @param value
+     *            Integer representation of the category.
+     * @return Category as string.
+     */
+    public static String getCategoryFromId(int value) {
+        switch (value) {
+        case KernelStatisticsData.HEADER_CPUS_INT:
+            return KernelStatisticsData.HEADER_CPUS;
+        case KernelStatisticsData.HEADER_EVENT_TYPES_INT:
+            return KernelStatisticsData.HEADER_EVENT_TYPES;
+        case KernelStatisticsData.HEADER_FUNCTIONS_INT:
+            return KernelStatisticsData.HEADER_FUNCTIONS;
+        case KernelStatisticsData.HEADER_MODES_INT:
+            return KernelStatisticsData.HEADER_MODES;
+        case KernelStatisticsData.HEADER_PROCESSES_INT:
+            return KernelStatisticsData.HEADER_PROCESSES;
+        case KernelStatisticsData.HEADER_SUBMODES_INT:
+            return KernelStatisticsData.HEADER_SUBMODES;
+        }
+        return ""; //$NON-NLS-1$
+    }
+
+    /**
+     * <h4>Provides unique keys for String - Integer pairs.</h4>
+     * 
+     * @author bhufmann
+     * 
+     */
+    private static final class KeyProvider {
+
+        /**
+         * <h4>Instance counter for unique ID generation.</h4>
+         */
+        private int fCount = 0;
+
+        /**
+         * <h4>Attributes to generate unique IDs for processes.</h4>
+         */
+        private HashMap<KeyHelper, Integer> fKeyMap = new HashMap<KeyHelper, Integer>(65535);
+        private final KeyHelper fHelper = new KeyHelper();
+
+        /**
+         * <h4>Bit mask to apply for the key.</h4>
+         */
+        private int fBitMask = 0;
+
+        /**
+         * Constructor
+         * 
+         * @param bitMask
+         *            <h4>Bit mask to apply for the key.</h4>
+         */
+        KeyProvider(int bitMask) {
+            this.fBitMask = bitMask;
+        }
+
+        /**
+         * <h4>Standard Constructor</h4>
+         */
+        KeyProvider() {
+            this(0);
+        }
+
+        /**
+         * <h4>Creates unique id for the given input data.</h4>
+         * 
+         * @param value
+         *            Integer value of the data the key is for
+         * @param name
+         *            Name of the data the key is for
+         * @return Unique id
+         */
+        public int getUniqueId(int value, String name) {
+            fHelper.setName(name);
+            fHelper.setValue(value);
+
+            Integer returnKey = fKeyMap.get(fHelper);
+            if (returnKey == null) {
+                returnKey = Integer.valueOf((++fCount) | fBitMask);
+                KeyHelper newHelper = fHelper.clone();
+                fKeyMap.put(newHelper, returnKey);
+            }
+            return returnKey.intValue();
+        }
+    }
+
+    /**
+     <h4>Helper class that provides keys for HashMaps depending on an integer 
+     * - string -pair. It provides better performance than using a string as key
+     * only. However, for optimal performance the integer values should be mostly
+     * unique.</h4>
+     * 
+     * @author bhufmann
+     * 
+     */
+    private static final class KeyHelper implements Cloneable {
+
+        // Short pre-fix
+        private final static String UNKNOWN_PREFIX = "P"; //$NON-NLS-1$
+
+        private String fName = UNKNOWN_PREFIX;
+        private int fValue = -1;
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.lang.Object#hashCode()
+         */
+        @Override
+        public int hashCode() {
+            return fValue;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.lang.Object#equals(java.lang.Object)
+         */
+        @Override
+        public boolean equals(Object o) {
+            if (o == this)
+                return true;
+            if (o == null)
+                return false;
+            if (!(o instanceof KeyHelper))
+                return false;
+            KeyHelper kh = (KeyHelper) o;
+            if (fValue == kh.fValue && fName.equals(kh.fName)) {
+                return true;
+            }
+            return false;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.lang.Object#clone()
+         */
+        @Override
+        public KeyHelper clone() {
+            KeyHelper clone = null;
+            try {
+                clone = (KeyHelper) super.clone();
+                clone.fName = fName;
+                clone.fValue = fValue;
+            } catch (CloneNotSupportedException e) {
+                e.printStackTrace();
+            }
+            return clone;
+        }
+
+        /**
+         * <h4>Set the name of the key.</h4>
+         * 
+         * @param name
+         *            The name to set.
+         */
+        public void setName(String name) {
+            if (fName != null)
+                this.fName = name;
+            else
+                this.fName = UNKNOWN_PREFIX;
+        }
+
+        /**
+         * <h4>Set the value of the key.</h4>
+         * 
+         * @param value
+         */
+        public void setValue(int value) {
+            this.fValue = value;
+        }
+    }
+
+    /**
+     * <h4>Provides unique keys for given process information. For optimal performance the integer 
+     * PIDs need to be mostly unique</h4>
+     * 
+     * @author bhufmann
+     * 
+     */
+    private static final class ProcessKeyProvider {
+        /**
+         * <h4>Instance counter for unique ID generation.</h4>
+         */
+        private int fCount = 0;
+
+        /**
+         * <h4>Attributes to generate unique IDs for processes.</h4>
+         */
+        private HashMap<ProcessKey, Integer> fKeyMap = new HashMap<ProcessKey, Integer>(65535);
+        private ProcessKey fHelper = new ProcessKey();
+
+        /**
+         * <h4>Bit mask to apply for the key.</h4>
+         */
+        private int fBitMask = 0;
+
+        /**
+         * Constructor
+         * 
+         * @param bitMask
+         *            <h4>Bit mask to apply for the key.</h4>
+         */
+        public ProcessKeyProvider(int bitMask) {
+            fBitMask = bitMask;
+        }
+
+        /**
+         * <h4>Creates unique id for the given input data.</h4>
+         * 
+         * @param value
+         *            Integer value of the data the key is for
+         * @param cpuId
+         *            The cpuId for the processKey Helper
+         * @param creationTime
+         *            The creation Time for the processKey Helper
+         * @return Unique id
+         */
+        public int getUniqueId(int value, int cpuId, long creationTime) {
+            fHelper.setPid(value);
+            fHelper.setCpuId(cpuId);
+            fHelper.setCreationTime(creationTime);
+
+            Integer returnKey = fKeyMap.get(fHelper);
+            if (returnKey == null) {
+                returnKey = Integer.valueOf((++fCount) | fBitMask);
+                ProcessKey newHelper = fHelper.clone();
+                fKeyMap.put(newHelper, returnKey);
+            }
+            return returnKey.intValue();
+        }
+    }
+    
+    /**
+    <h4>Helper class that provides keys for HashMaps depending on process information.</h4>
+    * 
+    * @author bhufmann
+    * 
+    */
+    private static final class ProcessKey implements Cloneable {
+        private int fPid = 0;
+        private int fCpuId = 0;
+        private long fCreationTime = 0;
+
+        /**
+         * <h4>Set the PID of the key.</h4>
+         * 
+         * @param pid
+         */
+        public void setPid(int pid) {
+            this.fPid = pid;
+        }
+        
+        /**
+         * <h4>Set the cpuTime of the process key.</h4>
+         * 
+         * @param cpuTime
+         *            The name to set.
+         */
+        public void setCpuId(int cpuId) {
+            this.fCpuId = cpuId;
+        }
+
+        /**
+         * <h4>Set the creationTime of the process key.</h4>
+         * 
+         * @param creationTime
+         *            The name to set.
+         */
+        public void setCreationTime(long creationTime) {
+            this.fCreationTime = creationTime;
+        }
+
+        /*
+         * (non-Javadoc)
+         * @see java.lang.Object#equals(java.lang.Object)
+         */
+        @Override
+        public boolean equals(Object obj) {
+            if (obj == this)
+                return true;
+            if (obj == null)
+                return false;
+            if (!(obj instanceof ProcessKey))
+                return false;
+
+            ProcessKey procKey = (ProcessKey) obj;
+
+            if (procKey.fPid != this.fPid) {
+                return false;
+            }
+
+            if (procKey.fCreationTime != this.fCreationTime) {
+                return false;
+            }
+            
+            // use the cpu value to validate pid 0
+            if (((procKey.fPid == 0L) && (procKey.fCpuId != this.fCpuId))) {
+                return false;
+            }
+            return true;
+        }
+
+        /*
+         * (non-Javadoc)
+         * @see java.lang.Object#hashCode()
+         */
+        @Override
+        public int hashCode() {
+            return this.fPid;
+        }
+
+        /*
+         * (non-Javadoc)
+         * @see java.lang.Object#clone()
+         */
+        @Override
+        public ProcessKey clone() {
+            ProcessKey clone = null;
+            try {
+                clone = (ProcessKey) super.clone();
+                clone.fPid = fPid;
+                clone.fCpuId = fCpuId;
+                clone.fCreationTime = fCreationTime;
+            } catch (CloneNotSupportedException e) {
+                e.printStackTrace();
+            }
+            return clone;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/Messages.java
new file mode 100644 (file)
index 0000000..11c058b
--- /dev/null
@@ -0,0 +1,21 @@
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model.messages"; //$NON-NLS-1$
+    public static String KernelStatisticsData_CPUs;
+    public static String KernelStatisticsData_EventTypes;
+    public static String KernelStatisticsData_Functions;
+    public static String KernelStatisticsData_Modes;
+    public static String KernelStatisticsData_Processes;
+    public static String KernelStatisticsData_SubModes;
+    public static String StatisticsData_UnknowProcess;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/Statistics.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/Statistics.java
new file mode 100644 (file)
index 0000000..017d1b0
--- /dev/null
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+public class Statistics {
+       /**
+        * <h4>Number of event</h4>
+        */
+       public long nbEvents = 0;
+       /**
+        * <h4>CPU time</h4>
+        * <p>Many events are excluded of the CPU time:
+        * <ul>
+        *              <li>All events in MODE_UNKNOWN</li>
+        *              <li>All events before a sched_schedule on a given CPU</li>
+        *              <li>All events in a process after the process_exit</li>
+        *              <li>Maybe some others</li>
+        * </ul>
+        */
+       public long cpuTime = 0;
+       /**
+        * <h4>Cumulative CPU time</h4>
+        * <p>Currently broken.</p>
+        */
+       public long cumulativeCpuTime = 0;
+       /**
+        * <h4>Elapsed time</h4>
+        * <p>Result validity in eclipse unknown.</p>
+        */
+       public long elapsedTime = 0;
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsData.java
new file mode 100644 (file)
index 0000000..ebdc510
--- /dev/null
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
+
+/**
+ * <h4>Base class for the statistics storage.</h4>
+ * <p>
+ * It allow to implement a tree structure while avoiding the need to run through
+ * the tree each time you need to add a node at a given place.
+ * </p>
+ */
+public abstract class StatisticsData {
+    /**
+     * <h4>Define values that can be used like a C++ enumeration.</h4>
+     * <p>
+     * The values can be used with binary "or" and "and" to mix them.
+     * </p>
+     */
+    public static class Values {
+        /**
+         * <h4>Indicate the cpu time</h4>
+         * <p>
+         * The actual time the cpu as passed in this state making calculations.
+         * </p>
+         */
+        public static final int CPU_TIME = 1;
+        /**
+         * <h4>Indicate the cumulative cpu time</h4>
+         * <p>
+         * Include the time the cpu as passed in this state and substate.
+         * </p>
+         * <p>
+         * Example:
+         * <ul>
+         * <li>PID:1, Mode:USER_MODE</li>
+         * <ul>
+         * <li>PID:1, Mode:SYSCALL</li>
+         * </ul>
+         * <li>PID:2, Mode:USER_MODE</li>
+         * </ul>
+         * </p>
+         * <p>
+         * In this example, the cumulative cpu time for "PID:1, Mode:USER_MODE"
+         * would be equal to its cpu time plus the cpu time of
+         * "PID:1, Mode:SYSCALL".
+         * </p>
+         * TODO Validate values. Not tested in LTTv. TODO Validate description.
+         */
+        public static final int CUMULATIVE_CPU_TIME = 2;
+        /**
+         * <h4>Elapsed time</h4>
+         * <p>
+         * Description...
+         * </p>
+         * TODO Give a correct description.
+         */
+        public static final int ELAPSED_TIME = 4;
+        /**
+         * <h4>State cumulative cpu time</h4>
+         * <p>
+         * Description...
+         * </p>
+         * TODO Give a correct description.
+         */
+        public static final int STATE_CUMULATIVE_CPU_TIME = 8;
+    }
+
+    /**
+     * <h4>String builder used to merge string with more efficacy.</h4>
+     */
+    protected static final StringBuilder fBuilder = new StringBuilder();
+    /**
+     * <h4>Identification of the root.</h4>
+     */
+    public static final FixedArray ROOT = new FixedArray(-1);
+
+    /**
+     * <h4>Function to merge many string with more efficacy.</h4>
+     * 
+     * @param strings
+     *            Strings to merge.
+     * @return A new string containing all the strings.
+     */
+    protected synchronized static String mergeString(String... strings) {
+        fBuilder.setLength(0);
+        for (String s : strings)
+            fBuilder.append(s);
+        return fBuilder.toString();
+    }
+
+    /**
+     * <h4>Define what child a node can have.</h4>
+     * <p>
+     * The management and usage of this map is done by subclass.
+     * </p>
+     * <p>
+     * HashSet are always faster than TreeSet.
+     * </p>
+     */
+    private Map<Integer, Set<Integer>> fKeys;
+    /**
+     * <h4>The nodes in the tree.</f4>
+     */
+    private HashMap<FixedArray, StatisticsTreeNode> fNodes;
+
+    /**
+     * <h4>Constructor.</h4>
+     */
+    public StatisticsData() {
+        fNodes = new HashMap<FixedArray, StatisticsTreeNode>();
+        fKeys = new HashMap<Integer, Set<Integer>>();
+    }
+
+    /**
+     * <h4>Indicate the end of the traceset</4>
+     * <p>
+     * Can be used to trigger necessary calculations.
+     * </p>
+     * 
+     * @param event
+     *            Event receive (May have timestamp of 0).
+     * @param traceState
+     *            State of the trace at that moment.
+     */
+    public abstract void endTraceset(LttngEvent event, LttngTraceState traceState);
+
+    /**
+     * <h4>Get a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return The node or null.
+     */
+    public StatisticsTreeNode get(final FixedArray path) {
+        return fNodes.get(path);
+    }
+
+    /**
+     * <h4>Put a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @param node
+     *            Node to put.
+     * @return node if replaced.
+     */
+    public StatisticsTreeNode put(final FixedArray path, StatisticsTreeNode node) {
+        return fNodes.put(path, node);
+    }
+
+    /**
+     * <h4>Get the children of a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return Collection containing the children.
+     */
+    public abstract Collection<StatisticsTreeNode> getChildren(final FixedArray path);
+
+    /**
+     * <h4>Get the map of existing elements of path classified by parent.</h4>
+     * 
+     * @return The map.
+     */
+    protected Map<Integer, Set<Integer>> getKeys() {
+        return fKeys;
+    }
+
+    /**
+     * <h4>Get or create a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return The node.
+     */
+    public StatisticsTreeNode getOrCreate(final FixedArray path) {
+        StatisticsTreeNode current = fNodes.get(path);
+        if (current == null) {
+            registerName(path);
+            current = new StatisticsTreeNode(path, this);
+            fNodes.put(path, current);
+        }
+        return current;
+    }
+
+    /**
+     * <h4>Get the parent of a node.</h4>
+     * 
+     * @param path
+     *            Path to the node.
+     * @return Parent node or null.
+     */
+    public StatisticsTreeNode getParent(final FixedArray path) {
+        if (path.size() == 1) {
+            if (path.equals(ROOT))
+                return null;
+            else
+                return get(ROOT);
+        }
+        // TODO Get or GetOrCreate?
+        return get(path.subArray(0, path.size() - 1));
+    }
+
+    /**
+     * <h4>Increase some values.</h4>
+     * <p>
+     * Values is an binary or operation on the desired values between
+     * {@link Values#CPU_TIME}, {@link Values#CUMULATIVE_CPU_TIME},
+     * {@link Values#ELAPSED_TIME} and {@link Values#STATE_CUMULATIVE_CPU_TIME}
+     * .
+     * 
+     * @param event
+     *            Current event.
+     * @param traceState
+     *            State of the trace at that moment.
+     * @param values
+     *            Values desired.
+     */
+    public abstract void increase(LttngEvent event, LttngTraceState traceState, int values);
+
+    /**
+     * <h4>Register an event.</h4>
+     * <p>
+     * This method must be implemented by subclass.
+     * </p>
+     * 
+     * @param event
+     *            Event to process.
+     * @param traceState
+     *            State of the trace at the moment of the event.
+     */
+    public abstract void registerEvent(LttngEvent event, LttngTraceState traceState);
+
+    /**
+     * <h4>Register that a new node was created.</h4>
+     * <p>
+     * Must make sure the {@link #getChildren(FixedArray)} on the parent node
+     * will return the newly created node.
+     * </p>
+     * 
+     * @param path
+     *            Path of the new node.
+     */
+    protected abstract void registerName(final FixedArray path);
+
+    /**
+     * <h4>Reset a node.</h4>
+     * <p>
+     * Work recursively.
+     * </p>
+     * 
+     * @param path
+     *            Path to the node.
+     */
+    public void reset(final FixedArray path) {
+        for (StatisticsTreeNode node : getChildren(path)) {
+            reset(node.getPath());
+            fNodes.remove(node.getPath());
+        }
+    }
+
+    /**
+     * Indicate that the process is finishing.
+     * 
+     * @param event
+     *            The event indicating the end of the process.
+     * @param traceState
+     *            State of the trace at that moment.
+     */
+    public abstract void process_exit(LttngEvent event, LttngTraceState traceState);
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsTreeNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsTreeNode.java
new file mode 100644 (file)
index 0000000..432f0ac
--- /dev/null
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *   Francois Godin (copelnug@gmail.com)  - Re-design for new stats structure
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+import java.util.Collection;
+
+/**
+ * <h4>A tree where nodes can be accessed efficiently using paths.</h4>
+ * 
+ * <p>It works like file systems. Each node is identified by a key. A path is an array ({@link FixedArray}) of String. The elements of the array represent the path from the root to this node.</p>
+ */
+public class StatisticsTreeNode implements Comparable<StatisticsTreeNode> {
+       /**
+        * <h4>Value of the node.</h4>
+        */
+       private Statistics fValue;
+       /**
+        * <h4>Path of the node.</h4>
+        */
+       private FixedArray fPath;
+       /**
+        * <h4>Corresponding StatisticsData.</h4>
+        */
+       private StatisticsData fNodes;
+       /**
+     * <h4>Name of the node.</h4>
+     */
+       private String fName = ""; //$NON-NLS-1$
+       /**
+        * <h4>Constructor.</h4>
+        * @param path Path to the node.
+        * @param nodes Corresponding StatisticsData.
+        */
+       public StatisticsTreeNode(final FixedArray path, StatisticsData nodes) {
+               this(path, nodes, ""); //$NON-NLS-1$
+       }
+       
+       /**
+     * <h4>Constructor.</h4>
+     * @param path Path to the node.
+     * @param nodes Corresponding StatisticsData.
+     * @param name The name associated with this node.
+     */
+       public StatisticsTreeNode(final FixedArray path, StatisticsData nodes, String name) {
+               fPath = path;
+               fNodes = nodes;
+               fName = name;
+               fValue = new Statistics();
+           }
+
+       /**
+        * <h4>Test if a node contain the specified child.</h4>
+        * @param key Name of the child.
+        * @return true: if child with given key is present, false: if no child exists with given key name
+        */
+       public boolean containsChild(Integer key) {
+               if(StatisticsData.ROOT == fPath)
+                       return fNodes.get(new FixedArray(key)) != null;
+               return (fNodes.get(fPath.append(key)) != null);
+       }
+       /**
+        * <h4>Get the children of this node.</h4>
+        * @return Direct children of this node.
+        */
+       public Collection<StatisticsTreeNode> getChildren() {
+               return fNodes.getChildren(fPath);
+       }
+       /**
+        * <h4>Get the key for this node.</h4>
+        * @return Key associated with this node.
+        */
+       public Integer getKey() {
+               return fPath.get(fPath.size() - 1);
+       }
+       /**
+        * <h4>Get the number of children this node have.</h4>
+        * @return Number of direct children of this node.
+        */
+       public int getNbChildren() {
+               return fNodes.getChildren(fPath).size();
+       }
+       /**
+        * <h4>Return the parent node.</h4>
+        * @return Parent node.
+        */
+       public StatisticsTreeNode getParent() {
+               return fNodes.getParent(fPath);
+       }
+       /**
+        * <h4>Get the path of the node.</h4>
+        * @return The path of the node.
+        */
+       public FixedArray getPath() {
+               return fPath;
+       }
+       /**
+        * <h4>Get the value of this node.</h4>
+        * @return Value associated with this node.
+        */
+       public Statistics getValue() {
+               return fValue;
+       }
+       /**
+        * <h4>Indicate if the node have children.</h4>
+        * @return True if the node has children.
+        */
+       public boolean hasChildren() {
+               return !fNodes.getChildren(fPath).isEmpty();
+       }
+
+       /**
+        * <h4>Start from creation time i.e. keep key and parent but new statistics and no children.</h4>
+        */
+       public void reset() {
+               fValue = new Statistics();
+               fNodes.reset(fPath);
+       }
+
+       /**
+     * <h4>Set the name of this node.</h4>
+     */
+       public void setName (String name) {
+           fName = name;
+       }
+       /**
+     * <h4>Get the name of this node.</h4>
+     * @return Name associated with this node.
+     */
+       public String getName() {
+           return fName;
+       }
+
+       /**
+     * <h4>Returns node content as string (full path is not included).</h4>
+     * @return Node content as string.
+     */
+    public String getContent() {
+           return fName + ": [nbEvents=" + fValue.nbEvents +  //$NON-NLS-1$
+                           ", cpuTime=" + fValue.cpuTime + //$NON-NLS-1$
+                               ", cumulativeCpuTime=" + fValue.cumulativeCpuTime + //$NON-NLS-1$
+                               ", elapsedTime=" + fValue.elapsedTime + "]"; //$NON-NLS-1$ //$NON-NLS-2$ 
+       }
+
+    /**
+     * <h4>For sorting purposes (sorting by node name).</h4>
+     */
+    @Override
+    public int compareTo(StatisticsTreeNode o) {
+        return fName.compareTo(o.fName);
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsTreeRootFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/StatisticsTreeRootFactory.java
new file mode 100644 (file)
index 0000000..5db2882
--- /dev/null
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.statistics.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class StatisticsTreeRootFactory {
+       
+       // -----------------------------------------------------------------------
+       // Data
+       // -----------------------------------------------------------------------
+
+       private static final Map<String, StatisticsData> fTreeInstances = new HashMap<String, StatisticsData>();
+       
+       // -----------------------------------------------------------------------
+       // Methods
+       // -----------------------------------------------------------------------
+
+       /**
+        * Provide a statisticsTree instance per trace
+        * 
+        * @return
+        */
+       public static StatisticsTreeNode getStatTreeRoot(String traceUniqueId) {
+               return getStatTree(traceUniqueId).getOrCreate(StatisticsData.ROOT);
+       }
+       public static StatisticsData getStatTree(String traceUniqueId) {
+               if(traceUniqueId == null)
+                       return null;
+               
+               StatisticsData tree = fTreeInstances.get(traceUniqueId);
+               if(tree == null) {
+                       tree = new KernelStatisticsData(traceUniqueId); // NOTE
+                       fTreeInstances.put(traceUniqueId, tree);
+               }
+               return tree;
+       }
+       /**
+        * @param traceUniqueId
+        * @return
+        */
+       public static boolean containsTreeRoot(String traceUniqueId) {
+               return fTreeInstances.containsKey(traceUniqueId);
+       }
+
+       /**
+        * Remove previously registered statistics tree.
+        * @param traceUniqueId
+        */
+       public static void removeStatTreeRoot(String traceUniqueId) {
+               if (traceUniqueId != null && fTreeInstances.containsKey(traceUniqueId)) {
+                       fTreeInstances.remove(traceUniqueId);
+               }
+       }
+
+       /**
+        * Remove all tree and root instances
+        */
+       public static void removeAll() {
+               fTreeInstances.clear();
+       }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/statistics/model/messages.properties
new file mode 100644 (file)
index 0000000..7e88de5
--- /dev/null
@@ -0,0 +1,7 @@
+KernelStatisticsData_CPUs=CPUs
+KernelStatisticsData_EventTypes=Event Types
+KernelStatisticsData_Functions=Functions
+KernelStatisticsData_Modes=Modes
+KernelStatisticsData_Processes=Processes
+KernelStatisticsData_SubModes=Submodes
+StatisticsData_UnknowProcess=Unknown process
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/Messages.java
new file mode 100644 (file)
index 0000000..4817246
--- /dev/null
@@ -0,0 +1,18 @@
+package org.eclipse.linuxtools.internal.lttng.ui.views.timeframe;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng.ui.views.timeframe.messages"; //$NON-NLS-1$
+    public static String TimeFrameView_CurrentTime;
+    public static String TimeFrameView_WindowEndTime;
+    public static String TimeFrameView_WindowRange;
+    public static String TimeFrameView_WindowStartTime;
+    static {
+       // initialize resource bundle
+       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/SpinnerGroup.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/SpinnerGroup.java
new file mode 100644 (file)
index 0000000..8f7fce3
--- /dev/null
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.timeframe;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+
+// ========================================================================
+// SpinnerGroup
+// ========================================================================
+
+/**
+ * <b><u>SpinnerGroup</u></b>
+ * <p>
+ * A SpinnerGroup holds two coordinated spinners (for seconds and
+ * nanoseconds) representing the current time within the trace.
+ * <p>
+ * The current time can take any value anything within the time range (start
+ * and end time).
+ */
+public class SpinnerGroup {
+
+    // The nanosecond scale (10^9)
+    private static final int  NS_PER_SECOND = 1000 * 1000 * 1000;
+    private static final byte NS_SCALING_FACTOR = -9;
+
+    // Labels
+    private static final String SECONDS_LABEL = "sec"; //$NON-NLS-1$
+    private static final String NANOSEC_LABEL = "ns"; //$NON-NLS-1$
+
+    // Widgets
+    private Group group;
+    private Spinner seconds;
+    private Spinner nanosec;
+
+    // The valid time range - start time
+    private ITmfTimestamp startTime;
+    private int startSeconds;
+    private int startNanosec;
+
+    // The valid time range - end time
+    private ITmfTimestamp endTime;
+    private int endSeconds;
+    private int endNanosec;
+
+    // The current time value
+    private ITmfTimestamp currentTime;
+    private int currentSeconds;
+    private int currentNanosec;
+    
+    /**
+     * <b><u>Constructor</u></b>
+     * <p>
+     * <li>Creates the display group and formats it for the grid cell
+     * <li>Sets the initial values for Start/End/Current time
+     * </li>
+     * <p>
+     * @param parent    - the parent Composite
+     * @param groupName - the group name
+     * @param range     - the valid time range (start/end time)
+     * @param current   - the current time
+     */
+    public SpinnerGroup(TimeFrameView owner, Composite parent, String groupName, TmfTimeRange range, ITmfTimestamp current) {
+
+        // Create the group
+        group = new Group(parent, SWT.BORDER);
+        group.setText(groupName);
+
+        // Make it use the whole grid cell
+        GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
+        gridData.horizontalAlignment = SWT.FILL;
+        group.setLayoutData(gridData);
+
+        // Create and position the widgets
+        seconds = new Spinner(group, SWT.BORDER);
+        seconds.addModifyListener(new ModifyListener() {
+            @Override
+                       public void modifyText(ModifyEvent e) {
+                currentSeconds = seconds.getSelection();
+                refreshCurrentTime();
+            }
+        });
+        seconds.setBounds(5, 25, 110, 25);
+
+        Label label = new Label(group, SWT.LEFT);
+        label.setText(SECONDS_LABEL);
+        label.setBounds(120, 28, 25, 22);
+
+        nanosec = new Spinner(group, SWT.BORDER);
+        nanosec.addModifyListener(new ModifyListener() {
+            @Override
+                       public void modifyText(ModifyEvent e) {
+                currentNanosec = nanosec.getSelection();
+                // Correct for nanosec underflow
+                if (currentNanosec < 0) {
+                    currentSeconds--;
+                    currentNanosec = NS_PER_SECOND - 1;
+                }
+                // Correct for nanosec overflow
+                if (currentNanosec >= NS_PER_SECOND) {
+                    currentSeconds++;
+                    currentNanosec = 0;
+                }
+                refreshCurrentTime();
+            }
+        });
+        nanosec.setBounds(150, 25, 110, 25);
+
+        label = new Label(group, SWT.LEFT);
+        label.setText(NANOSEC_LABEL);
+        label.setBounds(265, 28, 25, 22);
+
+        setContent(range, current);
+    }
+
+    private void refreshCurrentTime() {
+        long newCurrentTime = ((long) currentSeconds) * NS_PER_SECOND + currentNanosec;
+        TmfTimestamp ts = new TmfTimestamp(newCurrentTime, NS_SCALING_FACTOR, 0);
+        currentTime = ts;
+//        fOwner.synchTimeFrameWidgets(this);
+    }
+
+    // ====================================================================
+    // Get/Set
+    // ====================================================================
+
+    public ITmfTimestamp getStartTime() {
+        return startTime;
+    }
+
+    public ITmfTimestamp getEndTime() {
+        return endTime;
+    }
+
+    public ITmfTimestamp getCurrentTime() {
+        return currentTime;
+    }
+
+    public TmfTimestamp getSpan() {
+        TmfTimestamp span = (TmfTimestamp) startTime.getDelta(endTime);
+        return span;
+    }
+
+    public TmfTimeRange getTimeRange() {
+        TmfTimeRange range = new TmfTimeRange(startTime, endTime);
+        return range;
+    }
+
+    public void setStartTime(ITmfTimestamp ts) {
+       try {
+               startTime = (TmfTimestamp) ts.getDelta(new TmfTimestamp(0, NS_SCALING_FACTOR));
+               startSeconds = (int) (startTime.getValue() / NS_PER_SECOND);
+               startNanosec = (int) (startTime.getValue() % NS_PER_SECOND);
+       }
+       catch (ArithmeticException e) {
+       }
+    }
+
+    public void setEndTime(ITmfTimestamp ts) {
+       try {
+           endTime = (TmfTimestamp) ts.getDelta(new TmfTimestamp(0, NS_SCALING_FACTOR));
+               endSeconds = (int) (endTime.getValue() / NS_PER_SECOND);
+               endNanosec = (int) (endTime.getValue() % NS_PER_SECOND);
+       }
+       catch (ArithmeticException e) {
+       }
+    }
+
+    public void setCurrentTime(ITmfTimestamp ts) {
+       try {
+           currentTime = (TmfTimestamp) ts.getDelta(new TmfTimestamp(0, NS_SCALING_FACTOR));
+               currentSeconds = (int) (currentTime.getValue() / NS_PER_SECOND);
+               currentNanosec = (int) (currentTime.getValue() % NS_PER_SECOND);
+       }
+       catch (ArithmeticException e) {
+       }
+    }
+
+    // ====================================================================
+    // Operators
+    // ====================================================================
+
+    /**
+     * <b><u>setContent</u></b>
+     * <p>
+     * <li>validates that [startTime <= currentTime <= endTime] is respected
+     * <li>sets the start/current/end time and update the spinners
+     * </li>
+     * <p>
+     * 
+     * @param range
+     * @param current
+     */
+    public void setContent(TmfTimeRange range, ITmfTimestamp current) {
+
+       if (range != null) {
+               // Extract the time range
+            ITmfTimestamp start = range.getStartTime();
+            ITmfTimestamp end   = range.getEndTime();
+
+            // Assume start time is OK
+            setStartTime(start);
+
+            // Make sure end time >= start time
+            if (end.compareTo(start, false) < 0) {
+                end = start;
+            }
+            setEndTime(end);
+
+            // Make sure [start time <= current time <= end time]
+            // If not: current = min(max(start, current), end);
+            if (current.compareTo(start, false) < 0) {
+                current = start;
+            }
+            if (current.compareTo(end, false) > 0) {
+                current = end;
+            }
+       }
+        setCurrentTime(current);
+
+        // And configure the spinners
+        updateSpinners();
+    }
+
+    /**
+     * <b><u>setValue</u></b>
+     * <p>
+     * <li>validates that [startTime <= currentTime <= endTime] is respected
+     * <li>sets the current time and the spinners
+     * </li>
+     * <p>
+     * 
+     * @param range
+     * @param current
+     */
+    public void setValue(ITmfTimestamp current) {
+
+        // Make sure [start time <= current time <= end time]
+        // If not: current = min(max(start, current), end);
+        if (current.compareTo(startTime, false) < 0) {
+            current = startTime;
+        }
+        if (current.compareTo(endTime, false) > 0) {
+            current = endTime;
+        }
+        setCurrentTime(current);
+
+        // And configure the spinners
+        updateSpinners();
+    }
+
+    /**
+     * Update the spinners with the new current time value
+     * Perform the update on the UI thread
+     */
+    public void updateSpinners() {
+       // Ignore update if disposed
+       if (seconds.isDisposed()) return;
+       
+        seconds.getDisplay().asyncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               if (!seconds.isDisposed() && !nanosec.isDisposed()) {
+                           // If we are on the start second, ensure that [currentNS >= startNS]
+                           // If the currentSeconds > startSeconds, set startns to -1 so we can
+                           // "underflow"
+                           int startns = -1;
+                           if (currentSeconds <= startSeconds) {
+                               currentSeconds = startSeconds;
+                               startns = startNanosec;
+                               if (currentNanosec < startns) {
+                                   currentNanosec = startns;
+                               }
+                           }
+
+                           // If we are on the end second, ensure that [currentNS <= endNS]
+                           // If the currentSeconds < endSeconds, set endns to MAX so we can
+                           // "overflow"
+                           int endns = NS_PER_SECOND;
+                           if (currentSeconds >= endSeconds) {
+                               currentSeconds = endSeconds;
+                               endns = endNanosec;
+                               if (currentNanosec > endns) {
+                                   currentNanosec = endns;
+                               }
+                           }
+
+                           // Refresh the spinners (value, range, increments, ...)
+                                       // To ensure that the spinners are properly set, the range has to be > 0 
+//                                     seconds.setValues(currentSeconds, startSeconds - 1, endSeconds + 1, 0, 1, 10);
+//                                     nanosec.setValues(currentNanosec, startns - 1, endns + 1, 0, 1, 1000000);
+                                       seconds.setValues(currentSeconds, startSeconds, endSeconds, 0, 1, 10);
+                                       nanosec.setValues(currentNanosec, startns, endns, 0, 100000, 10000000);
+
+                           // If start == end (i.e. no range), disable the spinner
+                           // (if start == end, the spinner widget range is set to [0..100] by default)
+                           seconds.setEnabled(startSeconds != endSeconds);
+                           nanosec.setEnabled(startns != endns);
+                               }
+                       }
+        });
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/TimeFrameView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/TimeFrameView.java
new file mode 100644 (file)
index 0000000..05d6f78
--- /dev/null
@@ -0,0 +1,396 @@
+/*******************************************************************************
+ * Copyright (c) 2009 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng.ui.views.timeframe;
+
+import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
+import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal;
+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.views.TmfView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Slider;
+
+/**
+ * <b><u>TimeFrameView</u></b>
+ * <p>
+ * The TimeFrameView provides a set of spinners to monitor and set the start time, end time, the current time interval
+ * and current time of the trace set at the nanosecond level.
+ * <p>
+ * It ensures that the following relations are always true:
+ * <p>
+ * <li>[ startTime >= start time of the trace ]
+ * <li>[ endTime <= end time of the trace ]
+ * <li>[ startTime <= currentTime <= endTime ]
+ * <li>[ interval == (endTime - startTime) ]</li>
+ * <p>
+ * It provides a slider to rapidly set the current time within the time range (i.e. between startTime and endTime).
+ * <p>
+ * Finally, it allows modification of the time range and the current time. This triggers notifications to the other
+ * LTTng views.
+ * <p>
+ * FIXME: The slider is very jumpy due to the large number of async updates FIXME: Revisit the control flow between
+ * View, Spinners and Slider
+ */
+@Deprecated
+public class TimeFrameView extends TmfView {
+
+    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.timeframe"; //$NON-NLS-1$
+
+    // ------------------------------------------------------------------------
+    // TimeFrameView
+    // ------------------------------------------------------------------------
+
+    // The event log timestamp characteristics
+    private ITmfTimestamp fTraceStartTime = new TmfTimestamp();
+    private ITmfTimestamp fTraceEndTime = new TmfTimestamp();
+
+    private ITmfTimestamp fCurrentTime = new TmfTimestamp();
+
+    private TmfTimeRange fTraceTimeRange = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
+    private TmfTimeRange fTraceSpan = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
+    private int fScale = 0;
+
+    // Labels
+    private static final String START_TIME_LABEL = Messages.TimeFrameView_WindowStartTime;
+    private static final String END_TIME_LABEL = Messages.TimeFrameView_WindowEndTime;
+    private static final String TIME_RANGE_LABEL = Messages.TimeFrameView_WindowRange;
+    private static final String CURRENT_TIME_LABEL = Messages.TimeFrameView_CurrentTime;
+
+    private static final int SLIDER_RANGE = 10000;
+
+    private SpinnerGroup fStartGroup;
+    private SpinnerGroup fEndGroup;
+    private SpinnerGroup fRangeGroup;
+    private SpinnerGroup fCurrentGroup;
+
+    // The slider
+    private Slider fSlider;
+
+    // The current experiment
+    TmfExperiment<LttngEvent> fExperiment = null;
+
+    // notify external listeners may not be needed if the update originated externally
+    private boolean fupdateExternalListeners = true;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     */
+    public TimeFrameView() {
+        super("TimeFrameView"); //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets .Composite)
+     */
+    @Override
+    public void createPartControl(Composite parent) {
+
+        // Set the view layout
+        GridLayout layout = new GridLayout(4, true);
+        parent.setLayout(layout);
+
+        fStartGroup = new SpinnerGroup(this, parent, START_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
+        fEndGroup = new SpinnerGroup(this, parent, END_TIME_LABEL, fTraceTimeRange, fTraceEndTime);
+        fRangeGroup = new SpinnerGroup(this, parent, TIME_RANGE_LABEL, fTraceTimeRange, fTraceEndTime);
+        fCurrentGroup = new SpinnerGroup(this, parent, CURRENT_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
+
+        // Create the slider
+        createSlider(parent);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    @Override
+    public void setFocus() {
+        // TODO Auto-generated method stub
+    }
+
+    // ------------------------------------------------------------------------
+    // Operators
+    // ------------------------------------------------------------------------
+
+    /**
+     * One of the spinners has been updated. Synchronize the other widgets.
+     */
+    public void synchTimeFrameWidgets(SpinnerGroup trigger) {
+        boolean trangeUpdated = false;
+
+        // Collect the data
+        ITmfTimestamp startTime = fStartGroup.getCurrentTime();
+        ITmfTimestamp endTime = fEndGroup.getCurrentTime();
+        ITmfTimestamp timeRange = fRangeGroup.getCurrentTime();
+        ITmfTimestamp currentTime = fCurrentGroup.getCurrentTime();
+
+        // If startTime was set beyond endTime, adjust endTime and interval
+        if (trigger == fStartGroup) {
+            if (startTime.compareTo(endTime, false) > 0) {
+                endTime = startTime;
+                trangeUpdated = true;
+            }
+        }
+
+        // If endTime was set beyond startTime, adjust startTime and interval
+        if (trigger == fEndGroup) {
+            if (endTime.compareTo(startTime, false) < 0) {
+                startTime = endTime;
+                trangeUpdated = true;
+            }
+        }
+
+        // If timeRange was set, adjust endTime
+        if (trigger == fRangeGroup) {
+            long start = startTime.getValue();
+            long span = timeRange.getValue();
+            ITmfTimestamp ts = new TmfTimestamp(start + span, startTime.getScale(), 0);
+            if (ts.compareTo(fTraceEndTime, false) > 0) {
+                ts = fTraceEndTime.clone();
+            }
+            endTime = ts;
+            trangeUpdated = true;
+        }
+
+        // Compute the new time range
+        TmfTimeRange subrange = new TmfTimeRange(startTime, endTime);
+//        int scale = startTime.getScale();
+        ITmfTimestamp interval = (TmfTimestamp) startTime.getDelta(endTime);
+
+        // Update the spinner groups
+        fStartGroup.setContent(fTraceTimeRange, startTime);
+        fEndGroup.setContent(fTraceTimeRange, endTime);
+        fRangeGroup.setContent(fTraceSpan, interval);
+        fCurrentGroup.setContent(subrange, currentTime);
+
+        updateSlider(subrange, currentTime);
+        // Notify other views, only if the update originated from this view
+        if (fupdateExternalListeners) {
+            if (!fCurrentTime.equals(currentTime)) {
+                fCurrentTime = currentTime;
+                broadcast(new TmfTimeSynchSignal(this, currentTime));
+            }
+
+            // Notify the views if the time range has been impacted
+            if (trangeUpdated) {
+                TmfTimeRange trange = new TmfTimeRange(startTime, endTime);
+                broadcast(new TmfRangeSynchSignal(this, trange, currentTime));
+            }
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Slider Handling
+    // ------------------------------------------------------------------------
+
+    /**
+     * @param parent
+     */
+    private void createSlider(Composite parent) {
+        fSlider = new Slider(parent, SWT.SMOOTH | SWT.FILL);
+        fSlider.setMinimum(0);
+        fSlider.setMaximum(SLIDER_RANGE + fSlider.getThumb());
+        fSlider.setIncrement(SLIDER_RANGE / 100);
+        fSlider.setPageIncrement(SLIDER_RANGE / 10);
+        fSlider.setSelection(0);
+
+        GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
+        gridData.horizontalAlignment = SWT.FILL;
+        gridData.horizontalSpan = 4;
+        fSlider.setLayoutData(gridData);
+
+        fSlider.addListener(SWT.Selection, new Listener() {
+            @Override
+            public void handleEvent(Event event) {
+                int ratio = fSlider.getSelection();
+                ITmfTimestamp span = fCurrentGroup.getSpan();
+                long value = span.getValue() * ratio / SLIDER_RANGE;
+                ITmfTimestamp start = fCurrentGroup.getStartTime();
+                ITmfTimestamp current = new TmfTimestamp(start.getValue() + value, start.getScale(), 0);
+                fCurrentGroup.setValue(current);
+            }
+        });
+
+    }
+
+    /**
+     * @param range
+     * @param timestamp
+     */
+    private void updateSlider(TmfTimeRange range, ITmfTimestamp timestamp) {
+
+        // Ignore update if disposed
+        if (fSlider.isDisposed())
+            return;
+
+        // Determine the new relative position
+//        int scale = range.getEndTime().getScale();
+        long total = range.getStartTime().getDelta(range.getEndTime()).getValue();
+        long relative = range.getStartTime().getDelta(timestamp).getValue();
+
+        // Set the slider value
+        final long position = (total > 0) ? (relative * SLIDER_RANGE / total) : 0;
+
+        // Update the slider on the UI thread
+        long current = fSlider.getSelection();
+        if (position != current) {
+            fSlider.getDisplay().asyncExec(new Runnable() {
+                @Override
+                public void run() {
+                    fSlider.setSelection((int) position);
+                }
+            });
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    @SuppressWarnings("nls")
+    public String toString() {
+        return "[TimeFrameView]";
+    }
+
+    // ------------------------------------------------------------------------
+    // Signal Handling
+    // ------------------------------------------------------------------------
+
+    /**
+     * @param signal
+     */
+    @SuppressWarnings("unchecked")
+    @TmfSignalHandler
+    public void experimentSelected(TmfExperimentSelectedSignal<LttngEvent> signal) {
+
+        // Update the trace reference
+        fExperiment = (TmfExperiment<LttngEvent>) signal.getExperiment();
+
+        // Update the time frame
+        fTraceTimeRange = fExperiment.getTimeRange();
+        fTraceStartTime = fTraceTimeRange.getStartTime();
+        fTraceEndTime = fTraceTimeRange.getEndTime();
+        fScale = fTraceStartTime.getScale();
+
+        // Update the widgets
+        fStartGroup.setContent(fTraceTimeRange, fTraceStartTime);
+        fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
+        fCurrentGroup.setContent(fTraceTimeRange, fTraceStartTime);
+
+        fCurrentTime = fTraceStartTime;
+
+        ITmfTimestamp delta = fTraceStartTime.getDelta(fTraceEndTime);
+        fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
+        // fRangeGroup.setContent(fTraceSpan, delta);
+        ITmfTimestamp start = new TmfTimestamp(1, (byte) -1, 0);
+        fRangeGroup.setContent(fTraceSpan, start);
+    }
+
+    /**
+     * @param signal
+     */
+    @TmfSignalHandler
+    public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
+        if (signal.getExperiment() != fExperiment) {
+            return;
+        }
+
+        // Update the time frame
+        // fTraceTimeRange = signal.getTrace().getTimeRange();
+        fTraceTimeRange = signal.getExperiment().getTimeRange();
+        fTraceStartTime = fTraceTimeRange.getStartTime();
+        fTraceEndTime = fTraceTimeRange.getEndTime();
+        fScale = fTraceStartTime.getScale();
+
+        // Update the widgets
+        fStartGroup.setContent(fTraceTimeRange, fStartGroup.getCurrentTime());
+        fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
+        fCurrentGroup.setContent(fTraceTimeRange, fCurrentGroup.getCurrentTime());
+
+        ITmfTimestamp delta = fTraceStartTime.getDelta(fTraceEndTime);
+        fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
+        fRangeGroup.setContent(fTraceSpan, delta);
+    }
+
+    /**
+     * @param signal
+     */
+    @TmfSignalHandler
+    public void currentTimeRangeUpdated(TmfRangeSynchSignal signal) {
+        if (signal.getSource() != this) {
+            // Update the time frame
+            TmfTimeRange selTimeRange = signal.getCurrentRange();
+            ITmfTimestamp selStart = selTimeRange.getStartTime().normalize(0, fScale);
+            ITmfTimestamp selEnd   = selTimeRange.getEndTime().normalize(0, fScale);
+
+            fupdateExternalListeners = false;
+            // Update the widgets and prevent broadcast notifications to
+            // the views which have been notified already.
+            {
+                fStartGroup.setContent(fTraceTimeRange, selStart);
+                fEndGroup.setContent(fTraceTimeRange, selEnd);
+
+                ITmfTimestamp delta = selStart.getDelta(selEnd);
+
+                fRangeGroup.setContent(fTraceSpan, delta);
+            }
+
+            // restore the external notification flag
+            fupdateExternalListeners = true;
+
+        }
+    }
+
+    /**
+     * @param signal
+     */
+    @TmfSignalHandler
+    public void currentTimeUpdated(TmfTimeSynchSignal signal) {
+        if (signal.getSource() != this) {
+            // prevent loop to external notifications
+            fupdateExternalListeners = false;
+            fCurrentTime = signal.getCurrentTime().normalize(0, fStartGroup.getCurrentTime().getScale());
+            if (fStartGroup.getCurrentTime().compareTo(fCurrentTime, false) > 0) {
+                fStartGroup.setContent(new TmfTimeRange(fCurrentTime, fEndGroup.getCurrentTime()), fCurrentTime);
+            }
+            if (fEndGroup.getCurrentTime().compareTo(fCurrentTime, false) < 0) {
+                fEndGroup.setContent(new TmfTimeRange(fStartGroup.getCurrentTime(), fCurrentTime), fCurrentTime);
+            }
+            fCurrentGroup.setContent(null, fCurrentTime);
+            updateSlider(fCurrentGroup.getTimeRange(), fCurrentTime);
+
+            // Enable external notifications
+            fupdateExternalListeners = true;
+        }
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/internal/lttng/ui/views/timeframe/messages.properties
new file mode 100644 (file)
index 0000000..c070425
--- /dev/null
@@ -0,0 +1,4 @@
+TimeFrameView_CurrentTime=Current Time
+TimeFrameView_WindowEndTime=Window End Time
+TimeFrameView_WindowRange=Window Range
+TimeFrameView_WindowStartTime=Window Start Time
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/Activator.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/Activator.java
new file mode 100644 (file)
index 0000000..b3d5974
--- /dev/null
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *   Bernd Hufmann - Updated for LTTng trace control
+ *   
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng.ui;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
+import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
+import org.eclipse.linuxtools.internal.lttng.ui.TraceDebug;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.Messages;
+import org.eclipse.linuxtools.internal.lttng.ui.tracecontrol.model.TraceAdapterFactory;
+import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends SystemBasePlugin {
+
+       // The plug-in ID
+       public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng.ui"; //$NON-NLS-1$
+
+    // Icon names
+    public static final String ICON_ID_PROVIDER = "ICON_ID_PROVIDER"; //$NON-NLS-1$
+    public static final String ICON_ID_TARGET = "ICON_ID_TARGET"; //$NON-NLS-1$
+    public static final String ICON_ID_TRACE = "ICON_ID_TRACE"; //$NON-NLS-1$
+    public static final String ICON_ID_NEW_TRACE = "ICON_ID_NEW_TRACE"; //$NON-NLS-1$
+    public static final String ICON_ID_CONFIG_MARKERS = "ICON_ID_CONFIG_MARKERS"; //$NON-NLS-1$
+    public static final String ICON_ID_CONFIG_TRACE = "ICON_ID_CONFIG_TRACE"; //$NON-NLS-1$
+    public static final String ICON_ID_CHECKED = "ICON_ID_CHECKED"; //$NON-NLS-1$
+    public static final String ICON_ID_UNCHECKED = "ICON_ID_UNCHECKED"; //$NON-NLS-1$
+    public static final String ICON_ID_IMPORT_TRACE = "ICON_ID_IMPORT_TRACE"; //$NON-NLS-1$
+    public static final String ICON_ID_EDIT = "ICON_ID_EDIT"; //$NON-NLS-1$
+       
+       // The shared instance
+       private static Activator plugin;
+       
+       /**
+        * The constructor
+        */
+       public Activator() {
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+        */
+       @Override
+       public void start(BundleContext context) throws Exception {
+               super.start(context);
+               TraceDebug.init();
+               
+        // Trace control initialization
+        IAdapterManager manager = Platform.getAdapterManager();
+        TraceAdapterFactory factory = new TraceAdapterFactory();
+        manager.registerAdapters(factory, ProviderResource.class);
+        manager.registerAdapters(factory, TargetResource.class);
+        manager.registerAdapters(factory, TraceResource.class);
+        
+        // Assign shared instance
+               plugin = this;
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+        */
+       @Override
+       public void stop(BundleContext context) throws Exception {
+               TraceDebug.stop();
+               plugin = null;
+               super.stop(context);
+       }
+
+       /**
+        * Returns the shared instance
+        *
+        * @return the shared instance
+        */
+       public static Activator getDefault() {
+               return plugin;
+       }
+    
+    /**
+     * Create a System Message for given throwable
+     * 
+     * @param x - The throwable the message is for
+     * @return
+     */
+    public SystemMessage getMessage(Throwable x) {
+        String msg = x.getMessage();
+        if (msg == null) {
+            msg = ""; //$NON-NLS-1$
+        }
+        if ((x instanceof ExecutionException) && (((ExecutionException)x).getCause() != null)) {
+            msg += " (" + ((ExecutionException)x).getCause().getMessage() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+        if (x instanceof TimeoutException) {
+            msg += " (" + Messages.Ltt_TimeoutMsg + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+        return new SimpleSystemMessage(PLUGIN_ID, SystemMessage.ERROR, msg, x);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.rse.ui.SystemBasePlugin#initializeImageRegistry()
+     */
+    @Override
+    protected void initializeImageRegistry() {
+        String path = getIconPath();
+        putImageInRegistry(ICON_ID_PROVIDER, path + "obj16/providers.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_TARGET, path + "obj16/targets.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_TRACE, path + "obj16/trace.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_NEW_TRACE, path + "elcl16/new_trace.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_CONFIG_MARKERS, path + "elcl16/configure_markers.gif"); //$NON-NLS-1$ 
+        putImageInRegistry(ICON_ID_CONFIG_TRACE, path + "elcl16/configure_trace.gif"); //$NON-NLS-1$ 
+        putImageInRegistry(ICON_ID_CHECKED, path + "elcl16/checked.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_UNCHECKED, path + "elcl16/unchecked.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_IMPORT_TRACE, path + "elcl16/import_trace.gif"); //$NON-NLS-1$
+        putImageInRegistry(ICON_ID_EDIT, path + "elcl16/edit.gif"); //$NON-NLS-1$
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUILogger.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUILogger.java
deleted file mode 100644 (file)
index e6e163f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui;
-
-/**
- * <b><u>LTTngUILogger</u></b>
- * <p>
- * A logging utility 
- */
-public class LTTngUILogger {
-
-       public static void logInfo(String message) {
-               LTTngUiPlugin.getDefault().getLogger().logInfo(message);
-       }
-
-       public static void logWarning(String message) {
-               LTTngUiPlugin.getDefault().getLogger().logWarning(message);
-       }
-
-       public static void logError(Throwable exception) {
-               logError("Unexpected exception", exception); //$NON-NLS-1$
-       }
-
-       public static void logError(String message, Throwable exception) {
-               LTTngUiPlugin.getDefault().getLogger().logError(message, exception);
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java
deleted file mode 100644 (file)
index 4fdbf75..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *   Bernd Hufmann - Updated for LTTng trace control
- *   
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
-
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.model.TraceAdapterFactory;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class LTTngUiPlugin extends SystemBasePlugin {
-
-       // The plug-in ID
-       public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng.ui"; //$NON-NLS-1$
-
-    // Icon names
-    public static final String ICON_ID_PROVIDER = "ICON_ID_PROVIDER"; //$NON-NLS-1$
-    public static final String ICON_ID_TARGET = "ICON_ID_TARGET"; //$NON-NLS-1$
-    public static final String ICON_ID_TRACE = "ICON_ID_TRACE"; //$NON-NLS-1$
-    public static final String ICON_ID_NEW_TRACE = "ICON_ID_NEW_TRACE"; //$NON-NLS-1$
-    public static final String ICON_ID_CONFIG_MARKERS = "ICON_ID_CONFIG_MARKERS"; //$NON-NLS-1$
-    public static final String ICON_ID_CONFIG_TRACE = "ICON_ID_CONFIG_TRACE"; //$NON-NLS-1$
-    public static final String ICON_ID_CHECKED = "ICON_ID_CHECKED"; //$NON-NLS-1$
-    public static final String ICON_ID_UNCHECKED = "ICON_ID_UNCHECKED"; //$NON-NLS-1$
-    public static final String ICON_ID_IMPORT_TRACE = "ICON_ID_IMPORT_TRACE"; //$NON-NLS-1$
-    public static final String ICON_ID_EDIT = "ICON_ID_EDIT"; //$NON-NLS-1$
-       
-       // The shared instance
-       private static LTTngUiPlugin plugin;
-       
-       /**
-        * The constructor
-        */
-       public LTTngUiPlugin() {
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-        */
-       @Override
-       public void start(BundleContext context) throws Exception {
-               super.start(context);
-               TraceDebug.init();
-               
-        // Trace control initialization
-        IAdapterManager manager = Platform.getAdapterManager();
-        TraceAdapterFactory factory = new TraceAdapterFactory();
-        manager.registerAdapters(factory, ProviderResource.class);
-        manager.registerAdapters(factory, TargetResource.class);
-        manager.registerAdapters(factory, TraceResource.class);
-        
-        // Assign shared instance
-               plugin = this;
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-        */
-       @Override
-       public void stop(BundleContext context) throws Exception {
-               TraceDebug.stop();
-               plugin = null;
-               super.stop(context);
-       }
-
-       /**
-        * Returns the shared instance
-        *
-        * @return the shared instance
-        */
-       public static LTTngUiPlugin getDefault() {
-               return plugin;
-       }
-    
-    /**
-     * Create a System Message for given throwable
-     * 
-     * @param x - The throwable the message is for
-     * @return
-     */
-    public SystemMessage getMessage(Throwable x) {
-        String msg = x.getMessage();
-        if (msg == null) {
-            msg = ""; //$NON-NLS-1$
-        }
-        if ((x instanceof ExecutionException) && (((ExecutionException)x).getCause() != null)) {
-            msg += " (" + ((ExecutionException)x).getCause().getMessage() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
-        }
-        if (x instanceof TimeoutException) {
-            msg += " (" + Messages.Ltt_TimeoutMsg + ")"; //$NON-NLS-1$ //$NON-NLS-2$
-        }
-        return new SimpleSystemMessage(PLUGIN_ID, SystemMessage.ERROR, msg, x);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.SystemBasePlugin#initializeImageRegistry()
-     */
-    @Override
-    protected void initializeImageRegistry() {
-        String path = getIconPath();
-        putImageInRegistry(ICON_ID_PROVIDER, path + "obj16/providers.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_TARGET, path + "obj16/targets.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_TRACE, path + "obj16/trace.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_NEW_TRACE, path + "elcl16/new_trace.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_CONFIG_MARKERS, path + "elcl16/configure_markers.gif"); //$NON-NLS-1$ 
-        putImageInRegistry(ICON_ID_CONFIG_TRACE, path + "elcl16/configure_trace.gif"); //$NON-NLS-1$ 
-        putImageInRegistry(ICON_ID_CHECKED, path + "elcl16/checked.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_UNCHECKED, path + "elcl16/unchecked.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_IMPORT_TRACE, path + "elcl16/import_trace.gif"); //$NON-NLS-1$
-        putImageInRegistry(ICON_ID_EDIT, path + "elcl16/edit.gif"); //$NON-NLS-1$
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java
deleted file mode 100644 (file)
index 9cefc4b..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui;\r
-\r
-\r
-import java.io.FileWriter;\r
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Date;\r
-\r
-import org.eclipse.core.runtime.ILog;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Platform;\r
-import org.eclipse.core.runtime.Plugin;\r
-import org.eclipse.core.runtime.Status;\r
-\r
-@SuppressWarnings("nls")\r
-public class TraceDebug {\r
-    static boolean DEBUG = false;\r
-    static boolean INFO = false;\r
-    static boolean WARN = false;\r
-\r
-    static boolean CFV = false;\r
-    static boolean RV = false;\r
-    static boolean SV = false;\r
-\r
-    private static Plugin plugin = LTTngUiPlugin.getDefault();\r
-    private static String pluginID = LTTngUiPlugin.PLUGIN_ID;\r
-    private static SimpleDateFormat stimeformat = new SimpleDateFormat("HH:mm:ss:SSS");\r
-\r
-    // Note: files are created in $HOME\r
-    static private PrintWriter fCFVfile = null;\r
-    static private PrintWriter fRVfile = null;\r
-    static private PrintWriter fSVfile = null;\r
-\r
-    public static void init() {\r
-        // Update Trace configuration options\r
-        String debugTrace = Platform.getDebugOption(pluginID + "/debug");\r
-        String infoTrace = Platform.getDebugOption(pluginID + "/info");\r
-        String warnTrace = Platform.getDebugOption(pluginID + "/warn");\r
-\r
-        if (debugTrace != null) {\r
-            DEBUG = Boolean.valueOf(debugTrace);\r
-        }\r
-\r
-        if (infoTrace != null) {\r
-            INFO = Boolean.valueOf(infoTrace);\r
-        }\r
-\r
-        if (warnTrace != null) {\r
-            WARN = Boolean.valueOf(warnTrace);\r
-        }\r
-\r
-        String cfvTrace = Platform.getDebugOption(pluginID + "/cfv");\r
-        if (cfvTrace != null) {\r
-            CFV = Boolean.valueOf(cfvTrace);\r
-            if (CFV) {\r
-                try {\r
-                    fCFVfile = new PrintWriter(new FileWriter("CFVTrace.txt"));\r
-                } catch (IOException e) {\r
-                    e.printStackTrace();\r
-                }\r
-            }\r
-        }\r
-\r
-        String rvTrace = Platform.getDebugOption(pluginID + "/rv");\r
-        if (rvTrace != null) {\r
-            RV = Boolean.valueOf(rvTrace);\r
-            if (RV) {\r
-                try {\r
-                    fRVfile = new PrintWriter(new FileWriter("RVTrace.txt"));\r
-                } catch (IOException e) {\r
-                    e.printStackTrace();\r
-                }\r
-            }\r
-        }\r
-\r
-        String svTrace = Platform.getDebugOption(pluginID + "/sv");\r
-        if (svTrace != null) {\r
-            SV = Boolean.valueOf(svTrace);\r
-            if (SV) {\r
-                try {\r
-                    fSVfile = new PrintWriter(new FileWriter("SVTrace.txt"));\r
-                } catch (IOException e) {\r
-                    e.printStackTrace();\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    public static void stop() {\r
-        if (fCFVfile != null) {\r
-            fCFVfile.close();\r
-            fCFVfile = null;\r
-        }\r
-\r
-        if (fRVfile != null) {\r
-            fRVfile.close();\r
-            fRVfile = null;\r
-        }\r
-\r
-        if (fSVfile != null) {\r
-            fSVfile.close();\r
-            fSVfile = null;\r
-        }\r
-    }\r
-\r
-    public static void traceCFV(String trace) {\r
-        if (CFV && fCFVfile != null) {\r
-            fCFVfile.println(trace);\r
-            fCFVfile.flush();\r
-        }\r
-    }\r
-\r
-    public static void traceRV(String trace) {\r
-        if (RV && fRVfile != null) {\r
-            fRVfile.println(trace);\r
-            fRVfile.flush();\r
-        }\r
-    }\r
-\r
-    public static void traceSV(String trace) {\r
-        if (SV && fSVfile != null) {\r
-            fSVfile.println(trace);\r
-            fSVfile.flush();\r
-        }\r
-    }\r
-\r
-    public static void info(String message) {\r
-        if (INFO) {\r
-            ILog logger = plugin.getLog();\r
-            logger.log(new Status(IStatus.INFO, LTTngUiPlugin.PLUGIN_ID, IStatus.OK, message, null));\r
-        }\r
-    }\r
-\r
-    public static void warn(String message) {\r
-        if (WARN) {\r
-            ILog logger = plugin.getLog();\r
-            logger.log(new Status(IStatus.WARNING, LTTngUiPlugin.PLUGIN_ID, IStatus.WARNING, message, null));\r
-        }\r
-    }\r
-\r
-    public static void debug(String message) {\r
-        if (DEBUG) {\r
-            String location = getCallingLocation();\r
-            System.out.println(location + "\n\t-> " + message);\r
-\r
-        }\r
-    }\r
-\r
-    public static void debug(String message, int additionalStackLines) {\r
-        if (DEBUG) {\r
-            String location = getCallingLocation(additionalStackLines);\r
-            System.out.println(location + "\n\t-> " + message);\r
-        }\r
-    }\r
-\r
-    public static void throwException(String message) {\r
-        if (DEBUG) {\r
-            try {\r
-                triggerException(message);\r
-            } catch (Exception e) {\r
-                e.printStackTrace();\r
-            }\r
-        }\r
-    }\r
-\r
-    private static void triggerException(String message) throws Exception {\r
-        throw new Exception(message);\r
-    }\r
-\r
-    private static String getCallingLocation() {\r
-        StringBuilder sb = new StringBuilder();\r
-        sb.append(trace(Thread.currentThread().getStackTrace(), 4));\r
-        sb.append("\n" + trace(Thread.currentThread().getStackTrace(), 3));\r
-        return sb.toString();\r
-    }\r
-\r
-    private static String getCallingLocation(int numOfStackLines) {\r
-        int stackCalledFromIdx = 3;\r
-        int earliestRequested = numOfStackLines > 0 ? stackCalledFromIdx + numOfStackLines : stackCalledFromIdx;\r
-        StringBuilder sb = new StringBuilder();\r
-        for (int i = earliestRequested; i >= stackCalledFromIdx; i--) {\r
-            sb.append(trace(Thread.currentThread().getStackTrace(), i) + "\n");\r
-        }\r
-        return sb.toString();\r
-    }\r
-\r
-    private static String trace(StackTraceElement e[], int level) {\r
-        if (e != null) {\r
-            level = level >= e.length ? e.length - 1 : level;\r
-            StackTraceElement s = e[level];\r
-            if (s != null) {\r
-                String simpleClassName = s.getClassName();\r
-                String[] clsNameSegs = simpleClassName.split("\\.");\r
-                if (clsNameSegs.length > 0)\r
-                    simpleClassName = clsNameSegs[clsNameSegs.length - 1];\r
-                return stimeformat.format(new Date()) + " " + simpleClassName + "." + s.getLineNumber() + "." + s.getMethodName();\r
-            }\r
-        }\r
-\r
-        return null;\r
-    }\r
-\r
-    public static boolean isDEBUG() {\r
-        return DEBUG;\r
-    }\r
-\r
-    public static boolean isINFO() {\r
-        return INFO;\r
-    }\r
-\r
-    public static boolean isWARN() {\r
-        return WARN;\r
-    }\r
-\r
-    public static boolean isCFV() {\r
-        return CFV;\r
-    }\r
-\r
-    public static boolean isRV() {\r
-        return RV;\r
-    }\r
-\r
-    public static boolean isSV() {\r
-        return SV;\r
-    }\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/ITimeRangeComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/ITimeRangeComponent.java
deleted file mode 100644 (file)
index 9cb42a5..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.model.trange;
-
-/**
- * The common component of the Composite related to time-range events its
- * components or containers
- * 
- * @author alvaro
- * 
- */
-public interface ITimeRangeComponent {
-
-       public long getStartTime();
-
-       public void setStartTime(long startTime);
-
-       public long getStopTime();
-
-       public void setStopTime(long endTime);
-
-       public ITimeRangeComponent getEventParent();
-
-       public String getName();
-
-       /**
-        * Flag to indicate if this Time Range is visible within the GUI, May not be
-        * visible if the duration can not be represented in one pixel
-        * 
-        * @return true if visible i.e. represented at least in one pixel
-        */
-       public boolean isVisible();
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/ItemContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/ItemContainer.java
deleted file mode 100644 (file)
index 89298be..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.model.trange;
-
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-
-public interface ItemContainer<T extends ITmfTimeAnalysisEntry> {
-
-       /**
-        * Interface to add resources.
-        * 
-        * @param process
-        */
-       public abstract void addItem(T newItem);
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /**
-        * Request a unique ID
-        * 
-        * @return Integer
-        */
-       public abstract Integer getUniqueId();
-
-       /**
-        * This method is intended for read only purposes in order to keep the
-        * internal data structure in Synch
-        * 
-        * @return
-        */
-       public abstract T[] readItems();
-
-       /**
-        * Clear the children information for resources related to a specific trace
-        * e.g. just before refreshing data with a new time range
-        * 
-        * @param traceId
-        */
-       public abstract void clearChildren();
-
-       /**
-        * Clear all resources items e.g. when a new experiment is selected
-        */
-       public abstract void clearItems();
-
-       /**
-        * Remove the resources related to a specific trace e.g. during trace
-        * removal
-        * 
-        * @param traceId
-        */
-       public abstract void removeItems(String traceId);
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/Messages.java
deleted file mode 100644 (file)
index 2269cd5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.model.trange;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.model.trange.messages"; //$NON-NLS-1$
-    public static String TimeRangeViewerProvider_BadRangeExtraInfo;
-    public static String TimeRangeViewerProvider_EndTime;
-    public static String TimeRangeViewerProvider_ProcessType;
-    public static String TimeRangeViewerProvider_StartTime;
-    public static String TimeRangeViewerProvider_UndefinedEndTime;
-    public static String TimeRangeViewerProvider_UndefinedStartTime;
-    static {
-       // initialize resource bundle
-       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java
deleted file mode 100644 (file)
index 64c51df..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.model.trange;
-
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-
-
-/**
- * @author alvaro
- * 
- */
-public abstract class TimeRangeComponent implements ITimeRangeComponent, ITimeEvent {
-
-       // ========================================================================
-       // Data
-       // =======================================================================
-       protected Long startTime = 0L;
-       protected Long stopTime = Long.MAX_VALUE;
-       protected TimeRangeComposite eventParent = null;
-       private boolean visible = true;
-       
-
-
-       // ========================================================================
-       // Constructor
-       // =======================================================================
-       public TimeRangeComponent(Long stime, Long etime,
-                       TimeRangeComposite eventParent) {
-               this.startTime = stime;
-               this.stopTime = etime;
-               this.eventParent = eventParent;
-       }
-
-       // ========================================================================
-       // Methods
-       // =======================================================================
-       /**
-        * This method shall not be used to estimate the starting drawing point of
-        * the time range-event. see interface method getTime(). However this method
-        * can be used to retrieve the tool tip information where we need to reflect
-        * that the actual start of this event is unknown
-        * 
-        * @param time
-        */
-       @Override
-       public long getStartTime() {
-               return startTime.longValue();
-       }
-
-       @Override
-       public void setStartTime(long time) {
-               if (time > -1) {
-                       startTime = time;
-               }
-       }
-
-       @Override
-       public long getStopTime() {
-               return stopTime.longValue();
-       }
-
-       @Override
-       public void setStopTime(long stopTime) {
-               if (stopTime > -1) {
-                       this.stopTime = stopTime;
-               }
-       }
-
-       @Override
-       public ITimeRangeComponent getEventParent() {
-               return eventParent;
-       }
-
-       public void setEventParent(TimeRangeComposite eventParent) {
-               this.eventParent = eventParent;
-       }
-
-       @Override
-       public abstract String getName();
-
-       
-       public void setVisible(boolean visible) {
-               this.visible = visible;
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.model.trange.ITimeRangeComponent#isVisible()
-        */
-       @Override
-       public boolean isVisible() {
-               return visible;
-       }
-
-       @Override
-       public ITmfTimeAnalysisEntry getEntry() {
-               return eventParent;
-       }
-
-       @Override
-       public long getTime() {
-               return startTime;
-       }
-
-       @Override
-       public long getDuration() {
-               return stopTime - startTime;
-       }
-
-    @Override
-    @SuppressWarnings("nls")
-    public String toString() {
-               return "[TimeRangeComponent:" + "startTime=" + startTime + ",stopTime=" + stopTime +
-               ",parent=" + (eventParent != null ? eventParent.id : "null") + "]";
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java
deleted file mode 100644 (file)
index 66dbd87..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.model.trange;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-
-public class TimeRangeComposite extends TimeRangeComponent implements
-ITmfTimeAnalysisEntry {
-
-       // ========================================================================
-       // Data
-       // =======================================================================
-       /**
-        * Type of Composites or Containers
-        * <p>
-        * PROPERTY: Refers to a sub-composite of a RESOURCE or a PROCESS e.g the
-        * cpu which can vary over time and can have time range events associated to
-        * it, and at the same time PROPERTY is associated to a Composite parent
-        * like a PROCESS
-        * </p>
-        * <p>
-        * PROCESS: A composite of time range events representing a Process
-        * </p>
-        * <p>
-        * RESOURCE: A composite of time range events representing a resource i.g.
-        * irq, softIrq, trap, bdev, cpu
-        * </p>
-        * 
-        * @author alvaro
-        * 
-        */
-       public static enum CompositeType {
-               UNKNOWN, PROPERTY, PROCESS, RESOURCE
-       }
-
-       protected final Vector<TimeRangeComponent> ChildEventLeafs = new Vector<TimeRangeComponent>();
-       protected final Vector<TimeRangeComponent> ChildEventComposites = new Vector<TimeRangeComponent>();
-       protected Integer id = 0;
-       protected String name;
-       protected String groupName = ""; //$NON-NLS-1$
-       protected String className = ""; //$NON-NLS-1$
-       protected CompositeType contType = CompositeType.UNKNOWN;
-       protected Long next_good_time = -1L;
-       /*Time of first event which trigger the creation of this local resource */
-       protected Long insertionTime = -1L; 
-
-       // ========================================================================
-       // Constructors
-       // =======================================================================
-       public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
-                       CompositeType type, long insertionTime) {
-               super(stime, etime, null);
-               this.id = id;
-               this.name = name;
-               contType = type;
-               this.insertionTime = insertionTime;
-               // Adjust the first good drawing position to the event time creating this resource
-               next_good_time = insertionTime;
-       }
-
-       public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
-                       String groupName, String className, CompositeType type,
-                       long insertionTime) {
-               this(id, stime, etime, name, type, insertionTime);
-               this.groupName = groupName;
-               this.className = className;
-    }
-       
-       // ========================================================================
-       // Methods
-       // =======================================================================
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent#getName()
-        */
-       @Override
-       public String getName() {
-               return name;
-       }
-
-       /**
-        * @param name
-        */
-       public void setName(String name) {
-               this.name = name;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry#getGroupName()
-        */
-       @Override
-       public String getGroupName() {
-               return groupName;
-       }
-
-       /**
-        * @param groupName
-        */
-       public void setGroupName(String groupName) {
-               this.groupName = groupName;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry#getId()
-        */
-       @Override
-       public int getId() {
-               return id;
-       }
-
-       /**
-        * @param id
-        */
-       public void setId(int id) {
-               this.id = id;
-       }
-
-       /**
-        * @return
-        */
-       public String getClassName() {
-               return className;
-       }
-
-       /**
-        * @param className
-        */
-       public void setClassName(String className) {
-               this.className = className;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry#getTraceEvents()
-        */
-       @Override
-       @SuppressWarnings("unchecked")
-       @Deprecated public Vector<TimeRangeComponent> getTraceEvents() {
-               return ChildEventLeafs;
-       }
-
-       @Override
-       @SuppressWarnings("unchecked")
-       public Iterator<TimeRangeComponent> getTraceEventsIterator() {
-               Vector<TimeRangeComponent> clone = (Vector<TimeRangeComponent>) ChildEventLeafs.clone();
-               return clone.iterator();
-       }
-
-       @Override
-       @SuppressWarnings("unchecked")
-       public Iterator<TimeRangeComponent> getTraceEventsIterator(long startTime, long stopTime, long visibleDuration) {
-               return getTraceEventsIterator();
-       }
-
-       @Override
-       public void addTraceEvent(ITimeEvent event) {
-               if (event instanceof TimeRangeComponent) {
-                       ChildEventLeafs.add((TimeRangeComponent) event);
-               }
-       }
-
-    /**
-        * @return
-        */
-       public Vector<TimeRangeComponent> getChildEventComposites() {
-               return ChildEventComposites;
-       }
-
-       /**
-        * Represents the time where the next time range can start the drawing i.e.
-        * right after previous time range.
-        * 
-        * @return
-        */
-       public long getNext_good_time() {
-               return next_good_time;
-       }
-
-       /**
-        * Represents the time where the next time range can start the drawing i.e.
-        * right after previous time range.
-        * 
-        * @param nextGoodTime
-        */
-       public void setNext_good_time(long nextGoodTime) {
-               next_good_time = nextGoodTime;
-       }
-
-       /**
-        * Reset this resource to the construction state
-        */
-       public void reset() {
-               getChildEventComposites().clear();
-               getTraceEvents().clear();
-               next_good_time = insertionTime;
-       }
-
-       /**
-        * Event Time reflecting the creation of this local resource e.g. at Reception of Fork, etc.
-        * 
-        * @return
-        */
-       public long getInsertionTime() {
-               return insertionTime;
-       }
-
-    @Override
-    @SuppressWarnings("nls")
-    public String toString() {
-               return "[TimeRangeComposite:" + super.toString() +
-               ",id=" + id + ",name=" + name + ",group=" + groupName + ",class=" + className +
-               ",ctype=" + contType + ",itime=" + insertionTime + 
-               ",leaves=" + ChildEventLeafs + ",composites=" + ChildEventComposites + "]";
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEvent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEvent.java
deleted file mode 100644 (file)
index c8b466b..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.lttng.ui.model.trange;\r
-\r
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
-\r
-/**\r
- * @author alvaro\r
- * \r
- */\r
-public class TimeRangeEvent extends TimeRangeComponent implements ITimeEvent {\r
-       // =======================================================================\r
-       // Data\r
-       // =======================================================================\r
-       TimeRangeComposite parent = null;\r
-\r
-       public static enum Type {\r
-               UNKNOWN, PROPERTY, PROCESS_MODE, BDEV_MODE, TRAP_MODE, SOFT_IRQ_MODE, IRQ_MODE, CPU_MODE\r
-       }\r
-\r
-       protected Type eventType = Type.UNKNOWN;\r
-       protected String stateMode = ""; //$NON-NLS-1$\r
-\r
-       // =======================================================================\r
-       // Constructors\r
-       // =======================================================================\r
-       /**\r
-        * @param stime\r
-        *            Event Start Time (may be unknown)\r
-        * @param etime\r
-        *            Event EndTime (may be unknown)\r
-        * @param eventParent\r
-        * @param type\r
-        * @param duration\r
-        */\r
-       public TimeRangeEvent(Long stime, Long etime,\r
-                       TimeRangeComposite eventParent, Type type, String stateMode) {\r
-               super(stime, etime, eventParent);\r
-               parent = eventParent;\r
-               this.eventType = type;\r
-               this.stateMode = stateMode;\r
-       }\r
-\r
-       // =======================================================================\r
-       // Methods\r
-       // =======================================================================\r
-       \r
-       // @Override\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see\r
-        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getTime\r
-        * ()\r
-        */\r
-       @Override\r
-       public long getTime() {\r
-               // The value provided by this method is used to start drawing the\r
-               // time-range,\r
-               // so a null value shall not be provided.\r
-               // If the actual start time is unknown then use the start of the Trace\r
-               // as the\r
-               // starting reference point.\r
-               if (startTime == null) {\r
-                       return eventParent.getStartTime();\r
-               }\r
-               return startTime;\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see\r
-        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getEntry\r
-        * ()\r
-        */\r
-       @Override\r
-       public ITmfTimeAnalysisEntry getEntry() {\r
-               return parent;\r
-       }\r
-\r
-       /**\r
-        * return the duration between end and start time , if the start time or end\r
-        * time are unknown, use the Trace start and End times to estimate it, this\r
-        * value will be used to draw the time range and need to provide a valid\r
-        * time width.\r
-        * \r
-        * @return the duration\r
-        */\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#\r
-        * getDuration()\r
-        */\r
-       @Override\r
-       public long getDuration() {\r
-               long duration = -1;\r
-               long endT = (stopTime == null) ? parent.getStopTime() : stopTime;\r
-               long startT = (startTime == null) ? parent.getStartTime() : startTime;\r
-\r
-               if (endT > startT) {\r
-                       return stopTime - startTime;\r
-               }\r
-               return duration;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public String getStateMode() {\r
-               return stateMode;\r
-       }\r
-\r
-       /**\r
-        * @param stateMode\r
-        */\r
-       public void setStateMode(String stateMode) {\r
-               if (stateMode != null) {\r
-                       this.stateMode = stateMode;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see org.eclipse.linuxtools.lttng.ui.model.ITimeRangeComponent#getName()\r
-        */\r
-       @Override\r
-       public String getName() {\r
-               return stateMode;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public Type getEventType() {\r
-               return eventType;\r
-       }\r
-\r
-       /**\r
-        * @param eventType\r
-        */\r
-       public void setEventType(Type eventType) {\r
-               this.eventType = eventType;\r
-       }\r
-\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java
deleted file mode 100644 (file)
index 23e7550..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.model.trange;\r
-\r
-public class TimeRangeEventProcess extends TimeRangeComposite implements\r
-               Comparable<TimeRangeEventProcess> {\r
-       // ========================================================================\r
-       // Data\r
-       // =======================================================================\r
-       // GUI information\r
-       private Long pid = 0L;\r
-       private Long tgid = 0L;\r
-       private Long ppid = 0L;\r
-       private Long creationTime = 0L;\r
-       private String traceID = ""; //$NON-NLS-1$\r
-       private String processType = "User"; // Kernel or user thread //$NON-NLS-1$\r
-       private Long cpu = 0L;\r
-       private String brand = ""; //$NON-NLS-1$\r
-\r
-       // ========================================================================\r
-       // Constructor\r
-       // =======================================================================\r
-       /**\r
-        * @param id\r
-        * @param name\r
-        * @param sTime\r
-        *            normally set to the Trace start time\r
-        * @param stopTime\r
-        *            normally set to the Trace end time\r
-        * @param groupName\r
-        * @param className\r
-        */\r
-       public TimeRangeEventProcess(int id, String name, long startTime,\r
-                       long stopTime, String groupName, String className, Long cpu,\r
-                       long insertionTime) {\r
-\r
-               super(id, startTime, stopTime, name, CompositeType.PROCESS,\r
-                               insertionTime);\r
-               this.cpu = cpu;\r
-       }\r
-\r
-       // ========================================================================\r
-       // Methods\r
-       // =======================================================================\r
-       \r
-       \r
-       /**\r
-     * Interface to add children to this process\r
-     * \r
-     * @param newEvent\r
-     */\r
-    public void addChildren(TimeRangeEvent newEvent) {\r
-        if ((newEvent != null)) {\r
-            this.ChildEventLeafs.add(newEvent);\r
-        }\r
-    }\r
-       \r
-       /**\r
-        * @return\r
-        */\r
-       public Long getPid() {\r
-               return pid;\r
-       }\r
-\r
-       /**\r
-        * @param pid\r
-        */\r
-       public void setPid(Long pid) {\r
-               this.pid = pid;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public Long getTgid() {\r
-               return tgid;\r
-       }\r
-\r
-       /**\r
-        * @param tgid\r
-        */\r
-       public void setTgid(Long tgid) {\r
-               this.tgid = tgid;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public Long getPpid() {\r
-               return ppid;\r
-       }\r
-\r
-       /**\r
-        * @param ppid\r
-        */\r
-       public void setPpid(Long ppid) {\r
-               this.ppid = ppid;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public Long getCreationTime() {\r
-               return creationTime;\r
-       }\r
-\r
-       /**\r
-        * @param creationTime\r
-        */\r
-       public void setCreationTime(Long creationTime) {\r
-               this.creationTime = creationTime;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public String getTraceID() {\r
-               return traceID;\r
-       }\r
-\r
-       /**\r
-        * @param traceID\r
-        */\r
-       public void setTraceID(String traceID) {\r
-               if (traceID != null) {\r
-                       this.traceID = traceID;\r
-               } else {\r
-                       this.traceID = ""; //$NON-NLS-1$\r
-               }\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public String getProcessType() {\r
-               return processType;\r
-       }\r
-\r
-       /**\r
-        * @param processType\r
-        */\r
-       public void setProcessType(String processType) {\r
-               if (processType != null) {\r
-                       this.processType = processType;\r
-               }\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public Long getCpu() {\r
-               return cpu;\r
-       }\r
-\r
-       /**\r
-        * @param cpu\r
-        */\r
-       public void setCpu(Long cpu) {\r
-               if (cpu != null) {\r
-                       this.cpu = cpu;\r
-               } else {\r
-                   this.cpu = 0L;\r
-               }\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public String getBrand() {\r
-        return brand;\r
-    }\r
-\r
-       /**\r
-        * @param brand\r
-        */\r
-    public void setBrand(String brand) {\r
-        if (brand != null) {\r
-            this.brand = brand;\r
-        } else {\r
-            brand = ""; //$NON-NLS-1$\r
-        }\r
-    }\r
-       \r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see java.lang.Comparable#compareTo(java.lang.Object)\r
-        */\r
-       @Override\r
-       public int compareTo(TimeRangeEventProcess process) {\r
-               if (process != null) {\r
-                       int result = 0;\r
-                       // first compare by pid\r
-                       Long anotherPid = process.getPid();\r
-                       result = pid.compareTo(anotherPid);\r
-                       if (result != 0) {\r
-                               return result;\r
-                       }\r
-\r
-                       // Then by CPU\r
-                       Long anotherCpu = process.getCpu();\r
-                       result = cpu.compareTo(anotherCpu);\r
-                       if (result != 0) {\r
-                               return result;\r
-                       }\r
-\r
-                       // finally by trace\r
-                       String anotherTraceId = process.getTraceID();\r
-                       return traceID.compareTo(anotherTraceId);\r
-               }\r
-\r
-               return 0;\r
-       }\r
-       \r
-    @Override\r
-    @SuppressWarnings("nls")\r
-    public String toString() {\r
-               return "[TimeRangeEventProcess:" + super.toString() +\r
-               ",pid=" + pid + ",tgid=" + tgid + ",ppid=" + ppid + ",ctime=" + creationTime +\r
-               ",trace=" + traceID + ",ptype=" + processType + ",cpu=" + cpu + ",brand=" + brand + "]";\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see java.lang.Object#hashCode()\r
-     */\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result + ((brand == null) ? 0 : brand.hashCode());\r
-        result = prime * result + ((cpu == null) ? 0 : cpu.hashCode());\r
-        result = prime * result + ((creationTime == null) ? 0 : creationTime.hashCode());\r
-        result = prime * result + ((pid == null) ? 0 : pid.hashCode());\r
-        result = prime * result + ((ppid == null) ? 0 : ppid.hashCode());\r
-        result = prime * result + ((processType == null) ? 0 : processType.hashCode());\r
-        result = prime * result + ((tgid == null) ? 0 : tgid.hashCode());\r
-        result = prime * result + ((traceID == null) ? 0 : traceID.hashCode());\r
-        return result;\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see java.lang.Object#equals(java.lang.Object)\r
-     */\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (obj == null) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof TimeRangeEventProcess)) {\r
-            return false;\r
-        }\r
-        TimeRangeEventProcess other = (TimeRangeEventProcess) obj;\r
-        if (brand == null) {\r
-            if (other.brand != null) {\r
-                return false;\r
-            }\r
-        } else if (!brand.equals(other.brand)) {\r
-            return false;\r
-        }\r
-        if (cpu == null) {\r
-            if (other.cpu != null) {\r
-                return false;\r
-            }\r
-        } else if (!cpu.equals(other.cpu)) {\r
-            return false;\r
-        }\r
-        if (creationTime == null) {\r
-            if (other.creationTime != null) {\r
-                return false;\r
-            }\r
-        } else if (!creationTime.equals(other.creationTime)) {\r
-            return false;\r
-        }\r
-        if (pid == null) {\r
-            if (other.pid != null) {\r
-                return false;\r
-            }\r
-        } else if (!pid.equals(other.pid)) {\r
-            return false;\r
-        }\r
-        if (ppid == null) {\r
-            if (other.ppid != null) {\r
-                return false;\r
-            }\r
-        } else if (!ppid.equals(other.ppid)) {\r
-            return false;\r
-        }\r
-        if (processType == null) {\r
-            if (other.processType != null) {\r
-                return false;\r
-            }\r
-        } else if (!processType.equals(other.processType)) {\r
-            return false;\r
-        }\r
-        if (tgid == null) {\r
-            if (other.tgid != null) {\r
-                return false;\r
-            }\r
-        } else if (!tgid.equals(other.tgid)) {\r
-            return false;\r
-        }\r
-        if (traceID == null) {\r
-            if (other.traceID != null) {\r
-                return false;\r
-            }\r
-        } else if (!traceID.equals(other.traceID)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java
deleted file mode 100644 (file)
index 0c73fe2..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.model.trange;\r
-\r
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;\r
-\r
-\r
-/**\r
- * @author alvaro\r
- * \r
- */\r
-public abstract class TimeRangeEventResource extends TimeRangeComposite\r
-               implements\r
-               Comparable<TimeRangeEventResource> {\r
-\r
-       // ========================================================================\r
-       // Data\r
-       // =======================================================================\r
-       public static enum ResourceTypes {\r
-               UNKNOWN, IRQ, TRAP, SOFT_IRQ, BDEV, CPU\r
-       }\r
-\r
-       private ResourceTypes type = ResourceTypes.UNKNOWN;\r
-       private Long resourceId = null;\r
-\r
-       // ========================================================================\r
-       // Constructor\r
-       // =======================================================================\r
-       /**\r
-        * Constructor<br>\r
-        * \r
-        * @param newId            Id used by the UI\r
-        * @param newStartTime     normally set to the Trace start time\r
-        * @param newStopTime      normally set to the Trace end time\r
-        * @param newName          the name of this resource\r
-        * @param newGroupName     the group name of this resource. Should be same as the traceId\r
-        * @param newClassName     the classname of this resource.\r
-        * @param newType          the type of the resource, as defined in the ResourceTypes enum\r
-        * @param newResourceId    the resourceId, unique id identifying this resource \r
-        * \r
-        */\r
-       public TimeRangeEventResource(int newId, long newStartTime,\r
-                       long newStopTime, String newName, String newGroupName,\r
-                       String newClassName, ResourceTypes newType, Long newResourceId,\r
-                       long insertionTime) {\r
-\r
-               super(newId, newStartTime, newStopTime, newName, newGroupName,\r
-                               newClassName, CompositeType.RESOURCE, insertionTime);\r
-\r
-               type = newType;\r
-               resourceId = newResourceId;\r
-       }\r
-\r
-       // ========================================================================\r
-       // Methods\r
-       // =======================================================================\r
-\r
-       /**\r
-        * Interface to add children to this resource\r
-        * \r
-        * @param newEvent\r
-        */\r
-       public void addChildren(TimeRangeEvent newEvent) {\r
-               if ((newEvent != null)) {\r
-                       this.ChildEventLeafs.add(newEvent);\r
-               }\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public Long getResourceId() {\r
-               return resourceId;\r
-       }\r
-\r
-       /**\r
-        * @param newResId\r
-        */\r
-       public void setResourceId(Long newResId) {\r
-               this.resourceId = newResId;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public ResourceTypes getType() {\r
-               return type;\r
-       }\r
-\r
-       /**\r
-        * @param type\r
-        */\r
-       public void setType(ResourceTypes type) {\r
-               this.type = type;\r
-       }\r
-\r
-       /**\r
-        * Getter for traceId.<br>\r
-        * Note : traceId and groupName are the same for EventResource\r
-        * \r
-        * @return String\r
-        */\r
-       public String getTraceId() {\r
-               return groupName;\r
-       }\r
-\r
-       /**\r
-        * Getter for traceId.<br>\r
-        * Note : traceId and groupName are the same for EventResource\r
-        * \r
-        * @return String\r
-        */\r
-       public void setTraceId(String traceId) {\r
-               this.groupName = traceId;\r
-       }\r
-\r
-       // @Override\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see java.lang.Object#toString()\r
-        */\r
-//     @Override\r
-//     public String toString() {\r
-//             return getResourceId().toString() + ":" + getTraceId().toString() + ":"\r
-//                             + getType().toString();\r
-//     }\r
-\r
-    @Override\r
-    @SuppressWarnings("nls")\r
-    public String toString() {\r
-               return "[TimeRangeEventResource: " + super.toString() +\r
-               ",type=" + type + ",resourceId=" + resourceId + "]";\r
-    }\r
-\r
-    /**\r
-        * Compare function to implement Comparable<br>\r
-        * <br>\r
-        * Compare by traceId THEN IF EQUAL by resourceType THEN IF EQUAL by\r
-        * resourceId\r
-        * \r
-        * @param comparedResource\r
-        *            The resource to compare to\r
-        * \r
-        * @return int 0 if equals, negative number if "smaller", positive if\r
-        *         "bigger".\r
-        */\r
-       // @Override\r
-       @Override\r
-       public int compareTo(TimeRangeEventResource comparedResource) {\r
-               int returnedValue = 0;\r
-\r
-               if (comparedResource != null) {\r
-                       // Compare by trace id first\r
-                       returnedValue = this.getTraceId().compareTo(\r
-                                       comparedResource.getTraceId());\r
-\r
-                       // If same, compare by resourceName\r
-                       if (returnedValue == 0) {\r
-                               returnedValue = this.getName().compareTo(\r
-                                               comparedResource.getName());\r
-\r
-                               // Finally, if same, compare by ResourceId\r
-                               if (returnedValue == 0) {\r
-                                       returnedValue = this.getResourceId().compareTo(\r
-                                                       comparedResource.getResourceId());\r
-                               }\r
-                       }\r
-\r
-               }\r
-\r
-               return returnedValue;\r
-       }\r
-\r
-       public abstract String getStateMode(LttngTraceState traceState);\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java
deleted file mode 100644 (file)
index 305b29c..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.model.trange;
-
-
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LTTngCPUState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngIRQState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTrapState;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
-
-/**
- * Creates Resources with custom implementation to obtain its corresponding
- * state mode
- * <p>
- * The state mode resolution is needed at the end of a data request, as well as
- * in the before and after handlers
- * </p>
- * 
- * @author alvaro
- * 
- */
-public class TimeRangeResourceFactory {
-       // ========================================================================
-       // Data
-       // =======================================================================
-       private static TimeRangeResourceFactory instance = null;
-
-       // ========================================================================
-       // Create instance
-       // =======================================================================
-       /**
-        * Factory singleton
-        * 
-        * @return
-        */
-       public static TimeRangeResourceFactory getInstance() {
-               if (instance == null) {
-                       instance = new TimeRangeResourceFactory();
-               }
-               return instance;
-       }
-
-       // ========================================================================
-       // Public methods
-       // =======================================================================
-       public TimeRangeEventResource createResource(int newId, long newStartTime,
-                       long newStopTime, String newName, String newGroupName,
-                       String newClassName, ResourceTypes type, Long newResourceId,
-                       long insertionTime) {
-
-               TimeRangeEventResource resource = null;
-               switch (type) {
-               case CPU:
-                       resource = createCpuResource(newId, newStartTime, newStopTime,
-                                       newName, newGroupName, newClassName, type, newResourceId,
-                                       insertionTime);
-                       break;
-               case IRQ:
-                       resource = createIrqResource(newId, newStartTime, newStopTime,
-                                       newName, newGroupName, newClassName, type, newResourceId,
-                                       insertionTime);
-                       break;
-               case SOFT_IRQ:
-                       resource = createSoftIrqResource(newId, newStartTime, newStopTime,
-                                       newName, newGroupName, newClassName, type, newResourceId,
-                                       insertionTime);
-                       break;
-               case TRAP:
-                       resource = createTrapResource(newId, newStartTime, newStopTime,
-                                       newName, newGroupName, newClassName, type, newResourceId,
-                                       insertionTime);
-                       break;
-               case BDEV:
-                       resource = createBdevResource(newId, newStartTime, newStopTime,
-                                       newName, newGroupName, newClassName, type, newResourceId,
-                                       insertionTime);
-                       break;
-               default:
-                       break;
-               }
-
-               return resource;
-       }
-
-       // ========================================================================
-       // Private methods
-       // =======================================================================
-       private TimeRangeEventResource createIrqResource(int newId,
-                       long newStartTime, long newStopTime, String newName,
-                       String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId, long insertionTime) {
-
-               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
-                               newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId, insertionTime) {
-
-                       @Override
-                       public String getStateMode(LttngTraceState traceSt) {
-                               LttngIRQState irqState = traceSt.getIrq_states().get(
-                                               getResourceId());
-                               String statemode = ""; //$NON-NLS-1$
-                               if (irqState != null) {
-                                       statemode = irqState.peekFromIrqStack().getInName();
-                               }
-
-                               return statemode;
-                       }
-               };
-               
-               return resource;
-       }
-
-       private TimeRangeEventResource createTrapResource(int newId,
-                       long newStartTime, long newStopTime, String newName,
-                       String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId, long insertionTime) {
-
-               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
-                               newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId, insertionTime) {
-
-                       @Override
-                       public String getStateMode(LttngTraceState traceSt) {
-                               // Determine the trap state.
-                               String trapStateMode = ""; //$NON-NLS-1$
-                               LttngTrapState ts = traceSt.getTrap_states().get(getResourceId());
-                               
-                               // *** Note : 
-                               //      Ts might not have been created yet.
-                               //      This is because the state system will be updated next to this before hook
-                               //      It should be correct to create it here as Busy 
-                               //              (traps are created with running++ so it wont be idle)
-                               if ( ts != null ) {
-                                       Long trapState = ts.getRunning();
-                                       
-                                       if (trapState == 0) {
-                                               trapStateMode = StateStrings.TrapMode.LTTV_TRAP_IDLE.getInName();
-                                       } else {
-                                               trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY.getInName();
-                                       }
-                               }
-                               else {
-                                       trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY.getInName();
-                               }
-                               
-                               return trapStateMode;
-                       }
-               };
-
-               return resource;
-       }
-
-       private TimeRangeEventResource createSoftIrqResource(int newId,
-                       long newStartTime, long newStopTime, String newName,
-                       String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId, long insertionTime) {
-
-               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
-                               newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId, insertionTime) {
-
-                       @Override
-                       public String getStateMode(LttngTraceState traceSt) {
-                               // Get the resource id.
-                               Long softIrqId = getResourceId();
-                               // Get the resource state mode
-                               long running = traceSt.getSoft_irq_states().get(softIrqId)
-                                               .getRunning().longValue();
-                               long pending = traceSt.getSoft_irq_states().get(softIrqId)
-                                               .getPending().longValue();
-
-                               String softIrqStateMode;
-                               if (running > 0) {
-                                       softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_BUSY
-                                                       .getInName();
-                               } else if (pending > 0) {
-                                       softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_PENDING
-                                                       .getInName();
-                               } else {
-                                       softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_IDLE
-                                                       .getInName();
-                               }
-
-                               return softIrqStateMode;
-                       }
-
-               };
-
-               return resource;
-       }
-
-       private TimeRangeEventResource createBdevResource(int newId,
-                       long newStartTime, long newStopTime, String newName,
-                       String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId, long insertionTime) {
-
-               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
-                               newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId, insertionTime) {
-
-                       @Override
-                       public String getStateMode(LttngTraceState traceSt) {
-                               // Get the resource state mode
-                               String bdevStateMode = traceSt.getBdev_states().get(
-                                               getResourceId()).peekFromBdevStack().getInName();
-
-                               return bdevStateMode;
-                       }
-
-               };
-
-               return resource;
-       }
-
-       private TimeRangeEventResource createCpuResource(int newId,
-                       long newStartTime, long newStopTime, String newName,
-                       String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId, long insertionTime) {
-
-               TimeRangeEventResource resource = new TimeRangeEventResource(newId,
-                               newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId, insertionTime) {
-
-                       @Override
-                       public String getStateMode(LttngTraceState traceSt) {
-                               // Get the resource state mode
-                           LTTngCPUState cpuState = traceSt.getCpu_states().get(
-                        getResourceId());
-                           
-                               String cpuStateMode = ""; //$NON-NLS-1$
-                               if (cpuState != null) { 
-                                   cpuStateMode = traceSt.getCpu_states().get(
-                                           getResourceId())
-                                           .peekFromCpuStack().getInName();
-                               }
-
-                               return cpuStateMode;
-                       }
-
-               };
-
-               return resource;
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java
deleted file mode 100644 (file)
index 6518c4b..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.model.trange;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Map.Entry;\r
-\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.BdevMode;\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.CpuMode;\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ExecutionMode;\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.IRQMode;\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ProcessStatus;\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.SoftIRQMode;\r
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.TrapMode;\r
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
-\r
-public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Data\r
-    // ------------------------------------------------------------------------\r
-\r
-    protected Map<String, StateColor> procStateToColor = new HashMap<String, StateColor>(16);\r
-    protected Map<String, StateColor> bdevStateToColor = new HashMap<String, StateColor>(4);\r
-    protected Map<String, StateColor> softIrqStateToColor = new HashMap<String, StateColor>(4);\r
-    protected Map<String, StateColor> trapStateToColor = new HashMap<String, StateColor>(4);\r
-    protected Map<String, StateColor> irqStateToColor = new HashMap<String, StateColor>(4);\r
-    protected Map<String, StateColor> cpuStateToColor = new HashMap<String, StateColor>(8);\r
-\r
-    private final ParamsUpdater fviewParameters;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    public TimeRangeViewerProvider(ParamsUpdater paramsUpdater) {\r
-       // Fill the state mode to color maps\r
-       fillProcessStateToColor();\r
-       fillBdevStateToColor();\r
-       fillSoftIRQStateToColor();\r
-       fillTrapStateToColor();\r
-       fillIrqStateToColor();\r
-       fillCpuStateToColor();\r
-       fviewParameters = paramsUpdater;\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Methods\r
-    // ------------------------------------------------------------------------\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventColor(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent)\r
-     */\r
-    @Override\r
-    public StateColor getEventColor(ITimeEvent event) {\r
-       StateColor retColor = null;\r
-\r
-       if (event instanceof TimeRangeEvent) {\r
-           TimeRangeEvent devent = (TimeRangeEvent) event;\r
-           String stateMode = devent.getStateMode();\r
-           switch (devent.getEventType()) {\r
-           case PROCESS_MODE:\r
-               retColor = procStateToColor.get(stateMode);\r
-               break;\r
-           case BDEV_MODE:\r
-               retColor = bdevStateToColor.get(stateMode);\r
-               break;\r
-           case IRQ_MODE:\r
-               retColor = irqStateToColor.get(stateMode);\r
-               break;\r
-           case SOFT_IRQ_MODE:\r
-               retColor = softIrqStateToColor.get(stateMode);\r
-               break;\r
-           case CPU_MODE:\r
-               retColor = cpuStateToColor.get(stateMode);\r
-               break;\r
-           case TRAP_MODE:\r
-               retColor = trapStateToColor.get(stateMode);\r
-               break;\r
-           }\r
-       }\r
-\r
-       if (retColor == null) {\r
-           return StateColor.MAGENTA3;\r
-       }\r
-       return retColor;\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider.StateColor)\r
-     */\r
-    @Override\r
-    public String getStateName(StateColor color) {\r
-       // Override to multiple instances of the widget, the same color can have\r
-       // multiple meanings\r
-       return "Not mapped"; //$NON-NLS-1$\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventHoverToolTipInfo(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent)\r
-     */\r
-    @Override\r
-    public Map<String, String> getEventHoverToolTipInfo(ITimeEvent revent) {\r
-       Map<String, String> toolTipEventMsgs = new HashMap<String, String>();\r
-       // if the selected resource is a Process, add the Process type to the\r
-       // tool tip\r
-       if (revent instanceof TimeRangeComponent) {\r
-           ITimeRangeComponent parent = ((TimeRangeComponent) revent).getEventParent();\r
-\r
-           // if the event start time is unknown, indicate it to the user\r
-           String extraInfo = "\n" + Messages.TimeRangeViewerProvider_BadRangeExtraInfo; //$NON-NLS-1$\r
-           long eventStart = revent.getTime();\r
-           if (eventStart < fviewParameters.getStartTime()) {\r
-               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_StartTime, Messages.TimeRangeViewerProvider_UndefinedStartTime + extraInfo);\r
-               // avoid repeated details\r
-               extraInfo = ""; //$NON-NLS-1$\r
-           }\r
-\r
-           long eventEnd = revent.getTime() + revent.getDuration();\r
-           if (eventEnd > fviewParameters.getEndTime()) {\r
-               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_EndTime, Messages.TimeRangeViewerProvider_UndefinedEndTime + extraInfo);\r
-           }\r
-\r
-           if (parent != null && parent instanceof TimeRangeEventProcess) {\r
-               TimeRangeEventProcess localProcess = (TimeRangeEventProcess) parent;\r
-               toolTipEventMsgs.put(Messages.TimeRangeViewerProvider_ProcessType, localProcess.getProcessType());\r
-           }\r
-       }\r
-\r
-       return toolTipEventMsgs;\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getEventName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent, boolean, boolean)\r
-     */\r
-    @Override\r
-    public String getEventName(ITimeEvent event, boolean upper, boolean extInfo) {\r
-       String name = null;\r
-       // The relevant event name for the time range is the actual state mode\r
-       if (event instanceof TimeRangeEvent) {\r
-           TimeRangeEvent devent = (TimeRangeEvent) event;\r
-           StringBuilder sb = new StringBuilder(devent.getStateMode());\r
-           name = sb.toString();\r
-       }\r
-\r
-       if (name == null) {\r
-           return "Unknown"; //$NON-NLS-1$\r
-       }\r
-       return name;\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider#getTraceClassName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry)\r
-     */\r
-    @Override\r
-    public String getTraceClassName(ITmfTimeAnalysisEntry trace) {\r
-       String name = ""; //$NON-NLS-1$\r
-       if (trace instanceof TimeRangeComposite) {\r
-           TimeRangeComposite dTrace = (TimeRangeComposite) trace;\r
-           name = dTrace.getClassName();\r
-       }\r
-       return name;\r
-    }\r
-\r
-    private void fillCpuStateToColor() {\r
-       cpuStateToColor.put(CpuMode.LTTV_CPU_UNKNOWN.getInName(), StateColor.BLACK);\r
-       cpuStateToColor.put(CpuMode.LTTV_CPU_IDLE.getInName(), StateColor.GRAY);\r
-       cpuStateToColor.put(CpuMode.LTTV_CPU_BUSY.getInName(), StateColor.LIGHT_BLUE);\r
-       cpuStateToColor.put(CpuMode.LTTV_CPU_IRQ.getInName(), StateColor.ORANGE);\r
-       cpuStateToColor.put(CpuMode.LTTV_CPU_SOFT_IRQ.getInName(), StateColor.PURPLE1);\r
-       cpuStateToColor.put(CpuMode.LTTV_CPU_TRAP.getInName(), StateColor.GOLD);\r
-    }\r
-\r
-    private void fillIrqStateToColor() {\r
-       irqStateToColor.put(IRQMode.LTTV_IRQ_UNKNOWN.getInName(), StateColor.BLACK);\r
-       irqStateToColor.put(IRQMode.LTTV_IRQ_IDLE.getInName(), StateColor.GRAY);\r
-       irqStateToColor.put(IRQMode.LTTV_IRQ_BUSY.getInName(), StateColor.ORANGE);\r
-    }\r
-\r
-    private void fillTrapStateToColor() {\r
-       trapStateToColor.put(TrapMode.LTTV_TRAP_UNKNOWN.getInName(), StateColor.BLACK);\r
-       trapStateToColor.put(TrapMode.LTTV_TRAP_IDLE.getInName(), StateColor.GRAY);\r
-       trapStateToColor.put(TrapMode.LTTV_TRAP_BUSY.getInName(), StateColor.GOLD);\r
-    }\r
-\r
-    private void fillSoftIRQStateToColor() {\r
-       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_UNKNOWN.getInName(), StateColor.BLACK);\r
-       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_IDLE.getInName(), StateColor.GRAY);\r
-       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_PENDING.getInName(), StateColor.PINK1);\r
-       softIrqStateToColor.put(SoftIRQMode.LTTV_SOFT_IRQ_BUSY.getInName(), StateColor.PURPLE1);\r
-    }\r
-\r
-    private void fillBdevStateToColor() {\r
-       softIrqStateToColor.put(BdevMode.LTTV_BDEV_UNKNOWN.getInName(), StateColor.BLACK);\r
-       softIrqStateToColor.put(BdevMode.LTTV_BDEV_IDLE.getInName(), StateColor.GRAY);\r
-       softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_READING.getInName(), StateColor.DARK_BLUE);\r
-       softIrqStateToColor.put(BdevMode.LTTV_BDEV_BUSY_WRITING.getInName(), StateColor.RED);\r
-    }\r
-\r
-    private void fillProcessStateToColor() {\r
-       // Process Status\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_UNNAMED.getInName(), StateColor.GRAY);\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_DEAD.getInName(), StateColor.BLACK);\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_FORK.getInName(), StateColor.DARK_GREEN);\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_CPU.getInName(), StateColor.DARK_YELLOW);\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_EXIT.getInName(), StateColor.MAGENTA3);\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_ZOMBIE.getInName(), StateColor.PURPLE1);\r
-       procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT.getInName(), StateColor.RED);\r
-\r
-       // Execution Mode\r
-       procStateToColor.put(ExecutionMode.LTTV_STATE_MODE_UNKNOWN.getInName(), StateColor.BLACK);\r
-       procStateToColor.put(ExecutionMode.LTTV_STATE_USER_MODE.getInName(), StateColor.GREEN);\r
-       procStateToColor.put(ExecutionMode.LTTV_STATE_SYSCALL.getInName(), StateColor.DARK_BLUE);\r
-       procStateToColor.put(ExecutionMode.LTTV_STATE_TRAP.getInName(), StateColor.GOLD);\r
-       procStateToColor.put(ExecutionMode.LTTV_STATE_IRQ.getInName(), StateColor.ORANGE);\r
-       procStateToColor.put(ExecutionMode.LTTV_STATE_SOFT_IRQ.getInName(), StateColor.PINK1);\r
-    }\r
-    \r
-    protected String findObject(StateColor Value, Map<String, StateColor> map) {\r
-        for (Entry<String, StateColor> entry : map.entrySet()) {\r
-            if (entry.getValue().equals(Value)) {\r
-                return entry.getKey();\r
-            }\r
-        }\r
-               return "Not Found"; //$NON-NLS-1$\r
-       }\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/messages.properties
deleted file mode 100644 (file)
index 86fb8ff..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-TimeRangeViewerProvider_BadRangeExtraInfo=(i.e. outside of data time window)
-TimeRangeViewerProvider_EndTime=Stop Time
-TimeRangeViewerProvider_ProcessType=Process Type
-TimeRangeViewerProvider_StartTime=Start Time
-TimeRangeViewerProvider_UndefinedEndTime=Actual Event Stop Time is undefined
-TimeRangeViewerProvider_UndefinedStartTime=Actual Event Start Time is undefined
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/Messages.java
deleted file mode 100644 (file)
index 86295f2..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.project.dialogs;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.project.dialogs.messages"; //$NON-NLS-1$
-    public static String NewProjectWizard_Title;
-       public static String NewProjectWizard_Description;
-       public static String TraceLibraryPath_label;
-       public static String TraceLibraryPath_browseBtn;
-       public static String TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists;
-       public static String TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists;
-       public static String TraceLibraryPathWizardPage_Title;
-       public static String TraceLibraryPathWizardPage_Description;
-       public static String TraceLibraryPathWizard_Message;
-       public static String TraceLibraryPathProperty_Message;
-       public static String TraceLibraryPath_Note;
-       public static String TraceLibraryPath_Message;
-       static {
-               // initialize resource bundle
-               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-       }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/NewLTTngProjectMainWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/NewLTTngProjectMainWizardPage.java
deleted file mode 100644 (file)
index 0d05e17..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.project.dialogs;
-
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-/**
- * <b><u>NewProjectMainWizardPage</u></b>
- * <p>
- *
- * TODO: Implement me. Please.
- */
-public class NewLTTngProjectMainWizardPage extends WizardNewProjectCreationPage {
-
-    /**
-     * @param pageName
-     */
-    public NewLTTngProjectMainWizardPage(String pageName) {
-        super(pageName);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/NewLTTngProjectWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/NewLTTngProjectWizard.java
deleted file mode 100644 (file)
index 2b7104a..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *   Yufen Kuo       (ykuo@mvista.com) - add support to allow user specify trace library path
- *   Francois Chouinard - Rebase on TMF NewProjectWizard
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.project.dialogs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.linuxtools.internal.lttng.core.TraceHelper;
-import org.eclipse.linuxtools.lttng.core.LTTngProjectNature;
-import org.eclipse.linuxtools.tmf.core.TmfProjectNature;
-import org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard;
-
-/**
- * <b><u>NewLTTngProjectWizard</u></b>
- * <p>
- */
-public class NewLTTngProjectWizard extends NewTmfProjectWizard {
-
-    // ------------------------------------------------------------------------
-    // Constants
-    // ------------------------------------------------------------------------
-
-    private static final String TRACE_LIBRARY_PATH = "traceLibraryPath"; //$NON-NLS-1$
-
-    // ------------------------------------------------------------------------
-    // Variables
-    // ------------------------------------------------------------------------
-
-    private TraceLibraryPathWizardPage traceLibraryPathPage;
-
-    // ------------------------------------------------------------------------
-    // Construction
-    // ------------------------------------------------------------------------
-
-    public NewLTTngProjectWizard() {
-        this(Messages.NewProjectWizard_Title, Messages.NewProjectWizard_Description);
-    }
-
-    public NewLTTngProjectWizard(String title, String desc) {
-        super(title, desc);
-    }
-
-    // ------------------------------------------------------------------------
-    // NewProjectWizard
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void addPages() {
-        super.addPages();
-        traceLibraryPathPage = new TraceLibraryPathWizardPage(Messages.NewProjectWizard_Title);
-        traceLibraryPathPage.setTitle(Messages.TraceLibraryPathWizardPage_Title);
-        traceLibraryPathPage.setDescription(Messages.TraceLibraryPathWizardPage_Description);
-        addPage(traceLibraryPathPage);
-    }
-
-    @Override
-    public boolean performFinish() {
-        // Create the tracing project
-        super.performFinish();
-
-        // Add the LTTng nature
-        try {
-            IProjectDescription description = fProject.getDescription();
-            description.setNatureIds(new String[] { TmfProjectNature.ID, LTTngProjectNature.ID });
-            fProject.setDescription(description, null);
-        } catch (CoreException e) {
-        }
-
-        // Set the library path
-        String traceLibraryPath = traceLibraryPathPage.getPath();
-        if (traceLibraryPath != null) {
-            return TraceHelper.setProjectPreference(fProject, TRACE_LIBRARY_PATH, traceLibraryPath);
-        }
-
-        return true;
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    public IProject getProject() {
-        return fProject;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/TraceLibraryPathPropertyPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/TraceLibraryPathPropertyPage.java
deleted file mode 100644 (file)
index 6b189f7..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 MontaVista Software
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yufen Kuo (ykuo@mvista.com) - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.project.dialogs;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.linuxtools.internal.lttng.core.TraceHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class TraceLibraryPathPropertyPage extends PropertyPage {
-
-    private static final String LTTVTRACEREAD_LOADER_LIBNAME = "lttvtraceread_loader"; //$NON-NLS-1$
-    private Button browsePathButton;
-    private Text traceLibraryPath;
-
-    @Override
-    protected Control createContents(Composite parent) {
-        Composite client = new Composite(parent, SWT.NONE);
-        client.setLayoutData(new GridData(GridData.FILL_BOTH));
-
-        GridLayout layout = new GridLayout(3, false);
-        layout.marginHeight = 0;
-        layout.marginWidth = 0;
-        client.setLayout(layout);
-
-        Label label = new Label(client, SWT.NONE);
-        label.setText(Messages.TraceLibraryPath_label);
-        traceLibraryPath = new Text(client, SWT.BORDER);
-        traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
-                false));
-        traceLibraryPath.addModifyListener(new ModifyListener() {
-
-            @Override
-            public void modifyText(ModifyEvent e) {
-                setValid(validateInputs());
-            }
-
-        });
-        browsePathButton = new Button(client, SWT.PUSH);
-        browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false,
-                false));
-        browsePathButton.setText(Messages.TraceLibraryPath_browseBtn);
-        browsePathButton.addSelectionListener(new SelectionAdapter() {
-
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                String dir = new DirectoryDialog(Display.getDefault()
-                        .getActiveShell()).open();
-                if (dir != null) {
-                    traceLibraryPath.setText(dir);
-                }
-
-            }
-
-        });
-
-        Label noLabel = new Label(client, SWT.NONE);
-        noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
-
-        Label descTextLabel = new Label(client, SWT.WRAP);
-        descTextLabel.setText(Messages.TraceLibraryPathProperty_Message);
-        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
-        gd.widthHint = 400;
-        gd.horizontalSpan = 2;
-        descTextLabel.setLayoutData(gd);
-
-        Label noteBoldLabel = new Label(client, SWT.BOLD);
-        noteBoldLabel.setText(Messages.TraceLibraryPath_Note);
-        noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false,
-                false));
-        Font font = noteBoldLabel.getFont();
-        if (font.getFontData().length > 0)
-            noteBoldLabel.setFont(new Font(client.getDisplay(), font
-                    .getFontData()[0].getName(), font.getFontData()[0]
-                    .getHeight(), SWT.BOLD));
-
-        Label noteTextLabel = new Label(client, SWT.WRAP);
-        noteTextLabel.setText(Messages.TraceLibraryPath_Message);
-        gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
-        gd.widthHint = 400;
-        gd.horizontalSpan = 2;
-        noteTextLabel.setLayoutData(gd);
-                
-        performDefaults();
-        return client;
-    }
-
-    public boolean validateInputs() {
-        String path = traceLibraryPath.getText();
-        if (path != null && !path.trim().isEmpty()) {
-            File file = new File(path);
-            if (file.exists() && file.isDirectory()) {
-                File loaderLib = new File(path,
-                        System.mapLibraryName(LTTVTRACEREAD_LOADER_LIBNAME));
-                if (!loaderLib.exists()) {
-                    setErrorMessage(Messages.TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists);
-                    return false;
-                }
-            } else {
-                setErrorMessage(Messages.TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists);
-                return false;
-            }
-        }
-        setErrorMessage(null);
-        return true;
-    }
-
-    @Override
-    protected void performDefaults() {
-        IResource resource = (IResource) getElement().getAdapter(
-                IResource.class);
-        IProject project = resource.getProject();
-        if (project != null) {
-            String traceLibDir = TraceHelper.getTraceLibDirFromProject(project);
-            if (traceLibDir != null) {
-                traceLibraryPath.setText(traceLibDir);
-            }
-        }
-        super.performDefaults();
-    }
-
-    @Override
-    public boolean performOk() {
-        IResource resource = (IResource) getElement().getAdapter(
-                IResource.class);
-        IProject project = resource.getProject();
-        boolean ok = false;
-        if (project != null) {
-            String libPath = traceLibraryPath.getText();
-            if (libPath == null || libPath.trim().isEmpty())
-                ok = TraceHelper.removeProjectPreference(project, "traceLibraryPath"); //$NON-NLS-1$
-            else
-                ok = TraceHelper.setProjectPreference(project, "traceLibraryPath", traceLibraryPath.getText()); //$NON-NLS-1$
-        }
-        return ok && super.performOk();
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/TraceLibraryPathWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/TraceLibraryPathWizardPage.java
deleted file mode 100644 (file)
index 4935553..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 MontaVista Software
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yufen Kuo (ykuo@mvista.com) - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.project.dialogs;
-
-import java.io.File;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class TraceLibraryPathWizardPage extends WizardPage {
-    private static final String LTTVTRACEREAD_LOADER_LIBNAME = "lttvtraceread_loader"; //$NON-NLS-1$
-    private Button browsePathButton;
-    private Text traceLibraryPath;
-
-    protected TraceLibraryPathWizardPage(String pageName) {
-        super(pageName);
-    }
-
-    @Override
-    public void createControl(Composite parent) {
-        Composite client = new Composite(parent, SWT.NONE);
-        client.setLayoutData(new GridData(GridData.FILL_BOTH));
-
-        GridLayout layout = new GridLayout(3, false);
-        layout.marginHeight = 0;
-        layout.marginWidth = 0;
-        client.setLayout(layout);
-
-        Label label = new Label(client, SWT.NONE);
-        label.setText(Messages.TraceLibraryPath_label);
-        traceLibraryPath = new Text(client, SWT.BORDER);
-        traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-        traceLibraryPath.addModifyListener(new ModifyListener() {
-
-            @Override
-            public void modifyText(ModifyEvent e) {
-                boolean valid = validatePage();
-                setPageComplete(valid);
-            }
-
-        });
-        browsePathButton = new Button(client, SWT.PUSH);
-        browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
-        browsePathButton.setText(Messages.TraceLibraryPath_browseBtn);
-        browsePathButton.addSelectionListener(new SelectionAdapter() {
-
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                String dir = new DirectoryDialog(Display.getDefault()
-                        .getActiveShell()).open();
-                if (dir != null) {
-                    traceLibraryPath.setText(dir);
-                }
-
-            }
-
-        });
-
-        Label noLabel = new Label(client, SWT.NONE);
-        noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
-
-        Label descTextLabel = new Label(client, SWT.WRAP);
-        descTextLabel.setText(Messages.TraceLibraryPathWizard_Message);
-        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
-        gd.widthHint = 400;
-        gd.horizontalSpan = 2;
-        descTextLabel.setLayoutData(gd);
-
-        Label noteBoldLabel = new Label(client, SWT.BOLD);
-        noteBoldLabel.setText(Messages.TraceLibraryPath_Note);
-        noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
-        Font font = noteBoldLabel.getFont();
-        if (font.getFontData().length > 0)
-            noteBoldLabel.setFont(new Font(client.getDisplay(), font
-                    .getFontData()[0].getName(), font.getFontData()[0]
-                    .getHeight(), SWT.BOLD));
-
-        Label noteTextLabel = new Label(client, SWT.WRAP);
-        noteTextLabel.setText(Messages.TraceLibraryPath_Message);
-        gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
-        gd.widthHint = 400;
-        gd.horizontalSpan = 2;
-        noteTextLabel.setLayoutData(gd);
-        setControl(client);
-
-    }
-
-    public String getPath() {
-        if (traceLibraryPath != null && !traceLibraryPath.isDisposed()) {
-            String path = traceLibraryPath.getText();
-            if (path != null && !path.trim().isEmpty())
-                return path;
-        }
-        return null;
-    }
-
-    private boolean validatePage() {
-        String path = getPath();
-        if (path != null) {
-            File file = new File(path);
-            if (file.exists() && file.isDirectory()) {
-                File loaderLib = new File(path,
-                        System.mapLibraryName(LTTVTRACEREAD_LOADER_LIBNAME));
-                if (!loaderLib.exists()) {
-                    setErrorMessage(Messages.TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists);
-                    return false;
-                }
-            } else {
-                setErrorMessage(Messages.TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists);
-                return false;
-            }
-        }
-        setErrorMessage(null);
-        return true;
-
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/project/dialogs/messages.properties
deleted file mode 100644 (file)
index 4d8158a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-NewProjectWizard_Title=LTTng Project
-NewProjectWizard_Description=Create an LTTng Project
-
-TraceLibraryPath_label = Trace Library Path:
-TraceLibraryPath_browseBtn = Browse...
-
-TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists = Specified trace library directory does not exist!
-TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists = Trace loader library not found at the specified path!
-TraceLibraryPathWizardPage_Title = LTTng Parsing Library
-TraceLibraryPathWizardPage_Description = Specify the directory which contains the LTTng parsing libraries
-TraceLibraryPathWizard_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\n\
-    The field is project specific and can be modified at any time from the LTTng project Properties page.\n\
-
-TraceLibraryPathProperty_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\
-
-TraceLibraryPath_Note = Note:
-TraceLibraryPath_Message = If you set this field, the parser library 'liblttvtraceread_loader.so' must be accessible from the path provided.\n\n\
-    In addition, the library 'liblttvtraceread_loader.so' must have 'RUNPATH' set with ${ORIGIN} so it can find the dependent libraries. \
-    'RUNPATH' can be set in the makefile or by using the patchelf utility.
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/Messages.java
deleted file mode 100644 (file)
index 072505f..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.tracecontrol.messages"; //$NON-NLS-1$
-    
-    public static String Property_Type_Provider_Filter;
-    public static String Property_Type_Provider;
-    
-    public static String Lttng_Resource_Root;
-    public static String Lttng_Resource_Target;
-    public static String Lttng_Resource_Provider;
-    public static String Lttng_Resource_Trace;
-    public static String Lttng_Resource_Marker;
-    public static String Lttng_Resource_Channel;
-    
-    public static String Filter_Provider_Dlg_Title;
-    public static String Filter_Provider_Page_Title;
-    public static String Filter_Provider_Page_Text;
-
-    public static String Filter_Target_Dlg_Title;
-    public static String Filter_Target_Page_Title;
-    public static String Filter_Target_Page_Text;
-    public static String Filter_Target_Target_Prompt_label;
-
-    public static String Filter_Trace_Dlg_Title;
-    public static String Filter_Trace_Page_Title;
-    public static String Filter_Trace_Page_Text;
-    public static String Filter_Trace_Target_Prompt_Label;
-    
-    public static String AllProviders;
-
-    public static String Trace_Connector_Service_Name;
-    public static String Trace_Connector_Service_Description;
-    public static String Trace_Connector_Service_Connect_Msg;
-    public static String Trace_Connector_Service_Disconnect_Msg;
-    public static String Trace_Connector_Service_Canceled_Msg;
-    
-    public static String Lttng_Control_Unknown_Event_Msg;
-    
-    public static String Lttng_Control_CommandError;
-
-    public static String Lttng_Control_ErrorNewTrace;
-    public static String Lttng_Control_ErrorConfigureTrace;
-    public static String Lttng_Control_ErrorConfigureMarkers;
-    public static String Lttng_Control_ErrorGetMarkers;
-    public static String Lttng_Control_ErrorGetMarkerInfo;
-    public static String Lttng_Control_ErrorStart;
-    public static String Lttng_Control_ErrorPause;
-    public static String Lttng_Control_ErrorStop;
-    public static String Lttng_Control_ErrorBrowse;
-    
-    public static String Lttng_Control_GetProvidersError;
-    public static String Lttng_Control_GetTargetsError;
-    public static String Lttng_Control_GetTracesError;
-    public static String Lttng_Control_GetMarkersError;
-    public static String Lttng_Control_GetMarkerInfoError;
-    
-    public static String Ltt_Controller_Service_Not_Connected_Msg;
-    public static String Ltt_Controller_Service_Unsupported_Msg;
-
-    public static String Lttng_Control_ErrorSetChannelEnable;
-    public static String Lttng_Control_ErrorSetChannelOverwrite;
-    public static String Lttng_Control_ErrorSetSubbufNum;
-    public static String Lttng_Control_ErrorSetSubbufSize;
-    public static String Lttng_Control_ErrorSetChannelTimer;
-    
-    public static String Lttng_Control_ErrorCreateTracePath;
-    
-    // Trace resource properties
-    public static String Ltt_Trace_Property_TracePathName;
-    public static String Ltt_Trace_Property_TracePathDescription;
-    public static String Ltt_Trace_Property_NumberOfChannelsName;
-    public static String Ltt_Trace_Property_NumberOfChannelsDescr;
-    public static String Ltt_Trace_Property_FlighRecorderModeName;
-    public static String Ltt_Trace_Property_FlighRecorderModeDesc;
-    public static String Ltt_Trace_Property_NormalModeName;
-    public static String Ltt_Trace_Property_NormalModeDesc;
-    public static String Ltt_Trace_Property_NetworkTraceName;
-    public static String Ltt_Trace_Property_NetWorkTraceDescr;
-    public static String Ltt_Trace_Property_TraceTransportName;
-    public static String Ltt_Trace_Property_TraceTransportDesc;
-    
-    public static String Ltt_ShutdownWarning;
-    public static String Ltt_NetworkTraceRunningWarning;
-    
-    public static String Ltt_TimeoutMsg;
-    
-    public static String ConfigureMarkersDialog_Select_All;
-    public static String ConfigureMarkersDialog_Call;
-    public static String ConfigureMarkersDialog_Cancel;
-    public static String ConfigureMarkersDialog_EventId;
-    public static String ConfigureMarkersDialog_Format;
-    public static String ConfigureMarkersDialog_Location;
-    public static String ConfigureMarkersDialog_NameColumn;
-    public static String ConfigureMarkersDialog_Ok;
-    public static String ConfigureMarkersDialog_Probe_Single;
-    public static String ConfigureMarkersDialog_Deselect_All;
-    public static String ConfigureMarkersDialog_Title;
-    
-    public static String ConfigureTraceDialog_Append;
-    public static String ConfigureTraceDialog_Browse;
-    public static String ConfigureTraceDialog_Cancel;
-    public static String ConfigureTraceDialog_Finish;
-    public static String ConfigureTraceDialog_Mode_Flight_Recorder;
-    public static String ConfigureTraceDialog_Host;
-    public static String ConfigureTraceDialog_Target;
-    public static String ConfigureTraceDialog_Mode_None;
-    public static String ConfigureTraceDialog_Mode_Normal;
-    public static String ConfigureTraceDialog_Num_Lttd_Threads;
-    public static String ConfigureTraceDialog_Error_Invalid_Folder;
-    public static String ConfigureTraceDialog_Error_Invalid_Path;
-    public static String ConfigureTraceDialog_Error_Multiple_Seps;
-    public static String ConfigureTraceDialog_Error_File_Exists;
-    public static String ConfigureTraceDialog_Error_Can_Not_Write;
-    public static String ConfigureTraceDialog_Title;
-    public static String ConfigureTraceDialog_Trace_Location;
-    public static String ConfigureTraceDialog_Trace_Mode;
-    public static String ConfigureTraceDialog_Trace_Path;
-    public static String ConfigureTraceDialog_Trace_Transport;
-    
-    public static String NewTraceDialog_Title;
-    public static String NewTraceDialog_TraceName;
-    public static String NewTraceDialog_Tracing_Project;
-    public static String NewTraceDialog_Error_No_Name;
-    public static String NewTraceDialog_Error_No_Path;
-    public static String NewTraceDialog_Error_No_NumLttdThreads;
-    public static String NewTraceDialog_Error_No_Project;
-    public static String NewTraceDialog_Error_Already_Exists;
-    public static String NewTraceDialog_Error_Invalid_First_Char;
-    public static String NewTraceDialog_Error_Invalid_Name;
-    
-    public static String SeletctTracePathDialog_Title;
-    
-    public static String DeleteTrace_ConfirmMessage;
-       public static String DeleteTrace_ConfirmTitle;
-
-       public static String ImportToProject_AlreadyExists;
-       public static String ImportToProject_ImportFailed;
-       public static String ImportToProject_NoFileServiceSubsystem;
-       public static String ImportToProject_NoProjectTraceFolder;
-       public static String ImportToProject_NoRemoteTraceFolder;
-       
-       public static String ImportTraceDialog_ImportButton;
-       public static String ImportTraceDialog_LinkOnly;
-       public static String ImportTraceDialog_NameLabel;
-       public static String ImportTraceDialog_ProjectColumn;
-       public static String ImportTraceDialog_TableLabel;
-       public static String ImportTraceDialog_Title;
-       
-       public static String ChannelConfigPage_BufferOverrideTooltip;
-    public static String ChannelConfigPage_ChannelEnabled;
-    public static String ChannelConfigPage_ChannelEnabledTooltip;
-    public static String ChannelConfigPage_ChannelName;
-    public static String ChannelConfigPage_ChannelNameTooltip;
-    public static String ChannelConfigPage_ChannelOverride;
-    public static String ChannelConfigPage_ChannelTimer;
-    public static String ChannelConfigPage_ChannelTimerTooltip;
-    public static String ChannelConfigPage_NumSubBuf;
-    public static String ChannelConfigPage_NumSubBufTooltip;
-    public static String ChannelConfigPage_PageTitle;
-    public static String ChannelConfigPage_SubBufSize;
-    public static String ChannelConfigPage_SubBufSizeTooltip;
-    
-    public static String ChannelConfigPage_EnableAll;
-    public static String ChannelConfigPage_DisableAll;
-    public static String ChannelConfigPage_EnableAllBufferOverride;
-    public static String ChannelConfigage_DisableAllBufferOverride;
-    public static String ChannelConfigPage_SetAll;
-    public static String ChannelConfigPage_SetAllNumSubBuf;
-    public static String channelConfigPage_SetAllSubBufSize;
-    public static String ChannelConfigPage_SetAllChannelTimer;
-
-    static {
-        // initialize resource bundle
-        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/TraceControlConstants.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/TraceControlConstants.java
deleted file mode 100644 (file)
index 3e95577..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.tracecontrol;
-
-
-@SuppressWarnings("nls")
-public class TraceControlConstants {
-
-    // LTTng Resource Constants
-    public static final String Rse_Provider_Resource_Remote_Type_Category = "providers";
-    public static final String Rse_Provider_Resource_Remote_Type = "provider";
-    public static final String Rse_Target_Resource_Remote_Type_Category = "targets";
-    public static final String Rse_Target_Resource_Remote_Type = "target";
-    public static final String Rse_Trace_Resource_Remote_Type_Category = "traces";
-    public static final String Rse_Trace_Resource_Remote_Type = "trace";
-    public static final String Lttng_Providers_Name = "Providers";
-    public static final String Lttng_Ust_TraceName = "auto";
-    public static final String Lttng_Trace_Transport_Relay = "relay";
-    public static final String Lttng_Control_AllChannels = "all";
-    public static final String Lttng_Control_New_Event_Data = "new_trace_data";
-    public static final String Lttng_Control_Unwrite_Trace_Data_Event = "unwrite_trace_data";
-    public static final String Lttng_Control_Trace_Done_Event = "trace_done";
-
-    // the parameter names have to be coordinated with lttctltraceinfo.c in lttng-agent
-    public static final String ACTIVE_TRACE_INFO_PARAM_DESTINATION = "destination";
-    public static final String ACTIVE_TRACE_INFO_PARAM_NUM_THREAD = "numThread";
-    public static final String ACTIVE_TRACE_INFO_PARAM_NORMAL_ONLY = "normal_only";
-    public static final String ACTIVE_TRACE_INFO_PARAM_FLIGHT_ONLY = "flight_only";
-    public static final String ACTIVE_TRACE_INFO_PARAM_ENABLED = "enabled";
-
-    // the destination prefixes have to be coordinated with lttctlkerntransfer.c in lttng-agent
-    public static final String ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL = "local:";
-    public static final String ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK = "network:";
-
-    // Default timeout for TCF tasks (in seconds)
-    public static final int DEFAULT_TCF_TASK_TIMEOUT = 10;
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureMarkers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureMarkers.java
deleted file mode 100644 (file)
index 0f2bf2d..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs.ConfigureMarkersDialog;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>ConfigureMarkers</u></b>
- * <p>
- * Action implementation to configure markers.
- * </p>
- */
-public class ConfigureMarkers implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private List<TargetResource> fSelectedTargets;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    public ConfigureMarkers() {
-        fSelectedTargets = new ArrayList<TargetResource>();
-    }
-    
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-
-    }
-
-    /**
-     * Returns the first of all selected targets.
-     * 
-     * @return first selected target.
-     */
-    protected TargetResource getFirstSelectedTarget() {
-        if (fSelectedTargets.size() > 0) {
-            return (TargetResource) fSelectedTargets.get(0);
-        }
-        return null;
-    }
-
-    /**
-     * Returns the SubSystem reference for the selected targets.
-     * 
-     * @return Trace SubSystem
-     */
-    protected ISubSystem getSubSystem() {
-        return getFirstSelectedTarget().getSubSystem();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-        Shell shell = getShell();
-
-        final TargetResource tr = (TargetResource) fSelectedTargets.get(0);
-        TraceSubSystem subSystem = (TraceSubSystem)tr.getSubSystem();
-
-        ConfigureMarkersDialog dialog = new ConfigureMarkersDialog(shell, subSystem);
-        Map<String, Boolean> map = dialog.open(tr);
-        if (map == null) {
-            return;
-        }
-
-        for (Iterator<Map.Entry<String, Boolean>> it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry<String, Boolean> entry = (Map.Entry<String, Boolean>) it.next();
-            final String key = (String) entry.getKey();
-
-            final Boolean value = (Boolean) entry.getValue();
-
-            try {
-
-                final ILttControllerService service = subSystem.getControllerService();
-
-                // Create future task
-                @SuppressWarnings("unused")
-                Boolean ok = new TCFTask<Boolean>() {
-                    @Override
-                    public void run() {
-
-                        // Set marker enable using Lttng controller service proxy
-                        service.setMarkerEnable(tr.getParent().getName(), tr.getName(), key, value.booleanValue(), new ILttControllerService.DoneSetMarkerEnable() {
-
-                            @Override
-                            public void doneSetMarkerEnable(IToken token, Exception error, Object str) {
-                                if (error != null) {
-                                    // Notify with error
-                                    error(error);
-                                    return;
-                                }
-
-                                // Notify about success
-                                done(Boolean.valueOf(true));
-                            }
-                        });
-                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            } catch (Exception e) {
-                SystemMessageException sysExp;
-                if (e instanceof SystemMessageException) {
-                    sysExp = (SystemMessageException)e;
-                } else {
-                    sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-                }
-                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorConfigureMarkers + " (" +  //$NON-NLS-1$
-                        Messages.Lttng_Resource_Target + ": "  + tr.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        if (selection instanceof IStructuredSelection) {
-            fSelectedTargets.clear();
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TargetResource) {
-                    fSelectedTargets.add((TargetResource)obj);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java
deleted file mode 100644 (file)
index 3894a9c..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.util.Iterator;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards.ConfigureTraceWizard;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>ConfigureTrace</u></b>
- * <p>
- * Action implementation to configure a trace.
- * </p>
- */
-public class ConfigureTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    private TraceResource fSelectedTrace = null;
-    private IStructuredSelection fSelection = null;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    public ConfigureTrace() {
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-        ConfigureTraceWizard wizard = new ConfigureTraceWizard();
-        wizard.init(SystemBasePlugin.getActiveWorkbenchWindow().getWorkbench(), fSelection);
-        WizardDialog wDialog= new WizardDialog(getShell(), wizard);
-        wDialog.open();
-        if (wDialog.getReturnCode() != Window.OK) {
-            return;
-        }
-        
-        final TraceConfig result = wizard.getTraceConfig();
-
-        if (result != null) {
-//            try {
-
-                // Update channel settings
-                TraceChannels channels = result.getTraceChannels();
-
-                for (Iterator<String> iterator = channels.keySet().iterator(); iterator.hasNext();) {
-                    String chanName = (String) iterator.next();
-                    TraceChannel chan = channels.get(chanName);
-
-                    boolean doIt = false;
-
-                    // If we channel settings have been updated send the relevant command to the agent
-                    TraceChannel other = new TraceChannel(chan.getName());
-
-                    if (fSelectedTrace.getTraceConfig() == null || fSelectedTrace.getTraceConfig().getTraceChannels() == null) {
-                        // Do the update since channels haven't been configured previously (or we re-connected to the agent)  
-                        doIt = true; 
-                    } else if (fSelectedTrace.getTraceConfig() != null && fSelectedTrace.getTraceConfig().getTraceChannels() != null) {
-                        // Channels has been configured previously, compare new settings with old. Do the update if necessary 
-                        TraceChannel other2 = fSelectedTrace.getTraceConfig().getTraceChannels().get(chanName);
-                        if (other2 != null) {
-                            other = other2;
-                        }
-
-                        doIt = !(chan.equals(other));
-                    }
-
-                    // Please note that currently, the agent doesn't support the retrieval of channel settings. 
-                    // Therefore, the current settings might not be known!
-
-                    if (doIt) {
-                        if (!fSelectedTrace.isUst()) {
-                            // Update kernel tracing related parameters (not applicable for UST)
-
-                            if (chan.isEnabledStatusKnown()) {
-                                if(!other.isEnabledStatusKnown() || (chan.isEnabled() != other.isEnabled()) ) {
-                                    setChannelEnable(chan.getName(), chan.isEnabled());
-                                }
-                            }
-
-                            if (chan.isChannelOverrideStatusKnown()) {
-                                if(!other.isChannelOverrideStatusKnown() || (chan.isChannelOverride() != other.isChannelOverride())) {
-                                    setChannelOverwrite(chanName, chan.isChannelOverride());
-                                }
-                            }
-
-                            if (chan.getSubbufNum() != other.getSubbufNum()) {
-                                setChannelSubbufNum(chanName, chan.getSubbufNum());
-                            }
-
-                            if (chan.getSubbufSize() != other.getSubbufSize()) {
-                                setChannelSubbufSize(chanName, chan.getSubbufSize());
-                            }
-                        }
-
-                        if (chan.getTimer() != other.getTimer()) {
-                            setChannelTimer(chanName, chan.getTimer());    
-                        }
-                    }
-                }
-                // Update state of trace
-                if (fSelectedTrace.getTraceState() == TraceState.CREATED) {
-                    fSelectedTrace.setTraceState(TraceState.CONFIGURED);
-                }
-
-                fSelectedTrace.setTraceConfig(result);
-
-                ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-                registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, fSelectedTrace, fSelectedTrace.getParent(), fSelectedTrace.getSubSystem(), null);
-
-//            } catch (SystemMessageException e) {
-//                SystemMessageException sysExp;
-//                if (e instanceof SystemMessageException) {
-//                    sysExp = (SystemMessageException)e;
-//                } else {
-//                    sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-//                }
-//                
-//                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorConfigureTrace + " (" +  //$NON-NLS-1$
-//                        Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-//            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        if (selection instanceof IStructuredSelection) {
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            fSelection = (IStructuredSelection) selection;
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TraceResource) {
-                    fSelectedTrace = (TraceResource)obj;
-                    break;
-                }
-            }
-        }
-        else {
-            fSelection = null;
-        }
-        
-    }
-
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-    
-    /*
-     * Enable or disable a channel on the remote system. 
-     */
-    private void setChannelEnable(final String channelName, final boolean enabled) {
-        try {
-            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
-
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Set marker enable using Lttng controller service proxy
-                    service.setChannelEnable(fSelectedTrace.getParent().getParent().getName(),
-                            fSelectedTrace.getParent().getName(), 
-                            fSelectedTrace.getName(), 
-                            channelName, 
-                            enabled,  
-                            new ILttControllerService.DoneSetChannelEnable() {
-
-                        @Override
-                        public void doneSetChannelEnable(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException)e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetChannelEnable + " (" +  //$NON-NLS-1$
-                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
-                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-    }
-
-    // setChannelOverwrite* provider target trace channel enable
-    private void setChannelOverwrite(final String channelName, final boolean override) {
-        try {
-            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
-
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Set marker enable using Lttng controller service proxy
-                    service.setChannelOverwrite(fSelectedTrace.getParent().getParent().getName(),
-                            fSelectedTrace.getParent().getName(), 
-                            fSelectedTrace.getName(), 
-                            channelName, 
-                            override,  
-                            new ILttControllerService.DoneSetChannelOverwrite() {
-
-                        @Override
-                        public void doneSetChannelOverwrite(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException)e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetChannelOverwrite + " (" +  //$NON-NLS-1$
-                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
-                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-    }
-    
-    /*
-     * Setup the number of sub-buffers on the remote system.
-     */
-    private void setChannelSubbufNum(final String channelName, final long numSubBuf) {
-        try {
-            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
-
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Set marker enable using Lttng controller service proxy
-                    service.setChannelSubbufNum(fSelectedTrace.getParent().getParent().getName(),
-                            fSelectedTrace.getParent().getName(), 
-                            fSelectedTrace.getName(), 
-                            channelName, 
-                            numSubBuf,  
-                            new ILttControllerService.DoneSetChannelSubbufNum() {
-
-                        @Override
-                        public void doneSetChannelSubbufNum(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException)e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetSubbufNum + " (" +  //$NON-NLS-1$
-                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
-                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-    }
-
-    /*
-     * Setup the size of the sub-buffer on the remote system.
-     */
-    private void setChannelSubbufSize(final String channelName, final long subBufSize) {
-        try {
-            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
-
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Set marker enable using Lttng controller service proxy
-                    service.setChannelSubbufSize(fSelectedTrace.getParent().getParent().getName(),
-                            fSelectedTrace.getParent().getName(), 
-                            fSelectedTrace.getName(), 
-                            channelName, 
-                            subBufSize,  
-                            new ILttControllerService.DoneSetChannelSubbufSize() {
-
-                        @Override
-                        public void doneSetChannelSubbufSize(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException)e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetSubbufSize + " (" +  //$NON-NLS-1$
-                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
-                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-    }
-    
-    /*
-     * Setup up the channel timer on the remote system.
-     */
-    private void setChannelTimer(final String channelName, final long timer) {
-        try {
-            final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();
-
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Set marker enable using Lttng controller service proxy
-                    service.setChannelTimer(fSelectedTrace.getParent().getParent().getName(),
-                            fSelectedTrace.getParent().getName(), 
-                            fSelectedTrace.getName(), 
-                            channelName, 
-                            timer,  
-                            new ILttControllerService.DoneSetChannelTimer() {
-
-                        @Override
-                        public void doneSetChannelTimer(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException)e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorSetChannelTimer + " (" +  //$NON-NLS-1$
-                    Messages.Lttng_Resource_Trace + ": "  + fSelectedTrace.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
-                    Messages.Lttng_Resource_Channel + ": " + channelName + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-        }        
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/CreateNewTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/CreateNewTrace.java
deleted file mode 100644 (file)
index 6e4e2e1..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs.NewTraceDialog;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>CreateNewTrace</u></b>
- * <p>
- * Action implementation to create a new trace.
- * </p>
- */
-public class CreateNewTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final List<TargetResource> fSelectedFiles;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor for CreateNewTrace.
-     */
-    public CreateNewTrace() {
-        fSelectedFiles = new ArrayList<TargetResource>();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
-     * action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-    }
-
-    /**
-     * Returns the first selected target resource.
-     * 
-     * @return first selected target resource
-     */
-    protected TargetResource getFirstSelectedTarget() {
-        if (fSelectedFiles.size() > 0) {
-            return fSelectedFiles.get(0);
-        }
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction action) {
-        Shell shell = getShell();
-        final TargetResource targetResource = getFirstSelectedTarget();
-        TraceSubSystem subSystem = (TraceSubSystem) targetResource.getSubSystem();
-        NewTraceDialog dialog = new NewTraceDialog(shell, subSystem, targetResource);
-
-        final TraceConfig traceConfig = dialog.open();
-
-        if (traceConfig == null) {
-            return;
-        }
-
-        try {
-            final ILttControllerService service = subSystem.getControllerService();
-
-            TraceResource trace = new TraceResource(targetResource.getSubSystem(), service);
-            trace.setName(traceConfig.getTraceName());
-            trace.setParent(targetResource);
-            trace.setTraceConfig(traceConfig);
-
-            if (targetResource.isUst()) {
-                boolean ok = setupUstLocation(service, targetResource, traceConfig);
-                if (!ok) {
-                    return;
-                }
-            }
-
-            trace.setupTrace();
-
-            if (!targetResource.isUst()) {
-
-                // Enable all channels by default
-                trace.setChannelEnable(TraceControlConstants.Lttng_Control_AllChannels, true);
-
-                // Set overwrite mode for all channels according to user
-                // selection (true for flight recorder, false for normal)
-                trace.setChannelOverwrite(TraceControlConstants.Lttng_Control_AllChannels, traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE);
-
-                // Set channel timer for all channels
-                final long period = 1000;
-                trace.setChannelTimer(TraceControlConstants.Lttng_Control_AllChannels, period);
-
-                // Set subbuffer size for all channels
-                final long subbufSize = 16384;
-                trace.setChannelSubbufSize(TraceControlConstants.Lttng_Control_AllChannels, subbufSize);
-
-                // Set number of subbuffers for all channels
-                final long subbufNum = 2;
-                trace.setChannelSubbufNum(TraceControlConstants.Lttng_Control_AllChannels, subbufNum);
-            }
-
-            if (traceConfig.isNetworkTrace()) {
-
-                File newDir = new File(traceConfig.getTracePath());
-                if (!newDir.exists()) {
-                    boolean created = newDir.mkdirs();
-                    if (!created) {
-                        throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
-                    }
-                }
-            }
-
-            if (trace.isUst()) {
-                // in UST the tracing is started after setupTrace!!
-                trace.setTraceState(TraceState.STARTED);
-            } else {
-                trace.setTraceState(TraceState.CONFIGURED);
-            }
-
-            targetResource.addTrace(trace);
-
-            ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-            registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, trace, targetResource, subSystem, null);
-
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException) e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorNewTrace + " (" + //$NON-NLS-1$
-                    Messages.Lttng_Resource_Trace + ": " + traceConfig.getTraceName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-
-            return;
-        }
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
-     * .IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public void selectionChanged(IAction action, ISelection selection) {
-        if (selection instanceof IStructuredSelection) {
-            fSelectedFiles.clear();
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TargetResource) {
-                    fSelectedFiles.add((TargetResource) obj);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.
-     * IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-
-    /*
-     * Setup the trace location for UST.
-     */
-    private boolean setupUstLocation(final ILttControllerService service, final TargetResource targetResource, final TraceConfig traceConfig)
-            throws Exception {
-        if (traceConfig.isNetworkTrace()) {
-            File localDir = new File(traceConfig.getTracePath());
-            if (!localDir.exists()) {
-                boolean success = localDir.mkdirs();
-                if (!success) {
-                    return false;
-                }
-            }
-
-            // Create future task
-            boolean ok = new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Setup trace location using Lttng controller service proxy
-                    service.writeTraceNetwork(targetResource.getParent().getName(), targetResource.getName(), traceConfig.getTracePath(), traceConfig.getTraceName(),
-                            traceConfig.getNumChannel(), traceConfig.getIsAppend(), traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE,
-                            traceConfig.getMode() == TraceConfig.NORMAL_MODE, new ILttControllerService.DoneWriteTraceNetwork() {
-
-                                @Override
-                                public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
-                                    if (error != null) {
-                                        // Notify with error
-                                        error(error);
-                                        return;
-                                    }
-
-                                    // Notify about success
-                                    done(true);
-                                }
-                            });
-                }
-            }.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            return ok;
-        } else {
-            // Create future task
-            boolean ok = new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Setup trace location using Lttng controller service proxy
-                    service.writeTraceLocal(targetResource.getParent().getName(), targetResource.getName(), traceConfig.getTraceName(),
-                            traceConfig.getTracePath(), traceConfig.getNumChannel(), traceConfig.getIsAppend(),
-                            traceConfig.getMode() == TraceConfig.NORMAL_MODE, traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE,
-                            new ILttControllerService.DoneWriteTraceLocal() {
-
-                                @Override
-                                public void doneWriteTraceLocal(IToken token, Exception error, Object str) {
-                                    if (error != null) {
-                                        // Notify with error
-                                        error(error);
-                                        return;
-                                    }
-
-                                    // Notify about success
-                                    done(true);
-                                }
-                            });
-                }
-            }.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            return ok;
-        }
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/DeleteTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/DeleteTrace.java
deleted file mode 100644 (file)
index cc247b7..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>DeleteTrace</u></b>
- * <p>
- * Action implementation to delete a new trace.
- * </p>
- */
-public class DeleteTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private List<TraceResource> fSelectedTraces;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    
-    public DeleteTrace() {
-        fSelectedTraces = new ArrayList<TraceResource>();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
-    }
-
-    /**
-     * Gets the first selected target.
-     * 
-     * @return first selected target.
-     */
-    protected TraceResource getSelectedTarget() {
-        if (fSelectedTraces.size() > 0) {
-            return (TraceResource) fSelectedTraces.get(0);
-        }
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-       
-               boolean confirm = MessageDialog.openConfirm(getShell(),
-                               Messages.DeleteTrace_ConfirmTitle,
-                               Messages.DeleteTrace_ConfirmMessage);
-               if (!confirm) {
-                       return;
-               }
-
-        int size = fSelectedTraces.size();
-        for (int i = 0; i < size; i++) {
-
-            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
-
-            trace.getParent().removeTrace(trace);
-            
-            ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-            registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, trace, trace.getParent(), trace.getSubSystem(), null);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        
-        if (selection instanceof IStructuredSelection) {
-            fSelectedTraces.clear();
-
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TraceResource) {
-                    fSelectedTraces.add((TraceResource)obj);
-                }
-            }
-        }
-
-    }
-
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ImportToProject.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ImportToProject.java
deleted file mode 100644 (file)
index 9ed2384..0000000
+++ /dev/null
@@ -1,346 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs.ImportTraceDialog;
-import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.IFileService;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-
-/**
- * <b><u>ImportToProject</u></b>
- * <p>
- * Action implementation to import a trace to a LTTng project.
- * </p>
- */
-public class ImportToProject implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-
-       public static final String TRACE_FOLDER_NAME = "Traces"; //$NON-NLS-1$
-       
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private List<TraceResource> fSelectedTraces;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    public ImportToProject() {
-        fSelectedTraces = new ArrayList<TraceResource>();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
-    }
-
-    /**
-     * Gets the first selected trace.
-     * @return first selected trace
-     */
-    protected TraceResource getFirstSelectedTrace() {
-        if (fSelectedTraces.size() > 0) {
-            return (TraceResource) fSelectedTraces.get(0);
-        }
-        return null;
-    }
-
-    /**
-     * Gets the trace SubSystem for the selected trace.
-     * 
-     * @return trace SubSystem
-     */
-    protected ISubSystem getSubSystem() {
-        return getFirstSelectedTrace().getSubSystem();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-        for (int i = 0; i < fSelectedTraces.size(); i++) {
-
-            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
-            ImportTraceDialog dialog = new ImportTraceDialog(getShell(), trace);
-            int result = dialog.open();
-            if (result == Dialog.OK) {
-               IProject project = dialog.getProject();
-               String traceName = dialog.getTraceName();
-               if (trace.getTraceConfig().isNetworkTrace()) {
-                       if (dialog.getLinkOnly()) {
-                               linkTrace(getShell(), trace, project, traceName);
-                       } else {
-                               copyTrace(trace, project, traceName);
-                       }
-               } else {
-                       downloadTrace(trace, project, traceName);
-               }
-            }
-        }
-    }
-
-    /*
-     * method to download a trace from the remote system.
-     */
-    private void downloadTrace(TraceResource trace, IProject project, String traceName) {
-               try {
-                       IHost host = trace.getSubSystem().getHost();
-                       ISubSystem[] sss = RSECorePlugin.getTheSystemRegistry().getSubsystems(host, IFileServiceSubSystem.class);
-                       if (sss.length == 0 || !(sss[0] instanceof FileServiceSubSystem)) {
-                               MessageDialog.openWarning(getShell(),
-                                               Messages.ImportToProject_ImportFailed,
-                                               Messages.ImportToProject_NoFileServiceSubsystem);
-                               return;
-                       }
-                       FileServiceSubSystem fsss = (FileServiceSubSystem) sss[0];
-                       
-                       IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
-                       if (!traceFolder.exists()) {
-                               MessageDialog.openWarning(getShell(),
-                                               Messages.ImportToProject_ImportFailed,
-                                               Messages.ImportToProject_NoProjectTraceFolder);
-                               return;
-                       }
-
-                       IRemoteFile remoteFolder = fsss.getRemoteFileObject(trace.getTraceConfig().getTracePath(), new NullProgressMonitor());
-                       if (remoteFolder == null || !remoteFolder.exists()) {
-                               MessageDialog.openWarning(getShell(),
-                                               Messages.ImportToProject_ImportFailed,
-                                               Messages.ImportToProject_NoRemoteTraceFolder);
-                               return;
-                       }
-                       
-                       IFolder folder = traceFolder.getFolder(traceName);
-                       if (folder.exists()) {
-                               MessageDialog.openWarning(getShell(),
-                                               Messages.ImportToProject_ImportFailed,
-                                               Messages.ImportToProject_AlreadyExists);
-                               return;
-                       } else {
-                               folder.create(true, true, null);
-                       }
-                       
-                       IRemoteFile[] sources = fsss.list(remoteFolder, IFileService.FILE_TYPE_FILES, new NullProgressMonitor());
-
-                       String[] destinations = new String[sources.length];
-                       String[] encodings = new String[sources.length];
-                       for (int i = 0; i < sources.length; i++) {
-                               destinations[i] = folder.getLocation().addTrailingSeparator().append(sources[i].getName()).toString();
-                               encodings[i] = null;
-                       }
-                       
-                       fsss.downloadMultiple(sources, destinations, encodings, new NullProgressMonitor());
-                       
-               } catch (SystemMessageException e) {
-                       MessageDialog.openWarning(getShell(),
-                                       Messages.ImportToProject_ImportFailed,
-                                       e.getMessage());
-               } catch (CoreException e) {
-                       MessageDialog.openWarning(getShell(),
-                                       Messages.ImportToProject_ImportFailed,
-                                       e.getMessage());
-               }
-       }
-
-    /*
-     * Method to copy a trace residing on the local host. 
-     */
-       private void copyTrace(TraceResource trace, IProject project, String traceName) {
-               IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
-               if (!traceFolder.exists()) {
-                       MessageDialog.openWarning(getShell(),
-                                       Messages.ImportToProject_ImportFailed,
-                                       Messages.ImportToProject_NoProjectTraceFolder);
-                       return;
-               }
-               
-               IPath containerPath = traceFolder.getFullPath().addTrailingSeparator().append(traceName);
-               
-               File sourceFolder = new File(trace.getTraceConfig().getTracePath());
-               
-               IOverwriteQuery overriteImplementor = new IOverwriteQuery(){
-                       @Override
-                       public String queryOverwrite(String pathString) {
-                               MessageDialog.openWarning(getShell(),
-                                               Messages.ImportToProject_ImportFailed,
-                                               Messages.ImportToProject_AlreadyExists);
-                               return IOverwriteQuery.NO_ALL;
-                       }};
-               
-               ImportOperation operation = new ImportOperation(
-                               containerPath,
-                               sourceFolder,
-                               FileSystemStructureProvider.INSTANCE,
-                               overriteImplementor);
-               operation.setCreateContainerStructure(false);
-               
-               try {
-                       operation.run(new NullProgressMonitor());
-               } catch (InvocationTargetException e) {
-                       MessageDialog.openWarning(getShell(),
-                                       Messages.ImportToProject_ImportFailed,
-                                       e.getMessage());
-               } catch (InterruptedException e) {
-                       MessageDialog.openWarning(getShell(),
-                                       Messages.ImportToProject_ImportFailed,
-                                       e.getMessage());
-               }
-       }
-
-    /*
-     * Method to create a symbolic link to a trace residing on the local host. 
-     */
-    public static void linkTrace(Shell shell, TraceResource trace, IProject project, String traceName) {
-        IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
-        if (!traceFolder.exists()) {
-            MessageDialog.openWarning(shell,
-                    Messages.ImportToProject_ImportFailed,
-                    Messages.ImportToProject_NoProjectTraceFolder);
-            return;
-        }
-
-        IFolder folder = traceFolder.getFolder(traceName);
-        if (folder.exists()) {
-            MessageDialog.openWarning(shell,
-                    Messages.ImportToProject_ImportFailed,
-                    Messages.ImportToProject_AlreadyExists);
-            return;
-        }
-
-        File sourceFolder = new File(trace.getTraceConfig().getTracePath());
-
-        try {
-            folder.createLink(sourceFolder.toURI(), IResource.REPLACE, null);
-            // Set the trace properties for this resource
-            // FIXME: update from extension point properties
-            folder.setPersistentProperty(TmfTraceElement.TRACEBUNDLE, LTTngUiPlugin.PLUGIN_ID);
-            folder.setPersistentProperty(TmfTraceElement.TRACETYPE, "org.eclipse.linuxtools.lttng.tracetype.kernel"); //$NON-NLS-1$
-            folder.setPersistentProperty(TmfTraceElement.TRACEICON, "icons/obj16/tux2.png"); //$NON-NLS-1$
-        } catch (CoreException e) {
-            MessageDialog.openWarning(shell,
-                    Messages.ImportToProject_ImportFailed,
-                    e.getMessage());
-        }
-    }
-
-       /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        if (selection instanceof IStructuredSelection) {
-            fSelectedTraces.clear();
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TraceResource) {
-                    fSelectedTraces.add((TraceResource)obj);
-                }
-            }
-        }
-    }
-
-    /**
-     * Set selected traces
-     * @param traces
-     */
-    public void setSelectedTraces(List<TraceResource> traces) {
-        fSelectedTraces = traces; 
-    }
-    
-    
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/PauseTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/PauseTrace.java
deleted file mode 100644 (file)
index 83ad7a1..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>PauseTrace</u></b>
- * <p>
- * Action implementation to pause a trace.
- * </p>
- */
-public class PauseTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private List<TraceResource> fSelectedTraces;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    public PauseTrace() {
-        fSelectedTraces = new ArrayList<TraceResource>();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-        for (int i = 0; i < fSelectedTraces.size(); i++) {
-
-            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
-            TraceSubSystem subSystem = (TraceSubSystem)trace.getSubSystem();
-            
-            try {
-                final ILttControllerService service = subSystem.getControllerService();
-
-                // Create future task
-                @SuppressWarnings("unused")
-                Boolean success = new TCFTask<Boolean>() {
-                    @Override
-                    public void run() {
-
-                        // Setup trace  using Lttng controller service proxy
-                        service.pauseTrace(trace.getParent().getParent().getName(), trace.getParent().getName(), trace.getName(), new ILttControllerService.DonePauseTrace() {
-
-                            @Override
-                            public void donePauseTrace(IToken token, Exception error, Object str) {
-                                if (error != null) {
-                                    // Notify with error
-                                    error(error);
-                                    return;
-                                }
-
-                                // Notify about success
-                                done(Boolean.valueOf(true));
-                            }
-                        });
-                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-
-                    trace.setTraceState(TraceState.PAUSED);
-                    
-                    ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-                    registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
-                         
-            } catch (Exception e) {
-                SystemMessageException sysExp;
-                if (e instanceof SystemMessageException) {
-                    sysExp = (SystemMessageException)e;
-                } else {
-                    sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-                }
-                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorPause + " (" +  //$NON-NLS-1$
-                        Messages.Lttng_Resource_Trace + ": "  + trace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        if (selection instanceof IStructuredSelection) {
-            fSelectedTraces.clear();
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TraceResource) {
-                    fSelectedTraces.add((TraceResource)obj);
-                }
-            }
-        }
-    }
-
-    /**
-     * Set selected traces
-     * @param traces
-     */
-    public void setSelectedTraces(List<TraceResource> traces) {
-        fSelectedTraces = traces; 
-    }
-    
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/StartTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/StartTrace.java
deleted file mode 100644 (file)
index a431197..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs.SelectTracePathDialog;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>StartTrace</u></b>
- * <p>
- * Action implementation to start and resume a trace. Starting a trace the first time will allocate all 
- * necessary resources and configure all necessary parameters on the remote system.
- * </p>
- */
-public class StartTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private List<TraceResource> fSelectedTraces;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    public StartTrace() {
-        fSelectedTraces = new ArrayList<TraceResource>();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-        for (int i = 0; i < fSelectedTraces.size(); i++) {
-
-            TraceResource trace = (TraceResource) fSelectedTraces.get(i);
-            TraceSubSystem subSystem = (TraceSubSystem)trace.getSubSystem();
-
-            TraceConfig traceConfig = trace.getTraceConfig();
-            if (traceConfig != null) {
-                try {
-                    ILttControllerService service = subSystem.getControllerService();
-                    if (trace.getTraceState() == TraceState.CONFIGURED) {
-                        setTraceTransport(service, trace, traceConfig);
-                        allocTrace(service, trace, traceConfig);
-                       setupLocation(service, trace, traceConfig);
-                    }
-                    // for network traces and if trace path is not available, open a dialog box for the user to specify the trace path
-                    else if (traceConfig.isNetworkTrace() && (TraceConfig.InvalidTracePath.equals(traceConfig.getTracePath()))) {
-                        
-                        SelectTracePathDialog selectDialog = new SelectTracePathDialog(SystemBasePlugin.getActiveWorkbenchShell());
-
-                        if (selectDialog.open() == Window.OK) {
-                            traceConfig.setTracePath(selectDialog.getTracePath());
-                        }
-                        else {
-                            // we don't have place to store the trace files ... go to the next trace
-                            continue;
-                        }
-                    }
-
-                    startTrace(service, trace, traceConfig);
-
-                    trace.setTraceState(TraceState.STARTED);
-
-                    if (trace.isNetworkTraceAndStarted()) {
-                        LiveTraceManager.setLiveTrace(trace.getTraceConfig().getTracePath(), true);
-                    }
-
-                    // Refresh display
-                    ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-                    registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
-
-                } catch (Exception e) {
-                    SystemMessageException sysExp;
-                    if (e instanceof SystemMessageException) {
-                        sysExp = (SystemMessageException)e;
-                    } else {
-                        sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-                    }
-                    SystemBasePlugin.logError(Messages.Lttng_Control_ErrorStart + " (" +  //$NON-NLS-1$
-                            Messages.Lttng_Resource_Trace + ": "  + trace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-                } 
-           }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        if (selection instanceof IStructuredSelection) {
-            fSelectedTraces.clear();
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TraceResource) {
-                    fSelectedTraces.add((TraceResource)obj);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow arg0) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-
-    /*
-     * Setup trace transport on the remote system
-     */
-    private void setTraceTransport(final ILttControllerService service, final TraceResource trace, final TraceConfig oldConfig) throws Exception {
-        // Create future task
-        new TCFTask<Boolean>() {
-            @Override
-            public void run() {
-
-                // Setup trace transport using Lttng controller service proxy
-                service.setTraceTransport(trace.getParent().getParent().getName(), 
-                        trace.getParent().getName(), 
-                        oldConfig.getTraceName(), 
-                        oldConfig.getTraceTransport(), 
-                        new ILttControllerService.DoneSetTraceTransport() {
-
-                    @Override
-                    public void doneSetTraceTransport(IToken token, Exception error, Object str) {
-                        if (error != null) {
-                            // Notify with error
-                            error(error);
-                            return;
-                        }
-
-                        // Notify about success
-                        done(Boolean.valueOf(true));
-                    }
-                });
-            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-    }
-
-    /*
-     * Allocate trace resources on the remote system.
-     */
-    private void allocTrace(final ILttControllerService service, final TraceResource trace, final TraceConfig oldConfig) throws Exception {
-        new TCFTask<Boolean>() {
-        @Override
-        public void run() {
-
-            // Setup trace transport using Lttng controller service proxy
-            service.allocTrace(trace.getParent().getParent().getName(), 
-                    trace.getParent().getName(), 
-                    trace.getName(),  
-                    new ILttControllerService.DoneAllocTrace() {
-
-                @Override
-                public void doneAllocTrace(IToken token, Exception error, Object str) {
-                    if (error != null) {
-                        // Notify with error
-                        error(error);
-                        return;
-                    }
-
-                    // Notify about success
-                    done(Boolean.valueOf(true));
-                }
-            });
-        }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-    }
-
-    /*
-     * Setup the trace location. Only normal channels are written while trace is started.  
-     */
-    private void setupLocation(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
-        if (traceConfig.isNetworkTrace()) {
-
-            File newDir = new File(traceConfig.getTracePath());
-            if (!newDir.exists()) {
-                boolean created = newDir.mkdirs();
-                if (!created) {
-                    throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
-                }
-            }
-            
-            if (traceConfig.getProject() != null) {
-                ImportToProject.linkTrace(getShell(), trace, traceConfig.getProject(), traceConfig.getTraceName());
-            }
-            
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Setup trace transport using Lttng controller service proxy
-                    service.writeTraceNetwork(trace.getParent().getParent().getName(), 
-                            trace.getParent().getName(), 
-                            traceConfig.getTraceName(), 
-                            traceConfig.getTracePath(), 
-                            traceConfig.getNumChannel(), 
-                            traceConfig.getIsAppend(), 
-                            false, 
-                            true, // write only normal channels 
-                            new ILttControllerService.DoneWriteTraceNetwork() {
-
-                        @Override
-                        public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            
-        } else {
-            
-            // Create future task
-            new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Setup trace transport using Lttng controller service proxy
-                    service.writeTraceLocal(trace.getParent().getParent().getName(), 
-                            trace.getParent().getName(), 
-                            traceConfig.getTraceName(), 
-                            traceConfig.getTracePath(), 
-                            traceConfig.getNumChannel(),
-                            traceConfig.getIsAppend(), 
-                            false, 
-                            true, // write only normal channels 
-                            new ILttControllerService.DoneWriteTraceLocal() {
-
-                        @Override
-                        public void doneWriteTraceLocal(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        }
-    }
-
-    /*
-     * Starts the trace on the remote system.
-     */
-    private void startTrace(final ILttControllerService service, final TraceResource trace, final TraceConfig oldConfig) throws Exception {
-        new TCFTask<Boolean>() {
-        @Override
-        public void run() {
-
-            // Setup trace transport using Lttng controller service proxy
-            service.startTrace(trace.getParent().getParent().getName(), trace.getParent().getName(), oldConfig.getTraceName(), new ILttControllerService.DoneStartTrace() {
-
-                @Override
-                public void doneStartTrace(IToken token, Exception error, Object str) {
-                    if (error != null) {
-                        
-                        // Notify with error
-                        error(error);
-                        return;
-                    }
-
-                    // Notify about success
-                    done(Boolean.valueOf(true));
-                }
-            });
-        }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS );
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/StopTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/StopTrace.java
deleted file mode 100644 (file)
index 08467bb..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * <b><u>StopTrace</u></b>
- * <p>
- * Action implementation to stop a trace which deallocates all resources on the remote system.
- * </p>
- */
-public class StopTrace implements IObjectActionDelegate, IWorkbenchWindowActionDelegate, IViewActionDelegate {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private List<TraceResource> fSelectedTraces;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    
-    public StopTrace() {
-        fSelectedTraces = new ArrayList<TraceResource>();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
-     */
-    @Override
-    public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-     */
-    @Override
-    public void run(IAction arg0) {
-        int size = fSelectedTraces.size();
-        for (int i = 0; i < size; i++) {
-
-            final TraceResource trace = (TraceResource) fSelectedTraces.get(i);
-            TraceSubSystem subSystem = (TraceSubSystem)trace.getSubSystem();
-
-            try {
-                final ILttControllerService service = subSystem.getControllerService();
-                
-                TraceConfig traceConfig = trace.getTraceConfig();
-                if (traceConfig != null && traceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE) {
-                       setupLocation(service, trace, traceConfig);
-                }
-                
-                // Create future task
-                @SuppressWarnings("unused")
-                Boolean success = new TCFTask<Boolean>() {
-                    @Override
-                    public void run() {
-
-                        // Setup trace  using Lttng controller service proxy
-                        service.destroyTrace(trace.getParent().getParent().getName(), trace.getParent().getName(), trace.getName(), new ILttControllerService.DoneDestroyTrace() {
-
-                            @Override
-                            public void doneDestroyTrace(IToken token, Exception error, Object str) {
-                                if (error != null) {
-                                    // Notify with error
-                                    error(error);
-                                    return;
-                                }
-
-                                // Notify about success
-                                done(Boolean.valueOf(true));
-                            }
-                        });
-                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-                    
-                    trace.setTraceState(TraceState.STOPPED);
-
-                    if (trace.getTraceConfig() != null) {
-                        LiveTraceManager.setLiveTrace(trace.getTraceConfig().getTracePath(), false);
-                    }
-
-                    ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-                    registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, trace, trace.getParent(), subSystem, null);
-
-            } catch (Exception e) {
-                SystemMessageException sysExp;
-                if (e instanceof SystemMessageException) {
-                    sysExp = (SystemMessageException)e;
-                } else {
-                    sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-                }
-                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorStop + " (" +  //$NON-NLS-1$
-                        Messages.Lttng_Resource_Trace + ": "  + trace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public void selectionChanged(IAction action, ISelection selection) {
-        
-        if (selection instanceof IStructuredSelection) {
-            fSelectedTraces.clear();
-
-            // store the selected targets to be used when running
-            Iterator<IStructuredSelection> theSet = ((IStructuredSelection) selection).iterator();
-            while (theSet.hasNext()) {
-                Object obj = theSet.next();
-                if (obj instanceof TraceResource) {
-                    fSelectedTraces.add((TraceResource)obj);
-                }
-            }
-        }
-
-    }
-
-    /**
-     * Returns the active workbench shell of this plug-in.
-     * 
-     * @return active workbench shell.
-     */
-    protected Shell getShell() {
-        return SystemBasePlugin.getActiveWorkbenchShell();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
-     */
-    @Override
-    public void init(IWorkbenchWindow window) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
-     */
-    @Override
-    public void init(IViewPart view) {
-    }
-    
-    /*
-     * Setup the trace location. Only flight recorder channels are written when trace is stopped.
-     */
-    private void setupLocation(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
-       boolean success = false;
-       
-        if (traceConfig.isNetworkTrace()) {
-
-            // Create future task
-            success = new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Setup trace transport using Lttng controller service proxy
-                    service.writeTraceNetwork(trace.getParent().getParent().getName(), 
-                            trace.getParent().getName(), 
-                            traceConfig.getTraceName(), 
-                            traceConfig.getTracePath(), 
-                            traceConfig.getNumChannel(), 
-                            traceConfig.getIsAppend(), 
-                            true, // write only flight recorder channels 
-                            false, 
-                            new ILttControllerService.DoneWriteTraceNetwork() {
-
-                        @Override
-                        public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            
-        } else {
-            
-            // Create future task
-            success = new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Setup trace transport using Lttng controller service proxy
-                    service.writeTraceLocal(trace.getParent().getParent().getName(), 
-                            trace.getParent().getName(), 
-                            traceConfig.getTraceName(), 
-                            traceConfig.getTracePath(), 
-                            traceConfig.getNumChannel(),
-                            traceConfig.getIsAppend(), 
-                            true, // write only flight recorder channels 
-                            false, 
-                            new ILttControllerService.DoneWriteTraceLocal() {
-
-                        @Override
-                        public void doneWriteTraceLocal(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(Boolean.valueOf(true));
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        }
-        
-        if (success) {
-            //FIXME: wait 2 seconds to allow time for channels to be written before destroying the trace
-            try {
-                               Thread.sleep(2000);
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
-                       }
-        }
-    }
-
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/connectorservice/TraceConnectorService.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/connectorservice/TraceConnectorService.java
deleted file mode 100644 (file)
index 5d4f9d1..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation (based on TCFConnectorService)
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.connectorservice;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.LttControllerServiceProxy;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.utility.DownloadProxy;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.CommunicationsEvent;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.subsystems.StandardConnectorService;
-import org.eclipse.tm.tcf.core.AbstractPeer;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IChannel.IEventListener;
-import org.eclipse.tm.tcf.protocol.IPeer;
-import org.eclipse.tm.tcf.protocol.IService;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.ILocator;
-
-/**
- * <b><u>TraceConnectorService</u></b>
- * <p>
- * Implementation of the Trace Connector class to connect to the remote agent.
- * </p>
- */
-public class TraceConnectorService extends StandardConnectorService {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    private final static int INVOCATION_TIMEOUT = 1000;
-    private boolean fIsConnected = false;
-    private IChannel fChannel;
-    private Throwable fChannelError;
-
-    private final List<Runnable> fWaitList = new ArrayList<Runnable>();
-    private boolean fPollTimerStarted;
-    private DownloadProxy fDownloadProxy = null;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    /**
-     * Constructor for TraceConnectorService.
-     * 
-     * @param host - host reference
-     * @param port - port
-     */
-    public TraceConnectorService(IHost host, int port) {
-        super(Messages.Trace_Connector_Service_Name, Messages.Trace_Connector_Service_Description, host, port);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.IConnectorService#isConnected()
-     */
-    @Override
-    public boolean isConnected() {
-        return fIsConnected;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalConnect(org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    protected void internalConnect(final IProgressMonitor monitor) throws Exception {
-        assert !Protocol.isDispatchThread();
-        final Exception[] res = new Exception[1];
-        // Fire comm event to signal state about to change
-        fireCommunicationsEvent(CommunicationsEvent.BEFORE_CONNECT);
-        monitor.beginTask(Messages.Trace_Connector_Service_Connect_Msg + " " + getHostName(), 1); //$NON-NLS-1$
-        synchronized (res) {
-            Protocol.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    if (!connectTCFChannel(res, monitor)) {
-                        add_to_wait_list(this);
-                    }
-                }
-            });
-            res.wait();
-        }
-        monitor.done();
-        if (res[0] != null) {
-            throw res[0];
-        }
-        // pretend. Normally, we'd connect to our remote server-side code here
-        fIsConnected = true;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalDisconnect(org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void internalDisconnect(final IProgressMonitor monitor) throws Exception {
-        assert !Protocol.isDispatchThread();
-        final Exception[] res = new Exception[1];
-        // Fire comm event to signal state about to change
-        fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT);
-        monitor.beginTask(Messages.Trace_Connector_Service_Disconnect_Msg + " " + getHostName(), 1); //$NON-NLS-1$
-        synchronized (res) {
-            Protocol.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    if (!disconnectTCFChannel(res, monitor)) {
-                        add_to_wait_list(this);
-                    }
-                }
-            });
-            res.wait();
-        }
-        monitor.done();
-        if (res[0] != null) {
-            throw res[0];
-        }
-        fIsConnected = false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsRemoteServerLaunching()
-     */
-    @Override
-    public boolean supportsRemoteServerLaunching() {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#supportsServerLaunchProperties()
-     */
-    @Override
-    public boolean supportsServerLaunchProperties() {
-        return false;
-    }
-
-    /*
-     * Add Runnable to wait list.
-     */
-    private void add_to_wait_list(Runnable cb) {
-        fWaitList.add(cb);
-        if (fPollTimerStarted) {
-            return;
-        }
-        Protocol.invokeLater(INVOCATION_TIMEOUT, new Runnable() {
-            @Override
-            public void run() {
-                fPollTimerStarted = false;
-                run_wait_list();
-            }
-        });
-        fPollTimerStarted = true;
-    }
-
-    /*
-     * Run the runnables of the wait list.
-     */
-    private void run_wait_list() {
-        if (fWaitList.isEmpty()) {
-            return;
-        }
-        Runnable[] runnables = fWaitList.toArray(new Runnable[fWaitList.size()]);
-        fWaitList.clear();
-        for (int i = 0; i < runnables.length; i++) {
-            runnables[i].run();
-        }
-    }
-
-    /*
-     * Connect the TCF channel.
-     */
-    private boolean connectTCFChannel(Exception[] res, IProgressMonitor monitor) {
-        if (fChannel != null) {
-            switch (fChannel.getState()) {
-            case IChannel.STATE_OPEN:
-            case IChannel.STATE_CLOSED:
-                synchronized (res) {
-                    if (fChannelError instanceof Exception) {
-                        res[0] = (Exception) fChannelError;
-                    }
-                    else if (fChannelError != null) {
-                        res[0] = new Exception(fChannelError);
-                    }
-                    else {
-                        res[0] = null;
-                    }
-                    res.notifyAll();
-                    return true;
-                }
-                default:
-            }
-        }
-        if (monitor.isCanceled()) {
-            synchronized (res) {
-                res[0] = new Exception(Messages.Trace_Connector_Service_Canceled_Msg); 
-                if (fChannel != null) {
-                    fChannel.terminate(res[0]);
-                }
-                res.notifyAll();
-                return true;
-            }
-        }
-        if (fChannel == null) {
-            String host = getHostName().toLowerCase();
-            int port = getConnectPort();
-            if (port <= 0) {
-                // Default fallback
-                port = TraceConnectorServiceManager.TCF_PORT;
-            }
-            IPeer peer = null;
-            String port_str = Integer.toString(port);
-            ILocator locator = Protocol.getLocator();
-            for (IPeer p : locator.getPeers().values()) {
-                Map<String, String> attrs = p.getAttributes();
-                if ("TCP".equals(attrs.get(IPeer.ATTR_TRANSPORT_NAME)) &&  //$NON-NLS-1$
-                        host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) && port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) {
-                    peer = p;
-                    break;
-                }
-            }
-            if (peer == null) {
-                Map<String, String> attrs = new HashMap<String, String>();
-                attrs.put(IPeer.ATTR_ID, "RSE:" + host + ":" + port_str);  //$NON-NLS-1$ //$NON-NLS-2$
-                attrs.put(IPeer.ATTR_NAME, getName());
-                attrs.put(IPeer.ATTR_TRANSPORT_NAME, "TCP");  //$NON-NLS-1$
-                attrs.put(IPeer.ATTR_IP_HOST, host);
-                attrs.put(IPeer.ATTR_IP_PORT, port_str);
-                peer = new AbstractPeer(attrs);
-            }
-            fChannel = peer.openChannel();
-            fChannel.addChannelListener(new IChannel.IChannelListener() {
-                @Override
-                public void onChannelOpened() {
-                    assert fChannel != null;
-
-                    // Check if remote server provides LTTng service
-                    if (fChannel.getRemoteService(ILttControllerService.NAME) == null) {
-                        return;
-                    }
-                    // Create service proxy, passing the fChannel to the proxy
-                    ILttControllerService controllerService = new LttControllerServiceProxy(fChannel);
-
-                    fChannel.setServiceProxy(ILttControllerService.class, controllerService);
-
-                    ISubSystem[] subSystems = getSubSystems();
-
-                    for (int i = 0; i < subSystems.length; i++) {
-                        if (subSystems[i] instanceof TraceSubSystem) {
-                            // There is only one trace subsystem per trace connector service 
-                            fDownloadProxy = new DownloadProxy((TraceSubSystem)subSystems[i]);
-                        }
-                    }
-
-                    final IEventListener listener = new IEventListener() {
-
-                        @Override
-                        public void event(String name, byte[] data) {
-                            if (fDownloadProxy != null) {
-                                if (name.compareTo(TraceControlConstants.Lttng_Control_New_Event_Data) == 0) {
-                                    fDownloadProxy.writeDownloadedTrace(data);
-                                    }
-                                else if (name.compareTo(TraceControlConstants.Lttng_Control_Unwrite_Trace_Data_Event) == 0) {
-                                        // only for UST
-                                        // TODO implement handling
-                                    }
-                                else if (name.compareTo(TraceControlConstants.Lttng_Control_Trace_Done_Event) == 0) {
-                                    // finished 
-                                    fDownloadProxy.handleTraceDoneEvent(data);
-                                } else {
-                                    try {
-                                        throw new IOException(LttngConstants.Lttng_Control_Command + ": " + Messages.Lttng_Control_Unknown_Event_Msg + ": " + name);  //$NON-NLS-1$ //$NON-NLS-2$  
-                                    } catch (IOException e) {
-                                        SystemBasePlugin.logError("TraceConnectorService", e); //$NON-NLS-1$
-                                    }
-                                }
-                            }
-                        }
-                    };
-                    fChannel.addEventListener(controllerService, listener);
-                    run_wait_list();
-                }
-
-                @Override
-                public void congestionLevel(int level) {
-                }
-
-                @Override
-                public void onChannelClosed(Throwable error) {
-                    assert fChannel != null;
-                    fChannel.removeChannelListener(this);
-                    fChannelError = error;
-                    if (fWaitList.isEmpty()) {
-                        fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR);
-                    } else {
-                        run_wait_list();
-                    }
-                    fChannel = null;
-                    fChannelError = null;
-                }
-
-            });
-
-            assert fChannel.getState() == IChannel.STATE_OPENING;
-        }
-        return false;
-    }
-
-    /*
-     * Disconnect the TCF channel.
-     */
-    private boolean disconnectTCFChannel(Exception[] res, IProgressMonitor monitor) {
-        if (fChannel == null || fChannel.getState() == IChannel.STATE_CLOSED) {
-            synchronized (res) {
-                res[0] = null;
-                res.notifyAll();
-                return true;
-            }
-        }
-        if (monitor.isCanceled()) {
-            synchronized (res) {
-                res[0] = new Exception("Canceled"); //$NON-NLS-1$
-                res.notifyAll();
-                return true;
-            }
-        }
-        if (fChannel.getState() == IChannel.STATE_OPEN) {
-            fChannel.close();
-        }
-        return false;
-    }
-
-    /**
-     * Retrieve the remote service for given service interface.
-     * 
-     * @param <V>
-     * @param service_interface
-     * @return Service
-     * @throws Exception
-     */
-    public <V extends IService> V getService(Class<V> service_interface) throws Exception {
-        if (fChannel == null || fChannel.getState() != IChannel.STATE_OPEN) {
-            throw new Exception(Messages.Ltt_Controller_Service_Not_Connected_Msg + ": " + service_interface.getName()); //$NON-NLS-1$
-        }
-        V service = fChannel.getRemoteService(service_interface);
-        if (service == null) {
-            throw new Exception(Messages.Ltt_Controller_Service_Unsupported_Msg + ": " + service_interface.getName()); //$NON-NLS-1$
-        }
-        return service;
-    }
-
-    /**
-     * Retrieve the LTTng remote service.
-     * 
-     * @return LTTng remote Service
-     * @throws Exception
-     */
-    public LttControllerServiceProxy getControllerService() throws Exception {
-        return (LttControllerServiceProxy)getService(ILttControllerService.class);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/connectorservice/TraceConnectorServiceManager.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/connectorservice/TraceConnectorServiceManager.java
deleted file mode 100644 (file)
index 4841f9e..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.connectorservice;
-
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.ITCFSubSystem;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.ITraceSubSystem;
-import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-
-/**
- * <b><u>TraceConnectorServiceManager</u></b>
- * <p>
- * Implementation of the Trace Connector Service Manager class for the creation 
- * of the Trace Connector service.
- * </p>
- */
-public class TraceConnectorServiceManager extends AbstractConnectorServiceManager {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    private static TraceConnectorServiceManager INSTANCE = new TraceConnectorServiceManager();
-
-    public static final int TCF_PORT = 1534;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    /**
-     * Return singleton instance
-     */
-    public static TraceConnectorServiceManager getInstance() {
-        if (INSTANCE == null) {
-            INSTANCE = new TraceConnectorServiceManager();
-        }
-        return INSTANCE;
-    }
-
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#createConnectorService(org.eclipse.rse.core.model.IHost)
-     */
-    @Override
-    public IConnectorService createConnectorService(IHost host) {
-        return new TraceConnectorService(host, TCF_PORT);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#sharesSystem(org.eclipse.rse.core.subsystems.ISubSystem)
-     */
-    @Override
-    public boolean sharesSystem(ISubSystem otherSubSystem) {
-        return (otherSubSystem instanceof ITCFSubSystem);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#getSubSystemCommonInterface(org.eclipse.rse.core.subsystems.ISubSystem)
-     */
-    @Override
-    public Class<ITraceSubSystem> getSubSystemCommonInterface(ISubSystem subsystem) {
-        return ITraceSubSystem.class;
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/ConfigureMarkersDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/ConfigureMarkersDialog.java
deleted file mode 100644 (file)
index f8391f6..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Dialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-/**
- * <b><u>ConfigureMarkersDialog</u></b>
- * <p>
- * Dialog box to configure markers for a given target resource.
- * </p>
- */
-public class ConfigureMarkersDialog extends Dialog {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    
-    private String[] fMarkersList;
-    private TargetResource fTarget;
-    private Boolean fOkClicked;
-    Map<String, Boolean> fMap;
-    private TableItem[] fTableLines;
-    private Boolean[] fInitialMarkersStates;
-
-    private TraceSubSystem fSubSystem;
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor 
-     * 
-     * @param parent The parent shell
-     * @param subSystem The trace SubSystem
-     */
-    public ConfigureMarkersDialog(Shell parent, TraceSubSystem subSystem) {
-        super(parent);
-        fOkClicked = false;
-        fSubSystem = subSystem;
-    }
-
-    /**
-     * Constructor
-     * 
-     * @param parent The parent shell
-     * @param style The dialog box style
-     * @param subSystem The trace SubSystem
-
-     */
-    public ConfigureMarkersDialog(Shell parent, int style, TraceSubSystem subSystem) {
-        super(parent, style);
-        fOkClicked = false;
-        fSubSystem = subSystem;
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    public Map<String, Boolean> open(TargetResource aTarget) {
-        fTarget = aTarget;
-        
-        Shell parent = getParent();
-        final Display display = parent.getDisplay();
-        final Shell shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE);
-        shell.setText(Messages.ConfigureMarkersDialog_Title);
-        shell.setImage(LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_CONFIG_MARKERS));
-        shell.setLayout(new FillLayout());
-        Composite composite = new Composite(shell, SWT.NONE);
-        composite.setLayout(new GridLayout());
-
-        try {
-
-            final ILttControllerService service = fSubSystem.getControllerService();
-
-            // Create future task
-            fMarkersList = new TCFTask<String[]>() {
-                @Override
-                public void run() {
-
-                    // Get markers using Lttng controller service proxy
-                    service.getMarkers(fTarget.getParent().getName(), fTarget.getName(), new ILttControllerService.DoneGetMarkers() {
-
-                        @Override
-                        public void doneGetMarkers(IToken token, Exception error, String[] str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(str);
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            SystemMessageException sysExp;
-            if (e instanceof SystemMessageException) {
-                sysExp = (SystemMessageException)e;
-            } else {
-                sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-            }
-            SystemBasePlugin.logError(Messages.Lttng_Control_ErrorGetMarkers + " (" +  //$NON-NLS-1$
-                    Messages.Lttng_Resource_Target + ": "  + fTarget.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-            return null;
-        }
-
-        for (int i = 0; i < fMarkersList.length; i++) {
-            fMarkersList[i] = fMarkersList[i].trim();
-        }
-        final Table table = new Table(composite, SWT.BORDER | SWT.CHECK);
-        TableColumn tc0 = new TableColumn(table, SWT.LEFT | SWT.CENTER);
-        TableColumn tc1 = new TableColumn(table, SWT.LEFT);
-        TableColumn tc2 = new TableColumn(table, SWT.LEFT);
-        TableColumn tc3 = new TableColumn(table, SWT.LEFT);
-        TableColumn tc4 = new TableColumn(table, SWT.LEFT);
-        TableColumn tc5 = new TableColumn(table, SWT.LEFT);
-        TableColumn tc6 = new TableColumn(table, SWT.LEFT);
-        tc1.setText(Messages.ConfigureMarkersDialog_NameColumn);
-        tc2.setText(Messages.ConfigureMarkersDialog_Location);
-        tc3.setText(Messages.ConfigureMarkersDialog_Format);
-        tc4.setText(Messages.ConfigureMarkersDialog_EventId);
-        tc5.setText(Messages.ConfigureMarkersDialog_Call);
-        tc6.setText(Messages.ConfigureMarkersDialog_Probe_Single);
-        tc0.setWidth(25);
-        tc1.setWidth(100);
-        tc2.setWidth(100);
-        tc3.setWidth(170);
-        tc4.pack();
-        tc5.setWidth(100);
-        tc6.setWidth(100);
-        table.setHeaderVisible(true);
-        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        fTableLines = new TableItem[fMarkersList.length];
-        fInitialMarkersStates = new Boolean[fMarkersList.length];
-
-        for (int i = 0; i < fMarkersList.length; i++) {
-            fTableLines[i] = new TableItem(table, SWT.NONE);
-            String markerInfoResult = null;
-            final String currentMarker = fMarkersList[i];
-            
-            try {
-
-                final ILttControllerService service = fSubSystem.getControllerService();
-                
-                // Create future task
-                markerInfoResult = new TCFTask<String>() {
-                    @Override
-                    public void run() {
-
-                        // Get marker info using Lttng controller service proxy
-                        service.getMarkerInfo(fTarget.getParent().getName(), fTarget.getName(), currentMarker, new ILttControllerService.DoneGetMarkerInfo() {
-
-                            @Override
-                            public void doneGetMarkerInfo(IToken token, Exception error, String str) {
-                                if (error != null) {
-                                    // Notify with error
-                                    error(error);
-                                    return;
-                                }
-
-                                // Notify about success
-                                done(str);
-                            }
-                        });
-                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            } catch (Exception e) {
-                SystemMessageException sysExp;
-                if (e instanceof SystemMessageException) {
-                    sysExp = (SystemMessageException)e;
-                } else {
-                    sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));    
-                }
-                SystemBasePlugin.logError(Messages.Lttng_Control_ErrorGetMarkerInfo + " (" +  //$NON-NLS-1$
-                        Messages.Lttng_Resource_Target + ": "  + fTarget.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
-                        Messages.Lttng_Resource_Marker + ": " + currentMarker + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$
-                return null;
-            }
-
-            String markerInfos = markerInfoResult.substring(1, markerInfoResult.length() - 1);
-            // System.out.println("markerInfos " + markerInfos);
-
-            // HACK!!!
-            // BAD : payload CAN contain comma!!!
-            /*
-             * String[] infosList = markerInfos.split(","); for(int j=0 ; j<infosList.length ; j++) { infosList[j] = infosList[j].trim(); String[] tempTable = infosList[j].split("="); infosList[j] = tempTable[1]; System.out.print(infosList[j] + " ");
-             * } System.out.println("");
-             */
-
-            // QUICK FIX :
-            int nbOfEqualsHack = 0;
-            for (int x = 0; x < markerInfos.length(); x++) {
-                if (markerInfos.charAt(x) == '=') {
-                    nbOfEqualsHack++;
-                }
-            }
-
-            if (nbOfEqualsHack > 0) { 
-                String[] infosList = new String[nbOfEqualsHack];
-                String value = ""; //$NON-NLS-1$
-
-                int prevPos = 0;
-                int curPos = 0;
-                int eqPos = 0;
-                int nbDone = 0;
-
-                while ((curPos < markerInfos.length()) && (eqPos >= 0)) {
-                    eqPos = markerInfos.indexOf("=", curPos); //$NON-NLS-1$
-
-                    if (eqPos >= 0) {
-                        prevPos = markerInfos.lastIndexOf(",", eqPos); //$NON-NLS-1$
-                    } else {
-                        prevPos = markerInfos.length() - 1;
-                    }
-
-                    if (prevPos >= 0) {
-                        value = markerInfos.substring(curPos, prevPos);
-
-                        infosList[nbDone] = value;
-                        nbDone++;
-                    }
-                    curPos = eqPos + 1;
-                }
-
-                fTableLines[i].setText(new String[] { null, fMarkersList[i], infosList[3], infosList[4], infosList[2], infosList[0], infosList[5] });
-
-                if (infosList[1].compareTo("1") == 0) { //$NON-NLS-1$
-                    fTableLines[i].setChecked(true);
-                    fInitialMarkersStates[i] = true;
-                } else {
-                    fTableLines[i].setForeground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
-                    fInitialMarkersStates[i] = false;
-                }
-            }
-        }
-
-        table.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                if (event.detail == SWT.CHECK) {
-                    TableItem ti = (TableItem) event.item;
-                    if (!ti.getChecked()) {
-                        ti.setForeground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
-                    } else {
-                        ti.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
-                    }
-                }
-            }
-        });
-
-        final Composite buttonComposite = new Composite(composite, SWT.NONE);
-        buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-        GridLayout gl = new GridLayout(4, false);
-        gl.verticalSpacing = 10;
-        buttonComposite.setLayout(gl);
-
-        Label shadow_sep_h = new Label(buttonComposite, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
-        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
-        shadow_sep_h.setLayoutData(gd);
-
-        Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
-        selectAllButton.setText(Messages.ConfigureMarkersDialog_Select_All);
-        gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-        gd.widthHint = 100;
-        selectAllButton.setLayoutData(gd);
-        selectAllButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                for (int i = 0; i < fTableLines.length; i++) {
-                    fTableLines[i].setChecked(true);
-                    fTableLines[i].setForeground(display.getSystemColor(SWT.COLOR_BLACK));
-                }
-            }
-        });
-
-        Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
-        deselectAllButton.setText(Messages.ConfigureMarkersDialog_Deselect_All);
-        gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-        gd.widthHint = 100;
-        deselectAllButton.setLayoutData(gd);
-        deselectAllButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                for (int i = 0; i < fTableLines.length; i++) {
-                    fTableLines[i].setChecked(false);
-                    fTableLines[i].setForeground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
-                }
-            }
-        });
-
-        Button cancelButton = new Button(buttonComposite, SWT.PUSH);
-        cancelButton.setText(Messages.ConfigureMarkersDialog_Cancel);
-        gd = new GridData();
-        gd = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
-        gd.widthHint = 100;
-        cancelButton.setLayoutData(gd);
-        cancelButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                fOkClicked = Boolean.valueOf(false);
-                shell.dispose();
-            }
-        });
-
-        Button okButton = new Button(buttonComposite, SWT.PUSH);
-        okButton.setText(Messages.ConfigureMarkersDialog_Ok);
-        gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
-        gd.widthHint = 100;
-        okButton.setLayoutData(gd);
-        okButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                fOkClicked = Boolean.valueOf(true);
-                fMap = new HashMap<String, Boolean>();
-                for (int k = 0; k < fTableLines.length; k++) {
-                    Boolean isChecked = fTableLines[k].getChecked();
-                    if (isChecked.booleanValue() != fInitialMarkersStates[k].booleanValue()) {
-                        if (isChecked) {
-                            fMap.put(fMarkersList[k], Boolean.valueOf(true));
-                        } else {
-                            fMap.put(fMarkersList[k], Boolean.valueOf(false));
-                        }
-                    }
-                }
-                shell.dispose();
-            }
-        });
-
-        shell.addListener(SWT.Traverse, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                if (event.detail == SWT.TRAVERSE_ESCAPE) {
-                    event.doit = false;
-                }
-            }
-        });
-        
-        TableItem[] items = table.getItems();
-        for (int i = 0; i < items.length; i++) {
-            if ((i % 2) != 0) {
-                items[i].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
-            }
-        }
-        
-        Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-        shell.setMinimumSize(shell.computeSize(minSize.x, minSize.y).x, 200);
-        shell.setSize(shell.computeSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300));
-        shell.open();
-
-        while (!shell.isDisposed()) {
-            if (!display.readAndDispatch()) {
-                display.sleep();
-            }
-        }
-        if (!fOkClicked) {
-            return null;
-        }
-
-        return fMap;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/ImportTraceDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/ImportTraceDialog.java
deleted file mode 100644 (file)
index 834cfea..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Patrick Tasse - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.lttng.core.LTTngProjectNature;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <b><u>ImportTraceDialog</u></b>
- * <p>
- * Dialog box to import a trace a LTTng project.
- * </p>
- */
-public class ImportTraceDialog extends Dialog {
-
-       // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-       private TraceResource fTrace;
-       private Table fTable;
-       private Text fNameText;
-       private Button fLinkOnlyButton;
-       private IProject fProject;
-       private String fTraceName;
-       private boolean fLinkOnly = false;
-       
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-       /**
-        * Constructor
-        *  
-        * @param parentShell The parent shell
-        * @param trace The trace to import
-        */
-       public ImportTraceDialog(Shell parentShell, TraceResource trace) {
-               super(parentShell);
-               fTrace = trace;
-       }
-
-       // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-        */
-       @Override
-       protected Control createDialogArea(Composite parent) {
-               getShell().setText(Messages.ImportTraceDialog_Title);
-               getShell().setImage(LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_IMPORT_TRACE));
-               
-               Composite composite = new Composite(parent, SWT.NONE);
-        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        composite.setLayout(new GridLayout(1, false));
-        
-        Label tableLabel = new Label(composite, SWT.NONE);
-        tableLabel.setText(Messages.ImportTraceDialog_TableLabel);
-               
-        fTable = new Table(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
-        fTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        fTable.setHeaderVisible(true);
-        fTable.setLinesVisible(true);
-
-        TableColumn column = new TableColumn(fTable, SWT.CENTER);
-        column.setText(Messages.ImportTraceDialog_ProjectColumn);
-
-        for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
-               try {
-                               if (project.isOpen() && project.hasNature(LTTngProjectNature.ID)) {
-                           TableItem item = new TableItem(fTable, SWT.LEFT);
-                           item.setText(0, project.getName());
-                           item.setData(project);
-                               }
-                       } catch (CoreException e) {
-                           SystemBasePlugin.logError("ImportTraceDialog", e); //$NON-NLS-1$
-                       }
-        }
-        
-        for (int i = 0; i < fTable.getColumnCount(); i++) {
-               fTable.getColumn(i).pack();
-        }
-
-        Composite nameComposite = new Composite(composite, SWT.NONE);
-        nameComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-        GridLayout gl = new GridLayout(2, false);
-        gl.marginWidth = 0;
-        gl.marginHeight = 0;
-        nameComposite.setLayout(gl);
-        
-        Label nameLabel = new Label(nameComposite, SWT.NONE);
-        nameLabel.setText(Messages.ImportTraceDialog_NameLabel);
-
-        fNameText = new Text(nameComposite, SWT.BORDER);
-        fNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-        fNameText.setText(fTrace.getName());
-
-        if (fTrace.getTraceConfig().isNetworkTrace()) {
-               fLinkOnlyButton = new Button(composite, SWT.CHECK);
-               fLinkOnlyButton.setText(Messages.ImportTraceDialog_LinkOnly);
-               fLinkOnlyButton.setSelection(true);
-               fLinkOnly = true;
-               if (fTrace.getTraceState() != TraceState.STOPPED) {
-                       // if the trace is not stopped, link is the only allowed option
-                       fLinkOnlyButton.setEnabled(false);
-               }
-        }
-        
-               return composite;
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
-        */
-    @Override
-    protected void createButtonsForButtonBar(Composite parent) {
-        super.createButtonsForButtonBar(parent);
-        getButton(IDialogConstants.OK_ID).setText(Messages.ImportTraceDialog_ImportButton);
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-     */
-    @Override
-       protected void okPressed() {
-       TableItem[] selection = fTable.getSelection();
-       if (selection.length > 0) {
-               fProject = (IProject) selection[0].getData();
-       }
-       fTraceName = fNameText.getText();
-       if (fLinkOnlyButton != null) {
-               fLinkOnly = fLinkOnlyButton.getSelection();
-       }
-       super.okPressed();
-       }
-
-    /**
-     * Returns the project to import to.
-     * 
-     * @return project to import to.
-     */
-       public IProject getProject() {
-       return fProject;
-    }
-    
-       /**
-        * Gets the name of the trace in the LTTng project. 
-        * 
-        * @return
-        */
-    public String getTraceName() {
-       return fTraceName;
-    }
-    
-    /**
-     * Returns if trace should be linked or copied to the project.
-     * Only applicable for traces residing on local host.
-     * 
-     * @return true if trace should be linked to the project, 
-     *         false if it should be copied 
-     */
-    public boolean getLinkOnly() {
-       return fLinkOnly;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/NewTraceDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/NewTraceDialog.java
deleted file mode 100644 (file)
index ec9ff35..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.lttng.core.LTTngProjectNature;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Dialog;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <b><u>NewTraceDialog</u></b>
- * <p>
- * Dialog box to create a new trace.
- * </p>
- */
-public class NewTraceDialog extends Dialog {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private String fTraceName;
-    private String fTraceTransport;
-    private String fTracePath;
-    private int fMode;
-    private int fNumChannel;
-    private Boolean fIsAppend;
-    private Boolean fIsLocal;
-    private Text fNameText;
-    private Text fTransportText;
-    private Text fPathText;
-    private Text fNumLttdThreadsText;
-    private Button fFinishButton;
-    private Button fHostButton;
-    private Button fTargetButton;
-    private Button fIsAppendButton;
-    private Button fFlightRecorderButton;
-    private Button fNormalButton;
-    private Boolean fFinishButtonClicked;
-    private Display fDisplay;
-    private String fTraceNameError;
-    private String fTracePathError;
-    private Label fErrorLabel;
-    private Button fBrowseButton;
-    
-    private TraceSubSystem fSubSystem;
-    private TargetResource fTargetResource;
-    
-    private IProject fProject;
-    private static IProject defaultProject;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor 
-     * 
-     * @param parent The parent shell
-     * @param subSystem The trace SubSystem
-     * @param targetResource The parent target resource
-     */
-    public NewTraceDialog(Shell parent, TraceSubSystem subSystem, TargetResource targetResource) {
-        super(parent);
-        fSubSystem = subSystem;
-        fTargetResource = targetResource;
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * Makes the dialog visible and returns the trace configuration of the new trace.
-     * 
-     * @return trace configuration
-     */
-    public TraceConfig open() {
-        Shell parent = getParent();
-        final Shell shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
-        shell.setText(Messages.NewTraceDialog_Title);
-
-        shell.setLayout(new GridLayout());
-        shell.setImage(LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_NEW_TRACE));
-
-        GridData griddata = new GridData();
-        fFinishButtonClicked = Boolean.valueOf(false);
-        fTraceNameError = ""; //$NON-NLS-1$
-        fTracePathError = ""; //$NON-NLS-1$
-
-        griddata = new GridData();
-        Composite composite1 = new Composite(shell, SWT.NONE);
-        GridLayout compositeLayout1 = new GridLayout(2, false);
-        composite1.setSize(520, 300);
-        composite1.setLayout(compositeLayout1);
-        griddata.horizontalSpan = 3;
-        griddata.widthHint = 520;
-        griddata.minimumWidth = 520;
-        composite1.setLayoutData(griddata);
-
-        Label nameLabel = new Label(composite1, SWT.NULL);
-        nameLabel.setText(Messages.NewTraceDialog_TraceName + ":"); //$NON-NLS-1$
-        griddata = new GridData();
-        griddata.verticalIndent = 20;
-        nameLabel.setLayoutData(griddata);
-
-        fNameText = new Text(composite1, SWT.SINGLE | SWT.BORDER);
-        if (fTargetResource.isUst()) {
-               fNameText.setText(TraceControlConstants.Lttng_Ust_TraceName);
-               fNameText.setEnabled(false);
-        }
-
-        griddata = new GridData();
-        griddata.horizontalAlignment = SWT.FILL;
-        griddata.grabExcessHorizontalSpace = true;
-        griddata.verticalIndent = 20;
-        fNameText.setLayoutData(griddata);
-        fNameText.setSize(500, 50);
-
-        Label transportLabel = new Label(composite1, SWT.NULL);
-        transportLabel.setText(Messages.ConfigureTraceDialog_Trace_Transport + ":"); //$NON-NLS-1$
-        griddata = new GridData();
-        transportLabel.setLayoutData(griddata);
-
-        fTransportText = new Text(composite1, SWT.SINGLE | SWT.BORDER);
-        griddata = new GridData();
-        griddata.horizontalAlignment = SWT.FILL;
-        griddata.grabExcessHorizontalSpace = true;
-        fTransportText.setLayoutData(griddata);
-        fTransportText.setSize(500, 50);
-        fTransportText.setText(TraceControlConstants.Lttng_Trace_Transport_Relay);
-        fTransportText.setEnabled(false); // relay is the only allowed value
-
-        griddata = new GridData();
-        Group composite21 = new Group(composite1, SWT.SHADOW_OUT);
-        composite21.setSize(300, 300);
-        composite21.setText(Messages.ConfigureTraceDialog_Trace_Location);
-        griddata.horizontalAlignment = SWT.FILL;
-        griddata.horizontalSpan = 2;
-        griddata.verticalIndent = 10;
-        griddata.widthHint = 300;
-        griddata.minimumWidth = 300;
-        composite21.setLayoutData(griddata);
-        GridLayout compositeLayout21 = new GridLayout(4, false);
-        composite21.setLayout(compositeLayout21);
-        fTargetButton = new Button(composite21, SWT.RADIO);
-        fTargetButton.setText(Messages.ConfigureTraceDialog_Target);
-        fTargetButton.setSelection(true);
-        fHostButton = new Button(composite21, SWT.RADIO);
-        fHostButton.setText(Messages.ConfigureTraceDialog_Host);
-        griddata = new GridData();
-        griddata.horizontalSpan = 3;
-        fHostButton.setLayoutData(griddata);
-        fIsLocal = false;
-        fHostButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                if (fHostButton.getSelection()) {
-                    fIsLocal = true;
-                    fBrowseButton.setEnabled(true);
-                } else {
-                    fIsLocal = false;
-                    fBrowseButton.setEnabled(false);
-                }
-                validatePathName(fPathText.getText());
-                validate();
-            }
-        });
-
-        Label pathLabel = new Label(composite21, SWT.NULL);
-        pathLabel.setText(Messages.ConfigureTraceDialog_Trace_Path);
-        griddata = new GridData();
-        griddata.verticalIndent = 10;
-        pathLabel.setLayoutData(griddata);
-
-        fPathText = new Text(composite21, SWT.SINGLE | SWT.BORDER);
-        griddata = new GridData();
-        griddata.horizontalAlignment = SWT.FILL;
-        griddata.grabExcessHorizontalSpace = true;
-        griddata.verticalIndent = 10;
-        fPathText.setLayoutData(griddata);
-        fPathText.setData(""); //$NON-NLS-1$
-
-        fBrowseButton = new Button(composite21, SWT.PUSH);
-        fBrowseButton.setText(Messages.ConfigureTraceDialog_Browse + "...");  //$NON-NLS-1$
-        griddata = new GridData();
-        griddata.grabExcessHorizontalSpace = false;
-        griddata.widthHint = 100;
-        griddata.verticalIndent = 10;
-        fBrowseButton.setLayoutData(griddata);
-        fBrowseButton.setEnabled(false);
-        fBrowseButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                DirectoryDialog dialog = new DirectoryDialog(shell);
-                String newPath = dialog.open();
-                if (newPath != null) {
-                    fPathText.setText(newPath);
-                }
-            }
-        });
-
-        fNameText.addListener(SWT.Modify, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-               validateTraceName(fNameText.getText());
-               validate();
-            }
-        });
-
-        fTransportText.addListener(SWT.Modify, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-               validate();
-            }
-        });
-
-        fPathText.addListener(SWT.Modify, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-               if (!fPathText.isEnabled()) {
-                       return;
-               }
-                validatePathName(fPathText.getText());
-                validate();
-            }
-        });
-
-        Composite projectComposite = new Composite(composite1, SWT.NONE);
-        projectComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-        GridLayout gl = new GridLayout(2, false);
-        gl.marginWidth = 0;
-        gl.marginHeight = 10;
-        projectComposite.setLayout(gl);
-
-        Label projectLabel = new Label(projectComposite, SWT.NONE);
-        projectLabel.setText(Messages.NewTraceDialog_Tracing_Project + ":"); //$NON-NLS-1$);
-
-        final Combo projectCombo = new Combo(projectComposite, SWT.READ_ONLY);
-        projectCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-        for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
-            try {
-                if (project.isOpen() && project.hasNature(LTTngProjectNature.ID)) {
-                    projectCombo.add(project.getName());
-                    projectCombo.setData(project.getName(), project);
-                    if (fProject == null  || project.equals(defaultProject)) {
-                        projectCombo.select(projectCombo.getItemCount() - 1);
-                        fProject = project;
-                    }
-                }
-            } catch (CoreException e) {
-                SystemBasePlugin.logError("NewTraceDialog", e); //$NON-NLS-1$
-            }
-        }
-        projectCombo.addSelectionListener(new SelectionListener() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                fProject = (IProject) projectCombo.getData(projectCombo.getText());
-            }
-            @Override
-            public void widgetDefaultSelected(SelectionEvent e) {
-            }});
-
-        griddata = new GridData();
-        Composite composite2 = new Composite(composite1, SWT.NONE);
-        GridLayout compositeLayout2 = new GridLayout(2, false);
-        compositeLayout2.marginWidth = 0;
-        composite2.setLayout(compositeLayout2);
-        griddata.horizontalSpan = 2;
-        composite2.setLayoutData(griddata);
-
-        Label numLttdThreadsLabel = new Label(composite2, SWT.NULL);
-        numLttdThreadsLabel.setText(Messages.ConfigureTraceDialog_Num_Lttd_Threads + ":"); //$NON-NLS-1$);
-
-        fNumLttdThreadsText = new Text(composite2, SWT.SINGLE | SWT.BORDER);
-        griddata = new GridData();
-        griddata.horizontalAlignment = SWT.BEGINNING;
-        griddata.widthHint = 50;
-        griddata.minimumWidth = 50;
-        fNumLttdThreadsText.setLayoutData(griddata);
-        if (fTargetResource.isUst()) {
-               fNumLttdThreadsText.setText("1"); //$NON-NLS-1$
-               fNumLttdThreadsText.setEnabled(false);
-        } else {
-               fNumLttdThreadsText.setText("2"); //$NON-NLS-1$
-        }
-
-        fNumLttdThreadsText.addListener(SWT.Verify, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                String string = e.text;
-                char[] chars = new char[string.length()];
-                string.getChars(0, chars.length, chars, 0);
-                for (int i = 0; i < chars.length; i++) {
-                    if (!('0' <= chars[i] && chars[i] <= '9')) {
-                        e.doit = false;
-                        return;
-                    }
-                }
-            }
-        });
-
-        fNumLttdThreadsText.addListener(SWT.Modify, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-               validate();
-            }
-        });
-
-        fIsAppendButton = new Button(composite1, SWT.CHECK);
-        fIsAppendButton.setText(Messages.ConfigureTraceDialog_Append);
-        griddata = new GridData();
-        griddata.horizontalAlignment = SWT.BEGINNING;
-        griddata.horizontalSpan = 2;
-        griddata.verticalIndent = 10;
-        fIsAppendButton.setLayoutData(griddata);
-        fIsAppend = Boolean.valueOf(false);
-        fIsAppendButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                if (fIsAppendButton.getSelection()) {
-                    fIsAppend = true;
-                }
-                else {
-                    fIsAppend = false;
-                }
-            }
-        });
-        if (fTargetResource.isUst()) {
-               fIsAppendButton.setEnabled(false);
-        }
-
-        griddata = new GridData();
-        Group composite22 = new Group(composite1, SWT.SHADOW_OUT);
-        composite22.setText(Messages.ConfigureTraceDialog_Trace_Mode);
-        griddata.horizontalSpan = 2;
-        griddata.verticalIndent = 10;
-        composite22.setLayoutData(griddata);
-        GridLayout compositeLayout22 = new GridLayout(2, false);
-        composite22.setLayout(compositeLayout22);
-        fNormalButton = new Button(composite22, SWT.RADIO);
-        fNormalButton.setText(Messages.ConfigureTraceDialog_Mode_Normal);
-        fFlightRecorderButton = new Button(composite22, SWT.RADIO);
-        fFlightRecorderButton.setText(Messages.ConfigureTraceDialog_Mode_Flight_Recorder);
-        fMode = TraceConfig.NORMAL_MODE;
-        fNormalButton.setSelection(true);
-        fNormalButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event e) {
-                if (fNormalButton.getSelection()) {
-                    fMode = TraceConfig.NORMAL_MODE;
-                }
-            }
-        });
-        fFlightRecorderButton.addListener(SWT.Selection, new Listener() {
-               @Override
-               public void handleEvent(Event e) {
-                       if (fFlightRecorderButton.getSelection()) {
-                               fMode = TraceConfig.FLIGHT_RECORDER_MODE;
-                       }
-               }
-        });
-        if (fTargetResource.isUst()) {
-               fFlightRecorderButton.setEnabled(false);
-               fNormalButton.setEnabled(false);
-        }
-
-        fErrorLabel = new Label(shell, SWT.NULL);
-        fDisplay = parent.getDisplay();
-        fErrorLabel.setForeground(fDisplay.getSystemColor(SWT.COLOR_RED));
-        griddata = new GridData();
-        griddata.widthHint = 400;
-        griddata.minimumWidth = 400;
-        fErrorLabel.setLayoutData(griddata);
-
-        Label shadow_sep_h = new Label(shell, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
-        griddata = new GridData();
-        griddata.horizontalAlignment = SWT.FILL;
-        griddata.grabExcessHorizontalSpace = true;
-        griddata.verticalIndent = 20;
-        shadow_sep_h.setLayoutData(griddata);
-
-        Composite buttonComposite = new Composite(shell, SWT.NONE);
-        buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-        buttonComposite.setLayout(new GridLayout(2, false));
-
-        Button cancelButton = new Button(buttonComposite, SWT.PUSH);
-        cancelButton.setText(Messages.ConfigureTraceDialog_Cancel);
-        cancelButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
-
-        fFinishButton = new Button(buttonComposite, SWT.PUSH);
-        fFinishButton.setText(Messages.ConfigureTraceDialog_Finish);
-        fFinishButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
-        fFinishButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                fFinishButtonClicked = true;
-                shell.dispose();
-            }
-        });
-        validate();
-        
-        cancelButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                fTraceName = null;
-                fTraceTransport = null;
-                fTracePath = null;
-                shell.dispose();
-            }
-        });
-
-        shell.addListener(SWT.Traverse, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                if (event.detail == SWT.TRAVERSE_ESCAPE) {
-                    event.doit = false;
-                }
-            }
-        });
-        shell.pack();
-        shell.open();
-
-        Display display = parent.getDisplay();
-        while (!shell.isDisposed()) {
-            if (!display.readAndDispatch()) {
-                display.sleep();
-            }
-        }
-        if ((fTraceName == null) || (fTraceTransport == null) || (fTracePath == null) || (!fFinishButtonClicked)) {
-            return null;
-        }
-        TraceConfig result = new TraceConfig();
-        result.setTraceName(fTraceName);
-        result.setTraceTransport(fTraceTransport);
-        result.setTracePath(fTracePath);
-        result.setNetworkTrace(fIsLocal);
-        result.setIsAppend(fIsAppend);
-        result.setMode(fMode);
-        result.setNumChannel(fNumChannel);
-        result.setProject(fProject);
-        defaultProject = fProject;
-        return result;
-    }
-
-    /*
-     * Validates the trace name which has to be unique.
-     */
-    private boolean validateTraceName(String name) {
-        if (name.length() > 0) {
-            TraceResource[] traces = new TraceResource[0];
-            try {
-                traces = fSubSystem.getAllTraces();
-            } catch (SystemMessageException e) {
-                SystemBasePlugin.logError("NewTraceDialog ", e); //$NON-NLS-1$
-            }
-            for (int i = 0; i < traces.length; i++) {
-                if (traces[i].getName().compareTo(name) == 0) {
-                    fTraceNameError = Messages.NewTraceDialog_Error_Already_Exists;
-                    fErrorLabel.setText(fTraceNameError);
-                    return false;
-                }
-            }
-            final char[] chars = name.toCharArray();
-            for (int x = 0; x < chars.length; x++) {
-                final char c = chars[x];
-                if ((x == 0) && !(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) {
-                    fTraceNameError = Messages.NewTraceDialog_Error_Invalid_First_Char;
-                    fErrorLabel.setText(fTraceNameError);
-                    return false;
-                } else if (x != 0) {
-                    if (!((c >= 'a') && (c <= 'z')) && !((c >= 'A') && (c <= 'Z')) && !((c >= '0') && (c <= '9'))) {
-                        fTraceNameError = Messages.NewTraceDialog_Error_Invalid_Name;
-                        fErrorLabel.setText(fTraceNameError);
-                        return false;
-                    }
-                }
-            }
-        }
-        if (fTracePathError.length() > 0) {
-               fErrorLabel.setText(fTracePathError);
-        } else {
-               fErrorLabel.setText(""); //$NON-NLS-1$
-        }
-        fTraceNameError = ""; //$NON-NLS-1$
-        return true;
-    }
-
-    /*
-     * Validates the trace path.
-     */
-    private boolean validatePathName(String path) {
-        if (path.length() > 0) {
-            final char c0 = path.charAt(0);
-            if (c0 != '/') {
-                fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Path;
-                fErrorLabel.setText(fTracePathError);
-                return false;
-            } else {
-                String[] folders = path.split("/"); //$NON-NLS-1$
-                for (int i = 0; i < folders.length; i++) {
-                    final char[] chars = folders[i].toCharArray();
-                    for (int x = 0; x < chars.length; x++) {
-                        final char c = chars[x];
-                        if ((c >= 'a') && (c <= 'z')) {
-                            continue; // lowercase
-                        }
-                        if ((c >= 'A') && (c <= 'Z')) {
-                            continue; // uppercase
-                        }
-                        if ((c >= '0') && (c <= '9')) {
-                            continue; // numeric
-                        }
-                        fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Folder;
-                        fErrorLabel.setText(fTracePathError);
-                        return false;
-                    }
-                }
-                if (path.length() > 1) {
-                    for (int i = 0; i < path.length() - 1; i++) {
-                        if ((path.charAt(i) == '/') && (path.charAt(i + 1) == '/')) {
-                            fTracePathError = Messages.ConfigureTraceDialog_Error_Multiple_Seps;
-                            fErrorLabel.setText(fTracePathError);
-                            return false;
-                        }
-                    }
-                }
-            }
-            if (fIsLocal) {
-                File file = new File(path);
-                if (file.isFile()) {
-                    fTracePathError = Messages.ConfigureTraceDialog_Error_File_Exists;
-                    fErrorLabel.setText(fTracePathError);
-                    return false;
-                }
-                if (path.length() > 1 && !file.getParentFile().canWrite()) {
-                    fTracePathError = Messages.ConfigureTraceDialog_Error_Can_Not_Write;
-                    fErrorLabel.setText(fTracePathError);
-                    return false;
-                }
-            }
-        }
-        if (fTraceNameError.length() > 0) {
-               fErrorLabel.setText(fTraceNameError);
-        } else {
-               fErrorLabel.setText(""); //$NON-NLS-1$
-        }
-        fTracePathError = ""; //$NON-NLS-1$
-        return true;
-    }
-    
-    /*
-     * It validates all input values.
-     */
-    private void validate() {
-        if ((fTracePathError.length() > 0) || (fTraceNameError.length() > 0)) {
-            fFinishButton.setEnabled(false);
-            return;
-        }
-        if ((fNameText.getText() == null) || (fNameText.getText().length() == 0)) {
-            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_Name);
-            fFinishButton.setEnabled(false);
-            return;
-        }
-        if ((fTransportText.getText() == null) || (fTransportText.getText().length() == 0)) {
-            fFinishButton.setEnabled(false);
-            return;
-        }
-        if (fPathText.getText().length() == 0) {
-            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_Path);
-            fFinishButton.setEnabled(false);
-            return;
-        }
-        if (fProject == null) {
-            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_Project);
-            fFinishButton.setEnabled(false);
-            return;
-        }
-        if ((fNumLttdThreadsText.getText().length() == 0) || (fNumLttdThreadsText.getText().length() == 0)) {
-            fErrorLabel.setText(Messages.NewTraceDialog_Error_No_NumLttdThreads);
-            fFinishButton.setEnabled(false);
-            return;
-        }
-        fErrorLabel.setText(""); //$NON-NLS-1$
-        fTraceName = fNameText.getText();
-        fTraceTransport = fTransportText.getText();
-        fTracePath = fPathText.getText();
-        fNumChannel = Integer.parseInt(fNumLttdThreadsText.getText());
-        fFinishButton.setEnabled(true);
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/SelectTracePathDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/dialogs/SelectTracePathDialog.java
deleted file mode 100644 (file)
index db9f744..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.dialogs;
-
-import java.io.File;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * <b><u>SelectTracePathDialog</u></b>
- * <p>
- * Dialog box to configure and select a trace path.
- * </p>
- */
-public class SelectTracePathDialog extends Dialog {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private Text fPath = null;
-    private String fPathName = null;
-    private String fTracePathError = null;
-    private Label fErrorLabel = null;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     * 
-     * @param parentShell The paren shell
-     */
-    public SelectTracePathDialog(Shell parentShell) {
-        super(parentShell);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
-     */
-    @Override
-    protected void configureShell(Shell newShell) {
-        super.configureShell(newShell);
-        newShell.setText(Messages.SeletctTracePathDialog_Title);    
-        newShell.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-     */
-    @Override
-    protected Control createDialogArea(Composite parent) {
-        //Main dialog panel
-        Composite composite = new Composite(parent, SWT.RESIZE);
-        GridLayout mainLayout = new GridLayout(1, true);
-        composite.setLayout(mainLayout);
-        
-        fErrorLabel = new Label(composite, SWT.LEFT);
-        fErrorLabel.setLayoutData(new GridData(GridData.FILL, 
-                GridData.CENTER, true, false, 6, 1));
-        fErrorLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
-        
-        Group group = new Group(composite, SWT.SHADOW_OUT);
-        group.setText(Messages.ConfigureTraceDialog_Trace_Location);
-        group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
-        
-        GridLayout groupLayout = new GridLayout(6, true);
-        group.setLayout(groupLayout);
-
-        Label tracePathLabel = new Label(group, SWT.LEFT);
-        tracePathLabel.setText(Messages.ConfigureTraceDialog_Trace_Path);
-        tracePathLabel.setLayoutData(new GridData(GridData.FILL, 
-                GridData.CENTER, true, false, 1, 1));
-        
-        fPath = new Text(group, SWT.LEFT);
-        fPath.setLayoutData(new GridData(GridData.FILL, 
-                GridData.CENTER, true, false, 4, 1));
-        
-        fPath.addListener(SWT.Modify, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                Button ok = getButton(IDialogConstants.OK_ID);
-                ok.setEnabled(validatePathName(fPath.getText()));
-            }
-        });
-        
-        Button browseButton = new Button(group, SWT.PUSH);
-        browseButton.setText(Messages.ConfigureTraceDialog_Browse + "...");  //$NON-NLS-1$
-        browseButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
-        
-        browseButton.setEnabled(true);
-        browseButton.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                DirectoryDialog dialog = new DirectoryDialog(getShell());
-                String newPath = dialog.open();
-                if (newPath != null) {
-                    fPath.setText(newPath);
-                }
-            }
-        });
-        return composite;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
-     */
-    @Override
-    protected void createButtonsForButtonBar(Composite parent) {
-        Button ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
-        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-        
-        ok.setEnabled(false);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-     */
-    @Override
-    protected void okPressed() {
-        fPathName = fPath.getText();
-
-        File newDir = new File(fPathName);
-        if (!newDir.exists()) {
-            try {
-                newDir.mkdirs();
-            } catch (Exception e) {
-                // Should not happen
-            }
-        }
-
-        super.okPressed();
-    }
-
-    /*
-     * Validates the trace path.
-     */
-    private boolean validatePathName(String path) {
-        if (path.length() > 0) {
-            final char c0 = path.charAt(0);
-            if (c0 != '/') {
-                fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Path;
-                fErrorLabel.setText(fTracePathError);
-                return false;
-            } else {
-                String[] folders = path.split("/"); //$NON-NLS-1$
-                for (int i = 0; i < folders.length; i++) {
-                    final char[] chars = folders[i].toCharArray();
-                    for (int x = 0; x < chars.length; x++) {
-                        final char c = chars[x];
-                        if ((c >= 'a') && (c <= 'z')) {
-                            continue; // lowercase
-                        }
-                        if ((c >= 'A') && (c <= 'Z')) {
-                            continue; // uppercase
-                        }
-                        if ((c >= '0') && (c <= '9')) {
-                            continue; // numeric
-                        }
-                        fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Folder;
-                        fErrorLabel.setText(fTracePathError);
-                        return false;
-                    }
-                }
-                if (path.length() > 1) {
-                    for (int i = 0; i < path.length() - 1; i++) {
-                        if ((path.charAt(i) == '/') && (path.charAt(i + 1) == '/')) {
-                            fTracePathError = Messages.ConfigureTraceDialog_Error_Multiple_Seps;
-                            fErrorLabel.setText(fTracePathError);
-                            return false;
-                        }
-                    }
-                }
-            }
-            
-            File file = new File(path);
-            if (file.isFile()) {
-                fTracePathError = Messages.ConfigureTraceDialog_Error_File_Exists;
-                fErrorLabel.setText(fTracePathError);
-                return false;
-            }
-            if (path.length() > 1 && !file.getParentFile().canWrite()) {
-                fTracePathError = Messages.ConfigureTraceDialog_Error_Can_Not_Write;
-                fErrorLabel.setText(fTracePathError);
-                return false;
-            }
-        }
-        fErrorLabel.setText(""); //$NON-NLS-1$
-        fTracePathError = ""; //$NON-NLS-1$
-        return true;
-    }
-
-    /**
-     * Returns the trace path.
-     * 
-     * @return trace path
-     */
-    public String getTracePath() {
-        return fPathName;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/messages.properties
deleted file mode 100644 (file)
index adad6e8..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-Property_Type_Provider_Filter=Providers filter
-Property_Type_Provider=Remote system filter
-
-Filter_Provider_Dlg_Title=Change Provider Filter
-Filter_Provider_Page_Title=Provider Filter
-Filter_Provider_Page_Text=Create a new filter to list providers
-
-Filter_Target_Dlg_Title=Change Target Filter
-Filter_Target_Page_Title=Target Filter
-Filter_Target_Page_Text=Create a new filter to list targets
-Filter_Target_Target_Prompt_label=Parent provider
-
-Filter_Trace_Dlg_Title=Change Trace Filter
-Filter_Trace_Page_Title=Trace Filter
-Filter_Trace_Page_Text=Create a new filter to list trace
-Filter_Trace_Target_Prompt_Label=Parent target
-
-Lttng_Resource_Root=root
-Lttng_Resource_Target=Target
-Lttng_Resource_Provider=Provider
-Lttng_Resource_Trace=Trace
-Lttng_Resource_Marker=Marker
-Lttng_Resource_Channel=Channel
-
-AllProviders=All Providers
-
-Trace_Connector_Service_Name=TCF
-Trace_Connector_Service_Description=Target Communication Framework
-Trace_Connector_Service_Connect_Msg=Connecting
-Trace_Connector_Service_Disconnect_Msg=Disconnecting
-Trace_Connector_Service_Canceled_Msg=Canceled
-
-Lttng_Control_Unknown_Event_Msg=Unknown event
-
-Lttng_Control_CommandError=lttng_control failed
-
-Lttng_Control_ErrorNewTrace=Create new trace failed
-Lttng_Control_ErrorConfigureTrace=Configure trace failed
-Lttng_Control_ErrorConfigureMarkers=Configure markers failed
-Lttng_Control_ErrorGetMarkers=Get markers failed
-Lttng_Control_ErrorGetMarkerInfo=Get marker info failed
-Lttng_Control_ErrorStart=Start tracing failed
-Lttng_Control_ErrorPause=Pause tracing failed
-Lttng_Control_ErrorStop=Destroy trace failed
-Lttng_Control_ErrorBrowse=Browse trace failed
-
-Lttng_Control_GetProvidersError=
-Lttng_Control_GetTargetsError=
-Lttng_Control_GetTracesError=   
-Lttng_Control_GetMarkersError=
-Lttng_Control_GetMarkerInfoError= 
-
-Ltt_Controller_Service_Not_Connected_Msg=Service not connected
-Ltt_Controller_Service_Unsupported_Msg=Remote peer does not support service
-
-Lttng_Control_ErrorSetChannelEnable=Set Channel Enable failed
-Lttng_Control_ErrorSetChannelOverwrite=Set Channel Overwrite failed
-Lttng_Control_ErrorSetSubbufNum=Set Number of Sub Buffers Enable failed
-Lttng_Control_ErrorSetSubbufSize=Set Sub Buffer size failed
-Lttng_Control_ErrorSetChannelTimer=Set Channel timer failed
-Lttng_Control_ErrorCreateTracePath=Can't create trace path.
-
-#Trace resource properties
-Ltt_Trace_Property_TracePathName=Trace path
-Ltt_Trace_Property_TracePathDescription=Location of trace
-Ltt_Trace_Property_NumberOfChannelsName=Number of channels
-Ltt_Trace_Property_NumberOfChannelsDescr=Number of channels
-Ltt_Trace_Property_FlighRecorderModeName=Flight recorder mode
-Ltt_Trace_Property_FlighRecorderModeDesc=Flight recorder mode (true or false)
-Ltt_Trace_Property_NormalModeName=Normal mode
-Ltt_Trace_Property_NormalModeDesc=Normal mode only (true or false)
-Ltt_Trace_Property_NetworkTraceName=Network trace
-Ltt_Trace_Property_NetWorkTraceDescr=Network trace (true or false)
-Ltt_Trace_Property_TraceTransportName=Trace transport
-Ltt_Trace_Property_TraceTransportDesc=Trace transport
-
-Ltt_ShutdownWarning=Shutdown Warning
-Ltt_NetworkTraceRunningWarning=One or more traces from type network are still running!\n\nThe following traces will be paused before disconnecting
-
-Ltt_TimeoutMsg=Timeout
-
-ConfigureMarkersDialog_Select_All=Select All
-ConfigureMarkersDialog_Call=Call
-ConfigureMarkersDialog_Cancel=Cancel
-ConfigureMarkersDialog_EventId=Event_id
-ConfigureMarkersDialog_Format=Format
-ConfigureMarkersDialog_Location=Location
-ConfigureMarkersDialog_NameColumn=Name
-ConfigureMarkersDialog_Ok=OK
-ConfigureMarkersDialog_Probe_Single=Probe single
-ConfigureMarkersDialog_Deselect_All=Deselect All
-ConfigureMarkersDialog_Title=Configure markers
-
-ConfigureTraceDialog_Append=Append
-ConfigureTraceDialog_Browse=Browse
-ConfigureTraceDialog_Cancel=Cancel
-ConfigureTraceDialog_Finish=Finish
-ConfigureTraceDialog_Mode_Flight_Recorder=Flight recorder
-ConfigureTraceDialog_Host=Host
-ConfigureTraceDialog_Target=Target
-ConfigureTraceDialog_Mode_None=None
-ConfigureTraceDialog_Mode_Normal=Normal
-ConfigureTraceDialog_Num_Lttd_Threads=Number of lttd threads
-ConfigureTraceDialog_Error_Invalid_Folder=Trace path error: folder is not alphanumeric
-ConfigureTraceDialog_Error_Invalid_Path=Trace path error: first character is not a slash
-ConfigureTraceDialog_Error_Multiple_Seps=Trace path error: the trace path contains 2 successive slashes
-ConfigureTraceDialog_Error_File_Exists=Trace path error: file exists
-ConfigureTraceDialog_Error_Can_Not_Write=Trace path error: can not write
-ConfigureTraceDialog_Title=Trace configuration
-ConfigureTraceDialog_Trace_Location=Trace location
-ConfigureTraceDialog_Trace_Mode=Trace mode
-ConfigureTraceDialog_Trace_Path=Trace path
-ConfigureTraceDialog_Trace_Transport=Trace transport
-
-NewTraceDialog_Title=Create a new trace
-NewTraceDialog_TraceName=Name
-NewTraceDialog_Tracing_Project=Tracing Project
-NewTraceDialog_Error_No_Name=No trace name entered
-NewTraceDialog_Error_No_Path=No trace path entered
-NewTraceDialog_Error_No_NumLttdThreads=No number of lttd threads entered
-NewTraceDialog_Error_No_Project=No tracing project selected
-NewTraceDialog_Error_Already_Exists=Trace name error: trace exists
-NewTraceDialog_Error_Invalid_First_Char=Trace name error: first character is not alphabetic
-NewTraceDialog_Error_Invalid_Name=Trace name error: char is not alphanumeric
-
-SeletctTracePathDialog_Title=Select local trace path
-
-ChannelConfigPage_BufferOverrideTooltip=Buffer override enabled flag
-ChannelConfigPage_ChannelEnabled=Enabled
-ChannelConfigPage_ChannelEnabledTooltip=Channel enabled flag
-ChannelConfigPage_ChannelName=Name
-ChannelConfigPage_ChannelNameTooltip=Name of channel
-ChannelConfigPage_ChannelOverride=Buffer Override
-ChannelConfigPage_ChannelTimer=Channel Timer
-ChannelConfigPage_ChannelTimerTooltip=Channel timer in milliseconds
-ChannelConfigPage_NumSubBuf=Number of Sub Buffers
-ChannelConfigPage_NumSubBufTooltip=Number of sub buffers
-ChannelConfigPage_PageTitle=Configure channel information
-ChannelConfigPage_SubBufSize=Sub Buffer Size
-ChannelConfigPage_SubBufSizeTooltip=Size of sub buffers
-
-ChannelConfigPage_EnableAll=Enable All
-ChannelConfigPage_DisableAll=Disable All
-ChannelConfigPage_EnableAllBufferOverride=Enable All (Buffer Overwrite)
-ChannelConfigage_DisableAllBufferOverride=Disable All (Buffer Overwrite)
-ChannelConfigPage_SetAll=Set All
-ChannelConfigPage_SetAllNumSubBuf=Set All (Number of Sub Buffers)
-channelConfigPage_SetAllSubBufSize=Set All (Size of Sub Buffers)
-ChannelConfigPage_SetAllChannelTimer=Set All (Channel Timer)
-
-DeleteTrace_ConfirmMessage=Are you sure you want to delete the selected trace?
-DeleteTrace_ConfirmTitle=Delete Trace
-
-ImportToProject_AlreadyExists=A trace with that name already exists in the project.
-ImportToProject_ImportFailed=Import failed
-ImportToProject_NoFileServiceSubsystem=Can't find file service subsystem.
-ImportToProject_NoProjectTraceFolder=Can't find file trace folder in selected project.
-ImportToProject_NoRemoteTraceFolder=Can't find remote trace folder.
-
-ImportTraceDialog_ImportButton=Import
-ImportTraceDialog_LinkOnly=Link Only
-ImportTraceDialog_NameLabel=Trace name:
-ImportTraceDialog_ProjectColumn=Project
-ImportTraceDialog_TableLabel=Import to project:
-ImportTraceDialog_Title=Import Trace
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/ProviderResourceAdapter.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/ProviderResourceAdapter.java
deleted file mode 100644 (file)
index 921b3fd..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-/**
- * <b><u>ProviderResourceAdapter</u></b>
- * <p>
- * This is the adapter which enables us to work with our remote provider resources.
- * </p>
- */
-public class ProviderResourceAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    /**
-     * Default Constructor.
-     */
-    public ProviderResourceAdapter() {
-        super();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
-     */
-    @Override
-    public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
-     */
-    @Override
-    public ImageDescriptor getImageDescriptor(Object element) {
-        return LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_PROVIDER);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#getText(java.lang.Object)
-     */
-    @Override
-    public String getText(Object element) {
-        return ((ProviderResource) element).getName();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
-     */
-    @Override
-    public String getAbsoluteName(Object object) {
-        ProviderResource provider = (ProviderResource) object;
-        return Messages.Lttng_Resource_Provider + "_" + provider.getName(); //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
-     */
-    @Override
-    public String getType(Object element) {
-        return Messages.Lttng_Resource_Provider;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
-     */
-    @Override
-    public Object getParent(Object element) {
-        return null; // not really used, which is good because it is ambiguous
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
-        return ((ProviderResource) element).getTargets();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
-     */
-    @Override
-    protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
-     */
-    @Override
-    protected Object internalGetPropertyValue(Object key) {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#canRename(java.lang.Object)
-     * 
-     * Intercept of parent method to indicate these objects can be renamed using the RSE-supplied rename action.
-     */
-    @Override
-    public boolean canRename(Object element) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object)
-     */
-    @Override
-    public boolean showDelete(Object element) {
-        return false;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
-     */
-    @Override
-    public boolean showRefresh(Object element) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object)
-     */
-    @Override
-    public boolean showRename(Object element) {
-        return false;
-    }
-
-    // --------------------------------------
-    // ISystemRemoteElementAdapter methods...
-    // --------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
-     */
-    @Override
-    public String getAbsoluteParentName(Object element) {
-        return Messages.Lttng_Resource_Root; // not really applicable as we have no unique hierarchy
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getSubSystemConfigurationId(java.lang.Object)
-     */
-    @Override
-    public String getSubSystemConfigurationId(Object element) {
-        return "org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystemConfiguration"; // as declared in extension in plugin.xml  //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
-     */
-    @Override
-    public String getRemoteTypeCategory(Object element) {
-        return TraceControlConstants.Rse_Provider_Resource_Remote_Type_Category; // Course grained. Same for all our remote resources.
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
-     */
-    @Override
-    public String getRemoteType(Object element) {
-        return TraceControlConstants.Rse_Provider_Resource_Remote_Type; // Fine grained. Unique to this resource type.
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
-     */
-    @Override
-    public String getRemoteSubType(Object element) {
-        return null; // Very fine grained. We don't use it.
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
-     */
-    @Override
-    public boolean refreshRemoteObject(Object oldElement, Object newElement) {
-        ProviderResource oldProvider = (ProviderResource) oldElement;
-        ProviderResource newProvider = (ProviderResource) newElement;
-        newProvider.setName(oldProvider.getName());
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
-     */
-    @Override
-    public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception {
-        TraceSubSystem ourSS = (TraceSubSystem) getSubSystem(element);
-        ProviderResource[] allProviders = ourSS.getAllProviders();
-        String[] allNames = new String[allProviders.length];
-        for (int idx = 0; idx < allProviders.length; idx++) {
-            allNames[idx] = allProviders[idx].getName();
-        }
-        return allNames; // Return list of all team names
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(org.eclipse.core.runtime.IAdaptable)
-     */
-    @Override
-    public boolean hasChildren(IAdaptable element) {
-        return ((((ProviderResource) element).getTargets() != null) && (((ProviderResource) element).getTargets().length > 0));
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TargetResourceAdapter.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TargetResourceAdapter.java
deleted file mode 100644 (file)
index b6747dc..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-/**
- * <b><u>TargetResourceAdapter</u></b>
- * <p>
- * This is the adapter which enables us to work with our remote target resources.
- * </p>
- */
-public class TargetResourceAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     */
-    public TargetResourceAdapter() {
-        super();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
-     */
-    @Override
-    public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
-     */
-    @Override
-    public ImageDescriptor getImageDescriptor(Object object) {
-        return LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_TARGET);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#getText(java.lang.Object)
-     */
-    @Override
-    public String getText(Object element) {
-        return ((TargetResource) element).getName();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
-     */
-    @Override
-    public String getAbsoluteName(Object object) {
-        TargetResource tar = (TargetResource) object;
-        return tar.getName();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
-     */
-    @Override
-    public String getType(Object element) {
-        return Messages.Lttng_Resource_Target;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
-     */
-    @Override
-    public Object getParent(Object object) {
-        return ((TargetResource) object).getParent(); // not really used, which is good because it is ambiguous
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
-        return ((TargetResource) element).getTraces();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
-     */
-    @Override
-    protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
-     */
-    @Override
-    protected Object internalGetPropertyValue(Object key) {
-        return null;
-    }
-
-    // --------------------------------------
-    // ISystemRemoteElementAdapter methods...
-    // --------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
-     */
-    @Override
-    public String getAbsoluteParentName(Object element) {
-        return Messages.Lttng_Resource_Root; // not really applicable as we have no unique hierarchy
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getSubSystemConfigurationId(java.lang.Object)
-     */
-    @Override
-    public String getSubSystemConfigurationId(Object element) {
-        return "org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteTypeCategory(java.lang.Object)
-     */
-    @Override
-    public String getRemoteTypeCategory(Object element) {
-        return TraceControlConstants.Rse_Target_Resource_Remote_Type_Category; // Course grained. Same for all our remote resources.
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteType(java.lang.Object)
-     */
-    @Override
-    public String getRemoteType(Object element) {
-        return TraceControlConstants.Rse_Target_Resource_Remote_Type; // Fine grained. Unique to this resource type.
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteSubType(java.lang.Object)
-     */
-    @Override
-    public String getRemoteSubType(Object element) {
-        return null; // Very fine grained. We don't use it.
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
-     */
-    @Override
-    public boolean refreshRemoteObject(Object oldElement, Object newElement) {
-        TargetResource oldDevr = (TargetResource) oldElement;
-        TargetResource newDevr = (TargetResource) newElement;
-        newDevr.setName(oldDevr.getName());
-        return true;
-    }
-
-    public boolean supportsUserDefinedActions(Object object) {
-        return true;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(org.eclipse.core.runtime.IAdaptable)
-     */
-    @Override
-    public boolean hasChildren(IAdaptable element) {
-        return ((((TargetResource) element).getTraces() != null) && (((TargetResource) element).getTraces().length > 0));
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object)
-     */
-    @Override
-    public boolean showDelete(Object element) {
-        return false;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
-     */
-    @Override
-    public boolean showRefresh(Object element) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object)
-     */
-    @Override
-    public boolean showRename(Object element) {
-        return false;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#saveExpansionState(java.lang.Object)
-     */
-    @Override
-    public boolean saveExpansionState(Object element) {
-        return true;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
-     */
-    @Override
-    public boolean testAttribute(Object target, String name, String value) {
-        
-        if (target instanceof TargetResource) {
-            if ((name.compareTo("canCreateNewTrace") == 0) && (((TargetResource)target).getCanCreateNewTrace().compareTo(value) == 0)) { //$NON-NLS-1$ 
-                return true;
-            }
-        }
-        
-        return super.testAttribute(target, name, value);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TraceAdapterFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TraceAdapterFactory.java
deleted file mode 100644 (file)
index 37bc564..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * <b><u>TargetResourceAdapter</u></b>
- * <p>
- * This factory maps requests for an adapter object from a given remote object.
- * </p>
- */
-public class TraceAdapterFactory extends AbstractSystemRemoteAdapterFactory implements IAdapterFactory {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private ProviderResourceAdapter providerAdapter = new ProviderResourceAdapter();
-    private TargetResourceAdapter targetAdapter = new TargetResourceAdapter();
-    private TraceResourceAdapter traceAdapter = new TraceResourceAdapter();
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor for TraceAdapterFactory.
-     */
-    public TraceAdapterFactory() {
-        super();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
-     */
-    @SuppressWarnings("rawtypes")
-    @Override
-    public Object getAdapter(Object adaptableObject, Class adapterType) {
-        ISystemViewElementAdapter adapter = null;
-        if (adaptableObject instanceof ProviderResource) {
-            adapter = providerAdapter;
-        }
-        else if (adaptableObject instanceof TargetResource) {
-            adapter = targetAdapter;
-        }
-        else if (adaptableObject instanceof TraceResource) {
-            adapter = traceAdapter;
-        }
-        // these lines are very important!
-        if ((adapter != null) && (adapterType == IPropertySource.class)) {
-            adapter.setPropertySourceInput(adaptableObject);
-        }
-        return adapter;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TraceResourceAdapter.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/TraceResourceAdapter.java
deleted file mode 100644 (file)
index 9125b59..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.PropertyInfo;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-/**
- * <b><u>TargetResourceAdapter</u></b>
- * <p>
- * This is the adapter which enables us to work with our remote trace resources.
- * </p>
- */
-public class TraceResourceAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter {
-
- // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     */
-    public TraceResourceAdapter() {
-        super();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
-     */
-    @Override
-    public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object)
-     */
-    @Override
-    public ImageDescriptor getImageDescriptor(Object object) {
-        return LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_TRACE);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#getText(java.lang.Object)
-     */
-    @Override
-    public String getText(Object element) {
-        return ((TraceResource) element).getName();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
-     */
-    @Override
-    public String getAbsoluteName(Object object) {
-        TraceResource tar = (TraceResource) object;
-        return tar.getName();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object)
-     */
-    @Override
-    public String getType(Object element) {
-        return Messages.Lttng_Resource_Trace;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object)
-     */
-    @Override
-    public Object getParent(Object object) {
-        return ((TraceResource) object).getParent();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
-     */
-    @Override
-    protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
-        // propertySourceInput holds the currently selected object
-        TraceResource trace = (TraceResource)propertySourceInput;
-
-        Map<String, PropertyInfo> properties = trace.getPropertyInfo();
-
-        PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[properties.size()];
-
-        Set<String> keys = properties.keySet();
-        int i = 0;
-        for (Iterator<String> iterator = keys.iterator(); iterator.hasNext();) {
-            String key = iterator.next();
-            PropertyInfo info = properties.get(key);
-            propertyDescriptors[i++] = createSimplePropertyDescriptor(key, info.getName(), info.getDescription());
-        }
-
-        return propertyDescriptors;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object)
-     */
-    @Override
-    protected Object internalGetPropertyValue(Object key) {
-        // propertySourceInput holds the currently selected object
-        TraceResource trace = (TraceResource)propertySourceInput;
-        return trace.getProperty((String)key);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object)
-     */
-    @Override
-    public boolean showDelete(Object element) {
-        return false;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
-     */
-    @Override
-    public boolean showRefresh(Object element) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object)
-     */
-    @Override
-    public boolean showRename(Object element) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#supportsDeferredQueries(org.eclipse.rse.core.subsystems.ISubSystem)
-     */
-    @Override
-    public boolean supportsDeferredQueries(ISubSystem subSys) {
-        return false;
-    }
-    // --------------------------------------
-    // ISystemRemoteElementAdapter methods...
-    // --------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
-     */
-    @Override
-    public String getAbsoluteParentName(Object element) {
-        return Messages.Lttng_Resource_Root; // not really applicable as we have no unique hierarchy
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getSubSystemConfigurationId(java.lang.Object)
-     */
-    @Override
-    public String getSubSystemConfigurationId(Object element) {
-        return "org.eclipse.linuxtools.lttng.rse.subsystems.factory"; // as declared in extension in plugin.xml //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteTypeCategory(java.lang.Object)
-     */
-    @Override
-    public String getRemoteTypeCategory(Object element) {
-        return TraceControlConstants.Rse_Trace_Resource_Remote_Type_Category; // Course grained. Same for all our remote resources.
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteType(java.lang.Object)
-     */
-    @Override
-    public String getRemoteType(Object element) {
-        return TraceControlConstants.Rse_Trace_Resource_Remote_Type; // Fine grained. Unique to this resource type.
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider#getRemoteSubType(java.lang.Object)
-     */
-    @Override
-    public String getRemoteSubType(Object element) {
-        return null; // Very fine grained. We don't use it.
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
-     */
-    @Override
-    public boolean refreshRemoteObject(Object oldElement, Object newElement) {
-        TraceResource oldDevr = (TraceResource) oldElement;
-        TraceResource newDevr = (TraceResource) newElement;
-        newDevr.setName(oldDevr.getName());
-        return true;
-    }
-
-     /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
-     */
-    public boolean supportsUserDefinedActions(Object object) {
-        return true;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception {
-        return null; // leave as null if this is the root
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(org.eclipse.core.runtime.IAdaptable)
-     */
-    @Override
-    public boolean hasChildren(IAdaptable arg0) {
-        return false;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
-     */
-    @SuppressWarnings("nls")
-    @Override
-    public boolean testAttribute(Object target, String name, String value) {
-        if(target instanceof TraceResource) {
-            TraceResource trace = (TraceResource) target;
-            if (name.equals("canConfigure") && value.equals("yes")) {
-                if (trace.getTraceState() != TraceState.STOPPED) {
-                    return true;
-                }
-            }
-            else if (name.equals("canStart") && value.equals("yes")) {
-                if (trace.getTraceState() == TraceState.CONFIGURED|| trace.getTraceState() == TraceState.PAUSED) {
-                    return true;
-                }
-            }
-            else if (name.equals("canPause") && value.equals("yes")) {
-                if (trace.getTraceState() == TraceState.STARTED) {
-                    return true;
-                }
-            }
-            else if (name.equals("canStop") && value.equals("yes")) {
-                if (trace.getTraceState() == TraceState.CREATED || trace.getTraceState() == TraceState.PAUSED || trace.getTraceState() == TraceState.CONFIGURED) {
-                    return true;
-                }
-            }
-            else if (name.equals("canBrowse") && value.equals("yes")) {
-                if ((trace.getTraceConfig() != null) && trace.getTraceConfig().isNetworkTrace() && (trace.getTraceState() == TraceState.STOPPED)) {
-                    return true;
-                }
-            }
-            else if (name.equals("canDelete") && value.equals("yes")) {
-                if (trace.getTraceState() == TraceState.STOPPED) {
-                    return true;
-                }
-            }
-            else if (name.equals("canImport") && value.equals("yes")) {
-                if (trace.getTraceState() == TraceState.STOPPED) {
-                    return true;
-                } else if (trace.getTraceState() != TraceState.CREATED && trace.getTraceConfig().isNetworkTrace()) {
-                       return true;
-                }
-            }
-        }
-        return super.testAttribute(target, name, value);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelCellModifier.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelCellModifier.java
deleted file mode 100644 (file)
index 0217b94..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config;
-
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards.KernelTraceChannelConfigurationPage;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * <b><u>TraceChannelCellModifier</u></b>
- * <p>
- *  ICellModifier implementation for TableViewers in order to modify cells of a table used for 
- *  for displaying and configuring trace channel information.  
- * </p>
- */
-public class TraceChannelCellModifier implements ICellModifier {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // -----------------------------------------------------------------------
-    KernelTraceChannelConfigurationPage fConfigPage;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // -----------------------------------------------------------------------
-    
-    /**
-     * Constructor
-     * 
-     * @param configPage The trace configuration reference
-     */
-    public TraceChannelCellModifier(KernelTraceChannelConfigurationPage configPage) {
-        fConfigPage = configPage;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
-     */
-    @Override
-    public boolean canModify(Object element, String property) {
-        // Find the index of the column
-        int columnIndex = fConfigPage.getColumnProperties().indexOf(property);
-
-        switch (columnIndex) {
-            case 0: // Name
-                return false;
-            case 1: // Enabled
-            case 2: // Buffer Overwrite
-            case 3: // SubbufNum
-            case 4: // SubbufSize
-                if ((fConfigPage.getTraceState() == TraceState.CREATED) || (fConfigPage.getTraceState() == TraceState.CONFIGURED)) {
-                    return true;
-                }
-                break;
-            case 5: // Channel Timer
-                if (fConfigPage.isLocalTrace() && ((fConfigPage.getTraceState() == TraceState.CREATED) || (fConfigPage.getTraceState() == TraceState.CONFIGURED))) {
-                    return true;
-                }
-                break;
-            default:  
-        }
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
-     */
-    @Override
-    public Object getValue(Object element, String property) {
-        
-        // Find the index of the column
-        int columnIndex = fConfigPage.getColumnProperties().indexOf(property);
-
-        Object result = null;
-        TraceChannel chan = (TraceChannel) element;
-        
-        switch (columnIndex) {
-            case 0: // Name
-                result = chan.getName();
-                break;
-            case 1: // Enabled
-                result = Boolean.valueOf(chan.isEnabled());
-                break;
-            case 2: // Buffer Overwrite
-                result = Boolean.valueOf(chan.isChannelOverride());
-                break;
-            case 3: // SubbufNum
-                result = String.valueOf(chan.getSubbufNum());
-                break;
-            case 4: // SubbufSize
-                result = String.valueOf(chan.getSubbufSize());
-                break;
-            case 5: // Channel Timer
-                result = String.valueOf(chan.getTimer());
-                break;
-            default:
-                    result = "";  //$NON-NLS-1$
-        }
-        return result;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
-     */
-    @Override
-    public void modify(Object element, String property, Object value) {
-        //  Find the index of the column
-        int columnIndex = fConfigPage.getColumnProperties().indexOf(property);
-
-        TableItem item = (TableItem) element;
-        TraceChannel chan = (TraceChannel) item.getData();
-        String valueString;
-
-        switch (columnIndex) {
-        case 0:
-            chan.setName(((String) value).trim());
-            break;
-        case 1: // Name
-            chan.setIsEnabled(((Boolean) value).booleanValue());
-            break;
-        case 2: 
-            chan.setIsChannelOverride(((Boolean) value).booleanValue());
-            break;
-        case 3: // SubbufNum
-            valueString = ((String) value).trim();
-            if (valueString.length() == 0) {
-                valueString = "0"; //$NON-NLS-1$
-            }
-            else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
-                chan.setSubbufNum(TraceChannel.UNKNOWN_VALUE);
-            }
-            else {
-                chan.setSubbufNum(Integer.parseInt(valueString));
-            }
-            break;
-        case 4: // SubbufSize
-            valueString = ((String) value).trim();
-            if (valueString.length() == 0) {
-                valueString = "0"; //$NON-NLS-1$
-            }
-            else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
-                chan.setSubbufSize(TraceChannel.UNKNOWN_VALUE);
-            }
-            else {
-                chan.setSubbufSize(Integer.parseInt(valueString));
-            }
-            break;
-        case 5:  // Channel Timer
-            valueString = ((String) value).trim();
-            if (valueString.length() == 0) {
-                valueString = "0"; //$NON-NLS-1$
-            }
-            else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
-                chan.setTimer(TraceChannel.UNKNOWN_VALUE);
-            }
-            else {
-                chan.setTimer(Integer.parseInt(valueString));
-            }
-            break;
-        default:
-        }
-        fConfigPage.refresh();
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelTableContentProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelTableContentProvider.java
deleted file mode 100644 (file)
index eda935e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
-
-/**
- * <b><u>TraceChannelTableContentProvider</u></b>
- * <p>
- *  IStructuredContentProvider implementation for TableViewers in order to provide the content of a table 
- *  used for displaying and configuring trace channel information.  
- * </p>
- */
-public class TraceChannelTableContentProvider implements IStructuredContentProvider {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // -----------------------------------------------------------------------
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // -----------------------------------------------------------------------
-    
-    // ------------------------------------------------------------------------
-    // Operations
-    // -----------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
-     */
-    @Override
-    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
-     */
-    @Override
-    public Object[] getElements(Object inputElement) {
-        if (inputElement instanceof TraceChannels) {
-            return ((TraceChannels)inputElement).values().toArray();
-        }
-        return null;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelTableLabelProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/model/config/TraceChannelTableLabelProvider.java
deleted file mode 100644 (file)
index bc3abca..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * <b><u>TraceChannelTableLabelProvider</u></b>
- * <p>
- *  ITableLabelProvider implementation for TableViewers in order to provide the labels of a table 
- *  used for displaying and configuring trace channel information.  
- * </p>
- */
-public class TraceChannelTableLabelProvider implements ITableLabelProvider {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // -----------------------------------------------------------------------
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // -----------------------------------------------------------------------
-    
-    // ------------------------------------------------------------------------
-    // Operations
-    // -----------------------------------------------------------------------
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
-     */
-    @Override
-    public void addListener(ILabelProviderListener listener) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
-     */
-    @Override
-    public void dispose() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
-     */
-    @Override
-    public boolean isLabelProperty(Object element, String property) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
-     */
-    @Override
-    public void removeListener(ILabelProviderListener listener) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
-     */
-    @Override
-    public Image getColumnImage(Object element, int columnIndex) {
-        if (element instanceof TraceChannel) {
-            TraceChannel chan = (TraceChannel) element;
-            switch (columnIndex) {
-            case 1: 
-                return getImage(chan.isEnabled() && chan.isEnabledStatusKnown());
-            case 2: 
-                return getImage(chan.isChannelOverride() && chan.isChannelOverrideStatusKnown());    
-            default:
-            }
-        }
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
-     */
-    @Override
-    public String getColumnText(Object element, int columnIndex) {
-        if (element instanceof TraceChannel) {
-            TraceChannel chan = (TraceChannel) element;
-            switch (columnIndex) {
-            case 0: 
-                return chan.getName();
-            case 1: 
-                if (!chan.isEnabledStatusKnown())  {
-                    return TraceChannel.UNKNOWN_STRING;
-                }
-                break;
-            case 2:
-                if (!chan.isChannelOverrideStatusKnown()) { 
-                    return TraceChannel.UNKNOWN_STRING;
-                }
-                break;
-            case 3:
-                if (chan.getSubbufNum() == TraceChannel.UNKNOWN_VALUE) {
-                    return TraceChannel.UNKNOWN_STRING;
-                }
-                return String.valueOf(chan.getSubbufNum());
-            case 4: 
-                if (chan.getSubbufSize() == TraceChannel.UNKNOWN_VALUE) {
-                    return TraceChannel.UNKNOWN_STRING;
-                }
-                return String.valueOf(chan.getSubbufSize());
-            case 5:
-                if (chan.getTimer() == TraceChannel.UNKNOWN_VALUE) { 
-                    return TraceChannel.UNKNOWN_STRING;
-                }
-                return String.valueOf(chan.getTimer());
-            default:
-                // fall through
-            }
-        }
-        return null;
-    }
-
-    /*
-     * Gets the checked or unchecked image.
-     */
-    private Image getImage(boolean isSelected) {
-        if (isSelected) {
-            return LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_CHECKED);
-        }
-        return LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_UNCHECKED);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/ITCFSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/ITCFSubSystem.java
deleted file mode 100644 (file)
index 3967cb5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Wind River Systems - initial API and implementation
- *     Bernd Hufmann - Adapted for Lttng
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems;
-
-import org.eclipse.rse.core.subsystems.ISubSystem;
-
-/**
- * A subsystem can implement this interface to indicate that it can share TCF connection with
- * other subsystems on same host.
- */
-public interface ITCFSubSystem extends ISubSystem {
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/ITraceSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/ITraceSubSystem.java
deleted file mode 100644 (file)
index 37078cb..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems;
-
-/**
- * A subsystem can implement this interface to indicate that this subsystem is a Trace Subsystem.
- */
-public interface ITraceSubSystem extends ITCFSubSystem {
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java
deleted file mode 100644 (file)
index 4579945..0000000
+++ /dev/null
@@ -1,819 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Vector;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.ProviderResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TargetResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.LttControllerServiceProxy;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.ImportToProject;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.actions.PauseTrace;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.connectorservice.TraceConnectorService;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.core.subsystems.CommunicationsEvent;
-import org.eclipse.rse.core.subsystems.ICommunicationsListener;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.services.clientserver.NamePatternMatcher;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-/**
- * <b><u>TraceSubSystem</u></b>
- * <p>
- * Implementation of the trace subsystem. Provides methods to initialize connections
- * to the remote system, connection handling, filtering and retrival of remote
- * system configuration. 
- * </p>
- */
-public class TraceSubSystem extends SubSystem implements ICommunicationsListener {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private ProviderResource[] fProviders; // master list of Providers
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    /**
-     * @param host
-     * @param connectorService
-     */
-    public TraceSubSystem(IHost host, IConnectorService connectorService) {
-        super(host, connectorService);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void initializeSubSystem(IProgressMonitor monitor) {
-        getConnectorService().addCommunicationsListener(this);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void uninitializeSubSystem(IProgressMonitor monitor) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String)
-     *
-     * For drag and drop, and clipboard support of remote objects.
-     * 
-     * Return the remote object within the subsystem that corresponds to the specified unique ID. Because each subsystem maintains it's own objects, it's the responsability of the subsystem to determine how an ID (or key) for a given object maps to
-     * the real object. By default this returns null.
-     */
-    @Override
-    public Object getObjectWithAbsoluteName(String key) {
-        return null;
-    }
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException {
-        
-        ProviderResource[] allProviders;
-
-        try {
-             allProviders = getAllProviders();
-        } catch (SystemMessageException e) {
-            SystemBasePlugin.logError("TraceSubSystem", e); //$NON-NLS-1$
-            Object[] children = new SystemMessageObject[1];
-            children[0] = new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null);
-            return children;
-        }
-
-        // Now, subset master list, based on filter string...
-        NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
-        Vector<ProviderResource> v = new Vector<ProviderResource>();
-        for (int idx = 0; idx < allProviders.length; idx++) {
-            if (subsetter.matches(allProviders[idx].getName())) {
-                v.addElement(allProviders[idx]);
-            }
-        }
-        return allProviders;
-    }
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(java.lang.Object, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException {
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#filterEventFilterCreated(java.lang.Object, org.eclipse.rse.core.filters.ISystemFilter)
-     */
-    @Override
-    public void filterEventFilterCreated(Object selectedObject, ISystemFilter newFilter) {
-        super.filterEventFilterCreated(selectedObject, newFilter);
-        ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-        registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null));
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystem#filterEventFilterPoolReferenceCreated(org.eclipse.rse.core.filters.ISystemFilterPoolReference)
-     */
-    @Override
-    public void filterEventFilterPoolReferenceCreated(ISystemFilterPoolReference newPoolRef) {
-        super.filterEventFilterPoolReferenceCreated(newPoolRef);
-        if (getSystemFilterPoolReferenceManager().getSystemFilterPoolReferenceCount() == 1) {
-            ISystemRegistry registry = SystemStartHere.getSystemRegistry();
-            registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, null));
-        }
-    }
-    
-    /**
-     * Retrieves all provider resources from the remote system and updates local references.  
-     * 
-     * @return provider resources
-     * @throws SystemMessageException
-     * @throws InterruptedException
-     */
-    public ProviderResource[] getAllProviders() throws SystemMessageException, InterruptedException {
-        ProviderResource[] providers = createProviders(); 
-        if (fProviders == null) {
-            fProviders = providers;
-        }
-        else {
-            for (int i = 0; i < fProviders.length; i++) {
-                for (int j = 0; j < providers.length; j++) {
-                    if(fProviders[i].getName().equals(providers[j].getName())) {
-                        // Check if all targets already exist
-                        fProviders[i].refreshTargets(providers[j].getTargets());
-                    }
-                }
-            }
-        }
-        return (fProviders != null) ? Arrays.copyOf(fProviders, fProviders.length) : null;
-    }
-
-    /**
-     * Get the list of all targets.
-     * 
-     * @return targets The list of targets.
-     * @throws SystemMessageException
-     */
-    public TargetResource[] getAllTargets() throws SystemMessageException {
-       ArrayList<TargetResource> targets = new ArrayList<TargetResource>();
-       if (fProviders != null) {
-            for (int i = 0; i < fProviders.length; i++) {
-                targets.addAll(Arrays.asList(fProviders[i].getTargets()));
-            }
-       }
-        return targets.toArray(new TargetResource[0]);
-    }
-
-    /**
-     * Get the list of all traces.
-     * 
-     * @return traces The list of traces.
-     * @throws SystemMessageException
-     */
-    public TraceResource[] getAllTraces() throws SystemMessageException {
-       ArrayList<TraceResource> traces = new ArrayList<TraceResource>();
-       if (fProviders != null) {
-            for (int i = 0; i < fProviders.length; i++) {
-               ProviderResource provider = fProviders[i];
-               int numTargets = provider.getTargets().length;
-                for (int j = 0; j < numTargets; j++) {
-                       TargetResource target = provider.getTargets()[j];
-                       if (provider.getName().equals(LttngConstants.Lttng_Provider_Kernel)) {
-                               traces.addAll(Arrays.asList(target.getTraces()));
-                       }
-                }
-            }
-        }
-        return traces.toArray(new TraceResource[0]);
-    }
-
-    /**
-     * Get the list of all traces for given provider and target.
-     * 
-     * @param provider
-     * @param target
-     * @returns trace resources
-     */
-    public TraceResource[] getAllTraces(String providerName, String targetName) throws SystemMessageException {
-        ArrayList<TraceResource> traces = new ArrayList<TraceResource>();
-        ProviderResource selectedProvider = null;
-        if (fProviders != null) {
-            for (int i = 0; i < fProviders.length; i++) {
-                ProviderResource provider = fProviders[i];
-                if (provider.getName().equals(providerName)) {
-                    selectedProvider = fProviders[i];
-                    break;
-                }
-            }
-            
-            if (selectedProvider != null) {
-                int numTargets = selectedProvider.getTargets().length;
-                for (int j = 0; j < numTargets; j++) {
-                    TargetResource target = selectedProvider.getTargets()[j];
-                    if (target.getName().equals(targetName)) {
-                        traces.addAll(Arrays.asList(target.getTraces()));
-                        break;
-                    }
-                }
-            }
-        }
-        return traces.toArray(new TraceResource[0]);
-    }
-    
-    /**
-     * Finds a trace resource within a given provider and target for a given trace name 
-     * 
-     * @param targetName - target name to be searched 
-     * @param traceName - trace name to be searched
-     * @return trace resource or null (if not found)
-     */
-    public TraceResource findTrace(String providerName, String targetName, String traceName) {
-        TraceResource trace = null;
-        TraceResource[] traces;
-        try {
-            traces = getAllTraces(providerName, targetName);
-            for (int i = 0; i < traces.length; i++) {
-                if (traces[i].getName().equals(traceName)) {
-                    trace = traces[i];
-                    break;
-                }
-            }
-        } catch (SystemMessageException e) {
-            SystemBasePlugin.logError("TraceSubSystem", e); //$NON-NLS-1$
-        }
-
-        return trace;
-    }
-    
-    /*
-     * Retrieves the providers from the remote system.
-     */
-    private ProviderResource[] createProviders() throws SystemMessageException {
-        ProviderResource[] providers = null;
-        try {
-            
-            final ILttControllerService service = getControllerService();
-
-            // Create future task
-            providers = new TCFTask<ProviderResource[]>() {
-                @Override
-                public void run() {
-
-                    // Get provider using Lttng controller service proxy
-                    service.getProviders(new ILttControllerService.DoneGetProviders() {
-
-                        @Override
-                        public void doneGetProviders(IToken token, Exception error, String[] str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Create provider list
-                            ProviderResource[] providers = new ProviderResource[str.length]; 
-
-                            for (int i = 0; i < str.length; i++) {
-                                ProviderResource tempProvider = new ProviderResource(TraceSubSystem.this);
-                                tempProvider.setName(str[i]);
-                                providers[i] = tempProvider;
-                            }
-
-                            // Notify with provider list
-                            done(providers);
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            if (e instanceof SystemMessageException) throw (SystemMessageException)e;
-            throw new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
-        }
-
-        for (int i = 0; i < providers.length; i++) {
-            createTargets(providers[i]);
-        }
-
-        return providers;
-    }
-
-    /*
-     * Retrieves the targets for given provider from the remote system.
-     */
-    private TargetResource[] createTargets(final ProviderResource provider) throws SystemMessageException {
-       TargetResource[] targets;
-       try {
-            final ILttControllerService service = getControllerService();
-
-            // Create future task
-            targets = new TCFTask<TargetResource[]>() {
-                @Override
-                public void run() {
-                    
-                    // Get targets using Lttng controller service proxy
-                    service.getTargets(provider.getName(), new ILttControllerService.DoneGetTargets() {
-
-                        @Override
-                        public void doneGetTargets(IToken token, Exception error, String[] str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Create targets
-                            TargetResource[] targets = new TargetResource[str.length];
-                            for (int i = 0; i < str.length; i++) {
-                                TargetResource tempTarget = new TargetResource(TraceSubSystem.this);
-                                tempTarget.setName(str[i]);
-                                tempTarget.setParent(provider);
-                                targets[i] = tempTarget;
-                            }
-                            // Notify with target list
-                            done(targets);
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-               provider.setTargets(new TargetResource[0]);
-            if (e instanceof SystemMessageException) throw (SystemMessageException)e;
-            throw new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
-        }
-
-        provider.setTargets(targets);
-        for (int i = 0; i < targets.length; i++) {
-               if (targets[i].getParent().getName().equals(LttngConstants.Lttng_Provider_Kernel)) {
-                   createTraces(targets[i]);
-               }
-        }
-
-        return targets;
-    }
-
-    /*
-     * Retrieves the trace instances for a given target from the remote system.
-     */
-    private TraceResource[] createTraces(final TargetResource target) throws SystemMessageException {
-       TraceResource[] traces;
-        try {
-            final ILttControllerService service = getControllerService();
-
-            // Create future task
-            traces = new TCFTask<TraceResource[]>() {
-                @Override
-                public void run() {
-                    // Get targets using Lttng controller service proxy
-                    service.getTraces(target.getParent().getName(), target.getName(), new ILttControllerService.DoneGetTraces() {
-
-                        @Override
-                        public void doneGetTraces(IToken token, Exception error, String[] str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-                            
-                            // Create trace list
-                            TraceResource[] traces = new TraceResource[str.length];
-                            for (int i = 0; i < str.length; i++) {
-                                TraceResource trace = new TraceResource(TraceSubSystem.this, service);
-                                trace.setName(str[i]);
-                                trace.setParent(target);
-                                trace.setTraceState(TraceState.CREATED);
-                                traces[i] = trace;
-                            }
-
-                            // Notify with trace list
-                            done(traces);
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-        } catch (Exception e) {
-            target.setTraces(new TraceResource[0]);
-            if (e instanceof SystemMessageException) throw (SystemMessageException)e;
-            throw new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
-        }
-
-        target.setTraces(traces);
-
-        // get active trace information (is only supported for kernel traces)
-        createTraceConfigurations(target, traces);
-        return traces;
-    }
-
-    /*
-     * Retrieves the trace configurations for the given trace from the remote system.
-     */
-    private void createTraceConfigurations(final TargetResource target, TraceResource[] traces) throws SystemMessageException {
-        if (!target.isUst() && (traces.length > 0)) {
-            // get active traces 
-            String[] activeTraceNames;
-            try {
-                final ILttControllerService service = getControllerService();
-                activeTraceNames = new TCFTask<String[]>() {
-                    @Override
-                    public void run() {
-                        // Get targets using Lttng controller service proxy
-                        service.getActiveTraces(target.getParent().getName(), target.getName(), new ILttControllerService.DoneGetActiveTraces() {
-
-                            @Override
-                            public void doneGetActiveTraces(IToken token, Exception error, String[] str) {
-                                if (error != null) {
-                                    // Notify with error
-                                    error(error);
-                                    return;
-                                }
-
-                                // Notify with active trace list
-                                done(str);
-                            }
-                        });
-                    }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-            } catch (Exception e) {
-                if (e instanceof SystemMessageException) throw (SystemMessageException)e;
-                throw new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
-            }
-            
-            // get active trace information
-            for (int j = 0; j < activeTraceNames.length; j++) {
-                final TraceResource trace = target.getTrace(activeTraceNames[j]);
-                if (trace != null) {
-                    // get trace info
-                    TraceConfig traceConfig;
-
-                    try {
-                        final ILttControllerService service = getControllerService();
-                        traceConfig = new TCFTask<TraceConfig>() {
-                            @Override
-                            public void run() {
-                                // Get targets using Lttng controller service proxy
-                                service.getActiveTraceInfo(target.getParent().getName(), target.getName(), trace.getName(), new ILttControllerService.DoneGetActiveTraceInfo() {
-
-                                    @Override
-                                    public void doneGetActiveTraceInfo(IToken token, Exception error, String[] strArray) {
-                                        if (error != null) {
-                                            // Notify with error
-                                            error(error);
-                                            return;
-                                        }
-
-                                        TraceConfig config = new TraceConfig();
-                                        config.setTraceName(trace.getName());
-                                        config.setTraceTransport(TraceControlConstants.Lttng_Trace_Transport_Relay); 
-                                        config.setIsAppend(false); 
-                                        for (String pair : strArray) {
-                                            String[] pairArray = pair.split(LttngConstants.Lttng_Control_GetActiveTraceInfoSeparator);
-                                            if (pairArray.length != 2) {
-                                                continue;
-                                            }
-                                            String param = pairArray[0];
-                                            String value = pairArray[1];
-                                            if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_DESTINATION)) {
-                                                if (value.startsWith(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL)) {
-                                                    config.setNetworkTrace(false);
-                                                    config.setTracePath(value.substring(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_LOCAL.length()));
-                                                } else if (value.startsWith(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK)) {
-                                                    config.setNetworkTrace(true);
-                                                    config.setTracePath(value.substring(TraceControlConstants.ACTIVE_TRACE_INFO_DESTINATION_PREFIX_NETWORK.length()));
-                                                }
-                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_NUM_THREAD)) {
-                                                config.setNumChannel(Integer.valueOf(value));
-                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_NORMAL_ONLY)) {
-                                                if (value.equals(Boolean.toString(true))) {
-                                                    config.setMode(TraceConfig.NORMAL_MODE);
-                                                }
-                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_FLIGHT_ONLY)) {
-                                                if (value.equals(Boolean.toString(true))) {
-                                                    config.setMode(TraceConfig.FLIGHT_RECORDER_MODE);
-                                                }
-                                            } else if (param.equals(TraceControlConstants.ACTIVE_TRACE_INFO_PARAM_ENABLED)) {
-                                                if (value.equals(Boolean.toString(true))) {
-                                                    trace.setTraceState(TraceState.STARTED);
-                                                } else {
-                                                    trace.setTraceState(TraceState.PAUSED);  
-                                                }
-                                            }
-                                        }
-
-                                        // Notify with active trace list
-                                        done(config);
-                                    }
-                                });
-                            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-                        trace.setTraceConfig(traceConfig);
-                        if (traceConfig != null) {
-                            if (traceConfig.isNetworkTrace()) {
-                                // stop and restart the network transfer since TCF channel may be different
-                                if (fProviders == null) { // do this only on startup, not on refresh
-                                    restartTraceNetwork(service, trace, traceConfig);
-                                }
-                                LiveTraceManager.setLiveTrace(traceConfig.getTracePath(), true);
-                            }
-                        }
-                    } catch (Exception e) {
-                        if (e instanceof SystemMessageException) throw (SystemMessageException)e;
-                        throw new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e));
-                    }
-                }
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent)
-     */
-    @Override
-    public void communicationsStateChange(CommunicationsEvent e) {
-        switch (e.getState())
-        {
-        case CommunicationsEvent.BEFORE_CONNECT :
-            break;
-        case CommunicationsEvent.AFTER_CONNECT :
-            break;
-        case CommunicationsEvent.BEFORE_DISCONNECT :
-            
-            try {
-                final TraceResource[] traces = getAllTraces();
-
-                StringBuffer traceNames = new StringBuffer("");  //$NON-NLS-1$
-                String filler = ""; //$NON-NLS-1$
-                for (int j = 0; j < traces.length; j++) {
-                    // For network traces, ask user to pause tracing
-                    if (traces[j].isNetworkTraceAndStarted()) {
-                        traceNames.append(filler);
-                        traceNames.append(traces[j].getName());
-                    }
-                    filler = ", "; //$NON-NLS-1$
-                }
-                if (!"".equals(traceNames.toString())) { //$NON-NLS-1$
-                    final String finalTraceNames = traceNames.toString();
-                    Display.getDefault().syncExec(new Runnable() {
-
-                        @Override
-                        public void run() {
-                            MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.Ltt_ShutdownWarning, Messages.Ltt_NetworkTraceRunningWarning + ":\n" + finalTraceNames); //$NON-NLS-1$
-
-                            // Pause tracing
-                            PauseTrace pauseAction = new PauseTrace();
-                            pauseAction.setSelectedTraces(new ArrayList<TraceResource>(Arrays.asList(traces)));
-                            pauseAction.run(null);
-                            try {
-                                Thread.sleep(2000); // allow time for target to pause traces before disconnecting the channel
-                            } catch (InterruptedException e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    });
-                }
-
-                if (fProviders != null) {
-                    // reset all providers and it's children
-                    for (int i = 0; i < fProviders.length; i++) {
-                        fProviders[i].removeAllTargets();
-                    }
-                    fProviders = null;
-                }
-
-            } catch (SystemMessageException ex) {
-                SystemBasePlugin.logError("TraceSubSystem", ex); //$NON-NLS-1$
-            }
-            break;
-        case CommunicationsEvent.AFTER_DISCONNECT :
-            getConnectorService().removeCommunicationsListener(this);
-            break;
-        case CommunicationsEvent.CONNECTION_ERROR :
-            // TODO notify user about the lost connection ?!
-            getConnectorService().removeCommunicationsListener(this);
-            try {
-                this.disconnect();
-            } catch (Exception e1) {
-                // Nothing to do
-            }
-            break;
-        default :
-            break;
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#isPassiveCommunicationsListener()
-     */
-    @Override
-    public boolean isPassiveCommunicationsListener() {
-        return true;    
-    }
-    
-    /**
-     * Returns the trace controller service.
-     * 
-     * @return trace controller service
-     * @throws Exception
-     */
-    public LttControllerServiceProxy getControllerService() throws Exception {
-        return ((TraceConnectorService)getConnectorService()).getControllerService();
-    }
-
-    /*
-     * Stop and restart the network transfer. Only normal channels are written while trace is started.  
-     */
-    private void restartTraceNetwork(final ILttControllerService service, final TraceResource trace, final TraceConfig traceConfig) throws Exception {
-        File newDir = new File(traceConfig.getTracePath());
-        if (!newDir.exists()) {
-            boolean created = newDir.mkdirs();
-            if (!created) {
-                throw new Exception(Messages.Lttng_Control_ErrorCreateTracePath + ": " + traceConfig.getTracePath()); //$NON-NLS-1$
-            }
-            if (traceConfig.getProject() != null) {
-                ImportToProject.linkTrace(getShell(), trace, traceConfig.getProject(), traceConfig.getTraceName());
-            }
-        }
-
-        // stop the previous lttd
-        boolean ok = new TCFTask<Boolean>() {
-            @Override
-            public void run() {
-
-                // Setup trace transport using Lttng controller service proxy
-                service.stopWriteTraceNetwork(trace.getParent().getParent().getName(), 
-                        trace.getParent().getName(), 
-                        traceConfig.getTraceName(), 
-                        new ILttControllerService.DoneStopWriteTraceNetwork() {
-
-                    @Override
-                    public void doneStopWriteTraceNetwork(IToken token, Exception error, Object str) {
-                        if (error != null) {
-                            // Notify with error
-                            error(error);
-                            return;
-                        }
-
-                        // Notify about success
-                        done(true);
-                    }
-                });
-            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-
-        if (!ok) {
-            return;
-        }
-
-        // lttd will only perform the shutdown after stopWriteTraceNetwork
-        // when it receives the next on_read_subbuffer callback
-
-        if (trace.getTraceState() == TraceState.PAUSED) {
-            // we need to start the trace to make sure that the network transfer is stopped
-            ok = new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Start the trace
-                    service.startTrace(trace.getParent().getParent().getName(), 
-                            trace.getParent().getName(), 
-                            traceConfig.getTraceName(), 
-                            new ILttControllerService.DoneStartTrace() {
-
-                        @Override
-                        public void doneStartTrace(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(true);
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-
-            if (!ok) {
-                return;
-            }
-
-            trace.setTraceState(TraceState.STARTED);
-
-            // wait for the lttd shutdown
-            Thread.sleep(1000);
-
-            // return to paused state
-            ok = new TCFTask<Boolean>() {
-                @Override
-                public void run() {
-
-                    // Pause the trace
-                    service.pauseTrace(trace.getParent().getParent().getName(), 
-                            trace.getParent().getName(), 
-                            traceConfig.getTraceName(), 
-                            new ILttControllerService.DonePauseTrace() {
-
-                        @Override
-                        public void donePauseTrace(IToken token, Exception error, Object str) {
-                            if (error != null) {
-                                // Notify with error
-                                error(error);
-                                return;
-                            }
-
-                            // Notify about success
-                            done(true);
-                        }
-                    });
-                }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-
-            if (!ok) {
-                return;
-            }
-
-            trace.setTraceState(TraceState.PAUSED);
-
-        } else {
-            // wait for the lttd shutdown
-            Thread.sleep(1000);
-        }
-
-        // start a new lttd
-        new TCFTask<Boolean>() {
-            @Override
-            public void run() {
-
-                // Setup trace transport using Lttng controller service proxy
-                service.writeTraceNetwork(trace.getParent().getParent().getName(), 
-                        trace.getParent().getName(), 
-                        traceConfig.getTraceName(), 
-                        traceConfig.getTracePath(), 
-                        traceConfig.getNumChannel(), 
-                        traceConfig.getIsAppend(), 
-                        false, 
-                        true, // write only normal channels 
-                        new ILttControllerService.DoneWriteTraceNetwork() {
-
-                    @Override
-                    public void doneWriteTraceNetwork(IToken token, Exception error, Object str) {
-                        if (error != null) {
-                            // Notify with error
-                            error(error);
-                            return;
-                        }
-
-                        // Notify about success
-                        done(true);
-                    }
-                });
-            }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystemConfiguration.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystemConfiguration.java
deleted file mode 100644 (file)
index 12231a5..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems;
-
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.connectorservice.TraceConnectorServiceManager;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
-
-/**
- * <b><u>TraceSubSystemConfiguration</u></b>
- * <p>
- * Implementation of the subsystem configuration to define the trace subsystem configuration.
- * </p>
- */
-public class TraceSubSystemConfiguration extends SubSystemConfiguration {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor for TraceSubSystemConfiguration.
-     */
-    public TraceSubSystemConfiguration() {
-        super();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(org.eclipse.rse.core.model.IHost)
-     */
-    @Override
-    public ISubSystem createSubSystemInternal(IHost conn) {
-        return new TraceSubSystem(conn, getConnectorService(conn));
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getConnectorService(org.eclipse.rse.core.model.IHost)
-     */
-    @Override
-    public IConnectorService getConnectorService(IHost host) {
-        return TraceConnectorServiceManager.getInstance().getConnectorService(host, ITCFSubSystem.class);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createDefaultFilterPool(org.eclipse.rse.core.filters.ISystemFilterPoolManager)
-     */
-    @Override
-    protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr) {
-        ISystemFilterPool defaultPool = null;
-        try {
-            defaultPool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), false); // true=>is deletable by user
-            defaultPool.setDeletable(false);
-            defaultPool.setNonRenamable(true);
-            List<String> strings = new Vector<String>();
-            strings.add("*"); //$NON-NLS-1$
-            ISystemFilter filter = mgr.createSystemFilter(defaultPool, Messages.AllProviders, strings);
-            filter.setNonChangable(false);
-            filter.setSingleFilterStringOnly(false);
-            filter.setNonDeletable(true);
-            filter.setNonRenamable(true);
-        } catch (Exception exc) {
-        }
-        return defaultPool;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getTranslatedFilterTypeProperty(org.eclipse.rse.core.filters.ISystemFilter)
-     *
-     * Intercept of parent method so we can supply our own value shown in the property sheet for the "type" property when a filter is selected within our subsystem.
-     * 
-     * Requires this line in LTTngServicesResources.properties: property.type.providerfilter=Lttng_Resource_Provider filter
-     */
-    @Override
-    public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter) {
-        return Messages.Property_Type_Provider_Filter;
-    }
-
-    public boolean supportsUserId() {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)
-     */
-    @Override
-    public boolean supportsServerLaunchProperties(IHost host) {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()
-     */
-    @Override
-    public boolean supportsFilters() {
-        return true;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilterChildren()
-     */
-    @Override
-    public boolean supportsFilterChildren() {
-        return true;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/utility/DownloadProxy.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/utility/DownloadProxy.java
deleted file mode 100644 (file)
index c733c2f..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Polytechnique Montréal - Initial API and implementation
- *   Bernd Hufmann - Productification, enhancements and fixes
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.utility;
-
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.tm.tcf.protocol.JSON;
-
-/**
- * <b><u>DownloadProxy</u></b>
- * <p>
- * Proxy implementation for storing trace data locally on host where client is running. (writeTraceNetwork)
- * </p>
- */
-public class DownloadProxy {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    TraceSubSystem fSubSystem;
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     *  
-     * @param subSystem The trace SubSystem
-     */
-    public DownloadProxy(TraceSubSystem subSystem) {
-        fSubSystem = subSystem;
-    }
-    
- // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    
-    /**
-     * Writes trace data to traces files. 
-     * 
-     * @param data binary data
-     */
-    public void writeDownloadedTrace(byte[] data) {
-        Object[] args = null;
-        try {
-            args = JSON.parseSequence(data);
-        } catch (IOException e) {
-            SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
-        }
-        if (args != null) {
-            byte[] traceData = JSON.toByteArray(args[4]);
-            TraceResource trace = fSubSystem.findTrace(args[0].toString(), args[1].toString(), args[2].toString());
-            if (trace != null) {
-                TraceConfig conf = trace.getTraceConfig();
-                FileOutputStream fos = null;
-                if (conf != null && !TraceConfig.InvalidTracePath.equals(conf.getTracePath())) {
-                    String fileName = conf.getTracePath() + "/" + args[3].toString();  //$NON-NLS-1$
-                    try {
-                        fos = new FileOutputStream(fileName, true);
-                        fos.write(traceData);
-                        fos.close();
-                        // ((TraceResource) args[2]).setSize(sizeFile.length());
-                    } catch (FileNotFoundException e) {
-                        SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
-                    } catch (IOException e) {
-                        SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
-                    }
-                }
-            }
-        }
-    }
-    
-    /**
-     * Method for UST 
-     * 
-     * @param data
-     */
-    public void handleUnwriteTraceDataEvent(byte [] data) {
-        try {
-            Object[] args = null;
-            args = JSON.parseSequence(data);
-            // Check if it is an ust trace
-            TraceResource trace = fSubSystem.findTrace(args[0].toString(), args[1].toString(), args[2].toString());
-            if ((trace != null) && trace.isUst()) {
-                // TODO
-            }
-
-        } catch (IOException e) {
-            SystemBasePlugin.logError("DownloadProxy", e); //$NON-NLS-1$
-        }
-        
-    }
-    
-    /**
-     * Method that handles trace done event which is sent at the end of the trace session.
-     * 
-     * @param data Binary data
-     */
-    public void handleTraceDoneEvent(byte [] data) {
-        // Nothing to do!
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/ConfigureTraceWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/ConfigureTraceWizard.java
deleted file mode 100644 (file)
index deb18c0..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Bernd Hufmann - Initial API and implementation\r
- *   \r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards;\r
-\r
-import java.util.Iterator;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.jface.wizard.Wizard;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.service.ILttControllerService;\r
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;\r
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;\r
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;\r
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;\r
-import org.eclipse.rse.ui.SystemBasePlugin;\r
-import org.eclipse.tm.tcf.protocol.IToken;\r
-import org.eclipse.tm.tcf.util.TCFTask;\r
-import org.eclipse.ui.INewWizard;\r
-import org.eclipse.ui.IWorkbench;\r
-\r
-/**\r
- * <b><u>ConfigureTraceWizard</u></b>\r
- * <p>\r
- *  Wizard implementation to configure a trace.\r
- * </p>\r
- */\r
-public class ConfigureTraceWizard extends Wizard implements INewWizard {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    ITraceChannelConfigurationPage channelConfigPage;\r
-    TraceConfigurationPage traceConfigPage;\r
-\r
-    private TraceResource fSelectedTrace = null;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    public ConfigureTraceWizard() {\r
-        super();\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.wizard.Wizard#performFinish()\r
-     */\r
-    @Override\r
-    public boolean performFinish() {\r
-        return true;\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.wizard.Wizard#addPages()\r
-     */\r
-    @Override\r
-       public void addPages() {\r
-        traceConfigPage = new TraceConfigurationPage(this);\r
-        addPage(traceConfigPage);\r
-\r
-        if (fSelectedTrace.isUst()) {\r
-            // User space trace\r
-            TraceChannels channels = null;\r
-            if ((fSelectedTrace.getTraceConfig()) != null && fSelectedTrace.getTraceConfig().getTraceChannels() != null) {\r
-                channels = fSelectedTrace.getTraceConfig().getTraceChannels().clone(); \r
-            }\r
-            else {\r
-                channels = new TraceChannels();\r
-                channels.put(TraceChannel.UST_TRACE_CHANNEL_NAME, new TraceChannel(TraceChannel.UST_TRACE_CHANNEL_NAME));\r
-            }\r
-            channelConfigPage = new UstTraceChannelConfigurationPage(channels);\r
-            addPage(channelConfigPage);\r
-        } else {\r
-            // Kernel trace \r
-            TraceChannels channels = null;\r
-            if ((fSelectedTrace.getTraceConfig()) != null && (fSelectedTrace.getTraceConfig().getTraceChannels() != null)) {\r
-                channels = fSelectedTrace.getTraceConfig().getTraceChannels().clone(); \r
-            }\r
-            else {\r
-                String[] channelNames = new String[0];\r
-                try {\r
-                    final ILttControllerService service = ((TraceSubSystem)fSelectedTrace.getSubSystem()).getControllerService();\r
-                    channelNames = new TCFTask<String[]>() {\r
-                        @Override\r
-                        public void run() {\r
-                            // Get targets using Lttng controller service proxy\r
-                            service.getChannels(fSelectedTrace.getParent().getParent().getName(), fSelectedTrace.getParent().getName(), fSelectedTrace.getName(), new ILttControllerService.DoneGetChannels() {\r
-\r
-                                @Override\r
-                                public void doneGetChannels(IToken token, Exception error, String[] str) {\r
-                                    if (error != null) {\r
-                                        // Notify with error\r
-                                        error(error);\r
-                                        return;\r
-                                    }\r
-                                    // Notify with active trace list\r
-                                    done(str);\r
-                                }\r
-                            });\r
-                        }}.get(TraceControlConstants.DEFAULT_TCF_TASK_TIMEOUT, TimeUnit.SECONDS);\r
-                } catch (Exception e) {\r
-                    if (e instanceof SystemMessageException) {\r
-                        SystemBasePlugin.logError("Trace Configuration", e); //$NON-NLS-1$;\r
-                    }\r
-                    else {\r
-                        SystemBasePlugin.logError("TraceSubSystem", new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e))); //$NON-NLS-1$\r
-                    }\r
-                }\r
-\r
-                channels = new TraceChannels();\r
-                channels.putAll(channelNames);\r
-            }\r
-\r
-            channelConfigPage = new KernelTraceChannelConfigurationPage(channels, fSelectedTrace.getTraceState());\r
-            addPage(channelConfigPage);\r
-        }\r
-\r
-        getShell().setImage(LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_CONFIG_TRACE));\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)\r
-     */\r
-    @Override\r
-    @SuppressWarnings("unchecked")\r
-       public void init(IWorkbench workbench, IStructuredSelection selection) {\r
-\r
-        fSelectedTrace = null;\r
-\r
-        // store the selected targets to be used when running\r
-        Iterator<IStructuredSelection> theSet = selection.iterator();\r
-        while (theSet.hasNext()) {\r
-            Object obj = theSet.next();\r
-            if (obj instanceof TraceResource) {\r
-                fSelectedTrace = (TraceResource)obj;\r
-                break; // only one is allowed\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Gets the relevant selected trace that will be configured.\r
-     * \r
-     * @return selected trace.\r
-     */\r
-    public TraceResource getSelectedTrace() {\r
-        return fSelectedTrace;\r
-    }\r
-    \r
-    /**\r
-     * Gets the new trace configuration of the trace.\r
-     *  \r
-     * @return trace configuration\r
-     */\r
-    public TraceConfig getTraceConfig() {\r
-        TraceConfig config = traceConfigPage.getTraceConfig();\r
-        config.setTraceChannels(channelConfigPage.getTraceChannels());\r
-        return config;\r
-    }\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/ITraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/ITraceChannelConfigurationPage.java
deleted file mode 100644 (file)
index 9f84554..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
-
-public interface ITraceChannelConfigurationPage extends IWizardPage {
-
-    public TraceChannels getTraceChannels();
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java
deleted file mode 100644 (file)
index b0e665a..0000000
+++ /dev/null
@@ -1,590 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config.TraceChannelCellModifier;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config.TraceChannelTableContentProvider;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config.TraceChannelTableLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <b><u>KernelTraceChannelConfigurationPage</u></b>
- * <p>
- *  Wizard page implementation to configure the kernel trace channels.
- * </p>
- */
-public class KernelTraceChannelConfigurationPage extends WizardPage implements ITraceChannelConfigurationPage {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    
-    private TraceChannels fChannels;
-    private TraceState fTraceState;
-    private Composite container;
-    private TableViewer tableViewer;
-    List<String> fColumnNames;
-    
-    Action enableAllAction;
-    Action disableAllAction;
-    Action setOverrideAllAction;
-    Action resetOverideAllAction;
-    Action setNumSubbufAction;
-    Action setSubbufSizeAction;
-    Action setChanTimerAction;
-
-    private ColumnData[] columnDataList = new ColumnData[] {
-            new ColumnData(Messages.ChannelConfigPage_ChannelName, 150, SWT.LEFT, Messages.ChannelConfigPage_ChannelNameTooltip, new ViewerComparator() {
-                    @Override
-                    public int compare(Viewer viewer, Object e1, Object e2) {
-                        TraceChannel chan1 = (TraceChannel) e1;
-                        TraceChannel chan2 = (TraceChannel) e2;
-                        return chan1.getName().compareTo(chan2.getName());
-                    }
-            }),
-            new ColumnData(Messages.ChannelConfigPage_ChannelEnabled, 150, SWT.LEFT, Messages.ChannelConfigPage_ChannelEnabledTooltip, null),
-            new ColumnData(Messages.ChannelConfigPage_ChannelOverride, 150, SWT.LEFT, Messages.ChannelConfigPage_BufferOverrideTooltip, null),
-            new ColumnData(Messages.ChannelConfigPage_NumSubBuf, 175, SWT.LEFT, Messages.ChannelConfigPage_NumSubBufTooltip, null),
-            new ColumnData(Messages.ChannelConfigPage_SubBufSize, 150, SWT.LEFT, Messages.ChannelConfigPage_SubBufSizeTooltip, null),
-            new ColumnData(Messages.ChannelConfigPage_ChannelTimer, 150, SWT.LEFT, Messages.ChannelConfigPage_ChannelTimerTooltip, null)};
-    
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     * 
-     * @param channels The current channels information
-     * @param state The trace state
-     */
-    protected KernelTraceChannelConfigurationPage(TraceChannels channels, TraceState state) {
-        super("TraceChannelConfigurationPage"); //$NON-NLS-1$
-        fChannels = channels;
-        fTraceState = state;
-        setTitle(Messages.ChannelConfigPage_PageTitle);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
-     */
-    @Override
-    public void createControl(Composite parent) {
-        container = new Composite(parent, SWT.NULL);
-        container.setLayout(new GridLayout());
-        setControl(container);
-
-        Composite headerComposite = new Composite(container, SWT.FILL);
-        GridLayout headerLayout = new GridLayout(1, true);
-        headerLayout.marginHeight = 0;
-        headerLayout.marginWidth = 0;
-        headerComposite.setLayout(headerLayout);
-        headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        
-        tableViewer = new TableViewer(headerComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION );
-        tableViewer.setUseHashlookup(true);
-        
-        Table table = tableViewer.getTable(); 
-        table.setHeaderVisible(true);
-
-        fColumnNames = new ArrayList<String>();
-        for (int i = 0; i < columnDataList.length; i++) {
-
-            final ColumnData columnData = columnDataList[i];
-            fColumnNames.add(columnData.header);
-            final TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
-            tableColumn.setText(columnData.header);
-            tableColumn.setWidth(columnData.width);
-            tableColumn.setAlignment(columnData.alignment);
-            tableColumn.setToolTipText(columnData.tooltip);
-            tableColumn.setMoveable(false);
-            if (columnData.comparator != null) {
-                tableColumn.addSelectionListener(new SelectionAdapter() {
-                    @Override
-                    public void widgetSelected(SelectionEvent e) {
-                        if (tableViewer.getTable().getSortDirection() == SWT.UP || (tableViewer.getTable().getSortColumn() != tableColumn)) {
-                            tableViewer.setComparator(columnData.comparator);
-                            tableViewer.getTable().setSortDirection(SWT.DOWN);
-                        } else {
-                            tableViewer.setComparator(new ViewerComparator() {
-                                @Override
-                                public int compare(Viewer viewer,Object e1, Object e2) {
-                                    return -1 * columnData.comparator.compare(viewer, e1,e2);
-                                }
-                            });
-                            tableViewer.getTable().setSortDirection(SWT.UP);
-                        }
-                        tableViewer.getTable().setSortColumn(tableColumn);
-                    }
-                });
-            }
-        }
-
-        tableViewer.setColumnProperties(fColumnNames.toArray(new String[0]));
-        
-        // Create the cell editors
-        CellEditor[] editors = new CellEditor[columnDataList.length];
-
-        // Column 1 : Completed (Checkbox)
-        TextCellEditor textEditor = new TextCellEditor(table);
-        editors[0] = textEditor;
-
-        // Column 2 : Description (Free text)
-        editors[1] = new CheckboxCellEditor(table);
-
-        // Column 3 : Owner (Combo Box) 
-        editors[2] = new CheckboxCellEditor(table);
-
-        // Column 4 : Percent complete (Text with digits only)
-         textEditor = new TextCellEditor(table);
-        ((Text) textEditor.getControl()).addVerifyListener(
-        
-            new VerifyListener() {
-                
-                @Override
-                public void verifyText(VerifyEvent e) {
-                    e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
-                }
-            });
-        editors[3] = textEditor;
-
-        textEditor = new TextCellEditor(table);
-        ((Text) textEditor.getControl()).addVerifyListener(
-        
-            new VerifyListener() {
-                
-                @Override
-                public void verifyText(VerifyEvent e) {
-                    e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
-                }
-            });
-        editors[4] = textEditor;
-        
-        textEditor = new TextCellEditor(table);
-        ((Text) textEditor.getControl()).addVerifyListener(
-        
-            new VerifyListener() {
-                
-                @Override
-                public void verifyText(VerifyEvent e) {
-                    e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
-                }
-            });
-        editors[5] = textEditor;
-
-        // Assign the cell editors to the viewer 
-        tableViewer.setCellEditors(editors);
-        tableViewer.setCellModifier(new TraceChannelCellModifier(this));
-
-        tableViewer.setContentProvider(new TraceChannelTableContentProvider());
-        tableViewer.setLabelProvider(new TraceChannelTableLabelProvider());
-        
-        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
-        makeActions();
-        addContextMenu();
-    }
-    
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.DialogPage#dispose()
-     */
-    @Override
-    public void dispose() {
-        super.dispose();
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
-     */
-    @Override
-    public void setVisible(boolean visible) {
-        if (visible && (fChannels != null)) {
-            // Get new channels configuration
-            tableViewer.setInput(fChannels);
-            
-            Table table = tableViewer.getTable();
-            TableItem[] items = table.getItems();
-            for (int i = 0; i < items.length; i++) {
-                if ((i % 2) != 0) {
-                    items[i].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
-                }
-                
-                if ((fTraceState != TraceState.CREATED)  && (fTraceState != TraceState.CONFIGURED)) {
-                    items[i].setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
-                }    
-            }
-
-            container.layout();
-        }
-        super.setVisible(visible);
-    }
-
-    /**
-     * Gets the list of column names.
-     * 
-     * @return list of column names
-     */
-    public List<String> getColumnProperties() {
-        return fColumnNames;
-    }
-    
-    /*
-     * Refreshes the table.
-     */
-    public void refresh() {
-        tableViewer.refresh();
-    }
-    
-    /**
-     * Gets the trace state.
-     * 
-     * @return trace state
-     */
-    public TraceState getTraceState() {
-        return fTraceState;
-    }
-    
-    /**
-     * Gets if trace is a local trace (i.e. if trace output is stored on host 
-     * where client is running)
-     * 
-     * @return isLocalTrace
-     */
-    public boolean isLocalTrace() {
-        TraceConfigurationPage configPage = (TraceConfigurationPage) getPreviousPage();
-        return configPage.isLocalTrace();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.rse.ui.wizards.ITraceChannelConfigurationPage#getTraceChannels()
-     */
-    @Override
-    public TraceChannels getTraceChannels() {
-        return fChannels;
-    }
-    
-    /*
-     * Local class to configure table columns
-     */
-    private static final class ColumnData {
-        // Name of the column.
-        public final String header;
-        // Width of the column.
-        public final int width;
-        // Alignment of the column.
-        public final int alignment;
-        // Tooltip of the column.
-        public final String tooltip;
-        // Used to sort elements of this column. Can be null.
-        public final ViewerComparator comparator;
-
-        public ColumnData(String h, int w, int a, String t, ViewerComparator c) {
-            header = h;
-            width = w;
-            alignment = a;
-            tooltip = t;
-            comparator = c;
-        }
-    };
-    
-    /*
-     * Creates actions for context sensitive menu. 
-     */
-    private void makeActions() {
-
-        // Create the context menu actions
-        enableAllAction = new Action(Messages.ChannelConfigPage_EnableAll, LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_CHECKED)) {
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                for (int i = 0; i < items.length; i++) {
-                    TraceChannel chan = (TraceChannel)items[i].getData();
-                    chan.setIsEnabled(true);
-                }
-                tableViewer.refresh();
-            }
-        };
-
-        disableAllAction = new Action(Messages.ChannelConfigPage_DisableAll, LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_UNCHECKED)) {
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                for (int i = 0; i < items.length; i++) {
-                    TraceChannel chan = (TraceChannel)items[i].getData();
-                    chan.setIsEnabled(false);
-                }
-                tableViewer.refresh();
-            }
-        };
-        setOverrideAllAction = new Action(Messages.ChannelConfigPage_EnableAllBufferOverride, LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_CHECKED)) {
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                for (int i = 0; i < items.length; i++) {
-                    TraceChannel chan = (TraceChannel)items[i].getData();
-                    chan.setIsChannelOverride(true);
-                }
-                tableViewer.refresh();
-            }
-        };
-        resetOverideAllAction= new Action(Messages.ChannelConfigage_DisableAllBufferOverride, LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_UNCHECKED)) {
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                for (int i = 0; i < items.length; i++) {
-                    TraceChannel chan = (TraceChannel)items[i].getData();
-                    chan.setIsChannelOverride(false);
-                }
-                tableViewer.refresh();
-            }
-        };
-        setNumSubbufAction = new Action(Messages.ChannelConfigPage_SetAllNumSubBuf, LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_EDIT)) {
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                SetDialog setDialog = new SetDialog(getShell(), Messages.ChannelConfigPage_NumSubBuf);
-                if (setDialog.open() == Window.OK) {
-
-                    for (int i = 0; i < items.length; i++) {
-                        TraceChannel chan = (TraceChannel)items[i].getData();
-                        chan.setSubbufNum(setDialog.getValue());
-                    }
-
-                    tableViewer.refresh();
-                }
-            }
-        };
-        setSubbufSizeAction = new Action(Messages.channelConfigPage_SetAllSubBufSize, LTTngUiPlugin.getDefault().getImageDescriptor(LTTngUiPlugin.ICON_ID_EDIT)) {
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                SetDialog setDialog = new SetDialog(getShell(), Messages.ChannelConfigPage_SubBufSize);
-                if (setDialog.open() == Window.OK) {
-
-                    for (int i = 0; i < items.length; i++) {
-                        TraceChannel chan = (TraceChannel)items[i].getData();
-                        chan.setSubbufSize(setDialog.getValue());
-                    }
-
-                    tableViewer.refresh();
-                }
-            }
-        };
-        setChanTimerAction = new Action(Messages.ChannelConfigPage_SetAllChannelTimer, LTTngUiPlugin.getDefault().getImageDescriptor("ICON_ID_EDIT")) { //$NON-NLS-1$
-            @Override
-            public void run() {
-                TableItem[] items = tableViewer.getTable().getItems();
-                SetDialog setDialog = new SetDialog(getShell(), Messages.ChannelConfigPage_ChannelTimer);
-                if (setDialog.open() == Window.OK) {
-
-                    for (int i = 0; i < items.length; i++) {
-                        TraceChannel chan = (TraceChannel)items[i].getData();
-                        chan.setTimer(setDialog.getValue());
-                    }
-
-                    tableViewer.refresh();
-                }
-            }
-        };
-    }
-
-    /*
-     * Adds context sensitive menu to table.
-     */
-    private void addContextMenu() {
-        MenuManager manager = new MenuManager("configChanPopupMenu"); //$NON-NLS-1$
-        manager.setRemoveAllWhenShown(true);
-        manager.addMenuListener(new IMenuListener() {
-            
-            @Override
-            public void menuAboutToShow(IMenuManager manager) {
-                
-                if ((fTraceState != TraceState.CREATED)  && (fTraceState != TraceState.CONFIGURED)) {
-                    return;
-                }
-                manager.add(enableAllAction);
-                manager.add(disableAllAction);
-                manager.add(setOverrideAllAction);
-                manager.add(resetOverideAllAction);
-                manager.add(setNumSubbufAction);
-                manager.add(setSubbufSizeAction);
-                manager.add(setChanTimerAction);
-            }
-        });
-        
-        Menu menu = manager.createContextMenu(tableViewer.getControl());
-        tableViewer.getControl().setMenu(menu);
-    }
-    
-    /**
-     * Local class dialog box implementation for setting values for all
-     * rows for a given column  
-     */
-    private static final class SetDialog extends Dialog {
-
-        // ------------------------------------------------------------------------
-        // Attributes
-        // ------------------------------------------------------------------------
-
-        private String fWhat = null;
-        private Text fValueText = null;
-        private Long fValue = null;
-
-        // ------------------------------------------------------------------------
-        // Constructors
-        // ------------------------------------------------------------------------
-
-        public SetDialog(Shell parentShell, String what) {
-            super(parentShell);
-            fWhat = what;
-        }
-
-        // ------------------------------------------------------------------------
-        // Operations
-        // ------------------------------------------------------------------------
-
-        /*
-         * (non-Javadoc)
-         * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
-         */
-        @Override
-        protected void configureShell(Shell newShell) {
-            super.configureShell(newShell);
-            newShell.setText(Messages.ChannelConfigPage_SetAll);    
-            newShell.setImage(LTTngUiPlugin.getDefault().getImage(LTTngUiPlugin.ICON_ID_EDIT));
-        }
-
-        /*
-         * (non-Javadoc)
-         * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-         */
-        @Override
-        protected Control createDialogArea(Composite parent) {
-            //Main dialog panel
-            Composite composite = new Composite(parent, SWT.RESIZE);
-            GridLayout mainLayout = new GridLayout(3, true);
-            composite.setLayout(mainLayout);
-            Label what = new Label(composite, SWT.LEFT);
-            what.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
-            what.setText(fWhat);
-            
-            fValueText = new Text(composite, SWT.LEFT);
-            fValueText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
-            
-            fValueText.addVerifyListener(
-                    new VerifyListener() {
-                        
-                        @Override
-                        public void verifyText(VerifyEvent e) {
-                            e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
-                        }
-                    });
-            
-            fValueText.addListener(SWT.Modify, new Listener() {
-                @Override
-                public void handleEvent(Event event) {
-                    Button ok = getButton(IDialogConstants.OK_ID);
-                    ok.setEnabled(validateInput(fValueText.getText()));
-                }
-            });
-            
-            return composite;
-        }
-        
-        /*
-         * (non-Javadoc)
-         * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
-         */
-        @Override
-        protected void createButtonsForButtonBar(Composite parent) {
-            Button ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
-            createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-            
-            ok.setEnabled(false);
-        }
-
-        /*
-         * (non-Javadoc)
-         * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-         */
-        @Override
-        protected void okPressed() {
-            fValue = Long.valueOf(fValueText.getText());
-            super.okPressed();
-        }
-
-        /*
-         * Method to validate input.
-         */
-        private boolean validateInput(String path) {
-            return (path.trim().length() > 0);
-        }
-
-        /**
-         * Gets value that the user input. 
-         * 
-         * @return value
-         */
-        public Long getValue() {
-            return fValue;
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/TraceConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/TraceConfigurationPage.java
deleted file mode 100644 (file)
index 653ba2b..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Bernd Hufmann - Initial API and implementation\r
- *   \r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards;\r
-\r
-import java.io.File;\r
-\r
-import org.eclipse.jface.wizard.WizardPage;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.TraceResource.TraceState;\r
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceConfig;\r
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.TraceControlConstants;\r
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;\r
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.subsystems.TraceSubSystem;\r
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;\r
-import org.eclipse.rse.ui.SystemBasePlugin;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.VerifyEvent;\r
-import org.eclipse.swt.events.VerifyListener;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.DirectoryDialog;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Group;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Text;\r
-\r
-/**\r
- * <b><u>UstTraceChannelConfigurationPage</u></b>\r
- * <p>\r
- *  Wizard page implementation to configure a trace (Kernel and UST).\r
- * </p>\r
- */\r
-public class TraceConfigurationPage extends WizardPage {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-    private ConfigureTraceWizard fWizard;\r
-    private String fTraceName;\r
-    private String fTraceTransport;\r
-    private String fTracePath;\r
-    private int fMode;\r
-    private int fNumChannel;\r
-    private boolean fIsAppend;\r
-    private boolean fIsNetwork;\r
-    private Text fNameText;\r
-    private Text fTransportText;\r
-    private Text fPathText;\r
-    private Text fNumLttdThreadsText;\r
-    private Button fHostButton;\r
-    private Button fTargetButton;\r
-    private Button fIsAppendButton;\r
-    private Button fFlightRecorderButton;\r
-    private Button fNormalButton;\r
-    private Display fDisplay;\r
-    private String fTraceNameError;\r
-    private String fTracePathError;\r
-    private Button fBrowseButton;\r
-    \r
-    private TraceResource fTraceResource;\r
-    private TraceConfig   fOldTraceConfig;\r
-    private TraceSubSystem fSubSystem;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructore\r
-     * \r
-     * @param wizard\r
-     */\r
-    public TraceConfigurationPage(ConfigureTraceWizard wizard) {\r
-        super("TraceConfigurationPage"); //$NON-NLS-1$\r
-        setTitle(Messages.ConfigureTraceDialog_Title);\r
-//        setDescription("set description..."); \r
-        this.fWizard = wizard;\r
-        setPageComplete(false);\r
-        fTraceNameError = ""; //$NON-NLS-1$\r
-        fTracePathError = ""; //$NON-NLS-1$\r
-        fTraceResource = this.fWizard.getSelectedTrace();\r
-        fOldTraceConfig = fTraceResource.getTraceConfig();\r
-        fSubSystem = (TraceSubSystem)this.fWizard.getSelectedTrace().getSubSystem();\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-       public void createControl(Composite parent) {\r
-        GridData griddata = new GridData();\r
-\r
-        griddata = new GridData();\r
-        Composite composite1 = new Composite(parent, SWT.NONE);\r
-        GridLayout compositeLayout1 = new GridLayout(4, false);\r
-        composite1.setSize(520, 300);\r
-        composite1.setLayout(compositeLayout1);\r
-        griddata.horizontalSpan = 3;\r
-        griddata.widthHint = 520;\r
-        griddata.minimumWidth = 520;\r
-        composite1.setLayoutData(griddata);\r
-        fDisplay = this.getShell().getDisplay();\r
-        setControl(composite1);\r
-        Label nameLabel = new Label(composite1, SWT.NULL);\r
-        nameLabel.setText(Messages.NewTraceDialog_TraceName + ":"); //$NON-NLS-1$\r
-        griddata = new GridData();\r
-        griddata.verticalIndent = 20;\r
-        nameLabel.setLayoutData(griddata);\r
-\r
-        fNameText = new Text(composite1, SWT.SINGLE | SWT.BORDER);\r
-        if (fTraceResource.isUst()) {\r
-            fNameText.setText(TraceControlConstants.Lttng_Ust_TraceName);\r
-            fNameText.setEnabled(false);\r
-        }\r
-\r
-        griddata = new GridData();\r
-        griddata.horizontalAlignment = SWT.FILL;\r
-        griddata.grabExcessHorizontalSpace = true;\r
-        griddata.verticalIndent = 20;\r
-        griddata.horizontalSpan = 3;\r
-        fNameText.setLayoutData(griddata);\r
-        fNameText.setText(fTraceResource.getName());\r
-        fNameText.setEnabled(false);\r
-\r
-        Label transportLabel = new Label(composite1, SWT.NULL);\r
-        transportLabel.setText(Messages.ConfigureTraceDialog_Trace_Transport + ":"); //$NON-NLS-1$\r
-        griddata = new GridData();\r
-        transportLabel.setLayoutData(griddata);\r
-\r
-        fTransportText = new Text(composite1, SWT.SINGLE | SWT.BORDER);\r
-        griddata = new GridData();\r
-        griddata.horizontalAlignment = SWT.FILL;\r
-        griddata.grabExcessHorizontalSpace = true;\r
-        griddata.horizontalSpan = 3;\r
-        fTransportText.setLayoutData(griddata);\r
-        fTransportText.setText(TraceControlConstants.Lttng_Trace_Transport_Relay);\r
-        fTransportText.setEnabled(false); // relay is the only allowed value\r
-        if (fOldTraceConfig != null) {\r
-            fTransportText.setText(fOldTraceConfig.getTraceTransport());\r
-        }\r
-\r
-        griddata = new GridData();\r
-        Group composite21 = new Group(composite1, SWT.SHADOW_OUT);\r
-        composite21.setSize(300, 300);\r
-        composite21.setText(Messages.ConfigureTraceDialog_Trace_Location);\r
-        griddata.horizontalAlignment = SWT.FILL;\r
-        griddata.horizontalSpan = 4;\r
-        griddata.verticalIndent = 10;\r
-        griddata.widthHint = 300;\r
-        griddata.minimumWidth = 300;\r
-        composite21.setLayoutData(griddata);\r
-        GridLayout compositeLayout21 = new GridLayout(4, false);\r
-        composite21.setLayout(compositeLayout21);\r
-        fTargetButton = new Button(composite21, SWT.RADIO);\r
-        fTargetButton.setText(Messages.ConfigureTraceDialog_Target);\r
-        fTargetButton.setSelection(true);\r
-        fIsNetwork = false;\r
-        fHostButton = new Button(composite21, SWT.RADIO);\r
-        fHostButton.setText(Messages.ConfigureTraceDialog_Host);\r
-        griddata = new GridData();\r
-        griddata.horizontalSpan = 3;\r
-        fHostButton.setLayoutData(griddata);\r
-        fHostButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event e) {\r
-                if (fHostButton.getSelection()) {\r
-                    fBrowseButton.setEnabled(true);\r
-                } else {\r
-                    fBrowseButton.setEnabled(false);\r
-                }\r
-                fIsNetwork = fHostButton.getSelection();\r
-                validatePathName(fPathText.getText());\r
-                validate();\r
-            }\r
-        });\r
-        \r
-        Label pathLabel = new Label(composite21, SWT.NULL);\r
-        pathLabel.setText(Messages.ConfigureTraceDialog_Trace_Path);\r
-        griddata = new GridData();\r
-        griddata.verticalIndent = 10;\r
-        pathLabel.setLayoutData(griddata);\r
-\r
-        fPathText = new Text(composite21, SWT.SINGLE | SWT.BORDER);\r
-        griddata = new GridData();\r
-        griddata.horizontalAlignment = SWT.FILL;\r
-        griddata.grabExcessHorizontalSpace = true;\r
-        griddata.verticalIndent = 10;\r
-        fPathText.setLayoutData(griddata);\r
-        fPathText.setData(""); //$NON-NLS-1$\r
-\r
-        fBrowseButton = new Button(composite21, SWT.PUSH);\r
-        fBrowseButton.setText(Messages.ConfigureTraceDialog_Browse + "...");  //$NON-NLS-1$\r
-        griddata = new GridData();\r
-        griddata.grabExcessHorizontalSpace = false;\r
-        griddata.widthHint = 100;\r
-        griddata.verticalIndent = 10;\r
-        fBrowseButton.setLayoutData(griddata);\r
-        fBrowseButton.setEnabled(false);\r
-        fBrowseButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                DirectoryDialog dialog = new DirectoryDialog(fDisplay.getActiveShell());\r
-                String newPath = dialog.open();\r
-                if (newPath != null) {\r
-                    fPathText.setText(newPath);\r
-                }\r
-            }\r
-        });\r
-\r
-        fNameText.addListener(SWT.Modify, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                validateTraceName(fNameText.getText());\r
-                validate();\r
-            }\r
-        });\r
-\r
-        fTransportText.addListener(SWT.Modify, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                validate();\r
-            }\r
-        });\r
-\r
-        fPathText.addListener(SWT.Modify, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                if (!fPathText.isEnabled()) {\r
-                    return;\r
-                }\r
-                validatePathName(fPathText.getText());\r
-                validate();\r
-            }\r
-        });\r
-\r
-        griddata = new GridData();\r
-        Composite composite2 = new Composite(composite1, SWT.NONE);\r
-        GridLayout compositeLayout2 = new GridLayout(2, false);\r
-        composite2.setLayout(compositeLayout2);\r
-        griddata.horizontalSpan = 4;\r
-        griddata.widthHint = 500;\r
-        griddata.minimumWidth = 500;\r
-        composite2.setLayoutData(griddata);\r
-\r
-        Label numLttdThreadsLabel = new Label(composite2, SWT.NULL);\r
-        numLttdThreadsLabel.setText(Messages.ConfigureTraceDialog_Num_Lttd_Threads + ":"); //$NON-NLS-1$);\r
-        griddata = new GridData();\r
-        griddata.verticalIndent = 10;\r
-        numLttdThreadsLabel.setLayoutData(griddata);\r
-\r
-        fNumLttdThreadsText = new Text(composite2, SWT.SINGLE | SWT.BORDER);\r
-        griddata = new GridData();\r
-        griddata.horizontalAlignment = SWT.BEGINNING;\r
-        griddata.verticalIndent = 10;\r
-        griddata.widthHint = 50;\r
-        griddata.minimumWidth = 50;\r
-        fNumLttdThreadsText.setLayoutData(griddata);\r
-        if (fTraceResource.isUst()) {\r
-            fNumLttdThreadsText.setText("1"); //$NON-NLS-1$\r
-            fNumLttdThreadsText.setEnabled(false);\r
-        } else {\r
-            fNumLttdThreadsText.setText("2"); //$NON-NLS-1$\r
-        }\r
-\r
-        fNumLttdThreadsText.addVerifyListener(new VerifyListener() {\r
-            @Override\r
-            public void verifyText(VerifyEvent e) {\r
-                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$\r
-            }\r
-        });\r
-\r
-        fNumLttdThreadsText.addListener(SWT.Modify, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                validate();\r
-            }\r
-        });\r
-\r
-        fIsAppendButton = new Button(composite1, SWT.CHECK);\r
-        fIsAppendButton.setText(Messages.ConfigureTraceDialog_Append);\r
-        griddata = new GridData();\r
-        griddata.horizontalAlignment = SWT.BEGINNING;\r
-        griddata.horizontalSpan = 4;\r
-        griddata.verticalIndent = 10;\r
-        fIsAppendButton.setLayoutData(griddata);\r
-        fIsAppend = false;\r
-        fIsAppendButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event e) {\r
-                fIsAppend = fIsAppendButton.getSelection();\r
-            }\r
-        });\r
-        if (fTraceResource.isUst()) {\r
-            fIsAppendButton.setEnabled(false);\r
-        }\r
-\r
-        griddata = new GridData();\r
-        Group composite22 = new Group(composite1, SWT.SHADOW_OUT);\r
-        composite22.setText(Messages.ConfigureTraceDialog_Trace_Mode);\r
-        griddata.horizontalSpan = 4;\r
-        griddata.verticalIndent = 10;\r
-        composite22.setLayoutData(griddata);\r
-        GridLayout compositeLayout22 = new GridLayout(2, false);\r
-        composite22.setLayout(compositeLayout22);\r
-        fNormalButton = new Button(composite22, SWT.RADIO);\r
-        fNormalButton.setText(Messages.ConfigureTraceDialog_Mode_Normal);\r
-        fFlightRecorderButton = new Button(composite22, SWT.RADIO);\r
-        fFlightRecorderButton.setText(Messages.ConfigureTraceDialog_Mode_Flight_Recorder);\r
-        fMode = TraceConfig.NORMAL_MODE;\r
-        fNormalButton.setSelection(true);\r
-        fNormalButton.addListener(SWT.Selection, new Listener() {\r
-               @Override\r
-               public void handleEvent(Event e) {\r
-                       if (fNormalButton.getSelection()) {\r
-                               fMode = TraceConfig.NORMAL_MODE;\r
-                       }\r
-               }\r
-        });\r
-        fFlightRecorderButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event e) {\r
-                if (fFlightRecorderButton.getSelection()) {\r
-                    fMode = TraceConfig.FLIGHT_RECORDER_MODE;\r
-                }\r
-            }\r
-        });\r
-        if (fTraceResource.isUst()) {\r
-            fFlightRecorderButton.setEnabled(false);\r
-            fNormalButton.setEnabled(false);\r
-        }\r
-\r
-        if(fOldTraceConfig != null) {\r
-            fPathText.setText(fOldTraceConfig.getTracePath());\r
-            fTargetButton.setSelection(!fOldTraceConfig.isNetworkTrace());\r
-            fHostButton.setSelection(fOldTraceConfig.isNetworkTrace());\r
-            fIsNetwork = fOldTraceConfig.isNetworkTrace();\r
-            fBrowseButton.setEnabled(true);\r
-            fNumLttdThreadsText.setText(String.valueOf(fOldTraceConfig.getNumChannel()));\r
-            fIsAppendButton.setSelection(fOldTraceConfig.getIsAppend());\r
-            fIsAppend = fOldTraceConfig.getIsAppend();\r
-            fFlightRecorderButton.setSelection(fOldTraceConfig.getMode() == TraceConfig.FLIGHT_RECORDER_MODE);\r
-            fNormalButton.setSelection(fOldTraceConfig.getMode() == TraceConfig.NORMAL_MODE);\r
-        }\r
-\r
-        // Depending on the state disable fields, it's only informational then\r
-        if ((fTraceResource.getTraceState() == TraceState.STARTED) || (fTraceResource.getTraceState() == TraceState.PAUSED)) {\r
-            fPathText.setEnabled(false);\r
-            fBrowseButton.setEnabled(false);\r
-            fTargetButton.setEnabled(false);\r
-            fHostButton.setEnabled(false);\r
-            fIsAppendButton.setEnabled(false);\r
-            fNumLttdThreadsText.setEnabled(false);\r
-            fFlightRecorderButton.setEnabled(false);\r
-            fNormalButton.setEnabled(false);\r
-        }\r
-\r
-        validate();\r
-\r
-        fDisplay.getActiveShell().addListener(SWT.Traverse, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                if (event.detail == SWT.TRAVERSE_ESCAPE) {\r
-                    event.doit = false;\r
-                }\r
-            }\r
-        });\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.dialogs.DialogPage#dispose()\r
-     */\r
-    @Override\r
-    public void dispose() {\r
-        super.dispose();\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)\r
-     */\r
-    @Override\r
-    public void setVisible(boolean visible) {\r
-        if (visible) {\r
-            validate();\r
-        }\r
-        super.setVisible(visible);\r
-    }\r
-    \r
-    /*\r
-     * Validates the trace name which has to be unique.\r
-     */\r
-    protected boolean validateTraceName(String name) {\r
-        if (name.length() > 0) {\r
-            TraceResource[] traces = new TraceResource[0];\r
-            try {\r
-                traces = fSubSystem.getAllTraces();\r
-            } catch (SystemMessageException e) {\r
-                SystemBasePlugin.logError("TraceConfigurationPage ", e); //$NON-NLS-1$\r
-            }\r
-            for (int i = 0; i < traces.length; i++) {\r
-                if (traces[i].getName().compareTo(name) == 0) {\r
-                    fTraceNameError = Messages.NewTraceDialog_Error_Already_Exists;\r
-                    setErrorMessage(fTraceNameError);\r
-                    return false;\r
-                }\r
-            }\r
-            final char[] chars = name.toCharArray();\r
-            for (int x = 0; x < chars.length; x++) {\r
-                final char c = chars[x];\r
-                if ((x == 0) && !(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) {\r
-                    fTraceNameError = Messages.NewTraceDialog_Error_Invalid_First_Char;\r
-                    setErrorMessage(fTraceNameError);\r
-                    return false;\r
-                } else if (x != 0) {\r
-                    if (!((c >= 'a') && (c <= 'z')) && !((c >= 'A') && (c <= 'Z')) && !((c >= '0') && (c <= '9'))) {\r
-                        fTraceNameError = Messages.NewTraceDialog_Error_Invalid_Name;\r
-                        setErrorMessage(fTraceNameError);\r
-                        return false;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if (fTracePathError.length() > 0) {\r
-            setErrorMessage(fTracePathError);\r
-        } else {\r
-            setErrorMessage(null);\r
-        }\r
-        fTraceNameError = ""; //$NON-NLS-1$\r
-        return true;\r
-    }\r
-\r
-    /*\r
-     * Validates the trace path.\r
-     */\r
-    private boolean validatePathName(String path) {\r
-        if (path.length() > 0) {\r
-            final char c0 = path.charAt(0);\r
-            if (c0 != '/') {\r
-                fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Path;\r
-                setErrorMessage(fTracePathError);\r
-                return false;\r
-            } else {\r
-                String[] folders = path.split("/"); //$NON-NLS-1$\r
-                for (int i = 0; i < folders.length; i++) {\r
-                    final char[] chars = folders[i].toCharArray();\r
-                    for (int x = 0; x < chars.length; x++) {\r
-                        final char c = chars[x];\r
-                        if ((c >= 'a') && (c <= 'z')) {\r
-                            continue; // lowercase\r
-                        }\r
-                        if ((c >= 'A') && (c <= 'Z')) {\r
-                            continue; // uppercase\r
-                        }\r
-                        if ((c >= '0') && (c <= '9')) {\r
-                            continue; // numeric\r
-                        }\r
-                        fTracePathError = Messages.ConfigureTraceDialog_Error_Invalid_Folder;\r
-                        setErrorMessage(fTracePathError);\r
-                        return false;\r
-                    }\r
-                }\r
-                if (path.length() > 1) {\r
-                    for (int i = 0; i < path.length() - 1; i++) {\r
-                        if ((path.charAt(i) == '/') && (path.charAt(i + 1) == '/')) {\r
-                            fTracePathError = Messages.ConfigureTraceDialog_Error_Multiple_Seps;\r
-                            setErrorMessage(fTracePathError);\r
-                            return false;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-            if (fHostButton.getSelection()) {\r
-                File file = new File(path);\r
-                if (file.isFile()) {\r
-                    fTracePathError = Messages.ConfigureTraceDialog_Error_File_Exists;\r
-                    setErrorMessage(fTracePathError);\r
-                    return false;\r
-                }\r
-                if (path.length() > 1 && !file.getParentFile().canWrite()) {\r
-                    fTracePathError = Messages.ConfigureTraceDialog_Error_Can_Not_Write;\r
-                    setErrorMessage(fTracePathError);\r
-                    return false;\r
-                }\r
-            }\r
-        }\r
-        if (fTraceNameError.length() > 0) {\r
-            setErrorMessage(fTraceNameError);\r
-        } else {\r
-            setErrorMessage(null);\r
-        }\r
-        fTracePathError = ""; //$NON-NLS-1$\r
-        return true;\r
-    }\r
-    \r
-    /*\r
-     * Validates all input values.\r
-     */\r
-    private void validate() {\r
-        if ((fNameText.getText() == null) || (fTransportText.getText() == null) || (fTransportText.getText().length() == 0) || (fNameText.getText().length() == 0)\r
-                || (fNumLttdThreadsText.getText().length() == 0) || (fNumLttdThreadsText.getText().length() == 0)) {\r
-            setPageComplete(false);\r
-            return;\r
-        }\r
-        if (fPathText.getText().length() == 0) {\r
-            setPageComplete(false);\r
-            return;\r
-        }\r
-        if ((fTracePathError.length() > 0) || (fTraceNameError.length() > 0)) {\r
-            setPageComplete(false);\r
-            return;\r
-        }\r
-        fTraceName = fNameText.getText();\r
-        fTraceTransport = fTransportText.getText();\r
-        fTracePath = fPathText.getText();\r
-        fNumChannel = Integer.parseInt(fNumLttdThreadsText.getText());\r
-        \r
-        if (fTraceNameError.length() == 0) {\r
-            setErrorMessage(null);\r
-            setPageComplete(true);\r
-       } else {\r
-            setErrorMessage(fTraceNameError);\r
-            setPageComplete(false);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Gets the trace configuration. \r
-     * \r
-     * @return trace configuration\r
-     */\r
-    public TraceConfig getTraceConfig() {\r
-        TraceConfig newTraceConfig = new TraceConfig();\r
-        newTraceConfig.setTraceName(fTraceName);\r
-        newTraceConfig.setTraceTransport(fTraceTransport);\r
-        newTraceConfig.setTracePath(fTracePath);\r
-        newTraceConfig.setNetworkTrace(fIsNetwork);\r
-        newTraceConfig.setIsAppend(fIsAppend);\r
-        newTraceConfig.setMode(fMode);\r
-        newTraceConfig.setNumChannel(fNumChannel);\r
-\r
-        return newTraceConfig;\r
-    }\r
-\r
-    /**\r
-     * Gets if trace is a local trace (i.e. if trace output is stored on host \r
-     * where client is running)\r
-     * \r
-     * @return isLocalTrace\r
-     */\r
-    public boolean isLocalTrace() {\r
-        return fHostButton.getSelection();\r
-    }\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/UstTraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/UstTraceChannelConfigurationPage.java
deleted file mode 100644 (file)
index e05cf56..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *   
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.tracecontrol.wizards;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannel;
-import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.model.config.TraceChannels;
-import org.eclipse.linuxtools.lttng.ui.tracecontrol.Messages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <b><u>UstTraceChannelConfigurationPage</u></b>
- * <p>
- *  Wizard page implementation to configure the UST trace channels.
- * </p>
- */
-public class UstTraceChannelConfigurationPage extends WizardPage implements ITraceChannelConfigurationPage {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    private TraceChannels fChannels;
-    private Composite fContainer;
-    private Text fChannelTimerText;
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     * 
-     * @param channels
-     */
-    protected UstTraceChannelConfigurationPage(TraceChannels channels) {
-        super("UstTraceChannelConfigurationPage"); //$NON-NLS-1$
-        fChannels = channels;
-        setTitle(Messages.ChannelConfigPage_PageTitle);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
-     */
-    @Override
-    public void createControl(Composite parent) {
-        fContainer = new Composite(parent, SWT.NULL);
-        fContainer.setLayout(new GridLayout());
-        setControl(fContainer);
-
-        Composite headerComposite = new Composite(fContainer, SWT.FILL);
-        GridLayout headerLayout = new GridLayout(4, true);
-        headerLayout.marginHeight = 0;
-        headerLayout.marginWidth = 0;
-        headerComposite.setLayout(headerLayout);
-        headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        
-        Label label = new Label(headerComposite, SWT.LEFT);
-        label.setText(Messages.ChannelConfigPage_ChannelTimer + ":"); //$NON-NLS-1$
-        label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-        
-        fChannelTimerText = new Text(headerComposite, SWT.LEFT);
-        fChannelTimerText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
-        fChannelTimerText.setToolTipText(Messages.ChannelConfigPage_ChannelTimerTooltip);
-        
-        TraceChannel chan = fChannels.get(TraceChannel.UST_TRACE_CHANNEL_NAME);
-        if (chan.getTimer() == TraceChannel.UNKNOWN_VALUE) {
-            fChannelTimerText.setText(TraceChannel.UNKNOWN_STRING);    
-        }
-        else { 
-            fChannelTimerText.setText(String.valueOf(chan.getTimer()));
-        }
-        
-        fChannelTimerText.addVerifyListener(new VerifyListener() {
-            @Override
-            public void verifyText(VerifyEvent e) {
-                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
-            }
-        });
-        
-        fChannelTimerText.addListener(SWT.Modify, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                String valueString = fChannelTimerText.getText();
-                TraceChannel chan = fChannels.get(TraceChannel.UST_TRACE_CHANNEL_NAME);
-                if (valueString.length() == 0) {
-                    valueString = "0"; //$NON-NLS-1$
-                }
-                else if(TraceChannel.UNKNOWN_STRING.equals(valueString)) {
-                    chan.setTimer(TraceChannel.UNKNOWN_VALUE);
-                }
-                else {
-                    chan.setTimer(Integer.parseInt(valueString));
-                }
-            }
-        });
-    }
-    
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.DialogPage#dispose()
-     */
-    @Override
-    public void dispose() {
-        super.dispose();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.rse.ui.wizards.ITraceChannelConfigurationPage#getTraceChannels()
-     */
-    @Override
-    public TraceChannels getTraceChannels() {
-        return fChannels;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java
deleted file mode 100644 (file)
index 8bff779..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views;
-
-import org.eclipse.linuxtools.lttng.ui.views.controlflow.ControlFlowView;
-import org.eclipse.linuxtools.lttng.ui.views.resources.ResourcesView;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.StatisticsView;
-import org.eclipse.linuxtools.tmf.ui.views.events.TmfEventsView;
-import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView;
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-/**
- * <b><u>PerspectiveFactory</u></b>
- * <p>
- * The default LTTng perspective.
- */
-public class PerspectiveFactory implements IPerspectiveFactory {
-
-    // Perspective ID
-    public static final String ID = "org.eclipse.linuxtools.lttng.ui.perspective"; //$NON-NLS-1$
-
-    // LTTng views
-    private static final String EVENTS_VIEW_ID = TmfEventsView.ID;
-    private static final String CONTROL_FLOW_VIEW_ID = ControlFlowView.ID;
-    private static final String RESOURCES_VIEW_ID = ResourcesView.ID;
-    private static final String STATISTICS_VIEW_ID = StatisticsView.ID;
-    private static final String HISTOGRAM_VIEW_ID = HistogramView.ID;
-
-    // Standard Eclipse views
-    private static final String PROJECT_VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER;
-    private static final String PROPERTIES_VIEW_ID = IPageLayout.ID_PROP_SHEET;
-    private static final String BOOKMARKS_VIEW_ID = IPageLayout.ID_BOOKMARKS;
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
-     */
-    @Override
-    public void createInitialLayout(IPageLayout layout) {
-
-        layout.setEditorAreaVisible(false);
-
-        addFastViews(layout);
-        addViewShortcuts(layout);
-        addPerspectiveShortcuts(layout);
-
-        // Create the top left folder
-        IFolderLayout topLeftFolder = layout.createFolder(
-                "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
-        topLeftFolder.addView(PROJECT_VIEW_ID);
-
-        // Create the top right folder
-        IFolderLayout topRightFolder = layout.createFolder(
-                "topRightFolder", IPageLayout.TOP, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
-        topRightFolder.addView(CONTROL_FLOW_VIEW_ID);
-        topRightFolder.addView(RESOURCES_VIEW_ID);
-        topRightFolder.addView(STATISTICS_VIEW_ID);
-
-        // Create the middle right folder
-        IFolderLayout middleRightFolder = layout.createFolder(
-                "middleRightFolder", IPageLayout.BOTTOM, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ 
-        middleRightFolder.addView(EVENTS_VIEW_ID);
-
-        // Create the bottom right folder
-        IFolderLayout bottomRightFolder = layout.createFolder(
-                "bottomRightFolder", IPageLayout.BOTTOM, 0.50f, "middleRightFolder"); //$NON-NLS-1$ //$NON-NLS-2$
-        bottomRightFolder.addView(HISTOGRAM_VIEW_ID);
-        bottomRightFolder.addView(PROPERTIES_VIEW_ID);
-        bottomRightFolder.addView(BOOKMARKS_VIEW_ID);
-    }
-
-    /**
-     * Add fast views to the perspective
-     * 
-     * @param layout
-     */
-    private void addFastViews(IPageLayout layout) {
-        // TODO Auto-generated method stub
-    }
-
-    /**
-     * Add view shortcuts to the perspective
-     * 
-     * @param layout
-     */
-    private void addViewShortcuts(IPageLayout layout) {
-        // TODO Auto-generated method stub
-    }
-
-    /**
-     * Add perspective shortcuts to the perspective
-     * 
-     * @param layout
-     */
-    private void addPerspectiveShortcuts(IPageLayout layout) {
-        // TODO Auto-generated method stub
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java
deleted file mode 100644 (file)
index 6b6fff2..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: Alvaro Sanchez-Leon - Initial implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.common;
-
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.state.AbsStateProcessing;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-
-public abstract class AbsTRangeUpdate extends AbsStateProcessing implements
-               ILttngEventProcessor {
-
-    private static final long MINORBITS = 20;
-    
-       // ========================================================================
-       // General methods
-       // =======================================================================
-    
-    /**
-     * Get the mkdev node id<br>
-     * <br>
-     * This is an implementation of a KERNEL macro used in Lttv
-     * 
-     */
-    public long getMkdevId(long major, long minor) {
-        return (((major) << MINORBITS) | (minor));
-    }
-
-       /**
-        * Get the pixels per Nano second, either from active widgets or initialise
-        * with the experiment time range values
-        * 
-        * @param traceSt
-        * @param params
-        * 
-        * @return double
-        */
-    protected double getPixelsPerNs(LttngTraceState traceSt, ParamsUpdater params) {
-        double pixPerNs = params.getPixelsPerNs();
-        if (pixPerNs == 0.0) {
-            TmfTimeRange tsetRange = traceSt.getContext().getExperimentTimeWindow();
-            
-            long startTime = tsetRange.getStartTime().getValue();
-            long endTime = tsetRange.getEndTime().getValue();
-            long delta = endTime - startTime;
-            
-            if (delta > 0) {
-                pixPerNs = (double) params.getWidth() / (double) delta;
-                params.setPixelsPerNs(pixPerNs);
-            }
-        }
-        return pixPerNs;
-       }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java
deleted file mode 100644 (file)
index fd723d7..0000000
+++ /dev/null
@@ -1,823 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *   Bernd Hufmann - Bug fixes
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.common;
-
-import java.util.Arrays;
-
-import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
-import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
-import org.eclipse.linuxtools.internal.lttng.core.control.LttngSyntheticEventProvider;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngSyntheticEvent;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
-import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
-import org.eclipse.linuxtools.internal.lttng.core.request.IRequestStatusListener;
-import org.eclipse.linuxtools.internal.lttng.core.request.LttngSyntEventRequest;
-import org.eclipse.linuxtools.internal.lttng.core.request.RequestCompletedSignal;
-import org.eclipse.linuxtools.internal.lttng.core.request.RequestStartedSignal;
-import org.eclipse.linuxtools.internal.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.tmf.core.event.ITmfTimestamp;
-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.request.TmfDataRequest;
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITimeAnalysisViewer;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-import org.eclipse.linuxtools.tmf.ui.views.TmfView;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * <p>
- * Abstract class used as a base for views handling specific time range data
- * requests
- * </p>
- * <p>
- * The class handles a single element queue of data requests, i.e. request can
- * be triggered from different sources e.g. opening a file as well as a new
- * selected time window
- * </p>
- * 
- * @author alvaro
- * 
- */
-public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatusListener {
-
-       // ========================================================================
-       // Data
-       // ========================================================================
-
-//      private static final long INITIAL_WINDOW_OFFSET = (1L * 1    * 1000 * 1000); // .001sec
-//      private static final long INITIAL_WINDOW_OFFSET = (1L * 10   * 1000 * 1000); // .01sec
-        private static final long INITIAL_WINDOW_OFFSET = (1L * 100  * 1000 * 1000); // .1sec
-//      private static final long INITIAL_WINDOW_OFFSET = (1L * 1000 * 1000 * 1000); // 1sec
-
-       /**
-        * Number of events before a GUI refresh
-        */
-       protected static final Long INPUT_CHANGED_REFRESH = 75000L;
-       private static final long DEFAULT_OFFSET = 0;
-
-       protected boolean synch = true; // time synchronization, used to be an option
-       protected ITimeAnalysisViewer tsfviewer = null;
-
-       private LttngSyntEventRequest fCurrentRequest = null;
-
-       protected LttngSyntheticEventProvider fProvider = LttngCoreProviderFactory.getEventProvider(getProviderId());
-       
-       // ========================================================================
-       // Constructor
-       // ========================================================================
-       public AbsTimeUpdateView(String viewID) {
-               super(viewID);
-               // freqState = UiCommonFactory.getQueue(this);
-       }
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       
-       /**
-        * Returns the number of events after which the relevant display will 
-        * be refreshed
-        * 
-        * @return  
-        */
-       protected Long getInputChangedRefresh() {
-           return INPUT_CHANGED_REFRESH;
-       }
-
-   /**
-     * Cancel the ongoing request if another experiment is being selected
-     * @param experimentDisposedSignal
-     */
-    @TmfSignalHandler
-    public void experimentDisposed(TmfExperimentDisposedSignal<? extends TmfEvent> experimentDisposedSignal) {
-        if (experimentDisposedSignal.getExperiment() != TmfExperiment.getCurrentExperiment()) {
-            return;
-        }
-        fProvider.conditionallyCancelRequests();
-    }
-       
-       /*
-        * (non-Javadoc)
-        * 
-        * @seeorg.eclipse.linuxtools.lttng.state.IStateDataRequestListener#
-        * processingStarted(org.eclipse.linuxtools.lttng.state.StateDataRequest)
-        */
-       @Override
-       @TmfSignalHandler
-       public synchronized void processingStarted(RequestStartedSignal signal) {
-               LttngSyntEventRequest request = signal.getRequest();
-               if (request != null) {
-                       // update queue with the id of the current request.
-                       // freqState.requestStarted(request);
-
-                       // if there was no new request then this one is still on
-                       // prepare for the reception of new data
-                       waitCursor(true);
-
-                       // no new time range for zoom orders
-                       TmfTimeRange trange = null;
-                       // Time Range will be used to filter out events which are
-                       // not visible in one pixel
-                       trange = request.getRange();
-
-                       // indicate if the data model needs to be cleared e.g. a new
-                       // experiment is being selected
-                       boolean clearData = request.isclearDataInd();
-                       // Indicate if current data needs to be cleared and if so
-                       // specify the new experiment time range that applies
-                       modelUpdatePrep(trange, clearData);
-               }
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @seeorg.eclipse.linuxtools.lttng.state.IStateDataRequestListener#
-        * processingCompleted(org.eclipse.linuxtools.lttng.state.StateDataRequest)
-        */
-       @Override
-       @TmfSignalHandler
-       public void processingCompleted(RequestCompletedSignal signal) {
-               ILttngSyntEventRequest request = signal.getRequest();
-
-               if (request == null) {
-                       return;
-               }
-
-               // Update wait cursor
-               waitCursor(false);
-
-               // No data refresh actions for cancelled requests.
-               if (request.isCancelled() || request.isFailed()) {
-                       if (TraceDebug.isDEBUG()) {
-                               TmfTimeRange trange = request.getRange();
-                               if (request.isCancelled()) {
-                                       TraceDebug.debug("Request cancelled " //$NON-NLS-1$
-                                                       + trange.getStartTime() + "-" + trange.getEndTime() //$NON-NLS-1$
-                                                       + " Handled Events: " + request.getSynEventCount() //$NON-NLS-1$
-                                                       + " " + request.toString(), 15); //$NON-NLS-1$
-                               } else if (request.isFailed()) {
-                                       TraceDebug.debug("Request Failed " + trange.getStartTime() //$NON-NLS-1$
-                                                       + "-" + trange.getEndTime() + " Handled Events: " //$NON-NLS-1$ //$NON-NLS-2$
-                                                       + request.getSynEventCount() + " " //$NON-NLS-1$
-                                                       + request.toString());
-                               }
-                       }
-
-                       return;
-               } else {
-                       modelInputChanged(request, true);
-               }
-       }
-
-       /**
-        * Registers as listener of time selection from other views
-        * 
-        * @param signal
-        */
-       public void synchToTime(TmfTimeSynchSignal signal) {
-        if (signal == null)
-               return;
-               if (synch) {
-                       Object source = signal.getSource();
-                       if (source != null && source != this) {
-
-                               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-
-                                       // Check for GUI thread
-                                       if (Display.getCurrent() != null) {
-                                               // GUI thread - execute update right away.
-                                               
-                                               // Internal value is expected in nano seconds.
-                                               long selectedTime = signal.getCurrentTime().getValue();
-                                               if (tsfviewer != null) {
-                                                       tsfviewer.setSelectedTime(selectedTime, true, source);
-
-                                                       ParamsUpdater paramUpdater = getParamsUpdater();
-                                                   Long savedSelTime = paramUpdater.getSelectedTime();
-                                                   if ((savedSelTime == null) || (savedSelTime != selectedTime)) {
-                                                   // Update the parameter updater to save the selected time
-                                                   paramUpdater.setSelectedTime(selectedTime);   
-                                               }
-                                               }
-                                       } else {
-                                               // Perform the updates on the UI thread
-                                               
-                                               // We need to clone the timestamp in the signal so that it won't be overwritten duo to multipe thread access 
-                                               final TmfTimeSynchSignal savedSignal = new TmfTimeSynchSignal(signal.getSource(), signal.getCurrentTime().clone());
-                                               tsfviewer.getControl().getDisplay().asyncExec(new Runnable() {
-                                                       @Override
-                                                       public void run() {
-                                                               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-                                                                       synchToTime(savedSignal);
-                                                               }
-                                                       }
-                                               });
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Process the reception of time window adjustment in this view if the
-        * source of the update is not this view.
-        * 
-        * @param signal
-        * @param clearingData
-        */
-       public void synchToTimeRange(TmfRangeSynchSignal signal, boolean clearingData) {
-           if (signal == null)
-                return;
-               if (synch) {
-                       Object source = signal.getSource();
-                       if (source != null && source != this) {
-                               // Internal value is expected in nano seconds.
-                               TmfTimeRange trange = signal.getCurrentRange();
-                               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
-                               if (experiment == null) {
-                                       TraceDebug.debug("Current selected experiment is null"); //$NON-NLS-1$
-                                       return;
-                               }
-
-                               // Clearing of process data is configurable
-                               eventRequest(trange, experiment.getTimeRange(), clearingData, ExecutionType.FOREGROUND);
-                       }
-               }
-       }
-
-       /**
-        * Trigger time synchronisation to other views this method shall be called
-        * when a check has been performed to note that an actual change of time has
-        * been performed vs a pure re-selection of the same time
-        * 
-        * @param time
-        * @param source
-        */
-       protected void synchTimeNotification(long time, Object source) {
-               // if synchronisation selected
-               if (synch) {
-                       // Notify other views
-                       TmfSignalManager.dispatchSignal(new TmfTimeSynchSignal(source, new LttngTimestamp(time)));
-               }
-       }
-
-       /**
-        * Common implementation of ITmfTimeSelectionListener, not used by all the
-        * views extending this abstract class
-        * 
-        * @param event
-        */
-       protected void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) {
-               Object source = event.getSource();
-               if (source == null) {
-                       return;
-               }
-
-               ParamsUpdater paramUpdater = getParamsUpdater();
-               Long savedSelTime = paramUpdater.getSelectedTime();
-
-               long selTimens = event.getSelectedTime();
-
-               // make sure the new selected time is different than saved before
-               // executing update
-               if (savedSelTime == null || savedSelTime != selTimens) {
-                       // Notify listener views.
-                       synchTimeNotification(selTimens, source);
-
-                       // Update the parameter updater to save the selected time
-                       paramUpdater.setSelectedTime(selTimens);
-
-                       if (TraceDebug.isDEBUG()) {
-                               TraceDebug.debug("Selected Time: " + new LttngTimestamp(selTimens) + "\n\t\t" + getName()); //$NON-NLS-1$ //$NON-NLS-2$
-                       }
-               }
-       }
-
-       /**
-        * Common implementation of ITmfTimeScaleSelectionListener, not used by all
-        * the views extending this abstract class
-        * 
-        * @param event
-        */
-       protected void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
-        // source needed to keep track of source values
-        Object source = event.getSource();
-
-        boolean newParams = false;
-        TmfTimeRange trange = null;
-        Long selectedTime = null;
-
-        // update all information and get relevant data
-           synchronized (this) {
-               if (source != null) {
-                   // Update the parameter updater before carrying out a read request
-                   ParamsUpdater paramUpdater = getParamsUpdater();
-                   newParams = paramUpdater.processTimeScaleEvent(event);
-
-                   if (newParams) {
-                       // Read the updated time window
-                       trange = paramUpdater.getTrange();
-                       if (trange != null) {
-                           selectedTime = paramUpdater.getSelectedTime();
-                       }
-                   }
-               }
-           }
-
-           // Check for selectedTime is sufficient since it is only set if
-           // newParams is true and trange is not null
-               if (selectedTime != null) {
-                   // Notify listener views. to perform data requests
-            // upon this notification
-
-                   // Note that this has to be done outside the synchronized statement
-                   // because otherwise we could end-up in a deadlock if a ongoing 
-                   // request needs to be canceled.
-            synchTimeRangeNotification(trange, selectedTime, source);              
-               }
-       }
-
-       /**
-        * Inform registered listeners about the new time range
-        * 
-        * @param trange
-        * @param selectedTime
-        * @param source
-        */
-       protected void synchTimeRangeNotification(TmfTimeRange trange, Long selectedTime, Object source) {
-               // if synchronisation selected
-               if (synch) {
-                       // Notify other views
-                       TmfSignalManager.dispatchSignal(new TmfRangeSynchSignal(source, trange, new LttngTimestamp(selectedTime)));
-               }
-       }
-
-       /**
-        * @param zoomedTRange
-        * @param experimentTRange
-        * @param clearingData
-        * @param execType 
-        */
-       public void eventRequest(TmfTimeRange zoomedTRange, TmfTimeRange experimentTRange, boolean clearingData, ExecutionType execType) {
-
-               // timeRange is the Experiment time range
-               boolean sent = processDataRequest(zoomedTRange, experimentTRange, DEFAULT_OFFSET, TmfDataRequest.ALL_DATA, clearingData, execType);
-
-               if (sent) {
-                       waitCursor(true);
-               }
-       }
-
-       /**
-        * @param offset
-        * @param nbRequested
-        * @param startTime
-        * @param clearingData
-        * @param execType 
-        */
-       public void eventRequest(long offset, TmfTimeRange range, boolean clearingData, ExecutionType execType) {
-
-               // timeRange is the Experiment time range
-               boolean sent = processDataRequest(range, null, offset, TmfDataRequest.ALL_DATA, clearingData, execType);
-
-               if (sent) {
-                       waitCursor(true);
-               }
-       }
-
-//     /**
-//      * @param zoomedTRange
-//      * @param experimentTRange
-//      * @param execType 
-//      */
-//     public void dataRequest(TmfTimeRange zoomedTRange,
-//                     TmfTimeRange experimentTRange, boolean clearingData) {
-//
-//             // timeRange is the Experiment time range
-//              boolean sent = processDataRequest(zoomedTRange, experimentTRange, clearingData);
-//
-//             if (sent) {
-//                     waitCursor(true);
-//             }
-//     }
-
-       /**
-        * send data request directly e.g. doesn't use a queue
-        * 
-        * @param requestTrange
-        * @param listener
-        * @param experimentTRange
-        * @param execType 
-        * @param processor
-        * @return
-        */
-       private boolean processDataRequest(TmfTimeRange requestTrange,
-                       TmfTimeRange experimentTRange, long offset, int nbRequested, boolean clearingData, ExecutionType execType) {
-               // Validate input
-               if (requestTrange == null) {
-                       TraceDebug.debug("Invalid input"); //$NON-NLS-1$
-                       return false;
-               }
-
-               // Cancel the currently executing request before starting a new one
-               fProvider.conditionallyCancelRequests();
-               fCurrentRequest = new LttngSyntEventRequest(
-                               requestTrange, offset, nbRequested,
-                               LttngConstants.DEFAULT_BLOCK_SIZE, this, experimentTRange, getEventProcessor(), 
-                               TmfExperiment.getCurrentExperiment().getName(), execType) {
-       
-                       Long fCount = getSynEventCount();
-                       ITransEventProcessor processor = getProcessor();
-                       ITmfTimestamp frunningTimeStamp;
-       
-                       /*
-                        * (non-Javadoc)
-                        * 
-                        * @see
-                        * org.eclipse.linuxtools.lttng.request.LttngSyntEventRequest#handleData
-                        * ()
-                        */
-////                   int handleDataCount = 0;
-////                   int handleDataValidCount = 0;
-//                     @Override
-//                     public void handleData() {
-//                             LttngSyntheticEvent[] result = getData();
-//     
-//                             TmfEvent evt = (result.length > 0) ? result[0] : null;
-////                           handleDataCount++;
-
-                       @Override
-                       public void handleData(LttngSyntheticEvent event) {
-                               super.handleData(event);
-                               if (event != null) {
-//                                     handleDataValidCount++;
-                                       LttngSyntheticEvent synEvent = (LttngSyntheticEvent) event;
-                                       // process event
-                                       switch (synEvent.getSynType()) {
-
-                                           case STARTREQ: {
-                                               handleRequestStarted();
-                                               break;
-                                           }
-
-                                           case BEFORE: {
-                                               processor.process(event, synEvent.getTraceModel());
-                                               fCount++;
-                                               if ((fCount != 0) && (fCount % getInputChangedRefresh() == 0)) {
-                                                   // send partial update
-                                                   modelInputChanged(this, false);
-  
-                                                   if (TraceDebug.isDEBUG()) {
-                                                       frunningTimeStamp = event.getTimestamp();
-                                                       TraceDebug.debug("handled: " + fCount + " sequence: " + synEvent.getSynType()); //$NON-NLS-1$ //$NON-NLS-2$
-                                                   }
-                                               }
-                                               break;
-                                           }
-
-                                           case AFTER:
-                                               // fall-through
-                                           case ENDREQ:{
-                                               processor.process(event, synEvent.getTraceModel());
-                                               break;
-                                           }
-
-                                           default:
-                          // nothing to do
-                          break;
-                                   }
-                               }
-                       }
-       
-                       public void handleRequestStarted() {
-                               notifyStarting();
-                       }
-
-                       @Override
-                       public void done() {
-//                             if (TraceDebug.isDEBUG()) {
-//                                     TraceDebug.debug("AbsTimeUpdateView: Received=" + handleDataCount + ", Valid=" + handleDataCount + ", fCount=" + fCount);
-//                             }
-                               super.done();
-                       }
-       
-                       @Override
-                       public void handleCompleted() {
-                               super.handleCompleted();
-
-                               // Data is not complete and should be handled as such
-                               if (isFailed() || isCancelled()) {
-                                       modelIncomplete(this);
-                               }
-
-                               if (TraceDebug.isDEBUG()) {
-                                       if (frunningTimeStamp != null) {
-                                               TraceDebug.debug("Last event time stamp: " + frunningTimeStamp.getValue()); //$NON-NLS-1$
-                                       }
-                               }
-                       }
-               };
-       
-               // send the request to TMF
-               fCurrentRequest.startRequestInd(fProvider);
-               fCurrentRequest.setclearDataInd(clearingData);
-               return true;
-       }
-
-       /**
-        * Returns an initial smaller window to allow the user to select the area of
-        * interest
-        * 
-        * @param experimentTRange
-        * @return
-        */
-       protected TmfTimeRange getInitTRange(TmfTimeRange experimentTRange) {
-               ITmfTimestamp expStartTime = experimentTRange.getStartTime();
-               ITmfTimestamp expEndTime = experimentTRange.getEndTime();
-               ITmfTimestamp initialEndOfWindow = new LttngTimestamp(expStartTime
-                               .getValue()
-                               + INITIAL_WINDOW_OFFSET);
-               if (initialEndOfWindow.compareTo(expEndTime, false) < 0) {
-                       return new TmfTimeRange(expStartTime, initialEndOfWindow);
-               }
-
-               // The original size of the experiment is smaller than proposed adjusted
-               // time
-               return experimentTRange;
-       }
-
-       /**
-        * Request the Time Analysis widget to enable or disable the wait cursor
-        * e.g. data request in progress or data request completed
-        * 
-        * @param waitInd
-        */
-       protected void waitCursor(final boolean waitInd) {
-               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-                       Display display = tsfviewer.getControl().getDisplay();
-
-                       // Perform the updates on the UI thread
-                       display.asyncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-                                               tsfviewer.waitCursor(waitInd);
-                                       }
-                               }
-                       });
-               }
-       }
-
-       /**
-        * View preparation to override the current local information
-        * 
-        * @param timeRange
-        *            - new total time range e.g. Experiment level
-        * @param clearAllData
-        */
-       protected void modelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) {
-               ItemContainer<?> itemContainer = getItemContainer();
-               if (clearAllData) {
-                       // start fresh e.g. new experiment selected
-                       itemContainer.clearItems();
-               } else {
-                       // clear children but keep processes
-                       itemContainer.clearChildren();
-               }
-
-               // Obtain the current resource array
-               ITmfTimeAnalysisEntry[] itemArr = itemContainer.readItems();
-
-               // clean up data and boundaries
-               displayModel(itemArr, -1, -1, false, -1, -1, null);
-
-               ParamsUpdater updater = getParamsUpdater();
-               if (updater != null) {
-                       // Start over
-                       updater.setEventsDiscarded(0);
-
-                       // Update new visible time range if available
-                       if (timeRange != null) {
-                               updater.update(timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue());
-                       }
-               }
-       }
-
-       /**
-        * Initialize the model and view before reloading items
-        * 
-        * @param boundaryRange
-        * @param visibleRange
-        * @param source
-        */
-       protected void modelUpdateInit(TmfTimeRange boundaryRange, TmfTimeRange visibleRange, Object source) {
-               // Update the view boundaries
-               if (boundaryRange != null) {
-                       ItemContainer<?> itemContainer = getItemContainer();
-                       if (itemContainer != null) {
-                               itemContainer.clearItems();
-                               // Obtain the current process array
-                               ITmfTimeAnalysisEntry[] itemArr = itemContainer.readItems();
-
-                               long startTime = boundaryRange.getStartTime().getValue();
-                               long endTime = boundaryRange.getEndTime().getValue();
-
-                               // Update the view part
-                               displayModel(itemArr, startTime, endTime, true, visibleRange.getStartTime().getValue(), visibleRange
-                                               .getEndTime().getValue(), source);
-                       }
-               }
-
-               // update the view filtering parameters
-               if (visibleRange != null) {
-                       ParamsUpdater updater = getParamsUpdater();
-                       if (updater != null) {
-                               // Start over
-                               updater.setEventsDiscarded(0);
-                               // Update new visible time range if available
-                               updater.update(visibleRange.getStartTime().getValue(), visibleRange.getEndTime().getValue());
-                       }
-               }
-       }
-
-       /**
-        * Actions taken by the view to refresh its widget(s) with the updated data
-        * model
-        * 
-        * @param request
-        * @param complete
-        *            true: yes, false: partial update
-        */
-       @SuppressWarnings("deprecation")
-       protected void modelInputChanged(ILttngSyntEventRequest request, boolean complete) {
-               long experimentStartTime = -1;
-               long experimentEndTime = -1;
-               TmfTimeRange experimentTimeRange = request.getExperimentTimeRange();
-               if (experimentTimeRange != null) {
-                       experimentStartTime = experimentTimeRange.getStartTime().getValue();
-                       experimentEndTime = experimentTimeRange.getEndTime().getValue();
-               }
-
-               // Obtain the current resource list
-               ITmfTimeAnalysisEntry[] itemArr = getItemContainer().readItems();
-
-               if (itemArr != null) {
-                       // Sort the array by pid
-                       Arrays.sort(itemArr);
-
-                       // Update the view part
-                       displayModel(itemArr, experimentStartTime, experimentEndTime, false, request.getRange().getStartTime()
-                                       .getValue(), request.getRange().getEndTime().getValue(), request.getSource());
-               }
-
-               if (complete) {
-                       // reselect to original time
-                       ParamsUpdater paramUpdater = getParamsUpdater();
-                       if ((paramUpdater != null) && (tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-                               final Long selTime = paramUpdater.getSelectedTime();
-                               if (selTime != null) {
-                                       TraceDebug.debug("View: " + getName() + "\n\t\tRestoring the selected time to: " + selTime); //$NON-NLS-1$ //$NON-NLS-2$
-                                       Display display = tsfviewer.getControl().getDisplay();
-                                       display.asyncExec(new Runnable() {
-                                               @Override
-                                               public void run() {
-                                                       if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-                                                               tsfviewer.setSelectedTime(selTime, false, this);
-                                                       }
-                                               }
-                                       });
-                               }
-
-//                             System.out.println(System.currentTimeMillis() + ": AbsTimeUpdate (" + getName() + ") completed");
-
-                               if (TraceDebug.isDEBUG()) {
-                                       int eventCount = 0;
-                                       Long count = request.getSynEventCount();
-                                       for (int pos = 0; pos < itemArr.length; pos++) {
-                                               eventCount += itemArr[pos].getTraceEvents().size();
-                                       }
-
-                                       int discarded = paramUpdater.getEventsDiscarded();
-                                       int discardedOutofOrder = paramUpdater.getEventsDiscardedWrongOrder();
-                                       int discardedOutofViewRange = paramUpdater.getEventsDiscardedOutOfViewRange();
-                                       int dicardedNotVisible = paramUpdater.getEventsDiscardedNotVisible();
-
-                                       TmfTimeRange range = request.getRange();
-                                       StringBuilder sb = new StringBuilder("View: " + getName() + ", Events handled: " + count //$NON-NLS-1$ //$NON-NLS-2$
-                                                       + ", Events loaded in view: " + eventCount + ", Number of events discarded: " + discarded //$NON-NLS-1$ //$NON-NLS-2$
-                                                       + "\n\tNumber of events discarded with start time earlier than next good time: " //$NON-NLS-1$
-                                                       + discardedOutofOrder + "\n\tDiscarded Not visible: " + dicardedNotVisible //$NON-NLS-1$
-                                                       + "\n\tDiscarded out of view Range: " + discardedOutofViewRange); //$NON-NLS-1$
-
-                                       sb.append("\n\t\tRequested Time Range: " + range.getStartTime() + "-" + range.getEndTime()); //$NON-NLS-1$ //$NON-NLS-2$
-                                       sb.append("\n\t\tExperiment Time Range: " + experimentStartTime + "-" + experimentEndTime); //$NON-NLS-1$ //$NON-NLS-2$
-                                       TraceDebug.debug(sb.toString());
-                               }
-                       }
-
-               }
-       }
-
-       // /**
-       // * Obtains the remainder fraction on unit Seconds of the entered value in
-       // * nanoseconds. e.g. input: 1241207054171080214 ns The number of seconds
-       // can
-       // * be obtain by removing the last 9 digits: 1241207054 the fractional
-       // * portion of seconds, expressed in ns is: 171080214
-       // *
-       // * @param v
-       // * @return
-       // */
-       // protected String formatNs(long v) {
-       // StringBuffer str = new StringBuffer();
-       // boolean neg = v < 0;
-       // if (neg) {
-       // v = -v;
-       // str.append('-');
-       // }
-       //
-       // String strVal = String.valueOf(v);
-       // if (v < 1000000000) {
-       // return strVal;
-       // }
-       //
-       // // Extract the last nine digits (e.g. fraction of a S expressed in ns
-       // return strVal.substring(strVal.length() - 9);
-       // }
-
-       /**
-        * The request was stopped, the data is incomplete
-        * 
-        * @param request
-        */
-       protected abstract void modelIncomplete(ILttngSyntEventRequest request);
-
-       /**
-        * Returns the Event processor instance related to a specific view
-        * 
-        * @return
-        */
-       protected abstract ITransEventProcessor getEventProcessor();
-
-       /**
-        * To be overridden by some sub-classes although may not be needed in some
-        * e.g. statistics view
-        * 
-        * @param items
-        * @param startBoundTime
-        * @param endBoundTime
-        * @param updateTimeBounds
-        *            - Time bounds updated needed e.g. if a new Experiment or trace
-        *            is selected
-        * @param startVisibleWindow
-        * @param endVisibleWindow
-        * @param source
-        */
-       protected abstract void displayModel(final ITmfTimeAnalysisEntry[] items, final long startBoundTime,
-                       final long endBoundTime, final boolean updateTimeBounds, final long startVisibleWindow,
-                       final long endVisibleWindow, final Object source);
-
-       /**
-        * To be overridden by some sub-classes although may not be needed in some
-        * e.g. statistics view
-        * 
-        * @return
-        */
-       protected abstract ParamsUpdater getParamsUpdater();
-
-       /**
-        * Returns the model's item container
-        * 
-        * @return
-        */
-       protected abstract ItemContainer<?> getItemContainer();
-
-       /**
-        * Returns LTTng Synthetic Provider ID used for current view
-        * 
-        * @return  
-        */
-       protected abstract int getProviderId();
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java
deleted file mode 100644 (file)
index 75086ff..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.common;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
-
-/**
- * 
- * Preserve the time and space width parameters applicable to a particular view
- * in order to facilitate filtering of events and request handling.
- * 
- * @author alvaro
- * 
- */
-public class ParamsUpdater {
-       // ========================================================================
-       // Data
-       // ========================================================================
-
-    private long startTime = 0;
-    private long endTime = Long.MAX_VALUE;
-    private static Long selectedTime = null;
-    private final int DEFAULT_WIDTH = 2000; // number of estimated pixels that
-                                            // can hold the time range space
-    private int width = DEFAULT_WIDTH; // width in pixels used to represent the
-                                       // time interval
-    private double pixelsPerNs = 0;
-    private int eventsDiscarded = 0;
-    private int eventsDiscardedOutOfView = 0;
-    private int eventsDiscardedNotVisible = 0;
-    private int eventsDiscardedWrongOrder = 0;
-    private TmfTimeRange trange = null;
-
-    public static final int OUT_OF_VIEWRANGE = 0;
-    public static final int NOT_VISIBLE = 1;
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-
-       /**
-        * @param event
-        * @return
-        */
-       public synchronized boolean processTimeScaleEvent(
-                       TmfTimeScaleSelectionEvent event) {
-
-               boolean updated = false;
-               if (event != null) {
-                       long time0 = event.getTime0();
-                       long time1 = event.getTime1();
-                       int dwidth = event.getWidth();
-
-                       updated = update(time0, time1, dwidth);
-
-                       // initialization only, otherwise wait for the actual selection
-                       // event to update its value. Note that the time must be different
-                       // upon selection of a new time in order to trigger an update to all
-                       if (selectedTime == null) {
-                               setSelectedTime(event.getSelectedTime());
-                       }
-
-               }
-
-               return updated;
-
-       }
-
-       /**
-        * Save the selected time
-        * @param selTime
-        */
-       public void setSelectedTime(long selTime) {
-               TraceDebug.debug("Selected time changed from: \n\t" + selectedTime //$NON-NLS-1$
-                               + " to: \n\t" + selTime); //$NON-NLS-1$
-               selectedTime = selTime;
-       }
-
-       /**
-        * May return null, if the selected time is invalid
-        * 
-        * @return
-        */
-       public Long getSelectedTime() {
-               return selectedTime;
-       }
-
-       /**
-        * Update time range but keep width as is
-        * 
-        * @param time0
-        * @param time1
-        * @return
-        */
-       public boolean update(long time0, long time1) {
-               return update(time0, time1, width);
-       }
-
-       /**
-        * Only positive attributes are expected
-        * 
-        * @param time0
-        * @param time1
-        * @param dwidth
-        * @return
-        */
-       public boolean update(long time0, long time1, int dwidth) {
-               boolean updated = false;
-
-               if (time0 == startTime && time1 == endTime && dwidth == width) {
-                       // No updated needed
-                       return updated;
-               }
-
-               // Negatives are invalid
-               time0 = time0 > 0 ? time0 : 0;
-               time1 = time1 > 0 ? time1 : 0;
-               dwidth = dwidth > 0 ? dwidth : 0;
-
-               if (time1 > time0) {
-                       // Store the new values as long as they are within range
-                       startTime = time0;
-                       endTime = time1;
-                       width = dwidth;
-
-                       pixelsPerNs = (double) width / (double) (endTime - startTime);
-
-                       TmfTimestamp fTimeStart = new LttngTimestamp(startTime);
-                       TmfTimestamp fTimeEnd = new LttngTimestamp(endTime);
-                       trange = new TmfTimeRange(fTimeStart, fTimeEnd);
-
-                       // make sure the selected time is within the new range or else set
-                       // mark it as invalid
-                       if (selectedTime != null) {
-                               setSelectedTime(selectedTime);
-                       }
-
-                       // update succeeded
-                       updated = true;
-
-                       TraceDebug.debug("Configuration updated to: StartTime: " /* */ //$NON-NLS-1$
-                                       + fTimeStart /* */
-                                       + "-" /* */ //$NON-NLS-1$
-                                       + fTimeEnd /* */
-                                       + " width: " /* */ //$NON-NLS-1$
-                                       + width + " k: " + pixelsPerNs); /* */ //$NON-NLS-1$
-               } else {
-                       TraceDebug
-                                       .debug("End time is not greater than start time, start time: " //$NON-NLS-1$
-                                                       + time0 + " end time: " + time1); //$NON-NLS-1$
-               }
-
-               return updated;
-       }
-
-       /**
-        * @return
-        */
-       public long getStartTime() {
-               return startTime;
-       }
-
-       /**
-        * @return
-        */
-       public long getEndTime() {
-               return endTime;
-       }
-
-       /**
-        * @return
-        */
-       public int getWidth() {
-               if (width == 0) {
-                       TraceDebug
-                                       .debug("Unexpected width value of 0 pixels, returning default"); //$NON-NLS-1$
-                       return DEFAULT_WIDTH;
-               }
-
-               return width;
-       }
-
-       /**
-        * Return the current constant "K" of pixels per nano second used for the
-        * widest time space widget registered in this instance.
-        * 
-        * @return
-        */
-       public double getPixelsPerNs() {
-               return pixelsPerNs;
-       }
-
-       /**
-        * Set the value of pixels per nano second as long as the value is grater
-        * positive
-        * 
-        * @return
-        */
-       public void setPixelsPerNs(double pixperNsec) {
-               if (pixperNsec > 0) {
-                       pixelsPerNs = pixperNsec;
-               }
-       }
-
-       /**
-        * @param value
-        */
-       public void setEventsDiscarded(int value) {
-               eventsDiscarded = value;
-               if (value == 0) {
-                       eventsDiscardedWrongOrder = 0;
-                       eventsDiscardedNotVisible = 0;
-                       eventsDiscardedOutOfView = 0;
-               }
-       }
-
-       /**
-        * 
-        */
-       public void incrementEventsDiscarded(int reason) {
-               if (reason == OUT_OF_VIEWRANGE) {
-                       this.eventsDiscardedOutOfView++;
-               }
-
-               if (reason == NOT_VISIBLE) {
-                       this.eventsDiscardedNotVisible++;
-               }
-
-               this.eventsDiscarded++;
-       }
-
-       /**
-        * @return
-        */
-       public int getEventsDiscarded() {
-               return eventsDiscarded;
-       }
-
-       /**
-        * increase the number of events discarder since they were not received in a
-        * later time than previous events
-        */
-       public void incrementEventsDiscardedWrongOrder() {
-               this.eventsDiscarded++;
-               this.eventsDiscardedWrongOrder++;
-       }
-
-       /**
-        * @return
-        */
-       public int getEventsDiscardedWrongOrder() {
-               return eventsDiscardedWrongOrder;
-
-       }
-
-       /**
-        * @return
-        */
-       public int getEventsDiscardedNotVisible() {
-               return eventsDiscardedNotVisible;
-
-       }
-
-       /**
-        * @return
-        */
-       public int getEventsDiscardedOutOfViewRange() {
-               return eventsDiscardedOutOfView;
-
-       }
-
-       /**
-        * @return
-        */
-       public TmfTimeRange getTrange() {
-               return trange;
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/ControlView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/ControlView.java
deleted file mode 100644 (file)
index ced59ac..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.control;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * <b><u>ControlView</u></b>
- * <p>
- * TODO: Implement me. Please.
- */
-@Deprecated
-public class ControlView extends ViewPart {
-
-    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.control"; //$NON-NLS-1$
-
-    /**
-        * 
-        */
-    public ControlView() {
-        // TODO Auto-generated constructor stub
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
-     */
-    @Override
-    public void createPartControl(Composite parent) {
-        // TODO Auto-generated method stub
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
-     */
-    @Override
-    public void setFocus() {
-        // TODO Auto-generated method stub
-
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java
deleted file mode 100644 (file)
index c12af30..0000000
+++ /dev/null
@@ -1,1161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * 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 java.util.Vector;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
-import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
-import org.eclipse.linuxtools.internal.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.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.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.TmfExperimentUpdatedSignal;
-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;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeSelectionListener;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeFilterSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * <b><u>ControlFlowView</u></b>
- */
-/**
- * @author alvaro
- * 
- */
-public class ControlFlowView extends AbsTimeUpdateView implements
-               ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener,
-               ITmfTimeFilterSelectionListener {
-
-    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.controlflow"; //$NON-NLS-1$
-    
-       // ========================================================================
-       // Table data
-       // ========================================================================
-
-    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,/* */
-       PID_COLUMN,/* */
-       TGID_COLUMN,/* */
-       PPID_COLUMN,/* */
-       CPU_COLUMN, /* */
-       BIRTH_SEC_COLUMN,/* */
-       BIRTH_NSEC_COLUMN,/* */
-       TRACE /* */
-       };
-
-       // ========================================================================
-       // Data
-       // ========================================================================
-       private TableViewer tableViewer;
-       // private int totalNumItems = 0;
-       // Actions
-       private Action doubleClickAction;
-       private Action resetScale;
-       private Action nextEvent;
-       private Action prevEvent;
-       private Action nextTrace;
-       private Action prevTrace;
-       private Action showLegend;
-       private Action filterTraces;
-       private Action zoomIn;
-       private Action zoomOut;
-       private Action zoomFilter;
-
-       private ViewProcessFilter tableFilter = null;
-       private ScrolledComposite scrollFrame = null;
-       
-       private TmfTimeRange initTimeRange = TmfTimeRange.NULL_RANGE;
-
-       // private static SimpleDateFormat stimeformat = new SimpleDateFormat(
-       // "yy/MM/dd HH:mm:ss");
-
-       // private TraceModelImplFactory fact;
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /*
-        * The content provider class is responsible for providing objects to the
-        * view. It can wrap existing objects in adapters or simply return objects
-        * as-is. These objects may be sensitive to the current input of the view,
-        * or ignore it and always show the same content (like Task List, for
-        * example).
-        */
-
-       static class ViewContentProvider implements
-       /* ILazyContentProvider, */IStructuredContentProvider {
-               private TableViewer cviewer = null;
-               private ITmfTimeAnalysisEntry[] elements = null;
-
-               public ViewContentProvider(TableViewer v) {
-                       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); //$NON-NLS-1$
-                       } else {
-                               TraceDebug.debug("New input = null"); //$NON-NLS-1$
-                       }
-               }
-
-               @Override
-               public void dispose() {
-
-               }
-
-               // Needed with the use of virtual tables in order to initialize items
-               // which were not initially visible.
-               public void updateElement(int index) {
-                       cviewer.replace(elements[index], index);
-               }
-
-               @Override
-               public Object[] getElements(Object inputElement) {
-                       return elements;
-               }
-       }
-
-       static class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
-               @Override
-               public String getColumnText(Object obj, int index) {
-                       String strRes = ""; //$NON-NLS-1$
-                       LttngTimestamp time;
-                       if (obj instanceof TimeRangeEventProcess) {
-                               TimeRangeEventProcess process = (TimeRangeEventProcess) obj;
-                               switch (index) {
-                               case 0:
-                                       strRes = process.getName();
-                                       break;
-                               case 1:
-                                       strRes = process.getBrand();
-                                       break;
-                               case 2:
-                                       strRes = process.getPid().toString();
-                                       break;
-                               case 3:
-                                       strRes = process.getTgid().toString();
-                                       break;
-                               case 4:
-                                       strRes = process.getPpid().toString();
-                                       break;
-                               case 5:
-                                       strRes = process.getCpu().toString();
-                                       break;
-                               case 6:
-                                       time = new LttngTimestamp(process.getCreationTime()
-                                                       .longValue());
-                                       strRes = time.getSeconds();
-                                       break;
-                               case 7:
-                                       time = new LttngTimestamp(process.getCreationTime()
-                                                       .longValue());
-                                       strRes = time.getNanoSeconds();
-                                       break;
-                               case 8:
-                                       strRes = process.getTraceID();
-                                       break;
-                               default:
-                                       break;
-                               }
-                       } else {
-                               return getText(obj);
-                       }
-
-                       return strRes;
-               }
-
-               @Override
-               public Image getColumnImage(Object obj, int index) {
-                       return getImage(obj);
-               }
-
-               @Override
-               public Image getImage(Object obj) {
-                       // No image needed for the time being
-                       // return PlatformUI.getWorkbench().getSharedImages().getImage(
-                       // ISharedImages.IMG_OBJ_ELEMENT);
-                       return null;
-               }
-       }
-
-       static class ViewProcessFilter extends ViewerFilter {
-
-               private Vector<ITmfTimeAnalysisEntry> filteredSet = new Vector<ITmfTimeAnalysisEntry>();
-               StructuredViewer viewer;
-
-               public ViewProcessFilter(StructuredViewer rviewer) {
-                       this.viewer = rviewer;
-               }
-
-               public void setFilter(Vector<ITmfTimeAnalysisEntry> filtered) {
-                       if (filtered != null) {
-                               this.filteredSet = filtered;
-                               viewer.refresh();
-                       }
-               }
-
-               @Override
-               public boolean select(Viewer viewer, Object parentElement,
-                               Object element) {
-                       boolean filteredIn = true;
-                       if (element instanceof ITmfTimeAnalysisEntry) {
-                               ITmfTimeAnalysisEntry process = (ITmfTimeAnalysisEntry) element;
-                               if (filteredSet.contains(process)) {
-                                       // The element is marked to be filtered out
-                                       return false;
-                               }
-                       } else {
-                               TraceDebug.debug("Unexpected type of filter element received: " //$NON-NLS-1$
-                                               + element.toString());
-                       }
-                       // Compare element versus a list of filtered out
-                       return filteredIn;
-               }
-       }
-
-       /**
-        * The constructor.
-        */
-       public ControlFlowView() {
-               super(ID);
-       }
-
-       /**
-        * This is a callback that will allow us to create the viewer and initialize
-        * it.
-        */
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.tmf.ui.views.TmfView#createPartControl(org.eclipse
-        * .swt.widgets.Composite)
-        */
-       @Override
-       public void createPartControl(Composite parent) {
-
-               scrollFrame = new ScrolledComposite(parent, SWT.V_SCROLL);
-               
-               scrollFrame.setExpandVertical(true);
-               scrollFrame.setExpandHorizontal(true);
-               scrollFrame.setAlwaysShowScrollBars(true);
-               
-               SashForm sash = new SashForm(scrollFrame, SWT.NONE);
-               scrollFrame.setContent(sash);
-
-               tableViewer = new TableViewer(sash, SWT.FULL_SELECTION | SWT.H_SCROLL);
-               tableViewer.setContentProvider(new ViewContentProvider(tableViewer));
-               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()) {
-                                       Object firstSel = null;
-                                       if (sel instanceof IStructuredSelection) {
-                                               firstSel = ((IStructuredSelection) sel).getFirstElement();
-
-                                               // Make sure the selection is visible
-                                               updateScrollOrigin();
-
-                                               if (firstSel instanceof ITmfTimeAnalysisEntry) {
-                                                       ITmfTimeAnalysisEntry trace = (ITmfTimeAnalysisEntry) firstSel;
-                                                       tsfviewer.setSelectedTrace(trace);
-                                               }
-                                       }
-                               }
-                       }
-
-                       /**
-                        * Make sure the selected item is visible
-                        */
-                       private void updateScrollOrigin() {
-                               Table table = tableViewer.getTable();
-                               if (table != null && table.getItemCount() > 0) {
-                                       TableItem item = table.getSelection()[0];
-                                       if (item == null) {
-                                               // no selected reference to go up or down
-                                               return;
-                                       }
-
-                                       Rectangle itemRect = item.getBounds();
-                                       int step = itemRect.height;
-
-                                       // calculate height of horizontal bar
-                                       int hscrolly = 0;
-                                       ScrollBar hbar = scrollFrame.getHorizontalBar();
-                                       if (hbar != null) {
-                                               hscrolly = hbar.getSize().y;
-                                       }
-
-                                       int visibleHeight = scrollFrame.getSize().y - hscrolly;
-
-                                       // the current scrollbar offset to adjust i.e. start
-                                       // of
-                                       // the visible window
-                                       Point origin = scrollFrame.getOrigin();
-                                       // end of visible window
-                                       int endy = origin.y + visibleHeight;
-
-                                       int itemStartPos = itemRect.y + table.getHeaderHeight() + table.getBorderWidth()
-                                                       + table.getParent().getBorderWidth();
-
-                                       // Item End Position
-                                       int itemEndPos = itemStartPos + step;
-
-                                       // check if need to go up
-                                       if (origin.y >= step && itemStartPos < origin.y) {
-                                               // one step up
-                                               scrollFrame.setOrigin(origin.x, origin.y - step);
-
-                                       }
-
-                                                       // check if it needs to go down
-                                       if (itemEndPos > endy) {
-                                               // one step down
-                                               scrollFrame.setOrigin(origin.x, origin.y + step);
-
-                                                       }
-                               }
-                       }
-               });
-               
-               // 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();
-                               if (table == null || table.getItemCount() < 1) {
-                                       // nothing to page
-                                       return;
-                               }
-
-                               switch (e.keyCode) {
-                               case SWT.PAGE_DOWN:
-                                       updateScrollPageDown();
-                                       break;
-                               case SWT.PAGE_UP:
-                                       updateScrollUp();
-                                       break;
-                               case SWT.HOME:
-                                       // Go to the top
-                                       scrollFrame.setOrigin(origin.x, 0);
-                                       break;
-                               case SWT.END:
-                                       // End Selected
-                                       int count = table.getItemCount();
-                                       TableItem item = table.getItem(count - 1);
-                                       int itemStartPos = item.getBounds().y;
-                                       // Get to the bottom
-                                       scrollFrame.setOrigin(origin.x, itemStartPos);
-                                       break;
-                               default:
-                                       break;
-                               }
-                       }
-
-                       @Override
-                       public void keyReleased(KeyEvent e) {
-                               // Nothing to do
-
-                       }
-
-                       /**
-                        * Scroll one page down
-                        */
-                       private void updateScrollPageDown() {
-                               // null protection before calling private method
-                               Table table = tableViewer.getTable();
-                               int step = table.getItemHeight();
-
-                               int hscrolly = 0;
-                               ScrollBar hbar = scrollFrame.getHorizontalBar();
-                               if (hbar != null) {
-                                       hscrolly = hbar.getSize().y;
-                               }
-
-                               Point origin = scrollFrame.getOrigin();
-                               int visibleHeight = scrollFrame.getSize().y - hscrolly;
-                               int endy = origin.y + visibleHeight;
-
-                               scrollFrame.setOrigin(origin.x, endy - step);
-                       }
-
-                       /**
-                        * Scroll one page up
-                        */
-                       private void updateScrollUp() {
-                               // null protection before calling private method
-                               Table table = tableViewer.getTable();
-                               int step = table.getItemHeight();
-
-                               int hscrolly = 0;
-                               ScrollBar hbar = scrollFrame.getHorizontalBar();
-                               if (hbar != null) {
-                                       hscrolly = hbar.getSize().y;
-                               }
-
-                               Point origin = scrollFrame.getOrigin();
-                               int visibleHeight = scrollFrame.getSize().y - hscrolly;
-                               int pageUpPos = origin.y - visibleHeight + step;
-                               pageUpPos = pageUpPos > 0 ? pageUpPos : 0;
-                               scrollFrame.setOrigin(origin.x, pageUpPos);
-                       }
-
-               });
-               // Describe table
-               applyTableLayout(table);
-
-               int borderWidth = table.getBorderWidth();
-
-               int itemHeight = table.getItemHeight() + getTableItemHeightAdjustement();
-               int headerHeight = table.getHeaderHeight();
-               table.getVerticalBar().setVisible(false);
-
-               tsfviewer = TmfViewerFactory.createViewer(sash, new FlowTimeRangeViewerProvider(getParamsUpdater()));
-
-               // Traces shall not be grouped to allow synchronisation
-               tsfviewer.groupTraces(false);
-               tsfviewer.setItemHeight(itemHeight);
-               tsfviewer.setBorderWidth(borderWidth);
-               tsfviewer.setHeaderHeight(headerHeight);
-               tsfviewer.setVisibleVerticalScroll(false);
-               // Names provided by the table
-               tsfviewer.setNameWidthPref(0);
-               tsfviewer.setAcceptSelectionAPIcalls(true);
-
-               // Viewer to notify selection to this class
-               // This class will synchronise selections with table.
-               tsfviewer.addWidgetSelectionListner(this);
-               tsfviewer.addFilterSelectionListner(this);
-               tsfviewer.addWidgetTimeScaleSelectionListner(this);
-
-               sash.setWeights(new int[] { 1, 1 });
-               // Create the help context id for the viewer's control
-               // TODO: Associate with help system
-               PlatformUI.getWorkbench().getHelpSystem().setHelp(
-                               tableViewer.getControl(),
-                               "org.eclipse.linuxtools.lttnng.ui.views.flow.viewer"); //$NON-NLS-1$
-
-               makeActions();
-               hookContextMenu();
-               hookDoubleClickAction();
-               contributeToActionBars();
-
-               // scrollFrame.addControlListener(new ControlAdapter() {
-               //
-               // @Override
-               // public void controlResized(ControlEvent e) {
-               // tsfviewer.resizeControls();
-               // updateScrolls(scrollFrame);
-               // }
-               // });
-
-               // set the initial view parameter values
-               // Experiment start and end time
-               // as well as time space width in pixels, used by the time analysis
-               // widget
-               // Read relevant values
-//             int timeSpaceWidth = tsfviewer.getTimeSpace();
-//             if (timeSpaceWidth < 0) {
-//                     timeSpaceWidth = -timeSpaceWidth;
-//             }
-
-               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
-               if (experiment != null) {
-                       TmfTimeRange experimentTRange = experiment.getTimeRange();
-
-                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
-                               // 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 hookContextMenu() {
-               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);
-                       }
-               });
-               Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
-               tableViewer.getControl().setMenu(menu);
-               getSite().registerContextMenu(menuMgr, tableViewer);
-       }
-
-       private void contributeToActionBars() {
-               IActionBars bars = getViewSite().getActionBars();
-               fillLocalPullDown(bars.getMenuManager());
-               fillLocalToolBar(bars.getToolBarManager());
-       }
-
-       private void fillLocalPullDown(IMenuManager manager) {
-               manager.add(new Separator());
-               manager.add(showLegend);
-               manager.add(new Separator());
-               manager.add(resetScale);
-               manager.add(nextEvent);
-               manager.add(prevEvent);
-               manager.add(nextTrace);
-               manager.add(prevTrace);
-               // manager.add(filterTraces);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(zoomFilter);
-               manager.add(new Separator());
-       }
-
-       private void fillContextMenu(IMenuManager manager) {
-               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(filterTraces);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(zoomFilter);
-               manager.add(new Separator());
-               manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-       }
-
-       private void fillLocalToolBar(IToolBarManager manager) {
-               manager.add(showLegend);
-               manager.add(new Separator());
-               manager.add(resetScale);
-               manager.add(nextEvent);
-               manager.add(prevEvent);
-               manager.add(nextTrace);
-               manager.add(prevTrace);
-               // manager.add(filterTraces);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(zoomFilter);
-               manager.add(new Separator());
-       }
-
-       private void makeActions() {
-               // resetScale
-               resetScale = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.resetStartFinishTime();
-                               }
-
-                       }
-               };
-               resetScale.setText(Messages.getString("ControlFlowView.Action.Reset")); //$NON-NLS-1$
-               resetScale.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.Reset.ToolTip")); //$NON-NLS-1$
-               resetScale.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                                               "icons/elcl16/home_nav.gif")); //$NON-NLS-1$
-
-               // nextEvent
-               nextEvent = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectNextEvent();
-                               }
-                       }
-               };
-               nextEvent.setText(Messages
-                               .getString("ControlFlowView.Action.NextEvent")); //$NON-NLS-1$
-               nextEvent.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.NextEvent.Tooltip")); //$NON-NLS-1$
-               nextEvent.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                                               "icons/elcl16/next_event.gif")); //$NON-NLS-1$
-
-               // prevEvent
-               prevEvent = new Action() {
-               @Override
-               public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectPrevEvent();
-                               }
-                       }
-               };
-               prevEvent.setText(Messages
-                               .getString("ControlFlowView.Action.PrevEvent")); //$NON-NLS-1$
-               prevEvent.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.PrevEvent.Tooltip")); //$NON-NLS-1$
-               prevEvent.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                                               "icons/elcl16/prev_event.gif")); //$NON-NLS-1$
-
-               // nextTrace
-               nextTrace = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectNextTrace();
-                               }
-                       }
-               };
-               nextTrace.setText(Messages
-                               .getString("ControlFlowView.Action.NextProcess")); //$NON-NLS-1$
-               nextTrace.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.NextProcess.ToolTip")); //$NON-NLS-1$
-               nextTrace.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                                               "icons/elcl16/next_item.gif")); //$NON-NLS-1$
-
-               // prevTrace
-               prevTrace = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectPrevTrace();
-                               }
-                       }
-               };
-               prevTrace.setText(Messages
-                               .getString("ControlFlowView.Action.PreviousProcess")); //$NON-NLS-1$
-               prevTrace.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.PreviousProcess.Tooltip")); //$NON-NLS-1$
-               prevTrace.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                                               "icons/elcl16/prev_item.gif")); //$NON-NLS-1$
-
-               // showLegend
-               showLegend = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.showLegend();
-                               }
-                       }
-               };
-               showLegend.setText(Messages.getString("ControlFlowView.Action.Legend")); //$NON-NLS-1$
-               showLegend.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.Legend.ToolTip")); //$NON-NLS-1$
-
-               // filterTraces
-               filterTraces = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.filterTraces();
-                               }
-                       }
-               };
-               filterTraces.setText(Messages
-                               .getString("ControlFlowView.Action.Filter")); //$NON-NLS-1$
-               filterTraces.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.Filter.ToolTip")); //$NON-NLS-1$
-               filterTraces.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                                               "icons/elcl16/filter_items.gif")); //$NON-NLS-1$
-
-               // zoomIn
-               zoomIn = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.zoomIn();
-                               }
-                       }
-               };
-               zoomIn.setText(Messages.getString("ControlFlowView.Action.ZoomIn")); //$NON-NLS-1$
-               zoomIn.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.ZoomIn.Tooltip")); //$NON-NLS-1$
-               zoomIn.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
-                               Messages.getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                               "icons/elcl16/zoomin_nav.gif")); //$NON-NLS-1$
-
-               // zoomOut
-               zoomOut = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.zoomOut();
-                               }
-                       }
-               };
-               zoomOut.setText(Messages.getString("ControlFlowView.Action.ZoomOut")); //$NON-NLS-1$
-               zoomOut.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.ZoomOut.tooltip")); //$NON-NLS-1$
-               zoomOut.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
-                               Messages.getString("ControlFlowView.tmf.UI"), //$NON-NLS-1$
-                               "icons/elcl16/zoomout_nav.gif")); //$NON-NLS-1$
-
-               // zoomFilter
-               zoomFilter = new Action() {
-                       @Override
-                       public void run() {
-                               // Nothing to do, however the selection status is needed by the
-                               // application
-                       }
-               };
-               zoomFilter.setText(Messages
-                               .getString("ControlFlowView.Action.ZoomFilter")); //$NON-NLS-1$
-               zoomFilter.setToolTipText(Messages
-                               .getString("ControlFlowView.Action.ZoomFilter.tooltip")); //$NON-NLS-1$
-               zoomFilter.setImageDescriptor(AbstractUIPlugin
-                               .imageDescriptorFromPlugin(Messages
-                                               .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);
-
-               doubleClickAction = new Action() {
-                       @Override
-                       public void run() {
-                               ISelection selection = tableViewer.getSelection();
-                               Object obj = ((IStructuredSelection) selection)
-                                               .getFirstElement();
-                               showMessage("Double-click detected on " + obj.toString()); //$NON-NLS-1$
-                       }
-               };
-       }
-
-       private void hookDoubleClickAction() {
-               tableViewer.addDoubleClickListener(new IDoubleClickListener() {
-                       @Override
-                       public void doubleClick(DoubleClickEvent event) {
-                               doubleClickAction.run();
-                       }
-               });
-       }
-
-       private void showMessage(String message) {
-               MessageDialog.openInformation(tableViewer.getControl().getShell(),
-                               Messages.getString("ControlFlowView.msgSlogan"), message); //$NON-NLS-1$
-       }
-
-       /**
-        * Passing the focus request to the viewer's control.
-        */
-       @Override
-       public void setFocus() {
-               tableViewer.getControl().setFocus();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * tsfTmProcessSelEvent
-        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent
-        * )
-        */
-       @Override
-       public void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) {
-               // common implementation
-               super.tsfTmProcessSelEvent(event);
-
-               // Reselect the table viewer to widget selection
-               ISelection sel = tsfviewer.getSelectionTrace();
-               if (sel != null && !sel.isEmpty()) {
-                       tableViewer.setSelection(sel);
-               }
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
-        * ITmfTimeScaleSelectionListener
-        * #tsfTmProcessTimeScaleEvent(org.eclipse.linuxtools
-        * .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent)
-        */
-       @Override
-       public void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
-               super.tsfTmProcessTimeScaleEvent(event);
-       }
-
-       private void applyTableLayout(Table table) {
-               for (int i = 0; i < columnNames.length; i++) {
-                       TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
-                       tableColumn.setText(columnNames[i]);
-                       tableColumn.pack();
-               }
-               table.setHeaderVisible(true);
-               table.setLinesVisible(true);
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel
-        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry[], long, long, boolean, long, long,
-        * java.lang.Object)
-        */
-       @Override
-       public void displayModel(final ITmfTimeAnalysisEntry[] items,
-                       final long startBoundTime, final long endBoundTime,
-                       final boolean updateTimeBounds, final long startVisibleWindow,
-                       final long endVisibleWindow, final Object source) {
-               
-               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() {
-                                       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);
-                                }
-                            }
-                        });
-                                       }
-                               }
-                       });
-               }
-       }
-
-       @Override
-       public void dispose() {
-               // dispose parent resources
-               super.dispose();
-
-               tsfviewer.removeFilterSelectionListner(this);
-               tsfviewer.removeWidgetSelectionListner(this);
-               tsfviewer.removeWidgetTimeScaleSelectionListner(this);
-               tableViewer = null;
-               tsfviewer = null;
-       }
-
-       /**
-        * @param tableComposite
-        * @param table
-        */
-       private synchronized void resizeTableColumns(Table table) {
-               if (table != null) {
-                       TableColumn[] columns = table.getColumns();
-                       for (TableColumn column : columns) {
-                               column.pack();
-                       }
-               }
-       }
-
-       @Override
-       public void tmfTaProcessFilterSelection(TmfTimeFilterSelectionEvent event) {
-               if (tableFilter != null) {
-                       Vector<ITmfTimeAnalysisEntry> filteredout = event.getFilteredOut();
-                       if (filteredout != null) {
-                               tableFilter.setFilter(filteredout);
-                       } else {
-                               tableFilter.setFilter(new Vector<ITmfTimeAnalysisEntry>());
-                       }
-                       tableViewer.refresh();
-               }
-       }
-
-       /**
-        * @param scrollFrame
-        * @param wrapper
-        */
-       private void updateScrolls(final ScrolledComposite scrollFrame) {
-               scrollFrame.setMinSize(tableViewer.getTable().computeSize(SWT.DEFAULT, SWT.DEFAULT));
-       }
-
-       /**
-        * Registers as listener of time selection from other views
-        * 
-        * @param signal
-        */
-       @Override
-       @TmfSignalHandler
-       public void synchToTime(TmfTimeSynchSignal signal) {
-               super.synchToTime(signal);
-       }
-
-       /**
-        * Annotation Registers as listener of time range selection from other views
-        * The implementation handles the entry of the signal.
-        * 
-        * @param signal
-        */
-       @TmfSignalHandler
-       public void synchToTimeRange(TmfRangeSynchSignal signal) {
-               if (zoomFilter != null) {
-                       synchToTimeRange(signal, zoomFilter.isChecked());
-               }
-       }
-
-       @Override
-       public void modelIncomplete(ILttngSyntEventRequest request) {
-               // Nothing to do
-               // The data will be refreshed on the next request
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getEventProcessor()
-        */
-       @Override
-       public ITransEventProcessor getEventProcessor() {
-               return FlowEventToHandlerFactory.getInstance();
-       }
-
-       /**
-        * @param signal
-        */
-       @TmfSignalHandler
-       public void experimentSelected(
-                       TmfExperimentSelectedSignal<? extends TmfEvent> signal) {
-               if (signal != null) {
-                       TmfTimeRange experimentTRange = signal.getExperiment()
-                                       .getTimeRange();
-
-                       initTimeRange = TmfTimeRange.NULL_RANGE;
-                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
-                               // 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_RANGE && signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
-                       TmfTimeRange experimentTRange = signal.getRange();
-
-                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
-                               // prepare time intervals in widget
-                               modelUpdateInit(experimentTRange, experimentTRange, signal.getSource());
-
-                               // request initial data
-                               initialExperimentDataRequest(signal.getSource(), experimentTRange);
-                       }
-               }
-       }
-
-    @TmfSignalHandler
-    public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
-        if (signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
-            final TmfTimeRange range = signal.getExperiment().getTimeRange();
-            if (range != TmfTimeRange.NULL_RANGE) {
-                Display.getDefault().asyncExec(new Runnable() {
-                    @Override
-                    public void run() {
-                        tsfviewer.setTimeBounds(range.getStartTime().getValue(), range.getEndTime().getValue());
-                    }});
-            }
-        }
-    }
-
-       /**
-        * @param source
-        * @param experimentTRange
-        * @return Adjusted time window used for the request (smaller window to
-        *         initialize view)
-        */
-       private TmfTimeRange initialExperimentDataRequest(Object source,
-                       TmfTimeRange experimentTRange) {
-               // Adjust the initial time window to a shorter interval to allow
-               // user to select the interesting area based on the perspective
-               TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
-
-               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;
-       }
-       
-       /*
-        * 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 ajustement;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getParamsUpdater()
-        */
-       @Override
-       protected ParamsUpdater getParamsUpdater() {
-               return FlowModelFactory.getParamsUpdater();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getItemContainer()
-        */
-       @Override
-       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; 
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/Messages.java
deleted file mode 100644 (file)
index a7c8bc9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.controlflow;\r
-\r
-import java.util.MissingResourceException;\r
-import java.util.ResourceBundle;\r
-\r
-public class Messages {\r
-       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.controlflow.messages"; //$NON-NLS-1$\r
-\r
-       private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle\r
-                       .getBundle(BUNDLE_NAME);\r
-\r
-       private Messages() {\r
-       }\r
-\r
-       public static String getString(String key) {\r
-               try {\r
-                       return RESOURCE_BUNDLE.getString(key);\r
-               } catch (MissingResourceException e) {\r
-                       return '!' + key + '!';\r
-               }\r
-       }\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java
deleted file mode 100644 (file)
index f488a2b..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * 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.controlflow.evProcessor;
-
-import java.util.Vector;
-
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ProcessStatus;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent.Type;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
-import org.eclipse.linuxtools.lttng.ui.views.common.AbsTRangeUpdate;
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
-import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowModelFactory;
-import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowProcessContainer;
-
-public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILttngEventProcessor {
-
-       // ========================================================================
-       // Data
-       // =======================================================================
-
-       protected FlowProcessContainer procContainer = FlowModelFactory.getProcContainer();
-       protected ParamsUpdater params = FlowModelFactory.getParamsUpdater();
-       protected static final Long ANY_CPU = 0L;
-
-
-       // ========================================================================
-       // Methods
-       // =======================================================================
-       protected TimeRangeEventProcess addLocalProcess(LttngProcessState stateProcess, long traceStartTime, long traceEndTime, String traceId) {
-               // TimeRangeEventProcess localProcess = new TimeRangeEventProcess(id, name, startTime, stopTime, groupName, className)
-               TimeRangeEventProcess localProcess = new TimeRangeEventProcess(
-                               procContainer.getUniqueId(), stateProcess.getName(),
-                               traceStartTime, traceEndTime, "", stateProcess.getType() //$NON-NLS-1$
-                                               .getInName(), stateProcess.getCpu(), stateProcess
-                                               .getInsertion_time());
-               
-               
-               localProcess.setCreationTime(stateProcess.getCreation_time());
-               localProcess.setPid(stateProcess.getPid());
-               localProcess.setTgid(stateProcess.getTgid());
-               localProcess.setPpid(stateProcess.getPpid());
-               localProcess.setName(stateProcess.getName());
-               localProcess.setBrand(stateProcess.getBrand());
-               localProcess.setTraceID(traceId);
-               localProcess.setProcessType(stateProcess.getType().getInName());
-               procContainer.addItem(localProcess);
-
-               if (TraceDebug.isCFV()) {
-                       TraceDebug.traceCFV("addLocalProcess():" + localProcess); //$NON-NLS-1$
-               }
-
-               return localProcess;
-       }
-       
-       /**
-        * Used to check if the event is visible within the current visible time
-        * window
-        * 
-        * @return
-        */
-       protected boolean withinViewRange(long stime, long etime) {
-               long windowStartTime = params.getStartTime();
-               long windowEndTime = params.getEndTime();
-
-               // start time is within window
-               if (stime >= windowStartTime && stime <= windowEndTime) {
-                       // The event or part of it shall be displayed.
-                       return true;
-               }
-
-               // end time is within window
-               if (etime >= windowStartTime && etime <= windowEndTime) {
-                       // The event or part of it shall be displayed.
-                       return true;
-               }
-
-               // check that a portion is within the window
-               if (stime < windowStartTime && etime > windowEndTime) {
-                       // The time range is bigger than the selected time window and
-                       // crosses it
-                       return true;
-               }
-
-               return false;
-       }
-
-       /**
-        * @param traceSt
-        * @param startTime
-        * @param endTime
-        * @param localProcess
-        * @param params
-        * @param stateMode
-        * @return
-        */
-       @SuppressWarnings("deprecation")
-       protected boolean makeDraw(LttngTraceState traceSt, long startTime,
-                       long endTime, TimeRangeEventProcess localProcess,
-                       ParamsUpdater params, String stateMode) {
-
-               if (TraceDebug.isCFV()) {
-                       TraceDebug.traceCFV("makeDraw():[" + localProcess + //$NON-NLS-1$ 
-                                       ",candidate=[stime=" + startTime +  //$NON-NLS-1$
-                                       ",etime=" + endTime +  //$NON-NLS-1$
-                                       ",state=" + stateMode + "]]"); //$NON-NLS-1$ //$NON-NLS-2$
-               }
-
-               // Determine start and end times to establish duration
-               Long stime = startTime;
-               Long etime = endTime;
-
-               if (!withinViewRange(stime, etime)) {
-                       // No use to process the event since it's outside
-                       // the visible time range of the window
-                       params.incrementEventsDiscarded(ParamsUpdater.OUT_OF_VIEWRANGE);
-                       return false;
-               }
-
-               if (etime < stime) {
-                       // Validate the sequential order of events
-                       params.incrementEventsDiscardedWrongOrder();
-                       return false;
-               }
-
-               // Store the next good time to start drawing the next event
-               // this is done this early to display an accurate start time of the
-               // first event
-               // within the display window
-               // ****** moved at the end since it produces gaps among the coloured rectangles
-               // localProcess.setNext_good_time(etime);
-
-               // If First event of a process, initialise start time half page before to enable pagination to the left
-               if (stime < params.getStartTime()) {
-                       // event start time is before the visible time window
-                       long insertion = localProcess.getInsertionTime();
-                       if (stime.longValue() == insertion) {
-                               // if start time is equal to insertion this is the first event to be drawn for this process
-                               long halfPage = (params.getEndTime() - params.getStartTime()) / 2;
-                               long initTime = params.getStartTime() - halfPage;
-                               if (initTime > insertion) {
-                                       // start time of this event is unknown, place it half page before visible window to allow left side
-                                       // pagination when selecting previous event
-                                       stime = initTime;
-                               }
-                       }
-               }
-
-               // Determine if the time range event will fit it the current
-               // pixel map
-               double duration = etime - stime;
-               double k = getPixelsPerNs(traceSt, params);
-               double pixels = duration * k;
-
-               // Visibility check
-               // Display a "more information" indication by allowing non visible event
-               // as long as its previous event is visible.
-               boolean visible = true;
-               if (pixels < 1.0) {
-                       boolean prevEventVisibility = true;
-                       // Get the visibility indication on previous event for
-                       // this process
-                       Vector<TimeRangeComponent> inMemEvents = localProcess
-                                       .getTraceEvents();
-                       if (inMemEvents.size() != 0) {
-                               TimeRangeComponent prevEvent = inMemEvents.get(inMemEvents
-                                               .size() - 1);
-                               prevEventVisibility = prevEvent.isVisible();
-
-                               // if previous event visibility is false and the time span
-                               // between events less than two pixels, there is no need to
-                               // load it in memory i.e. not visible and a more indicator is
-                               // within two pixels.
-                               // return i.e. event discarded to free up memory
-                               Long eventSpan = stime - prevEvent.getStartTime();
-                               if (prevEventVisibility == false
-                                               && ((double) eventSpan * k) < 2.0) {
-
-                                       // discard the item
-                                       params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
-                                       return false;
-
-                               }
-                       }
-
-                       // if previous event is visible, set this one to not
-                       // visible and continue
-                       visible = false;
-               }
-
-               // Create the time-range event
-               TimeRangeEvent time_window = new TimeRangeEvent(stime, etime,
-                               localProcess, Type.PROCESS_MODE, stateMode);
-
-               time_window.setVisible(visible);
-               localProcess.getTraceEvents().add(time_window);
-               localProcess.setNext_good_time(etime);
-
-               return false;
-       }
-
-       /**
-        * @param traceSt
-        * @param evTime
-        * @param process
-        * @param localProcess
-        * @param params
-        * @return
-        */
-       protected boolean makeDraw(LttngTraceState traceSt, long evTime,
-                       LttngProcessState process, TimeRangeEventProcess localProcess,
-                       ParamsUpdater params) {
-
-               // TmfTimestamp stime = process.getState().getChange_LttTime();
-               long stime = localProcess.getNext_good_time();
-
-               String stateMode;
-               ProcessStatus procStatus = process.getState().getProc_status();
-               // Use Execution mode if process state is RUN otherwise use the actual
-               // process state,
-               // this selection will determine the actual color selected for the event
-               if (procStatus == ProcessStatus.LTTV_STATE_RUN) {
-                       stateMode = process.getState().getExec_mode().getInName();
-               } else {
-                       stateMode = procStatus.getInName();
-               }
-
-               return makeDraw(traceSt, stime, evTime, localProcess, params, stateMode);
-
-       }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java
deleted file mode 100644 (file)
index 3a7c5c2..0000000
+++ /dev/null
@@ -1,387 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *   Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Fields;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-
-/**
- * Creates instances of specific after state update handlers, per corresponding
- * event.
- * 
- * @author alvaro
- * 
- */
-class FlowAfterUpdateHandlers {
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SCHED_SCHEDULE
-        * </p>
-        * Replace C function "after_schedchange_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getSchedChangeHandler() {
-               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                               
-                               // get event time, cpu, trace_number, process, pid
-                               LttngProcessState process_in = traceSt.getRunning_process().get(trcEvent.getCpuId());
-                               
-                               // pid_out is never used, even in LTTv!
-                               //Long pid_out = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_PREV_PID);
-                               Long pid_in = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_NEXT_PID);
-                               
-                               if ( !(pid_in.equals(process_in.getPid())) ) {
-                                   TraceDebug.debug("pid_in != PID!  (getSchedChangeHandler)"); //$NON-NLS-1$
-                }
-                               
-                               //hashed_process_data = processlist_get_process_data(process_list,pid_out,process->cpu,&birth,trace_num);
-                               TimeRangeEventProcess localProcess = procContainer.findProcess(pid_in, process_in.getCpu(), traceSt
-                                               .getTraceId(), process_in.getCreation_time());
-                               
-                               if (localProcess == null) {
-                                       if ((pid_in == 0) || !pid_in.equals(process_in.getPpid())) {
-                                           TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                           addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
-                                       }
-                                       else {
-                                               TraceDebug
-                                                               .debug("pid_in is not 0 or pid_in == PPID!  (getSchedChangeHandler)"); //$NON-NLS-1$
-                                       }
-                               }
-
-                               // There is no drawing done by the C code below, only refreshing
-                               // the references to the current hash data to make it ready for
-                               // next event
-
-                               // This current implementation does not support the use of
-                               // current hashed data
-                               // although an equivalent would be good in order to improve the
-                               // time to find the currently running process per cpu.
-                               /*
-                               if(ltt_time_compare(hashed_process_data_in->next_good_time, evtime) <= 0)
-                               {
-                                   TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab);
-                                 
-                                       #ifdef EXTRA_CHECK
-                                   if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1)
-                                      return FALSE;
-                                       #endif //EXTRA_CHECK
-                               
-                                   Drawing_t *drawing = control_flow_data->drawing;
-                                   guint width = drawing->width;
-                                   guint new_x;
-                                     
-                                   convert_time_to_pixels(time_window,evtime,width,&new_x);
-                                       
-                                   if(hashed_process_data_in->x.middle != new_x) {
-                                       hashed_process_data_in->x.middle = new_x;
-                                       hashed_process_data_in->x.middle_used = FALSE;
-                                       hashed_process_data_in->x.middle_marked = FALSE;
-                                   }
-                               }*/
-                               
-                               return false;
-
-                       }
-               };
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_PROCESS_FORK
-        * </p>
-        * Replace C function "after_process_fork_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_CHILD_PID
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getProcessForkHandler() {
-           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {  
-                           
-                Long child_pid = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_CHILD_PID);
-                LttngProcessState process_child = lttv_state_find_process(traceSt, trcEvent.getCpuId(), child_pid );
-                           
-                           if (process_child != null) {
-                               TimeRangeEventProcess localProcess = procContainer.findProcess(process_child.getPid(), process_child.getCpu(), traceSt.getTraceId(), process_child.getCreation_time() );
-                               
-                               if (localProcess == null) {
-                                   if (child_pid == 0 || !child_pid.equals(process_child.getPpid())) {            
-                                       TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                            addLocalProcess(process_child, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
-                                   }
-                                   else {
-                                       TraceDebug.debug("localProcess is null with child_pid not 0 or child_pid equals PPID (getProcessForkHandler)"); //$NON-NLS-1$
-                                   }
-                                       } else {
-                                               // If we found the process, the Ppid and the Tgid might
-                                               // be missing, let's add them
-                                               localProcess.setPpid(process_child.getPpid());
-                                               localProcess.setTgid(process_child.getTgid());
-                               }
-                           }
-                           else {
-                               TraceDebug.debug("process_child is null! (getProcessForkHandler)"); //$NON-NLS-1$
-                           }
-                     
-                               return false;
-                       }
-               };
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_PROCESS_EXIT
-        * </p>
-        * Replace C function "after_process_exit_hook" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getProcessExitHandler() {
-           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                           
-                           LttngProcessState process = traceSt.getRunning_process().get(trcEvent.getCpuId());
-
-                           if (process != null) {
-                               
-                                       // *** TODO: ***
-                                       // We shall look into a way to find the current process
-                                       // faster, see the c library
-                                       // (current_hash) in order to speed up the find. see c-code
-                               //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
-                           //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
-                           //   }
-                               TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(), process.getCpu(), traceSt.getTraceId(),  process.getCreation_time());
-                               
-                               if (localProcess == null) {
-                                   if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) {                                 
-                                       TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                                   addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
-                                   }
-                                   else {
-                                       TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExitHandler)"); //$NON-NLS-1$
-                                   }
-                                       }
-                           }
-                           else {
-                               TraceDebug.debug("process is null! (getProcessExitHandler)"); //$NON-NLS-1$
-                           }                       
-                           
-                               return false;
-                       }
-               };
-               return handler;
-       }
-
-       
-       /**
-        * <p>
-        * Handles: LTT_EVENT_EXEC
-        * </p>
-        * Replace C function "after_fs_exec_hook" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getProcessExecHandler() {
-           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                           
-                           LttngProcessState process = traceSt.getRunning_process().get(trcEvent.getCpuId());
-
-                if (process != null) {
-                    
-                    TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(),  process.getCpu(), traceSt.getTraceId(), process.getCreation_time());
-                    
-                    if (localProcess == null) {
-                        if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) {
-                            TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                            addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
-                        }
-                        else {
-                            TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExecHandler)"); //$NON-NLS-1$
-                        }
-                    }
-                    else {
-                        // If we found the process, the name might be missing. Let's add it here.
-                        localProcess.setName(process.getName());
-                    }
-                }
-                else {
-                    TraceDebug.debug("process is null! (getProcessExecHandler)"); //$NON-NLS-1$
-                }
-                
-                               return false;
-                       }
-               };
-               return handler;
-       }
-       
-       /**
-        * <p>
-        * LTT_EVENT_THREAD_BRAND
-        * </p>
-        * Replace C function "after_user_generic_thread_brand_hook" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor GetThreadBrandHandler() {
-           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                           
-                           LttngProcessState process = traceSt.getRunning_process().get(trcEvent.getCpuId());
-
-                if (process != null) {
-                    
-                                       // Similar to above comments, implement a faster way to find
-                                       // the local process
-                    //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
-                    //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
-                    //   }
-                    TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(), process.getCpu(), traceSt.getTraceId(), process.getCreation_time());
-                    
-                    if (localProcess == null) {
-                        if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) {                         
-                            TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                            addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
-                        }
-                        else {
-                            TraceDebug.debug("process pid is not 0 or pid equals ppid! (GetThreadBrandHandler)"); //$NON-NLS-1$
-                        }
-                    }
-                    else {
-                                               // If we found the process, the brand might be missing
-                                               // on it, add it.
-                        localProcess.setBrand(process.getBrand());
-                    }
-                }
-                else {
-                    TraceDebug.debug("process is null! (GetThreadBrandHandler)"); //$NON-NLS-1$
-                }
-                
-                return false;
-                           
-                       }
-               };
-               return handler;
-       }
-
-       /**
-        * <p>
-        * LTT_EVENT_PROCESS_STATE
-        * </p>
-        * Replace C function "after_event_enum_process_hook" in eventhooks.c
-        * <p>
-        * <p>
-        * Creates the processlist entry for the child process. Put the last
-        * position in x at the current time value.
-        * </p>
-        * 
-        * <p>
-        * Fields: LTT_FIELD_PID
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getEnumProcessStateHandler() {
-           AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                           
-                               int first_cpu;
-                               int nb_cpus;
-                           
-                               Long pid_in = getAFieldLong(trcEvent, traceSt,
-                                               Fields.LTT_FIELD_PID);
-                           
-                           if ( pid_in != null  ) {
-                           if(pid_in == 0L) {
-                                               first_cpu = 0;
-                                               nb_cpus = traceSt.getNumberOfCPUs();
-                           } 
-                           else {
-                                               first_cpu = ANY_CPU.intValue();
-                                               nb_cpus = ANY_CPU.intValue() + 1;
-                           }
-                           
-                                       for (int cpu = first_cpu; cpu < nb_cpus; cpu++) {
-                                               LttngProcessState process_in = lttv_state_find_process(traceSt, Long.valueOf(cpu), pid_in);
-                               
-                               if ( process_in != null ) {
-                                   TimeRangeEventProcess localProcess = procContainer.findProcess(process_in.getPid(), process_in.getCpu(), traceSt.getTraceId(), process_in.getCreation_time());
-                           
-                                   if (localProcess == null) {
-                                           if (process_in.getPid() == 0 || !process_in.getPid().equals(process_in.getPpid())) {
-                                    TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                                    localProcess = addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
-                                }
-                                else {
-                                    TraceDebug.debug("process pid is not 0 or pid equals ppid! (getEnumProcessStateHandler)"); //$NON-NLS-1$
-                                    return false;
-                                }
-                                   }
-
-                                                       // If the process was found, it might be missing
-                                                       // informations, add it here
-                                                       localProcess.setName(process_in.getName());
-                                                       localProcess.setPpid(process_in.getPpid());
-                                                       localProcess.setTgid(process_in.getTgid());
-                               }
-                               else {
-                                   TraceDebug.debug("process_in is null! This should never happen. (getEnumProcessStateHandler)"); //$NON-NLS-1$
-                               }
-                           }
-                           }
-                           else {
-                               TraceDebug.debug("pid_in is null! This should never happen, really... (getEnumProcessStateHandler)"); //$NON-NLS-1$
-                           }
-                           
-                               return false;
-                       }
-               };
-               return handler;
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowBeforeUpdateHandlers.java
deleted file mode 100644 (file)
index 249cd76..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *   Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Fields;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-
-/**
- * Creates instances of specific before state update handlers, per corresponding
- * event.
- * 
- * @author alvaro
- * 
- */
-class FlowBeforeUpdateHandlers {
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SYSCALL_ENTRY
-        * </p>
-        * Replace C function named "before_execmode_hook" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getStateModesHandler() {
-               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               Long cpu = trcEvent.getCpuId();
-                               LttngProcessState stateProcess = traceSt.getRunning_process()
-                                               .get(cpu);
-                               // TraceDebug.debug("Before handler called");
-                               String traceId = traceSt.getTraceId();
-
-                               if (stateProcess != null) {
-                                       // Find process within the list of registered time-range
-                                       // related
-                                       // processes
-
-                                       // key process attributes to look for it or store it
-                                       // are: pid, birth, trace_num, note: cpu not relevant since
-                                       // it
-                                       // may change
-                                       TimeRangeEventProcess localProcess = procContainer
-                                                       .findProcess(stateProcess.getPid(), stateProcess.getCpu(), traceId, stateProcess
-                                    .getCreation_time());
-
-                                       // Add process to process list if not present
-                                       if (localProcess == null) {
-                                               TmfTimeRange timeRange = traceSt.getContext()
-                                                               .getTraceTimeWindow();
-                                               localProcess = addLocalProcess(stateProcess, timeRange
-                                                               .getStartTime().getValue(), timeRange
-                                                               .getEndTime().getValue(), traceId);
-                                       }
-
-                                       // Do the actual drawing
-                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
-                                                       stateProcess, localProcess, params);
-                               } else {
-                                       TraceDebug
-                                                       .debug("Running state process is null! (getStateModesHandler)"); //$NON-NLS-1$
-                               }
-
-                               return false;
-                       }
-               };
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SCHED_SCHEDULE
-        * </p>
-        * Replace C function named "before_schedchange_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE (?)
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getBeforeSchedChangeHandler() {
-               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               Long pid_out = getAFieldLong(trcEvent, traceSt,
-                                               Fields.LTT_FIELD_PREV_PID);
-                               Long pid_in = getAFieldLong(trcEvent, traceSt,
-                                               Fields.LTT_FIELD_NEXT_PID);
-
-                               // This is useless even in Lttv !!
-                               // Long state_out = getAFieldLong(trcEvent, traceSt,
-                               // Fields.LTT_FIELD_PREV_STATE);
-
-                               // We need to process information.
-                               LttngProcessState process = traceSt.getRunning_process().get(
-                                               trcEvent.getCpuId());
-
-                               if (process != null) {
-                                       if (process.getPid().equals(pid_out) == false) {
-                                               // To replace :
-                                               // process = lttv_state_find_process(ts,tfs->cpu,
-                                               // pid_out);
-                                               process = lttv_state_find_process(traceSt, trcEvent
-                                                               .getCpuId(), pid_out);
-                                               // Also, removed :
-                                               // guint trace_num = ts->parent.index;
-                                       }
-
-                                       if (process != null) {
-                                               // TODO: Implement something similar to current hash in
-                                               // order to keep track of the current process and speed
-                                               // up finding the local resource.
-
-                                               // HashedProcessData *hashed_process_data = NULL;
-                                               // hashed_process_data =
-                                               // processlist_get_process_data(process_list,pid_out,process->cpu,&birth,trace_num);
-                                               TimeRangeEventProcess localProcess = procContainer
-                                                               .findProcess(process.getPid(), process.getCpu(), traceSt
-                                                                               .getTraceId(), process.getCreation_time());
-
-                                               // Add process to process list if not present
-                                               // Replace C Call :
-                                               // processlist_add(process_list,drawing,pid_out,process->tgid,process->cpu,process->ppid,&birth,trace_num,process->name,process->brand,&pl_height,&process_info,&hashed_process_data);
-                                               if (localProcess == null) {
-                                                       TmfTimeRange timeRange = traceSt.getContext()
-                                                                       .getTraceTimeWindow();
-                                                       localProcess = addLocalProcess(process, timeRange
-                                                                       .getStartTime().getValue(), timeRange
-                                                                       .getEndTime().getValue(), traceSt
-                                                                       .getTraceId());
-                                               }
-
-                                               // Do the actual drawing
-                                               makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
-                                                               process,
-                                                               localProcess, params);
-                                       } else {
-                                               // Process may be null if the process started BEFORE the
-                                               // trace start
-                                               // TraceDebug.debug("Process is null for pid_out! (getBeforeSchedChangeHandler)");
-                                       }
-
-                                       // PID_IN section
-                                       process = lttv_state_find_process(traceSt, trcEvent
-                                                       .getCpuId(), pid_in);
-
-                                       if (process != null) {
-                                               // HashedProcessData *hashed_process_data = NULL;
-                                               // hashed_process_data =
-                                               // processlist_get_process_data(process_list, pid_in,
-                                               // tfs->cpu, &birth, trace_num);
-                                               TimeRangeEventProcess localProcess = procContainer
-                                                               .findProcess(process.getPid(), process.getCpu(), traceSt
-                                                                               .getTraceId(), process.getCreation_time());
-
-                                               // Add process to process list if not present
-                                               // Replace C Call :
-                                               // processlist_add(process_list, drawing, pid_in,
-                                               // process->tgid, tfs->cpu, process->ppid, &birth,
-                                               // trace_num, process->name, process->brand, &pl_height,
-                                               // &process_info, &hashed_process_data);
-                                               if (localProcess == null) {
-                                                       TmfTimeRange timeRange = traceSt.getContext()
-                                                                       .getTraceTimeWindow();
-                                                       localProcess = addLocalProcess(process, timeRange
-                                                                       .getStartTime().getValue(), timeRange
-                                                                       .getEndTime().getValue(), traceSt
-                                                                       .getTraceId());
-                                               }
-
-                                               // Do the actual drawing
-                                               makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
-                                                               process,
-                                                               localProcess, params);
-
-                                       } else {
-                                               // Process can be null if it started AFTER the trace
-                                               // end. Do nothing...
-                                               // TraceDebug.debug("No process found for pid_in! Something is wrong? (getBeforeSchedChangeHandler)");
-                                       }
-                               } else {
-                                       TraceDebug
-                                                       .debug("Running process is null! (getBeforeSchedChangeHandler)"); //$NON-NLS-1$
-                               }
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_PROCESS_EXIT
-        * </p>
-        * Replace C function named "before_process_exit_hook" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getProcessExitHandler() {
-               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               // We need to process information.
-                               LttngProcessState process = traceSt.getRunning_process().get(
-                                               trcEvent.getCpuId());
-
-                               if (process != null) {
-                                       // TODO: Implement a similar method to track the current
-                                       // local process in order to speed up finding the local
-                                       // resource
-
-                                       // hashed_process_data =
-                                       // processlist_get_process_data(process_list, pid,
-                                       // process->cpu, &birth,trace_num);
-                                       TimeRangeEventProcess localProcess = procContainer
-                                                       .findProcess(process.getPid(), process.getCpu(), traceSt
-                                                                       .getTraceId(), process.getCreation_time());
-
-                                       // Add process to process list if not present
-                                       // Replace C Call :
-                                       // processlist_add(process_list, drawing, pid,
-                                       // process->tgid, process->cpu, process->ppid, &birth,
-                                       // trace_num, process->name, process->brand,&pl_height,
-                                       // &process_info, &hashed_process_data);
-                                       if (localProcess == null) {
-                                               TmfTimeRange timeRange = traceSt.getContext()
-                                                               .getTraceTimeWindow();
-                                               localProcess = addLocalProcess(process, timeRange
-                                                               .getStartTime().getValue(), timeRange
-                                                               .getEndTime().getValue(), traceSt.getTraceId());
-                                       }
-
-                                       // Call the function that does the actual drawing
-                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
-                                                       process, localProcess, params);
-
-                               } else {
-                                       TraceDebug
-                                                       .debug("Running process is null! (getProcessExitHandler)"); //$NON-NLS-1$
-                               }
-
-                               return false;
-                       }
-               };
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_PROCESS_FREE
-        * </p>
-        * Replace C function named "before_process_release_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_PID
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getProcessFreeHandler() {
-               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                               // PID of the process to release
-                               Long release_pid = getAFieldLong(trcEvent, traceSt,
-                                               Fields.LTT_FIELD_PID);
-
-                               if ((release_pid != null)) {
-                                       LttngProcessState process = lttv_state_find_process(
-                                                       traceSt, ANY_CPU, release_pid);
-                                       if (process != null) {
-
-                                               // Replace the C call :
-                                               // hashed_process_data =
-                                               // processlist_get_process_data(process_list,pid,process->cpu,&birth,trace_num);
-                                               TimeRangeEventProcess localProcess = procContainer
-                                                               .findProcess(process.getPid(), process.getCpu(), traceSt
-                                                                               .getTraceId(), process
-                                        .getCreation_time());
-
-                                               // This is as it was in the C ... ?
-                                               if (localProcess == null) {
-                                                       return false;
-                                               }
-
-                                               // Perform the drawing
-                                               makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
-                                                               process,
-                                                               localProcess, params);
-                                       }
-                               } else {
-                                       TraceDebug
-                                                       .debug("Release_pid is null! (getProcessFreeHandler)"); //$NON-NLS-1$
-                               }
-
-                               return false;
-                       }
-               };
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_STATEDUMP_END
-        * </p>
-        * Replace C function named "before_statedump_end" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getStateDumpEndHandler() {
-               AbsFlowTRangeUpdate handler = new AbsFlowTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               // What's below should replace the following call in C :
-                               // ClosureData closure_data;
-                               // closure_data.events_request = events_request;
-                               // closure_data.tss = tss;
-                               // closure_data.end_time = evtime;
-                               // convert_time_to_pixels(time_window,evtime,width,&closure_data.x_end);
-                               // g_hash_table_foreach(process_list->process_hash,
-                               // draw_closure,(void*)&closure_data);
-                               //
-                               // And the draw is always the same then...
-
-                               // The c-library loops through the local processes, search for
-                               // the local processes in the state provider and then draws
-                               // If it's present is the local processes why shuldn't they be
-                               // present in the state provider?
-                               // This seems more direct. and makes sure all processes are
-                               // reflected in the control flow view.
-                               LttngProcessState[] processes = traceSt.getProcesses();
-                               for (int pos=0; pos < processes.length; pos++) {
-                                       LttngProcessState process = processes[pos];
-                                       
-                                       // Replace the C call :
-                                       // hashed_process_data =
-                                       // processlist_get_process_data(process_list,pid,process->cpu,&birth,trace_num);
-                                       TimeRangeEventProcess localProcess = procContainer
-                                                       .findProcess(process.getPid(), process.getCpu(), traceSt
-                                                                       .getTraceId(), process
-                                    .getCreation_time());
-
-                                       // Add process to process list if not present
-                                       if (localProcess == null) {
-                                               TmfTimeRange timeRange = traceSt.getContext()
-                                                               .getTraceTimeWindow();
-                                               localProcess = addLocalProcess(process, timeRange
-                                                               .getStartTime().getValue(), timeRange
-                                                               .getEndTime().getValue(), traceSt.getTraceId());
-                                       }
-
-                                       // Call the function that will does the actual
-                                       // drawing
-                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
-                                                       process, localProcess, params);
-                               }
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowEventToHandlerFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowEventToHandlerFactory.java
deleted file mode 100644 (file)
index 06eecf9..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-
-/**
- * Builds a Map from string event name to a processing handler object, the
- * processors implement the same interface to facilitate transparent methods
- * call,
- * 
- * The map key STring is the entry point of the raw events, using a hash speeds
- * up the resolution of the appropriate processor
- * 
- * @author alvaro
- * 
- */
-public class FlowEventToHandlerFactory extends AbsEventToHandlerResolver {
-       // ========================================================================
-       // Data
-       // =======================================================================
-       private final Map<String, ILttngEventProcessor> eventNametoBeforeProcessor = new HashMap<String, ILttngEventProcessor>();
-       private final Map<String, ILttngEventProcessor> eventNametoAfterProcessor = new HashMap<String, ILttngEventProcessor>();
-       private ILttngEventProcessor finishProcesor = null;
-       private static FlowEventToHandlerFactory instance = null;
-       private FlowBeforeUpdateHandlers instantiateBeforeHandler = new FlowBeforeUpdateHandlers();
-       private FlowAfterUpdateHandlers instantiateAfterHandler = new FlowAfterUpdateHandlers();
-
-       // ========================================================================
-       // Constructors
-       // =======================================================================
-       private FlowEventToHandlerFactory() {
-               super();
-               // Create one instance of each individual event handler and add the
-               // instance to the map
-
-               // BEFORE HOOKS
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SYSCALL_ENTRY.getInName(),
-                               instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SYSCALL_EXIT.getInName(),
-                               instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_ENTRY
-                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_EXIT
-                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_ENTRY.getInName(),
-                               instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_EXIT.getInName(),
-                               instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
-                                               .getInName(), instantiateBeforeHandler
-                                               .getStateModesHandler());
-
-               eventNametoBeforeProcessor
-                               .put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
-                                               .getInName(), instantiateBeforeHandler
-                                               .getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_ENTRY
-                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_EXIT
-                               .getInName(), instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_ENTRY.getInName(),
-                               instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_EXIT.getInName(),
-                               instantiateBeforeHandler.getStateModesHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
-                               instantiateBeforeHandler.getBeforeSchedChangeHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PROCESS_EXIT.getInName(),
-                               instantiateBeforeHandler.getProcessExitHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PROCESS_FREE.getInName(),
-                               instantiateBeforeHandler.getProcessFreeHandler());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_STATEDUMP_END.getInName(),
-                               instantiateBeforeHandler.getStateDumpEndHandler());
-
-
-               // AFTER HOOKS
-               eventNametoAfterProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
-                               instantiateAfterHandler.getSchedChangeHandler());
-
-               eventNametoAfterProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PROCESS_FORK.getInName(),
-                               instantiateAfterHandler.getProcessForkHandler());
-
-               eventNametoAfterProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PROCESS_EXIT.getInName(),
-                               instantiateAfterHandler.getProcessExitHandler());
-
-               eventNametoAfterProcessor.put(StateStrings.Events.LTT_EVENT_EXEC
-                               .getInName(), instantiateAfterHandler.getProcessExecHandler());
-
-               eventNametoAfterProcessor.put(
-                               StateStrings.Events.LTT_EVENT_THREAD_BRAND.getInName(),
-                               instantiateAfterHandler.GetThreadBrandHandler());
-
-               eventNametoAfterProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PROCESS_STATE.getInName(),
-                               instantiateAfterHandler.getEnumProcessStateHandler());
-
-               finishProcesor = new FlowFinishUpdateHandler();
-       }
-
-       // ========================================================================
-       // Public methods
-       // =======================================================================
-       /**
-        * The event processors are common to all traces an multiple instances will
-        * use more memory unnecessarily
-        * 
-        * @return
-        */
-       public static AbsEventToHandlerResolver getInstance() {
-               if (instance == null) {
-                       instance = new FlowEventToHandlerFactory();
-               }
-               return instance;
-       }
-
-       @Override
-       public ILttngEventProcessor getAfterProcessor(String eventType) {
-               return eventNametoAfterProcessor.get(eventType);
-       }
-
-       @Override
-       public ILttngEventProcessor getBeforeProcessor(String eventType) {
-               return eventNametoBeforeProcessor.get(eventType);
-       }
-
-       @Override
-       public ILttngEventProcessor getfinishProcessor() {
-               return finishProcesor;
-       }
-
-       @Override
-       public ILttngEventProcessor getStateUpdaterProcessor(String eventType) {
-               return null;
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowFinishUpdateHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowFinishUpdateHandler.java
deleted file mode 100644 (file)
index baf2fcf..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * 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.controlflow.evProcessor;
-
-import java.util.Vector;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
-
-/**
- * Creates specific finish state data request
- * 
- * @author alvaro
- * 
- */
-public class FlowFinishUpdateHandler extends AbsFlowTRangeUpdate
-               implements ILttngEventProcessor {
-
-       public Events getEventHandleType() {
-               // No specific event
-               return null;
-       }
-
-       @SuppressWarnings("deprecation")
-       @Override
-       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-               // The end of the last state is unknown since it's beyond the requested time range window. Create this last
-               // event to half page after the visible window but not beyond the end of trace
-               long endOfTrace = traceSt.getContext().getTraceTimeWindow().getEndTime().getValue();
-               long halfWindow = (params.getEndTime() - params.getStartTime()) / 2;
-
-               // End of event common to all processes within the trace for this specific request
-               long endOfEvent = params.getEndTime() + halfWindow;
-               if (endOfEvent > endOfTrace) {
-                       endOfEvent = endOfTrace;
-               }
-
-               TraceDebug.debug("Number of localProcesses: " + procContainer.readItems().length); //$NON-NLS-1$
-               // to identify the process relevant to the traceState
-               String traceId = traceSt.getTraceId();
-               int numLocalFound = 0;
-               int numLocalNotFound = 0;
-               int numWithNoChildren = 0;
-               for (TimeRangeEventProcess localProcess : procContainer.readItems()) {
-                       LttngProcessState stateProcess = lttv_state_find_process(traceSt,
-                                       localProcess.getCpu(), localProcess.getPid());
-
-                       // Drawing the last state for processes related to the current trace
-                       // id.
-                       if (!localProcess.getTraceID().equals(traceId)) {
-                               continue;
-                       }
-
-                       // Check if the process is in the state provider, it is the case
-                       // when the requested time frame did not include any events for a
-                       // process
-                       if (stateProcess == null) {
-                               // Get Start time from the end time of previous event
-                               Vector<TimeRangeComponent> childrenEvents = localProcess
-                                               .getTraceEvents();
-                               long nextGoodTime;
-                               String stateMode;
-                               if (childrenEvents.size() > 0) {
-                                       TimeRangeComponent prevEvent = childrenEvents
-                                                       .get(childrenEvents.size() - 1);
-                                       if (prevEvent instanceof TimeRangeEvent) {
-                                               TimeRangeEvent prevTimeRange = (TimeRangeEvent) prevEvent;
-                                               // calculate the next good time to draw the event
-                                               // nextGoodTime = prevTimeRange.getStopTime() + 1;
-                                               nextGoodTime = localProcess.getNext_good_time();
-                                               stateMode = prevTimeRange.getStateMode();
-
-                                               // Draw with the Local information since the current
-                                               // request did
-                                               // not contain events related to this process
-                                               makeDraw(traceSt, nextGoodTime, endOfEvent, localProcess, params, stateMode);
-                                       } else {
-                                               TraceDebug.debug("previous event not instance of TimeRangeEvent?: " //$NON-NLS-1$
-                                                               + prevEvent.getClass().getSimpleName());
-                                       }
-                               } else {
-                                       numWithNoChildren++;
-                               }
-
-                               numLocalNotFound++;
-                               continue;
-                       }
-
-                       numLocalFound++;
-                       // Draw the last state for this process
-                       makeDraw(traceSt, endOfEvent, stateProcess, localProcess, params);
-               }
-
-               TraceDebug.debug("Print Last Event: NumLocalFound " + numLocalFound      //$NON-NLS-1$
-                               + "; NumLocalNotFound: " + numLocalNotFound //$NON-NLS-1$
-                               + "; NumWithNoChildren: " + numWithNoChildren); //$NON-NLS-1$
-
-               return false;
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/messages.properties
deleted file mode 100644 (file)
index 9c42384..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-ControlFlowView.Action.Filter=Filter\r
-ControlFlowView.Action.Filter.ToolTip=Process Filter options\r
-ControlFlowView.Action.Legend=Legend\r
-ControlFlowView.Action.Legend.ToolTip=Show Legend\r
-ControlFlowView.Action.LoadData=LoadData\r
-ControlFlowView.Action.LoadData.ToolTip=Load data from external plug-in\r
-ControlFlowView.Action.NextEvent=NextEv\r
-ControlFlowView.Action.NextEvent.Tooltip=Next Event\r
-ControlFlowView.Action.NextProcess=NextProcess\r
-ControlFlowView.Action.NextProcess.ToolTip=Select Next Process\r
-ControlFlowView.Action.PrevEvent=PrevEv\r
-ControlFlowView.Action.PrevEvent.Tooltip=Previous Event\r
-ControlFlowView.Action.PreviousProcess=PreviousProcess\r
-ControlFlowView.Action.PreviousProcess.Tooltip=Select Previous Process\r
-ControlFlowView.Action.Reset=Reset\r
-ControlFlowView.Action.Reset.ToolTip=Reset the Time Scale to Default\r
-ControlFlowView.Action.Synchronize=Synchronize\r
-ControlFlowView.Action.Synchronize.ToolTip=Synchronize by listening to external API selection calls\r
-ControlFlowView.Action.ZoomIn=Zoom In\r
-ControlFlowView.Action.ZoomIn.Tooltip=Zoom In\r
-ControlFlowView.Action.ZoomOut=Zoom Out\r
-ControlFlowView.Action.ZoomOut.tooltip=Zoom Out\r
-ControlFlowView.Action.ZoomFilter=Zoom Filter\r
-ControlFlowView.Action.ZoomFilter.tooltip=Display elements with events within the zoomed time window\r
-ControlFlowView.birthNSecColumn=Birth nsec\r
-ControlFlowView.birthSecColumn=Birth sec\r
-ControlFlowView.brandColumn=Brand\r
-ControlFlowView.cpuColumn=CPU\r
-ControlFlowView.msgSlogan=Control Flow View\r
-ControlFlowView.pidColumn=PID\r
-ControlFlowView.ppidColumn=PPID\r
-ControlFlowView.processColumn=Process\r
-ControlFlowView.tgidColumn=TGID\r
-ControlFlowView.tmf.UI=org.eclipse.linuxtools.tmf.ui\r
-ControlFlowView.TraceNameColumn=TRACE\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowModelFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowModelFactory.java
deleted file mode 100644 (file)
index 7b350a9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.controlflow.model;
-
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
-
-/**
- * Instantiates the entry point classes to build the data model for this view
- * 
- * @author alvaro
- * 
- */
-public class FlowModelFactory {
-       // ========================================================================
-       // Data
-       // ========================================================================
-       private static FlowProcessContainer procContainer = null;
-       private static ParamsUpdater updater = null;
-       
-       
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /**
-        * Get Process data container
-        * @return
-        */
-       public static FlowProcessContainer getProcContainer() {
-               if (procContainer == null) {
-                       procContainer = new FlowProcessContainer();
-               }
-               return procContainer;
-       }
-       
-       public static ParamsUpdater getParamsUpdater() {
-               if (updater == null) {
-                       updater = new ParamsUpdater();
-               }
-               return updater;
-       }
-       
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java
deleted file mode 100644 (file)
index 036e536..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.controlflow.model;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.linuxtools.internal.lttng.core.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
-
-/**
- * Contains the processes in use by the Control flow view
- * 
- * @author alvaro
- * 
- */
-public class FlowProcessContainer implements ItemContainer<TimeRangeEventProcess> {
-       // ========================================================================
-       // Data
-       // ========================================================================
-       private final HashMap<ProcessKey, TimeRangeEventProcess> allProcesses = new HashMap<ProcessKey, TimeRangeEventProcess>();
-       private static Integer uniqueId = 0;
-       
-       // ========================================================================
-       // Constructor
-       // ========================================================================
-
-       /**
-        * Package level constructor
-        */
-       FlowProcessContainer() {
-
-       }
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /**
-        * Interface to add a new process.<p>
-        * 
-        * Note : Process with the same key will be overwritten, it's calling function job to make sure the new process is unique.
-        * 
-        * @param newProcess   The process to add
-        */
-       @Override
-       public void addItem(TimeRangeEventProcess newItem) {
-               if (newItem != null) {
-                       allProcesses.put(new ProcessKey(newItem), newItem);
-               }
-       }
-       
-       /**
-     * Request a unique ID
-     * 
-     * @return Integer
-     */
-    @Override
-       public Integer getUniqueId() {
-        return uniqueId++;
-    }
-    
-    /**
-     * This method is intended for read only purposes in order to keep the
-     * internal data structure in synch
-     * 
-     * @return TimeRangeEventProcess[]
-     */
-       @Override
-       public TimeRangeEventProcess[] readItems() {
-               
-           // This allow us to return an Array of the correct type of the exact correct dimension, without looping
-               return allProcesses.values().toArray(new TimeRangeEventProcess[allProcesses.size()]);
-       }
-       
-       /**
-        * Clear the children information for processes e.g. just before refreshing
-        * data with a new time range
-        */
-       @Override
-       public void clearChildren() {
-           TimeRangeEventProcess process = null;
-        Iterator<ProcessKey> iterator = allProcesses.keySet().iterator();
-        
-        while (iterator.hasNext()) {
-            process = allProcesses.get(iterator.next());
-                       process.reset();
-        }
-       }
-       
-       /**
-     * Clear all process items
-     */
-    @Override
-       public void clearItems() {
-        allProcesses.clear();
-    }
-       
-    /**
-     * Remove the process related to a specific trace e.g. during trace
-     * removal
-     * 
-     * @param traceId   The trace unique id (trace name?) on which we want to remove process
-     */
-       @Override
-       public void removeItems(String traceId) {
-           ProcessKey iterKey = null;
-
-        Iterator<ProcessKey> iterator = allProcesses.keySet().iterator();
-        while (iterator.hasNext()) {
-            iterKey = iterator.next();
-            
-            if (allProcesses.get(iterKey).getTraceID().equals(traceId)) {
-                allProcesses.remove(iterKey);
-            }
-        }
-       }
-       
-    /**
-     * Search by keys (pid, cpuId, traceId and creationTime)<p>
-     * 
-     * A match is returned if the four arguments received match an entry
-     *  Otherwise null is returned
-     *  
-     * @param searchedPid       The processId (Pid) we are looking for
-     * @param searchedCpuId     The cpu Id we are looking for
-     * @param searchedTraceID   The traceId (trace name?) we are looking for
-     * @param searchedCreationtime The creation time we are looking for
-     * 
-     * @return TimeRangeEventProcess
-     */
-    public TimeRangeEventProcess findProcess(Long searchedPid, Long searchedCpuId, String searchedTraceID, Long searchedCreationtime) {
-       // Get the TimeRangeEventProcess associated to a key we create here
-        TimeRangeEventProcess foundProcess = allProcesses.get( new ProcessKey(searchedPid, searchedCpuId, searchedTraceID, searchedCreationtime) );
-        
-        return foundProcess;
-    }
-}
-
-
-class ProcessKey {
-    private TimeRangeEventProcess valueRef = null;
-    
-    private Long    pid = null;
-    private Long    cpuId = null;
-    private String  traceId = null;
-    private Long    creationtime = null;
-    
-    @SuppressWarnings("unused")
-    private ProcessKey() { }
-    
-    public ProcessKey(TimeRangeEventProcess newRef) {
-        valueRef = newRef;
-    }
-    
-    public ProcessKey(Long newPid, Long newCpuId, String newTraceId, Long newCreationTime) {
-        pid = newPid;
-        cpuId = newCpuId;
-        traceId = newTraceId;
-        creationtime = newCreationTime;
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-        if (obj == null)
-            return false;
-
-        boolean isSame = false;
-        
-        if ( obj instanceof ProcessKey ) {
-               ProcessKey procKey = (ProcessKey) obj;
-               
-                       if (valueRef != null) {
-                               if ((procKey.getPid().equals(valueRef.getPid()))
-                                               && (procKey.getTraceId().equals(valueRef.getTraceID()))
-                                               && (procKey.getCreationtime().equals(valueRef.getCreationTime()))) {
-                                       // use the cpu value to validate pid 0
-                                       if (valueRef.getPid().longValue() == 0L && !procKey.getCpuId().equals(valueRef.getCpu())) {
-                                               isSame = false;
-                                       } else {
-                                               isSame = true;
-                                       }
-                               }
-                       } else {
-                               if ((procKey.getPid().equals(this.pid)) && (procKey.getTraceId().equals(this.traceId))
-                                               && (procKey.getCreationtime().equals(this.creationtime))) {
-                                       // use the cpu value to validate pid 0
-                                       if (this.pid.longValue() == 0L && !procKey.getCpuId().equals(this.cpuId)) {
-                                               isSame = false;
-                                       } else {
-                                               isSame = true;
-                                       }
-                               }
-                       }
-        }
-        else {
-               TraceDebug.debug("ERROR : The given key is not of the type ProcessKey!" + obj.getClass().toString()); //$NON-NLS-1$
-        }
-        
-        return isSame;
-    }
-    
-    // *** WARNING : Everything in there work because the check "valueRef != null" is the same for ALL getter
-    // Do NOT change this check without checking.
-    public Long getPid() {
-       if ( valueRef != null ) {
-            return valueRef.getPid();
-        }
-        else {
-            return pid;
-        }
-    }
-
-    public Long getCpuId() {
-        if ( valueRef != null ) {
-            return valueRef.getCpu();
-        }
-        else {
-            return cpuId;
-        }
-    }
-    
-    public String getTraceId() {
-        if ( valueRef != null ) {
-            return valueRef.getTraceID();
-        }
-        else {
-            return traceId;
-        }
-    }
-    
-    public Long getCreationtime() {
-        if ( valueRef != null ) {
-            return valueRef.getCreationTime();
-        }
-        else {
-            return creationtime;
-        }
-    }
-    
-    @Override
-    public int hashCode() {
-       return this.toString().hashCode();
-    }
-    
-    
-       @Override
-    @SuppressWarnings("nls")
-    public String toString() {
-        if ( valueRef != null ) {
-                       // return (valueRef.getPid().toString() + ":" +
-                       // valueRef.getCpu().toString() + ":"
-                       // + valueRef.getTraceID().toString() + ":" +
-                       // valueRef.getCreationTime().toString());
-                       return (valueRef.getPid().toString() + ":" + valueRef.getTraceID().toString() + ":" + valueRef
-                                       .getCreationTime().toString());
-        } 
-        
-               // return (pid.toString() + ":" + cpuId.toString() + ":" +
-               // traceId.toString() + ":" + creationtime.toString());
-
-               return (pid.toString() + ":" + traceId.toString() + ":" + creationtime.toString());
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowTimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowTimeRangeViewerProvider.java
deleted file mode 100644 (file)
index 2b07df1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Matthew Khouzam - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.controlflow.model;
-
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeViewerProvider;
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
-
-public class FlowTimeRangeViewerProvider extends TimeRangeViewerProvider {
-
-       public FlowTimeRangeViewerProvider(ParamsUpdater paramsUpdater) {
-               super(paramsUpdater);
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider
-        * #getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
-        * TmfTimeAnalysisProvider.StateColor)
-        */
-       @Override
-       public String getStateName(StateColor color) {
-               // Override to multiple instances of the widget, the same color can have
-               // multiple meanings
-               boolean isInProcess = procStateToColor.containsValue(color);
-               
-               if (isInProcess) {
-                       return findObject(color, procStateToColor);
-               }
-               return super.getStateName(color);
-       }
-
-       
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/DistributionData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/DistributionData.java
deleted file mode 100644 (file)
index 360958a..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.distribution.model;
-
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.Config;
-import org.eclipse.linuxtools.tmf.ui.views.distribution.model.BaseDistributionData;
-
-/**
- * <b><u>DistributionData</u></b>
- * <p>
- * The algorithm is based on the algorithm for the Histogram. The difference is that
- * it supports two dimensions. For more details about the model principle 
- * @see org.eclipse.linuxtools.lttng.ui.views.histogram.HistogramDataModel 
- * <p>
- */
-abstract public class DistributionData extends BaseDistributionData {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /**
-     * Flag to indicate if given timestamp is the first one to count 
-     */
-    protected boolean fIsFirst;
-    
-    /**
-     *  reference to fBuckets
-     */
-    protected final int [][] fBuckets;
-    
-    /**
-     * Time limit (current available longest time)
-     */
-    protected long fTimeLimit;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    public DistributionData(int[][] buckets) {
-        this(Config.DEFAULT_NUMBER_OF_BUCKETS, buckets);
-    }
-
-    public DistributionData(int nbBuckets, int[][] buckets) {
-        super(nbBuckets);
-        fBuckets = buckets;
-        clear();
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-   
-    public long getTimeLimit() {
-        return fTimeLimit;
-    }
-    
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.BaseDistributionData#clear()
-     */
-    @Override
-    public void clear() {
-        super.clear();
-        fIsFirst = true;
-        updateEndTime();
-    }
-
-    public boolean isFirst() {
-        return fIsFirst;
-    }
-
-    public int countEvent(long timestamp) {
-
-        // Set the start/end time if not already done
-        if (fIsFirst) {
-            fIsFirst = false;
-            fFirstBucketTime = timestamp;
-            fFirstEventTime = timestamp;
-
-            updateEndTime();
-        }
-
-        // save first event time if necessary 
-        if (timestamp < fFirstEventTime) {
-            fFirstEventTime = timestamp;
-        }
-
-        // save last event time if necessary
-        if (fLastEventTime < timestamp) {
-            fLastEventTime = timestamp;
-        }
-
-        
-        if (timestamp >= fFirstBucketTime) {
-            // Compact as needed
-            while (timestamp >= fTimeLimit) {
-                mergeBuckets();
-            }
-
-        } else {
-
-            // Get offset for buckets adjustment
-            int offset = getOffset(timestamp);
-
-            // Compact as needed
-            while (fLastBucket + offset >= fNbBuckets) {
-                mergeBuckets();
-                offset = getOffset(timestamp);
-            }
-
-            // Move buckets with offset (to right)
-            moveBuckets(offset);
-
-            // Adjust start/end time and index 
-            fLastBucket = fLastBucket + offset;
-            fFirstBucketTime = fFirstBucketTime - offset * fBucketDuration;
-            updateEndTime();
-        }
-
-        // Increment the right bucket
-        int index = (int) ((timestamp - fFirstBucketTime) / fBucketDuration);
-
-        if (fLastBucket < index) {
-            fLastBucket = index;
-        }
-
-        return index;
-    }
-
-    // ------------------------------------------------------------------------
-    // Abstract 
-    // ------------------------------------------------------------------------
-    
-    /**
-     * Moves content of buckets with the given offset in positive direction. 
-     * It has to be implemented accordingly in the relevant sub-classes for 
-     * horizontal and vertical direction.  
-     * 
-     * @param buckets - 2-dimensional array of buckets 
-     * @param offset - offset to move
-     */
-    abstract protected void moveBuckets(int offset);
-    
-    /**
-     * Merges buckets if end time is exceeded. It has to be implemented 
-     * accordingly in the relevant sub-classes for horizontal and 
-     * vertical direction.
-     * @param buckets
-     */
-    abstract protected void mergeBuckets();
-
-    // ------------------------------------------------------------------------
-    // Helper Functions
-    // ------------------------------------------------------------------------
-    protected int getOffset(long timestamp) {
-        int offset = (int) ((fFirstBucketTime - timestamp) / fBucketDuration);
-        if ((fFirstBucketTime - timestamp) % fBucketDuration != 0) {
-            offset++;
-        }
-        return offset;
-    }
-    
-    protected void updateEndTime() {
-        fTimeLimit = fFirstBucketTime + fNbBuckets * fBucketDuration;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/HorDistributionData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/HorDistributionData.java
deleted file mode 100644 (file)
index 766384f..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.distribution.model;
-
-/**
- * <b><u>HorDistributionData</u></b>
- * <p>
- * Implementation of DistributionData for horizontal direction.
- */
-public class HorDistributionData extends DistributionData {
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    public HorDistributionData(int nbBuckets, int[][] buckets) {
-        super(nbBuckets, buckets);
-    }
-
-    // ------------------------------------------------------------------------
-    // Abstract function implementation
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#moveBuckets(int)
-     */
-    @Override
-    protected void moveBuckets(int offset) {
-        for (int j = 0; j < fNbBuckets; j++) {
-
-            for(int i = fNbBuckets - 1; i >= offset; i--) {
-                fBuckets[i][j] = fBuckets[i-offset][j]; 
-            }
-
-            for (int i = 0; i < offset; i++) {
-                fBuckets[i][j] = 0;
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#mergeBuckets()
-     */
-    @Override
-    protected void mergeBuckets() {
-
-        for (int y = 0; y < fNbBuckets; y++) {
-            for (int i = 0; i < fNbBuckets / 2; i++) {
-                fBuckets[i][y] = fBuckets[2 * i][y] + fBuckets[2 * i + 1][y];
-            }
-
-            for (int i = fNbBuckets / 2; i < fNbBuckets; i++) {
-                fBuckets[i][y] = 0;
-            }
-        }
-        fBucketDuration = fBucketDuration * 2;
-        updateEndTime();
-        fLastBucket = fNbBuckets / 2 - 1;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/VerDistributionData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/distribution/model/VerDistributionData.java
deleted file mode 100644 (file)
index e44398c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.distribution.model;
-
-/**
- * <b><u>VerDistributionData</u></b>
- * 
- * Implementation of DistributionData for vertical direction. 
- * <p>
- */
-public class VerDistributionData extends DistributionData {
-    
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-    public VerDistributionData(int nbBuckets, int[][] buckets) {
-        super(nbBuckets, buckets);
-    }
-
-    // ------------------------------------------------------------------------
-    // Abstract function implementation
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#moveBuckets(int)
-     */
-    @Override
-    protected void moveBuckets(int offset) {
-        for (int j = 0; j < fNbBuckets; j++) {
-
-            for(int i = fNbBuckets - 1; i >= offset; i--) {
-                fBuckets[j][i] = fBuckets[j][i-offset]; 
-            }
-
-            for (int i = 0; i < offset; i++) {
-                fBuckets[j][i] = 0;
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData#mergeBuckets()
-     */
-    @Override
-    protected void mergeBuckets() {
-        for (int x = 0; x < fNbBuckets; x++) {
-            for (int i = 0; i < fNbBuckets / 2; i++) {
-                fBuckets[x][i] = fBuckets[x][2 * i] + fBuckets[x][2 * i + 1];
-            }
-            for (int i = fNbBuckets / 2; i < fNbBuckets; i++) {
-                fBuckets[x][i] = 0;
-            }
-        }
-        fBucketDuration = fBucketDuration * 2;
-        updateEndTime();
-        fLastBucket = fNbBuckets / 2 - 1;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsTable.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsTable.java
deleted file mode 100644 (file)
index 48b088a..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009, 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Francois Chouinard - Initial API and implementation\r
- *   Francois Chouinard - Aligned columns with domain terminology\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.lttng.ui.views.events;\r
-\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfEventField;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;\r
-import org.eclipse.linuxtools.tmf.ui.widgets.ColumnData;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-public class EventsTable extends TmfEventsTable {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Table data\r
-    // ------------------------------------------------------------------------\r
-\r
-    // Table column names\r
-    static private final String TIMESTAMP_COLUMN = Messages.EventsTable_timestampColumn;\r
-    static private final String TRACE_COLUMN = Messages.EventsTable_traceColumn;\r
-    static private final String MARKER_COLUMN = Messages.EventsTable_markerColumn;\r
-    static private final String CONTENT_COLUMN = Messages.EventsTable_contentColumn;\r
-    static private final String[] COLUMN_NAMES = new String[] {\r
-            TIMESTAMP_COLUMN,\r
-            TRACE_COLUMN,\r
-            MARKER_COLUMN,\r
-            CONTENT_COLUMN\r
-    };\r
-\r
-    static private final ColumnData[] COLUMN_DATA = new ColumnData[] {\r
-            new ColumnData(COLUMN_NAMES[0], 150, SWT.LEFT),\r
-            new ColumnData(COLUMN_NAMES[1], 120, SWT.LEFT),\r
-            new ColumnData(COLUMN_NAMES[2], 200, SWT.LEFT),\r
-            new ColumnData(COLUMN_NAMES[3], 100, SWT.LEFT)\r
-    };\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructor\r
-    // ------------------------------------------------------------------------\r
-\r
-    public EventsTable(Composite parent, int cacheSize) {\r
-        super(parent, cacheSize, COLUMN_DATA);\r
-        fTable.getColumns()[0].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP);\r
-        fTable.getColumns()[1].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_REFERENCE);\r
-        fTable.getColumns()[2].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TYPE);\r
-        fTable.getColumns()[3].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_CONTENT);\r
-    }\r
-\r
-    /**\r
-     * @param event\r
-     * @return\r
-     */\r
-    @Override\r
-    protected ITmfEventField[] extractItemFields(TmfEvent event) {\r
-        ITmfEventField[] fields = new TmfEventField[0];\r
-        if (event != null) {\r
-            fields = new TmfEventField[] {\r
-                     new TmfEventField(ITmfEvent.EVENT_FIELD_TIMESTAMP, ((Long) event.getTimestamp().getValue()).toString()),\r
-                     new TmfEventField(ITmfEvent.EVENT_FIELD_REFERENCE, event.getReference()),\r
-                     new TmfEventField(ITmfEvent.EVENT_FIELD_TYPE, event.getType().getName()),\r
-                     new TmfEventField(ITmfEvent.EVENT_FIELD_CONTENT, event.getContent().toString())\r
-                    };\r
-        }\r
-        return fields;\r
-    }\r
-\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/Messages.java
deleted file mode 100644 (file)
index 26ffa95..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.views.events;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.events.messages"; //$NON-NLS-1$
-       public static String EventsTable_traceColumn;
-       public static String EventsTable_timestampColumn;
-       public static String EventsTable_markerColumn;
-    public static String EventsTable_contentColumn;
-       static {
-               // initialize resource bundle
-               NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-       }
-
-       private Messages() {
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/messages.properties
deleted file mode 100644 (file)
index 4e6dfa8..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-EventsTable_traceColumn=Trace
-EventsTable_timestampColumn=Timestamp
-EventsTable_markerColumn=Marker
-EventsTable_contentColumn=Content
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/AbstractViewer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/AbstractViewer.java
deleted file mode 100644 (file)
index e908622..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseTrackListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.ZoomListener;\r
-import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.SWTException;\r
-import org.eclipse.swt.widgets.Canvas;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Display;\r
-\r
-/**\r
- * <b><u>AbstractViewer</u></b>\r
- * <p>\r
- * Abstract viewer.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public abstract class AbstractViewer extends Canvas {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Parent composite node.\r
-     */\r
-    protected Composite fParent;\r
-\r
-    /**\r
-     * Paint listener.\r
-     */\r
-    protected AbstractPaintListener fPaintListener;\r
-\r
-    /**\r
-     * Zoom listener, to zoom in and out of a graph using the scroll wheel.\r
-     */\r
-    protected ZoomListener fZoomListener;\r
-\r
-    /**\r
-     * Tool tip listener.\r
-     */\r
-    protected AbstractMouseTrackListener fMouseTraceListener;\r
-\r
-    /**\r
-     * Mouse listener\r
-     */\r
-    protected AbstractMouseListener fMouseListener;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructor\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Constructor.\r
-     * @param parent\r
-     *            The parent composite node.\r
-     * @param style\r
-     *            The SWT style to use to render the view.\r
-     */\r
-    public AbstractViewer(Composite parent, int style) {\r
-        super(parent, style);\r
-\r
-        fParent = parent;\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Abstract interface\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Clears the view.\r
-     */\r
-    abstract public void clear();\r
-\r
-    /**\r
-     * Clears the background of the view but keeps min and max values.\r
-     */\r
-    abstract public void clearBackground();\r
-\r
-    /**\r
-     * Method to increase bar width\r
-     */\r
-    abstract public void increaseBarWidth();\r
-    \r
-    /**\r
-     * Method to decrease bar width\r
-     */\r
-    abstract public void decreaseBarWidth();\r
-\r
-    /**\r
-     * Return data model\r
-     */\r
-    abstract public IBaseDistributionModel getModel();\r
-    \r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Accessors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Returns the zoom factor for the canvas.\r
-     * @return The zoom factor for the canvas.\r
-     */\r
-    public int getZoomFactor() {\r
-        if (fZoomListener != null) {\r
-            return fZoomListener.getZoomFactor();\r
-        } else {\r
-            return 1;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Returns the zoom increment for the canvas.\r
-     * @return The zoom increment for the canvas.\r
-     */\r
-    public int getZoomIncrement() {\r
-        if (fZoomListener != null) {\r
-            return fZoomListener.getZoomIncrement();\r
-        } else {\r
-            return 1;\r
-        }\r
-    }\r
-\r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Draw horizontal label each "nbTicks" ticks.\r
-     * @param nbTicks\r
-     *            The draw interval.\r
-     */\r
-    public void setDrawLabelEachNTicks(int nbTicks) {\r
-        fPaintListener.setDrawLabelEachNTicks(nbTicks);\r
-    }\r
-\r
-    /**\r
-     * Sets the title of the graph.\r
-     * @param graphTitle\r
-     *            The title of the graph.\r
-     */\r
-    public void setGraphTitle(String graphTitle) {\r
-        fPaintListener.setGraphTitle(graphTitle);\r
-    }\r
-\r
-    /**\r
-     * Sets the horizontal axis label.\r
-     * @param xLabel\r
-     *            The horizontal axis label.\r
-     * @param offset\r
-     *            The horizontal axis draw offset (in pixels).\r
-     */\r
-    public void setXAxisLabel(String xLabel, int offset) {\r
-        fPaintListener.setXAxisLabel(xLabel, offset);\r
-    }\r
-\r
-    /**\r
-     * Sets the vertical axis label.\r
-     * @param yLabel\r
-     *            The vertical axis label.\r
-     */\r
-    public void setYAxisLabel(String yLabel) {\r
-        fPaintListener.setYAxisLabel(yLabel);\r
-    }\r
-\r
-    /**\r
-     * Asks for the view to be redrawn, synchronously or asynchronously.\r
-     * @param asyncRedraw\r
-     *            If "true", the view will be redrawn asynchronously, otherwise it will be redraw synchronously.\r
-     */\r
-    public void askForRedraw(boolean asyncRedraw) {\r
-        if (asyncRedraw == true) {\r
-            Display.getDefault().asyncExec(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    try {\r
-                        redraw();\r
-                    } catch (SWTException e) {\r
-                        // ...\r
-                    }\r
-                }\r
-            });\r
-        } else {\r
-            Display.getDefault().syncExec(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    try {\r
-                        redraw();\r
-                    } catch (SWTException e) {\r
-                        // ...\r
-                    }\r
-                }\r
-            });\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Asks for the view to be redrawn (asynchronously).\r
-     */\r
-    public void askForRedraw() {\r
-        askForRedraw(true);\r
-    }\r
-\r
-    /**\r
-     * Redraws the title after a zoom to display the new zoom factor.\r
-     */\r
-    public void redrawTitle() {\r
-        fPaintListener.paintGraphTitle();\r
-    }\r
-\r
-    /**\r
-     * Removes the view's listeners before disposing of it.\r
-     */\r
-    @Override\r
-    public void dispose() {\r
-        try {\r
-            if (fPaintListener != null) {\r
-                removePaintListener(fPaintListener);\r
-                fPaintListener = null;\r
-            }\r
-            if (fZoomListener != null) {\r
-                removeListener(SWT.MouseWheel, fZoomListener);\r
-                fZoomListener = null;\r
-            }\r
-            if (fMouseTraceListener != null) {\r
-                removeListener(SWT.MouseMove, fMouseTraceListener);\r
-                fMouseTraceListener = null;\r
-            }\r
-        } catch (SWTException e) {\r
-            // This exception will be thrown if the user closes the view\r
-            // while it is receiving data from the Analyzer.\r
-\r
-            // ...\r
-        }\r
-\r
-        super.dispose();\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/GraphViewer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/GraphViewer.java
deleted file mode 100644 (file)
index 2598543..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.GraphMouseListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.GraphPaintListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.TimePointerListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphDataModel;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyGraphModel;\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-/**\r
- * <b><u>GraphViewer</u></b>\r
- * <p>\r
- * Graph viewer.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class GraphViewer extends AbstractViewer implements IGraphModelListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Latency graph model\r
-     */\r
-    private LatencyGraphModel fModel;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-       /**\r
-        * Constructor.\r
-        * @param parent The parent composite node.\r
-        * @param style The SWT style to use to render the view.\r
-        */\r
-       public GraphViewer(Composite parent, int style) {\r
-               super(parent, style);\r
-\r
-               // Register the paint listener\r
-               fPaintListener = new GraphPaintListener(this);\r
-               addPaintListener(fPaintListener);\r
-\r
-               // Register the mouse track listener\r
-               fMouseTraceListener = new TimePointerListener(this, (GraphPaintListener)fPaintListener);\r
-               addMouseTrackListener(fMouseTraceListener);\r
-\r
-               // Register mouse listener\r
-               fMouseListener = new GraphMouseListener(this, (GraphPaintListener)fPaintListener);\r
-               addMouseListener(fMouseListener);\r
-\r
-               fModel = new LatencyGraphModel();\r
-        fModel.addGraphModelListener(this);\r
-       }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-       \r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#dispose()\r
-        */\r
-       @Override\r
-       public void dispose() {\r
-           fModel.removeGraphModelListener(this);\r
-           fPaintListener.dispose();\r
-           super.dispose();\r
-       }\r
-       \r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clear()\r
-        */\r
-       @Override\r
-       public void clear() {\r
-               fPaintListener.clear();\r
-       }\r
-       \r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clearBackground()\r
-        */\r
-       @Override\r
-       public void clearBackground() {\r
-               fPaintListener.clear();\r
-       }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#increaseBarWidth()\r
-     */\r
-    @Override\r
-    public void increaseBarWidth() {\r
-        fPaintListener.increaseBarWitdh();\r
-        graphModelUpdated();\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#decreaseBarWidth()\r
-     */\r
-    @Override\r
-    public void decreaseBarWidth() {\r
-        fPaintListener.decreaseBarWitdh();\r
-        graphModelUpdated();\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#getModel()\r
-     */\r
-    @Override\r
-    public IGraphDataModel getModel() {\r
-        return fModel;\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#graphModelUpdated()\r
-     */\r
-    @Override\r
-    public void graphModelUpdated() {\r
-        if (!isDisposed() && getDisplay() != null) {\r
-            getDisplay().asyncExec(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    if (!isDisposed()) {\r
-                        redraw();\r
-                    }\r
-                }\r
-            });\r
-        }\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#currentEventUpdated()\r
-     */\r
-    @Override\r
-    public void currentEventUpdated(long currentEventTime) {\r
-        graphModelUpdated();\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/HistogramViewer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/HistogramViewer.java
deleted file mode 100644 (file)
index e4219b5..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.HistogramPaintListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.TooltipListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.listeners.ZoomListener;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramModelListener;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Composite;\r
-\r
-/**\r
- * <b><u>HistogramViewer</u></b>\r
- * <p>\r
- * \r
- * Histogram viewer.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class HistogramViewer extends AbstractViewer implements IHistogramModelListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-       /**\r
-        * Usable width for data plotting.\r
-        */\r
-       protected int fUsableWidth;\r
-\r
-       /**\r
-        * Latency histogram model.\r
-        */\r
-       private HistogramDataModel fModel;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-       /**\r
-        * Constructor.\r
-        * @param parent The parent composite node.\r
-        * @param style The SWT style to use to render the view.\r
-        */\r
-       public HistogramViewer(Composite parent, int style) {\r
-               super(parent, style);\r
-               \r
-               // Register the paint listener\r
-               fPaintListener = new HistogramPaintListener(this);\r
-               addPaintListener(fPaintListener);\r
-               \r
-               // Register the zoom listener\r
-               fZoomListener = new ZoomListener(this);\r
-               addListener(SWT.MouseWheel, fZoomListener);\r
-               \r
-               // Register the mouse click listener\r
-               fMouseTraceListener = new TooltipListener(this, (HistogramPaintListener)fPaintListener);\r
-               addMouseTrackListener(fMouseTraceListener);\r
-               \r
-               fModel = new HistogramDataModel();\r
-               fModel.addHistogramListener(this);\r
-       }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#dispose()\r
-        */\r
-       @Override\r
-       public void dispose() {\r
-           fModel.removeHistogramListener(this);\r
-           fPaintListener.dispose();\r
-           super.dispose();\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clear()\r
-        */\r
-       @Override\r
-       public void clear() {\r
-               fPaintListener.clear();\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clearBackground()\r
-        */\r
-       @Override\r
-       public void clearBackground() {\r
-               fPaintListener.clear();\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#increaseBarWidth()\r
-        */\r
-       @Override\r
-    public void increaseBarWidth() {\r
-           fPaintListener.increaseBarWitdh();\r
-           modelUpdated();\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#decreaseBarWidth()\r
-        */\r
-       @Override\r
-    public void decreaseBarWidth() {\r
-           fPaintListener.decreaseBarWitdh();\r
-           modelUpdated();\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#getModel()\r
-        */\r
-       @Override\r
-    public IHistogramDataModel getModel() {\r
-        return fModel;\r
-    }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.eclipse.linuxtools.lttng.ui.views.histogram.IHistogramModelListener#modelUpdated()\r
-        */\r
-    @Override\r
-    public void modelUpdated() {\r
-        \r
-        if (!isDisposed() && getDisplay() != null) {\r
-            getDisplay().asyncExec(new Runnable() {\r
-                @Override\r
-                public void run() {\r
-                    if (!isDisposed()) {\r
-                        redraw();\r
-                    }\r
-                }\r
-            });\r
-        }\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/LatencyView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/LatencyView.java
deleted file mode 100644 (file)
index cae36a1..0000000
+++ /dev/null
@@ -1,481 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.IToolBarManager;\r
-import org.eclipse.jface.action.Separator;\r
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AddDialog;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.DeleteDialog;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.ListDialog;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.Config;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyController;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyGraphModel;\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;\r
-import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;\r
-import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;\r
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;\r
-import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;\r
-import org.eclipse.linuxtools.tmf.ui.views.TmfView;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.ControlEvent;\r
-import org.eclipse.swt.events.ControlListener;\r
-import org.eclipse.swt.layout.FillLayout;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IActionBars;\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-\r
-/**\r
- * <b><u>LatencyView</u></b>\r
- * <p>\r
- * TmfView displaying the latency views (i.e. the two latency charts).\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class LatencyView extends TmfView implements IGraphModelListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-    \r
-    // The initial window span (in nanoseconds)\r
-    public static final long INITIAL_WINDOW_SPAN = (1L * 100 * 1000 * 1000); // .1sec\r
-\r
-    /**\r
-     * The view's unique ID.\r
-     */\r
-    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.latency.LatencyView"; //$NON-NLS-1$\r
-\r
-    /**\r
-     * A reference to the currently selected experiment.\r
-     */\r
-    protected TmfExperiment<LttngEvent> fExperiment = null;\r
-\r
-    /**\r
-     * Parent composite.\r
-     */\r
-    protected Composite fParent;\r
-\r
-    /**\r
-     * Graph view.\r
-     */\r
-    protected GraphViewer fGraphViewer;\r
-    \r
-    /**\r
-     * Histogram view.\r
-     */\r
-    protected HistogramViewer fHistogramViewer;\r
-\r
-    /**\r
-     * Action executed when the user wants to see the list of matching events.\r
-     */\r
-    protected Action fListMatchingEvents;\r
-    \r
-    /**\r
-     * Action executed when the user wants to add matching events.\r
-     */\r
-    protected Action fAddMatchingEvents;\r
-    \r
-    /**\r
-     * Action executed when the user wants to delete matching events.\r
-     */\r
-    protected Action fDeleteMatchingEvents;\r
-    \r
-    /**\r
-     * Action executed when the user wants to increase the width of the histogram bars.\r
-     */\r
-    protected Action fIncreaseBarWidth;\r
-    \r
-    /**\r
-     * Action executed when the user wants to decrease the width of the histogram bars.\r
-     */\r
-    protected Action fDecreaseBarWidth;\r
-\r
-    /**\r
-     * The current histogram window time range.\r
-     */\r
-    protected TmfTimeRange fTimeRange = null;\r
-\r
-    /**\r
-     * Controller of the latency model which is responsible to retrieve data from the trace\r
-     */\r
-    final private LatencyController fController;\r
-\r
-    /**\r
-     * Flag to notify that TimeSyncSignal was received and is being processed.\r
-     */\r
-    private boolean fSyncSignalReceived = false;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructor\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     */\r
-    public LatencyView() {\r
-        super(Messages.LatencyView_ViewName);\r
-        fController = LatencyController.getInstance();\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Create the UI controls of this view.\r
-     * \r
-     * @param parent\r
-     *            The composite parent of this view.\r
-     */\r
-    @Override\r
-    public void createPartControl(Composite parent) {\r
-        // Save the parent\r
-        fParent = parent;\r
-\r
-        makeActions();\r
-        contributeToActionBars();\r
-\r
-        // Add a control listener to handle the view resize events (to redraw the canvas)\r
-        fParent.addControlListener(new ControlListener() {\r
-            @Override\r
-            public void controlMoved(ControlEvent event) {\r
-                fHistogramViewer.clearBackground();\r
-                fGraphViewer.clearBackground();\r
-                fController.handleCompleted();\r
-            }\r
-\r
-            @Override\r
-            public void controlResized(ControlEvent event) {\r
-                fHistogramViewer.clearBackground();\r
-                fGraphViewer.clearBackground();\r
-                fController.handleCompleted();\r
-            }\r
-        });\r
-\r
-        // ///////////////////////////////////////////////////////////////////////////////////\r
-        // Layout for the whole view, other elements will be in a child composite of this one\r
-        // Contains :\r
-        // Composite layoutSelectionWindow\r
-        // Composite layoutTimesSpinner\r
-        // Composite layoutExperimentHistogram\r
-        // ///////////////////////////////////////////////////////////////////////////////////\r
-        Composite layoutFullView = new Composite(fParent, SWT.FILL);\r
-        FillLayout gridFullView = new FillLayout();\r
-        gridFullView.marginHeight = 0;\r
-        gridFullView.marginWidth = 0;\r
-        layoutFullView.setLayout(gridFullView);\r
-\r
-        // Create the graph views\r
-        fGraphViewer = new GraphViewer(layoutFullView, SWT.DOUBLE_BUFFERED);\r
-        fGraphViewer.setDrawLabelEachNTicks(2);\r
-        fGraphViewer.setGraphTitle(Messages.LatencyView_Graphs_Graph_Title);\r
-        fGraphViewer.setXAxisLabel(Messages.LatencyView_Graphs_Graph_XAxisLabel, 40);\r
-        fGraphViewer.setYAxisLabel(Messages.LatencyView_Graphs_Graph_YAxisLabel);\r
-\r
-        fHistogramViewer = new HistogramViewer(layoutFullView, SWT.DOUBLE_BUFFERED);\r
-        fHistogramViewer.setDrawLabelEachNTicks(2);\r
-        fHistogramViewer.setGraphTitle(Messages.LatencyView_Graphs_Histogram_Title);\r
-        fHistogramViewer.setXAxisLabel(Messages.LatencyView_Graphs_Histogram_XAxisLabel, 55);\r
-        fHistogramViewer.setYAxisLabel(Messages.LatencyView_Graphs_Histogram_YAxisLabel);\r
-\r
-        fController.registerModel(fGraphViewer.getModel());\r
-        fController.registerModel(fHistogramViewer.getModel());\r
-        \r
-        ((LatencyGraphModel)fGraphViewer.getModel()).addGraphModelListener(this);\r
-        \r
-        @SuppressWarnings("unchecked")\r
-        TmfExperiment<TmfEvent> experiment = (TmfExperiment<TmfEvent>) TmfExperiment.getCurrentExperiment();\r
-        if (experiment != null) {\r
-\r
-            TmfTimeRange experimentTRange = experiment.getTimeRange();\r
-\r
-            if (experimentTRange != TmfTimeRange.NULL_RANGE) {\r
-                TmfExperimentSelectedSignal<TmfEvent> signal = new TmfExperimentSelectedSignal<TmfEvent>(this, experiment);\r
-                experimentSelected(signal);\r
-            }\r
-        }\r
-    }\r
-\r
-    @SuppressWarnings("nls")\r
-    @Override\r
-    public String toString() {\r
-        return "["+ Messages.LatencyView_ViewName+"]";\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Signal handlers\r
-    // ------------------------------------------------------------------------\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @TmfSignalHandler\r
-    public void experimentSelected(TmfExperimentSelectedSignal<TmfEvent> signal) {\r
-        // Clear the views\r
-        fGraphViewer.clear();\r
-        fHistogramViewer.clear();\r
-\r
-        if (fParent != null) {\r
-            // Update the trace reference\r
-            fExperiment = (TmfExperiment<LttngEvent>) signal.getExperiment();\r
-\r
-            fTimeRange = TmfTimeRange.NULL_RANGE;\r
-            TmfTimeRange experimentTRange = fExperiment.getTimeRange();\r
-\r
-            if (!experimentTRange.equals(TmfTimeRange.NULL_RANGE)) {\r
-                fTimeRange = new TmfTimeRange(experimentTRange.getStartTime(), \r
-                        new TmfTimestamp(experimentTRange.getStartTime().getValue() + INITIAL_WINDOW_SPAN, experimentTRange.getStartTime().getScale(), experimentTRange.getStartTime().getPrecision()));\r
-                fController.refreshModels(fExperiment, fTimeRange);\r
-            }\r
-        }\r
-    }    \r
-    @TmfSignalHandler\r
-    public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {\r
-        if (fTimeRange == TmfTimeRange.NULL_RANGE && signal.getExperiment().equals(fExperiment)) {\r
-            TmfTimeRange experimentTRange = signal.getRange();\r
-\r
-            if (experimentTRange != TmfTimeRange.NULL_RANGE) {\r
-                fTimeRange = new TmfTimeRange(experimentTRange.getStartTime(), \r
-                        new TmfTimestamp(experimentTRange.getStartTime().getValue() + INITIAL_WINDOW_SPAN, experimentTRange.getStartTime().getScale(), experimentTRange.getStartTime().getPrecision()));\r
-                fController.refreshModels(fExperiment, fTimeRange);\r
-            }\r
-        }\r
-    }\r
-    \r
-    @TmfSignalHandler\r
-    public void experimentDisposed(TmfExperimentDisposedSignal<TmfEvent> signal) {\r
-        if (signal.getExperiment() != fExperiment) {\r
-            return;\r
-        }\r
-        fTimeRange = TmfTimeRange.NULL_RANGE;\r
-        fExperiment = null;\r
-        fController.clear();\r
-    }\r
-\r
-    /**\r
-     * Called when the LatencyView is closed: disposes of the canvas and unregisters models from views.\r
-     */\r
-    @Override\r
-    public void dispose() {\r
-        fController.dispose();\r
-        fController.deregisterModel(fGraphViewer.getModel());\r
-        fController.deregisterModel(fHistogramViewer.getModel());\r
-        ((LatencyGraphModel)fGraphViewer.getModel()).removeGraphModelListener(this);\r
-\r
-        fGraphViewer.dispose();\r
-        fHistogramViewer.dispose();\r
-\r
-        super.dispose();\r
-    }\r
-\r
-    /**\r
-     * Method called when synchronization is active and that the user select an event.\r
-     * \r
-     * The models will be updated with the new current selected time.\r
-     * \r
-     * @param signal\r
-     *            Signal received from the framework. Contain the event.\r
-     */\r
-    @TmfSignalHandler\r
-    public void currentTimeUpdated(TmfTimeSynchSignal signal) {\r
-        if (signal.getSource() != this) {\r
-            fSyncSignalReceived = true;\r
-            fController.setCurrentEventTime(signal.getCurrentTime().getValue());\r
-            fSyncSignalReceived = false;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Method called when synchronization is active and that the user changed the current time range.\r
-\r
-     * The models will be updated with the new time range.\r
-     * \r
-     * @param signal\r
-     *            Signal received from the framework. Contain the new time range.\r
-     */\r
-    @TmfSignalHandler\r
-    public void synchToTimeRange(TmfRangeSynchSignal signal) {\r
-        if (signal.getSource() != this) {\r
-            // Erase the graph views\r
-            fGraphViewer.clear();\r
-            fHistogramViewer.clear();\r
-            \r
-            ITmfTimestamp startTime = signal.getCurrentRange().getStartTime();\r
-            ITmfTimestamp endTime = signal.getCurrentRange().getEndTime();\r
-            fTimeRange = new TmfTimeRange(startTime, endTime);\r
-\r
-            fController.refreshModels(fExperiment, fTimeRange);\r
-        }\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#graphModelUpdated()\r
-     */\r
-    @Override\r
-    public void graphModelUpdated() {\r
-        // Nothing to do - update of viewers will be done in the viewers\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#currentEventUpdated(long)\r
-     */\r
-    @Override\r
-    public void currentEventUpdated(final long currentEventTime) {\r
-        if (fExperiment != null && \r
-                !fSyncSignalReceived && // Don't broadcast the current time that was received just before with a time sync signal\r
-                currentEventTime != Config.INVALID_EVENT_TIME) {\r
-\r
-            // Queue update in the event request queue \r
-            TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(currentEventTime, Config.TIME_SCALE), TmfTimestamp.BIG_CRUNCH);\r
-            TmfEventRequest<LttngEvent> request = new TmfEventRequest<LttngEvent>(LttngEvent.class, timeRange, 0, 1, ExecutionType.FOREGROUND) {\r
-                @Override\r
-                public void handleCompleted() {\r
-                    broadcast(new TmfTimeSynchSignal(this, new TmfTimestamp(currentEventTime, Config.TIME_SCALE)));\r
-                }\r
-            };\r
-            fExperiment.sendRequest(request);\r
-        }\r
-    }\r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Helper functions\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Fills the local pull down menu.\r
-     * @param manager\r
-     *            The menu manager.\r
-     */\r
-    private void fillLocalPullDown(IMenuManager manager) {\r
-        manager.add(new Separator());\r
-        manager.add(fIncreaseBarWidth);\r
-        manager.add(fDecreaseBarWidth);\r
-        manager.add(new Separator());\r
-        manager.add(fListMatchingEvents);\r
-        manager.add(fAddMatchingEvents);\r
-        manager.add(fDeleteMatchingEvents);\r
-        manager.add(new Separator());\r
-    }\r
-\r
-    /**\r
-     * Fills the local toolbar.\r
-     * @param manager\r
-     *            The toolbar manager\r
-     */\r
-    private void fillLocalToolBar(IToolBarManager manager) {\r
-        manager.add(new Separator());\r
-        manager.add(fIncreaseBarWidth);\r
-        manager.add(fDecreaseBarWidth);\r
-        manager.add(new Separator());\r
-        manager.add(fListMatchingEvents);\r
-        manager.add(fAddMatchingEvents);\r
-        manager.add(fDeleteMatchingEvents);\r
-        manager.add(new Separator());\r
-    }\r
-\r
-    /**\r
-     * Creates the actions required by the dialog events.\r
-     */\r
-    private void makeActions() {\r
-        // Increase the histogram bar width\r
-        fIncreaseBarWidth = new Action() {\r
-            @Override\r
-            public void run() {\r
-                fHistogramViewer.increaseBarWidth();\r
-                fGraphViewer.increaseBarWidth();\r
-            }\r
-        };\r
-        String tooltipText = Messages.LatencyView_Action_IncreaseBarWidth_Tooltip;\r
-        fIncreaseBarWidth.setText(tooltipText);\r
-        fIncreaseBarWidth.setToolTipText(tooltipText);\r
-        fIncreaseBarWidth.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/increasebar_button.gif")); //$NON-NLS-1$\r
-\r
-        // Decrease the histogram bar width\r
-        fDecreaseBarWidth = new Action() {\r
-            @Override\r
-            public void run() {\r
-                fHistogramViewer.decreaseBarWidth();\r
-                fGraphViewer.decreaseBarWidth();\r
-            }\r
-        };\r
-        tooltipText = Messages.LatencyView_Action_DecreaseBarWidth_Tooltip;\r
-        fDecreaseBarWidth.setText(tooltipText);\r
-        fDecreaseBarWidth.setToolTipText(tooltipText);\r
-        fDecreaseBarWidth.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/decreasebar_button.gif")); //$NON-NLS-1$\r
-\r
-        // List matching events dialog\r
-        fListMatchingEvents = new Action() {\r
-            @Override\r
-            public void run() {\r
-                ListDialog listDialog = new ListDialog(fParent.getShell(), Messages.LatencyView_Dialogs_ListEvents_Title, Messages.LatencyView_Dialogs_ListEvents_Message);\r
-                listDialog.create();\r
-                listDialog.open();\r
-            }\r
-        };\r
-        tooltipText = Messages.LatencyView_Action_ListEvents_Tooltip;\r
-        fListMatchingEvents.setText(tooltipText);\r
-        fListMatchingEvents.setToolTipText(tooltipText);\r
-        fListMatchingEvents.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/eview16/events_view.gif")); //$NON-NLS-1$\r
-\r
-        // Add matching events dialog\r
-        fAddMatchingEvents = new Action() {\r
-            @Override\r
-            public void run() {\r
-                AddDialog addDialog = new AddDialog(fParent.getShell(), Messages.LatencyView_Dialogs_AddEvents_Title, Messages.LatencyView_Dialogs_AddEvents_Message);\r
-                addDialog.create();\r
-                addDialog.open();\r
-            }\r
-        };\r
-        tooltipText = Messages.LatencyView_Action_AddEvents_Tooltip;\r
-        fAddMatchingEvents.setText(tooltipText);\r
-        fAddMatchingEvents.setToolTipText(tooltipText);\r
-        fAddMatchingEvents.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/add_button.gif")); //$NON-NLS-1$\r
-\r
-        // Remove matching events dialog\r
-        fDeleteMatchingEvents = new Action() {\r
-            @Override\r
-            public void run() {\r
-                DeleteDialog deleteDialog = new DeleteDialog(fParent.getShell(), Messages.LatencyView_Dialogs_DeleteEvents_Title,\r
-                        Messages.LatencyView_Dialogs_DeleteEvents_Message);\r
-                deleteDialog.create();\r
-                deleteDialog.open();\r
-            }\r
-        };\r
-        tooltipText = Messages.LatencyView_Action_DeleteEvents_Tooltip;\r
-        fDeleteMatchingEvents.setText(tooltipText);\r
-        fDeleteMatchingEvents.setToolTipText(tooltipText);\r
-        fDeleteMatchingEvents.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/delete_button.gif")); //$NON-NLS-1$\r
-    }\r
-\r
-    /**\r
-     * Build the toolbar and menu by adding action buttons for dialogs.\r
-     */\r
-    private void contributeToActionBars() {\r
-        IActionBars bars = getViewSite().getActionBars();\r
-        fillLocalPullDown(bars.getMenuManager());\r
-        fillLocalToolBar(bars.getToolBarManager());\r
-    }\r
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/Messages.java
deleted file mode 100644 (file)
index d8ec82f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Updated    \r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency;\r
-\r
-import org.eclipse.osgi.util.NLS;\r
-\r
-/**\r
- * Returns localized strings from the resource bundle (i.e. "messages.properties").\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class Messages extends NLS {\r
-\r
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.latency.messages"; //$NON-NLS-1$\r
-\r
-    public static String LatencyView_ViewName;\r
-    public static String LatencyView_Action_IncreaseBarWidth_Tooltip;\r
-    public static String LatencyView_Action_DecreaseBarWidth_Tooltip;\r
-    public static String LatencyView_Action_AddEvents_Tooltip;\r
-    public static String LatencyView_Action_DeleteEvents_Tooltip;\r
-    public static String LatencyView_Action_ListEvents_Tooltip;\r
-    public static String LatencyView_Dialogs_AddEvents_Title;\r
-    public static String LatencyView_Dialogs_AddEvents_Message;\r
-    public static String LatencyView_Dialogs_AddEvents_Buttons_Add;\r
-    public static String LatencyView_Dialogs_AddEvents_Buttons_Close;\r
-    public static String LatencyView_Dialogs_AddEvents_Columns_Start;\r
-    public static String LatencyView_Dialogs_AddEvents_Columns_End;\r
-    public static String LatencyView_Dialogs_AddEvents_Columns_List_Trigger;\r
-    public static String LatencyView_Dialogs_AddEvents_Columns_List_End;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_NoSelection;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_StartNotSelected;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_EndNotSelected;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_SameSelected;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_AlreadyMatched;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_StartAlreadyMatched;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_EndAlreadyMatched;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_StartAsEnd;\r
-    public static String LatencyView_Dialogs_AddEvents_Errors_EndAsStart;\r
-    public static String LatencyView_Dialogs_DeleteEvents_Title;\r
-    public static String LatencyView_Dialogs_DeleteEvents_Message;\r
-    public static String LatencyView_Dialogs_DeleteEvents_Buttons_Close;\r
-    public static String LatencyView_Dialogs_DeleteEvents_Buttons_Delete;\r
-    public static String LatencyView_Dialogs_DeleteEvents_Confirm_Title;\r
-    public static String LatencyView_Dialogs_DeleteEvents_Confirm_Message;\r
-    public static String LatencyView_Dialogs_ListEvents_Title;\r
-    public static String LatencyView_Dialogs_ListEvents_Message;\r
-    public static String LatencyView_Dialogs_ListEvents_Buttons_Close;\r
-    public static String LatencyView_Dialogs_ListEvents_Buttons_Reset;\r
-    public static String LatencyView_Dialogs_ListEvents_Columns_Trigger;\r
-    public static String LatencyView_Dialogs_ListEvents_Columns_End;\r
-    public static String LatencyView_Dialogs_ListEvents_Confirm_Title;\r
-    public static String LatencyView_Dialogs_ListEvents_Confirm_Message;\r
-    public static String LatencyView_Graphs_Graph_Title;\r
-    public static String LatencyView_Graphs_Graph_XAxisLabel;\r
-    public static String LatencyView_Graphs_Graph_YAxisLabel;\r
-    public static String LatencyView_Graphs_Histogram_Title;\r
-    public static String LatencyView_Graphs_Histogram_XAxisLabel;\r
-    public static String LatencyView_Graphs_Histogram_YAxisLabel;\r
-    public static String LatencyView_msgSlogan;\r
-    public static String LatencyView_tmf_UI;\r
-    public static String LatencyView_ClippingWarning;\r
-    \r
-    static {\r
-        // initialize resource bundle\r
-        NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
-    }\r
-\r
-    private Messages() {\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AbstractDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AbstractDialog.java
deleted file mode 100644 (file)
index c773037..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.dialogs;\r
-\r
-import java.util.Vector;\r
-\r
-import org.eclipse.jface.dialogs.IDialogSettings;\r
-import org.eclipse.jface.dialogs.IMessageProvider;\r
-import org.eclipse.jface.dialogs.TitleAreaDialog;\r
-import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
-import org.eclipse.linuxtools.internal.lttng.core.util.EventsPair;\r
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyController;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-/**\r
- * <b><u>AbstractDialog</u></b>\r
- * <p> \r
- * Includes the main functions shared by all the different dialogs.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public abstract class AbstractDialog extends TitleAreaDialog {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * The dialog window title.\r
-     */\r
-    protected String fDialogTitle;\r
-    /**\r
-     * The dialog window message.\r
-     */\r
-    protected String fDialogMessage;\r
-\r
-    /**\r
-     * The code returned by the dialog when the user closes the "Add" dialog.\r
-     */\r
-    public static final int ADD = 53445;\r
-    /**\r
-     * The code returned by the dialog when the user closes the "Delete" dialog.\r
-     */\r
-    public static final int DELETE = ADD + 1;\r
-    /**\r
-     * The code returned by the dialog when the user resets the latency pair to default.\r
-     */\r
-    public static final int RESET = DELETE + 1;\r
-\r
-    /**\r
-     * String ID of the number of pairs saved in the settings file.\r
-     */\r
-    protected static final String LATENCY_NB_MATCH_PAIRS = "NB_LATENCY_MATCH_PAIRS"; //$NON-NLS-1$\r
-    /**\r
-     * String ID of the start event pairs saved in the settings file.\r
-     */\r
-    protected static final String LATENCY_PAIRS_START = "LATENCY_PAIRS_START"; //$NON-NLS-1$\r
-    /**\r
-     * String ID of the end event pairs saved in the settings file.\r
-     */\r
-    protected static final String LATENCY_PAIRS_END = "LATENCY_PAIRS_END"; //$NON-NLS-1$\r
-\r
-    /**\r
-     * Dialog settings, saves the event pairs across sessions.\r
-     */\r
-    protected IDialogSettings fSettings;\r
-\r
-    /**\r
-     * Do the graphs canvas need to be redrawn due to latency pairs changes ?\r
-     */\r
-    protected boolean fRedrawGraphs = false;\r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param parentShell\r
-     *            The parent shell.\r
-     * @param title\r
-     *            The dialog window's title.\r
-     * @param message\r
-     *            The dialog window's message.\r
-     */\r
-    public AbstractDialog(Shell parentShell, String title, String message) {\r
-        super(parentShell);\r
-        fDialogTitle = title;\r
-        fDialogMessage = message;\r
-\r
-        fSettings = LTTngUiPlugin.getDefault().getDialogSettings();\r
-    }\r
-\r
-    /**\r
-     * Constructor\r
-     * @param parentShell\r
-     *            The parent shell.\r
-     * @param title\r
-     *            The dialog window's title.\r
-     */\r
-    @SuppressWarnings("nls")\r
-    public AbstractDialog(Shell parentShell, String title) {\r
-        this(parentShell, title, "");\r
-    }\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param parentShell\r
-     *            The parent shell.\r
-     */\r
-    @SuppressWarnings("nls")\r
-    public AbstractDialog(Shell parentShell) {\r
-        this(parentShell, "", "");\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Creates the dialog.\r
-     * \r
-     * <b>Note :</b> Since there is an issue with the table's vertical scroll bar, this dialog "resize" is necessary to\r
-     * ensure a minimal height for the window.\r
-     */\r
-    @Override\r
-    public void create() {\r
-        super.create();\r
-        // Set the title\r
-        setTitle(fDialogTitle);\r
-        // Set the message\r
-        setMessage(fDialogMessage, IMessageProvider.INFORMATION);\r
-\r
-        // Position the dialog at the center of the screen\r
-        int windowWidth = Display.getCurrent().getPrimaryMonitor().getBounds().width;\r
-        int windowHeight = Display.getCurrent().getPrimaryMonitor().getBounds().height;\r
-        int dialogWidth = getShell().getSize().x;\r
-        int dialogHeight = windowHeight / 2;\r
-\r
-        int x = (windowWidth - dialogWidth) / 2;\r
-        int y = (windowHeight - dialogHeight) / 2;\r
-\r
-        getShell().setSize(getShell().getSize().x, dialogHeight);\r
-        getShell().setLocation(x, y);\r
-    }\r
-\r
-    /**\r
-     * Formats the "#" of the event in the table by adding "00" before it.\r
-     * @param number\r
-     *            The number to format.\r
-     * @param max\r
-     *            The maximum number of event pairs in the list.\r
-     * @return The formatted string.\r
-     */\r
-    @SuppressWarnings("nls")\r
-    protected String formatListNumber(int number, int max) {\r
-        return String.format("%0" + max + "d", number);\r
-    }\r
-\r
-    /**\r
-     * Returns the match pairs saved in the settings file.\r
-     * @return The match pairs saved in the settings file.\r
-     */\r
-    protected EventsPair getMatchPairs() {\r
-        try {\r
-            // Check if the settings file has already some data (i.e. try provoking an exception)\r
-            fSettings.getInt(LATENCY_NB_MATCH_PAIRS);\r
-\r
-            String[] starts = fSettings.getArray(LATENCY_PAIRS_START);\r
-            String[] ends = fSettings.getArray(LATENCY_PAIRS_END);\r
-\r
-            EventMatcher.getInstance().resetMatches();\r
-            for (int i = 0; i < starts.length; i++) {\r
-                EventMatcher.getInstance().addMatch(starts[i], ends[i]);\r
-            }\r
-\r
-            return EventMatcher.getInstance().getEvents();\r
-        } catch (NumberFormatException e) {\r
-            return EventMatcher.getInstance().getEvents();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Saves the event match pairs to a settings file.\r
-     * @param start\r
-     *            The start event types.\r
-     * @param end\r
-     *            The end event types.\r
-     */\r
-    protected void saveMatchPairs(Vector<String> start, Vector<String> end) {\r
-        fSettings.put(LATENCY_NB_MATCH_PAIRS, start.size());\r
-        fSettings.put(LATENCY_PAIRS_START, start.toArray(new String[] {}));\r
-        fSettings.put(LATENCY_PAIRS_END, end.toArray(new String[] {}));\r
-    }\r
-\r
-    /**\r
-     * Ask the LatencyView to send a new analysis request to the views, so that they can be redrawn.\r
-     */\r
-    protected void redrawGraphs() {\r
-        LatencyController.getInstance().refreshModels();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected abstract Control createDialogArea(Composite parent);\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected abstract void createButtonsForButtonBar(Composite parent);\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.jface.dialogs.Dialog#isResizable()\r
-     */\r
-    @Override\r
-    protected boolean isResizable() {\r
-        return true;\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java
deleted file mode 100644 (file)
index 64aa906..0000000
+++ /dev/null
@@ -1,488 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.dialogs;\r
-\r
-import java.util.Vector;\r
-\r
-import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
-import org.eclipse.linuxtools.internal.lttng.core.util.EventsPair;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.Messages;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Table;\r
-import org.eclipse.swt.widgets.TableColumn;\r
-import org.eclipse.swt.widgets.TableItem;\r
-\r
-/**\r
- * <b><u>AddDialog</u></b>\r
- * <p>\r
- * Add dialog, lets the user add custom start/end event pairs.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class AddDialog extends AbstractDialog {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * The dialog's start table.\r
-     */\r
-    protected Table fStartTable;\r
-\r
-    /**\r
-     * The dialog's end table.\r
-     */\r
-    protected Table fEndTable;\r
-\r
-    /**\r
-     * The dialog's list table.\r
-     */\r
-    protected Table fListTable;\r
-\r
-    /**\r
-     * Start table columns.\r
-     */\r
-    protected TableColumn[] fStartColumns;\r
-\r
-    /**\r
-     * End table columns.\r
-     */\r
-    protected TableColumn[] fEndColumns;\r
-\r
-    /**\r
-     * List table columns.\r
-     */\r
-    protected TableColumn[] fListColumns;\r
-\r
-    /**\r
-     * Start table column names (header titles).\r
-     */\r
-    static final String[] START_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_Start }; //$NON-NLS-1$\r
-\r
-    /**\r
-     * End table column names (header titles).\r
-     */\r
-    static final String[] END_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_End }; //$NON-NLS-1$\r
-\r
-    /**\r
-     * List table column names (header titles).\r
-     */\r
-    static final String[] LIST_COLUMN_NAMES = {\r
-            "#", //$NON-NLS-1$\r
-            Messages.LatencyView_Dialogs_AddEvents_Columns_List_Trigger,\r
-            Messages.LatencyView_Dialogs_AddEvents_Columns_List_End };\r
-\r
-    /**\r
-     * Column widths.\r
-     */\r
-    static final int[] COLUMN_WIDTHS = { 25, 250, 250 };\r
-\r
-    /**\r
-     * Possible event types.\r
-     */\r
-    protected Vector<String> fEventTypes = new Vector<String>();\r
-\r
-    /**\r
-     * Start event types.\r
-     */\r
-    protected Vector<String> fEventStartTypes;\r
-\r
-    /**\r
-     * End event types.\r
-     */\r
-    protected Vector<String> fEventEndTypes;\r
-\r
-    /**\r
-     * Selected start type.\r
-     */\r
-    protected String fStartType;\r
-\r
-    /**\r
-     * Selected end type.\r
-     */\r
-    protected String fEndType;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param parentShell\r
-     *            The parent shell.\r
-     * @param title\r
-     *            The dialog's window title.\r
-     * @param message\r
-     *            The dialog's window message.\r
-     */\r
-    public AddDialog(Shell parentShell, String title, String message) {\r
-        super(parentShell, title, message);\r
-\r
-        // Get the possible events from the list\r
-        fEventTypes = EventMatcher.getInstance().getTypeList();\r
-\r
-        // Get the list of start and end types from the EventMatcher\r
-        EventsPair pair = getMatchPairs();\r
-        fEventStartTypes = pair.getFirst();\r
-        fEventEndTypes = pair.getSecond();\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Creates the start table's columns (i.e. the table header).\r
-     */\r
-    protected void createStartColumns() {\r
-        fStartColumns = new TableColumn[START_COLUMN_NAMES.length];\r
-        for (int i = 0; i < START_COLUMN_NAMES.length; i++) {\r
-            fStartColumns[i] = new TableColumn(fStartTable, SWT.LEFT);\r
-            fStartColumns[i].setText(START_COLUMN_NAMES[i]);\r
-            fStartColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Creates the end table's columns (i.e. the table header).\r
-     */\r
-    protected void createEndColumns() {\r
-        fEndColumns = new TableColumn[END_COLUMN_NAMES.length];\r
-        for (int i = 0; i < END_COLUMN_NAMES.length; i++) {\r
-            fEndColumns[i] = new TableColumn(fEndTable, SWT.LEFT);\r
-            fEndColumns[i].setText(END_COLUMN_NAMES[i]);\r
-            fEndColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Creates the list table's columns (i.e. the table header).\r
-     */\r
-    protected void createListColumns() {\r
-        fListColumns = new TableColumn[LIST_COLUMN_NAMES.length];\r
-        for (int i = 0; i < LIST_COLUMN_NAMES.length; i++) {\r
-            fListColumns[i] = new TableColumn(fListTable, SWT.LEFT);\r
-            fListColumns[i].setText(LIST_COLUMN_NAMES[i]);\r
-            fListColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Creates the start column list.\r
-     * @param parent\r
-     *            The parent composite.\r
-     */\r
-    protected void createStartColumn(Composite parent) {\r
-        final int style = SWT.SINGLE | SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
-        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
-        fStartTable = new Table(parent, style);\r
-        fStartTable.setLayoutData(layoutData);\r
-\r
-        // Some cosmetic enhancements\r
-        fStartTable.setHeaderVisible(true);\r
-        fStartTable.setLinesVisible(true);\r
-\r
-        createStartColumns();\r
-\r
-        for (int i = 0; i < fEventTypes.size(); i++) {\r
-            TableItem item = new TableItem(fStartTable, SWT.RIGHT);\r
-\r
-            String[] columns = { fEventTypes.get(i), fEventTypes.get(i) };\r
-\r
-            item.setText(columns);\r
-        }\r
-\r
-        fStartTable.setItemCount(fEventTypes.size());\r
-\r
-        fStartTable.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                if (event.detail == SWT.CHECK) {\r
-                    TableItem[] items = fStartTable.getItems();\r
-                    for (TableItem item : items) {\r
-                        if (item != event.item) {\r
-                            item.setChecked(false);\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        });\r
-    }\r
-\r
-    /**\r
-     * Creates the end column list.\r
-     * @param parent\r
-     *            The parent composite.\r
-     */\r
-    protected void createEndColumn(Composite parent) {\r
-        final int style = SWT.SINGLE | SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
-        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
-        fEndTable = new Table(parent, style);\r
-        fEndTable.setLayoutData(layoutData);\r
-\r
-        // Some cosmetic enhancements\r
-        fEndTable.setHeaderVisible(true);\r
-        fEndTable.setLinesVisible(true);\r
-\r
-        createEndColumns();\r
-\r
-        for (int i = 0; i < fEventTypes.size(); i++) {\r
-            TableItem item = new TableItem(fEndTable, SWT.RIGHT);\r
-\r
-            String[] columns = { fEventTypes.get(i), fEventTypes.get(i) };\r
-\r
-            item.setText(columns);\r
-        }\r
-\r
-        fEndTable.setItemCount(fEventTypes.size());\r
-\r
-        fEndTable.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                if (event.detail == SWT.CHECK) {\r
-                    TableItem[] items = fEndTable.getItems();\r
-                    for (TableItem item : items) {\r
-                        if (item != event.item) {\r
-                            item.setChecked(false);\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        });\r
-    }\r
-\r
-    /**\r
-     * Creates the list column for already existing event pairs.\r
-     * @param parent\r
-     *            The parent composite.\r
-     */\r
-    protected void createListColumn(Composite parent) {\r
-        final int style = SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
-        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
-        layoutData.horizontalSpan = 2;\r
-        fListTable = new Table(parent, style);\r
-        fListTable.setLayoutData(layoutData);\r
-\r
-        // Some cosmetic enhancements\r
-        fListTable.setHeaderVisible(true);\r
-        fListTable.setLinesVisible(true);\r
-\r
-        createListColumns();\r
-\r
-        for (int i = 0; i < fEventStartTypes.size(); i++) {\r
-            TableItem item = new TableItem(fListTable, SWT.RIGHT);\r
-\r
-            String max = String.valueOf(fEventStartTypes.size());\r
-            String number = formatListNumber(i + 1, max.length());\r
-\r
-            String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
-\r
-            item.setText(columns);\r
-        }\r
-\r
-        fListTable.setItemCount(103);\r
-        fListTable.remove(fEventTypes.size(), 103 - 1);\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected Control createDialogArea(Composite parent) {\r
-        GridLayout layout = new GridLayout(2, true);\r
-        parent.setLayout(layout);\r
-\r
-        createStartColumn(parent);\r
-        createEndColumn(parent);\r
-        createListColumn(parent);\r
-\r
-        return parent;\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected void createButtonsForButtonBar(Composite parent) {\r
-        GridData gridData = new GridData();\r
-        gridData.verticalAlignment = GridData.FILL;\r
-        gridData.horizontalSpan = 1;\r
-        gridData.grabExcessHorizontalSpace = true;\r
-        gridData.grabExcessVerticalSpace = true;\r
-        gridData.horizontalAlignment = SWT.RIGHT;\r
-\r
-        parent.setLayoutData(gridData);\r
-\r
-        // Create the "Add" button\r
-        Button addButton = createButton(parent, ADD, Messages.LatencyView_Dialogs_AddEvents_Buttons_Add, false);\r
-        addButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                if (isValidInput()) {\r
-                    // Add the event pair to the EventMatcher and save the pairs\r
-                    EventMatcher.getInstance().addMatch(fStartType, fEndType);\r
-                    fEventStartTypes.add(fStartType);\r
-                    fEventEndTypes.add(fEndType);\r
-                    saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
-\r
-                    EventsPair pairs = EventMatcher.getInstance().getEvents();\r
-                    fEventStartTypes = pairs.getFirst();\r
-                    fEventEndTypes = pairs.getSecond();\r
-\r
-                    fListTable.removeAll();\r
-\r
-                    for (int i = 0; i < fEventStartTypes.size(); i++) {\r
-                        TableItem item = new TableItem(fListTable, SWT.RIGHT);\r
-\r
-                        String max = String.valueOf(fEventStartTypes.size());\r
-                        String number = formatListNumber(i + 1, max.length());\r
-\r
-                        String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
-\r
-                        item.setText(columns);\r
-                    }\r
-\r
-                    saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
-                }\r
-\r
-                fRedrawGraphs = true;\r
-            }\r
-        });\r
-\r
-        // Create the "Close" button\r
-        Button closeButton = createButton(parent, CANCEL, Messages.LatencyView_Dialogs_AddEvents_Buttons_Close, false);\r
-        closeButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                setReturnCode(CANCEL);\r
-\r
-                if (fRedrawGraphs == true)\r
-                    redrawGraphs();\r
-\r
-                close();\r
-            }\r
-        });\r
-    }\r
-\r
-    /**\r
-     * Validate the list before adding event pairs.\r
-     * @return "true" if the input is valid, "false" otherwise.\r
-     */\r
-    protected boolean isValidInput() {\r
-        // Remove the previous error message\r
-        setErrorMessage(null);\r
-\r
-        boolean valid = true;\r
-\r
-        // Check if an item from the start list is selected\r
-        TableItem[] items = fStartTable.getItems();\r
-        fStartType = null;\r
-        boolean startHasSelectedItem = false;\r
-        for (int i = 0; i < items.length && !startHasSelectedItem; i++) {\r
-            if (items[i].getChecked() == true) {\r
-                fStartType = items[i].getText();\r
-                startHasSelectedItem = true;\r
-            }\r
-        }\r
-\r
-        // Check if an item from the end list is selected\r
-        items = fEndTable.getItems();\r
-        fEndType = null;\r
-        boolean endHasSelectedItem = false;\r
-        for (int i = 0; i < items.length && !endHasSelectedItem; i++) {\r
-            if (items[i].getChecked() == true) {\r
-                fEndType = items[i].getText();\r
-                endHasSelectedItem = true;\r
-            }\r
-        }\r
-\r
-        // Print error message if needed.\r
-        if (!startHasSelectedItem && !endHasSelectedItem) {\r
-            setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_NoSelection);\r
-            valid = false;\r
-        } else if (!startHasSelectedItem) {\r
-            setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_StartNotSelected);\r
-            valid = false;\r
-        } else if (!endHasSelectedItem) {\r
-            setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_EndNotSelected);\r
-            valid = false;\r
-        }\r
-\r
-        // Check if the same item is selected in both lists\r
-        if (startHasSelectedItem && endHasSelectedItem) {\r
-            if (fStartType.equalsIgnoreCase(fEndType)) {\r
-                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_SameSelected);\r
-                valid = false;\r
-            }\r
-        }\r
-\r
-        // Check if the selected item is already in the list\r
-        if (startHasSelectedItem && endHasSelectedItem) {\r
-            EventsPair pairs = getMatchPairs();\r
-            Vector<String> startEvents = pairs.getFirst();\r
-            Vector<String> endEvents = pairs.getSecond();\r
-\r
-            boolean startAlreadyUsed = false;\r
-            boolean endAlreadyUsed = false;\r
-            boolean startAsEndAlreadyUsed = false;\r
-            boolean endAsStartAlreadyUsed = false;\r
-\r
-            if (startEvents.contains(fStartType)) {\r
-                startAlreadyUsed = true;\r
-            }\r
-            if (endEvents.contains(fEndType)) {\r
-                endAlreadyUsed = true;\r
-            }\r
-            if (startEvents.contains(fEndType)) {\r
-                endAsStartAlreadyUsed = true;\r
-            }\r
-            if (endEvents.contains(fStartType)) {\r
-                startAsEndAlreadyUsed = true;\r
-            }\r
-\r
-            if (startAlreadyUsed && endAlreadyUsed) {\r
-                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_AlreadyMatched);\r
-                valid = false;\r
-            } else if (startAlreadyUsed) {\r
-                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_StartAlreadyMatched);\r
-                valid = false;\r
-            } else if (endAlreadyUsed) {\r
-                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_EndAlreadyMatched);\r
-                valid = false;\r
-            }\r
-\r
-            if (startAsEndAlreadyUsed) {\r
-                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_StartAsEnd);\r
-                valid = false;\r
-            }\r
-            if (endAsStartAlreadyUsed) {\r
-                setErrorMessage(Messages.LatencyView_Dialogs_AddEvents_Errors_EndAsStart);\r
-                valid = false;\r
-            }\r
-        }\r
-\r
-        return valid;\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java
deleted file mode 100644 (file)
index 450aecd..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.dialogs;\r
-\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.Messages;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.TableItem;\r
-\r
-/**\r
- * <b><u>DeleteDialog</u></b>\r
- * <p>\r
- * Remove dialog, lets the user remove start/end event pairs.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class DeleteDialog extends ListDialog {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param parentShell\r
-     *            The parent shell.\r
-     * @param title\r
-     *            The dialog's window title.\r
-     * @param message\r
-     *            The dialog's window message.\r
-     */\r
-    public DeleteDialog(Shell parentShell, String title, String message) {\r
-        super(parentShell, title, message);\r
-\r
-        // Set the table style\r
-        fStyle = SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.ListDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected void createButtonsForButtonBar(Composite parent) {\r
-        GridData gridData = new GridData();\r
-        gridData.verticalAlignment = GridData.FILL;\r
-        gridData.horizontalSpan = 1;\r
-        gridData.grabExcessHorizontalSpace = true;\r
-        gridData.grabExcessVerticalSpace = true;\r
-        gridData.horizontalAlignment = SWT.RIGHT;\r
-\r
-        parent.setLayoutData(gridData);\r
-\r
-        // Create the "Delete" button\r
-        Button deleteButton = createButton(parent, DELETE, Messages.LatencyView_Dialogs_DeleteEvents_Buttons_Delete, false);\r
-        deleteButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                TableItem selectedItem = fTable.getSelection()[0];\r
-                if (selectedItem == null)\r
-                    return;\r
-\r
-                int[] selectedIndices = fTable.getSelectionIndices();\r
-\r
-                StringBuffer deletePairs = new StringBuffer(""); //$NON-NLS-1$\r
-                for (int i = 0; i < selectedIndices.length; i++) {\r
-                    int index = selectedIndices[i];\r
-                    deletePairs.append("\t* ").append(fEventStartTypes.get(index)).append(" / ").append(fEventEndTypes.get(index)); //$NON-NLS-1$ //$NON-NLS-2$\r
-\r
-                    if (i < selectedIndices.length - 1) {\r
-                        deletePairs.append("\n"); //$NON-NLS-1$\r
-                    }\r
-                }\r
-\r
-                boolean confirmDeletion = MessageDialog.openQuestion(getShell(), Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Title,\r
-                        Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Message + "\n\n" + deletePairs.toString()); //$NON-NLS-1$\r
-\r
-                if (confirmDeletion) {\r
-                    // Remove the events starting from the end of the list, otherwise the TableItem elements will lose\r
-                    // their index from the table and may trigger an exception when removing an index that is no longer\r
-                    // valid.\r
-                    for (int i = selectedIndices.length - 1; i >= 0; i--) {\r
-                        int selectedIndex = selectedIndices[i];\r
-                        EventMatcher.getInstance().removeMatch(fEventStartTypes.get(selectedIndex), fEventEndTypes.get(selectedIndex));\r
-\r
-                        fTable.remove(selectedIndex);\r
-\r
-                        // Update the list of events\r
-                        fEventStartTypes.remove(selectedIndex);\r
-                        fEventEndTypes.remove(selectedIndex);\r
-                    }\r
-\r
-                    // Save the events pairs in the settings file so it can be retrieved in the next session\r
-                    saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
-\r
-                    fTable.setItemCount(fEventStartTypes.size());\r
-\r
-                    TableItem[] newItems = fTable.getItems();\r
-                    fTable.removeAll();\r
-                    for (int i = 0; i < newItems.length; i++) {\r
-                        TableItem item = new TableItem(fTable, SWT.RIGHT);\r
-\r
-                        String max = String.valueOf(fEventStartTypes.size());\r
-                        String number = formatListNumber(i + 1, max.length());\r
-\r
-                        String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
-\r
-                        item.setText(columns);\r
-                    }\r
-\r
-                    fRedrawGraphs = true;\r
-                }\r
-            }\r
-        });\r
-\r
-        // Create the "Close" button\r
-        Button closeButton = createButton(parent, CANCEL, Messages.LatencyView_Dialogs_AddEvents_Buttons_Close, false);\r
-        closeButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                // Remember the user's list\r
-                saveMatchPairs(fEventStartTypes, fEventEndTypes);\r
-\r
-                setReturnCode(CANCEL);\r
-\r
-                if (fRedrawGraphs == true)\r
-                    redrawGraphs();\r
-\r
-                close();\r
-            }\r
-        });\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java
deleted file mode 100644 (file)
index dc795f4..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new messages file, fixed warnings\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.dialogs;\r
-\r
-import java.util.Vector;\r
-\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;\r
-import org.eclipse.linuxtools.internal.lttng.core.util.EventsPair;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.Messages;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.swt.widgets.Table;\r
-import org.eclipse.swt.widgets.TableColumn;\r
-import org.eclipse.swt.widgets.TableItem;\r
-\r
-/**\r
- * <b><u>ListDialog</u></b>\r
- * <p>\r
- * List dialog, shows the list of start/end event pairs.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class ListDialog extends AbstractDialog {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * The dialog's table.\r
-     */\r
-    protected Table fTable;\r
-\r
-    /**\r
-     * Start event types.\r
-     */\r
-    protected Vector<String> fEventStartTypes;\r
-\r
-    /**\r
-     * End event types.\r
-     */\r
-    protected Vector<String> fEventEndTypes;\r
-\r
-    /**\r
-     * Table columns\r
-     */\r
-    protected TableColumn[] fColumns;\r
-\r
-    /**\r
-     * Column names (header titles).\r
-     */\r
-    static final String[] COLUMN_NAMES = { "#", Messages.LatencyView_Dialogs_ListEvents_Columns_Trigger, Messages.LatencyView_Dialogs_ListEvents_Columns_End }; //$NON-NLS-1$\r
-\r
-    /**\r
-     * Column widths.\r
-     */\r
-    static final int[] COLUMN_WIDTHS = { 25, 250, 250 };\r
-\r
-    /**\r
-     * The table style.\r
-     */\r
-    protected int fStyle;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructor\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param parentShell\r
-     *            The parent shell.\r
-     * @param title\r
-     *            The dialog's window title.\r
-     * @param message\r
-     *            The dialog's window message.\r
-     */\r
-    public ListDialog(Shell parentShell, String title, String message) {\r
-        super(parentShell, title, message);\r
-\r
-        // Set the table style\r
-        fStyle = SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL;\r
-\r
-        // Get the list of start and end types from the EventMatcher\r
-        EventsPair pair = getMatchPairs();\r
-        fEventStartTypes = pair.getFirst();\r
-        fEventEndTypes = pair.getSecond();\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Creates the table's column (i.e. the table header).\r
-     */\r
-    protected void createColumns() {\r
-        fColumns = new TableColumn[COLUMN_NAMES.length];\r
-        for (int i = 0; i < COLUMN_NAMES.length; i++) {\r
-            fColumns[i] = new TableColumn(fTable, SWT.LEFT);\r
-            fColumns[i].setText(COLUMN_NAMES[i]);\r
-            fColumns[i].setWidth(COLUMN_WIDTHS[i]);\r
-        }\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected Control createDialogArea(Composite parent) {\r
-        GridLayout layout = new GridLayout(1, true);\r
-        parent.setLayout(layout);\r
-\r
-        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);\r
-        fTable = new Table(parent, fStyle);\r
-        fTable.setLayoutData(layoutData);\r
-\r
-        // Some cosmetic enhancements\r
-        fTable.setHeaderVisible(true);\r
-        fTable.setLinesVisible(true);\r
-\r
-        createColumns();\r
-\r
-        for (int i = 0; i < fEventStartTypes.size(); i++) {\r
-            TableItem item = new TableItem(fTable, SWT.RIGHT);\r
-\r
-            String max = String.valueOf(fEventStartTypes.size());\r
-            String number = formatListNumber(i + 1, max.length());\r
-\r
-            String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
-\r
-            item.setText(columns);\r
-        }\r
-\r
-        return parent;\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.dialogs.AbstractDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    @Override\r
-    protected void createButtonsForButtonBar(Composite parent) {\r
-        GridData gridData = new GridData();\r
-        gridData.verticalAlignment = GridData.FILL;\r
-        gridData.horizontalSpan = 1;\r
-        gridData.grabExcessHorizontalSpace = true;\r
-        gridData.grabExcessVerticalSpace = true;\r
-        gridData.horizontalAlignment = SWT.RIGHT;\r
-\r
-        parent.setLayoutData(gridData);\r
-\r
-        // Create the "Reset" button\r
-        Button resetButton = createButton(parent, RESET, Messages.LatencyView_Dialogs_ListEvents_Buttons_Reset, false);\r
-        resetButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                boolean confirmDeletion = MessageDialog.openQuestion(getShell(), Messages.LatencyView_Dialogs_ListEvents_Confirm_Title,\r
-                        Messages.LatencyView_Dialogs_ListEvents_Confirm_Message);\r
-\r
-                if (confirmDeletion) {\r
-                    EventMatcher.getInstance().resetMatches();\r
-\r
-                    fTable.removeAll();\r
-\r
-                    Vector<String> defaultStarts = new Vector<String>();\r
-                    Vector<String> defaultEnds = new Vector<String>();\r
-\r
-                    defaultStarts.add(EventMatcher.PAGE_FAULT_GET_USER_ENTRY);\r
-                    defaultEnds.add(EventMatcher.PAGE_FAULT_GET_USER_EXIT);\r
-                    defaultStarts.add(EventMatcher.TASKLET_LOW_ENTRY);\r
-                    defaultEnds.add(EventMatcher.TASKLET_LOW_EXIT);\r
-                    defaultStarts.add(EventMatcher.PAGE_FAULT_ENTRY);\r
-                    defaultEnds.add(EventMatcher.PAGE_FAULT_EXIT);\r
-                    defaultStarts.add(EventMatcher.SYSCALL_ENTRY);\r
-                    defaultEnds.add(EventMatcher.SYSCALL_EXIT);\r
-                    defaultStarts.add(EventMatcher.IRQ_ENTRY);\r
-                    defaultEnds.add(EventMatcher.IRQ_EXIT);\r
-                    defaultStarts.add(EventMatcher.READ);\r
-                    defaultEnds.add(EventMatcher.WRITE);\r
-                    defaultStarts.add(EventMatcher.OPEN);\r
-                    defaultEnds.add(EventMatcher.CLOSE);\r
-                    defaultStarts.add(EventMatcher.BUFFER_WAIT_START);\r
-                    defaultEnds.add(EventMatcher.BUFFER_WAIT_END);\r
-                    defaultStarts.add(EventMatcher.START_COMMIT);\r
-                    defaultEnds.add(EventMatcher.END_COMMIT);\r
-                    defaultStarts.add(EventMatcher.WAIT_ON_PAGE_START);\r
-                    defaultEnds.add(EventMatcher.WAIT_ON_PAGE_END);\r
-\r
-                    saveMatchPairs(defaultStarts, defaultEnds);\r
-\r
-                    for (int i = 0; i < defaultStarts.size(); i++) {\r
-                        EventMatcher.getInstance().addMatch(defaultStarts.get(i), defaultEnds.get(i));\r
-                    }\r
-\r
-                    // Get the list of start and end types from the EventMatcher\r
-                    EventsPair pair = getMatchPairs();\r
-                    fEventStartTypes = pair.getFirst();\r
-                    fEventEndTypes = pair.getSecond();\r
-\r
-                    for (int i = 0; i < fEventStartTypes.size(); i++) {\r
-                        TableItem item = new TableItem(fTable, SWT.RIGHT);\r
-\r
-                        String max = String.valueOf(fEventStartTypes.size());\r
-                        String number = formatListNumber(i + 1, max.length());\r
-\r
-                        String[] columns = { number, fEventStartTypes.get(i), fEventEndTypes.get(i) };\r
-\r
-                        item.setText(columns);\r
-                    }\r
-\r
-                    fTable.setItemCount(fEventStartTypes.size());\r
-\r
-                    fRedrawGraphs = true;\r
-                }\r
-            }\r
-        });\r
-\r
-        // Create the "Close" button\r
-        Button closeButton = createButton(parent, CANCEL, Messages.LatencyView_Dialogs_ListEvents_Buttons_Close, false);\r
-        closeButton.addListener(SWT.Selection, new Listener() {\r
-            @Override\r
-            public void handleEvent(Event event) {\r
-                setReturnCode(CANCEL);\r
-\r
-                if (fRedrawGraphs == true)\r
-                    redrawGraphs();\r
-\r
-                close();\r
-            }\r
-        });\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractMouseListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractMouseListener.java
deleted file mode 100644 (file)
index 3d3b1a0..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;
-
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-
-/**
- * <b><u>AbstractMouseListener</u></b>
- * <p>
- */
-public abstract class AbstractMouseListener implements MouseListener {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /**
-     * Mouse x-coordinate.
-     */
-    protected int fMouseX;
-    
-    /**
-     * Mouse y-coordinate.
-     */
-    protected int fMouseY;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
-     */
-    @Override
-    public void mouseDoubleClick(MouseEvent e) {
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
-     */
-    @Override
-    public void mouseDown(MouseEvent e) {
-        fMouseX = e.x;
-        fMouseY = e.y;
-        display();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
-     */
-    @Override
-    public void mouseUp(MouseEvent e) {
-    }
-    
-    /**
-     * Callback to display information at the current x-y position
-     */
-    protected abstract void display();
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractMouseTrackListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractMouseTrackListener.java
deleted file mode 100644 (file)
index b4e53fe..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors: \r
- * Philippe Sawicki (INF4990.A2010@gmail.com) - Initial API and implementation \r
- * Mathieu Denis (mathieu.denis55@gmail.com) - Refactored code\r
- * Bernd Hufmann - Changed implemented interface to MouseTraceListener\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import org.eclipse.swt.events.MouseEvent;\r
-import org.eclipse.swt.events.MouseTrackListener;\r
-\r
-/**\r
- *  <b><u>AbstractMouseListener</u></b>\r
- * <p>\r
- * AbstractMouseListener, base class for the canvas mouse listener.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public abstract class AbstractMouseTrackListener implements MouseTrackListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Mouse x-coordinate.\r
-     */\r
-    protected int fMouseX;\r
-    /**\r
-     * Mouse y-coordinate.\r
-     */\r
-    protected int fMouseY;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)\r
-     */\r
-    @Override\r
-    public void mouseEnter(MouseEvent event) {\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)\r
-     */\r
-    @Override\r
-    public void mouseExit(MouseEvent event) {\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)\r
-     */\r
-    @Override\r
-    public void mouseHover(MouseEvent event) {\r
-        fMouseX = event.x;\r
-        fMouseY = event.y;\r
-        display();\r
-    }\r
-\r
-    /**\r
-     * Tooltip display callback.\r
-     */\r
-    protected abstract void display();\r
-\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractPaintListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/AbstractPaintListener.java
deleted file mode 100644 (file)
index ef1a38c..0000000
+++ /dev/null
@@ -1,735 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design, display improvements\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.Config;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.PaintEvent;\r
-import org.eclipse.swt.events.PaintListener;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.Font;\r
-import org.eclipse.swt.graphics.GC;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.widgets.Display;\r
-\r
-/**\r
- * <b><u>AbstractPaintListener</u></b>\r
- * <p> \r
- * Abstract paint listener. Draws the graphs on the view canvas.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public abstract class AbstractPaintListener implements PaintListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     *  Default colors and fonts\r
-     */\r
-    protected final Color DEFAULT_DATA_COLOR = new Color(Display.getDefault(), 74, 112, 139);\r
-    protected final static Color DEFAULT_LABEL_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);\r
-    protected final static Color DEFAULT_TEXT_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);\r
-    protected final static Color DEFAULT_DATA_BACKGROUND_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);\r
-    protected final static Color DEFAULT_CURRENT_EVENT_COLOR = Display.getCurrent().getSystemColor(SWT.COLOR_RED);\r
-\r
-    protected final Font DEFAULT_TITLE_FONT = new Font(Display.getDefault(), "Arial", 10, SWT.BOLD); //$NON-NLS-1$\r
-    protected final Font DEFAULT_VALUES_FONT = new Font(Display.getDefault(), "Arial", 7, SWT.NORMAL); //$NON-NLS-1$\r
-    protected final Font DEFAULT_LABEL_FONT = new Font(Display.getDefault(), "Arial", 8, SWT.NORMAL); //$NON-NLS-1$\r
-    \r
-    /**\r
-     * A reference to the listener's view.\r
-     */\r
-    protected AbstractViewer fViewer;\r
-\r
-    /**\r
-     * Graph title\r
-     */\r
-    protected String fGraphTitle;\r
-\r
-    /**\r
-     * X-axis label.\r
-     */\r
-    protected String fXAxisLabel;\r
-    \r
-    /**\r
-     * Y-axis label.\r
-     */\r
-    protected String fYAxisLabel;\r
-\r
-    /**\r
-     * Horizontal offset for the x-axis label.\r
-     */\r
-    protected int fXAxisLabelOffset;\r
-\r
-    /**\r
-     * Vertical offset for the horizontal axis offset.\r
-     */\r
-    protected int fHorizontalAxisYOffset = 20;\r
-\r
-    /**\r
-     * Graph padding.\r
-     */\r
-    protected int fPadding = Config.GRAPH_PADDING;\r
-\r
-    /**\r
-     * Graph client area.\r
-     */\r
-    protected Rectangle fClientArea = new Rectangle(0, 0, 1, 1);\r
-\r
-    /**\r
-     * Foreground color.\r
-     */\r
-    protected Color fForegroundColor;\r
-    \r
-    /**\r
-     * Background color.\r
-     */\r
-    protected Color fBackgroundColor;\r
-    \r
-    /**\r
-     * Data plotting color.\r
-     */\r
-    protected Color fDataColor;\r
-    \r
-    /**\r
-     * Axis label color.\r
-     */\r
-    protected Color fLabelColor;\r
-    \r
-    /**\r
-     * Text color.\r
-     */\r
-    protected Color fTextColor;\r
-    \r
-    /**\r
-     * Data background color.\r
-     */\r
-    protected Color fDataBackgroundColor;\r
-\r
-    /**\r
-     * Color for current event time line.\r
-     */\r
-    protected Color fCurrentEventColor;\r
-\r
-    /**\r
-     * Original canvas font.\r
-     */\r
-    protected Font fOriginalFont;\r
-\r
-    /**\r
-     * Font for the title of the graph.\r
-     */\r
-    protected Font fTitleFont;\r
-\r
-    /**\r
-     * Font for the values on the horizontal and vertical axis.\r
-     */\r
-    protected Font fValuesFont;\r
-\r
-    /**\r
-     * Font for the horizontal and vertical labels.\r
-     */\r
-    protected Font fLabelFont;\r
-\r
-    /**\r
-     * Horizontal offset for the axis arrow.\r
-     */\r
-    protected final int ARROW_DELTA_X = 10;\r
-\r
-    /**\r
-     * Vertical offset for the axis arrow.\r
-     */\r
-    protected final int ARROW_DELTA_Y = 4;\r
-\r
-    /**\r
-     * Max horizontal distance between ticks.\r
-     */\r
-    protected final int MAX_WIDTH_BETWEEN_TICKS = 40;\r
-\r
-    /**\r
-     * Max vertical distance between ticks.\r
-     */\r
-    protected final int MAX_HEIGHT_BETWEEN_TICKS = 30;\r
-\r
-    /**\r
-     * Max characters that can be displayed on the vertical axis.\r
-     */\r
-    protected final int MAX_CHAR_VERTICAL_DISPLAY = 5;\r
-\r
-    /**\r
-     * Draw label each "drawLabelEachNTicks_" ticks.\r
-     */\r
-    protected int fDrawLabelEachNTicks = 1;\r
-\r
-    /**\r
-     * Image drawn on the canvas.\r
-     */\r
-    protected Image fImage;\r
-\r
-    /**\r
-     * Paint canvas, where the values are plotted.\r
-     */\r
-    protected GC fAxisImage;\r
-\r
-    /**\r
-     * Is the paint listener initialized ?\r
-     */\r
-    protected boolean fInitialized = false;\r
-\r
-    /**\r
-     * Draw area.\r
-     */\r
-    protected Rectangle fDrawArea;\r
-\r
-    /**\r
-     * Right padding (in pixels).\r
-     */\r
-    protected int fPaddingRight = Config.GRAPH_PADDING;\r
-\r
-    /**\r
-     * Top padding (in pixels).\r
-     */\r
-    protected int fPaddingTop = Config.GRAPH_PADDING;\r
-\r
-    /**\r
-     * Vertical axis offset (in pixels).\r
-     */\r
-    protected int fVerticalAxisOffset = 2 * Config.GRAPH_PADDING;\r
-\r
-    /**\r
-     * Vertical axis factor for values (10^delta). When values larger than MAX_CHAR_VERTICAL_DISPLAY.\r
-     */\r
-    protected int fDelta = 0;\r
-\r
-    /**\r
-     * The barWidth of a bar\r
-     */\r
-    protected int fBarWith = Config.DEFAULT_HISTOGRAM_BAR_WIDTH;\r
-\r
-    /**\r
-     * Minimum value on horizontal axis\r
-     */\r
-    protected long fXMin = -1;\r
-\r
-    /**\r
-     * Maximum value on horizontal axis\r
-     */\r
-    protected long fXMax = -1;\r
-\r
-    /**\r
-     * Minimum value on vertical axis\r
-     */\r
-    protected long fYMin = -1;\r
-\r
-    /**\r
-     * Maximum value on vertical axis\r
-     */\r
-    protected long fYMax = -1;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Constructor.\r
-     * @param view\r
-     *            A reference to the listener's view.\r
-     */\r
-    public AbstractPaintListener(AbstractViewer view) {\r
-        fViewer = view;\r
-        fDataColor = DEFAULT_DATA_COLOR;\r
-        fLabelColor = DEFAULT_LABEL_COLOR;\r
-        fTextColor = DEFAULT_TEXT_COLOR;\r
-        fDataBackgroundColor = DEFAULT_DATA_BACKGROUND_COLOR;\r
-        fCurrentEventColor = DEFAULT_CURRENT_EVENT_COLOR;\r
-        \r
-        fTitleFont = DEFAULT_TITLE_FONT;\r
-        fValuesFont = DEFAULT_VALUES_FONT;\r
-        fLabelFont = DEFAULT_LABEL_FONT;\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Accessors\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Returns the draw area height.\r
-     * @return The draw area height.\r
-     */\r
-    public double getHeight() {\r
-        return (fClientArea.height - 2.0 * fPadding - fHorizontalAxisYOffset - fPaddingTop);\r
-    }\r
-\r
-    /**\r
-     * Returns the histogram's draw area width.\r
-     * @return The histogram's draw area width.\r
-     */\r
-    public double getWidth() {\r
-        return (fClientArea.width - 2.0 * fPadding - fVerticalAxisOffset - fPaddingRight);  // width of the plot area;\r
-    }\r
-\r
-    /**\r
-     * Returns the histogram's draw area padding.\r
-     * @return The histogram's draw area padding.\r
-     */\r
-    public int getPadding() {\r
-        return fPadding;\r
-    }\r
-\r
-    /**\r
-     * Returns the histogram's draw area top padding.\r
-     * @return The histogram's draw area top padding.\r
-     */\r
-    public int getPaddingTop() {\r
-        return fPaddingTop;\r
-    }\r
-\r
-    /**\r
-     * Returns the histogram's vertical axis offset.\r
-     * @return The histogram's vertical axis offset.\r
-     */\r
-    public int getVerticalAxisOffset() {\r
-        return fVerticalAxisOffset;\r
-    }\r
-\r
-    /**\r
-     * Returns the histogram's horizontal axis offset.\r
-     * @return The histogram's horizontal axis offset.\r
-     */\r
-    public int getHorizontalAxisYOffset() {\r
-        return fHorizontalAxisYOffset;\r
-    }\r
-\r
-    /**\r
-     *  Returns the horizontal minimum value\r
-     *  @return The horizontal minimum value.\r
-     */\r
-    public long getXMin() {\r
-        return fXMin;\r
-    }\r
-\r
-    /**\r
-     *  Returns the horizontal maximum value\r
-     *  @return The horizontal maximum value.\r
-     */\r
-    public long getXMax() {\r
-        return fXMax;\r
-    }\r
-\r
-    /**\r
-     *  Returns the horizontal minimum value\r
-     *  @return The horizontal minimum value.\r
-     */\r
-    public long getYMin() {\r
-        return fYMin;\r
-    }\r
-\r
-    /**\r
-     *  Returns the vertical maximum value\r
-     *  @return The vertical maximum value.\r
-     */\r
-    public long getYMax() {\r
-        return fYMax;\r
-    }\r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Disposes local resources (e.g. colors or fonts)\r
-     */\r
-    public void dispose() {\r
-        DEFAULT_DATA_COLOR.dispose();\r
-        DEFAULT_TITLE_FONT.dispose();\r
-        DEFAULT_VALUES_FONT.dispose();\r
-        DEFAULT_LABEL_FONT.dispose();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)\r
-     */\r
-    @Override\r
-    public void paintControl(PaintEvent e) {\r
-        fClientArea = fViewer.getClientArea();\r
-\r
-        fForegroundColor = e.gc.getForeground();\r
-        fBackgroundColor = e.gc.getBackground();\r
-        fOriginalFont = e.gc.getFont();\r
-\r
-        scale();\r
-        \r
-        if (!fInitialized) {\r
-            fImage = new Image(Display.getDefault(), fViewer.getBounds());\r
-\r
-            fAxisImage = new GC(fImage);\r
-\r
-            fAxisImage.setForeground(fForegroundColor);\r
-            fAxisImage.setBackground(fBackgroundColor);\r
-            fAxisImage.fillRectangle(fImage.getBounds());\r
-\r
-            fInitialized = true;\r
-        }\r
-        \r
-        paintGraphTitle();\r
-        paintBackground();     \r
-        paintHorizontalAxis();\r
-        paintVerticalAxis();\r
-        paintContent();\r
-\r
-        e.gc.drawImage(fImage, 0, 0);\r
-    }\r
-\r
-    /**\r
-     * Paints the title of the graph.\r
-     */\r
-    public void paintGraphTitle() {\r
-        if (fGraphTitle != null) {\r
-            fAxisImage.setFont(fTitleFont);\r
-            fAxisImage.setForeground(fLabelColor);\r
-            fAxisImage.setBackground(fBackgroundColor);\r
-\r
-            int zoomFactor = fViewer.getZoomFactor() / fViewer.getZoomIncrement() + 1;\r
-            int labelWidth = fAxisImage.stringExtent(fGraphTitle).x;\r
-            // Draws the zoom factor in the title only if there is one\r
-            if (fViewer.getZoomFactor() > 1)\r
-                fAxisImage.drawText(fGraphTitle + " (" + zoomFactor + "x)", (fViewer.getBounds().width - fPadding - labelWidth) / 2, 0); //$NON-NLS-1$ //$NON-NLS-2$\r
-            else\r
-                fAxisImage.drawText(fGraphTitle, (fViewer.getBounds().width - fPadding - labelWidth) / 2, 0);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Paints the background of the draw area.\r
-     */\r
-    public void paintBackground() {\r
-        fAxisImage.setBackground(fDataBackgroundColor);\r
-\r
-        fAxisImage.fillRectangle(fPadding + fVerticalAxisOffset, fPadding + fPaddingTop, (int)getWidth() + 1, (int)getHeight());\r
-    }\r
-\r
-    /**\r
-     * Paints the horizontal axis.\r
-     */\r
-    public void paintHorizontalAxis() {\r
-        fAxisImage.setForeground(fForegroundColor);\r
-\r
-        int y = fClientArea.height - fPadding - fHorizontalAxisYOffset;\r
-\r
-        fAxisImage.drawLine(fClientArea.x + fPadding + fVerticalAxisOffset, y, fClientArea.width - fPadding, y);\r
-\r
-        paintHorizontalArrow(fClientArea.width - fPadding, y);\r
-        // Draw the axis graphic details only if there are some data points (i.e. do not draw the axis graphic details\r
-        // if the window timerange is so small that no latency can be computed, or if there are no matching events in\r
-        // the timerange (for example, when an experiment has many traces with a large time gap between the logged\r
-        // events sets).\r
-        if (fXMin != Long.MAX_VALUE && fXMax != Long.MIN_VALUE && fXMin != fXMax) {\r
-            paintHorizontalTicks(y);\r
-            paintHorizontalAxisValues(y + 30);\r
-        }\r
-        paintHorizontalAxisLabel(y + fHorizontalAxisYOffset - 5);\r
-    }\r
-\r
-    /**\r
-     * Paints the vertical axis.\r
-     */\r
-    public void paintVerticalAxis() {\r
-        fAxisImage.setForeground(fForegroundColor);\r
-\r
-        int x = fClientArea.x + fPadding + fVerticalAxisOffset;\r
-\r
-        fAxisImage.drawLine(x, fPadding, x, fClientArea.height - fPadding - fHorizontalAxisYOffset);\r
-\r
-        paintVerticalArrow(x, fClientArea.y + fPadding);\r
-        // Draw the axis graphic details only if there are some data points (i.e. do not draw the axis graphic details\r
-        // if the window timerange is so small that no latency can be computed, or if there are no matching events in\r
-        // the timerange (for example, when an experiment has many traces with a large time gap between the logged\r
-        // events sets).\r
-        if (fXMin != Long.MAX_VALUE && fXMax != Long.MIN_VALUE && fXMin != fXMax) {\r
-            paintVerticalTicks(x);\r
-            paintVerticalAxisValues(x);\r
-        }\r
-        paintVerticalAxisLabel(x);\r
-    }\r
-\r
-    /**\r
-     * Paints the arrow on the horizontal axis.\r
-     * @param x\r
-     *            The x-coordinate of the point where the arrow points.\r
-     * @param y\r
-     *            The y-coordinate of the point where the arrow points.\r
-     */\r
-    public void paintHorizontalArrow(int x, int y) {\r
-        // Arrow top line\r
-        fAxisImage.drawLine(x - ARROW_DELTA_X, y - ARROW_DELTA_Y, x, y);\r
-        // Arrow bottom line\r
-        fAxisImage.drawLine(x - ARROW_DELTA_X, y + ARROW_DELTA_Y, x, y);\r
-    }\r
-\r
-    /**\r
-     * Paints the arrow on the vertical axis.\r
-     * @param x\r
-     *            The x-coordinate of the point where the arrow points.\r
-     * @param y\r
-     *            The y-coordinate of the point where the arrow points.\r
-     */\r
-    public void paintVerticalArrow(int x, int y) {\r
-        // Arrow left line\r
-        fAxisImage.drawLine(x - ARROW_DELTA_Y, y + ARROW_DELTA_X, x, y);\r
-        // Arrow right line\r
-        fAxisImage.drawLine(x + ARROW_DELTA_Y, y + ARROW_DELTA_X, x, y);\r
-    }\r
-\r
-    /**\r
-     * Paints the horizontal ticks.\r
-     * @param y\r
-     *            The y coordinate where to draw the axis.\r
-     */\r
-    public void paintHorizontalTicks(int y) {\r
-        if (fXMin >= 0L && fXMax >= 0L) {\r
-            int nbTicks = (int)(getWidth()) / MAX_WIDTH_BETWEEN_TICKS + 1;\r
-\r
-            for (int i = 0; i < nbTicks; i++) {\r
-                if (i % fDrawLabelEachNTicks == 0) {\r
-                    int x = i * MAX_WIDTH_BETWEEN_TICKS + fPadding + fVerticalAxisOffset;\r
-                    fAxisImage.drawLine(x, y, x, y + 3);\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Paints the horizontal axis values.\r
-     * @param y\r
-     *            The y coordinate where to draw the axis.\r
-     */\r
-    public void paintHorizontalAxisValues(int y) {\r
-        if (fXMin >= 0L && fXMax >= 0L) {\r
-            fAxisImage.setForeground(fTextColor);\r
-            fAxisImage.setBackground(fBackgroundColor);\r
-\r
-            double width = getWidth();\r
-            int nbTicks = ((int)getWidth()) / MAX_WIDTH_BETWEEN_TICKS + 1;\r
-\r
-            for (int i = 0; i < nbTicks; i++) {\r
-                if (i % fDrawLabelEachNTicks == 0) {\r
-                    int x = i * MAX_WIDTH_BETWEEN_TICKS + fPadding + fVerticalAxisOffset;\r
-                    \r
-                    long currentValue = (i * MAX_WIDTH_BETWEEN_TICKS)* (long)((fXMax - fXMin) / width) + fXMin;\r
-                    String currentLabel = formatStringForHorizontalAxis(currentValue);\r
-\r
-                    fAxisImage.setFont(fValuesFont);\r
-                    fAxisImage.drawText(currentLabel, x, y - 24);\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Paints the horizontal axis label.\r
-     * @param y\r
-     *            The y-coordinate where to draw the label.\r
-     */\r
-    public void paintHorizontalAxisLabel(int y) {\r
-        if (fXAxisLabel != null) {\r
-            fAxisImage.setFont(fLabelFont);\r
-            fAxisImage.setForeground(fLabelColor);\r
-\r
-            int labelWidth = fAxisImage.stringExtent(fXAxisLabel).x;\r
-\r
-            fAxisImage.drawText(fXAxisLabel, fClientArea.width - fPadding - labelWidth, y);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Paints the vertical axis ticks.\r
-     * @param x\r
-     *            The x-coordinate where to draw the ticks.\r
-     */\r
-    public void paintVerticalTicks(int x) {\r
-        if (fYMin != 0L && fYMax != 0L) {\r
-            int nbTicks = (int)(getHeight() / MAX_HEIGHT_BETWEEN_TICKS + 1);\r
-\r
-            for (int i = 0; i < nbTicks; i++) {\r
-                int y = fClientArea.height - fPadding - fHorizontalAxisYOffset - i * MAX_HEIGHT_BETWEEN_TICKS;\r
-                fAxisImage.drawLine(x - 3, y, x, y);\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Paints the vertical axis values.\r
-     * @param x\r
-     *            The x-coordinate where to draw the values.\r
-     */\r
-    public void paintVerticalAxisValues(int x) {\r
-        if (fYMin >= 0L && fYMax >= 0L) {\r
-            fAxisImage.setForeground(fTextColor);\r
-            fAxisImage.setBackground(fBackgroundColor);\r
-\r
-            double height = getHeight();\r
-            int nbTicks = (int)(height / MAX_HEIGHT_BETWEEN_TICKS + 1);\r
-\r
-            // System.out.println("nbTicks = " + nbTicks);\r
-\r
-            for (int i = 0; i < nbTicks; i++) {\r
-                int y = fClientArea.height - fPadding - fHorizontalAxisYOffset - i * MAX_HEIGHT_BETWEEN_TICKS;\r
-\r
-                long currentValue = (i * MAX_HEIGHT_BETWEEN_TICKS)* (long)((fYMax - fYMin) / height) + fYMin;\r
-                String currentLabel = formatStringForVerticalAxis(currentValue);\r
-\r
-                fAxisImage.setFont(fValuesFont);\r
-\r
-                Point textDimensions = fAxisImage.stringExtent(currentLabel);\r
-                fAxisImage.drawText(currentLabel, x - textDimensions.x - 5, y - textDimensions.y / 2);\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Increases the bar width. \r
-     */\r
-    public void increaseBarWitdh() {\r
-        fBarWith = fBarWith << 1;\r
-        if (fBarWith > Config.MAX_HISTOGRAM_BAR_WIDTH) {\r
-            fBarWith = Config.MAX_HISTOGRAM_BAR_WIDTH;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Decreases the bar width. \r
-     */\r
-    public void decreaseBarWitdh() {\r
-        fBarWith = fBarWith >> 1;\r
-        if (fBarWith < Config.MIN_HISTOGRAM_BAR_WIDTH) {\r
-            fBarWith = Config.MIN_HISTOGRAM_BAR_WIDTH; \r
-        }\r
-    }\r
-\r
-    \r
-    /**\r
-     * Paints the vertical axis label.\r
-     * @param x\r
-     *            The x-coordinate where to draw the label.\r
-     */\r
-    public void paintVerticalAxisLabel(int x) {\r
-        if (fYAxisLabel != null) {\r
-            fAxisImage.setFont(fLabelFont);\r
-            fAxisImage.setForeground(fLabelColor);\r
-            fAxisImage.setBackground(fBackgroundColor);\r
-\r
-            if (fDelta >= 1)\r
-                fAxisImage.drawText(fYAxisLabel + " (x10^" + fDelta + ")", x + 10, fHorizontalAxisYOffset - 5);  //$NON-NLS-1$//$NON-NLS-2$\r
-            else\r
-                fAxisImage.drawText(fYAxisLabel, x + 10, fPadding);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Adds points to the graph and draws them to the canvas.\r
-     * @param points\r
-     *            The buffer of points to draw.\r
-     * @param nbPoints\r
-     *            The number of points in the buffer.\r
-     */\r
-    abstract public String formatToolTipLabel(int x, int y);\r
-\r
-    /**\r
-     * Method to be implemented to scale the model data to the actual screen size.\r
-     */\r
-    abstract public void scale();\r
-    \r
-    /**\r
-     * Called for drawing elements after points are added to the graph.\r
-     */\r
-    abstract public void paintContent();\r
-\r
-    /**\r
-     * Clears the image and prepares it for redrawing.\r
-     */\r
-    public void clear() {\r
-        fInitialized = false;\r
-        fXMin = -1;\r
-        fXMax = -1;\r
-        fYMin = -1;\r
-        fYMax = -1;\r
-    }\r
-    \r
-    /**\r
-     * Draw horizontal label each "nbTicks" ticks.\r
-     * @param nbTicks\r
-     *            The draw interval.\r
-     */\r
-    public void setDrawLabelEachNTicks(int nbTicks) {\r
-        fDrawLabelEachNTicks = nbTicks;\r
-    }\r
-\r
-    /**\r
-     * Sets the title of the graph.\r
-     * @param graphTitle\r
-     *            The title of the graph.\r
-     */\r
-    public void setGraphTitle(String graphTitle) {\r
-        fGraphTitle = graphTitle;\r
-    }\r
-\r
-    /**\r
-     * Sets the horizontal axis label.\r
-     * @param xAxisLabel\r
-     *            The horizontal axis label.\r
-     * @param offset\r
-     *            The horizontal axis draw offset (in pixels).\r
-     */\r
-    public void setXAxisLabel(String xAxisLabel, int offset) {\r
-        fXAxisLabel = xAxisLabel;\r
-        fXAxisLabelOffset = offset;\r
-    }\r
-\r
-    /**\r
-     * Sets the vertical axis label.\r
-     * @param yAxisLabel\r
-     *            The vertical axis label.\r
-     */\r
-    public void setYAxisLabel(String yAxisLabel) {\r
-        fYAxisLabel = yAxisLabel;\r
-    }\r
-\r
-    /**\r
-     * Returns a string representing the given value. \r
-     * \r
-     * @param value\r
-     *            The numeric value to convert to String.\r
-     * @return The String-formatted value.\r
-     */\r
-    public String formatStringForHorizontalAxis(long value) {\r
-        return String.valueOf(value);\r
-    }\r
-\r
-    /**\r
-     * Returns a string representing the given value. \r
-     * \r
-     * @param value\r
-     *            The numeric value to convert to String.\r
-     * @return The String-formatted value.\r
-     */\r
-    public String formatStringForVerticalAxis(long value) {\r
-        return String.valueOf(value);\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/GraphMouseListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/GraphMouseListener.java
deleted file mode 100644 (file)
index 5d6cb75..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;
-
-import org.eclipse.linuxtools.lttng.ui.views.latency.GraphViewer;
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyGraphModel;
-
-/**
- * <b><u>GraphMouseListener</u></b>
- * <p>
- */
-public class GraphMouseListener extends AbstractMouseListener {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /**
-     * A reference to the observed view.
-     */
-    protected GraphViewer fView;
-
-    /**
-     * A reference to the HistogramPaintListener.
-     */
-    protected GraphPaintListener fGraph;
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-    
-    /**
-     * Constructor.
-     * @param view
-     *            A reference to the observed view.
-     * @param histogramPaintListener
-     *            A reference to the histogram's paintListener.
-     */
-    public GraphMouseListener(GraphViewer view, GraphPaintListener graphPaintListener) {
-        fView = view;
-        fGraph = graphPaintListener;
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseListener#display()
-     */
-    @Override
-    protected void display() {
-        long currentTime = fGraph.getCurrentTimeFromHorizontalValue(fMouseX);
-        ((LatencyGraphModel)fView.getModel()).setCurrentEventNotifyListeners(currentTime);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/GraphPaintListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/GraphPaintListener.java
deleted file mode 100644 (file)
index 7b27eb6..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design, display improvements\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import java.text.DecimalFormat;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.GraphViewer;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.Config;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.GraphScaledData;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphDataModel;\r
-import org.eclipse.linuxtools.tmf.ui.views.distribution.model.BaseDistributionData;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramUtils;\r
-\r
-/**\r
- * <b><u>GraphPaintListener</u></b>\r
- * <p>\r
- * Graph paint listener.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class GraphPaintListener extends AbstractPaintListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Scaled data from data model\r
-     */\r
-    protected GraphScaledData fScaledData;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param viewer\r
-     *            A reference to the listener's viewer.\r
-     */\r
-    public GraphPaintListener(AbstractViewer view) {\r
-        super(view);\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#scale()\r
-     */\r
-    @Override\r
-    public void scale() {\r
-         \r
-         // width of the plot area\r
-         double width = getWidth();\r
-         // height of the plot area\r
-         double height = getHeight();\r
-\r
-         IGraphDataModel model = ((GraphViewer)fViewer).getModel();\r
-         fScaledData = model.scaleTo((int)width, (int)height, fBarWith);\r
-\r
-         fXMin = fScaledData.getHorFirstBucketTime() > 0 ? fScaledData.getHorFirstBucketTime() : 0;\r
-         fXMax = 0;\r
-         if (fScaledData.getHorLastBucket() > 0) {\r
-             fXMax = fScaledData.getHorBucketEndTime(fScaledData.getHorNbBuckets() - 1);\r
-         }\r
-         \r
-         fYMin = fScaledData.getVerFirstBucketTime() > 0 ? fScaledData.getVerFirstBucketTime() : 0;\r
-         fYMax = 0;\r
-         if (fScaledData.getVerLastBucket() > 0) {\r
-             fYMax = fScaledData.getVerBucketEndTime(fScaledData.getVerNbBuckets() - 1);\r
-         }\r
-     }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintContent()\r
-     */\r
-    @Override\r
-    public void paintContent() {\r
-        if (fXMin >= 0 && fXMax >= 0 && fYMin >= 0 && fYMax >= 0 && fScaledData != null) {\r
-            \r
-            fAxisImage.setForeground(fDataColor);\r
-            fAxisImage.setBackground(fDataColor);\r
-\r
-            double height = getHeight();\r
-\r
-            int xLen = fScaledData.getHorNbBuckets();\r
-            int yLen = fScaledData.getVerNbBuckets();\r
-\r
-            int barWidth = fScaledData.getBarWidth();\r
-            \r
-            for (int i = 0; i < xLen; i++) {\r
-                for (int j = 0; j < yLen; j++) {\r
-                    if (fScaledData.getEventCount(i, j) > 0) {\r
-\r
-                        double x = fPadding + i * barWidth + fVerticalAxisOffset + 1;\r
-                        double y = fPadding + fPaddingTop + height - j * barWidth;\r
-\r
-                        // Avoid over-drawing background area\r
-                        int yBarWidth = fBarWith;\r
-                        if (y - yBarWidth < fPadding + fPaddingTop) {\r
-                            yBarWidth = (int) (y - fPadding - fPaddingTop);\r
-                        }\r
-                        int xBarWidth = fBarWith;\r
-                        if(x + xBarWidth > fClientArea.width - fPadding - fPaddingRight) {\r
-                            xBarWidth =  (int)(fClientArea.width - fPadding - fPaddingRight - x);    \r
-                        }\r
-                        fAxisImage.fillRectangle((int) x, (int) y - (int) yBarWidth, (int) xBarWidth, (int) yBarWidth);\r
-                    }\r
-                }\r
-            }\r
-            \r
-            if (fScaledData.isCurrentEventTimeValid()) {\r
-                // Draw vertical line\r
-                int index = fScaledData.getHorBucketIndex(fScaledData.getCurrentEventTime());\r
-\r
-                int x = fPadding + index * barWidth + fVerticalAxisOffset + 1;\r
-                fAxisImage.setForeground(fCurrentEventColor);\r
-                fAxisImage.setBackground(fCurrentEventColor);\r
-                fAxisImage.drawLine(x, fPadding + fPaddingTop, x, fClientArea.height - fPadding - fHorizontalAxisYOffset);\r
-            }\r
-        }\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatStringForVerticalAxis(long)\r
-     */\r
-    @Override\r
-    public String formatStringForVerticalAxis(long value) {\r
-        DecimalFormat formatter = new DecimalFormat("0.0E0"); //$NON-NLS-1$\r
-        return formatter.format(value);\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatStringForHorizontalAxis(long)\r
-     */\r
-    @Override\r
-    public String formatStringForHorizontalAxis(long value) {\r
-        return HistogramUtils.nanosecondsToString(value);\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatToolTipLabel(int, int)\r
-     */\r
-    @Override\r
-    public String formatToolTipLabel(int x, int y) {\r
-\r
-        int index = getIndexFromHorizontalValue(x);\r
-        int yIndex = getIndexFromVerticalValue(y);\r
-\r
-        if (index != BaseDistributionData.OUT_OF_RANGE_BUCKET && yIndex != BaseDistributionData.OUT_OF_RANGE_BUCKET) {\r
-            if (fScaledData.getEventCount(index, yIndex) > 0) {\r
-                StringBuffer buffer = new StringBuffer();\r
-                buffer.append("Time Range in s = ["); //$NON-NLS-1$\r
-                // TODO change Utility\r
-                long startTime = fScaledData.getHorBucketStartTime(index) > 0 ? fScaledData.getHorBucketStartTime(index) : 0;\r
-                buffer.append(HistogramUtils.nanosecondsToString(startTime));\r
-                buffer.append(","); //$NON-NLS-1$\r
-                buffer.append(HistogramUtils.nanosecondsToString(fScaledData.getHorBucketEndTime(index)));\r
-                buffer.append("]\n"); //$NON-NLS-1$\r
-                buffer.append("Latency Range in s = ["); //$NON-NLS-1$\r
-                long yStartTime = fScaledData.getVerBucketStartTime(yIndex) > 0 ? fScaledData.getVerBucketStartTime(yIndex) : 0;\r
-                buffer.append(HistogramUtils.nanosecondsToString(yStartTime));\r
-                buffer.append(","); //$NON-NLS-1$\r
-                buffer.append(HistogramUtils.nanosecondsToString(fScaledData.getVerBucketEndTime(yIndex)));\r
-                buffer.append("]\n"); //$NON-NLS-1$\r
-                buffer.append("Latency count = "); //$NON-NLS-1$\r
-                buffer.append(fScaledData.getEventCount(index, yIndex));\r
-                return buffer.toString();\r
-            }\r
-        }\r
-        return ""; //$NON-NLS-1$\r
-    }\r
-    \r
-    public int getIndexFromHorizontalValue(int x) {\r
-        if (fScaledData != null) {\r
-            double barWidth = fScaledData.getBarWidth();\r
-            \r
-            int index = (int) ((x - fPadding - fVerticalAxisOffset - 1) / barWidth);\r
-            if ((index >= 0) && (fScaledData.getHorNbBuckets() > index)) {\r
-                return index;\r
-            }\r
-        }\r
-        return BaseDistributionData.OUT_OF_RANGE_BUCKET;\r
-    }\r
-    \r
-    public int getIndexFromVerticalValue(int y) {\r
-        if (fScaledData != null) {\r
-            double barWidth = fScaledData.getBarWidth();\r
-            double height = getHeight();     // height of the plot area\r
-            \r
-            int index = (int) ((height - (y - fPadding - fPaddingTop)) / barWidth);\r
-            if (index >= 0 && fScaledData.getVerNbBuckets() > index) {\r
-                return index;\r
-            }\r
-        }\r
-        return BaseDistributionData.OUT_OF_RANGE_BUCKET;\r
-    }\r
-\r
-    public long getCurrentTimeFromHorizontalValue(int x) {\r
-        if (fXMin >= 0 && fXMax >= 0) {\r
-            int index = getIndexFromHorizontalValue(x);\r
-            if (index != BaseDistributionData.OUT_OF_RANGE_BUCKET) {\r
-                return fScaledData.getHorBucketStartTime(index);\r
-            }\r
-        }\r
-        return Config.INVALID_EVENT_TIME;\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/HistogramPaintListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/HistogramPaintListener.java
deleted file mode 100644 (file)
index ee923aa..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Adapted to new model-view-controller design, display improvements\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import java.text.DecimalFormat;\r
-import java.util.Collections;\r
-import java.util.Vector;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.HistogramViewer;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.Messages;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramScaledData;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramUtils;\r
-import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-\r
-/**\r
- * <b><u>HistogramPaintListener</u></b>\r
- * <p>\r
- * Histogram paint listener.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class HistogramPaintListener extends AbstractPaintListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Is a histogram bar so high that it is clipped from the draw area ?\r
-     */\r
-    private boolean fBarIsClipped = false;\r
-\r
-    /**\r
-     * Scaled data from data model\r
-     */\r
-    protected HistogramScaledData fScaledData;\r
-\r
-    /**\r
-     * Warning Image\r
-     */\r
-    protected Image fWarningImage;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Constructor.\r
-     * @param view\r
-     *            A reference to the listener's viewer.\r
-     */\r
-    public HistogramPaintListener(AbstractViewer viewer) {\r
-        super(viewer);\r
-        fWarningImage = AbstractUIPlugin.imageDescriptorFromPlugin(Messages.LatencyView_tmf_UI, "icons/elcl16/warning.gif").createImage(Display.getCurrent()); //$NON-NLS-1$\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Accessors\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Returns the histogram's bar Width.\r
-     * @return The histogram's bar Width.\r
-     */\r
-    public int getBarWidth() {\r
-        return fBarWith;\r
-    }\r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#dispose()\r
-     */\r
-    @Override\r
-    public void dispose() {\r
-        fWarningImage.dispose();\r
-        super.dispose();\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#scale()\r
-     */\r
-    @Override\r
-    public void scale() {\r
-        // width of the plot area\r
-        double width = getWidth();\r
-        // height of the plot area\r
-        double height = getHeight();\r
-\r
-        int barWidth = getBarWidth();\r
-\r
-        IHistogramDataModel model = ((HistogramViewer)fViewer).getModel();\r
-        fScaledData = model.scaleTo((int)width, (int)height, barWidth);\r
-\r
-        fYMin = 0;\r
-        fYMax = fScaledData.fMaxValue;\r
-\r
-        fXMin = fScaledData.getFirstBucketTime();\r
-        fXMin = fXMin > 0 ? fXMin : 0; \r
-        fXMax = fScaledData.getBucketEndTime(fScaledData.fLastBucket - 1);\r
-\r
-        // No data to display - set end time to 0 \r
-        if (fYMax == 0) {\r
-            fXMax = 0;\r
-        }\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintVerticalTicks(int)\r
-     */\r
-    @Override\r
-    public void paintVerticalTicks(int x) {\r
-        // done in method paintVerticalAxisValues()\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintVerticalAxisValues(int)\r
-     */\r
-    @Override\r
-    public void paintVerticalAxisValues(int x) {\r
-        int zoomFactor = 1;\r
-\r
-        zoomFactor = fViewer.getZoomFactor();\r
-\r
-        if (fYMin >= 0L && fYMax != 0L) {\r
-            fAxisImage.setForeground(fTextColor);\r
-            fAxisImage.setBackground(fBackgroundColor);\r
-\r
-            // Apply the zoom to the max value of the graph for the next calculations\r
-            long yMax = fYMax / zoomFactor;\r
-\r
-            int nbTicks = ((int)getHeight()) / MAX_HEIGHT_BETWEEN_TICKS + 1;\r
-\r
-            Vector<Integer> values = new Vector<Integer>();\r
-            boolean multipleSameValues = true;\r
-            while (multipleSameValues) {\r
-                double valueStep = (double) (yMax - fYMin) / (double) (nbTicks);\r
-\r
-                for (int i = 0; i < nbTicks; i++) {\r
-                    double currentValue = (double) (fYMin + i * valueStep) / (Math.pow(10, fDelta));\r
-\r
-                    values.add((int) currentValue);\r
-                }\r
-\r
-                Collections.sort(values);\r
-                boolean hasRepetition = false;\r
-                for (int i = 1; i < values.size(); i++) {\r
-                    if (values.get(i) == values.get(i - 1)) {\r
-                        hasRepetition = true;\r
-                        break;\r
-                    }\r
-                }\r
-\r
-                if (hasRepetition) {\r
-                    nbTicks--;\r
-                    values.clear();\r
-                } else {\r
-                    multipleSameValues = false;\r
-\r
-                    // Draw rectangle over the old values\r
-                    int height = fViewer.getBounds().height - 2 * fPadding - fPaddingTop - fHorizontalAxisYOffset;\r
-                    fAxisImage.fillRectangle(0, fPadding + fPaddingTop, fPadding + fVerticalAxisOffset, height);\r
-\r
-                    double pixelStep = (getHeight()) / values.size() + 1;\r
-\r
-                    for (int i = 0; i < values.size(); i++) {\r
-                        double currentValue = values.get(i);\r
-\r
-                        int y = (int)  (fClientArea.height - fPadding - fHorizontalAxisYOffset -  i * pixelStep);\r
-                        String currentLabel = formatStringForVerticalAxis((long) currentValue);\r
-\r
-                        fAxisImage.setFont(fValuesFont);\r
-\r
-                        Point textDimensions = fAxisImage.stringExtent(currentLabel);\r
-                        fAxisImage.drawText(currentLabel, x - textDimensions.x - 5, y - textDimensions.y / 2);\r
-                        fAxisImage.drawLine(x - 3, y, x, y);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#paintContent()\r
-     */\r
-    @Override\r
-    public void paintContent() {\r
-        double zoomFactor = fViewer.getZoomFactor();\r
-\r
-        // Calculate the vertical axis factor and see if it has changed\r
-        double tmpDelta = fDelta;\r
-        fDelta = 0;\r
-        if (Long.toString(fYMax / (long) zoomFactor).length() > MAX_CHAR_VERTICAL_DISPLAY) {\r
-            fDelta = Long.toString(fYMax / (long) zoomFactor).length() - MAX_CHAR_VERTICAL_DISPLAY;\r
-        }\r
-        if (tmpDelta != fDelta) {\r
-            fViewer.clearBackground();\r
-        }\r
-\r
-        paintBackground();\r
-        paintVerticalAxis();\r
-        paintHorizontalAxis();\r
-\r
-        fAxisImage.setForeground(fDataColor);\r
-        fAxisImage.setBackground(fDataColor);\r
-\r
-        // height of the plot area\r
-        double height = getHeight();\r
-\r
-        int barWidth = getBarWidth();\r
-        \r
-        // axisImage_.setBackground(backgroundColor_);\r
-        // 1.a Iterate over the points, from 0 to nbPoints\r
-        // 1.b Find the max counter value\r
-        // 2. Assign the max value to the "yMax_" class attribute\r
-        // 3. Draw the histogram bars using "axisImage_.fillRectangle(...)"\r
-        boolean oneBarIsClipped = false;\r
-\r
-        for (int i = 0; i < fScaledData.fData.length; i++) {\r
-            double pointY = fScaledData.fData[i];\r
-\r
-            // in pixels\r
-            double x = fPadding + i * barWidth + fVerticalAxisOffset + 1;\r
-\r
-            if (i == fScaledData.fData.length - 1)\r
-                x -= 1.0;\r
-            double barHeight = zoomFactor * ((double)(pointY - fYMin) / (double)(fYMax - fYMin)) * height;\r
-\r
-            if (barHeight > height + 1) {\r
-                barHeight = height;\r
-                oneBarIsClipped = true;\r
-\r
-                fAxisImage.drawImage(fWarningImage, 5, 3);\r
-            }\r
-\r
-            // Only draw the bars that have a barHeight of more than 1 pixel\r
-            if (barHeight > 0) {\r
-                double y = fPadding + fPaddingTop + height - barHeight;\r
-                fAxisImage.setBackground(fDataColor);\r
-\r
-                if (barHeight > height - 1) {\r
-                    fAxisImage.fillRectangle((int) x, (int) y, (int) barWidth, (int) (barHeight + 1));\r
-                } else {\r
-                    fAxisImage.fillRectangle((int) x, (int) y, (int) barWidth, (int) (barHeight + 2));\r
-                }\r
-            }\r
-        }\r
-\r
-        if (oneBarIsClipped)\r
-            fBarIsClipped = true;\r
-        else\r
-            fBarIsClipped = false;\r
-    }\r
-    \r
-    /**\r
-     * Paints the histogram horizontal axis values in engineering notation in which the exponent is a multiple of three.\r
-     * @param value\r
-     *            The numeric value to convert to engineering notation.\r
-     * @return The given value formatted according to the engineering notation.\r
-     */\r
-    @Override\r
-    public String formatStringForHorizontalAxis(long value) {\r
-        DecimalFormat formatter = new DecimalFormat("##0.#E0"); //$NON-NLS-1$\r
-        return formatter.format(value);\r
-    }\r
-\r
-    /**\r
-     * Sets the bar width.\r
-     * @param barWidth \r
-     *            bar width to set\r
-     */\r
-    public void setBarWidth(int barWidth) {\r
-        fBarWith = barWidth;\r
-    }\r
-    \r
-    /**\r
-     * Returns "true" if a histogram bar is so high that it cannot be drawn in the draw area, "false" otherwise.\r
-     * @return "true" if a histogram bar is so high that it cannot be drawn in the draw area, "false" otherwise.\r
-     */\r
-    public boolean barIsClipped() {\r
-        return fBarIsClipped;\r
-    }\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractPaintListener#formatToolTipLabel(int, int)\r
-     */\r
-    @Override\r
-    public String formatToolTipLabel(int x, int y) {\r
-        if (fScaledData != null) {\r
-\r
-            double barWidth = getBarWidth();\r
-            double height = getHeight();     // height of the plot area\r
-            \r
-            double zoomFactor = fViewer.getZoomFactor();\r
-\r
-            int index = (int) ((x - fPadding - fVerticalAxisOffset - 1) / barWidth);\r
-\r
-            double barHeight = 0.0;\r
-            if (index >= 0 && index <= fScaledData.fLastBucket) {\r
-                barHeight = (zoomFactor * height * (fScaledData.fData[index] - fYMin) / (fYMax - fYMin));\r
-            }\r
-\r
-            long fMouseY = (long) (height - (y - fPadding - fPaddingTop));\r
-\r
-            // Verifying mouse pointer is over histogram bar\r
-            if (index >= 0 && fScaledData.fLastBucket >= index && fMouseY >= 0 && fMouseY < barHeight && fMouseY < height && x >= (fVerticalAxisOffset + fPadding)) {\r
-\r
-                fScaledData.fCurrentBucket = index;\r
-\r
-                long startTime = fScaledData.getBucketStartTime(index);\r
-                // negative values are possible if time values came into the model in decreasing order\r
-                if (startTime < 0) {\r
-                    startTime = 0;\r
-                }\r
-                long endTime = fScaledData.getBucketEndTime(index);\r
-                int nbEvents = fScaledData.fData[index];\r
-\r
-                StringBuffer buffer = new StringBuffer();\r
-                buffer.append("Latency Range in s = ["); //$NON-NLS-1$\r
-                buffer.append(HistogramUtils.nanosecondsToString(startTime));\r
-                buffer.append(","); //$NON-NLS-1$\r
-                buffer.append(HistogramUtils.nanosecondsToString(endTime));\r
-                buffer.append("]\n"); //$NON-NLS-1$\r
-                buffer.append("Latency count = "); //$NON-NLS-1$\r
-                buffer.append(nbEvents);\r
-                return buffer.toString();\r
-            }\r
-        }\r
-        return ""; //$NON-NLS-1$\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/TimePointerListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/TimePointerListener.java
deleted file mode 100644 (file)
index 31027ca..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *   Bernd Hufmann - Changed display interface implementation \r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer;\r
-\r
-/**\r
- * <b><u>TimePointerListener</u></b>\r
- * <p>\r
- * Displays a tooltip showing the approximate values of the point under the mouse cursor.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class TimePointerListener extends AbstractMouseTrackListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * A reference to the observed view.\r
-     */\r
-    protected AbstractViewer fView;\r
-\r
-    /**\r
-     * A reference to the HistogramPaintListener.\r
-     */\r
-    protected GraphPaintListener fGraph;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Constructor.\r
-     * @param view\r
-     *            A reference to the observed view.\r
-     * @param histogramPaintListener\r
-     *            A reference to the histogram's paintListener.\r
-     */\r
-    public TimePointerListener(AbstractViewer view, GraphPaintListener graphPaintListener) {\r
-        fView = view;\r
-        fGraph = graphPaintListener;\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseTrackListener#display()\r
-     */\r
-    @Override\r
-    protected void display() {\r
-        fView.setToolTipText(fGraph.formatToolTipLabel(fMouseX, fMouseY));\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/TooltipListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/TooltipListener.java
deleted file mode 100644 (file)
index ccb8bc2..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com) - Initial API and implementation\r
- *   Bernd Hufmann - Changed display interface implementation\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer;\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.Messages;\r
-\r
-/**\r
- * <b><u>TooltipListener</u></b>\r
- * <p>\r
- * Tooltip listener, displays the event count for each latency selected by the mouse click area on histogram.\r
- * \r
- * @author Ali Jawhar\r
- */\r
-public class TooltipListener extends AbstractMouseTrackListener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * A reference to the observed view.\r
-     */\r
-    protected AbstractViewer fView;\r
-\r
-    /**\r
-     * A reference to the HistogramPaintListener.\r
-     */\r
-    protected HistogramPaintListener fHistogram;\r
-\r
-    /**\r
-     * Is the mouse over the warning icon, indicating that a bar is higher than the draw area due to zooming ?\r
-     */\r
-    protected boolean fDisplayWarning = false;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Constructor.\r
-     * @param view\r
-     *            A reference to the observed view.\r
-     * @param histogramPaintListener\r
-     *            A reference to the histogram's paintListener.\r
-     */\r
-    public TooltipListener(AbstractViewer view, HistogramPaintListener histogramPaintListener) {\r
-        fView = view;\r
-        fHistogram = histogramPaintListener;\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-\r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseTrackListener#display()\r
-     */\r
-    @Override\r
-    protected void display() {\r
-        displayWarningTooltip();\r
-        displayTooltip();\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Helper Functions\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /**\r
-     * Displays a tooltip if the mouse is over the warning icon indication that a bar cannot be draw entirely due to the\r
-     * zoom factor.\r
-     */\r
-    protected void displayWarningTooltip() {\r
-        if (fHistogram.barIsClipped() && fMouseX > 5 && fMouseX < 21 && fMouseY > 3 && fMouseY < 18) {\r
-            fView.setToolTipText(Messages.LatencyView_ClippingWarning);\r
-            fDisplayWarning = true;\r
-        } else {\r
-            fDisplayWarning = false;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Displays the tooltip showing the details of the histogram bar pointed by the mouse.\r
-     */\r
-    protected void displayTooltip() {\r
-        if (!fDisplayWarning)\r
-            fView.setToolTipText(fHistogram.formatToolTipLabel(fMouseX, fMouseY));\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/ZoomListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/listeners/ZoomListener.java
deleted file mode 100644 (file)
index 266f926..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactored code\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.listeners;\r
-\r
-import org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Canvas;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Listener;\r
-\r
-/**\r
- * <b><u>ZoomListener</u></b>\r
- * <p>\r
- * \r
- * Canvas zoom listener.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class ZoomListener implements Listener {\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Attributes\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * A reference to the observed view.\r
-     */\r
-    protected AbstractViewer fView;\r
-    /**\r
-     * Default zoom factor.\r
-     */\r
-    protected int fZoomFactor;\r
-    /**\r
-     * Zoom increment.\r
-     */\r
-    protected int fZoomIncrement = 30;\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Constructors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param view\r
-     *            A reference to the observed view.\r
-     * @param defaultZoomFactor\r
-     *            Default zoom factor.\r
-     */\r
-    public ZoomListener(AbstractViewer view, int defaultZoomFactor) {\r
-        fView = view;\r
-        fZoomFactor = defaultZoomFactor;\r
-    }\r
-\r
-    /**\r
-     * Constructor.\r
-     * @param view\r
-     *            A reference to the observed view.\r
-     */\r
-    public ZoomListener(AbstractViewer view) {\r
-        this(view, 1);\r
-    }\r
-\r
-    // ------------------------------------------------------------------------\r
-    // Accessors\r
-    // ------------------------------------------------------------------------\r
-\r
-    /**\r
-     * Returns the zoom factor.\r
-     * @return The zoom factor.\r
-     */\r
-    public int getZoomFactor() {\r
-        if (fZoomFactor < 1)\r
-            return 1;\r
-        else\r
-            return fZoomFactor;\r
-    }\r
-\r
-    /**\r
-     * Returns the zoom increment.\r
-     * @return The zoom increment.\r
-     */\r
-    public int getZoomIncrement() {\r
-        return fZoomIncrement;\r
-    }\r
-    \r
-    // ------------------------------------------------------------------------\r
-    // Operations\r
-    // ------------------------------------------------------------------------\r
-    \r
-    /*\r
-     * (non-Javadoc)\r
-     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)\r
-     */\r
-    @Override\r
-    public void handleEvent(Event event) {\r
-        switch (event.type) {\r
-            case SWT.MouseWheel:\r
-                boolean scrollDown = (event.count == 0 ? false : (event.count > 0 ? false : true));\r
-                int zoomStep = fZoomIncrement;\r
-                if (scrollDown)\r
-                    zoomStep = -fZoomIncrement;\r
-                fZoomFactor = Math.max(0, fZoomFactor + zoomStep);\r
-\r
-                Canvas canvas = (Canvas) event.widget;\r
-                if (fView != null) {\r
-                    // clear the background to allow redraw of values of the vertical axis.\r
-                    fView.clearBackground();\r
-                    fView.redrawTitle();\r
-                    fView.askForRedraw();\r
-                }\r
-                canvas.redraw();\r
-                break;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Sets the zoom increment.\r
-     * @param zoomIncrement\r
-     *            The new zoom increment.\r
-     */\r
-    public void setZoomIncrement(int zoomIncrement) {\r
-        fZoomIncrement = zoomIncrement;\r
-    }\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/messages.properties
deleted file mode 100644 (file)
index cf907c0..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#*******************************************************************************\r
-# Copyright (c) 2011 Ericsson\r
-#  \r
-# All rights reserved. This program and the accompanying materials are\r
-# made available under the terms of the Eclipse Public License v1.0 which\r
-# accompanies this distribution, and is available at\r
-# http://www.eclipse.org/legal/epl-v10.html\r
-#  \r
-# Contributors:\r
-#   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
-#   Bernd Hufmann - Updated and added properties    \r
-# *******************************************************************************/\r
-\r
-LatencyView_ViewName=LatencyView\r
-LatencyView_Action_IncreaseBarWidth_Tooltip=Increase bar width/height\r
-LatencyView_Action_DecreaseBarWidth_Tooltip=Decrease bar width/height\r
-LatencyView_Action_AddEvents_Tooltip=Add matching events\r
-LatencyView_Action_DeleteEvents_Tooltip=Delete matching events\r
-LatencyView_Action_ListEvents_Tooltip=List matching events\r
-LatencyView_Dialogs_AddEvents_Title=Add event pairs\r
-LatencyView_Dialogs_AddEvents_Message=Select a pair of events to add it to the match list :\r
-LatencyView_Dialogs_AddEvents_Buttons_Add=Add\r
-LatencyView_Dialogs_AddEvents_Buttons_Close=Close\r
-LatencyView_Dialogs_AddEvents_Columns_Start=Start event types\r
-LatencyView_Dialogs_AddEvents_Columns_End=End event types\r
-LatencyView_Dialogs_AddEvents_Columns_List_Trigger=Trigger event type\r
-LatencyView_Dialogs_AddEvents_Columns_List_End=End event type\r
-LatencyView_Dialogs_AddEvents_Errors_NoSelection=You must select one item from both lists_\r
-LatencyView_Dialogs_AddEvents_Errors_StartNotSelected=You must select one item from the start event list_\r
-LatencyView_Dialogs_AddEvents_Errors_EndNotSelected=You must select one item from the end event list_\r
-LatencyView_Dialogs_AddEvents_Errors_SameSelected=The same event cannot be selected in both list at the same time_\r
-LatencyView_Dialogs_AddEvents_Errors_AlreadyMatched=The start and end events are already matched_\r
-LatencyView_Dialogs_AddEvents_Errors_StartAlreadyMatched=The start event is already matched_\r
-LatencyView_Dialogs_AddEvents_Errors_EndAlreadyMatched=The end event is already matched_\r
-LatencyView_Dialogs_AddEvents_Errors_StartAsEnd=The start event is already matched as an end event_\r
-LatencyView_Dialogs_AddEvents_Errors_EndAsStart=The end event is already matched as a start event_\r
-LatencyView_Dialogs_DeleteEvents_Title=Delete event pairs\r
-LatencyView_Dialogs_DeleteEvents_Message=Select a pair of matched events to remove it from the list :\r
-LatencyView_Dialogs_DeleteEvents_Buttons_Close=Close\r
-LatencyView_Dialogs_DeleteEvents_Buttons_Delete=Delete\r
-LatencyView_Dialogs_DeleteEvents_Confirm_Title=Confirm event deletion\r
-LatencyView_Dialogs_DeleteEvents_Confirm_Message=Are you sure you want to delete these event pairs?\r
-LatencyView_Dialogs_ListEvents_Title=Matched events list\r
-LatencyView_Dialogs_ListEvents_Message=List of matched events for latency computation :\r
-LatencyView_Dialogs_ListEvents_Buttons_Close=Close\r
-LatencyView_Dialogs_ListEvents_Buttons_Reset=Reset to default pairs\r
-LatencyView_Dialogs_ListEvents_Columns_Trigger=Trigger event type\r
-LatencyView_Dialogs_ListEvents_Columns_End=End event type\r
-LatencyView_Dialogs_ListEvents_Confirm_Title=Confirm pairs reset\r
-LatencyView_Dialogs_ListEvents_Confirm_Message=Are you sure you want to reset the event pairs to their default values?\r
-LatencyView_Graphs_Graph_Title=Latency vs Time\r
-LatencyView_Graphs_Graph_XAxisLabel=time (s)\r
-LatencyView_Graphs_Graph_YAxisLabel=latency (ms)\r
-LatencyView_Graphs_Histogram_Title=Latency Distribution\r
-LatencyView_Graphs_Histogram_XAxisLabel=latency (ms)\r
-LatencyView_Graphs_Histogram_YAxisLabel=# events\r
-LatencyView_msgSlogan=Latency View\r
-LatencyView_tmf_UI=org.eclipse.linuxtools.lttng.ui\r
-LatencyView_ClippingWarning=One or more bars are higher than the drawing area due to zooming
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/Config.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/Config.java
deleted file mode 100644 (file)
index c15f5c8..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Philippe Sawicki (INF4990.A2010@gmail.com)   - Initial API and implementation\r
- *   Mathieu Denis    (mathieu.denis55@gmail.com) - Refactor code\r
- *   Bernd Hufmann - Added and updated constants\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;\r
-\r
-/**\r
- * <b><u>Config</u></b>\r
- * <p>\r
- * Configuration class, holds some application constants.\r
- * \r
- * @author Philippe Sawicki\r
- */\r
-public class Config {\r
-\r
-    /**\r
-     * Private constructor to defeat instantiation.\r
-     */\r
-    private Config() {\r
-    }\r
-\r
-    /**\r
-     * Time scale for TMF events;\r
-     */\r
-    public static final byte TIME_SCALE = -9;\r
-    \r
-    /**\r
-     * Size of the point buffer holding point values before sending them to the view.\r
-     */\r
-    public static final int POINT_BUFFER_SIZE = 10000;\r
-\r
-    /**\r
-     * Histogram bar width.\r
-     */\r
-    public static final int DEFAULT_HISTOGRAM_BAR_WIDTH = 2;\r
-    \r
-    /**\r
-     * Histogram bar width increase step.\r
-     */\r
-    public static final int MIN_HISTOGRAM_BAR_WIDTH = 1;\r
-\r
-    /**\r
-     * Histogram bar width increase step.\r
-     */\r
-    public static final int MAX_HISTOGRAM_BAR_WIDTH = 16;\r
-\r
-    \r
-    /**\r
-     * Diameter of a point drawn on the chart (in pixels).\r
-     */\r
-    public static final int GRAPH_POINT_DIAMETER = 1;\r
-\r
-    /**\r
-     * Graph padding.\r
-     */\r
-    public static final int GRAPH_PADDING = 10;\r
-\r
-    /**\r
-     * Default number of buckets used in data models\r
-     */\r
-    public static final int DEFAULT_NUMBER_OF_BUCKETS = 2 * 1000;\r
-    \r
-    /**\r
-     * Invalid event time\r
-     */\r
-    public static final long INVALID_EVENT_TIME = -1;\r
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/GraphScaledData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/GraphScaledData.java
deleted file mode 100644 (file)
index 387ce95..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;
-
-/**
- * <b><u>GraphScaledData</u></b>
- * Convenience class for scaled distribution data.  
- * <p>
- */
-import java.util.Arrays;
-
-import org.eclipse.linuxtools.tmf.ui.views.distribution.model.BaseDistributionData;
-
-public class GraphScaledData {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private int fWidth;
-    private int fHeight;
-    private int fBarWidth;
-    private int[][] fData;
-    private BaseDistributionData fHorDistributionData;
-    private BaseDistributionData fVerDistributionData;
-    private long fCurrentEventTime;
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    public GraphScaledData(int width, int height, int barWidth) {
-        fWidth = width;
-        fHeight = height;
-        fBarWidth = barWidth;
-        int horNbBuckets = (int)width/barWidth;
-        int verNbBuckets = (int)height/barWidth; 
-        fData = new int[horNbBuckets][verNbBuckets];
-        for (int[] row : fData) {
-            Arrays.fill(row, 0);    
-        }
-        fHorDistributionData = new BaseDistributionData(horNbBuckets);
-        fHorDistributionData.clear();
-        
-        fVerDistributionData = new BaseDistributionData(verNbBuckets);
-        fVerDistributionData.clear();
-        
-        fCurrentEventTime = Config.INVALID_EVENT_TIME;
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-
-    public int getWidth() {
-        return fWidth;
-    }
-
-    public int getHeight() {
-        return fHeight;
-    }
-
-    public int getBarWidth() {
-        return fBarWidth;
-    }
-
-    public int[][] getData() {
-        return fData;
-    }
-
-    public int getHorNbBuckets() {
-        return fHorDistributionData.getNbBuckets();
-    }
-    
-    public int getVerNbBuckets() {
-        return fVerDistributionData.getNbBuckets();
-    }
-
-    public long getHorFirstBucketTime() {
-        return fHorDistributionData.getFirstBucketTime();
-    }
-
-    public long getVerFirstBucketTime() {
-        return fVerDistributionData.getFirstBucketTime();
-    }
-
-    public long getHorLastBucketTime() {
-        return fHorDistributionData.getLastBucketTime();
-    }
-
-    public long getVerLastBucketTime() {
-        return fVerDistributionData.getLastBucketTime();
-    }
-    
-    public long getHorFirstEventTime() {
-        return fHorDistributionData.getFirstEventTime();
-    }
-
-    public long getVerFirstEventTime() {
-        return fVerDistributionData.getFirstEventTime();
-    }
-
-    public long getHorLastEventTime() {
-        return fHorDistributionData.getLastEventTime();
-    }
-
-    public long getVerLastEventTime() {
-        return fVerDistributionData.getLastEventTime();
-    }
-    
-    public long getHorBucketDuration() {
-        return fHorDistributionData.getBucketDuration();
-    }
-
-    public long getVerBucketDuration() {
-        return fVerDistributionData.getBucketDuration();
-    }
-
-    public int getHorLastBucket() {
-        return fHorDistributionData.getLastBucket();
-    }
-
-    public int getVerLastBucket() {
-        return fVerDistributionData.getLastBucket();
-    }
-
-    public long getHorBucketStartTime(int index) {
-        return  fHorDistributionData.getBucketStartTime(index);
-    }
-    
-    public long getHorBucketEndTime(int index) {
-        return fHorDistributionData.getBucketEndTime(index);
-    }
-    
-    public long getVerBucketStartTime(int index) {
-        return  fVerDistributionData.getBucketStartTime(index);
-    }
-    
-    public long getVerBucketEndTime(int index) {
-        return fVerDistributionData.getBucketEndTime(index);
-    }
-    
-    public int getEventCount(int horIndex, int verIndex) {
-        return fData[horIndex][verIndex];
-    }
-    
-    public long getCurrentEventTime() {
-        return fCurrentEventTime;
-    }
-
-    public boolean isCurrentEventTimeValid() {
-        if (fCurrentEventTime == Config.INVALID_EVENT_TIME || fCurrentEventTime < getHorFirstEventTime() || fCurrentEventTime > getHorLastEventTime()) {
-            return false;
-        }
-        return true;
-    }
-    
-    public int getHorBucketIndex(long time) {
-         return fHorDistributionData.getIndex(time);
-    }
-    
-    public int getVerBucketIndex(long time) {
-        return fVerDistributionData.getIndex(time);
-    }
-    
-    public boolean isHorIndexValid(int index) {
-        return fHorDistributionData.isIndexValid(index);
-    }
-    
-    public boolean isVerIndexValid(int index) {
-        return fVerDistributionData.isIndexValid(index);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    public void setWidth(int width) {
-        fWidth = width;
-    }
-
-    public void setHeight(int height) {
-        fHeight = height;
-    }
-    
-    public void setBarWidth(int barWidth) {
-        fBarWidth = barWidth;
-    }
-
-    public void setData(int[][] data) {
-        fData = data;
-    }
-
-    public void setHorFirstBucketTime(long firstBucketTime) {
-        fHorDistributionData.setFirstBucketTime(firstBucketTime);
-    }
-
-    public void setVerFirstBucketTime(long firstBucketTime) {
-        fVerDistributionData.setFirstBucketTime(firstBucketTime);
-    }
-
-    public void setHorFirstEventTime(long firstEventTime) {
-        fHorDistributionData.setFirstEventTime(firstEventTime);
-    }
-
-    public void setVerFirstEventTime(long firstEventTime) {
-        fVerDistributionData.setFirstEventTime(firstEventTime);
-    }
-
-    public void setHorLastEventTime(long lastEventTime) {
-        fHorDistributionData.setLastEventTime(lastEventTime);
-    }
-
-    public void setVerLastEventTime(long lastEventTime) {
-        fVerDistributionData.setLastEventTime(lastEventTime);
-    }
-
-    public void setHorBucketDuration(long bucketDuration) {
-        fHorDistributionData.setBucketDuration(bucketDuration);
-    }
-
-    public void setVerBucketDuration(long bucketDuration) {
-        fVerDistributionData.setBucketDuration(bucketDuration);
-    }
-
-    public void setHorLastBucket(int lastBucket) {
-        fHorDistributionData.setLastBucket(lastBucket);
-    }
-
-    public void setVerLastBucket(int lastBucket) {
-        fVerDistributionData.setLastBucket(lastBucket);
-    }
-
-    public void setCurrentEventTime(long currentEventTime) {
-        fCurrentEventTime = currentEventTime;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/IGraphDataModel.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/IGraphDataModel.java
deleted file mode 100644 (file)
index 5d42be9..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;
-
-import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;
-
-/**
- * <b><u>IGraphDataModel</u></b>
- * <p>
- */
-public interface IGraphDataModel extends IBaseDistributionModel {
-
-    /**
-     * Add event to the correct bucket, compacting the if needed.
-     * 
-     * @param eventCount - the event count
-     * @param timestamp - the timestamp (x-coordinate) of the event to count
-     * @param time - the time (y-coordinate) of the event to count
-     */
-    public void countEvent(int eventCount, long timestamp, long time);
-    
-    /**
-     * Scale the model data to the width and height requested.
-     * 
-     * @param width - width of graph
-     * @param height - height of graph
-     * @param barWidth - width of bar
-     * @return the result array of size [width] and where the highest value
-     *         doesn't exceed [height]
-     */
-    public GraphScaledData scaleTo(int width, int height, int barWidth);
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/IGraphModelListener.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/IGraphModelListener.java
deleted file mode 100644 (file)
index b664399..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;
-
-/**
- * <b><u>IGraphModelListener</u></b>
- * <p>
- */
-public interface IGraphModelListener {
-    
-    /**
-     * Method to notify listeners about model updates 
-     */
-    public void graphModelUpdated();
-
-    /**
-     * Method to inform listeners about current time updates 
-     */
-    public void currentEventUpdated(long currentEventTime);
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyController.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyController.java
deleted file mode 100644 (file)
index 6359b37..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;
-
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
-import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
-import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;
-import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel;
-
-/**
- * <b><u>LatencyController</u></b>
- * <p>
- */
-public class LatencyController {
-   
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private static LatencyController fInstance = null;
-    
-    private LatencyEventRequest fEventRequest;
-    
-    private TmfEventProvider<?> fProvider;
-    
-    private final ListenerList fModels;
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    private LatencyController() {
-        fModels = new ListenerList();
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-    public static LatencyController getInstance() {
-        if (fInstance == null) {
-            fInstance = new LatencyController();
-        }
-        return fInstance;
-    }
-    
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * Refresh all registered models
-     * 
-     * @param provider - TmfEventProvider to request data from
-     * @param timeRange - time range of request
-     */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public void refreshModels(TmfEventProvider<?> provider, TmfTimeRange timeRange) {
-        // save provider
-        fProvider = provider;
-        if (fProvider != null) {
-            if (fEventRequest != null && !fEventRequest.isCompleted()) {
-                fEventRequest.cancel();
-            }
-            clear();
-            fEventRequest = new LatencyEventRequest(this, timeRange, ExecutionType.FOREGROUND);
-            fProvider.sendRequest((TmfDataRequest)fEventRequest);
-        }
-    }
-
-    /**
-     * Refreshes registered models by re-sending previous request to saved provider
-     */
-    public void refreshModels() {
-        if (fProvider != null && fEventRequest != null) {
-            refreshModels(fProvider, fEventRequest.getRange());
-        }
-    }
-
-    /**
-     * Clear all models
-     */
-    public void clear() {
-        Object models[] = fModels.getListeners();
-        
-        for (int i = 0; i < models.length; i++) {
-            ((IBaseDistributionModel)models[i]).clear();
-        }
-    }
-    
-    /**
-     * Dispose of controller
-     */
-    public void dispose() {
-        if (fEventRequest != null && !fEventRequest.isCompleted()) {
-            fEventRequest.cancel();
-        }
-        fProvider = null;
-    }
-    
-    /**
-     * Register given model.
-     * @param model - model to register
-     */
-    public void registerModel(IBaseDistributionModel model) {
-        fModels.add(model);
-    }
-    
-    /**
-     * Deregister given model.
-     * 
-     * @param model - model to deregister
-     */
-    public void deregisterModel(IBaseDistributionModel model) {
-        fModels.remove(model);
-    }
-    
-    /**
-     * Handle data of event request and pass it information to the registered models
-     * 
-     * @param eventCount - event count
-     * @param timestamp - start timestamp of latency calculation
-     * @param latency - latency value (startTimestamp - endTimestamp)
-     */
-    public void handleData(int eventCount, long timestamp, long latency) {
-        Object[] models = fModels.getListeners();
-        for (int i = 0; i < models.length; i++) {
-            IBaseDistributionModel model = (IBaseDistributionModel)models[i];
-            if (model instanceof IHistogramDataModel) {
-                ((IHistogramDataModel)model).countEvent(eventCount, latency);
-            } else if (model instanceof IGraphDataModel) {
-                ((IGraphDataModel)model).countEvent(eventCount, timestamp, latency);
-            }
-        }
-    }
-
-    /**
-     * Handle complete indication from request.
-     */
-    public void handleCompleted() {
-        Object[] models = fModels.getListeners();
-        for (int i = 0; i < models.length; i++) {
-            ((IBaseDistributionModel)models[i]).complete();
-        }
-    }
-
-    /**
-     * Handle cancel indication from request.
-     */
-    public void handleCancel() {
-        clear();
-    }
-    
-    /**
-     * Set event provider for refresh.
-     * 
-     * @param provider
-     */
-    public void setEventProvider(TmfEventProvider<?> provider) {
-        fProvider = provider;
-    }
-    
-    /**
-     * Set current event time in model(s).
-     * 
-     * @param timestamp
-     */
-    public void setCurrentEventTime(long timestamp) {
-        Object[] models = fModels.getListeners();
-        for (int i = 0; i < models.length; i++) {
-            IBaseDistributionModel model = (IBaseDistributionModel)models[i];
-            if (model instanceof LatencyGraphModel) {
-                ((LatencyGraphModel)model).setCurrentEventNotifyListeners(timestamp);
-            }
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyEventRequest.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyEventRequest.java
deleted file mode 100644 (file)
index 24b389e..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;
-
-import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-
-/**
- * <b><u>LatencyEventRequest</u></b>
- * <p>
- */
-public class LatencyEventRequest extends TmfEventRequest<LttngEvent> {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    final private LatencyController fController;
-    
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    public LatencyEventRequest(LatencyController controller, TmfTimeRange range, int rank, int nbEvents, ITmfDataRequest.ExecutionType execType) {
-        super(LttngEvent.class, range, rank, nbEvents, LttngConstants.DEFAULT_BLOCK_SIZE, execType);
-        fController = controller;
-        EventMatcher.getInstance().clearStack();
-    }
-
-    public LatencyEventRequest(LatencyController controller, TmfTimeRange range, ITmfDataRequest.ExecutionType execType) {
-        this(controller, range, 0, ALL_DATA, execType);
-    }
-
-    public LatencyEventRequest(LatencyController controller, TmfTimeRange range, int rank, ITmfDataRequest.ExecutionType execType) {
-        this(controller, range, rank, ALL_DATA, execType);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.event.TmfData)
-     */
-    @Override
-    public void handleData(LttngEvent event) {
-        super.handleData(event);
-        
-        LttngEvent startEvent = EventMatcher.getInstance().process(event);
-
-        if (startEvent != null) {
-            long latency = event.getTimestamp().getValue() - startEvent.getTimestamp().getValue(); 
-            fController.handleData(getNbRead(), startEvent.getTimestamp().getValue(), latency);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCompleted()
-     */
-    @Override
-    public void handleCompleted() {
-        fController.handleCompleted();
-        super.handleCompleted();
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCancel()
-     */
-    @Override
-    public void handleCancel() {
-        EventMatcher.getInstance().clearStack();
-        fController.handleCancel();
-        super.handleCancel();
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyGraphModel.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/model/LatencyGraphModel.java
deleted file mode 100644 (file)
index 399379f..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.latency.model;
-
-import java.util.Arrays;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.linuxtools.lttng.ui.views.distribution.model.DistributionData;
-import org.eclipse.linuxtools.lttng.ui.views.distribution.model.HorDistributionData;
-import org.eclipse.linuxtools.lttng.ui.views.distribution.model.VerDistributionData;
-
-/**
- * <b><u>LatencyGraphModel</u></b>
- * <p>
- */
-public class LatencyGraphModel implements IGraphDataModel {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    private final int fNbBuckets;
-    private final int [][] fBuckets;
-    private final DistributionData fHorDistributionData;
-    private final DistributionData fVerDistributionData;
-    private long fCurrentEventTime;
-    
-    // private listener lists
-    private final ListenerList fModelListeners;
-
-    private final ReentrantLock fLock;
-    
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-    public LatencyGraphModel() {
-        this(Config.DEFAULT_NUMBER_OF_BUCKETS);
-    }
-
-    public LatencyGraphModel(int nbBuckets) {
-        fNbBuckets = nbBuckets;
-        fBuckets = new int[nbBuckets][nbBuckets];
-        fHorDistributionData = new HorDistributionData(nbBuckets, fBuckets);
-        fVerDistributionData = new VerDistributionData(nbBuckets, fBuckets);
-        fCurrentEventTime = Config.INVALID_EVENT_TIME;
-       
-        fModelListeners = new ListenerList();
-        fLock = new ReentrantLock();
-        clear();
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-    
-    public int getNbBuckets() {
-        return fNbBuckets;
-    }
-    
-    public long getHorBucketDuration() {
-        fLock.lock(); 
-        try {
-            return fHorDistributionData.getBucketDuration();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getVerBucketDuration() {
-        fLock.lock(); 
-        try {
-            return fVerDistributionData.getBucketDuration();
-        } finally {
-            fLock.unlock();
-        }
-    }
-    
-    public long getHorFirstBucketTime() {
-        fLock.lock(); 
-        try {
-            return fHorDistributionData.getFirstBucketTime();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getVerFirstBucketTime() {
-        fLock.lock(); 
-        try {
-            return fVerDistributionData.getFirstBucketTime();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getHorFirstEventTime() {
-        fLock.lock(); 
-        try {
-            return fHorDistributionData.getFirstEventTime();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getVerFirstEventTime() {
-        fLock.lock(); 
-        try {
-            return fVerDistributionData.getFirstEventTime();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getHorLastEventTime() {
-        fLock.lock(); 
-        try {
-            return fHorDistributionData.getLastEventTime();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getVerLastEventTime() {
-        fLock.lock(); 
-        try {
-            return fVerDistributionData.getLastEventTime();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getHorTimeLimit() {
-        fLock.lock(); 
-        try {
-            return fHorDistributionData.getTimeLimit();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public long getVerTimeLimit() {
-        fLock.lock(); 
-        try {
-            return fVerDistributionData.getTimeLimit();
-        } finally {
-            fLock.unlock();
-        }
-    }
-    
-    public int getHorLastBucket() {
-        fLock.lock(); 
-        try {
-            return fHorDistributionData.getLastBucket();
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    public int getVerLastBucket() {
-        fLock.lock(); 
-        try {
-            return fVerDistributionData.getLastBucket();
-        } finally {
-            fLock.unlock();
-        }
-    }
-    
-    public long getCurrentEventTime() {
-        fLock.lock();
-        try {
-            return fCurrentEventTime;
-        } finally {
-            fLock.unlock();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Listener interface
-    // ------------------------------------------------------------------------
-    public void addGraphModelListener(IGraphModelListener listener) {
-        fModelListeners.add(listener);        
-    }
-    
-    public void removeGraphModelListener(IGraphModelListener listener) {
-        fModelListeners.remove(listener);
-    }
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.IBaseDataModel#clear()
-     */
-    @Override
-    public void clear() {
-        fLock.lock();
-        try {
-            for (int[] row : fBuckets) {
-                Arrays.fill(row, 0, fNbBuckets, 0);
-            }
-            fHorDistributionData.clear();
-            fVerDistributionData.clear();
-        } finally {
-            fLock.unlock();
-        }
-        fireModelUpdateNotification();
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphDataModel#countEvent(int, long, long)
-     */
-    @Override
-    public void countEvent(int eventCount, long timestamp, long time) {
-        fLock.lock();
-        try {
-            int horIndex = fHorDistributionData.countEvent(timestamp);
-            int verIndex = fVerDistributionData.countEvent(time);
-
-            fBuckets[horIndex][verIndex]++;
-        } finally {
-            fLock.unlock();
-        }
-
-        fireModelUpdateNotification(eventCount);
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphDataModel#scaleTo(int, int, int)
-     */
-    @Override
-    public GraphScaledData scaleTo(int width, int height, int barWidth) {
-        GraphScaledData scaledData = new GraphScaledData(width, height, barWidth);
-        fLock.lock();
-        try {
-            if (!fHorDistributionData.isFirst() && !fVerDistributionData.isFirst() ) {
-
-                // Basic validation
-                if (width <= 0 ||  height <= 0 || barWidth <= 0)
-                    throw new AssertionError("Invalid histogram dimensions (" + width + "x" + height + ", barWidth=" + barWidth + ")");   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
-
-                // Scale horizontally
-                int nbBars = width / barWidth;
-                int bucketsPerBar = fHorDistributionData.getLastBucket() / nbBars + 1;
-
-                int horData[][] = new int[nbBars][fNbBuckets];  
-                for (int y = 0; y < fNbBuckets; y++) {
-                    for (int i = 0; i < nbBars; i++) {
-                        int count = 0;
-                        for (int j = i * bucketsPerBar; j < (i + 1) * bucketsPerBar; j++) {
-                            if (fNbBuckets <= j)
-                                break;
-                            count += fBuckets[j][y];
-                        }
-                        horData[i][y] = count;
-                    }
-                }
-
-                // Scale vertically
-                int nbVerBars = height / barWidth;
-                int bucketsPerVerBar = fVerDistributionData.getLastBucket() / nbVerBars + 1;
-
-                int verData[][] = new int[nbBars][nbVerBars];  
-                for (int x = 0; x < nbBars; x++) {
-                    for (int i = 0; i < nbVerBars; i++) {
-                        int count = 0;
-                        for (int j = i * bucketsPerVerBar; j < (i + 1) * bucketsPerVerBar; j++) {
-                            if (fNbBuckets <= j)
-                                break;
-                            count += horData[x][j];
-                        }
-                        verData[x][i] = count;
-                    }
-                }
-
-                scaledData.setData(verData);
-                scaledData.setHorFirstBucketTime(fHorDistributionData.getFirstBucketTime());
-                scaledData.setVerFirstBucketTime(fVerDistributionData.getFirstBucketTime());
-                scaledData.setHorFirstEventTime(fHorDistributionData.getFirstEventTime());
-                scaledData.setVerFirstEventTime(fVerDistributionData.getFirstEventTime());
-                scaledData.setHorLastEventTime(fHorDistributionData.getLastEventTime());
-                scaledData.setVerLastEventTime(fVerDistributionData.getLastEventTime());
-                scaledData.setHorBucketDuration(bucketsPerBar * fHorDistributionData.getBucketDuration());
-                scaledData.setVerBucketDuration(bucketsPerVerBar * fVerDistributionData.getBucketDuration());
-                scaledData.setHorLastBucket(fHorDistributionData.getLastBucket() / bucketsPerBar);
-                scaledData.setVerLastBucket(fVerDistributionData.getLastBucket() / bucketsPerVerBar);
-                scaledData.setCurrentEventTime(fCurrentEventTime);
-            }
-        } finally {
-            fLock.unlock();
-        }
-
-        return scaledData;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.distribution.model.IBaseDataModel#complete()
-     */
-    @Override
-    public void complete() {
-        fireModelUpdateNotification();
-    }
-
-    /**
-     * Sets the current event time but don't notify listeners.
-     * 
-     * @param timestamp
-     */
-    public void setCurrentEvent(long timestamp) {
-        fLock.lock();
-        try {
-            fCurrentEventTime = timestamp;
-        } finally {
-            fLock.unlock();
-        }   
-    }
-
-    /**
-     * Sets the current event time and notify listeners.
-     * 
-     * @param timestamp
-     */
-    public void setCurrentEventNotifyListeners(long timestamp) {
-        fLock.lock();
-        try {
-            fCurrentEventTime = timestamp;
-        } finally {
-            fLock.unlock();
-        }
-        fireCurrentEventUpdateNotification();
-    }
-   
-    // ------------------------------------------------------------------------
-    // Helper functions
-    // ------------------------------------------------------------------------
-
-    /*
-     * Notify listeners immediately
-     */
-    private void fireModelUpdateNotification() {
-        fireModelUpdateNotification(0);
-    }
-    
-    /*
-     * Notify listeners with certain refresh rate.
-     */
-    private void fireModelUpdateNotification(int count) {
-        if (count % Config.POINT_BUFFER_SIZE == 0) {
-            Object[] listeners = fModelListeners.getListeners();
-            for (int i = 0; i < listeners.length; i++) {
-                IGraphModelListener listener = (IGraphModelListener) listeners[i];
-                listener.graphModelUpdated();
-            }
-        }
-    }
-
-    /*
-     * Notify listeners immediately
-     */
-    private void fireCurrentEventUpdateNotification() {
-        Object[] listeners = fModelListeners.getListeners();
-        for (int i = 0; i < listeners.length; i++) {
-            IGraphModelListener listener = (IGraphModelListener) listeners[i];
-            listener.currentEventUpdated(fCurrentEventTime);
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/Messages.java
deleted file mode 100644 (file)
index e01dae1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2009 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation\r
- *******************************************************************************/\r
-package org.eclipse.linuxtools.lttng.ui.views.resources;\r
-\r
-import java.util.MissingResourceException;\r
-import java.util.ResourceBundle;\r
-\r
-public class Messages {\r
-       private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.resources.messages"; //$NON-NLS-1$\r
-\r
-       private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle\r
-                       .getBundle(BUNDLE_NAME);\r
-\r
-       private Messages() {\r
-       }\r
-\r
-       public static String getString(String key) {\r
-               try {\r
-                       return RESOURCE_BUNDLE.getString(key);\r
-               } catch (MissingResourceException e) {\r
-                       return '!' + key + '!';\r
-               }\r
-       }\r
-}\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java
deleted file mode 100644 (file)
index 49ce883..0000000
+++ /dev/null
@@ -1,596 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * 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.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
-import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
-import org.eclipse.linuxtools.internal.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.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.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.TmfExperimentUpdatedSignal;
-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;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * @author alvaro
- * 
- */
-public class ResourcesView extends AbsTimeUpdateView implements
-               ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener {
-
-       // ========================================================================
-       // Data
-       // ========================================================================
-       public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.resources"; //$NON-NLS-1$
-
-       // private int totalNumItems = 0;
-       // Actions
-       private Action resetScale;
-       private Action nextEvent;
-       private Action prevEvent;
-       private Action nextTrace;
-       private Action prevTrace;
-       private Action showLegend;
-       private Action filterTraces;
-       private Action zoomIn;
-       private Action zoomOut;
-       private Action zoomFilter;
-       private Composite top;
-
-       private TmfTimeRange initTimeRange = TmfTimeRange.NULL_RANGE;
-
-       // private static SimpleDateFormat stimeformat = new SimpleDateFormat(
-       // "yy/MM/dd HH:mm:ss");
-
-       // private TraceModelImplFactory fact;
-
-       // ========================================================================
-       // Constructor
-       // ========================================================================
-
-       /**
-        * The constructor.
-        */
-       public ResourcesView() {
-               super(ID);
-       }
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-
-       /**
-        * This is a callback that will allow us to create the viewer and initialize
-        * it.
-        */
-       @Override
-       public void createPartControl(Composite parent) {
-               top = new Composite(parent, SWT.BORDER);
-
-               top.setLayout(new FillLayout());
-               tsfviewer = TmfViewerFactory.createViewer(top, new ResourcesTimeRangeViewerProvider(getParamsUpdater()));
-
-               tsfviewer.addWidgetSelectionListner(this);
-               tsfviewer.addWidgetTimeScaleSelectionListner(this);
-
-               // Traces shall not be grouped to allow synchronisation
-               tsfviewer.groupTraces(true);
-               tsfviewer.setAcceptSelectionAPIcalls(true);
-
-               // Viewer to notify selection to this class
-               // This class will synchronise selections with table.
-//             tsfviewer.addWidgetSelectionListner(this);
-//             tsfviewer.addWidgetTimeScaleSelectionListner(this);
-
-               // Create the help context id for the viewer's control
-               // TODO: Associate with help system
-               PlatformUI.getWorkbench().getHelpSystem().setHelp(
-                               tsfviewer.getControl(),
-                               "org.eclipse.linuxtools.lttng.ui.views.resource.view"); //$NON-NLS-1$
-
-               makeActions();
-               hookContextMenu();
-               contributeToActionBars();
-
-//             // Read relevant values
-//             int timeSpaceWidth = tsfviewer.getTimeSpace();
-//             if (timeSpaceWidth < 0) {
-//                     timeSpaceWidth = -timeSpaceWidth;
-//             }
-
-               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
-               if (experiment != null) {
-                       TmfTimeRange experimentTRange = experiment.getTimeRange();
-                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
-                               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);
-                       }
-               } else {
-                       TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
-               }
-       }
-
-       private void hookContextMenu() {
-               MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
-               menuMgr.setRemoveAllWhenShown(true);
-               menuMgr.addMenuListener(new IMenuListener() {
-                       @Override
-                       public void menuAboutToShow(IMenuManager manager) {
-                               ResourcesView.this.fillContextMenu(manager);
-                       }
-               });
-
-               Menu menu = menuMgr.createContextMenu(tsfviewer.getControl());
-               tsfviewer.getControl().setMenu(menu);
-               getSite()
-                               .registerContextMenu(menuMgr, tsfviewer.getSelectionProvider());
-       }
-
-       private void contributeToActionBars() {
-               IActionBars bars = getViewSite().getActionBars();
-               fillLocalPullDown(bars.getMenuManager());
-               fillLocalToolBar(bars.getToolBarManager());
-       }
-
-       private void fillLocalPullDown(IMenuManager manager) {
-               manager.add(new Separator());
-               manager.add(showLegend);
-               manager.add(new Separator());
-               manager.add(resetScale);
-               manager.add(nextEvent);
-               manager.add(prevEvent);
-               manager.add(nextTrace);
-               manager.add(prevTrace);
-               // manager.add(filterTraces);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(zoomFilter);
-               manager.add(new Separator());
-       }
-
-       private void fillContextMenu(IMenuManager manager) {
-               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(filterTraces);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(zoomFilter);
-               manager.add(new Separator());
-               manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-       }
-
-       private void fillLocalToolBar(IToolBarManager manager) {
-               manager.add(showLegend);
-               manager.add(new Separator());
-               manager.add(resetScale);
-               manager.add(nextEvent);
-               manager.add(prevEvent);
-               manager.add(nextTrace);
-               manager.add(prevTrace);
-               // manager.add(filterTraces);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(zoomFilter);
-               manager.add(new Separator());
-       }
-
-       private void makeActions() {
-               // action4
-               resetScale = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.resetStartFinishTime();
-                               }
-
-                       }
-               };
-               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/elcl16/home_nav.gif")); //$NON-NLS-1$ //$NON-NLS-2$
-
-               // action5
-               nextEvent = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectNextEvent();
-                               }
-                       }
-               };
-               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/elcl16/next_event.gif"));  //$NON-NLS-1$//$NON-NLS-2$
-
-               // action6
-               prevEvent = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectPrevEvent();
-                               }
-                       }
-               };
-               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/elcl16/prev_event.gif")); //$NON-NLS-1$//$NON-NLS-2$
-
-               // action7
-               nextTrace = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectNextTrace();
-                               }
-                       }
-               };
-               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/elcl16/next_item.gif")); //$NON-NLS-1$//$NON-NLS-2$
-
-               // action8
-               prevTrace = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.selectPrevTrace();
-                               }
-                       }
-               };
-               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/elcl16/prev_item.gif"));  //$NON-NLS-1$//$NON-NLS-2$
-
-               // action9
-               showLegend = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.showLegend();
-                               }
-                       }
-               };
-               showLegend.setText(Messages.getString("ResourcesView.Action.Legend")); //$NON-NLS-1$
-               showLegend.setToolTipText(Messages.getString("ResourcesView.Action.Legend.ToolTip")); //$NON-NLS-1$
-
-               // action10
-               filterTraces = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.filterTraces();
-                               }
-                       }
-               };
-               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/elcl16/filter_items.gif"));  //$NON-NLS-1$//$NON-NLS-2$
-
-               // action10
-               zoomIn = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.zoomIn();
-                               }
-                       }
-               };
-               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/elcl16/zoomin_nav.gif"));  //$NON-NLS-1$//$NON-NLS-2$
-
-               // action10
-               zoomOut = new Action() {
-                       @Override
-                       public void run() {
-                               if (tsfviewer != null) {
-                                       tsfviewer.zoomOut();
-                               }
-                       }
-               };
-               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/elcl16/zoomout_nav.gif"));  //$NON-NLS-1$//$NON-NLS-2$
-
-               // zoomFilter
-               zoomFilter = new Action() {
-                       @Override
-                       public void run() {
-                               // Nothing to do, however the selection status is needed by the
-                               // application
-                       }
-               };
-
-               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/elcl16/filter_items.gif"));  //$NON-NLS-1$//$NON-NLS-2$
-               zoomFilter.setChecked(false);
-
-               // PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_SYNCED);
-       }
-
-       /**
-        * Passing the focus request to the viewer's control.
-        */
-       @Override
-       public void setFocus() {
-               tsfviewer.getControl().setFocus();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * tsfTmProcessSelEvent
-        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent
-        * )
-        */
-       @Override
-       public void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) {
-               // common implementation
-               super.tsfTmProcessSelEvent(event);
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
-        * ITmfTimeScaleSelectionListener
-        * #tsfTmProcessTimeScaleEvent(org.eclipse.linuxtools
-        * .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent)
-        */
-       @Override
-       public void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) {
-               super.tsfTmProcessTimeScaleEvent(event);
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel
-        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry[], long, long, boolean, long, long,
-        * java.lang.Object)
-        */
-       @Override
-       public void displayModel(final ITmfTimeAnalysisEntry[] items, final long startBoundTime,
-                       final long endBoundTime, final boolean updateTimeBounds, final long startVisibleWindow,
-                       final long endVisibleWindow, final Object source) {
-               
-               // Return if disposed
-               if ((tsfviewer == null) || (tsfviewer.getControl().isDisposed())) return;
-               
-               Display display = tsfviewer.getControl().getDisplay();
-               display.asyncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
-                                       tsfviewer.display(items, startBoundTime, endBoundTime, updateTimeBounds);
-                                       // validate visible boundaries
-                                       if (startVisibleWindow > -1 && endVisibleWindow > -1) {
-                                               tsfviewer.setSelectVisTimeWindow(startVisibleWindow, endVisibleWindow, source);
-                                       }
-                                       tsfviewer.resizeControls();
-                               }
-                       }
-               });
-       }
-
-       @Override
-       public void dispose() {
-               // dispose parent resources
-               super.dispose();
-
-               tsfviewer.removeWidgetSelectionListner(this);
-               tsfviewer.removeWidgetTimeScaleSelectionListner(this);
-               tsfviewer = null;
-       }
-
-       /**
-        * Registers as listener of time selection from other tmf views
-        * 
-        * @param signal
-        */
-       @Override
-       @TmfSignalHandler
-       public void synchToTime(TmfTimeSynchSignal signal) {
-               super.synchToTime(signal);
-       }
-
-       /**
-        * Annotation Registers as listener of time range selection from other views
-        * The implementation handles the entry of the signal.
-        * 
-        * @param signal
-        */
-       @TmfSignalHandler
-       public void synchToTimeRange(TmfRangeSynchSignal signal) {
-               if (zoomFilter != null) {
-                       synchToTimeRange(signal, zoomFilter.isChecked());
-               }
-       }
-
-       @Override
-       public void modelIncomplete(ILttngSyntEventRequest request) {
-               // Nothing to do
-               // The data will be refreshed on the next request
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getEventProcessor()
-        */
-       @Override
-       public ITransEventProcessor getEventProcessor() {
-               return ResourcesEventToHandlerFactory.getInstance();
-       }
-
-       /**
-        * @param signal
-        */
-       @TmfSignalHandler
-       public void experimentSelected(TmfExperimentSelectedSignal<? extends TmfEvent> signal) {
-               if (signal != null) {
-                       TmfTimeRange experimentTRange = signal.getExperiment().getTimeRange();
-
-                       initTimeRange = TmfTimeRange.NULL_RANGE;
-                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
-                               // 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_RANGE && signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
-                       TmfTimeRange experimentTRange = signal.getRange();
-
-                       if (experimentTRange != TmfTimeRange.NULL_RANGE) {
-                               // prepare time intervals in widget
-                               modelUpdateInit(experimentTRange, experimentTRange, signal.getSource());
-
-                               // request initial data
-                               initialExperimentDataRequest(signal.getSource(), experimentTRange);
-                       }
-               }
-       }
-
-    @TmfSignalHandler
-    public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
-        if (signal.getExperiment().equals(TmfExperiment.getCurrentExperiment())) {
-            final TmfTimeRange range = signal.getExperiment().getTimeRange();
-            if (range != TmfTimeRange.NULL_RANGE) {
-                Display.getDefault().asyncExec(new Runnable() {
-                    @Override
-                    public void run() {
-                        tsfviewer.setTimeBounds(range.getStartTime().getValue(), range.getEndTime().getValue());
-                    }});
-            }
-        }
-    }
-
-       /**
-        * @param source
-        * @param experimentTRange
-        * @return Adjusted time window used for the request (smaller window to
-        *         initialize view)
-        */
-       private TmfTimeRange initialExperimentDataRequest(Object source, TmfTimeRange experimentTRange) {
-               // Adjust the initial time window to a shorter interval to allow
-               // user to select the interesting area based on the perspective
-               TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
-
-               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;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getParamsUpdater()
-        */
-       @Override
-       protected ParamsUpdater getParamsUpdater() {
-               return ResourceModelFactory.getParamsUpdater();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getItemContainer()
-        */
-       @Override
-       protected ItemContainer<?> getItemContainer() {
-               return ResourceModelFactory.getResourceContainer();
-       }
-       
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getProviderId()
-        */
-       @Override
-    protected int getProviderId() { 
-        return LttngCoreProviderFactory.RESOURCE_LTTNG_SYTH_EVENT_PROVIDER; 
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java
deleted file mode 100644 (file)
index 70e1a7c..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
-
-import java.util.Vector;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent.Type;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeResourceFactory;
-import org.eclipse.linuxtools.lttng.ui.views.common.AbsTRangeUpdate;
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
-import org.eclipse.linuxtools.lttng.ui.views.resources.model.ResourceContainer;
-import org.eclipse.linuxtools.lttng.ui.views.resources.model.ResourceModelFactory;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-
-public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
-               implements ILttngEventProcessor {
-
-       // ========================================================================
-       // Data
-       // =======================================================================
-       protected ResourceContainer resContainer = ResourceModelFactory
-                       .getResourceContainer();
-       protected ParamsUpdater params = ResourceModelFactory.getParamsUpdater();
-       protected static final Long ANY_CPU = 0L;
-
-       // ========================================================================
-       // Methods
-       // =======================================================================
-       protected TimeRangeEventResource addLocalResource(long traceStartTime,
-                       long traceEndTime, String traceId, ResourceTypes type, Long resId,
-                       long insertionTime) {
-
-               String resourceName = type.toString() + " " + resId.toString(); //$NON-NLS-1$
-               // Note : the "traceid" here is assigned to the "groupname" as we group
-               // by trace in the UI
-               TimeRangeEventResource localRessource = TimeRangeResourceFactory
-                               .getInstance().createResource(resContainer.getUniqueId(),
-                                               traceStartTime, traceEndTime, resourceName, traceId,
-                                               "", type, resId, insertionTime); //$NON-NLS-1$
-               resContainer.addItem(localRessource);
-
-               if (TraceDebug.isRV()) {
-                       TraceDebug.traceRV("addLocalResource():" + localRessource); //$NON-NLS-1$
-               }
-
-               return localRessource;
-       }
-
-       /**
-        * Used to check if the event is visible within the current visible time
-        * window
-        * 
-        * @return
-        */
-       protected boolean withinViewRange(long stime, long etime) {
-               long windowStartTime = params.getStartTime();
-               long windowEndTime = params.getEndTime();
-
-               // Start of event is already out of range
-               if (stime > windowEndTime) {
-                       return false;
-               }
-
-               // End time within or beyond start of window as long as the start time
-               // is before the end of the window (condition above)
-               if (etime >= windowStartTime) {
-                       return true;
-               }
-
-               // // start time is within window
-               // if (stime >= windowStartTime && stime <= windowEndTime) {
-               // // The event or part of it shall be displayed.
-               // return true;
-               // }
-               //
-               // // end time is within window
-               // if (etime >= windowStartTime && etime <= windowEndTime) {
-               // // The event or part of it shall be displayed.
-               // return true;
-               // }
-
-               // crosses the window
-               if (stime <= windowStartTime && etime >= windowEndTime) {
-                       // The time range is bigger than the selected time window and
-                       // crosses it
-                       return true;
-               }
-
-               return false;
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_bdev(
-                       LttngTraceState traceState, Long resourceId) {
-               return resourcelist_obtain_generic(resourceId, ResourceTypes.BDEV,
-                               traceState.getTraceId());
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_trap(
-                       LttngTraceState traceState, Long resourceId) {
-               return resourcelist_obtain_generic(resourceId, ResourceTypes.TRAP,
-                               traceState.getTraceId());
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_irq(
-                       LttngTraceState traceState, Long resourceId) {
-               return resourcelist_obtain_generic(resourceId, ResourceTypes.IRQ,
-                               traceState.getTraceId());
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_soft_irq(
-                       LttngTraceState traceState, Long resourceId) {
-               return resourcelist_obtain_generic(resourceId, ResourceTypes.SOFT_IRQ,
-                               traceState.getTraceId());
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_cpu(
-                       LttngTraceState traceState, Long resourceId) {
-               return resourcelist_obtain_generic(resourceId, ResourceTypes.CPU,
-                               traceState.getTraceId());
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_machine(
-                       LttngTraceState traceState, Long resourceId) {
-               // *** VERIFY ***
-               // Does "UNKNOWN" make sense for "obtain_machine" ?
-               // It seems to be the only choice, thought...
-               return resourcelist_obtain_generic(resourceId, ResourceTypes.UNKNOWN,
-                               traceState.getTraceId());
-       }
-
-       public TimeRangeEventResource resourcelist_obtain_generic(Long resourceId,
-                       ResourceTypes resourceType, String traceId) {
-               return resContainer.findItem(resourceId, resourceType, traceId);
-       }
-
-       protected boolean globalProcessBeforeExecmode(LttngEvent trcEvent,
-                       LttngTraceState traceSt) {
-
-               // TODO: Implement the tracking of current resource in order ot speed up
-               // searching for the relevant resource similar to current_hash_data in
-               // the C implementation
-               // e.g.
-               // hashed_process_data =
-               // process_list->current_hash_data[trace_num][cpu];
-
-               TimeRangeEventResource localResource = resourcelist_obtain_cpu(traceSt,
-                               trcEvent.getCpuId());
-               Long cpu = trcEvent.getCpuId();
-               if (localResource == null) {
-                       TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
-                       localResource = addLocalResource(timeRange.getStartTime()
-                                       .getValue(), timeRange.getEndTime().getValue(),
-                                       traceSt.getTraceId(), ResourceTypes.CPU, cpu, trcEvent
-                                       .getTimestamp().getValue());
-               }
-
-               // get the start time
-               long stime = localResource.getNext_good_time();
-               // Get the resource state mode
-               String cpuStateMode = localResource.getStateMode(traceSt);
-               // Call the makeDraw function
-               makeDraw(traceSt, stime, trcEvent.getTimestamp().getValue(),
-                               localResource, params, cpuStateMode);
-
-               return false;
-       }
-
-       /**
-        * @param traceSt
-        * @param startTime
-        * @param endTime
-        * @param localResource
-        * @param params
-        * @param stateMode
-        * @return
-        */
-       @SuppressWarnings("deprecation")
-       protected boolean makeDraw(LttngTraceState traceSt, long stime, long etime,
-                       TimeRangeEventResource localResource, ParamsUpdater params,
-                       String stateMode) {
-
-               if (TraceDebug.isRV()) {
-                       TraceDebug.traceRV("makeDraw():[" + localResource + ",candidate=[stime=" + stime + ",etime=" + etime + ",state=" + stateMode + "]]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-               }
-
-               // Check if the event is out of range
-               if (!withinViewRange(stime, etime)) {
-                       params.incrementEventsDiscarded(ParamsUpdater.OUT_OF_VIEWRANGE);
-                       return false;
-               }
-
-               // Check if the time range is consistent.
-               if (etime < stime) {
-                       params.incrementEventsDiscardedWrongOrder();
-                       return false;
-               }
-
-               // Store the next good time to start drawing the next event
-               // this is done this early to display an accurate start time of the
-               // first event
-               // within the display window
-               // Moved at the end since it produces space gaps among events
-               // localResource.setNext_good_time(etime);
-
-               // If First event of a resource, initialise start time half page before to enable pagination to the left
-               if (stime < params.getStartTime()) {
-                       // event start time is before the visible time window
-                       long insertion = localResource.getInsertionTime();
-                       if (stime == insertion) {
-                               // if start time is equal to insertion this is the first event to be drawn for this resource
-                               long halfPage = (params.getEndTime() - params.getStartTime()) / 2;
-                               long initTime = params.getStartTime() - halfPage;
-                               if (initTime > insertion) {
-                                       // start time of this event is unknown, place it half page before visible window to allow left side
-                                       // pagination when selecting previous event
-                                       stime = initTime;
-                               }
-                       }
-               }
-
-               // Determine if the time range event will fit it the current
-               // pixel map
-               double duration = etime - stime;
-               double k = getPixelsPerNs(traceSt, params);
-               double pixels = duration * k;
-
-               // Visibility check
-               // Display a "more information" indication by allowing non visible event
-               // as long as its previous event is visible.
-               boolean visible = true;
-               if (pixels < 1.0) {
-                       boolean prevEventVisibility = true;
-                       // Get the visibility indication on previous event for
-                       // this process
-                       Vector<TimeRangeComponent> inMemEvents = localResource
-                                       .getTraceEvents();
-                       if (inMemEvents.size() != 0) {
-                               TimeRangeComponent prevEvent = inMemEvents.get(inMemEvents
-                                               .size() - 1);
-                               prevEventVisibility = prevEvent.isVisible();
-
-                               // if previous event visibility is false and the time span
-                               // between events less than two pixels, there is no need to
-                               // load it in memory i.e. not visible and a more indicator is
-                               // within two pixels.
-                               // return i.e. event discarded to free up memory
-                               Long eventSpan = stime - prevEvent.getStartTime();
-                               if (prevEventVisibility == false
-                                               && ((double) eventSpan * k) < 2.0) {
-                                       params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
-                                       return false;
-                               }
-                       }
-
-                       // if previous event is visible, set this one to not
-                       // visible and continue
-                       visible = false;
-               }
-
-               Type eventType = getEventType(localResource);
-               if (eventType != null) {
-                       TimeRangeEvent time_window = new TimeRangeEvent(stime, etime,
-                                       localResource, eventType, stateMode);
-
-                       time_window.setVisible(visible);
-                       localResource.addChildren(time_window);
-
-                       localResource.setNext_good_time(etime);
-               }
-
-               return false;
-       }
-
-       /**
-        * Convert between resource type and timeRange event type
-        * 
-        * @param resource
-        * @return
-        */
-       private Type getEventType(TimeRangeEventResource resource) {
-               // TODO: Can we merge into one type
-               ResourceTypes resType = resource.getType();
-               Type eventType = null;
-
-               switch (resType) {
-               case CPU:
-                       eventType = Type.CPU_MODE;
-                       break;
-               case IRQ:
-                       eventType = Type.IRQ_MODE;
-                       break;
-               case SOFT_IRQ:
-                       eventType = Type.SOFT_IRQ_MODE;
-                       break;
-               case TRAP:
-                       eventType = Type.TRAP_MODE;
-                       break;
-               case BDEV:
-                       eventType = Type.BDEV_MODE;
-                       break;
-               default:
-                       eventType = Type.PROCESS_MODE;
-                       break;
-               }
-
-               return eventType;
-       }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesAfterUpdateHandlers.java
deleted file mode 100644 (file)
index cdd2584..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-
-/**
- * Creates instances of specific after state update handlers, per corresponding
- * event.
- * 
- * @author alvaro
- * 
- */
-public class ResourcesAfterUpdateHandlers {
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SCHED_SCHEDULE
-        * </p>
-        * Replace C function named "after_schedchange_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getAfterSchedChangeHandler() {
-               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
-
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               // TODO: After sched scheduler handler should implement an
-                               // update to the current resource data, similar to
-                               // current_hash_data in C
-                               // We don't keep track of current hashed resource, we look in
-                               // the hash table every time. keeping track of current hash may
-                               // improve performance, although needs to be bench marked to
-                               // verify
-                               // if there's is a real gain.
-
-                               // process_list->current_hash_data[trace_num][process_in->cpu] =
-                               // hashed_process_data_in;
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-       /**
-        * Drawing stuff ?
-        */
-       // int after_request(void *hook_data, void *call_data)
-       // int after_chunk(void *hook_data, void *call_data)
-       // int before_statedump_end(void *hook_data, void *call_data)
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesBeforeUpdateHandlers.java
deleted file mode 100644 (file)
index a20b085..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Channels;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Fields;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-
-/**
- * Creates instances of specific before state update handlers, per corresponding
- * event.
- * 
- * @author alvaro
- * 
- */
-public class ResourcesBeforeUpdateHandlers {
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SCHED_SCHEDULE
-        * </p>
-        * Replace C function named "before_schedchange_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID(?), LTT_FIELD_PREV_STATE
-        * (?)
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getBeforeSchedChangeHandler() {
-               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                               // Create a time range for the cpu.
-                               globalProcessBeforeExecmode(trcEvent, traceSt);
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_IRQ_ENTRY, LTT_EVENT_IRQ_EXIT
-        * </p>
-        * Replace C function named "before_execmode_hook_irq" in eventhooks.c
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getBeforeExecutionModeIrq() {
-               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               Long irqId = null;
-
-                               // According to Ltt, we should not draw anything if the channel
-                               // is the kernel one
-                               if (trcEvent.getChannelName().equals(
-                                               Channels.LTT_CHANNEL_KERNEL.name())) {
-                                       return false;
-                               } else {
-
-                                       if (trcEvent.getMarkerName().equals(
-                                                       Events.LTT_EVENT_IRQ_ENTRY.getInName())) {
-                                               irqId = getAFieldLong(trcEvent, traceSt,
-                                                               Fields.LTT_FIELD_IRQ_ID);
-                                       } else if (trcEvent.getMarkerName().equals(
-                                                       Events.LTT_EVENT_IRQ_EXIT.getInName())) {
-                                               long cpu = trcEvent.getCpuId();
-                                               irqId = traceSt.getCpu_states().get(cpu)
-                                                               .peekFromIrqStack();
-                                               if (irqId.equals(-1L)) {
-                                                       // nothing to update
-                                                       return false;
-                                               }
-                                       }
-
-
-                                       // softIrqId is the resource id here
-                                       TimeRangeEventResource localResource = resourcelist_obtain_irq(
-                                                       traceSt, irqId);
-
-                                       // If the resource is missing in the list, add it
-                                       if (localResource == null) {
-                                               TmfTimeRange timeRange = traceSt.getContext()
-                                                               .getTraceTimeWindow();
-                                               localResource = addLocalResource(timeRange
-                                                               .getStartTime().getValue(), timeRange
-                                                               .getEndTime().getValue(), traceSt.getTraceId(),
-                                                               ResourceTypes.IRQ, irqId, trcEvent
-                                                                               .getTimestamp().getValue());
-                                       }
-
-                                       // get the start time
-                                       long stime = localResource.getNext_good_time();
-
-                                       // Get the resource state mode
-                                       String irqStateMode = localResource.getStateMode(traceSt);
-
-                                       // Call the makeDraw function
-                                       makeDraw(traceSt, stime,
-                                                       trcEvent.getTimestamp().getValue(), localResource,
-                                                       params, irqStateMode);
-
-                                       // Call the globalProcessBeforeExecmode() after, as
-                                       // it is needed by all
-                                       // getBeforeExecmode*SOMETHING*()
-                                       globalProcessBeforeExecmode(trcEvent, traceSt);
-                               }
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY,
-        * LTT_EVENT_SOFT_IRQ_EXIT,
-        * </p>
-        * Replace C function named "before_execmode_hook_soft_irq" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_SOFT_IRQ_ID
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getBeforeExecutionModeSoftIrq() {
-               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               Long softIrqId = null;
-
-                               // According to Ltt, we should not draw anything if the channel
-                               // is the kernel one
-                               if (trcEvent.getChannelName().equals(
-                                               Channels.LTT_CHANNEL_KERNEL.name())) {
-                                       return false;
-                               } else {
-
-                                       if ((trcEvent.getMarkerName()
-                                                       .equals(Events.LTT_EVENT_SOFT_IRQ_RAISE.getInName()))
-                                                       || (trcEvent.getMarkerName()
-                                                                       .equals(Events.LTT_EVENT_SOFT_IRQ_ENTRY
-                                                                                       .getInName()))) {
-                                               softIrqId = getAFieldLong(trcEvent, traceSt,
-                                                               Fields.LTT_FIELD_SOFT_IRQ_ID);
-                                       } else if (trcEvent.getMarkerName().equals(
-                                                       Events.LTT_EVENT_SOFT_IRQ_EXIT.getInName())) {
-                                               long cpu = trcEvent.getCpuId();
-                                               softIrqId = traceSt.getCpu_states().get(cpu)
-                                                               .peekFromSoftIrqStack();
-                                               if (softIrqId < 0) {
-                                                       // nothing to update
-                                                       return false;
-                                               }
-                                       }
-
-                                       // Add the resource to the resource list
-                                       // softIrqId is the resource id here
-                                       TimeRangeEventResource localResource = resourcelist_obtain_soft_irq(
-                                                       traceSt, softIrqId);
-
-                                       // If the resource is missing in the list, add it
-                                       if (localResource == null) {
-                                               TmfTimeRange timeRange = traceSt.getContext()
-                                                               .getTraceTimeWindow();
-                                               localResource = addLocalResource(timeRange
-                                                               .getStartTime().getValue(), timeRange
-                                                               .getEndTime().getValue(), traceSt.getTraceId(),
-                                                               ResourceTypes.SOFT_IRQ, softIrqId, trcEvent
-                                                                               .getTimestamp().getValue());
-                                       }
-
-                                       // get the start time
-                                       long stime = localResource.getNext_good_time();
-
-                                       // Get the resource state mode
-                                       String softIrqStateMode = localResource
-                                                       .getStateMode(traceSt);
-
-                                       // Call the makeDraw function
-                                       makeDraw(traceSt, stime,
-                                                       trcEvent.getTimestamp().getValue(), localResource,
-                                                       params, softIrqStateMode);
-
-                                       // Call the globalProcessBeforeExecmode() after, as
-                                       // it is needed by all
-                                       // getBeforeExecmode*SOMETHING*()
-                                       globalProcessBeforeExecmode(trcEvent, traceSt);
-
-                               }
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_TRAP_ENTRY, LTT_EVENT_TRAP_EXIT,
-        * LTT_EVENT_PAGE_FAULT_ENTRY, LTT_EVENT_PAGE_FAULT_EXIT,
-        * LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY, LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
-        * </p>
-        * Replace C function named "before_execmode_hook_trap" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_TRAP_ID
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getBeforeExecutionModeTrap() {
-               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-
-                               Long trapId = null;
-
-                               // According to Ltt, we should not draw anything if the channel
-                               // is the kernel one
-                               if (trcEvent.getChannelName().equals(
-                                               Channels.LTT_CHANNEL_KERNEL.name())) {
-                                       return false;
-                               } else {
-
-                                       if ((trcEvent.getMarkerName()
-                                                       .equals(Events.LTT_EVENT_TRAP_ENTRY.getInName()))
-                                                       || (trcEvent.getMarkerName()
-                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_ENTRY
-                                                                                       .getInName()))
-                                                       || (trcEvent.getMarkerName()
-                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
-                                                                                       .getInName()))) {
-                                               trapId = getAFieldLong(trcEvent, traceSt,
-                                                               Fields.LTT_FIELD_TRAP_ID);
-                                       } else if ((trcEvent.getMarkerName()
-                                                       .equals(Events.LTT_EVENT_TRAP_EXIT.getInName()))
-                                                       || (trcEvent.getMarkerName()
-                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_EXIT
-                                                                                       .getInName()))
-                                                       || (trcEvent.getMarkerName()
-                                                                       .equals(Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
-                                                                                       .getInName()))) {
-                                               long cpu = trcEvent.getCpuId();
-                                               trapId = traceSt.getCpu_states().get(cpu)
-                                                               .peekFromTrapStack();
-
-                                               if (trapId.equals(-1L)) {
-                                                       // Nothing to update
-                                                       return false;
-                                               }
-                                       } else {
-                                               return false;
-                                       }
-
-                                       // Add the resource to the resource list
-                                       // trapId is the resource id here
-                                       TimeRangeEventResource localResource = resourcelist_obtain_trap(
-                                                       traceSt, trapId);
-
-                                       // If the resource is missing in the list, add it
-                                       if (localResource == null) {
-                                               TmfTimeRange timeRange = traceSt.getContext()
-                                                               .getTraceTimeWindow();
-                                               localResource = addLocalResource(timeRange
-                                                               .getStartTime().getValue(), timeRange
-                                                               .getEndTime().getValue(), traceSt.getTraceId(),
-                                                               ResourceTypes.TRAP, trapId, trcEvent
-                                                                               .getTimestamp().getValue());
-                                       }
-
-                                       // Determine the trap state.
-                                       String trapStateMode = localResource.getStateMode(traceSt);
-
-                                       long stime = localResource.getNext_good_time();
-                                       makeDraw(traceSt, stime,
-                                                       trcEvent.getTimestamp().getValue(), localResource,
-                                                       params, trapStateMode);
-
-                                       // Call the globalProcessBeforeExecmode() after, as
-                                       // it is needed by all
-                                       // getBeforeExecmode*SOMETHING*()
-                                       globalProcessBeforeExecmode(trcEvent, traceSt);
-
-                               }
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles: LTT_EVENT_REQUEST_ISSUE, LTT_EVENT_REQUEST_COMPLETE
-        * </p>
-        * Replace C function named "before_bdev_event_hook" in eventhooks.c
-        * <p>
-        * Fields: LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION (?)
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getBeforeBdevEvent() {
-               AbsResourcesTRangeUpdate handler = new AbsResourcesTRangeUpdate() {
-
-                       // @Override
-                       @Override
-                       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-                               Long major = getAFieldLong(trcEvent, traceSt,
-                                               Fields.LTT_FIELD_MAJOR);
-                               Long minor = getAFieldLong(trcEvent, traceSt,
-                                               Fields.LTT_FIELD_MINOR);
-                               // This is useless even in LTTv!
-                               // Long oper = getAFieldLong(trcEvent, traceSt,
-                               // Fields.LTT_FIELD_OPERATION);
-
-                               Long bdevId = getMkdevId(major, minor);
-
-                               // According to Lttv, bdevId (obtain from MKDEV macro) is
-                               // the id here
-                               TimeRangeEventResource localResource = resourcelist_obtain_bdev(
-                                               traceSt, bdevId);
-
-                               if (localResource == null) {
-                                       TmfTimeRange timeRange = traceSt.getContext()
-                                                       .getTraceTimeWindow();
-                                       localResource = addLocalResource(timeRange.getStartTime()
-                                                       .getValue(), timeRange.getEndTime().getValue(),
-                                                       traceSt.getTraceId(), ResourceTypes.BDEV, bdevId,
-                                                       trcEvent.getTimestamp().getValue());
-                               }
-
-                               // get the start time
-                               long stime = localResource.getNext_good_time();
-                               // Get the resource state mode
-                               String bdevStateMode = localResource.getStateMode(traceSt);
-                               // Call the makeDraw function
-                               makeDraw(traceSt, stime, trcEvent.getTimestamp().getValue(),
-                                               localResource, params, bdevStateMode);
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesEventToHandlerFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesEventToHandlerFactory.java
deleted file mode 100644 (file)
index 516ec94..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngSyntheticEvent;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngSyntheticEvent.SequenceInd;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-
-/**
- * Builds a Map from string event name to a processing handler object, the
- * processors implement the same interface to facilitate transparent methods
- * call,
- * 
- * The map key String is the entry point of the raw events. Using a hash speeds
- * up the resolution of the appropriate processor
- * 
- * @author alvaro
- * 
- */
-public class ResourcesEventToHandlerFactory extends AbsEventToHandlerResolver {
-       // ========================================================================
-       // Data
-       // =======================================================================
-       private final Map<String, ILttngEventProcessor> eventNametoBeforeProcessor = new HashMap<String, ILttngEventProcessor>();
-       private final Map<String, ILttngEventProcessor> eventNametoAfterProcessor = new HashMap<String, ILttngEventProcessor>();
-       private ResourcesFinishUpdateHandler finishProcessor = null;
-       private static ResourcesEventToHandlerFactory instance = null;
-       private ResourcesBeforeUpdateHandlers instantiateBeforeHandler = new ResourcesBeforeUpdateHandlers();
-       private ResourcesAfterUpdateHandlers instantiateAfterHandler = new ResourcesAfterUpdateHandlers();
-
-       private ResourcesEventToHandlerFactory() {
-               super();
-               // Create one instance of each individual event handler and add the
-               // instance to the map
-
-               // *** BEFORE HOOKS ***
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
-                               instantiateBeforeHandler.getBeforeSchedChangeHandler());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_ENTRY
-                               .getInName(), instantiateBeforeHandler
-                               .getBeforeExecutionModeTrap());
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_EXIT
-                               .getInName(), instantiateBeforeHandler
-                               .getBeforeExecutionModeTrap());
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_ENTRY.getInName(),
-                               instantiateBeforeHandler.getBeforeExecutionModeTrap());
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_EXIT.getInName(),
-                               instantiateBeforeHandler.getBeforeExecutionModeTrap());
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
-                                               .getInName(), instantiateBeforeHandler
-                                               .getBeforeExecutionModeTrap());
-               eventNametoBeforeProcessor
-                               .put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
-                                               .getInName(), instantiateBeforeHandler
-                                               .getBeforeExecutionModeTrap());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_ENTRY
-                               .getInName(), instantiateBeforeHandler
-                               .getBeforeExecutionModeIrq());
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_EXIT
-                               .getInName(), instantiateBeforeHandler
-                               .getBeforeExecutionModeIrq());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_RAISE.getInName(),
-                               instantiateBeforeHandler.getBeforeExecutionModeSoftIrq());
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_ENTRY.getInName(),
-                               instantiateBeforeHandler.getBeforeExecutionModeSoftIrq());
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SOFT_IRQ_EXIT.getInName(),
-                               instantiateBeforeHandler.getBeforeExecutionModeSoftIrq());
-
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_REQUEST_ISSUE.getInName(),
-                               instantiateBeforeHandler.getBeforeBdevEvent());
-               eventNametoBeforeProcessor.put(
-                               StateStrings.Events.LTT_EVENT_REQUEST_COMPLETE.getInName(),
-                               instantiateBeforeHandler.getBeforeBdevEvent());
-
-               // *** AFTER HOOKS ***
-               eventNametoAfterProcessor.put(
-                               StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName(),
-                               instantiateAfterHandler.getAfterSchedChangeHandler());
-
-               finishProcessor = new ResourcesFinishUpdateHandler();
-       }
-
-       /**
-     * 
-     */
-       public static AbsEventToHandlerResolver getInstance() {
-               if (instance == null) {
-                       instance = new ResourcesEventToHandlerFactory();
-               }
-               return instance;
-       }
-
-       @Override
-       public ILttngEventProcessor getAfterProcessor(String eventType) {
-               return eventNametoAfterProcessor.get(eventType);
-       }
-
-       @Override
-       public ILttngEventProcessor getBeforeProcessor(String eventType) {
-               return eventNametoBeforeProcessor.get(eventType);
-       }
-
-       @Override
-       public ILttngEventProcessor getfinishProcessor() {
-               return finishProcessor;
-       }
-
-       @Override
-       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-               if (trcEvent instanceof LttngSyntheticEvent) {
-
-                       LttngSyntheticEvent synEvent = (LttngSyntheticEvent) trcEvent;
-                       String eventType = synEvent.getMarkerName();
-                       ILttngEventProcessor processor = null;
-                       if (synEvent.getSynType() == SequenceInd.BEFORE) {
-                               processor = getBeforeProcessor(eventType);
-                       }
-
-                       if (synEvent.getSynType() == SequenceInd.AFTER) {
-                               processor = getAfterProcessor(eventType);
-                       }
-
-                       if (synEvent.getSynType() == SequenceInd.ENDREQ) {
-                               processor = getfinishProcessor();
-                       }
-
-                       if (processor != null) {
-                               processor.process(trcEvent, traceSt);
-                       }
-               }
-               return false;
-       }
-
-       @Override
-       public ILttngEventProcessor getStateUpdaterProcessor(String eventType) {
-               return null;
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesFinishUpdateHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesFinishUpdateHandler.java
deleted file mode 100644 (file)
index c1bbdc2..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource;
-
-/**
- * Creates specific finish state data request
- * 
- * @author alvaro
- * 
- */
-public class ResourcesFinishUpdateHandler extends
- AbsResourcesTRangeUpdate
-               implements ILttngEventProcessor {
-
-       public Events getEventHandleType() {
-               // No specific event
-               return null;
-       }
-
-       @Override
-       public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
-               // The end of the last state is unknown since it's beyond the requested time range window. Create this last
-               // event to half page after the visible window but not beyond the end of trace
-               long endOfTrace = traceSt.getContext().getTraceTimeWindow().getEndTime().getValue();
-               long halfWindow = (params.getEndTime() - params.getStartTime()) / 2;
-
-               // End of event common to all resources within the trace for this specific request
-               long endOfEvent = params.getEndTime() + halfWindow;
-               if (endOfEvent > endOfTrace) {
-                       endOfEvent = endOfTrace;
-               }
-               
-               TraceDebug.debug("Number of localResources: " //$NON-NLS-1$
-                               + resContainer.readItems().length);
-
-               // for each existing resource
-               for (TimeRangeEventResource localResource : resContainer
-                               .readItems()) {
-
-                       // get the start time
-                       long stime = localResource.getNext_good_time();
-
-                       // Get the resource state mode
-                       String stateMode = localResource.getStateMode(traceSt);
-
-                       // Insert an instance from previous time to end request time with
-                       // the current state
-                       makeDraw(traceSt, stime, endOfEvent, localResource, params, stateMode);
-               }
-
-               return false;
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/messages.properties
deleted file mode 100644 (file)
index 032d20a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-ResourcesView.Action.Filter=Filter\r
-ResourcesView.Action.Filter.ToolTip=Resource Filter options\r
-ResourcesView.Action.Legend=Legend\r
-ResourcesView.Action.Legend.ToolTip=Show Legend\r
-ResourcesView.Action.LoadData=LoadData\r
-ResourcesView.Action.LoadData.ToolTip=Load data from external plug-in\r
-ResourcesView.Action.NextEvent=NextEv\r
-ResourcesView.Action.NextEvent.Tooltip=Next Event\r
-ResourcesView.Action.NextResource=NextResource\r
-ResourcesView.Action.NextResource.ToolTip=Select Next Resource\r
-ResourcesView.Action.PrevEvent=PrevEv\r
-ResourcesView.Action.PrevEvent.Tooltip=Previous Event\r
-ResourcesView.Action.PreviousResource=PreviousResource\r
-ResourcesView.Action.PreviousResource.Tooltip=Select Previous Resource\r
-ResourcesView.Action.Reset=Reset\r
-ResourcesView.Action.Reset.ToolTip=Reset the Time Scale to Default\r
-ResourcesView.Action.Synchronize=Synchronise\r
-ResourcesView.Action.Synchronize.ToolTip=Synchronise by listening to external API selection calls\r
-ResourcesView.Action.ZoomIn=Zoom In\r
-ResourcesView.Action.ZoomIn.Tooltip=Zoom In\r
-ResourcesView.Action.ZoomOut=Zoom Out\r
-ResourcesView.Action.ZoomOut.tooltip=Zoom Out\r
-ResourcesView.Action.ZoomFilter=Zoom Filter\r
-ResourcesView.Action.ZoomFilter.tooltip=Display elements with events within the zoomed time window\r
-ResourcesView.msgSlogan=Resources View\r
-ResourcesView.tmf.UI=org.eclipse.linuxtools.tmf.ui\r
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java
deleted file mode 100644 (file)
index b91754d..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.model;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.linuxtools.internal.lttng.core.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
-
-/**
- * Common location to allocate the resources in use by the resource view
- * 
- * @author alvaro
- * 
- */
-public class ResourceContainer implements ItemContainer<TimeRangeEventResource> {
-       // ========================================================================
-       // Data
-       // ========================================================================
-       private final HashMap<ResourceKey, TimeRangeEventResource> resources = new HashMap<ResourceKey, TimeRangeEventResource>();
-       private static Integer uniqueId = 0;
-       
-       
-       // ========================================================================
-       // Constructor
-       // ========================================================================
-       /**
-        * Package level constructor
-        */
-       public ResourceContainer() { }
-       
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#addItem
-        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry)
-        */
-       @Override
-       public void addItem(TimeRangeEventResource newItem) {
-               if (newItem != null) {
-                   resources.put( new ResourceKey(newItem),newItem);
-               }
-       }
-       
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#getUniqueId()
-        */
-    @Override
-       public Integer getUniqueId() {
-        return uniqueId++;
-    }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#readItems()
-        */
-       @Override
-       public TimeRangeEventResource[] readItems() {
-               return resources.values().toArray(
-                               new TimeRangeEventResource[resources.size()]);
-       }
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#clearChildren()
-        */
-       @Override
-       public void clearChildren() {
-           TimeRangeEventResource newRes = null;
-        Iterator<ResourceKey> iterator = resources.keySet().iterator();
-        
-        while (iterator.hasNext()) {
-                       newRes = resources.get(iterator.next());
-                       newRes.reset();
-        }
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#clearItems()
-        */
-       @Override
-       public void clearItems() {
-               resources.clear();
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.resources.model.ItemContainer#removeItems(java.lang.String)
-        */
-       @Override
-       public void removeItems(String traceId) {
-           ResourceKey newKey = null;
-
-           Iterator<ResourceKey> iterator = resources.keySet().iterator();
-        while (iterator.hasNext()) {
-            newKey = iterator.next();
-            
-            if (resources.get(newKey).getTraceId().equals(traceId)) {
-                resources.remove(newKey);
-            }
-        }
-       }
-       
-       
-       /**
-        * Search by keys (resourceId, traceId and type)
-        * <p>
-        * 
-        * A match is returned if the three arguments received match an entry
-        * Otherwise null is returned
-        * 
-        * @param searchedId
-        *            The ressourceId we are looking for
-        * @param searchedType
-        *            The ressourceType we are looking for
-        * @param searchedTraceId
-        *            The traceId (trace name?) we are looking for
-        * 
-        * @return TimeRangeEventResource
-        */
-    public TimeRangeEventResource findItem(Long searchedId, ResourceTypes searchedType, String searchedTraceId) {
-               // Get the EventResource associated to a key we create here
-        TimeRangeEventResource foundResource = resources.get( new ResourceKey(searchedId, searchedTraceId, searchedType) );
-        
-        return foundResource;
-    }
-}
-
-class ResourceKey {
-    
-    private TimeRangeEventResource valueRef = null;
-    
-    private Long       resourceId = null;
-    private String        traceId = null;
-    private ResourceTypes type = null;
-    
-    @SuppressWarnings("unused")
-    private ResourceKey() { }
-    
-    public ResourceKey(TimeRangeEventResource newRef) {
-        valueRef = newRef;
-    }
-    
-    public ResourceKey(Long newId, String newTraceId, ResourceTypes newType) {
-        resourceId = newId;
-        traceId = newTraceId;
-        type = newType;
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-        if (obj == null)
-            return false;
-        
-        boolean isSame = false;
-        
-        if ( obj instanceof ResourceKey ) {
-               if ( valueRef != null )  {
-                   if ( (  ((ResourceKey)obj).getResourceId().equals(valueRef.getResourceId()) ) &&
-                        (  ((ResourceKey)obj).getTraceId().equals(valueRef.getTraceId()) ) &&
-                        (  ((ResourceKey)obj).getType().equals(valueRef.getType()) ) )
-                   {
-                       isSame = true;
-                   }
-               }
-               else {
-                       if ( (  ((ResourceKey)obj).getResourceId().equals(this.resourceId)) &&
-                        (  ((ResourceKey)obj).getTraceId().equals(this.traceId)) &&
-                        (  ((ResourceKey)obj).getType().equals(this.type)) )
-                   {
-                       isSame = true;
-                   }
-               }
-        }
-        else {
-               TraceDebug.debug("ERROR : The given key is not of the type ProcessKey!" + obj.getClass().toString()); //$NON-NLS-1$
-        }
-        
-        return isSame;
-    }
-    
-    // *** WARNING : Everything in there work because the check "valueRef != null" is the same for ALL getter
-    // Do NOT change this check without checking.
-    public Long getResourceId() {
-        if ( valueRef != null ) {
-            return valueRef.getResourceId();
-        }
-        else {
-            return resourceId;
-        }
-    }
-
-    public String getTraceId() {
-        if ( valueRef != null ) {
-            return valueRef.getTraceId();
-        }
-        else {
-            return traceId;
-        }
-    }
-
-    public ResourceTypes getType() {
-        if ( valueRef != null ) {
-            return valueRef.getType();
-        }
-        else {
-            return type;
-        }
-    }
-
-    @Override
-    public int hashCode() { 
-        return this.toString().hashCode();
-    }
-    
-    
-    @Override
-       @SuppressWarnings("nls")
-       public String toString() {
-        if ( valueRef != null ) {
-            return (valueRef.getResourceId().toString() + ":" + valueRef.getTraceId().toString() + ":" + valueRef.getType().toString());
-        }
-        return (resourceId + ":" + traceId + ":" + type);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceModelFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceModelFactory.java
deleted file mode 100644 (file)
index f2b8ce6..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *      Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.resources.model;
-
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
-
-/**
- * Instantiates the entry point classes to build the data model for this view
- * 
- * @author alvaro
- * 
- */
-public class ResourceModelFactory {
-       // ========================================================================
-       // Data
-       // ========================================================================
-       private static ResourceContainer resContainer = null;
-       private static ParamsUpdater updater = null;
-       
-       
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /**
-        * Get Process data container
-        * @return
-        */
-       public static ResourceContainer getResourceContainer() {
-               if (resContainer == null) {
-                       resContainer = new ResourceContainer();
-               }
-               return resContainer;
-       }
-       
-       
-       public static ParamsUpdater getParamsUpdater() {
-               if (updater == null) {
-                       updater = new ParamsUpdater();
-               }
-               return updater;
-       }
-       
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourcesTimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourcesTimeRangeViewerProvider.java
deleted file mode 100644 (file)
index 175e55b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Matthew Khouzam - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.resources.model;
-
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeViewerProvider;
-import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
-
-public class ResourcesTimeRangeViewerProvider extends TimeRangeViewerProvider {
-
-       public ResourcesTimeRangeViewerProvider(ParamsUpdater paramsUpdater) {
-               super(paramsUpdater);
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider
-        * #getStateName(org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.
-        * TmfTimeAnalysisProvider.StateColor)
-        */
-       @Override
-       public String getStateName(StateColor color) {
-               // Override to multiple instances of the widget, the same color can have
-               // multiple meanings
-               boolean isInBlockDevice = bdevStateToColor.containsValue(color);
-               boolean isInSoftIrq = softIrqStateToColor.containsValue(color);
-               boolean isInTrap = trapStateToColor.containsValue(color);
-               boolean isInIrq = irqStateToColor.containsValue(color);
-               boolean isInCpu = cpuStateToColor.containsValue(color);
-               if (isInCpu) {
-                       return findObject(color, cpuStateToColor);
-               } else if (isInIrq) {
-                       return findObject(color, irqStateToColor);
-               } else if (isInTrap) {
-                       return findObject(color, trapStateToColor);
-               } else if (isInSoftIrq) {
-                       return findObject(color, softIrqStateToColor);
-               } else if (isInBlockDevice) {
-                       return findObject(color, bdevStateToColor);
-               }
-               return super.getStateName(color);
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/Messages.java
deleted file mode 100644 (file)
index 63fb853..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.views.statistics;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.statistics.messages"; //$NON-NLS-1$
-    public static String StatisticsView_CPUTimeColumn;
-    public static String StatisticsView_CPUTimeTip;
-    public static String StatisticsView_CumCPUTimeColumn;
-    public static String StatisticsView_CumCPUTimeTip;
-    public static String StatisticsView_ElapsedTimeColumn;
-    public static String StatisticsView_ElapsedTimeTip;
-    public static String StatisticsView_LevelColumn;
-    public static String StatisticsView_LevelColumnTip;
-    public static String StatisticsView_NbEventsColumn;
-    public static String StatisticsView_NbEventsTip;
-    static {
-       // initialize resource bundle
-       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java
deleted file mode 100644 (file)
index 694e1dd..0000000
+++ /dev/null
@@ -1,816 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin    (dhaemon@gmail.com)    - Implementation
- *   Francois Chouinard (fchouinard@gmail.com) - Initial API
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics;
-
-import java.text.DecimalFormat;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.TreeViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.linuxtools.internal.lttng.core.control.LttngCoreProviderFactory;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.model.LTTngTreeNode;
-import org.eclipse.linuxtools.internal.lttng.core.request.ILttngSyntEventRequest;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
-import org.eclipse.linuxtools.internal.lttng.core.state.experiment.StateManagerFactory;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer;
-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.statistics.evProcessor.StatsTimeCountHandlerFactory;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.KernelStatisticsData;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeNode;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeRootFactory;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-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.TmfSignalHandler;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * <b><u>StatisticsView</u></b>
- * <p>
- * The Statistics View displays statistics for traces.
- * 
- * It is implemented according to the MVC pattern. - The model is a
- * StatisticsTreeNode built by the State Manager. - The view is built with a
- * TreeViewer. - The controller that keeps model and view synchronised is an
- * observer of the model.
- */
-public class StatisticsView extends AbsTimeUpdateView {
-       public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.statistics"; //$NON-NLS-1$
-       private TreeViewer treeViewer;
-
-       // Table column names
-       private final String LEVEL_COLUMN = Messages.StatisticsView_LevelColumn;
-       private final String EVENTS_COUNT_COLUMN = Messages.StatisticsView_NbEventsColumn;
-       private final String CPU_TIME_COLUMN = Messages.StatisticsView_CPUTimeColumn;
-       private final String CUMULATIVE_CPU_TIME_COLUMN = Messages.StatisticsView_CumCPUTimeColumn;
-       private final String ELAPSED_TIME_COLUMN = Messages.StatisticsView_ElapsedTimeColumn;
-
-       // Table column tooltips
-       private final String LEVEL_COLUMN_TIP = Messages.StatisticsView_LevelColumnTip;
-       private final String EVENTS_COUNT_COLUMN_TIP = Messages.StatisticsView_NbEventsTip;
-       private final String CPU_TIME_COLUMN_TIP = Messages.StatisticsView_CPUTimeTip;
-       private final String CUMULATIVE_CPU_TIME_COLUMN_TIP = Messages.StatisticsView_CumCPUTimeTip;
-       private final String ELAPSED_TIME_COLUMN_TIP = Messages.StatisticsView_ElapsedTimeTip;
-
-       // Level for which statistics should not be displayed.
-    private Set<Integer> folderLevels = new HashSet<Integer>(Arrays
-                   .asList(new Integer[] { KernelStatisticsData.HEADER_CPUS_INT, 
-                                           KernelStatisticsData.HEADER_EVENT_TYPES_INT, 
-                                           KernelStatisticsData.HEADER_FUNCTIONS_INT, 
-                                           KernelStatisticsData.HEADER_MODES_INT, 
-                                           KernelStatisticsData.HEADER_PROCESSES_INT, 
-                                           KernelStatisticsData.HEADER_SUBMODES_INT }));
-
-       // Levels for which sub-levels should not contain time-related statistics.
-       private Set<Integer> levelsWithEmptyTime = new HashSet<Integer>(Arrays
-                   .asList(new Integer[] { KernelStatisticsData.HEADER_EVENT_TYPES_INT }));
-
-       private DecimalFormat decimalFormat = new DecimalFormat("0.#########"); //$NON-NLS-1$
-
-       private Cursor fwaitCursor = null;
-
-       private static final Long STATS_INPUT_CHANGED_REFRESH = 5000L;
-       
-       // Used to draw bar charts in columns.
-       private interface ColumnPercentageProvider {
-               public double getPercentage(StatisticsTreeNode node);
-       }
-
-    private boolean fStatisticsUpdateBusy = false;
-    private boolean fStatisticsUpdatePending = false;
-    private TmfTimeRange fStatisticsUpdateRange = null;
-    private final Object fStatisticsUpdateSyncObj = new Object();
-    private boolean fClearData = true;
-    // Flag to force request the data from trace
-    private boolean fRequestData = false;
-
-       /**
-        * Contains all the information necessary to build a column of the table.
-        */
-       private static class ColumnData {
-               // Name of the column.
-               public final String header;
-               // Width of the column.
-               public final int width;
-               // Alignment of the column.
-               public final int alignment;
-               // Tooltip of the column.
-               public final String tooltip;
-               // Adapts a StatisticsTreeNode into the content of it's corresponding
-               // cell for that column.
-               public final ColumnLabelProvider labelProvider;
-               // Used to sort elements of this column. Can be null.
-               public final ViewerComparator comparator;
-               // Used to draw bar charts in this column. Can be null.
-               public final ColumnPercentageProvider percentageProvider;
-
-               public ColumnData(String h, int w, int a, String t,
-                               ColumnLabelProvider l, ViewerComparator c,
-                               ColumnPercentageProvider p) {
-                       header = h;
-                       width = w;
-                       alignment = a;
-                       tooltip = t;
-                       labelProvider = l;
-                       comparator = c;
-                       percentageProvider = p;
-               }
-       };
-
-       // List that will be used to create the table.
-       private ColumnData[] columnDataList = new ColumnData[] {
-                       new ColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP,
-                                       new ColumnLabelProvider() {
-                                               @Override
-                                               public String getText(Object element) {
-                                                   StatisticsTreeNode node = (StatisticsTreeNode) element;
-                            if (folderLevels.contains(node.getKey())) {
-                                return (KernelStatisticsData.getCategoryFromId(node.getKey().intValue()));
-                            } else {
-                                return node.getName();
-                            }
-                                               }
-
-                                               @Override
-                                               public Image getImage(Object element) {
-                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
-                                                       if (folderLevels.contains(node.getKey())) {
-                                                               return PlatformUI.getWorkbench()
-                                                                               .getSharedImages().getImage(
-                                                                                               ISharedImages.IMG_OBJ_FOLDER);
-                                                       } else {
-                                                               return PlatformUI.getWorkbench()
-                                                                               .getSharedImages().getImage(
-                                                                                               ISharedImages.IMG_OBJ_ELEMENT);
-                                                       }
-                                               }
-                                       }, new ViewerComparator() {
-                                               @Override
-                                               public int compare(Viewer viewer, Object e1, Object e2) {
-                                                       StatisticsTreeNode n1 = (StatisticsTreeNode) e1;
-                                                       StatisticsTreeNode n2 = (StatisticsTreeNode) e2;
-                                                       
-//                                                     return n1.getKey().compareTo(n2.getKey());
-                                                       return n1.compareTo(n2);
-                                               }
-                                       }, null),
-                       new ColumnData(EVENTS_COUNT_COLUMN, 125, SWT.LEFT,
-                                       EVENTS_COUNT_COLUMN_TIP, new ColumnLabelProvider() {
-                                               @Override
-                                               public String getText(Object element) {
-                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
-                                                       if (!folderLevels.contains(node.getKey())) {
-                                                               return Long.toString(node.getValue().nbEvents);
-                                                       } else {
-                                                               return ""; //$NON-NLS-1$
-                                                       }
-                                               }
-                                       }, new ViewerComparator() {
-                                               @Override
-                                               public int compare(Viewer viewer, Object e1, Object e2) {
-                                                       StatisticsTreeNode n1 = (StatisticsTreeNode) e1;
-                                                       StatisticsTreeNode n2 = (StatisticsTreeNode) e2;
-
-                                                       return (int) (n1.getValue().nbEvents - n2
-                                                                       .getValue().nbEvents);
-                                               }
-                                       }, new ColumnPercentageProvider() {
-                                               @Override
-                                               public double getPercentage(StatisticsTreeNode node) {
-                                                       StatisticsTreeNode parent = node;
-                                                       do {
-                                                               parent = parent.getParent();
-                                                       } while (parent != null
-                                                                       && parent.getValue().nbEvents == 0);
-
-                                                       if (parent == null) {
-                                                               return 0;
-                                                       } else {
-                                                               return (double) node.getValue().nbEvents
-                                                                               / parent.getValue().nbEvents;
-                                                       }
-                                               }
-                                       }),
-                       new ColumnData(CPU_TIME_COLUMN, 125, SWT.LEFT, CPU_TIME_COLUMN_TIP,
-                                       new ColumnLabelProvider() {
-                                               @Override
-                                               public String getText(Object element) {
-                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
-
-                                                       if (folderLevels.contains(node.getKey())) {
-                                                               return ""; //$NON-NLS-1$
-                                                       } else if (node.getParent() != null
-                                                                       && levelsWithEmptyTime.contains(node
-                                                                                       .getParent().getKey())) {
-                                                               return ""; //$NON-NLS-1$
-                                                       } else {
-                                                               return decimalFormat
-                                                                               .format(node.getValue().cpuTime
-                                                                                               / Math.pow(10, 9));
-                                                       }
-                                               }
-                                       }, null, null),
-                       new ColumnData(CUMULATIVE_CPU_TIME_COLUMN, 155, SWT.LEFT,
-                                       CUMULATIVE_CPU_TIME_COLUMN_TIP, new ColumnLabelProvider() {
-                                               @Override
-                                               public String getText(Object element) {
-                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
-                                                       if (folderLevels.contains(node.getKey())) {
-                                                               return ""; //$NON-NLS-1$
-                                                       } else if (node.getParent() != null
-                                                                       && levelsWithEmptyTime.contains(node
-                                                                                       .getParent().getKey())) {
-                                                               return ""; //$NON-NLS-1$
-                                                       } else {
-                                                               return decimalFormat
-                                                                               .format(node.getValue().cumulativeCpuTime
-                                                                                               / Math.pow(10, 9));
-                                                       }
-                                               }
-                                       }, null, null),
-                       new ColumnData(ELAPSED_TIME_COLUMN, 100, SWT.LEFT,
-                                       ELAPSED_TIME_COLUMN_TIP, new ColumnLabelProvider() {
-                                               @Override
-                                               public String getText(Object element) {
-                                                       StatisticsTreeNode node = (StatisticsTreeNode) element;
-                                                       if (folderLevels.contains(node.getKey())) {
-                                                               return ""; //$NON-NLS-1$
-                                                       } else if (node.getParent() != null
-                                                                       && levelsWithEmptyTime.contains(node
-                                                                                       .getParent().getKey())) {
-                                                               return ""; //$NON-NLS-1$
-                                                       } else {
-                                                               return decimalFormat
-                                                                               .format(node.getValue().elapsedTime
-                                                                                               / Math.pow(10, 9));
-                                                       }
-                                               }
-                                       }, null, null) };
-
-       /**
-        * Adapter TreeViewers can use to interact with StatisticsTreeNode objects.
-        * 
-        * @see org.eclipse.jface.viewers.ITreeContentProvider
-        */
-       private static class TreeContentProvider implements ITreeContentProvider {
-               /*
-                * (non-Javadoc)
-                * 
-                * @see
-                * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang
-                * .Object)
-                */
-               @Override
-               public Object[] getChildren(Object parentElement) {
-                       return ((StatisticsTreeNode) parentElement).getChildren().toArray();
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see
-                * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang
-                * .Object)
-                */
-               @Override
-               public Object getParent(Object element) {
-                       return ((StatisticsTreeNode) element).getParent();
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see
-                * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang
-                * .Object)
-                */
-               @Override
-               public boolean hasChildren(Object element) {
-                       return ((StatisticsTreeNode) element).hasChildren();
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see
-                * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(
-                * java.lang.Object)
-                */
-               @Override
-               public Object[] getElements(Object inputElement) {
-                       return getChildren(inputElement);
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see org.eclipse.jface.viewers.IContentProvider#dispose()
-                */
-               @Override
-               public void dispose() {
-               }
-
-               /*
-                * (non-Javadoc)
-                * 
-                * @see
-                * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse
-                * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
-                */
-               // @Override
-               @Override
-               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-               }
-       }
-
-       public StatisticsView(String viewName) {
-               super(viewName);
-       }
-
-       private static final String STATISTICS_VIEW = "StatisticsView"; //$NON-NLS-1$
-       public StatisticsView() {
-               this(STATISTICS_VIEW);
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
-        * .Composite)
-        */
-       @Override
-       public void createPartControl(Composite parent) {
-               parent.setLayout(new FillLayout());
-
-               treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL
-                               | SWT.V_SCROLL);
-               treeViewer.setContentProvider(new TreeContentProvider());
-               treeViewer.getTree().setHeaderVisible(true);
-               treeViewer.setUseHashlookup(true);
-
-               for (final ColumnData columnData : columnDataList) {
-                       final TreeViewerColumn treeColumn = new TreeViewerColumn(
-                                       treeViewer, columnData.alignment);
-                       treeColumn.getColumn().setText(columnData.header);
-                       treeColumn.getColumn().setWidth(columnData.width);
-                       treeColumn.getColumn().setToolTipText(columnData.tooltip);
-                       if (columnData.comparator != null) {
-                               treeColumn.getColumn().addSelectionListener(
-                                               new SelectionAdapter() {
-                                                       @Override
-                                                       public void widgetSelected(SelectionEvent e) {
-                                                               if (treeViewer.getTree().getSortDirection() == SWT.UP
-                                                                               || treeViewer.getTree().getSortColumn() != treeColumn
-                                                                                               .getColumn()) {
-                                                                       treeViewer
-                                                                                       .setComparator(columnData.comparator);
-                                                                       treeViewer.getTree().setSortDirection(
-                                                                                       SWT.DOWN);
-                                                               } else {
-                                                                       treeViewer
-                                                                                       .setComparator(new ViewerComparator() {
-                                                                                               @Override
-                                                                                               public int compare(
-                                                                                                               Viewer viewer,
-                                                                                                               Object e1, Object e2) {
-                                                                                                       return -1
-                                                                                                                       * columnData.comparator
-                                                                                                                                       .compare(
-                                                                                                                                                       viewer,
-                                                                                                                                                       e1,
-                                                                                                                                                       e2);
-                                                                                               }
-                                                                                       });
-                                                                       treeViewer.getTree().setSortDirection(
-                                                                                       SWT.UP);
-                                                               }
-                                                               treeViewer.getTree().setSortColumn(
-                                                                               treeColumn.getColumn());
-                                                       }
-                                               });
-                       }
-                       treeColumn.setLabelProvider(columnData.labelProvider);
-               }
-
-               // Handler that will draw the bar charts.
-               treeViewer.getTree().addListener(SWT.EraseItem, new Listener() {
-                       // @Override
-                       @Override
-                       public void handleEvent(Event event) {
-                               if (columnDataList[event.index].percentageProvider != null) {
-                                       StatisticsTreeNode node = (StatisticsTreeNode) event.item
-                                                       .getData();
-
-                                       double percentage = columnDataList[event.index].percentageProvider
-                                                       .getPercentage(node);
-                                       if (percentage == 0) {
-                                               return;
-                                       }
-
-                                       if ((event.detail & SWT.SELECTED) > 0) {
-                                               Color oldForeground = event.gc.getForeground();
-                                               event.gc.setForeground(event.item.getDisplay()
-                                                               .getSystemColor(SWT.COLOR_LIST_SELECTION));
-                                               event.gc.fillRectangle(event.x, event.y, event.width,
-                                                               event.height);
-                                               event.gc.setForeground(oldForeground);
-                                               event.detail &= ~SWT.SELECTED;
-                                       }
-
-                                       int barWidth = (int) ((treeViewer.getTree().getColumn(1)
-                                                       .getWidth() - 8) * percentage);
-                                       int oldAlpha = event.gc.getAlpha();
-                                       Color oldForeground = event.gc.getForeground();
-                                       Color oldBackground = event.gc.getBackground();
-                                       event.gc.setAlpha(64);
-                                       event.gc.setForeground(event.item.getDisplay()
-                                                       .getSystemColor(SWT.COLOR_BLUE));
-                                       event.gc.setBackground(event.item.getDisplay()
-                                                       .getSystemColor(SWT.COLOR_LIST_BACKGROUND));
-                                       event.gc.fillGradientRectangle(event.x, event.y, barWidth,
-                                                       event.height, true);
-                                       event.gc.drawRectangle(event.x, event.y, barWidth,
-                                                       event.height);
-                                       event.gc.setForeground(oldForeground);
-                                       event.gc.setBackground(oldBackground);
-                                       event.gc.setAlpha(oldAlpha);
-                                       event.detail &= ~SWT.BACKGROUND;
-                               }
-                       }
-               });
-
-               treeViewer.setComparator(columnDataList[0].comparator);
-               treeViewer.getTree().setSortColumn(treeViewer.getTree().getColumn(0));
-               treeViewer.getTree().setSortDirection(SWT.DOWN);
-
-               // Read current data if any available
-               TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
-               if (experiment != null) {
-                       
-                       @SuppressWarnings({ "rawtypes", "unchecked" })
-                       TmfExperimentSelectedSignal<?> signal = new TmfExperimentSelectedSignal(this, experiment);
-                       fRequestData = true;
-                       experimentSelected(signal);
-                       
-               } else {
-                       TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
-               }
-       }
-
-       @Override
-       public void dispose() {
-               super.dispose();
-               if (fwaitCursor != null) {
-                       fwaitCursor.dispose();
-               }
-
-               // clean the model
-               StatisticsTreeRootFactory.removeAll();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
-        */
-       @Override
-       public void setFocus() {
-               treeViewer.getTree().setFocus();
-       }
-
-       
-       /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getInputChangedRefresh()
-     */
-    @Override
-    protected Long getInputChangedRefresh() {
-        return STATS_INPUT_CHANGED_REFRESH;
-    }
-
-       /**
-        * @return
-        */
-       @Override
-       public AbsEventToHandlerResolver getEventProcessor() {
-               return StatsTimeCountHandlerFactory.getInstance();
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#waitCursor
-        * (boolean)
-        */
-       @Override
-       protected void waitCursor(final boolean waitInd) {
-               if ((treeViewer == null) || (treeViewer.getTree().isDisposed())) {
-                       return;
-               }
-
-               Display display = treeViewer.getControl().getDisplay();
-               if (fwaitCursor == null) {
-                       fwaitCursor = new Cursor(display, SWT.CURSOR_WAIT);
-               }
-
-               // Perform the updates on the UI thread
-               display.asyncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               if ((treeViewer != null) && (!treeViewer.getTree().isDisposed())) {
-                                       Cursor cursor = null; /* indicates default */
-                                       if (waitInd) {
-                                               cursor = fwaitCursor;
-                                       }
-                                       treeViewer.getControl().setCursor(cursor);
-                               }
-                       }
-               });
-       }
-
-       @Override
-       public void modelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) {
-               Object input = treeViewer.getInput();
-               if ((input != null) && (input instanceof StatisticsTreeNode) && (!treeViewer.getTree().isDisposed())) {
-                       if (clearAllData) {
-                               ((StatisticsTreeNode) input).reset();
-                       }
-                       treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
-                               // @Override
-                               @Override
-                               public void run() {
-                                       if (!treeViewer.getTree().isDisposed())
-                                               treeViewer.refresh();
-                               }
-                       });
-               }
-       }
-
-       @Override
-       public void modelInputChanged(ILttngSyntEventRequest request, boolean complete) {
-               // Ignore update if disposed
-               if (treeViewer.getTree().isDisposed()) return;
-               
-               if(TraceDebug.isSV() && complete) {
-                   // print results
-
-                   TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
-                   if(experiment != null) {
-                       StatisticsTreeNode node = StatisticsTreeRootFactory.getStatTreeRoot(experiment.getName());
-                       printRecursively(node);
-
-                   }
-               }
-               
-               treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
-                       // @Override
-                       @Override
-                       public void run() {
-                               if (!treeViewer.getTree().isDisposed())
-                                       treeViewer.refresh();
-                       }
-               });
-               
-               if (complete) {
-                       synchronized (fStatisticsUpdateSyncObj) {
-                               fStatisticsUpdateBusy = false;
-                               if (fStatisticsUpdatePending) {
-                                       fStatisticsUpdatePending = false;
-                                       requestData(TmfExperiment.getCurrentExperiment(), fStatisticsUpdateRange, false);
-                               }
-                       }
-               }
-
-       }
-
-       private static int level = 0;
-    private void printRecursively(StatisticsTreeNode node) {
-        StringBuffer tab = new StringBuffer(""); //$NON-NLS-1$
-        for (int i = 0; i < level; i++) {
-            tab.append("\t"); //$NON-NLS-1$
-        }
-        level++;
-        TraceDebug.traceSV(tab + node.getContent());
-        if (node.hasChildren()) {
-            LinkedList<StatisticsTreeNode> childreen = (LinkedList<StatisticsTreeNode>)node.getChildren();
-            Collections.sort(childreen);
-
-            for (Iterator<StatisticsTreeNode> iterator = childreen.iterator(); iterator.hasNext();) {
-                StatisticsTreeNode statisticsTreeNode = (StatisticsTreeNode) iterator.next();
-                printRecursively(statisticsTreeNode);
-            }
-        }
-        level--;
-    }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * modelIncomplete
-        * (org.eclipse.linuxtools.lttng.request.ILttngSyntEventRequest)
-        */
-       @Override
-       public void modelIncomplete(ILttngSyntEventRequest request) {
-        // Do not remove incomplete statistics, they can be completed upon next selection
-       }
-
-       /**
-        * @param signal
-        */
-       @TmfSignalHandler
-       public void experimentSelected(TmfExperimentSelectedSignal<? extends ITmfEvent> signal) {
-               if (signal != null) {
-                       TmfExperiment<?> experiment = signal.getExperiment();
-                       String experimentName =  experiment.getName();
-
-                       if (StatisticsTreeRootFactory.containsTreeRoot(experimentName)) {
-                               // The experiment root is already present
-                               StatisticsTreeNode experimentTreeNode = StatisticsTreeRootFactory.getStatTreeRoot(experimentName);
-
-                               @SuppressWarnings("rawtypes")
-                ITmfTrace[] traces = experiment.getTraces();
-                               
-                               LTTngTreeNode expNode = StateManagerFactory.getExperimentManager().getSelectedExperiment();
-                               
-                               // check if there is partial data loaded in the experiment
-                               int numTraces = experiment.getTraces().length;
-                               int numNodeTraces = experimentTreeNode.getNbChildren();
-
-                               if (numTraces == numNodeTraces) {
-                                       boolean same = true;
-                                       // Detect if the experiment contains the same traces as when
-                                       // previously selected
-                                       for (int i = 0; i < numTraces; i++) {
-                                               String traceName = traces[i].getName();
-                                               LTTngTreeNode child = expNode.getChildByName(traceName);
-                                               if ((child == null) || (!experimentTreeNode.containsChild(child.getId().intValue()))) {
-                                                        same = false;
-                                                        break;
-                                               }
-                                       }
-
-                                       if (same) {
-                                               treeViewer.setInput(experimentTreeNode);
-                                               synchronized (fStatisticsUpdateSyncObj) {
-                                                       fStatisticsUpdateBusy = false;
-                                                       fStatisticsUpdatePending = false;
-                                               }
-                                               // request in case current data is incomplete
-                                               requestData(experiment, experiment.getTimeRange(), false);
-                                               return;
-                                       }
-                               }
-                       }
-
-                       StatisticsTreeNode treeModelRoot = StatisticsTreeRootFactory.getStatTreeRoot(experiment.getName());
-
-                       // if the model has contents, clear to start over
-                       if (treeModelRoot.hasChildren()) {
-                               treeModelRoot.reset();
-                       }
-
-                       // set input to a clean data model
-                       treeViewer.setInput(treeModelRoot);
-
-                       synchronized (fStatisticsUpdateSyncObj) {
-                               fStatisticsUpdateBusy = false;
-                               fStatisticsUpdatePending = false;
-                       }
-
-                       // if the data is not available or has changed, reload it
-                       fClearData = true;
-                       if(fRequestData) {
-                           requestData(experiment, experiment.getTimeRange(), fClearData);
-                           fRequestData = false;
-                       }
-               }
-       }
-
-       /**
-        * @param signal
-        */
-       @SuppressWarnings("unchecked")
-       @TmfSignalHandler
-       public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {
-               TmfExperiment<LttngEvent> experiment = (TmfExperiment<LttngEvent>) signal.getExperiment();
-               // validate
-               if (! experiment.equals(TmfExperiment.getCurrentExperiment())) {
-                       return;
-               }
-
-               requestData(experiment, signal.getRange(), fClearData);
-               fClearData = false;
-       }
-
-       /**
-        * @param experiment
-        */
-       private void requestData(TmfExperiment<?> experiment, TmfTimeRange range, boolean clearingData) {
-               if (experiment != null) {
-                       synchronized (fStatisticsUpdateSyncObj) {
-                               if (fStatisticsUpdateBusy) {
-                                       fStatisticsUpdatePending = true;
-                                       fStatisticsUpdateRange = range;
-                                       return;
-                               } else {
-                                       fStatisticsUpdateBusy = true;
-                               }
-                       }
-
-                       int index = 0;
-                       for (StatisticsTreeNode node : ((StatisticsTreeNode) treeViewer.getInput()).getChildren()) {
-                               index += (int) node.getValue().nbEvents;
-                       }
-
-                       // send the initial request, to start filling up model
-                       eventRequest(index, range, clearingData, ExecutionType.BACKGROUND);
-               } else {
-                       TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$
-               }
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel
-        * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
-        * ITmfTimeAnalysisEntry[], long, long, boolean, long, long,
-        * java.lang.Object)
-        */
-       @Override
-       protected void displayModel(ITmfTimeAnalysisEntry[] items, long startBoundTime, long endBoundTime,
-                       boolean updateTimeBounds, long startVisibleWindow, long endVisibleWindow, Object source) {
-               // No applicable to statistics view
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#
-        * getParamsUpdater()
-        */
-       @Override
-       protected ParamsUpdater getParamsUpdater() {
-               // Not applicable to statistics view
-               return null;
-       }
-
-       @Override
-       protected ItemContainer<?> getItemContainer() {
-               // Not applicable to statistics view
-               return null;
-       }
-       
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#getProviderId()
-        */
-       @Override
-       protected int getProviderId() { 
-           return LttngCoreProviderFactory.STATISTICS_LTTNG_SYTH_EVENT_PROVIDER; 
-       }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/AbstractStatsEventHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/AbstractStatsEventHandler.java
deleted file mode 100644 (file)
index bcd5dc5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *******************************************************************************/
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeRootFactory;
-
-abstract class AbstractStatsEventHandler implements ILttngEventProcessor {
-       private Events fEventType;
-       
-       public AbstractStatsEventHandler(Events eventType) {
-               super();
-               fEventType = eventType;
-       }
-
-       /**
-        * @return root of of the tree for this experiment.
-        */
-       protected StatisticsData getStatisticsTree(LttngTraceState trcState) {
-               String experimentName = trcState.getContext().getExperimentName();
-               return StatisticsTreeRootFactory.getStatTree(experimentName);
-       }
-       
-       public Events getEventHandleType() {
-               return fEventType;
-       }
-       
-       protected void stepCount(LttngEvent event, LttngTraceState traceState) {
-               StatisticsData tree = getStatisticsTree(traceState);
-               tree.registerEvent(event, traceState);
-       }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsModeChangeHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsModeChangeHandler.java
deleted file mode 100644 (file)
index d675848..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData;
-
-class StatsModeChangeHandler extends AbstractStatsEventHandler {
-       
-       public StatsModeChangeHandler(Events eventType) {
-               super(eventType);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public boolean process(LttngEvent event, LttngTraceState traceState) {
-               StatisticsData tree = getStatisticsTree(traceState);
-               tree.increase(event, traceState, StatisticsData.Values.CPU_TIME | StatisticsData.Values.STATE_CUMULATIVE_CPU_TIME);
-               return false;
-       }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsModeEndHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsModeEndHandler.java
deleted file mode 100644 (file)
index 4d2837a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData;
-
-class StatsModeEndHandler extends AbstractStatsEventHandler {
-       
-       public StatsModeEndHandler(Events eventType) {
-               super(eventType);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public boolean process(LttngEvent event, LttngTraceState traceState) {
-               StatisticsData tree = getStatisticsTree(traceState);
-               tree.increase(event, traceState, StatisticsData.Values.CPU_TIME | StatisticsData.Values.ELAPSED_TIME | StatisticsData.Values.CUMULATIVE_CPU_TIME);
-               return false;
-       }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsProcessExitHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsProcessExitHandler.java
deleted file mode 100644 (file)
index 7cabf25..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData;
-
-/**
- * <h4>Handler for process exit event statistics</h4>
- */
-public class StatsProcessExitHandler extends AbstractStatsEventHandler {
-       /**
-        * <h4>Constructor</h4>
-        * <p>
-        * Define the LTT_EVENT_PROCESS_EXIT type.
-        * </p>
-        */
-       public StatsProcessExitHandler() {
-               super(Events.LTT_EVENT_PROCESS_EXIT);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public boolean process(LttngEvent event, LttngTraceState traceState) {
-               StatisticsData tree = getStatisticsTree(traceState);
-               tree.process_exit(event, traceState);
-
-               return false;
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlerFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlerFactory.java
deleted file mode 100644 (file)
index 2b0c0ac..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.AbsEventToHandlerResolver;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-
-/**
- * Provide the handlers that will count the CPU Time, Cumulative CPU Time and
- * Elapsed Time and update the appropriate tree.
- * 
- * Builds a Map from string event name to a processing handler object, the
- * processors implement the same interface to facilitate transparent methods
- * call,
- * 
- * The map key STring is the entry point of the raw events, using a hash speeds
- * up the resolution of the appropriate processor
- * 
- * @author alvaro
- * 
- */
-public class StatsTimeCountHandlerFactory extends AbsEventToHandlerResolver {
-
-       // -----------------------------------------------------------------------
-       // Data
-       // -----------------------------------------------------------------------
-
-       private final Map<String, ILttngEventProcessor> eventNametoBeforeProcessor = new HashMap<String, ILttngEventProcessor>();
-       ILttngEventProcessor afterhandler;
-       private static StatsTimeCountHandlerFactory instance = null;
-       private StatsTimeCountHandlers instantiateHandler = new StatsTimeCountHandlers();
-
-       // -----------------------------------------------------------------------
-       // Constructors
-       // -----------------------------------------------------------------------
-
-       private StatsTimeCountHandlerFactory() {
-               super();
-               //create one instance of each individual event handler and add the instance to the map
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SYSCALL_ENTRY
-                               .getInName(), instantiateHandler.getSyscallEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SYSCALL_EXIT
-                               .getInName(), instantiateHandler.getsySyscallExitBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_ENTRY
-                               .getInName(), instantiateHandler.getTrapEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_TRAP_EXIT
-                               .getInName(), instantiateHandler.getTrapExitBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_ENTRY
-                               .getInName(), instantiateHandler.getTrapEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_EXIT
-                               .getInName(), instantiateHandler.getTrapExitBeforeHandler());
-
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
-                               .getInName(), instantiateHandler.getTrapEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
-                               .getInName(), instantiateHandler.getTrapExitBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_ENTRY
-                               .getInName(), instantiateHandler.getIrqEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_IRQ_EXIT
-                               .getInName(), instantiateHandler.getIrqExitBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SOFT_IRQ_ENTRY
-                               .getInName(), instantiateHandler.getSoftIrqEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SOFT_IRQ_EXIT
-                               .getInName(), instantiateHandler.getSoftIrqExitBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_FUNCTION_ENTRY
-                               .getInName(), instantiateHandler.getFunctionEntryBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_FUNCTION_EXIT
-                               .getInName(), instantiateHandler.getFunctionExitBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE
-                               .getInName(), instantiateHandler.getSchedChangeBeforeHandler());
-               
-               eventNametoBeforeProcessor.put(StateStrings.Events.LTT_EVENT_PROCESS_EXIT
-                               .getInName(), instantiateHandler.getProcessExitHandler());
-               
-               afterhandler = instantiateHandler.getAfterHandler();
-
-       }
-
-       // -----------------------------------------------------------------------
-       // Public methods
-       // -----------------------------------------------------------------------
-       /**
-        * The event processors are common to all traces an multiple instances will
-        * use more memory unnecessarily
-        * 
-        * @return
-        */
-       public static AbsEventToHandlerResolver getInstance() {
-               if (instance == null) {
-                       instance = new StatsTimeCountHandlerFactory();
-               }
-               return instance;
-       }
-
-
-       @Override
-       public ILttngEventProcessor getAfterProcessor(String eventType) {
-               return afterhandler;
-       }
-
-       @Override
-       public ILttngEventProcessor getBeforeProcessor(String eventType) {
-               return eventNametoBeforeProcessor.get(eventType);
-       }
-
-       @Override
-       public ILttngEventProcessor getfinishProcessor() {
-               return instantiateHandler.getTracesetEndHandler();
-       }
-
-       @Override
-       public ILttngEventProcessor getStateUpdaterProcessor(String eventType) {
-               return null;
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTimeCountHandlers.java
deleted file mode 100644 (file)
index 92e4345..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.evProcessor.ILttngEventProcessor;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-
-/**
- * Process the system call entry event
- * 
- * @author alvaro
- * 
- */
-class StatsTimeCountHandlers {
-       
-       /**
-        * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getSyscallEntryBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SYSCALL_ENTRY);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_SYSCALL_EXIT
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getsySyscallExitBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SYSCALL_EXIT);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_TRAP_ENTRY
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getTrapEntryBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_TRAP_ENTRY);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_TRAP_EXIT
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getTrapExitBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_TRAP_EXIT);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_IRQ_ENTRY
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getIrqEntryBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_IRQ_ENTRY);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_IRQ_EXIT
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getIrqExitBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_IRQ_EXIT);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_SOFT_IRQ_ENTRY
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getSoftIrqEntryBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SOFT_IRQ_ENTRY);
-               return handler;
-       }
-       
-       /**
-        * Method to handle the event: LTT_EVENT_SOFT_IRQ_EXIT
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getSoftIrqExitBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SOFT_IRQ_EXIT);
-               return handler;
-       }
-
-       /**
-        * <p>
-        * Handles event: LTT_EVENT_FUNCTION_ENTRY
-        * </p>
-        * <p>
-        * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getFunctionEntryBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_FUNCTION_ENTRY);
-               return handler;
-       }
-
-       /**
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getFunctionExitBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_FUNCTION_EXIT);
-               return handler;
-       }
-       
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SCHED_SCHEDULE
-        * </p>
-        * <p>
-        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getSchedChangeBeforeHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SCHED_SCHEDULE);
-               return handler;
-       }
-       
-       /**
-        * <p>
-        * Handles: LTT_EVENT_SCHED_SCHEDULE
-        * </p>
-        * <p>
-        * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
-        * </p>
-        * 
-        * @return
-        */
-       final ILttngEventProcessor getAfterHandler() {
-               AbstractStatsEventHandler handler = new StatsModeChangeHandler(null) {
-                       int sched_hash = StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName().hashCode();
-                       @Override
-                       public boolean process(LttngEvent event, LttngTraceState traceState) {
-                               // Step the event counter for any after event
-                               stepCount(event, traceState);
-
-                               int eventNameHash = event.getMarkerName().hashCode();
-                               // specific processing for after sched schedule
-                               if (sched_hash == eventNameHash
-                                               && event.getMarkerName().equals(StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName())) {
-                                       return super.process(event, traceState);
-                               }
-
-                               return false;
-                       }
-               };
-
-               return handler;
-       }
-       /**
-        * <h4>Get the trace end handler</h4>
-        * <p>Allow to do some calculations when the trace is finished.</p>
-        * @return The handler.
-        */
-       ILttngEventProcessor getTracesetEndHandler() {
-               return new StatsTracesetEndHandler();
-       }
-       /**
-        * <h4>Get the process exit handler</h4>
-        * <p> Handles: {@link org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events#LTT_EVENT_PROCESS_EXIT}.</p>
-        * @return The handler.
-        */
-       ILttngEventProcessor getProcessExitHandler() {
-               return new StatsProcessExitHandler();
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTracesetEndHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/evProcessor/StatsTracesetEndHandler.java
deleted file mode 100644 (file)
index b143689..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData;
-
-/**
- * <h4>Handler for the traceset end</h4>
- * <p>This class allow to react to the end of the traceset.</p>
- */
-public class StatsTracesetEndHandler extends AbstractStatsEventHandler {
-       /**
-        * <h4>Constructor</h4>
-        */
-       public StatsTracesetEndHandler() {
-               super(null);
-       }
-       /*
-        * (non-Javadoc)
-        * @see org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor#process(org.eclipse.linuxtools.lttng.event.LttngEvent, org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-        */
-       @Override
-       public boolean process(LttngEvent event, LttngTraceState traceState) {
-               StatisticsData tree = getStatisticsTree(traceState);
-               tree.endTraceset(event, traceState);
-               return false;
-       }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/messages.properties
deleted file mode 100644 (file)
index aafff50..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-StatisticsView_CPUTimeColumn=CPU Time
-StatisticsView_CPUTimeTip=Total amount of time the CPU was used excluding wait times(I/O, etc.) at that level.
-StatisticsView_CumCPUTimeColumn=Cumulative CPU Time
-StatisticsView_CumCPUTimeTip=Total amount of time between the first and last event excluding wait times in a level.
-StatisticsView_ElapsedTimeColumn=Elapsed Time
-StatisticsView_ElapsedTimeTip=Total amount of time the CPU was used including wait times(I/O, etc.) at that level.
-StatisticsView_LevelColumn=Level
-StatisticsView_LevelColumnTip=Level at which statistics apply.
-StatisticsView_NbEventsColumn=Number of Events
-StatisticsView_NbEventsTip=Total amount of events that are tied to given resource.
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java
deleted file mode 100644 (file)
index 7f50fb9..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-import java.util.Arrays;
-import java.util.RandomAccess;
-
-/**
- * <h4>Allow to create a List object that contain an already existing array.</h4>
- * <p>Works like {@link java.util.Arrays#asList} but offers more functions : 
- * <ul>
- *     <li>{@link #hashCode()}</li>
- *     <li>{@link #equals(Object)}</li>
- * </ul></p>
- * <p>Those functions allow to use the FixedArray as the key of a {@link java.util.HashMap}.</p>
- *
- * @param <T> Type of the array content.
- */
-public final class FixedArray implements RandomAccess, Cloneable {
-       /**
-        * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist in java 5.
-        * @param array Original array to copy from.
-        * @param newLength Length of the copy to be returned.
-        * @return A new array consisting of the elements specified.
-        */
-       private static int[] copyOf(final int[] array, int newLength) {
-               int[] result = new int[newLength]; // Is it useful to use newInstance?
-               System.arraycopy(array, 0, result, 0, Math.min(array.length, newLength));
-               return result;
-       }
-
-       /**
-        * Replace {@link java.util.Arrays#copyOfRange(Object[], int, int)} that do not exist in java 5.
-        * @param <E> Content of the array.
-        * @param array Original array to copy from.
-        * @param start Starting position of the range.
-        * @param end Ending position of the range.
-        * @return A new array consisting of the elements specified.
-        */
-       private static int[] copyOfRange(final int[] array, int start, int end) {
-               int[] result = new int[end - start];
-               System.arraycopy(array, start, result, 0, end - start);
-               return result;
-       }
-       /**
-        * The array.
-        */
-       private final int[] fArray;
-       
-       /**
-        * Constructor.
-        * @param array Array to use. WILL NOT BE COPIED.
-        */
-       public FixedArray(final int... array) {
-               fArray = array;
-       }
-       /**
-        * Append a FixedArray to this FixedArray.
-        * @param value The FixedArray to append.
-        * @return A new FixedArray with the elements of the two FixedArray.
-        */
-       public FixedArray append(final FixedArray value) {
-               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + value.size()));
-               System.arraycopy(value.fArray, 0, result.fArray, fArray.length, value.fArray.length);
-               return result;
-       }
-       /**
-        * Append in order many FixedArray to this FixedArray.
-        * @param values The FixedArrays to append.
-        * @return A new FixedArray with the element of all the FixedArray.
-        */
-       public FixedArray append(final FixedArray... values) {
-               int newLength = 0;
-               for(FixedArray value : values)
-                       newLength += value.size();
-               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + newLength));
-               newLength = fArray.length;
-               for(FixedArray value : values)
-               {
-                       System.arraycopy(value.fArray, 0, result.fArray, newLength, value.fArray.length);
-                       newLength += value.fArray.length;
-               }
-               return result;
-       }
-       /**
-        * Append an element to the array.
-        * @param value Element to append.
-        * @return A new FixedArray with the element appended.
-        */
-       public FixedArray append(final int value) {
-               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + 1));
-               result.fArray[fArray.length] = value;
-               return result;
-       }
-       /**
-        * Append an array of element to the array.
-        * @param values Elements array to append.
-        * @return A new FixedArray with the elements appended.
-        */
-       public FixedArray append(final int... values) {
-               FixedArray result = new FixedArray(copyOf(fArray, fArray.length + values.length));
-               for(int i = 0; i < values.length; ++i)
-                       result.fArray[fArray.length + i] =  values[i];
-               return result;
-       }
-       /*
-        * (non-Javadoc)
-        * @see java.lang.Object#clone()
-        */
-       @Override
-       public Object clone() {
-               return new FixedArray(copyOf(fArray, fArray.length));
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see java.lang.Object#equals(java.lang.Object)
-        */
-       @Override
-    public boolean equals(Object other) {
-        if (this == other)
-            return true;
-        if (other == null)
-            return false;
-        if (!(other instanceof FixedArray))
-            return false;
-        FixedArray array = (FixedArray) other;
-        return Arrays.equals(fArray, array.fArray);
-    }
-
-       /**
-        * Gets value of given index.
-        * @param index 
-        * @return Value of given index
-        */
-       public int get(int index) {
-               return fArray[index];
-       }
-       /**
-        * Get the array reference.
-        * @return The array reference.
-        * @see #toArray FixedArray.toArray() to get a copy of the array.
-        */
-       public int[] getArray() {
-               return fArray;
-       }
-       /*
-        * (non-Javadoc)
-        * @see java.lang.Object#hashCode()
-        */
-       @Override
-       public int hashCode() {
-           return Arrays.hashCode(fArray);
-       }
-       /**
-        * Sets value at given index.
-        * @param index
-        * @param value
-        * @return returns old value.
-        */
-       public int set(int index, int value) {
-               int temp = fArray[index];
-               fArray[index] = value;
-               return temp;
-       }
-       /**
-        * Gets the size of the array.
-        * @return Size of the array.
-        */
-       public int size() {
-               return fArray.length;
-       }
-       /**
-        * Get a array covering only a part of the array.
-        * @param start Starting position of the new array.
-        * @return A new array covering the elements specified.
-        */
-       public FixedArray subArray(int start) {
-               return new FixedArray(copyOfRange(fArray, start, fArray.length - 1));
-       }
-       /**
-        * Get a array covering only a part of the array.
-        * @param start Starting position of the new array.
-        * @param length Number of element to include in the new array.
-        * @return A new array covering the elements specified.
-        */
-       public FixedArray subArray(int start, int length) {
-               return new FixedArray(copyOfRange(fArray, start, length + start));
-       }
-       /*
-        * (non-Javadoc)
-        * @see java.lang.Object#toString()
-        */
-       @Override
-       public String toString() {
-               return Arrays.toString(fArray);
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java
deleted file mode 100644 (file)
index 99d0601..0000000
+++ /dev/null
@@ -1,1126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.Events;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ExecutionMode;
-import org.eclipse.linuxtools.internal.lttng.core.state.StateStrings.ProcessStatus;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngProcessState;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-
-/**
- * <h4>Class that process the LTTng kernel events.</h4>
- */
-public class KernelStatisticsData extends StatisticsData {
-    /**
-     * <h4>Header for the CPU categories.</h4>
-     */
-    public static final String HEADER_CPUS = Messages.KernelStatisticsData_CPUs;
-    public static final int HEADER_CPUS_INT = 256 | LttngConstants.STATS_CATEGORY_ID;
-    /**
-     * <h4>Header for the event types categories.</h4>
-     */
-    public static final String HEADER_EVENT_TYPES = Messages.KernelStatisticsData_EventTypes;
-    public static final int HEADER_EVENT_TYPES_INT = (HEADER_CPUS_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
-    /**
-     * <h4>Header for the function categories.</h4>
-     */
-    public static final String HEADER_FUNCTIONS = Messages.KernelStatisticsData_Functions;
-    public static final int HEADER_FUNCTIONS_INT = (HEADER_EVENT_TYPES_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
-    /**
-     * <h4>Header for the mode categories.</h4>
-     */
-    public static final String HEADER_MODES = Messages.KernelStatisticsData_Modes;
-    public static final int HEADER_MODES_INT = (HEADER_FUNCTIONS_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
-    /**
-     * <h4>Header for the processes categories.</h4>
-     */
-    public static final String HEADER_PROCESSES = Messages.KernelStatisticsData_Processes;
-    public static final int HEADER_PROCESSES_INT = (HEADER_MODES_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
-    /**
-     * <h4>Header for the submode categories.</h4>
-     */
-    public static final String HEADER_SUBMODES = Messages.KernelStatisticsData_SubModes;
-    public static final int HEADER_SUBMODES_INT = (HEADER_PROCESSES_INT + 1) | LttngConstants.STATS_CATEGORY_ID;
-
-    /**
-     * <h4>Class to generate unique IDs for processes.</h4>
-     */
-    private ProcessKeyProvider fPidKeys = new ProcessKeyProvider(LttngConstants.STATS_PROCESS_ID);
-
-    /**
-     * <h4>Class to generate unique Ids for event types.</h4>
-     */
-    private KeyProvider fTypeKeys = new KeyProvider(LttngConstants.STATS_TYPE_ID);
-    /**
-     * <h4>Class to generate unique Ids for subModes.</h4>
-     */
-    private KeyProvider fSubModeKeys = new KeyProvider();
-
-    /**
-     * <h4>Place Holder in path.</h4>
-     */
-    private static final int PLACE_HOLDER = 0;
-
-    /**
-     * For performance reason the following algorithm is applied to the paths:
-     * 
-     * Each array entry has to be unique to form a unique path. To generate
-     * unique entries a bit mask is used, where the bit mask is applied to the
-     * upper N bits of an integer value. It is assumed, that each value that
-     * will be filled in the place holder below is smaller than 2 ^ (32 - N).
-     */
-
-    /**
-     * <h4>Pre-created paths for type statistics, which will be filled for each
-     * relevant event.</h4>
-     */
-    private final FixedArray[] fTypedPaths = { new FixedArray(PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER, HEADER_EVENT_TYPES_INT, PLACE_HOLDER), };
-    /**
-     * <h4>Pre-created paths for other statistics, which will be filled for each
-     * relevant event.</h4>
-     */
-    final FixedArray[] fNormalPaths = { new FixedArray(PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_FUNCTIONS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_PROCESSES_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER), new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER),
-            new FixedArray(PLACE_HOLDER, HEADER_CPUS_INT, PLACE_HOLDER, HEADER_MODES_INT, PLACE_HOLDER, HEADER_SUBMODES_INT, PLACE_HOLDER), };
-
-    /**
-     * <h4>Indicate that it's a value.</h4>
-     * <p>
-     * Used when checking the possible child node for a node.
-     * </p>
-     * <p>
-     * It differentiate a category of a value by being appended to a value.
-     * </p>
-     */
-    private static final Integer NODE = -1;
-    private static final Integer ROOT_NODE_KEY = -2;
-
-    /**
-     * <h4>Constructor.</h4>
-     * 
-     * @param traceName
-     */
-    public KernelStatisticsData(String traceName) {
-        super();
-        Map<Integer, Set<Integer>> keys = getKeys();
-
-        // //////////// Adding category sets
-        keys.put(HEADER_PROCESSES_INT, new HashSet<Integer>());
-        keys.put(HEADER_MODES_INT, new HashSet<Integer>());
-        keys.put(HEADER_CPUS_INT, new HashSet<Integer>(4)); // Over 4 CPUs is
-                                                            // not common
-        keys.put(HEADER_SUBMODES_INT, new HashSet<Integer>());
-        keys.put(HEADER_EVENT_TYPES_INT, new HashSet<Integer>());
-        keys.put(HEADER_FUNCTIONS_INT, new HashSet<Integer>(4)); // Seems to be
-                                                                 // always one.
-
-        // /////////// Adding value sets
-        // Under a trace
-        Set<Integer> temp = new HashSet<Integer>(8);
-        temp.add(HEADER_PROCESSES_INT);
-        temp.add(HEADER_MODES_INT);
-        temp.add(HEADER_CPUS_INT);
-        temp.add(HEADER_EVENT_TYPES_INT);
-        keys.put(ROOT_NODE_KEY, temp);
-        // Under a process
-        temp = new HashSet<Integer>(4);
-        temp.add(HEADER_MODES_INT);
-        temp.add(HEADER_CPUS_INT);
-        temp.add(HEADER_EVENT_TYPES_INT);
-        keys.put(HEADER_PROCESSES_INT * NODE, temp);
-        // Under a CPUs : Functions is a special case
-        temp = new HashSet<Integer>(4);
-        temp.add(HEADER_MODES_INT);
-        temp.add(HEADER_EVENT_TYPES_INT);
-        keys.put(HEADER_CPUS_INT * NODE, temp);
-        // Under a functions
-        temp = new HashSet<Integer>(4);
-        temp.add(HEADER_MODES_INT);
-        temp.add(HEADER_EVENT_TYPES_INT);
-        keys.put(HEADER_FUNCTIONS_INT * NODE, temp);
-        // Under a mode
-        temp = new HashSet<Integer>(4);
-        temp.add(HEADER_SUBMODES_INT);
-        temp.add(HEADER_EVENT_TYPES_INT);
-        keys.put(HEADER_MODES_INT * NODE, temp);
-        // Under a submodes
-        temp = new HashSet<Integer>(2);
-        temp.add(HEADER_EVENT_TYPES_INT);
-        keys.put(HEADER_SUBMODES_INT * NODE, temp);
-        // Under an event type
-        temp = new HashSet<Integer>(16);
-        keys.put(HEADER_EVENT_TYPES_INT * NODE, temp);
-
-        // //////////// CREATE root
-        keys.put(ROOT.get(0), new HashSet<Integer>(2)); // 1 trace at the time
-        StatisticsTreeNode node = getOrCreate(ROOT);
-        node.setName("root"); //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
-     * #endTraceset(org.eclipse.linuxtools.lttng.event.LttngEvent,
-     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-     */
-    @Override
-    public void endTraceset(LttngEvent event, LttngTraceState traceState) {
-        // TODO Should we uncomment the rest?
-        // It include in the cpu time the time between the last event of each
-        // cpu and the time of the last global event.
-        // Because we know that there won't be a change of mode or process
-        // between those time.
-        /*
-         * if(last_ == null) return;
-         * 
-         * LttngProcessState process = traceState.getRunning_process().get(0L);
-         * System.out.println(process.getState().getChange_LttTime()); for(long
-         * cpu : traceState.getRunning_process().keySet()) { LttngEventType
-         * newType = new LttngEventType(last_.getType().getTracefileName(), cpu,
-         * last_.getType().getMarkerName(), last_.getType().getLabels());
-         * last_.setType(newType); increase(last_, traceState, Values.CPU_TIME |
-         * Values.CUMULATIVE_CPU_TIME | Values.ELAPSED_TIME |
-         * Values.STATE_CUMULATIVE_CPU_TIME); // TODO Are all those values
-         * required? }
-         */
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
-     * #getChildren
-     * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
-     */
-    @Override
-    public Collection<StatisticsTreeNode> getChildren(final FixedArray path) {
-        LinkedList<StatisticsTreeNode> result = new LinkedList<StatisticsTreeNode>();
-
-        if (path.size() % 2 == 0) { // if we are at a Category
-            StatisticsTreeNode current = null;
-            for (int value : getKeys().get(path.get(path.size() - 1))) {
-                current = get(path.append(value));
-                if (current != null && current.getValue().nbEvents != 0)
-                    result.add(current);
-            }
-        } else if (path.size() == 1) { // Special case.
-            if (path.equals(ROOT)) // Asking for the root.
-                for (int value : getKeys().get(ROOT.get(0)))
-                    result.add(getOrCreate(new FixedArray(value)));
-            else
-                // Get value under the root
-                for (int value : getKeys().get(ROOT_NODE_KEY)) {
-                    StatisticsTreeNode node = getOrCreate(path.append(value));
-                    node.setName(getCategoryFromId(value));
-                    result.add(node);
-                }
-        } else {// If we are at a value
-            for (int value : getKeys().get((path.get(path.size() - 2) * NODE))) { // Search
-                                                                                  // the
-                                                                                  // parent
-                                                                                  // name
-                                                                                  // +
-                                                                                  // NODE
-                StatisticsTreeNode node = getOrCreate(path.append(value));
-                node.setName(getCategoryFromId(value));
-                result.add(node);
-            }
-
-            if (path.size() == 5 && path.get(3) == HEADER_CPUS_INT) { // Special
-                                                                      // the
-                                                                      // Functions
-                                                                      // is just
-                                                                      // there.
-                                                                      // We want
-                                                                      // the
-                                                                      // fourth
-                                                                      // element
-                                                                      // but it
-                                                                      // start
-                                                                      // at 0.
-                                                                      // So #3
-                StatisticsTreeNode node = getOrCreate(path.append(HEADER_FUNCTIONS_INT));
-                node.setName(getCategoryFromId(HEADER_FUNCTIONS_INT));
-                result.add(node);
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * <h4>Get the standard paths for an event.</h4>
-     * 
-     * @param event
-     *            Event to get the path for.
-     * @param traceState
-     *            State of the trace for this event.
-     * @return Array of FixedArray representing the paths.
-     */
-    private FixedArray[] getNormalPaths(LttngEvent event, LttngTraceState traceState) {
-        int trace = (int) traceState.getContext().getIdentifier(); // No need
-                                                                   // for the
-                                                                   // identifier
-                                                                   // (already
-                                                                   // applied)
-        Long cpu = event.getCpuId();
-        int cpus = cpu.intValue() | LttngConstants.STATS_CPU_ID;
-        LttngProcessState process = traceState.getRunning_process().get(cpu);
-        int processName = fPidKeys.getUniqueId(process.getPid().intValue(), process.getCpu().intValue(), process.getCreation_time());
-        int mode = process.getState().getExec_mode().ordinal() | LttngConstants.STATS_MODE_ID;
-        int submode = fSubModeKeys.getUniqueId(process.getState().getExec_submode_id(), process.getState().getExec_submode());
-        int function = process.getCurrent_function().intValue() | LttngConstants.STATS_FUNCTION_ID;
-
-        /*
-         * Note that it's faster to re-use the path object, set the relevant
-         * fields and clone the path later when it's time to add to the map
-         */
-
-        // FixedArray(trace)
-        fNormalPaths[0].set(0, trace);
-
-        // FixedArray(trace,HEADER_MODES_INT,mode)
-        fNormalPaths[1].set(0, trace);
-        fNormalPaths[1].set(2, mode);
-
-        // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
-        fNormalPaths[2].set(0, trace);
-        fNormalPaths[2].set(2, mode);
-        fNormalPaths[2].set(4, submode);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName)
-        fNormalPaths[3].set(0, trace);
-        fNormalPaths[3].set(2, processName);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus)
-        fNormalPaths[4].set(0, trace);
-        fNormalPaths[4].set(2, processName);
-        fNormalPaths[4].set(4, cpus);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function)
-        fNormalPaths[5].set(0, trace);
-        fNormalPaths[5].set(2, processName);
-        fNormalPaths[5].set(4, cpus);
-        fNormalPaths[5].set(6, function);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,
-        // HEADER_MODES_INT, mode)
-        fNormalPaths[6].set(0, trace);
-        fNormalPaths[6].set(2, processName);
-        fNormalPaths[6].set(4, cpus);
-        fNormalPaths[6].set(6, function);
-        fNormalPaths[6].set(8, mode);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,
-        // HEADER_MODES_INT, mode, HEADER_SUBMODES_INT, submode)
-        fNormalPaths[7].set(0, trace);
-        fNormalPaths[7].set(2, processName);
-        fNormalPaths[7].set(4, cpus);
-        fNormalPaths[7].set(6, function);
-        fNormalPaths[7].set(8, mode);
-        fNormalPaths[7].set(10, submode);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode)
-        fNormalPaths[8].set(0, trace);
-        fNormalPaths[8].set(2, processName);
-        fNormalPaths[8].set(4, cpus);
-        fNormalPaths[8].set(6, mode);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
-        fNormalPaths[9].set(0, trace);
-        fNormalPaths[9].set(2, processName);
-        fNormalPaths[9].set(4, cpus);
-        fNormalPaths[9].set(6, mode);
-        fNormalPaths[9].set(8, submode);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode)
-        fNormalPaths[10].set(0, trace);
-        fNormalPaths[10].set(2, processName);
-        fNormalPaths[10].set(4, mode);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
-        fNormalPaths[11].set(0, trace);
-        fNormalPaths[11].set(2, processName);
-        fNormalPaths[11].set(4, mode);
-        fNormalPaths[11].set(6, submode);
-
-        // FixedArray(trace,HEADER_CPUS_INT,cpus)
-        fNormalPaths[12].set(0, trace);
-        fNormalPaths[12].set(2, cpus);
-
-        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode)
-        fNormalPaths[13].set(0, trace);
-        fNormalPaths[13].set(2, cpus);
-        fNormalPaths[13].set(4, mode);
-
-        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode)
-        fNormalPaths[14].set(0, trace);
-        fNormalPaths[14].set(2, cpus);
-        fNormalPaths[14].set(4, mode);
-        fNormalPaths[14].set(6, submode);
-
-        return fNormalPaths;
-
-    }
-
-    /**
-     * <h4>Get the event types paths.</h4>
-     * 
-     * @param event
-     *            Event to get the path for.
-     * @param traceState
-     *            State of the trace for this event.
-     * @return Array of FixedArray representing the paths.
-     */
-    private FixedArray[] getTypePaths(LttngEvent event, LttngTraceState traceState) {
-        int trace = (int) traceState.getContext().getIdentifier(); // No need
-                                                                   // for the
-                                                                   // identifier
-                                                                   // (already
-                                                                   // applied)
-        Long cpu = event.getCpuId();
-        int cpus = cpu.intValue() | LttngConstants.STATS_CPU_ID;
-        LttngProcessState process = traceState.getRunning_process().get(cpu);
-        int processName = fPidKeys.getUniqueId(process.getPid().intValue(), process.getCpu().intValue(), process.getCreation_time());
-        int mode = process.getState().getExec_mode().ordinal() | LttngConstants.STATS_MODE_ID;
-        int submode = fSubModeKeys.getUniqueId(process.getState().getExec_submode_id(), process.getState().getExec_submode());
-        int function = process.getCurrent_function().intValue() | LttngConstants.STATS_FUNCTION_ID;
-        int type = fTypeKeys.getUniqueId(event.getMarkerId(), event.getMarkerName());
-
-        /*
-         * Note that it's faster to re-use the path object, set the relevant
-         * fields and clone the path later when it's time to add to the map
-         */
-
-        // FixedArray(trace,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[0].set(0, trace);
-        fTypedPaths[0].set(2, type);
-
-        // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[1].set(0, trace);
-        fTypedPaths[1].set(2, mode);
-        fTypedPaths[1].set(4, type);
-
-        // FixedArray(trace,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[2].set(0, trace);
-        fTypedPaths[2].set(2, mode);
-        fTypedPaths[2].set(4, submode);
-        fTypedPaths[2].set(6, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[3].set(0, trace);
-        fTypedPaths[3].set(2, processName);
-        fTypedPaths[3].set(4, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[4].set(0, trace);
-        fTypedPaths[4].set(2, processName);
-        fTypedPaths[4].set(4, cpus);
-        fTypedPaths[4].set(6, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[5].set(0, trace);
-        fTypedPaths[5].set(2, processName);
-        fTypedPaths[5].set(4, cpus);
-        fTypedPaths[5].set(6, function);
-        fTypedPaths[5].set(8, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[6].set(0, trace);
-        fTypedPaths[6].set(2, processName);
-        fTypedPaths[6].set(4, cpus);
-        fTypedPaths[6].set(6, function);
-        fTypedPaths[6].set(8, mode);
-        fTypedPaths[6].set(10, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_FUNCTIONS_INT,function,
-        // HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[7].set(0, trace);
-        fTypedPaths[7].set(2, processName);
-        fTypedPaths[7].set(4, cpus);
-        fTypedPaths[7].set(6, function);
-        fTypedPaths[7].set(8, mode);
-        fTypedPaths[7].set(10, submode);
-        fTypedPaths[7].set(12, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[8].set(0, trace);
-        fTypedPaths[8].set(2, processName);
-        fTypedPaths[8].set(4, cpus);
-        fTypedPaths[8].set(6, mode);
-        fTypedPaths[8].set(8, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[9].set(0, trace);
-        fTypedPaths[9].set(2, processName);
-        fTypedPaths[9].set(4, cpus);
-        fTypedPaths[9].set(6, mode);
-        fTypedPaths[9].set(8, submode);
-        fTypedPaths[9].set(10, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[10].set(0, trace);
-        fTypedPaths[10].set(2, processName);
-        fTypedPaths[10].set(4, mode);
-        fTypedPaths[10].set(6, type);
-
-        // FixedArray(trace,HEADER_PROCESSES_INT,processName,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[11].set(0, trace);
-        fTypedPaths[11].set(2, processName);
-        fTypedPaths[11].set(4, mode);
-        fTypedPaths[11].set(6, submode);
-        fTypedPaths[11].set(8, type);
-
-        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[12].set(0, trace);
-        fTypedPaths[12].set(2, cpus);
-        fTypedPaths[12].set(4, type);
-
-        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[13].set(0, trace);
-        fTypedPaths[13].set(2, cpus);
-        fTypedPaths[13].set(4, mode);
-        fTypedPaths[13].set(6, type);
-
-        // FixedArray(trace,HEADER_CPUS_INT,cpus,HEADER_MODES_INT,mode,HEADER_SUBMODES_INT,submode,HEADER_EVENT_TYPES_INT,type)
-        fTypedPaths[14].set(0, trace);
-        fTypedPaths[14].set(2, cpus);
-        fTypedPaths[14].set(4, mode);
-        fTypedPaths[14].set(6, submode);
-        fTypedPaths[14].set(8, type);
-
-        return fTypedPaths;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
-     * #process_exit(org.eclipse.linuxtools.lttng.event.LttngEvent,
-     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-     */
-    @Override
-    public void process_exit(LttngEvent event, LttngTraceState traceState) {
-        FixedArray[] paths = getNormalPaths(event, traceState);
-        Long cpu = event.getCpuId();
-        LttngProcessState process = traceState.getRunning_process().get(cpu);
-
-        for (int j = 0; j < paths.length; ++j) {
-            StatisticsTreeNode node = getOrCreate(paths[j], event, traceState, j, false);
-
-            if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-            }
-        }
-        // TODO Unstacks cumulative CPU time
-        // TODO Elapsed time?
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
-     * #increase(org.eclipse.linuxtools.lttng.event.LttngEvent,
-     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState, int)
-     */
-    @Override
-    public void increase(LttngEvent event, LttngTraceState traceState, int values) {
-        FixedArray[] paths = getNormalPaths(event, traceState);
-        Long cpu = event.getCpuId();
-               LttngProcessState process = traceState.getRunning_process().get(cpu);
-
-        // Updating the cumulative CPU time
-        if ((values & Values.STATE_CUMULATIVE_CPU_TIME) != 0) {
-            if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                long cumulativeCpuTime = process.getState().getCum_cpu_time();
-                long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                process.getState().setCum_cpu_time(cumulativeCpuTime + delta);
-            }
-        }
-        if ((values & Values.CUMULATIVE_CPU_TIME) != 0) {
-            if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                long cumulativeCpuTime = process.getState().getCum_cpu_time();
-                long delta = event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
-                long newCumulativeCpuTime = cumulativeCpuTime + delta;
-                process.getState().setCum_cpu_time(newCumulativeCpuTime);
-            } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                long cumulativeCpuTime = process.getState().getCum_cpu_time();
-                long delta = event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                long newCumulativeCpuTime = cumulativeCpuTime + delta;
-                process.getState().setCum_cpu_time(newCumulativeCpuTime);
-            }
-        }
-
-               for (int j = 0; j < paths.length; ++j) {
-                       StatisticsTreeNode node = getOrCreate(paths[j], event, traceState, j, false);
-
-            if ((values & Values.CPU_TIME) != 0) {
-                // TODO Uncomment if the event after process_exit need to be
-                // count.
-                if ((process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) /*
-                                                                                               * || process.getState().
-                                                                                               * getProc_status
-                                                                                               * ().equals(ProcessStatus
-                                                                                               * .LTTV_STATE_EXIT)
-                                                                                               */) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                    node.getValue().cpuTime += event.getTimestamp().getValue() - process.getState().getChange_LttTime();
-                }
-            }
-            if ((values & Values.CUMULATIVE_CPU_TIME) != 0) {
-                if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                    node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
-                } else if (process.getState().getProc_status().equals(ProcessStatus.LTTV_STATE_RUN) && !process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                     node.getValue().cumulativeCpuTime += process.getState().getCum_cpu_time();
-                }
-            }
-            if ((values & Values.ELAPSED_TIME) != 0) {
-                if (!process.getState().getExec_mode().equals(ExecutionMode.LTTV_STATE_MODE_UNKNOWN)) {
-                    node.getValue().elapsedTime += event.getTimestamp().getValue() - process.getState().getEntry_LttTime();
-                }
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
-     * #registerEvent(org.eclipse.linuxtools.lttng.event.LttngEvent,
-     * org.eclipse.linuxtools.lttng.state.model.LttngTraceState)
-     */
-    @Override
-    public void registerEvent(LttngEvent event, LttngTraceState traceState) {
-        FixedArray[] paths = getNormalPaths(event, traceState);
-        for (int i = 0; i < paths.length; ++i)
-            ++(getOrCreate(paths[i], event, traceState, i, false).getValue().nbEvents);
-
-        paths = getTypePaths(event, traceState);
-        for (int i = 0; i < paths.length; ++i)
-            ++(getOrCreate(paths[i], event, traceState, i, true).getValue().nbEvents);
-
-        // last_ = event; // TODO Used by endTraceset
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData
-     * #registerName
-     * (org.eclipse.linuxtools.lttng.ui.views.statistics.model.FixedArray)
-     */
-    @Override
-    protected void registerName(final FixedArray path) {
-        if (path.size() == 1) {
-            if (!path.equals(ROOT))
-                getKeys().get(ROOT.get(0)).add(path.get(0));
-        } else if (path.size() % 2 != 0)
-            getKeys().get(path.get(path.size() - 2)).add(path.get(path.size() - 1));
-    }
-
-    /**
-     * <h4>Get or create a node.</h4>
-     * 
-     * @param path
-     *            Path to the node.
-     * @param event
-     *            The current event
-     * @param traceState
-     *            The current trace state
-     * @param index
-     *            The corresponding index of the statistic
-     * @param isType
-     *            The type of statistic (type or other)
-     * @return The node.
-     */
-    public StatisticsTreeNode getOrCreate(final FixedArray path, LttngEvent event, LttngTraceState traceState, int index, boolean isType) {
-        StatisticsTreeNode current = get(path);
-        if (current == null) {
-            // We have to clone the path since the object for the path is
-            // re-used for performance reasons!
-            FixedArray newPath = (FixedArray) path.clone();
-
-            // Note that setting of the name is done here only when the node is
-            // created (for performance reasons).
-            String name = (isType) ? getTypeStatsName(event, traceState, index) : getOtherStatsName(event, traceState, index);
-            registerName(path);
-            current = new StatisticsTreeNode(newPath, this, name);
-            put(newPath, current);
-        }
-        else {
-            // Special case: Update name if event is of type "exec". This is necessary because the 
-            // process name can change at this point (See Bug333114))
-            if ((index == 3) && !isType && Events.LTT_EVENT_EXEC.getInName().equals(event.getMarkerName())) {
-                String name = getOtherStatsName(event, traceState, index);
-                current.setName(name);
-            }
-        }
-        return current;
-    }
-
-    /**
-     * <h4>Get the name to be displayed for other statistics than type
-     * statistics</h4>
-     * 
-     * @param event
-     *            The current event
-     * @param traceState
-     *            The current trace state
-     * @param The
-     *            corresponding index of the statistic
-     * @return The name
-     */
-    private String getOtherStatsName(LttngEvent event, LttngTraceState traceState, int index) {
-        Long cpu = event.getCpuId();
-        LttngProcessState process = traceState.getRunning_process().get(cpu);
-
-        switch (index) {
-        case 0:
-            return traceState.getContext().getTraceId();
-        case 1:
-            return process.getState().getExec_mode().getInName();
-        case 2:
-            return process.getState().getExec_submode();
-        case 3:
-            return getProcessName(process);
-        case 4:
-            return String.valueOf(cpu);
-        case 5:
-            return process.getCurrent_function().toString();
-        case 6:
-            return process.getState().getExec_mode().getInName();
-        case 7:
-            return process.getState().getExec_submode();
-        case 8:
-            return process.getState().getExec_mode().getInName();
-        case 9:
-            return process.getState().getExec_submode();
-        case 10:
-            return process.getState().getExec_mode().getInName();
-        case 11:
-            return process.getState().getExec_submode();
-        case 12:
-            return String.valueOf(cpu);
-        case 13:
-            return process.getState().getExec_mode().getInName();
-        case 14:
-            return process.getState().getExec_submode();
-        default:
-            return ""; //$NON-NLS-1$
-        }
-    }
-
-    /**
-     * <h4>Get the name to be displayed for type statistics</h4>
-     * 
-     * @param event
-     *            The current event
-     * @param traceState
-     *            The current state
-     * @param index
-     *            The corresponding index of the statistic
-     * @return The strings in a array
-     */
-    private String getTypeStatsName(LttngEvent event, LttngTraceState traceState, int index) {
-        return event.getMarkerName();
-    }
-
-    /**
-     * <h4>Get the name of a process.</h4>
-     * 
-     * @param process
-     *            The process.
-     * @return The name of the process. //TODO Adding the creation time of the
-     *         process may be needed to differentiate two process.
-     */
-    private String getProcessName(LttngProcessState process) {
-        if (process.getPid() == -1)
-            return Messages.StatisticsData_UnknowProcess;
-        if (process.getName() == null)
-            return mergeString(Messages.StatisticsData_UnknowProcess + " - ", String.valueOf(process.getPid())); //$NON-NLS-1$
-        if (process.getName().equals("")) //$NON-NLS-1$
-            return process.getPid().toString();
-        else
-            return mergeString(process.getName(), " - ", String.valueOf(process.getPid())); //$NON-NLS-1$
-    }
-
-    /**
-     * <h4>Converts the integer representation of the category to string.</h4>
-     * 
-     * @param value
-     *            Integer representation of the category.
-     * @return Category as string.
-     */
-    public static String getCategoryFromId(int value) {
-        switch (value) {
-        case KernelStatisticsData.HEADER_CPUS_INT:
-            return KernelStatisticsData.HEADER_CPUS;
-        case KernelStatisticsData.HEADER_EVENT_TYPES_INT:
-            return KernelStatisticsData.HEADER_EVENT_TYPES;
-        case KernelStatisticsData.HEADER_FUNCTIONS_INT:
-            return KernelStatisticsData.HEADER_FUNCTIONS;
-        case KernelStatisticsData.HEADER_MODES_INT:
-            return KernelStatisticsData.HEADER_MODES;
-        case KernelStatisticsData.HEADER_PROCESSES_INT:
-            return KernelStatisticsData.HEADER_PROCESSES;
-        case KernelStatisticsData.HEADER_SUBMODES_INT:
-            return KernelStatisticsData.HEADER_SUBMODES;
-        }
-        return ""; //$NON-NLS-1$
-    }
-
-    /**
-     * <h4>Provides unique keys for String - Integer pairs.</h4>
-     * 
-     * @author bhufmann
-     * 
-     */
-    private static final class KeyProvider {
-
-        /**
-         * <h4>Instance counter for unique ID generation.</h4>
-         */
-        private int fCount = 0;
-
-        /**
-         * <h4>Attributes to generate unique IDs for processes.</h4>
-         */
-        private HashMap<KeyHelper, Integer> fKeyMap = new HashMap<KeyHelper, Integer>(65535);
-        private final KeyHelper fHelper = new KeyHelper();
-
-        /**
-         * <h4>Bit mask to apply for the key.</h4>
-         */
-        private int fBitMask = 0;
-
-        /**
-         * Constructor
-         * 
-         * @param bitMask
-         *            <h4>Bit mask to apply for the key.</h4>
-         */
-        KeyProvider(int bitMask) {
-            this.fBitMask = bitMask;
-        }
-
-        /**
-         * <h4>Standard Constructor</h4>
-         */
-        KeyProvider() {
-            this(0);
-        }
-
-        /**
-         * <h4>Creates unique id for the given input data.</h4>
-         * 
-         * @param value
-         *            Integer value of the data the key is for
-         * @param name
-         *            Name of the data the key is for
-         * @return Unique id
-         */
-        public int getUniqueId(int value, String name) {
-            fHelper.setName(name);
-            fHelper.setValue(value);
-
-            Integer returnKey = fKeyMap.get(fHelper);
-            if (returnKey == null) {
-                returnKey = Integer.valueOf((++fCount) | fBitMask);
-                KeyHelper newHelper = fHelper.clone();
-                fKeyMap.put(newHelper, returnKey);
-            }
-            return returnKey.intValue();
-        }
-    }
-
-    /**
-     <h4>Helper class that provides keys for HashMaps depending on an integer 
-     * - string -pair. It provides better performance than using a string as key
-     * only. However, for optimal performance the integer values should be mostly
-     * unique.</h4>
-     * 
-     * @author bhufmann
-     * 
-     */
-    private static final class KeyHelper implements Cloneable {
-
-        // Short pre-fix
-        private final static String UNKNOWN_PREFIX = "P"; //$NON-NLS-1$
-
-        private String fName = UNKNOWN_PREFIX;
-        private int fValue = -1;
-
-        /*
-         * (non-Javadoc)
-         * 
-         * @see java.lang.Object#hashCode()
-         */
-        @Override
-        public int hashCode() {
-            return fValue;
-        }
-
-        /*
-         * (non-Javadoc)
-         * 
-         * @see java.lang.Object#equals(java.lang.Object)
-         */
-        @Override
-        public boolean equals(Object o) {
-            if (o == this)
-                return true;
-            if (o == null)
-                return false;
-            if (!(o instanceof KeyHelper))
-                return false;
-            KeyHelper kh = (KeyHelper) o;
-            if (fValue == kh.fValue && fName.equals(kh.fName)) {
-                return true;
-            }
-            return false;
-        }
-
-        /*
-         * (non-Javadoc)
-         * 
-         * @see java.lang.Object#clone()
-         */
-        @Override
-        public KeyHelper clone() {
-            KeyHelper clone = null;
-            try {
-                clone = (KeyHelper) super.clone();
-                clone.fName = fName;
-                clone.fValue = fValue;
-            } catch (CloneNotSupportedException e) {
-                e.printStackTrace();
-            }
-            return clone;
-        }
-
-        /**
-         * <h4>Set the name of the key.</h4>
-         * 
-         * @param name
-         *            The name to set.
-         */
-        public void setName(String name) {
-            if (fName != null)
-                this.fName = name;
-            else
-                this.fName = UNKNOWN_PREFIX;
-        }
-
-        /**
-         * <h4>Set the value of the key.</h4>
-         * 
-         * @param value
-         */
-        public void setValue(int value) {
-            this.fValue = value;
-        }
-    }
-
-    /**
-     * <h4>Provides unique keys for given process information. For optimal performance the integer 
-     * PIDs need to be mostly unique</h4>
-     * 
-     * @author bhufmann
-     * 
-     */
-    private static final class ProcessKeyProvider {
-        /**
-         * <h4>Instance counter for unique ID generation.</h4>
-         */
-        private int fCount = 0;
-
-        /**
-         * <h4>Attributes to generate unique IDs for processes.</h4>
-         */
-        private HashMap<ProcessKey, Integer> fKeyMap = new HashMap<ProcessKey, Integer>(65535);
-        private ProcessKey fHelper = new ProcessKey();
-
-        /**
-         * <h4>Bit mask to apply for the key.</h4>
-         */
-        private int fBitMask = 0;
-
-        /**
-         * Constructor
-         * 
-         * @param bitMask
-         *            <h4>Bit mask to apply for the key.</h4>
-         */
-        public ProcessKeyProvider(int bitMask) {
-            fBitMask = bitMask;
-        }
-
-        /**
-         * <h4>Creates unique id for the given input data.</h4>
-         * 
-         * @param value
-         *            Integer value of the data the key is for
-         * @param cpuId
-         *            The cpuId for the processKey Helper
-         * @param creationTime
-         *            The creation Time for the processKey Helper
-         * @return Unique id
-         */
-        public int getUniqueId(int value, int cpuId, long creationTime) {
-            fHelper.setPid(value);
-            fHelper.setCpuId(cpuId);
-            fHelper.setCreationTime(creationTime);
-
-            Integer returnKey = fKeyMap.get(fHelper);
-            if (returnKey == null) {
-                returnKey = Integer.valueOf((++fCount) | fBitMask);
-                ProcessKey newHelper = fHelper.clone();
-                fKeyMap.put(newHelper, returnKey);
-            }
-            return returnKey.intValue();
-        }
-    }
-    
-    /**
-    <h4>Helper class that provides keys for HashMaps depending on process information.</h4>
-    * 
-    * @author bhufmann
-    * 
-    */
-    private static final class ProcessKey implements Cloneable {
-        private int fPid = 0;
-        private int fCpuId = 0;
-        private long fCreationTime = 0;
-
-        /**
-         * <h4>Set the PID of the key.</h4>
-         * 
-         * @param pid
-         */
-        public void setPid(int pid) {
-            this.fPid = pid;
-        }
-        
-        /**
-         * <h4>Set the cpuTime of the process key.</h4>
-         * 
-         * @param cpuTime
-         *            The name to set.
-         */
-        public void setCpuId(int cpuId) {
-            this.fCpuId = cpuId;
-        }
-
-        /**
-         * <h4>Set the creationTime of the process key.</h4>
-         * 
-         * @param creationTime
-         *            The name to set.
-         */
-        public void setCreationTime(long creationTime) {
-            this.fCreationTime = creationTime;
-        }
-
-        /*
-         * (non-Javadoc)
-         * @see java.lang.Object#equals(java.lang.Object)
-         */
-        @Override
-        public boolean equals(Object obj) {
-            if (obj == this)
-                return true;
-            if (obj == null)
-                return false;
-            if (!(obj instanceof ProcessKey))
-                return false;
-
-            ProcessKey procKey = (ProcessKey) obj;
-
-            if (procKey.fPid != this.fPid) {
-                return false;
-            }
-
-            if (procKey.fCreationTime != this.fCreationTime) {
-                return false;
-            }
-            
-            // use the cpu value to validate pid 0
-            if (((procKey.fPid == 0L) && (procKey.fCpuId != this.fCpuId))) {
-                return false;
-            }
-            return true;
-        }
-
-        /*
-         * (non-Javadoc)
-         * @see java.lang.Object#hashCode()
-         */
-        @Override
-        public int hashCode() {
-            return this.fPid;
-        }
-
-        /*
-         * (non-Javadoc)
-         * @see java.lang.Object#clone()
-         */
-        @Override
-        public ProcessKey clone() {
-            ProcessKey clone = null;
-            try {
-                clone = (ProcessKey) super.clone();
-                clone.fPid = fPid;
-                clone.fCpuId = fCpuId;
-                clone.fCreationTime = fCreationTime;
-            } catch (CloneNotSupportedException e) {
-                e.printStackTrace();
-            }
-            return clone;
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Messages.java
deleted file mode 100644 (file)
index e699fa8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.statistics.model.messages"; //$NON-NLS-1$
-    public static String KernelStatisticsData_CPUs;
-    public static String KernelStatisticsData_EventTypes;
-    public static String KernelStatisticsData_Functions;
-    public static String KernelStatisticsData_Modes;
-    public static String KernelStatisticsData_Processes;
-    public static String KernelStatisticsData_SubModes;
-    public static String StatisticsData_UnknowProcess;
-    static {
-       // initialize resource bundle
-       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Statistics.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/Statistics.java
deleted file mode 100644 (file)
index 5bf15d6..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-public class Statistics {
-       /**
-        * <h4>Number of event</h4>
-        */
-       public long nbEvents = 0;
-       /**
-        * <h4>CPU time</h4>
-        * <p>Many events are excluded of the CPU time:
-        * <ul>
-        *              <li>All events in MODE_UNKNOWN</li>
-        *              <li>All events before a sched_schedule on a given CPU</li>
-        *              <li>All events in a process after the process_exit</li>
-        *              <li>Maybe some others</li>
-        * </ul>
-        */
-       public long cpuTime = 0;
-       /**
-        * <h4>Cumulative CPU time</h4>
-        * <p>Currently broken.</p>
-        */
-       public long cumulativeCpuTime = 0;
-       /**
-        * <h4>Elapsed time</h4>
-        * <p>Result validity in eclipse unknown.</p>
-        */
-       public long elapsedTime = 0;
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsData.java
deleted file mode 100644 (file)
index 74ded0f..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Godin (copelnug@gmail.com)  - Initial design and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
-
-/**
- * <h4>Base class for the statistics storage.</h4>
- * <p>
- * It allow to implement a tree structure while avoiding the need to run through
- * the tree each time you need to add a node at a given place.
- * </p>
- */
-public abstract class StatisticsData {
-    /**
-     * <h4>Define values that can be used like a C++ enumeration.</h4>
-     * <p>
-     * The values can be used with binary "or" and "and" to mix them.
-     * </p>
-     */
-    public static class Values {
-        /**
-         * <h4>Indicate the cpu time</h4>
-         * <p>
-         * The actual time the cpu as passed in this state making calculations.
-         * </p>
-         */
-        public static final int CPU_TIME = 1;
-        /**
-         * <h4>Indicate the cumulative cpu time</h4>
-         * <p>
-         * Include the time the cpu as passed in this state and substate.
-         * </p>
-         * <p>
-         * Example:
-         * <ul>
-         * <li>PID:1, Mode:USER_MODE</li>
-         * <ul>
-         * <li>PID:1, Mode:SYSCALL</li>
-         * </ul>
-         * <li>PID:2, Mode:USER_MODE</li>
-         * </ul>
-         * </p>
-         * <p>
-         * In this example, the cumulative cpu time for "PID:1, Mode:USER_MODE"
-         * would be equal to its cpu time plus the cpu time of
-         * "PID:1, Mode:SYSCALL".
-         * </p>
-         * TODO Validate values. Not tested in LTTv. TODO Validate description.
-         */
-        public static final int CUMULATIVE_CPU_TIME = 2;
-        /**
-         * <h4>Elapsed time</h4>
-         * <p>
-         * Description...
-         * </p>
-         * TODO Give a correct description.
-         */
-        public static final int ELAPSED_TIME = 4;
-        /**
-         * <h4>State cumulative cpu time</h4>
-         * <p>
-         * Description...
-         * </p>
-         * TODO Give a correct description.
-         */
-        public static final int STATE_CUMULATIVE_CPU_TIME = 8;
-    }
-
-    /**
-     * <h4>String builder used to merge string with more efficacy.</h4>
-     */
-    protected static final StringBuilder fBuilder = new StringBuilder();
-    /**
-     * <h4>Identification of the root.</h4>
-     */
-    public static final FixedArray ROOT = new FixedArray(-1);
-
-    /**
-     * <h4>Function to merge many string with more efficacy.</h4>
-     * 
-     * @param strings
-     *            Strings to merge.
-     * @return A new string containing all the strings.
-     */
-    protected synchronized static String mergeString(String... strings) {
-        fBuilder.setLength(0);
-        for (String s : strings)
-            fBuilder.append(s);
-        return fBuilder.toString();
-    }
-
-    /**
-     * <h4>Define what child a node can have.</h4>
-     * <p>
-     * The management and usage of this map is done by subclass.
-     * </p>
-     * <p>
-     * HashSet are always faster than TreeSet.
-     * </p>
-     */
-    private Map<Integer, Set<Integer>> fKeys;
-    /**
-     * <h4>The nodes in the tree.</f4>
-     */
-    private HashMap<FixedArray, StatisticsTreeNode> fNodes;
-
-    /**
-     * <h4>Constructor.</h4>
-     */
-    public StatisticsData() {
-        fNodes = new HashMap<FixedArray, StatisticsTreeNode>();
-        fKeys = new HashMap<Integer, Set<Integer>>();
-    }
-
-    /**
-     * <h4>Indicate the end of the traceset</4>
-     * <p>
-     * Can be used to trigger necessary calculations.
-     * </p>
-     * 
-     * @param event
-     *            Event receive (May have timestamp of 0).
-     * @param traceState
-     *            State of the trace at that moment.
-     */
-    public abstract void endTraceset(LttngEvent event, LttngTraceState traceState);
-
-    /**
-     * <h4>Get a node.</h4>
-     * 
-     * @param path
-     *            Path to the node.
-     * @return The node or null.
-     */
-    public StatisticsTreeNode get(final FixedArray path) {
-        return fNodes.get(path);
-    }
-
-    /**
-     * <h4>Put a node.</h4>
-     * 
-     * @param path
-     *            Path to the node.
-     * @param node
-     *            Node to put.
-     * @return node if replaced.
-     */
-    public StatisticsTreeNode put(final FixedArray path, StatisticsTreeNode node) {
-        return fNodes.put(path, node);
-    }
-
-    /**
-     * <h4>Get the children of a node.</h4>
-     * 
-     * @param path
-     *            Path to the node.
-     * @return Collection containing the children.
-     */
-    public abstract Collection<StatisticsTreeNode> getChildren(final FixedArray path);
-
-    /**
-     * <h4>Get the map of existing elements of path classified by parent.</h4>
-     * 
-     * @return The map.
-     */
-    protected Map<Integer, Set<Integer>> getKeys() {
-        return fKeys;
-    }
-
-    /**
-     * <h4>Get or create a node.</h4>
-     * 
-     * @param path
-     *            Path to the node.
-     * @return The node.
-     */
-    public StatisticsTreeNode getOrCreate(final FixedArray path) {
-        StatisticsTreeNode current = fNodes.get(path);
-        if (current == null) {
-            registerName(path);
-            current = new StatisticsTreeNode(path, this);
-            fNodes.put(path, current);
-        }
-        return current;
-    }
-
-    /**
-     * <h4>Get the parent of a node.</h4>
-     * 
-     * @param path
-     *            Path to the node.
-     * @return Parent node or null.
-     */
-    public StatisticsTreeNode getParent(final FixedArray path) {
-        if (path.size() == 1) {
-            if (path.equals(ROOT))
-                return null;
-            else
-                return get(ROOT);
-        }
-        // TODO Get or GetOrCreate?
-        return get(path.subArray(0, path.size() - 1));
-    }
-
-    /**
-     * <h4>Increase some values.</h4>
-     * <p>
-     * Values is an binary or operation on the desired values between
-     * {@link Values#CPU_TIME}, {@link Values#CUMULATIVE_CPU_TIME},
-     * {@link Values#ELAPSED_TIME} and {@link Values#STATE_CUMULATIVE_CPU_TIME}
-     * .
-     * 
-     * @param event
-     *            Current event.
-     * @param traceState
-     *            State of the trace at that moment.
-     * @param values
-     *            Values desired.
-     */
-    public abstract void increase(LttngEvent event, LttngTraceState traceState, int values);
-
-    /**
-     * <h4>Register an event.</h4>
-     * <p>
-     * This method must be implemented by subclass.
-     * </p>
-     * 
-     * @param event
-     *            Event to process.
-     * @param traceState
-     *            State of the trace at the moment of the event.
-     */
-    public abstract void registerEvent(LttngEvent event, LttngTraceState traceState);
-
-    /**
-     * <h4>Register that a new node was created.</h4>
-     * <p>
-     * Must make sure the {@link #getChildren(FixedArray)} on the parent node
-     * will return the newly created node.
-     * </p>
-     * 
-     * @param path
-     *            Path of the new node.
-     */
-    protected abstract void registerName(final FixedArray path);
-
-    /**
-     * <h4>Reset a node.</h4>
-     * <p>
-     * Work recursively.
-     * </p>
-     * 
-     * @param path
-     *            Path to the node.
-     */
-    public void reset(final FixedArray path) {
-        for (StatisticsTreeNode node : getChildren(path)) {
-            reset(node.getPath());
-            fNodes.remove(node.getPath());
-        }
-    }
-
-    /**
-     * Indicate that the process is finishing.
-     * 
-     * @param event
-     *            The event indicating the end of the process.
-     * @param traceState
-     *            State of the trace at that moment.
-     */
-    public abstract void process_exit(LttngEvent event, LttngTraceState traceState);
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeNode.java
deleted file mode 100644 (file)
index a286abf..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *   Francois Godin (copelnug@gmail.com)  - Re-design for new stats structure
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-import java.util.Collection;
-
-/**
- * <h4>A tree where nodes can be accessed efficiently using paths.</h4>
- * 
- * <p>It works like file systems. Each node is identified by a key. A path is an array ({@link FixedArray}) of String. The elements of the array represent the path from the root to this node.</p>
- */
-public class StatisticsTreeNode implements Comparable<StatisticsTreeNode> {
-       /**
-        * <h4>Value of the node.</h4>
-        */
-       private Statistics fValue;
-       /**
-        * <h4>Path of the node.</h4>
-        */
-       private FixedArray fPath;
-       /**
-        * <h4>Corresponding StatisticsData.</h4>
-        */
-       private StatisticsData fNodes;
-       /**
-     * <h4>Name of the node.</h4>
-     */
-       private String fName = ""; //$NON-NLS-1$
-       /**
-        * <h4>Constructor.</h4>
-        * @param path Path to the node.
-        * @param nodes Corresponding StatisticsData.
-        */
-       public StatisticsTreeNode(final FixedArray path, StatisticsData nodes) {
-               this(path, nodes, ""); //$NON-NLS-1$
-       }
-       
-       /**
-     * <h4>Constructor.</h4>
-     * @param path Path to the node.
-     * @param nodes Corresponding StatisticsData.
-     * @param name The name associated with this node.
-     */
-       public StatisticsTreeNode(final FixedArray path, StatisticsData nodes, String name) {
-               fPath = path;
-               fNodes = nodes;
-               fName = name;
-               fValue = new Statistics();
-           }
-
-       /**
-        * <h4>Test if a node contain the specified child.</h4>
-        * @param key Name of the child.
-        * @return true: if child with given key is present, false: if no child exists with given key name
-        */
-       public boolean containsChild(Integer key) {
-               if(StatisticsData.ROOT == fPath)
-                       return fNodes.get(new FixedArray(key)) != null;
-               return (fNodes.get(fPath.append(key)) != null);
-       }
-       /**
-        * <h4>Get the children of this node.</h4>
-        * @return Direct children of this node.
-        */
-       public Collection<StatisticsTreeNode> getChildren() {
-               return fNodes.getChildren(fPath);
-       }
-       /**
-        * <h4>Get the key for this node.</h4>
-        * @return Key associated with this node.
-        */
-       public Integer getKey() {
-               return fPath.get(fPath.size() - 1);
-       }
-       /**
-        * <h4>Get the number of children this node have.</h4>
-        * @return Number of direct children of this node.
-        */
-       public int getNbChildren() {
-               return fNodes.getChildren(fPath).size();
-       }
-       /**
-        * <h4>Return the parent node.</h4>
-        * @return Parent node.
-        */
-       public StatisticsTreeNode getParent() {
-               return fNodes.getParent(fPath);
-       }
-       /**
-        * <h4>Get the path of the node.</h4>
-        * @return The path of the node.
-        */
-       public FixedArray getPath() {
-               return fPath;
-       }
-       /**
-        * <h4>Get the value of this node.</h4>
-        * @return Value associated with this node.
-        */
-       public Statistics getValue() {
-               return fValue;
-       }
-       /**
-        * <h4>Indicate if the node have children.</h4>
-        * @return True if the node has children.
-        */
-       public boolean hasChildren() {
-               return !fNodes.getChildren(fPath).isEmpty();
-       }
-
-       /**
-        * <h4>Start from creation time i.e. keep key and parent but new statistics and no children.</h4>
-        */
-       public void reset() {
-               fValue = new Statistics();
-               fNodes.reset(fPath);
-       }
-
-       /**
-     * <h4>Set the name of this node.</h4>
-     */
-       public void setName (String name) {
-           fName = name;
-       }
-       /**
-     * <h4>Get the name of this node.</h4>
-     * @return Name associated with this node.
-     */
-       public String getName() {
-           return fName;
-       }
-
-       /**
-     * <h4>Returns node content as string (full path is not included).</h4>
-     * @return Node content as string.
-     */
-    public String getContent() {
-           return fName + ": [nbEvents=" + fValue.nbEvents +  //$NON-NLS-1$
-                           ", cpuTime=" + fValue.cpuTime + //$NON-NLS-1$
-                               ", cumulativeCpuTime=" + fValue.cumulativeCpuTime + //$NON-NLS-1$
-                               ", elapsedTime=" + fValue.elapsedTime + "]"; //$NON-NLS-1$ //$NON-NLS-2$ 
-       }
-
-    /**
-     * <h4>For sorting purposes (sorting by node name).</h4>
-     */
-    @Override
-    public int compareTo(StatisticsTreeNode o) {
-        return fName.compareTo(o.fName);
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeRootFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/StatisticsTreeRootFactory.java
deleted file mode 100644 (file)
index 2b4d003..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Yann N. Dauphin     (dhaemon@gmail.com)  - Implementation for stats
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.statistics.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class StatisticsTreeRootFactory {
-       
-       // -----------------------------------------------------------------------
-       // Data
-       // -----------------------------------------------------------------------
-
-       private static final Map<String, StatisticsData> fTreeInstances = new HashMap<String, StatisticsData>();
-       
-       // -----------------------------------------------------------------------
-       // Methods
-       // -----------------------------------------------------------------------
-
-       /**
-        * Provide a statisticsTree instance per trace
-        * 
-        * @return
-        */
-       public static StatisticsTreeNode getStatTreeRoot(String traceUniqueId) {
-               return getStatTree(traceUniqueId).getOrCreate(StatisticsData.ROOT);
-       }
-       public static StatisticsData getStatTree(String traceUniqueId) {
-               if(traceUniqueId == null)
-                       return null;
-               
-               StatisticsData tree = fTreeInstances.get(traceUniqueId);
-               if(tree == null) {
-                       tree = new KernelStatisticsData(traceUniqueId); // NOTE
-                       fTreeInstances.put(traceUniqueId, tree);
-               }
-               return tree;
-       }
-       /**
-        * @param traceUniqueId
-        * @return
-        */
-       public static boolean containsTreeRoot(String traceUniqueId) {
-               return fTreeInstances.containsKey(traceUniqueId);
-       }
-
-       /**
-        * Remove previously registered statistics tree.
-        * @param traceUniqueId
-        */
-       public static void removeStatTreeRoot(String traceUniqueId) {
-               if (traceUniqueId != null && fTreeInstances.containsKey(traceUniqueId)) {
-                       fTreeInstances.remove(traceUniqueId);
-               }
-       }
-
-       /**
-        * Remove all tree and root instances
-        */
-       public static void removeAll() {
-               fTreeInstances.clear();
-       }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/messages.properties
deleted file mode 100644 (file)
index 7e88de5..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-KernelStatisticsData_CPUs=CPUs
-KernelStatisticsData_EventTypes=Event Types
-KernelStatisticsData_Functions=Functions
-KernelStatisticsData_Modes=Modes
-KernelStatisticsData_Processes=Processes
-KernelStatisticsData_SubModes=Submodes
-StatisticsData_UnknowProcess=Unknown process
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/Messages.java
deleted file mode 100644 (file)
index 8535011..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.linuxtools.lttng.ui.views.timeframe;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.timeframe.messages"; //$NON-NLS-1$
-    public static String TimeFrameView_CurrentTime;
-    public static String TimeFrameView_WindowEndTime;
-    public static String TimeFrameView_WindowRange;
-    public static String TimeFrameView_WindowStartTime;
-    static {
-       // initialize resource bundle
-       NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java
deleted file mode 100644 (file)
index 2d24800..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.timeframe;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-
-// ========================================================================
-// SpinnerGroup
-// ========================================================================
-
-/**
- * <b><u>SpinnerGroup</u></b>
- * <p>
- * A SpinnerGroup holds two coordinated spinners (for seconds and
- * nanoseconds) representing the current time within the trace.
- * <p>
- * The current time can take any value anything within the time range (start
- * and end time).
- */
-public class SpinnerGroup {
-
-    // The nanosecond scale (10^9)
-    private static final int  NS_PER_SECOND = 1000 * 1000 * 1000;
-    private static final byte NS_SCALING_FACTOR = -9;
-
-    // Labels
-    private static final String SECONDS_LABEL = "sec"; //$NON-NLS-1$
-    private static final String NANOSEC_LABEL = "ns"; //$NON-NLS-1$
-
-    // Widgets
-    private Group group;
-    private Spinner seconds;
-    private Spinner nanosec;
-
-    // The valid time range - start time
-    private ITmfTimestamp startTime;
-    private int startSeconds;
-    private int startNanosec;
-
-    // The valid time range - end time
-    private ITmfTimestamp endTime;
-    private int endSeconds;
-    private int endNanosec;
-
-    // The current time value
-    private ITmfTimestamp currentTime;
-    private int currentSeconds;
-    private int currentNanosec;
-    
-    /**
-     * <b><u>Constructor</u></b>
-     * <p>
-     * <li>Creates the display group and formats it for the grid cell
-     * <li>Sets the initial values for Start/End/Current time
-     * </li>
-     * <p>
-     * @param parent    - the parent Composite
-     * @param groupName - the group name
-     * @param range     - the valid time range (start/end time)
-     * @param current   - the current time
-     */
-    public SpinnerGroup(TimeFrameView owner, Composite parent, String groupName, TmfTimeRange range, ITmfTimestamp current) {
-
-        // Create the group
-        group = new Group(parent, SWT.BORDER);
-        group.setText(groupName);
-
-        // Make it use the whole grid cell
-        GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
-        gridData.horizontalAlignment = SWT.FILL;
-        group.setLayoutData(gridData);
-
-        // Create and position the widgets
-        seconds = new Spinner(group, SWT.BORDER);
-        seconds.addModifyListener(new ModifyListener() {
-            @Override
-                       public void modifyText(ModifyEvent e) {
-                currentSeconds = seconds.getSelection();
-                refreshCurrentTime();
-            }
-        });
-        seconds.setBounds(5, 25, 110, 25);
-
-        Label label = new Label(group, SWT.LEFT);
-        label.setText(SECONDS_LABEL);
-        label.setBounds(120, 28, 25, 22);
-
-        nanosec = new Spinner(group, SWT.BORDER);
-        nanosec.addModifyListener(new ModifyListener() {
-            @Override
-                       public void modifyText(ModifyEvent e) {
-                currentNanosec = nanosec.getSelection();
-                // Correct for nanosec underflow
-                if (currentNanosec < 0) {
-                    currentSeconds--;
-                    currentNanosec = NS_PER_SECOND - 1;
-                }
-                // Correct for nanosec overflow
-                if (currentNanosec >= NS_PER_SECOND) {
-                    currentSeconds++;
-                    currentNanosec = 0;
-                }
-                refreshCurrentTime();
-            }
-        });
-        nanosec.setBounds(150, 25, 110, 25);
-
-        label = new Label(group, SWT.LEFT);
-        label.setText(NANOSEC_LABEL);
-        label.setBounds(265, 28, 25, 22);
-
-        setContent(range, current);
-    }
-
-    private void refreshCurrentTime() {
-        long newCurrentTime = ((long) currentSeconds) * NS_PER_SECOND + currentNanosec;
-        TmfTimestamp ts = new TmfTimestamp(newCurrentTime, NS_SCALING_FACTOR, 0);
-        currentTime = ts;
-//        fOwner.synchTimeFrameWidgets(this);
-    }
-
-    // ====================================================================
-    // Get/Set
-    // ====================================================================
-
-    public ITmfTimestamp getStartTime() {
-        return startTime;
-    }
-
-    public ITmfTimestamp getEndTime() {
-        return endTime;
-    }
-
-    public ITmfTimestamp getCurrentTime() {
-        return currentTime;
-    }
-
-    public TmfTimestamp getSpan() {
-        TmfTimestamp span = (TmfTimestamp) startTime.getDelta(endTime);
-        return span;
-    }
-
-    public TmfTimeRange getTimeRange() {
-        TmfTimeRange range = new TmfTimeRange(startTime, endTime);
-        return range;
-    }
-
-    public void setStartTime(ITmfTimestamp ts) {
-       try {
-               startTime = (TmfTimestamp) ts.getDelta(new TmfTimestamp(0, NS_SCALING_FACTOR));
-               startSeconds = (int) (startTime.getValue() / NS_PER_SECOND);
-               startNanosec = (int) (startTime.getValue() % NS_PER_SECOND);
-       }
-       catch (ArithmeticException e) {
-       }
-    }
-
-    public void setEndTime(ITmfTimestamp ts) {
-       try {
-           endTime = (TmfTimestamp) ts.getDelta(new TmfTimestamp(0, NS_SCALING_FACTOR));
-               endSeconds = (int) (endTime.getValue() / NS_PER_SECOND);
-               endNanosec = (int) (endTime.getValue() % NS_PER_SECOND);
-       }
-       catch (ArithmeticException e) {
-       }
-    }
-
-    public void setCurrentTime(ITmfTimestamp ts) {
-       try {
-           currentTime = (TmfTimestamp) ts.getDelta(new TmfTimestamp(0, NS_SCALING_FACTOR));
-               currentSeconds = (int) (currentTime.getValue() / NS_PER_SECOND);
-               currentNanosec = (int) (currentTime.getValue() % NS_PER_SECOND);
-       }
-       catch (ArithmeticException e) {
-       }
-    }
-
-    // ====================================================================
-    // Operators
-    // ====================================================================
-
-    /**
-     * <b><u>setContent</u></b>
-     * <p>
-     * <li>validates that [startTime <= currentTime <= endTime] is respected
-     * <li>sets the start/current/end time and update the spinners
-     * </li>
-     * <p>
-     * 
-     * @param range
-     * @param current
-     */
-    public void setContent(TmfTimeRange range, ITmfTimestamp current) {
-
-       if (range != null) {
-               // Extract the time range
-            ITmfTimestamp start = range.getStartTime();
-            ITmfTimestamp end   = range.getEndTime();
-
-            // Assume start time is OK
-            setStartTime(start);
-
-            // Make sure end time >= start time
-            if (end.compareTo(start, false) < 0) {
-                end = start;
-            }
-            setEndTime(end);
-
-            // Make sure [start time <= current time <= end time]
-            // If not: current = min(max(start, current), end);
-            if (current.compareTo(start, false) < 0) {
-                current = start;
-            }
-            if (current.compareTo(end, false) > 0) {
-                current = end;
-            }
-       }
-        setCurrentTime(current);
-
-        // And configure the spinners
-        updateSpinners();
-    }
-
-    /**
-     * <b><u>setValue</u></b>
-     * <p>
-     * <li>validates that [startTime <= currentTime <= endTime] is respected
-     * <li>sets the current time and the spinners
-     * </li>
-     * <p>
-     * 
-     * @param range
-     * @param current
-     */
-    public void setValue(ITmfTimestamp current) {
-
-        // Make sure [start time <= current time <= end time]
-        // If not: current = min(max(start, current), end);
-        if (current.compareTo(startTime, false) < 0) {
-            current = startTime;
-        }
-        if (current.compareTo(endTime, false) > 0) {
-            current = endTime;
-        }
-        setCurrentTime(current);
-
-        // And configure the spinners
-        updateSpinners();
-    }
-
-    /**
-     * Update the spinners with the new current time value
-     * Perform the update on the UI thread
-     */
-    public void updateSpinners() {
-       // Ignore update if disposed
-       if (seconds.isDisposed()) return;
-       
-        seconds.getDisplay().asyncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               if (!seconds.isDisposed() && !nanosec.isDisposed()) {
-                           // If we are on the start second, ensure that [currentNS >= startNS]
-                           // If the currentSeconds > startSeconds, set startns to -1 so we can
-                           // "underflow"
-                           int startns = -1;
-                           if (currentSeconds <= startSeconds) {
-                               currentSeconds = startSeconds;
-                               startns = startNanosec;
-                               if (currentNanosec < startns) {
-                                   currentNanosec = startns;
-                               }
-                           }
-
-                           // If we are on the end second, ensure that [currentNS <= endNS]
-                           // If the currentSeconds < endSeconds, set endns to MAX so we can
-                           // "overflow"
-                           int endns = NS_PER_SECOND;
-                           if (currentSeconds >= endSeconds) {
-                               currentSeconds = endSeconds;
-                               endns = endNanosec;
-                               if (currentNanosec > endns) {
-                                   currentNanosec = endns;
-                               }
-                           }
-
-                           // Refresh the spinners (value, range, increments, ...)
-                                       // To ensure that the spinners are properly set, the range has to be > 0 
-//                                     seconds.setValues(currentSeconds, startSeconds - 1, endSeconds + 1, 0, 1, 10);
-//                                     nanosec.setValues(currentNanosec, startns - 1, endns + 1, 0, 1, 1000000);
-                                       seconds.setValues(currentSeconds, startSeconds, endSeconds, 0, 1, 10);
-                                       nanosec.setValues(currentNanosec, startns, endns, 0, 100000, 10000000);
-
-                           // If start == end (i.e. no range), disable the spinner
-                           // (if start == end, the spinner widget range is set to [0..100] by default)
-                           seconds.setEnabled(startSeconds != endSeconds);
-                           nanosec.setEnabled(startns != endns);
-                               }
-                       }
-        });
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java
deleted file mode 100644 (file)
index 35b6d32..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 2010 Ericsson
- * 
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.timeframe;
-
-import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment;
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal;
-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.views.TmfView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Slider;
-
-/**
- * <b><u>TimeFrameView</u></b>
- * <p>
- * The TimeFrameView provides a set of spinners to monitor and set the start time, end time, the current time interval
- * and current time of the trace set at the nanosecond level.
- * <p>
- * It ensures that the following relations are always true:
- * <p>
- * <li>[ startTime >= start time of the trace ]
- * <li>[ endTime <= end time of the trace ]
- * <li>[ startTime <= currentTime <= endTime ]
- * <li>[ interval == (endTime - startTime) ]</li>
- * <p>
- * It provides a slider to rapidly set the current time within the time range (i.e. between startTime and endTime).
- * <p>
- * Finally, it allows modification of the time range and the current time. This triggers notifications to the other
- * LTTng views.
- * <p>
- * FIXME: The slider is very jumpy due to the large number of async updates FIXME: Revisit the control flow between
- * View, Spinners and Slider
- */
-@Deprecated
-public class TimeFrameView extends TmfView {
-
-    public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.timeframe"; //$NON-NLS-1$
-
-    // ------------------------------------------------------------------------
-    // TimeFrameView
-    // ------------------------------------------------------------------------
-
-    // The event log timestamp characteristics
-    private ITmfTimestamp fTraceStartTime = new TmfTimestamp();
-    private ITmfTimestamp fTraceEndTime = new TmfTimestamp();
-
-    private ITmfTimestamp fCurrentTime = new TmfTimestamp();
-
-    private TmfTimeRange fTraceTimeRange = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
-    private TmfTimeRange fTraceSpan = new TmfTimeRange(fTraceStartTime, fTraceEndTime);
-    private int fScale = 0;
-
-    // Labels
-    private static final String START_TIME_LABEL = Messages.TimeFrameView_WindowStartTime;
-    private static final String END_TIME_LABEL = Messages.TimeFrameView_WindowEndTime;
-    private static final String TIME_RANGE_LABEL = Messages.TimeFrameView_WindowRange;
-    private static final String CURRENT_TIME_LABEL = Messages.TimeFrameView_CurrentTime;
-
-    private static final int SLIDER_RANGE = 10000;
-
-    private SpinnerGroup fStartGroup;
-    private SpinnerGroup fEndGroup;
-    private SpinnerGroup fRangeGroup;
-    private SpinnerGroup fCurrentGroup;
-
-    // The slider
-    private Slider fSlider;
-
-    // The current experiment
-    TmfExperiment<LttngEvent> fExperiment = null;
-
-    // notify external listeners may not be needed if the update originated externally
-    private boolean fupdateExternalListeners = true;
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     */
-    public TimeFrameView() {
-        super("TimeFrameView"); //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets .Composite)
-     */
-    @Override
-    public void createPartControl(Composite parent) {
-
-        // Set the view layout
-        GridLayout layout = new GridLayout(4, true);
-        parent.setLayout(layout);
-
-        fStartGroup = new SpinnerGroup(this, parent, START_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
-        fEndGroup = new SpinnerGroup(this, parent, END_TIME_LABEL, fTraceTimeRange, fTraceEndTime);
-        fRangeGroup = new SpinnerGroup(this, parent, TIME_RANGE_LABEL, fTraceTimeRange, fTraceEndTime);
-        fCurrentGroup = new SpinnerGroup(this, parent, CURRENT_TIME_LABEL, fTraceTimeRange, fTraceStartTime);
-
-        // Create the slider
-        createSlider(parent);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
-     */
-    @Override
-    public void setFocus() {
-        // TODO Auto-generated method stub
-    }
-
-    // ------------------------------------------------------------------------
-    // Operators
-    // ------------------------------------------------------------------------
-
-    /**
-     * One of the spinners has been updated. Synchronize the other widgets.
-     */
-    public void synchTimeFrameWidgets(SpinnerGroup trigger) {
-        boolean trangeUpdated = false;
-
-        // Collect the data
-        ITmfTimestamp startTime = fStartGroup.getCurrentTime();
-        ITmfTimestamp endTime = fEndGroup.getCurrentTime();
-        ITmfTimestamp timeRange = fRangeGroup.getCurrentTime();
-        ITmfTimestamp currentTime = fCurrentGroup.getCurrentTime();
-
-        // If startTime was set beyond endTime, adjust endTime and interval
-        if (trigger == fStartGroup) {
-            if (startTime.compareTo(endTime, false) > 0) {
-                endTime = startTime;
-                trangeUpdated = true;
-            }
-        }
-
-        // If endTime was set beyond startTime, adjust startTime and interval
-        if (trigger == fEndGroup) {
-            if (endTime.compareTo(startTime, false) < 0) {
-                startTime = endTime;
-                trangeUpdated = true;
-            }
-        }
-
-        // If timeRange was set, adjust endTime
-        if (trigger == fRangeGroup) {
-            long start = startTime.getValue();
-            long span = timeRange.getValue();
-            ITmfTimestamp ts = new TmfTimestamp(start + span, startTime.getScale(), 0);
-            if (ts.compareTo(fTraceEndTime, false) > 0) {
-                ts = fTraceEndTime.clone();
-            }
-            endTime = ts;
-            trangeUpdated = true;
-        }
-
-        // Compute the new time range
-        TmfTimeRange subrange = new TmfTimeRange(startTime, endTime);
-//        int scale = startTime.getScale();
-        ITmfTimestamp interval = (TmfTimestamp) startTime.getDelta(endTime);
-
-        // Update the spinner groups
-        fStartGroup.setContent(fTraceTimeRange, startTime);
-        fEndGroup.setContent(fTraceTimeRange, endTime);
-        fRangeGroup.setContent(fTraceSpan, interval);
-        fCurrentGroup.setContent(subrange, currentTime);
-
-        updateSlider(subrange, currentTime);
-        // Notify other views, only if the update originated from this view
-        if (fupdateExternalListeners) {
-            if (!fCurrentTime.equals(currentTime)) {
-                fCurrentTime = currentTime;
-                broadcast(new TmfTimeSynchSignal(this, currentTime));
-            }
-
-            // Notify the views if the time range has been impacted
-            if (trangeUpdated) {
-                TmfTimeRange trange = new TmfTimeRange(startTime, endTime);
-                broadcast(new TmfRangeSynchSignal(this, trange, currentTime));
-            }
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Slider Handling
-    // ------------------------------------------------------------------------
-
-    /**
-     * @param parent
-     */
-    private void createSlider(Composite parent) {
-        fSlider = new Slider(parent, SWT.SMOOTH | SWT.FILL);
-        fSlider.setMinimum(0);
-        fSlider.setMaximum(SLIDER_RANGE + fSlider.getThumb());
-        fSlider.setIncrement(SLIDER_RANGE / 100);
-        fSlider.setPageIncrement(SLIDER_RANGE / 10);
-        fSlider.setSelection(0);
-
-        GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
-        gridData.horizontalAlignment = SWT.FILL;
-        gridData.horizontalSpan = 4;
-        fSlider.setLayoutData(gridData);
-
-        fSlider.addListener(SWT.Selection, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                int ratio = fSlider.getSelection();
-                ITmfTimestamp span = fCurrentGroup.getSpan();
-                long value = span.getValue() * ratio / SLIDER_RANGE;
-                ITmfTimestamp start = fCurrentGroup.getStartTime();
-                ITmfTimestamp current = new TmfTimestamp(start.getValue() + value, start.getScale(), 0);
-                fCurrentGroup.setValue(current);
-            }
-        });
-
-    }
-
-    /**
-     * @param range
-     * @param timestamp
-     */
-    private void updateSlider(TmfTimeRange range, ITmfTimestamp timestamp) {
-
-        // Ignore update if disposed
-        if (fSlider.isDisposed())
-            return;
-
-        // Determine the new relative position
-//        int scale = range.getEndTime().getScale();
-        long total = range.getStartTime().getDelta(range.getEndTime()).getValue();
-        long relative = range.getStartTime().getDelta(timestamp).getValue();
-
-        // Set the slider value
-        final long position = (total > 0) ? (relative * SLIDER_RANGE / total) : 0;
-
-        // Update the slider on the UI thread
-        long current = fSlider.getSelection();
-        if (position != current) {
-            fSlider.getDisplay().asyncExec(new Runnable() {
-                @Override
-                public void run() {
-                    fSlider.setSelection((int) position);
-                }
-            });
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    @SuppressWarnings("nls")
-    public String toString() {
-        return "[TimeFrameView]";
-    }
-
-    // ------------------------------------------------------------------------
-    // Signal Handling
-    // ------------------------------------------------------------------------
-
-    /**
-     * @param signal
-     */
-    @SuppressWarnings("unchecked")
-    @TmfSignalHandler
-    public void experimentSelected(TmfExperimentSelectedSignal<LttngEvent> signal) {
-
-        // Update the trace reference
-        fExperiment = (TmfExperiment<LttngEvent>) signal.getExperiment();
-
-        // Update the time frame
-        fTraceTimeRange = fExperiment.getTimeRange();
-        fTraceStartTime = fTraceTimeRange.getStartTime();
-        fTraceEndTime = fTraceTimeRange.getEndTime();
-        fScale = fTraceStartTime.getScale();
-
-        // Update the widgets
-        fStartGroup.setContent(fTraceTimeRange, fTraceStartTime);
-        fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
-        fCurrentGroup.setContent(fTraceTimeRange, fTraceStartTime);
-
-        fCurrentTime = fTraceStartTime;
-
-        ITmfTimestamp delta = fTraceStartTime.getDelta(fTraceEndTime);
-        fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
-        // fRangeGroup.setContent(fTraceSpan, delta);
-        ITmfTimestamp start = new TmfTimestamp(1, (byte) -1, 0);
-        fRangeGroup.setContent(fTraceSpan, start);
-    }
-
-    /**
-     * @param signal
-     */
-    @TmfSignalHandler
-    public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
-        if (signal.getExperiment() != fExperiment) {
-            return;
-        }
-
-        // Update the time frame
-        // fTraceTimeRange = signal.getTrace().getTimeRange();
-        fTraceTimeRange = signal.getExperiment().getTimeRange();
-        fTraceStartTime = fTraceTimeRange.getStartTime();
-        fTraceEndTime = fTraceTimeRange.getEndTime();
-        fScale = fTraceStartTime.getScale();
-
-        // Update the widgets
-        fStartGroup.setContent(fTraceTimeRange, fStartGroup.getCurrentTime());
-        fEndGroup.setContent(fTraceTimeRange, fTraceEndTime);
-        fCurrentGroup.setContent(fTraceTimeRange, fCurrentGroup.getCurrentTime());
-
-        ITmfTimestamp delta = fTraceStartTime.getDelta(fTraceEndTime);
-        fTraceSpan = new TmfTimeRange(new TmfTimestamp(0, fScale, 0), delta);
-        fRangeGroup.setContent(fTraceSpan, delta);
-    }
-
-    /**
-     * @param signal
-     */
-    @TmfSignalHandler
-    public void currentTimeRangeUpdated(TmfRangeSynchSignal signal) {
-        if (signal.getSource() != this) {
-            // Update the time frame
-            TmfTimeRange selTimeRange = signal.getCurrentRange();
-            ITmfTimestamp selStart = selTimeRange.getStartTime().normalize(0, fScale);
-            ITmfTimestamp selEnd   = selTimeRange.getEndTime().normalize(0, fScale);
-
-            fupdateExternalListeners = false;
-            // Update the widgets and prevent broadcast notifications to
-            // the views which have been notified already.
-            {
-                fStartGroup.setContent(fTraceTimeRange, selStart);
-                fEndGroup.setContent(fTraceTimeRange, selEnd);
-
-                ITmfTimestamp delta = selStart.getDelta(selEnd);
-
-                fRangeGroup.setContent(fTraceSpan, delta);
-            }
-
-            // restore the external notification flag
-            fupdateExternalListeners = true;
-
-        }
-    }
-
-    /**
-     * @param signal
-     */
-    @TmfSignalHandler
-    public void currentTimeUpdated(TmfTimeSynchSignal signal) {
-        if (signal.getSource() != this) {
-            // prevent loop to external notifications
-            fupdateExternalListeners = false;
-            fCurrentTime = signal.getCurrentTime().normalize(0, fStartGroup.getCurrentTime().getScale());
-            if (fStartGroup.getCurrentTime().compareTo(fCurrentTime, false) > 0) {
-                fStartGroup.setContent(new TmfTimeRange(fCurrentTime, fEndGroup.getCurrentTime()), fCurrentTime);
-            }
-            if (fEndGroup.getCurrentTime().compareTo(fCurrentTime, false) < 0) {
-                fEndGroup.setContent(new TmfTimeRange(fStartGroup.getCurrentTime(), fCurrentTime), fCurrentTime);
-            }
-            fCurrentGroup.setContent(null, fCurrentTime);
-            updateSlider(fCurrentGroup.getTimeRange(), fCurrentTime);
-
-            // Enable external notifications
-            fupdateExternalListeners = true;
-        }
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/messages.properties
deleted file mode 100644 (file)
index c070425..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-TimeFrameView_CurrentTime=Current Time
-TimeFrameView_WindowEndTime=Window End Time
-TimeFrameView_WindowRange=Window Range
-TimeFrameView_WindowStartTime=Window Start Time
This page took 1.021454 seconds and 5 git commands to generate.