Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-04-25 14:05:37 +0000
committerAlexander Kurtakov2014-04-26 05:35:49 +0000
commit9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10 (patch)
tree6460ae9326e2948a1c746798febd00f82321f638 /systemtap
parentfe48cecc1b6ba671cf0a70014e760413dae4cce9 (diff)
downloadorg.eclipse.linuxtools-9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10.tar.gz
org.eclipse.linuxtools-9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10.tar.xz
org.eclipse.linuxtools-9f5e0ed5dfda7ac2bf14f4b59228135bdbcb6a10.zip
Change tabs to spaces; elim trailing whitespace.
To comply with Sonar style requirements, replace all tab characters with four whitespace characters/spaces, and remove all trailing whitespace. Perform this change to all Java and XML files. Also replace tabs with "\t" in test strings that require tabs, and edit STPIndenterTest so that it doesn't rely on indented comments. Change-Id: I48c3c5449a58fe5310967d998a05df1a28fbcbb0 Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/25561 Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'systemtap')
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph-feature/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/plugin.xml6
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/CallgraphCorePlugin.java144
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/DocWriter.java88
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/FileFinderOpener.java100
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Helper.java106
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/LaunchConfigurationConstants.java148
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Messages.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/PluginConstants.java94
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/StapUIJob.java74
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapCommandGenerator.java156
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapErrorHandler.java64
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapParser.java610
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextParser.java72
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextView.java410
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapUIErrorMessages.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapView.java72
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/ViewFactory.java124
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/XMLParser.java328
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.docs/build-doc.xml84
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.docs/toc-doc.xml4
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.docs/toc.xml36
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml14
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml8
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml8
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml4
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AbstractStapTest.java62
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AllTests.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/ConfigurationTest.java164
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/LaunchShortcutsTest.java68
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandGeneratorTest.java76
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandTest.java46
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapErrorHandlerTest.java94
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapTabTest.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/plugin.xml14
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ConfigurationOptionsSetter.java254
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java344
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java474
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ListTreeContentProvider.java252
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/Messages.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/RuledTreeSelectionDialog.java88
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationDelegate.java764
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationTabGroup.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java1456
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapOptionsTab.java1786
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/TranslationUnitVisitor.java32
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.tests/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/Activator.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/MouseListenerTest.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/StapGraphParserTest.java208
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphTest.java164
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphViewTest.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/plugin.xml4
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/AggregateLayoutAlgorithm.java92
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallGraphConstants.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallgraphView.java1894
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/Messages.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapData.java246
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapGraphParser.java1038
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapNode.java142
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/AutoScrollHelper.java78
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/AutoScrollSelectionListener.java34
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/Messages.java20
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/Projectionist.java120
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/StapGraphFocusListener.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/StapGraphKeyListener.java58
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/StapGraphMouseExitListener.java20
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/StapGraphMouseListener.java446
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/StapGraphMouseMoveListener.java110
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/graphlisteners/StapGraphMouseWheelListener.java98
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/treeviewer/StapTreeContentProvider.java88
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/treeviewer/StapTreeDoubleClickListener.java54
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/treeviewer/StapTreeLabelProvider.java36
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/treeviewer/StapTreeListener.java80
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap-feature/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/AllTests.java42
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/MockDataSet.java106
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/aggregates/AverageAggregateTest.java74
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/aggregates/CountAggregateTest.java74
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/aggregates/MaxAggregateTest.java72
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/aggregates/MinAggregateTest.java74
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/aggregates/SumAggregateTest.java76
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/row/FilteredRowDataSetTest.java516
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/row/RowDataSetTest.java284
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/row/RowEntryTest.java200
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/row/RowParserTest.java42
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/table/FilteredTableDataSetTest.java500
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/table/TableDataSetTest.java296
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/table/TableEntryTest.java216
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/datasets/table/TableParserTest.java42
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/filters/MatchFilterTest.java70
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/filters/RangeFilterTest.java354
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/filters/SortFilterTest.java122
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/filters/UniqueFilterTest.java90
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/structures/ChartStreamDaemonTest.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/structures/NumberTypeTest.java84
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core.tests/src/org/eclipse/linuxtools/systemtap/graphing/core/tests/structures/UpdateManagerTest.java76
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/internal/systemtap/graphing/core/GraphingCorePlugin.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/internal/systemtap/graphing/core/Localization.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/IGraphColorConstants.java528
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/adapters/BlockAdapter.java156
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/adapters/IAdapter.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/adapters/ScrollAdapter.java166
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/aggregates/AverageAggregate.java58
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/aggregates/CountAggregate.java56
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/aggregates/IDataAggregate.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/aggregates/MaxAggregate.java60
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/aggregates/MinAggregate.java60
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/aggregates/SumAggregate.java56
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/IBlockDataSet.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/IDataEntry.java20
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/IDataSet.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/IDataSetParser.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/IFilteredDataSet.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/IHistoricalDataSet.java12
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/row/FilteredRowDataSet.java290
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/row/LineParser.java60
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/row/RowDataSet.java354
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/row/RowEntry.java150
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/row/RowParser.java80
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/table/FilteredTableDataSet.java310
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/table/TableDataSet.java406
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/table/TableEntry.java198
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/table/TableParser.java122
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/filters/IDataSetFilter.java20
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/filters/MatchFilter.java106
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/filters/RangeFilter.java250
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/filters/SortFilter.java140
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/filters/UniqueFilter.java190
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/structures/ChartStreamDaemon.java76
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/structures/GraphData.java104
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/structures/NumberType.java168
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/plugin.xml110
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/GraphingUIPlugin.java74
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/Localization.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithAxisBuilder.java458
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithoutAxisBuilder.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AreaChartBuilder.java16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/BarChart.java310
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/BarChartBuilder.java242
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/LineChartBuilder.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/Messages.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/PieChartBuilder.java170
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/ScatterChartBuilder.java18
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/BarChartMouseMoveListener.java50
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ChartMouseMoveListener.java92
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ChartWithAxisMouseMoveListener.java64
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/PieChartMouseMoveListener.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ToolTipChartMouseMoveListener.java52
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/handlers/SaveGraphImageHandler.java66
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/preferences/DataTablePreferencePage.java54
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/preferences/GraphPreferencePage.java66
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/preferences/GraphingPreferenceConstants.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/preferences/GraphingPreferencePage.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/preferences/PreferenceInitializer.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/views/Messages.java18
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/wizards/filter/AggregateFactory.java116
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/wizards/filter/MatchFilterWizardPage.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/wizards/filter/RangeFilterWizardPage.java6
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/wizards/filter/SortFilterWizardPage.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/wizards/filter/UniqueFilterWizardPage.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/GraphDisplaySet.java460
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/AbstractChartBuilder.java696
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/datadisplay/DataGrid.java652
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/views/GraphSelectorEditor.java396
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/views/GraphSelectorEditorInput.java68
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/ExceptionErrorDialog.java16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/GraphComposite.java186
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/GraphContinuousXControl.java220
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/GraphContinuousYControl.java220
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/GraphDiscreteXControl.java270
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/Messages.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/wizards/dataset/DataSetFactory.java50
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/wizards/graph/GraphFactory.java306
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/wizards/graph/SelectGraphAndSeriesWizard.java102
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/wizards/graph/SelectGraphAndSeriesWizardPage.java810
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/AllTests.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/CCodeFileFilterTest.java42
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/CopierTest.java46
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/IndexedObjectTest.java46
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/KernelSourceTreeTest.java76
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/LoggingStreamDaemonTest.java68
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/SortTest.java92
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/StringFormatterTest.java94
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/TreeDefinitionNodeTest.java94
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/TreeNodeTest.java434
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/runnable/CommandTest.java180
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/tests/runnable/StreamGobblerTest.java86
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/internal/systemtap/structures/Localization.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/internal/systemtap/structures/StructuresPlugin.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/CCodeFileFilter.java68
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/Copier.java64
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/IFormattingStyles.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/IndexedObject.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/KernelSourceTree.java192
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/LoggingStreamDaemon.java202
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/Sort.java100
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/StringFormatter.java84
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/TreeDefinitionNode.java32
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/TreeNode.java254
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java140
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/listeners/IGobblerListener.java10
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/listeners/ITabListener.java6
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/listeners/IUpdateListener.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/process/SystemTapRuntimeProcessFactory.java64
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/process/SystemtapProcessFactory.java130
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/runnable/Command.java606
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/runnable/Messages.java16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/runnable/StreamGobbler.java254
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/runnable/StringStreamGobbler.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog.tests/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog.tests/src/org/eclipse/linuxtools/systemtap/ui/consolelog/test/AllTests.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog.tests/src/org/eclipse/linuxtools/systemtap/ui/consolelog/test/structures/ConsoleStreamDaemonTest.java70
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog.tests/src/org/eclipse/linuxtools/systemtap/ui/consolelog/test/structures/ErrorStreamDaemonTest.java72
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog.tests/src/org/eclipse/linuxtools/systemtap/ui/consolelog/test/structures/ScriptConsoleTest.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/plugin.xml40
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/internal/systemtap/ui/consolelog/actions/CloseStapConsoleAction.java46
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/internal/systemtap/ui/consolelog/actions/ConsoleAction.java20
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/internal/systemtap/ui/consolelog/actions/SaveLogAction.java72
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/internal/systemtap/ui/consolelog/actions/StopScriptAction.java64
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/internal/systemtap/ui/consolelog/preferences/Messages.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/internal/systemtap/ui/consolelog/structures/Messages.java18
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/Messages.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/ScpClient.java178
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/ScpExec.java146
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/ScriptConsolePageParticipant.java132
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/dialogs/Messages.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/dialogs/SelectServerDialog.java230
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/internal/ConsoleLogPlugin.java60
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/internal/Localization.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/preferences/ConsoleLogPreferenceConstants.java18
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/preferences/ConsoleLogPreferencePage.java44
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/preferences/PreferenceInitializer.java32
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ConsoleStreamDaemon.java98
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ErrorStreamDaemon.java102
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ErrorTableDisplay.java276
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/IErrorParser.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/RemoteScriptOptions.java80
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java990
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/views/ErrorView.java114
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.doc/build-helper.xml84
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.doc/toc-doc.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.doc/toc.xml168
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/plugin.xml74
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/EditorPlugin.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/Localization.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/ColorManager.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/DoubleClickStrategy.java254
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java100
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleDocumentProvider.java312
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/SimpleEditor.java348
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/NewFileAction.java16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java242
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/AllTests.java6
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/ConditionalExpressionValidatorTest.java32
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/DirectoryValidatorTest.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/AbstractAutoEditTest.java410
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java448
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPFormattingTest.java758
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPIndenterTest.java548
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPToggleCommentTest.java334
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/structures/StapErrorParserTest.java70
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/structures/TreeSettingsTest.java200
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java2768
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/CommentRemover.java168
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDECloseMonitor.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPerspective.java54
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java154
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDESessionSettings.java288
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/Localization.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/StringOutputStream.java18
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/BrowserViewAction.java92
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ExportDataSetHandler.java54
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/FunctionBrowserAction.java62
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java86
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java20
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IndentHandler.java898
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/KernelSourceAction.java100
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/Messages.java36
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ProbeAliasAction.java110
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptChartHandler.java68
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptHandler.java940
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ToggleCommentHandler.java538
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/TreeExpandCollapseAction.java110
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/CodeFormatterUtil.java12
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/DocumentCharacterIterator.java422
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/IndentUtil.java594
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/Messages.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPAutoEditStrategy.java2084
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPColorConstants.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPCompletionProcessor.java912
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPConfiguration.java222
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPDefaultCodeFormatterConstants.java792
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPDocumentProvider.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java172
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPElementScanner.java156
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPHeuristicScanner.java2070
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPIndenter.java4588
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPMetadataSingleton.java202
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitionScanner.java130
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitioner.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPProbeScanner.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPReconcilingStrategy.java320
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPSymbols.java118
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/AddStapProbeHandler.java192
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionHandler.java94
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/DefinitionMenuTester.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/Messages.java22
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/Messages.java188
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java3134
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunch.java160
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationDelegate.java264
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java586
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTabGroup.java24
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchShortcut.java222
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptOptionsTab.java478
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/CodeAssistPreferencePage.java82
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/ConditionalExpressionValidator.java52
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/ConditionalFilterPreferencePage.java28
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/DirectoryValidator.java46
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/EditorPreferencePage.java40
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/EnvironmentVariablesPreferencePage.java256
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/IDEPreferenceConstants.java108
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/IDEPreferencePage.java40
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/ListEditor.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/LocalRemoteDirectoryEditor.java74
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/Messages.java36
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/PathPreferencePage.java88
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/PreferenceConstants.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/PreferenceInitializer.java174
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/SyntaxColoringPreferencePage.java192
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/SystemTapPreferencePage.java36
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/TapsetsPreferencePage.java40
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/FuncparamNodeData.java40
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/FunctionNodeData.java80
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/FunctionParser.java298
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ISearchableNode.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ISingleTypedNode.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/Messages.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbeNodeData.java60
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbeParser.java516
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbevarNodeData.java78
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/SharedParser.java92
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/StapErrorParser.java106
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java736
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetParser.java292
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TreeSettings.java480
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/BrowserView.java262
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/FunctionBrowserView.java174
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/KernelBrowserView.java376
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/ProbeAliasBrowserView.java136
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/wizards/StapNewWizard.java176
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/wizards/StapNewWizardPage.java316
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapTest.java32
358 files changed, 35059 insertions, 35161 deletions
diff --git a/systemtap/org.eclipse.linuxtools.callgraph-feature/pom.xml b/systemtap/org.eclipse.linuxtools.callgraph-feature/pom.xml
index 4e35e1fb9c..5dcb230734 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph-feature/pom.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph-feature/pom.xml
@@ -21,7 +21,7 @@
<packaging>eclipse-feature</packaging>
<name>Linux Tools C/C++ Call Graph Visualization Feature</name>
-
+
<build>
<plugins>
<plugin>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/plugin.xml b/systemtap/org.eclipse.linuxtools.callgraph.core/plugin.xml
index 0e85c132ad..9e577556fc 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/plugin.xml
@@ -2,7 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="org.eclipse.linuxtools.callgraph.core.parser" name="%systemtapparserextensionpoint" schema="schema/org.eclipse.linuxtools.callgraph.core.parser.exsd"/>
-
+
<extension
id="org.eclipse.linuxtools.callgraph.core.systemtaptextview"
name="%systemtaptextviewname"
@@ -13,7 +13,7 @@
id="org.eclipse.linuxtools.callgraph.core.staptextview"
name="%view.name"
restorable="true"
- icon="icons/12446.monitorOn.gif"
+ icon="icons/12446.monitorOn.gif"
allowMultiple="true">
</view>
</extension>
@@ -27,6 +27,6 @@
realtime="true">
</parser>
</extension>
-
+
</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/CallgraphCorePlugin.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/CallgraphCorePlugin.java
index 2b780ec041..23aa440a6a 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/CallgraphCorePlugin.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/CallgraphCorePlugin.java
@@ -4,7 +4,7 @@
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
@@ -25,82 +25,82 @@ import org.osgi.framework.BundleContext;
/**
- * Activator class behaves like standard Wizard-created activator,
+ * Activator class behaves like standard Wizard-created activator,
* except for the checkRun() function.
*
*/
public class CallgraphCorePlugin extends AbstractUIPlugin {
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.callgraph.core"; //$NON-NLS-1$
- // The shared instance
- private static CallgraphCorePlugin plugin;
-
- /**
- * The constructor
- */
- public CallgraphCorePlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
-
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static CallgraphCorePlugin getDefault() {
- return plugin;
- }
-
-
- /**
- * Returns the location of the plugin by checking the path of the bundle's
- * locationURL.
- *
- * @return
- */
- public static String getPluginLocation() {
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
-
- URL locationUrl = FileLocator.find(bundle,new Path("/"), null); //$NON-NLS-1$
- URL fileUrl = null;
- try {
- fileUrl = FileLocator.toFileURL(locationUrl);
- return fileUrl.getFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return new String();
- }
-
- /**
- * Log specified exception.
- * @param e Exception to log.
- */
- public static void logException(Exception e) {
- Status status = new Status(IStatus.ERROR, CallgraphCorePlugin.PLUGIN_ID,
- e.getMessage());
- CallgraphCorePlugin.getDefault().getLog().log(status);
- }
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.callgraph.core"; //$NON-NLS-1$
+ // The shared instance
+ private static CallgraphCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public CallgraphCorePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CallgraphCorePlugin getDefault() {
+ return plugin;
+ }
+
+
+ /**
+ * Returns the location of the plugin by checking the path of the bundle's
+ * locationURL.
+ *
+ * @return
+ */
+ public static String getPluginLocation() {
+ Bundle bundle = Platform.getBundle(PLUGIN_ID);
+
+ URL locationUrl = FileLocator.find(bundle,new Path("/"), null); //$NON-NLS-1$
+ URL fileUrl = null;
+ try {
+ fileUrl = FileLocator.toFileURL(locationUrl);
+ return fileUrl.getFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new String();
+ }
+
+ /**
+ * Log specified exception.
+ * @param e Exception to log.
+ */
+ public static void logException(Exception e) {
+ Status status = new Status(IStatus.ERROR, CallgraphCorePlugin.PLUGIN_ID,
+ e.getMessage());
+ CallgraphCorePlugin.getDefault().getLog().log(status);
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/DocWriter.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/DocWriter.java
index 1081a6c4a8..d9a453806f 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/DocWriter.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/DocWriter.java
@@ -19,55 +19,55 @@ import org.eclipse.ui.console.TextConsole;
import org.eclipse.ui.progress.UIJob;
public class DocWriter extends UIJob {
- private TextConsole console;
- private String message;
- private int length;
- private int start;
+ private TextConsole console;
+ private String message;
+ private int length;
+ private int start;
- /**
- * Initiate DocWriter class. DocWriter will append the given message
- * to the given console in a separate UI job. By default, DocWriter will
- * append to the end of the console and replace 0 characters. To change this,
- * see DocWriter's set methods.
- *
- *
- * @param name
- * @param console
- * @param message
- */
- public DocWriter(String name, TextConsole console, String message) {
+ /**
+ * Initiate DocWriter class. DocWriter will append the given message
+ * to the given console in a separate UI job. By default, DocWriter will
+ * append to the end of the console and replace 0 characters. To change this,
+ * see DocWriter's set methods.
+ *
+ *
+ * @param name
+ * @param console
+ * @param message
+ */
+ public DocWriter(String name, TextConsole console, String message) {
- super(name);
- this.console = console;
- this.message = message;
- this.start=-1;
- this.length=-1;
- }
+ super(name);
+ this.console = console;
+ this.message = message;
+ this.start=-1;
+ this.length=-1;
+ }
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (console == null) {
- return Status.CANCEL_STATUS;
- }
- if (message == null) {
- return Status.OK_STATUS;
- }
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (console == null) {
+ return Status.CANCEL_STATUS;
+ }
+ if (message == null) {
+ return Status.OK_STATUS;
+ }
- IDocument doc = console.getDocument();
+ IDocument doc = console.getDocument();
- if (length < 0) {
- length = 0;
- }
- if (start < 0) {
- start = doc.getLength();
- }
- try {
- doc.replace(start, length, message);
- } catch (BadLocationException e) {
- e.printStackTrace();
- }
+ if (length < 0) {
+ length = 0;
+ }
+ if (start < 0) {
+ start = doc.getLength();
+ }
+ try {
+ doc.replace(start, length, message);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
- return Status.OK_STATUS;
- }
+ return Status.OK_STATUS;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/FileFinderOpener.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/FileFinderOpener.java
index dc8c402163..c7dcd97f76 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/FileFinderOpener.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/FileFinderOpener.java
@@ -28,61 +28,61 @@ import org.eclipse.ui.dialogs.ElementListSelectionDialog;
*/
public class FileFinderOpener {
- private static Map<String, int []> map = new HashMap<>();
+ private static Map<String, int []> map = new HashMap<>();
- /**
- * Seeks all functions in the given proejct that contains the given function name.
- * Farms off the work of generating the list to the findFunctionsInProject function.
- * Opens a selection dialog if more than one file is found.
- *
- * @param project
- * @param functionName
- * @return
- */
- public static void findAndOpen(ICProject project, String functionName) {
- //Safety valve: Do not enforce use of project names
- if (project == null) {
- return;
- }
+ /**
+ * Seeks all functions in the given proejct that contains the given function name.
+ * Farms off the work of generating the list to the findFunctionsInProject function.
+ * Opens a selection dialog if more than one file is found.
+ *
+ * @param project
+ * @param functionName
+ * @return
+ */
+ public static void findAndOpen(ICProject project, String functionName) {
+ //Safety valve: Do not enforce use of project names
+ if (project == null) {
+ return;
+ }
- map = ProfileUIUtils.findFunctionsInProject(project, functionName, -1, null);
- ArrayList<String> files = new ArrayList<>(map.keySet());
+ map = ProfileUIUtils.findFunctionsInProject(project, functionName, -1, null);
+ ArrayList<String> files = new ArrayList<>(map.keySet());
- if (files == null || files.size() < 1) {
- return;
- }
+ if (files == null || files.size() < 1) {
+ return;
+ }
- if (files.size() == 1) {
- open(files.get(0), map.get(files.get(0))[0], map.get(files.get(0))[1]);
- } else {
- ElementListSelectionDialog d = new ElementListSelectionDialog(new Shell(), new LabelProvider());
- d.setTitle(Messages.getString("FileFinderOpener.MultipleFilesDialog")); //$NON-NLS-1$
- d.setMessage(Messages.getString("FileFinderOpener.MultFilesDialogM1") + functionName + Messages.getString("FileFinderOpener.MultFilesDialogM2") + //$NON-NLS-1$ //$NON-NLS-2$
- Messages.getString("FileFinderOpener.MultFilesDialogM3")); //$NON-NLS-1$
- d.setElements(files.toArray());
- d.open();
+ if (files.size() == 1) {
+ open(files.get(0), map.get(files.get(0))[0], map.get(files.get(0))[1]);
+ } else {
+ ElementListSelectionDialog d = new ElementListSelectionDialog(new Shell(), new LabelProvider());
+ d.setTitle(Messages.getString("FileFinderOpener.MultipleFilesDialog")); //$NON-NLS-1$
+ d.setMessage(Messages.getString("FileFinderOpener.MultFilesDialogM1") + functionName + Messages.getString("FileFinderOpener.MultFilesDialogM2") + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.getString("FileFinderOpener.MultFilesDialogM3")); //$NON-NLS-1$
+ d.setElements(files.toArray());
+ d.open();
- if (d.getResult() == null) {
- return;
- }
+ if (d.getResult() == null) {
+ return;
+ }
- for (Object o : d.getResult()) {
- if (o instanceof String) {
- String s = (String) o;
- open(s, map.get(s)[0], map.get(s)[1]);
- }
- }
- }
- }
+ for (Object o : d.getResult()) {
+ if (o instanceof String) {
+ String s = (String) o;
+ open(s, map.get(s)[0], map.get(s)[1]);
+ }
+ }
+ }
+ }
- private static void open(String path, int offset, int length) {
- if (path == null) {
- return;
- }
- try {
- ProfileUIUtils.openEditorAndSelect(path, offset, length);
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
+ private static void open(String path, int offset, int length) {
+ if (path == null) {
+ return;
+ }
+ try {
+ ProfileUIUtils.openEditorAndSelect(path, offset, length);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Helper.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Helper.java
index f39087ee63..38bd15d912 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Helper.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Helper.java
@@ -23,62 +23,62 @@ import org.eclipse.ui.console.TextConsole;
public class Helper {
- /**
- * @param name : A String that can be found in the console (BE AS SPECIFIC AS POSSIBLE)
- * @return The TextConsole having 'name' somewhere within it's name
- */
- public static TextConsole getConsoleByName(String name) {
- for (int i = 0; i < ConsolePlugin.getDefault().getConsoleManager()
- .getConsoles().length; i++) {
- if (ConsolePlugin.getDefault().getConsoleManager().
- getConsoles()[i].getName().contains(name)) {
- return (TextConsole)ConsolePlugin.getDefault().getConsoleManager().getConsoles()[i];
- }
- }
- return null;
- }
+ /**
+ * @param name : A String that can be found in the console (BE AS SPECIFIC AS POSSIBLE)
+ * @return The TextConsole having 'name' somewhere within it's name
+ */
+ public static TextConsole getConsoleByName(String name) {
+ for (int i = 0; i < ConsolePlugin.getDefault().getConsoleManager()
+ .getConsoles().length; i++) {
+ if (ConsolePlugin.getDefault().getConsoleManager().
+ getConsoles()[i].getName().contains(name)) {
+ return (TextConsole)ConsolePlugin.getDefault().getConsoleManager().getConsoles()[i];
+ }
+ }
+ return null;
+ }
- /**
- * Read the contents of a file
- * @param absoluteFilePath : The absolute path of the file from which to read.
- * @return : The contents of the file as a String.
- */
- public static String readFile(String absoluteFilePath) {
+ /**
+ * Read the contents of a file
+ * @param absoluteFilePath : The absolute path of the file from which to read.
+ * @return : The contents of the file as a String.
+ */
+ public static String readFile(String absoluteFilePath) {
- try (BufferedReader bw = new BufferedReader(new FileReader(new File(absoluteFilePath)))) {
- String output = ""; //$NON-NLS-1$
- String tmp = ""; //$NON-NLS-1$
- while ((tmp = bw.readLine()) != null) {
- output+=tmp + "\n"; //$NON-NLS-1$
- }
- bw.close();
+ try (BufferedReader bw = new BufferedReader(new FileReader(new File(absoluteFilePath)))) {
+ String output = ""; //$NON-NLS-1$
+ String tmp = ""; //$NON-NLS-1$
+ while ((tmp = bw.readLine()) != null) {
+ output+=tmp + "\n"; //$NON-NLS-1$
+ }
+ bw.close();
- return output;
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
+ return output;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
- public static BufferedWriter setBufferedWriter(String absoluteFilePath) {
- try {
- File f = new File(absoluteFilePath);
- f.delete();
- f.createNewFile();
- FileWriter fstream;
- fstream = new FileWriter(absoluteFilePath, true);
- return new BufferedWriter(fstream);
- } catch (IOException e) {
- SystemTapUIErrorMessages err = new SystemTapUIErrorMessages
- (Messages.getString("SystemTapView.FileIOErr"), //$NON-NLS-1$
- Messages.getString("SystemTapView.FileIOErr"), //$NON-NLS-1$
- Messages.getString("SystemTapView.FileIOErrMsg")); //$NON-NLS-1$
- err.schedule();
- e.printStackTrace();
- return null;
- }
- }
+ public static BufferedWriter setBufferedWriter(String absoluteFilePath) {
+ try {
+ File f = new File(absoluteFilePath);
+ f.delete();
+ f.createNewFile();
+ FileWriter fstream;
+ fstream = new FileWriter(absoluteFilePath, true);
+ return new BufferedWriter(fstream);
+ } catch (IOException e) {
+ SystemTapUIErrorMessages err = new SystemTapUIErrorMessages
+ (Messages.getString("SystemTapView.FileIOErr"), //$NON-NLS-1$
+ Messages.getString("SystemTapView.FileIOErr"), //$NON-NLS-1$
+ Messages.getString("SystemTapView.FileIOErrMsg")); //$NON-NLS-1$
+ err.schedule();
+ e.printStackTrace();
+ return null;
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/LaunchConfigurationConstants.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/LaunchConfigurationConstants.java
index 17ffb5b9dd..447f864c22 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/LaunchConfigurationConstants.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/LaunchConfigurationConstants.java
@@ -4,7 +4,7 @@
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
@@ -12,85 +12,85 @@ package org.eclipse.linuxtools.internal.callgraph.core;
/**
- * Contains the name and default value of configuration variables, as well as
+ * Contains the name and default value of configuration variables, as well as
* a few other plugin-specific constants.
*
*/
public final class LaunchConfigurationConstants {
-
-
- //Configuration type variables
- private static final String INVALID = ""; //$NON-NLS-1$
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.callgraph.launch"; //$NON-NLS-1$
- public static final String COMMAND_VERBOSE = PLUGIN_ID + ".COMMAND_VERBOSE"; //$NON-NLS-1$
- public static final String COMMAND_PASS = PLUGIN_ID + ".PASS"; //$NON-NLS-1$
- public static final String COMMAND_KEEP_TEMPORARY = PLUGIN_ID + ".KEEP_TEMPORARY"; //$NON-NLS-1$
- public static final String COMMAND_GURU = PLUGIN_ID + ".GURU"; //$NON-NLS-1$
- public static final String COMMAND_PROLOGUE_SEARCH = PLUGIN_ID + ".PROLOGUE_SEARCH"; //$NON-NLS-1$
- public static final String COMMAND_NO_CODE_ELISION = PLUGIN_ID + ".NO_CODE_ELISION"; //$NON-NLS-1$
- public static final String COMMAND_DISABLE_WARNINGS = PLUGIN_ID + ".DISABLE_WARNINGS"; //$NON-NLS-1$
- public static final String COMMAND_BULK_MODE = PLUGIN_ID + ".BULK_MODE"; //$NON-NLS-1$
- public static final String COMMAND_TIMING_INFO = PLUGIN_ID + ".TIMING_INFO"; //$NON-NLS-1$
- public static final String COMMAND_SKIP_BADVARS = PLUGIN_ID + ".SKIP_BADVARS"; //$NON-NLS-1$
- public static final String COMMAND_IGNORE_DWARF = PLUGIN_ID + ".IGNORE_DWARF"; //$NON-NLS-1$
- public static final String COMMAND_TAPSET_COVERAGE = PLUGIN_ID + ".TAPSET_COVERAGE"; //$NON-NLS-1$
- public static final String BINARY_PATH = PLUGIN_ID + ".BINARY_PATH"; //$NON-NLS-1$
- public static final String SCRIPT_PATH = PLUGIN_ID + ".SCRIPT_PATH"; //$NON-NLS-1$
- public static final String COMMAND_LEAVE_RUNNING = PLUGIN_ID + ".LEAVE_RUNNING"; //$NON-NLS-1$
- public static final String COMMAND_C_DIRECTIVES = PLUGIN_ID + ".C_DIRECTIVES"; //$NON-NLS-1$
- public static final String COMMAND_BUFFER_BYTES = PLUGIN_ID + ".BUFFER_BYTES"; //$NON-NLS-1$
- public static final String COMMAND_TARGET_PID = PLUGIN_ID + ".TARGET_PID"; //$NON-NLS-1$
- public static final String ARGUMENTS = PLUGIN_ID + ".ARGUMENTS"; //$NON-NLS-1$
- public static final String NUMBER_OF_ARGUMENTS = PLUGIN_ID + ".NUMBER_OF_ARGUMENTS"; //$NON-NLS-1$
- public static final String OUTPUT_PATH = PLUGIN_ID + ".OUTPUT_PATH"; //$NON-NLS-1$
- public static final String OVERWRITE = PLUGIN_ID + ".OVERWRITE"; //$NON-NLS-1$
- public static final String BUILD_PROJECT = PLUGIN_ID + ".BUILD_PROJECT"; //$NON-NLS-1$
- public static final String COMMAND_LIST = PLUGIN_ID + ".COMMAND_LIST"; //$NON-NLS-1$
- public static final String BINARY_ARGUMENTS = PLUGIN_ID + ".BINARY_ARGUMENTS"; //$NON-NLS-1$
- public static final String PARSER_CLASS = PLUGIN_ID + ".PARSER_CLASS"; //$NON-NLS-1$
- public static final String VIEW_CLASS = PLUGIN_ID + ".VIEW_CLASS"; //$NON-NLS-1$
- public static final String SECONDARY_VIEW_ID = PLUGIN_ID + ".SECONDARY_VIEW_ID"; //$NON-NLS-1$
+ //Configuration type variables
+ private static final String INVALID = ""; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.callgraph.launch"; //$NON-NLS-1$
+
+ public static final String COMMAND_VERBOSE = PLUGIN_ID + ".COMMAND_VERBOSE"; //$NON-NLS-1$
+ public static final String COMMAND_PASS = PLUGIN_ID + ".PASS"; //$NON-NLS-1$
+ public static final String COMMAND_KEEP_TEMPORARY = PLUGIN_ID + ".KEEP_TEMPORARY"; //$NON-NLS-1$
+ public static final String COMMAND_GURU = PLUGIN_ID + ".GURU"; //$NON-NLS-1$
+ public static final String COMMAND_PROLOGUE_SEARCH = PLUGIN_ID + ".PROLOGUE_SEARCH"; //$NON-NLS-1$
+ public static final String COMMAND_NO_CODE_ELISION = PLUGIN_ID + ".NO_CODE_ELISION"; //$NON-NLS-1$
+ public static final String COMMAND_DISABLE_WARNINGS = PLUGIN_ID + ".DISABLE_WARNINGS"; //$NON-NLS-1$
+ public static final String COMMAND_BULK_MODE = PLUGIN_ID + ".BULK_MODE"; //$NON-NLS-1$
+ public static final String COMMAND_TIMING_INFO = PLUGIN_ID + ".TIMING_INFO"; //$NON-NLS-1$
+ public static final String COMMAND_SKIP_BADVARS = PLUGIN_ID + ".SKIP_BADVARS"; //$NON-NLS-1$
+ public static final String COMMAND_IGNORE_DWARF = PLUGIN_ID + ".IGNORE_DWARF"; //$NON-NLS-1$
+ public static final String COMMAND_TAPSET_COVERAGE = PLUGIN_ID + ".TAPSET_COVERAGE"; //$NON-NLS-1$
+ public static final String BINARY_PATH = PLUGIN_ID + ".BINARY_PATH"; //$NON-NLS-1$
+ public static final String SCRIPT_PATH = PLUGIN_ID + ".SCRIPT_PATH"; //$NON-NLS-1$
+ public static final String COMMAND_LEAVE_RUNNING = PLUGIN_ID + ".LEAVE_RUNNING"; //$NON-NLS-1$
+ public static final String COMMAND_C_DIRECTIVES = PLUGIN_ID + ".C_DIRECTIVES"; //$NON-NLS-1$
+ public static final String COMMAND_BUFFER_BYTES = PLUGIN_ID + ".BUFFER_BYTES"; //$NON-NLS-1$
+ public static final String COMMAND_TARGET_PID = PLUGIN_ID + ".TARGET_PID"; //$NON-NLS-1$
+ public static final String ARGUMENTS = PLUGIN_ID + ".ARGUMENTS"; //$NON-NLS-1$
+ public static final String NUMBER_OF_ARGUMENTS = PLUGIN_ID + ".NUMBER_OF_ARGUMENTS"; //$NON-NLS-1$
+ public static final String OUTPUT_PATH = PLUGIN_ID + ".OUTPUT_PATH"; //$NON-NLS-1$
+ public static final String OVERWRITE = PLUGIN_ID + ".OVERWRITE"; //$NON-NLS-1$
+ public static final String BUILD_PROJECT = PLUGIN_ID + ".BUILD_PROJECT"; //$NON-NLS-1$
+ public static final String COMMAND_LIST = PLUGIN_ID + ".COMMAND_LIST"; //$NON-NLS-1$
+ public static final String BINARY_ARGUMENTS = PLUGIN_ID + ".BINARY_ARGUMENTS"; //$NON-NLS-1$
+ public static final String PARSER_CLASS = PLUGIN_ID + ".PARSER_CLASS"; //$NON-NLS-1$
+ public static final String VIEW_CLASS = PLUGIN_ID + ".VIEW_CLASS"; //$NON-NLS-1$
+ public static final String SECONDARY_VIEW_ID = PLUGIN_ID + ".SECONDARY_VIEW_ID"; //$NON-NLS-1$
+
+
+ public static final String GENERATED_SCRIPT = PLUGIN_ID + ".GENERATED_SCRIPT"; //$NON-NLS-1$
+ public static final String NEED_TO_GENERATE = PLUGIN_ID + ".NEED_TO_GENERATE"; //$NON-NLS-1$
+ public static final String USE_COLOUR = PLUGIN_ID + ".USE_COLOUR"; //$NON-NLS-1$
+ public static final String COMMAND = ".COMMAND"; //$NON-NLS-1$
+
+ //Defaults
+ public static final int DEFAULT_COMMAND_VERBOSE = 0;
+ public static final int DEFAULT_COMMAND_PASS = 0;
+ public static final boolean DEFAULT_COMMAND_KEEP_TEMPORARY = false;
+ public static final boolean DEFAULT_COMMAND_GURU = false;
+ public static final boolean DEFAULT_COMMAND_PROLOGUE_SEARCH = false;
+ public static final boolean DEFAULT_COMMAND_NO_CODE_ELISION = false;
+ public static final boolean DEFAULT_COMMAND_DISABLE_WARNINGS = false;
+ public static final boolean DEFAULT_COMMAND_BULK_MODE = false;
+ public static final boolean DEFAULT_COMMAND_TIMING_INFO = false;
+ public static final boolean DEFAULT_COMMAND_SKIP_BADVARS = false;
+ public static final boolean DEFAULT_COMMAND_IGNORE_DWARF = false;
+ public static final boolean DEFAULT_COMMAND_TAPSET_COVERAGE = false;
+ public static final String DEFAULT_BINARY_PATH = INVALID;
+ public static final String DEFAULT_SCRIPT_PATH = INVALID;
+ public static final boolean DEFAULT_COMMAND_LEAVE_RUNNING = false;
+ public static final String DEFAULT_COMMAND_C_DIRECTIVES = INVALID;
+ public static final int DEFAULT_COMMAND_BUFFER_BYTES = 0;
+ public static final int DEFAULT_COMMAND_TARGET_PID = 0;
+ public static final String DEFAULT_ARGUMENTS = INVALID;
+ public static final String DEFAULT_OUTPUT_PATH = INVALID;
+ public static final boolean DEFAULT_OVERWRITE = false;
+ public static final int DEFAULT_NUMBER_OF_ARGUMENTS = 0;
+ public static final boolean DEFAULT_BUILD_PROJECT = true;
+ public static final String DEFAULT_COMMAND_LIST = INVALID;
+ public static final String DEFAULT_BINARY_ARGUMENTS = INVALID;
+
+ public static final String DEFAULT_GENERATED_SCRIPT = INVALID;
+ public static final boolean DEFAULT_NEED_TO_GENERATE = false;
+ public static final boolean DEFAULT_USE_COLOUR = false;
- public static final String GENERATED_SCRIPT = PLUGIN_ID + ".GENERATED_SCRIPT"; //$NON-NLS-1$
- public static final String NEED_TO_GENERATE = PLUGIN_ID + ".NEED_TO_GENERATE"; //$NON-NLS-1$
- public static final String USE_COLOUR = PLUGIN_ID + ".USE_COLOUR"; //$NON-NLS-1$
- public static final String COMMAND = ".COMMAND"; //$NON-NLS-1$
-
- //Defaults
- public static final int DEFAULT_COMMAND_VERBOSE = 0;
- public static final int DEFAULT_COMMAND_PASS = 0;
- public static final boolean DEFAULT_COMMAND_KEEP_TEMPORARY = false;
- public static final boolean DEFAULT_COMMAND_GURU = false;
- public static final boolean DEFAULT_COMMAND_PROLOGUE_SEARCH = false;
- public static final boolean DEFAULT_COMMAND_NO_CODE_ELISION = false;
- public static final boolean DEFAULT_COMMAND_DISABLE_WARNINGS = false;
- public static final boolean DEFAULT_COMMAND_BULK_MODE = false;
- public static final boolean DEFAULT_COMMAND_TIMING_INFO = false;
- public static final boolean DEFAULT_COMMAND_SKIP_BADVARS = false;
- public static final boolean DEFAULT_COMMAND_IGNORE_DWARF = false;
- public static final boolean DEFAULT_COMMAND_TAPSET_COVERAGE = false;
- public static final String DEFAULT_BINARY_PATH = INVALID;
- public static final String DEFAULT_SCRIPT_PATH = INVALID;
- public static final boolean DEFAULT_COMMAND_LEAVE_RUNNING = false;
- public static final String DEFAULT_COMMAND_C_DIRECTIVES = INVALID;
- public static final int DEFAULT_COMMAND_BUFFER_BYTES = 0;
- public static final int DEFAULT_COMMAND_TARGET_PID = 0;
- public static final String DEFAULT_ARGUMENTS = INVALID;
- public static final String DEFAULT_OUTPUT_PATH = INVALID;
- public static final boolean DEFAULT_OVERWRITE = false;
- public static final int DEFAULT_NUMBER_OF_ARGUMENTS = 0;
- public static final boolean DEFAULT_BUILD_PROJECT = true;
- public static final String DEFAULT_COMMAND_LIST = INVALID;
- public static final String DEFAULT_BINARY_ARGUMENTS = INVALID;
-
- public static final String DEFAULT_GENERATED_SCRIPT = INVALID;
- public static final boolean DEFAULT_NEED_TO_GENERATE = false;
- public static final boolean DEFAULT_USE_COLOUR = false;
-
- public static final String DEFAULT_PARSER_CLASS = INVALID;
- public static final String DEFAULT_VIEW_CLASS = INVALID;
- public static final String DEFAULT_SECONDARY_VIEW_ID = INVALID;
+ public static final String DEFAULT_PARSER_CLASS = INVALID;
+ public static final String DEFAULT_VIEW_CLASS = INVALID;
+ public static final String DEFAULT_SECONDARY_VIEW_ID = INVALID;
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Messages.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Messages.java
index c80d00c580..36ce1c8a5a 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Messages.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Messages.java
@@ -4,7 +4,7 @@
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
@@ -18,19 +18,19 @@ import java.util.ResourceBundle;
*
*/
public class Messages {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.callgraph.core.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.callgraph.core.messages"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
- private Messages() {
- }
+ private Messages() {
+ }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/PluginConstants.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/PluginConstants.java
index cb33ddad85..ccba0d3838 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/PluginConstants.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/PluginConstants.java
@@ -12,61 +12,61 @@ package org.eclipse.linuxtools.internal.callgraph.core;
public final class PluginConstants {
- private static String PLUGIN_LOCATION = ""; //$NON-NLS-1$
- public static final String CONFIGURATION_TYPE_ID = "org.eclipse.linuxtools.callgraph.launch.systemtapLaunch"; //$NON-NLS-1$
- public static final String PARSER_CLASS = "org.eclipse.linuxtools.callgraph.core.parser"; //$NON-NLS-1$
- public static final String PARSER_RESOURCE = "org.eclipse.linuxtools.callgraph.core"; //$NON-NLS-1$
- public static final String PARSER_NAME = "parser"; //$NON-NLS-1$
- public static final String VIEW_CLASS = "org.eclipse.linuxtools.callgraph.core.view"; //$NON-NLS-1$
- public static final String VIEW_RESOURCE = "org.eclipse.ui"; //$NON-NLS-1$
- public static final String VIEW_NAME = "views"; //$NON-NLS-1$
- public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
- public static final String ATTR_REALTIME = "realtime"; //$NON-NLS-1$
- public static final String VAL_TRUE = "true"; //$NON-NLS-1$
+ private static String PLUGIN_LOCATION = ""; //$NON-NLS-1$
+ public static final String CONFIGURATION_TYPE_ID = "org.eclipse.linuxtools.callgraph.launch.systemtapLaunch"; //$NON-NLS-1$
+ public static final String PARSER_CLASS = "org.eclipse.linuxtools.callgraph.core.parser"; //$NON-NLS-1$
+ public static final String PARSER_RESOURCE = "org.eclipse.linuxtools.callgraph.core"; //$NON-NLS-1$
+ public static final String PARSER_NAME = "parser"; //$NON-NLS-1$
+ public static final String VIEW_CLASS = "org.eclipse.linuxtools.callgraph.core.view"; //$NON-NLS-1$
+ public static final String VIEW_RESOURCE = "org.eclipse.ui"; //$NON-NLS-1$
+ public static final String VIEW_NAME = "views"; //$NON-NLS-1$
+ public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
+ public static final String ATTR_REALTIME = "realtime"; //$NON-NLS-1$
+ public static final String VAL_TRUE = "true"; //$NON-NLS-1$
- public static final String NEW_LINE = "\n"; //$NON-NLS-1$
- public static final int MAX_ERRORS = 500; //Maximum number of errors to tolerate
- public static int SYSTEMTAP_OPTIONS_TAB_HORIZONTAL_SPACING = 30;
- public static String STAP_PATH = "stap"; //$NON-NLS-1$
+ public static final String NEW_LINE = "\n"; //$NON-NLS-1$
+ public static final int MAX_ERRORS = 500; //Maximum number of errors to tolerate
+ public static int SYSTEMTAP_OPTIONS_TAB_HORIZONTAL_SPACING = 30;
+ public static String STAP_PATH = "stap"; //$NON-NLS-1$
- public static final String DEFAULT_VIEW_ID = "org.eclipse.linuxtools.callgraph.core.staptextview"; //$NON-NLS-1$
- public static final String DEFAULT_PARSER_ID = "org.eclipse.linuxtools.callgraph.core.systemtaptextparser"; //$NON-NLS-1$
- private static String DEFAULT_OUTPUT = ""; //$NON-NLS-1$
- private static String STAP_GRAPH_DEFAULT_IO_PATH = ""; //$NON-NLS-1$
+ public static final String DEFAULT_VIEW_ID = "org.eclipse.linuxtools.callgraph.core.staptextview"; //$NON-NLS-1$
+ public static final String DEFAULT_PARSER_ID = "org.eclipse.linuxtools.callgraph.core.systemtaptextparser"; //$NON-NLS-1$
+ private static String DEFAULT_OUTPUT = ""; //$NON-NLS-1$
+ private static String STAP_GRAPH_DEFAULT_IO_PATH = ""; //$NON-NLS-1$
- /**
- * Sets the absolute path of the Plugin folder and updates
- * the PLUGIN_LOCATION.
- *
- * @param loc
- */
- public static void setPluginLocation(String loc) {
- PLUGIN_LOCATION = loc;
- }
+ /**
+ * Sets the absolute path of the Plugin folder and updates
+ * the PLUGIN_LOCATION.
+ *
+ * @param loc
+ */
+ public static void setPluginLocation(String loc) {
+ PLUGIN_LOCATION = loc;
+ }
- public static String getPluginLocation() {
- if (PLUGIN_LOCATION.length() < 1) {
- PluginConstants.setPluginLocation(CallgraphCorePlugin.getPluginLocation());
- }
+ public static String getPluginLocation() {
+ if (PLUGIN_LOCATION.length() < 1) {
+ PluginConstants.setPluginLocation(CallgraphCorePlugin.getPluginLocation());
+ }
- return PLUGIN_LOCATION;
- }
+ return PLUGIN_LOCATION;
+ }
- public static String getDefaultOutput() {
- if (DEFAULT_OUTPUT.length() < 1){
- DEFAULT_OUTPUT = CallgraphCorePlugin.getDefault().getStateLocation().toString()+"/"; //$NON-NLS-1$
- }
+ public static String getDefaultOutput() {
+ if (DEFAULT_OUTPUT.length() < 1){
+ DEFAULT_OUTPUT = CallgraphCorePlugin.getDefault().getStateLocation().toString()+"/"; //$NON-NLS-1$
+ }
- return DEFAULT_OUTPUT;
- }
+ return DEFAULT_OUTPUT;
+ }
- public static String getDefaultIOPath() {
- if (STAP_GRAPH_DEFAULT_IO_PATH.length() < 1)
- {
- STAP_GRAPH_DEFAULT_IO_PATH = CallgraphCorePlugin.getDefault().getStateLocation().toString()+"/callgraph.out"; //$NON-NLS-1$
- }
- return STAP_GRAPH_DEFAULT_IO_PATH;
- }
+ public static String getDefaultIOPath() {
+ if (STAP_GRAPH_DEFAULT_IO_PATH.length() < 1)
+ {
+ STAP_GRAPH_DEFAULT_IO_PATH = CallgraphCorePlugin.getDefault().getStateLocation().toString()+"/callgraph.out"; //$NON-NLS-1$
+ }
+ return STAP_GRAPH_DEFAULT_IO_PATH;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/StapUIJob.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/StapUIJob.java
index 9d77870403..f6afd0ebf6 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/StapUIJob.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/StapUIJob.java
@@ -23,46 +23,46 @@ import org.eclipse.ui.progress.UIJob;
*
*/
public class StapUIJob extends UIJob {
- private SystemTapParser parser;
- private String viewID;
- private SystemTapView viewer;
+ private SystemTapParser parser;
+ private String viewID;
+ private SystemTapView viewer;
- public StapUIJob(String name, SystemTapParser parser, String viewID) {
- super(name);
- // CREATE THE SHELL
- this.parser = parser;
- this.viewID = viewID;
- }
+ public StapUIJob(String name, SystemTapParser parser, String viewID) {
+ super(name);
+ // CREATE THE SHELL
+ this.parser = parser;
+ this.viewID = viewID;
+ }
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (parser.getSecondaryID() != null && parser.getSecondaryID().length() > 0) {
- viewer = ViewFactory.createView(viewID, parser.getSecondaryID());
- } else {
- viewer = ViewFactory.createView(viewID);
- }
- if (!viewer.setParser(parser)) {
- return Status.CANCEL_STATUS;
- }
- if (viewer.initializeView(this.getDisplay(), monitor) == Status.CANCEL_STATUS) {
- return Status.CANCEL_STATUS;
- }
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (parser.getSecondaryID() != null && parser.getSecondaryID().length() > 0) {
+ viewer = ViewFactory.createView(viewID, parser.getSecondaryID());
+ } else {
+ viewer = ViewFactory.createView(viewID);
+ }
+ if (!viewer.setParser(parser)) {
+ return Status.CANCEL_STATUS;
+ }
+ if (viewer.initializeView(this.getDisplay(), monitor) == Status.CANCEL_STATUS) {
+ return Status.CANCEL_STATUS;
+ }
- if (!parser.realTime) {
- viewer.updateMethod();
- }
- viewer.setSourcePath(parser.getFile());
- viewer.setKillButtonEnabled(true);
+ if (!parser.realTime) {
+ viewer.updateMethod();
+ }
+ viewer.setSourcePath(parser.getFile());
+ viewer.setKillButtonEnabled(true);
- return Status.OK_STATUS;
- }
+ return Status.OK_STATUS;
+ }
- /**
- * Returns the viewer object. Viewer is initialized within the run method, and
- * is not guaranteed to be non-null until the job has terminated.
- * @return
- */
- public SystemTapView getViewer() {
- return viewer;
- }
+ /**
+ * Returns the viewer object. Viewer is initialized within the run method, and
+ * is not guaranteed to be non-null until the job has terminated.
+ * @return
+ */
+ public SystemTapView getViewer() {
+ return viewer;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapCommandGenerator.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapCommandGenerator.java
index 643cd18da5..a93fb35319 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapCommandGenerator.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapCommandGenerator.java
@@ -20,83 +20,83 @@ import java.util.ArrayList;
*/
public class SystemTapCommandGenerator {
- private static boolean needsToSendCommand;
- private static boolean needsArguments;
- private static String arguments;
- private static String scriptPath;
- private static String flags;
- private static String binaryPath = null;
- private static String binaryArguments;
- private static String command;
-
-
- public static String generateCommand(String scrPath, String binPath, String opts, boolean needBinary, boolean needsArgs, String arg, String binArguments,
- String cmdTarget) {
- needsToSendCommand = needBinary;
- needsArguments = needsArgs;
- binaryPath = binPath;
- scriptPath = scrPath;
- arguments = "--runtime=dyninst " + arg; //$NON-NLS-1$
- flags = opts;
- binaryArguments = binArguments;
- command = cmdTarget;
-
-
- String[] script = buildScript();
-
- String cmd = ""; //$NON-NLS-1$
- for (int i = 0; i < script.length-1; i++) {
- cmd = cmd + script[i] + " "; //$NON-NLS-1$
- }
- cmd = cmd + script[script.length-1];
-
- return cmd;
- }
-
-
- /**
- * Parses the data created from generateCommand
- * @return An array of strings to be joined and executed by the shell
- */
- private static String[] buildScript() {
- //TODO: Take care of this in the next release. For now only the guru mode is sent
- ArrayList<String> cmdList = new ArrayList<>();
- String[] script;
-
- if (flags.length() > 0){
- cmdList.add(flags);
- }
-
- //Execute a binary
- if (needsToSendCommand){
- if (binaryArguments.length() < 1){
- cmdList.add("-c '" + binaryPath + "'"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- cmdList.add("-c \"" + binaryPath + " " + binaryArguments +"\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
-
- if (needsArguments) {
- script = new String[cmdList.size() + 3];
- script[script.length-2] = scriptPath;
- script[script.length-1] = arguments;
- } else {
- script = new String[cmdList.size() + 2];
- script[script.length-1] = scriptPath;
- }
-
- script[0] = command;
-
- for(int i=0; i< cmdList.size(); i++) {
- if (cmdList.get(i) != null) {
- script[i +1] = cmdList.get(i);
- } else {
- script[i + 1] = ""; //$NON-NLS-1$
- }
- }
- return script;
-
- }
+ private static boolean needsToSendCommand;
+ private static boolean needsArguments;
+ private static String arguments;
+ private static String scriptPath;
+ private static String flags;
+ private static String binaryPath = null;
+ private static String binaryArguments;
+ private static String command;
+
+
+ public static String generateCommand(String scrPath, String binPath, String opts, boolean needBinary, boolean needsArgs, String arg, String binArguments,
+ String cmdTarget) {
+ needsToSendCommand = needBinary;
+ needsArguments = needsArgs;
+ binaryPath = binPath;
+ scriptPath = scrPath;
+ arguments = "--runtime=dyninst " + arg; //$NON-NLS-1$
+ flags = opts;
+ binaryArguments = binArguments;
+ command = cmdTarget;
+
+
+ String[] script = buildScript();
+
+ String cmd = ""; //$NON-NLS-1$
+ for (int i = 0; i < script.length-1; i++) {
+ cmd = cmd + script[i] + " "; //$NON-NLS-1$
+ }
+ cmd = cmd + script[script.length-1];
+
+ return cmd;
+ }
+
+
+ /**
+ * Parses the data created from generateCommand
+ * @return An array of strings to be joined and executed by the shell
+ */
+ private static String[] buildScript() {
+ //TODO: Take care of this in the next release. For now only the guru mode is sent
+ ArrayList<String> cmdList = new ArrayList<>();
+ String[] script;
+
+ if (flags.length() > 0){
+ cmdList.add(flags);
+ }
+
+ //Execute a binary
+ if (needsToSendCommand){
+ if (binaryArguments.length() < 1){
+ cmdList.add("-c '" + binaryPath + "'"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ cmdList.add("-c \"" + binaryPath + " " + binaryArguments +"\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+
+ if (needsArguments) {
+ script = new String[cmdList.size() + 3];
+ script[script.length-2] = scriptPath;
+ script[script.length-1] = arguments;
+ } else {
+ script = new String[cmdList.size() + 2];
+ script[script.length-1] = scriptPath;
+ }
+
+ script[0] = command;
+
+ for(int i=0; i< cmdList.size(); i++) {
+ if (cmdList.get(i) != null) {
+ script[i +1] = cmdList.get(i);
+ } else {
+ script[i + 1] = ""; //$NON-NLS-1$
+ }
+ }
+ return script;
+
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapErrorHandler.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapErrorHandler.java
index be0cc1c0f1..d90b4ae2bf 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapErrorHandler.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapErrorHandler.java
@@ -56,35 +56,35 @@ public class SystemTapErrorHandler {
try (BufferedReader buff1 = new BufferedReader(new FileReader(file))) {
String line;
for (String message : errorsList) {
- try (BufferedReader innerBuff = new BufferedReader(
- new FileReader(file))) {
- while ((line = innerBuff.readLine()) != null) {
- if (m != null && m.isCanceled()) {
- return;
- }
- int index = line.indexOf('=');
- Pattern pat = Pattern.compile(line.substring(0, index),
- Pattern.DOTALL);
- Matcher matcher = pat.matcher(message);
-
- if (matcher.matches()) {
- if (!isErrorRecognized()) {
- // First error
- errorMessage
- .append(Messages
- .getString("SystemTapErrorHandler.ErrorMessage2")); //$NON-NLS-1$
- errorRecognized = true;
- }
- String errorFound = line.substring(index + 1);
-
- if (!errorMessage.toString().contains(errorFound)) {
- errorMessage.append(errorFound
- + PluginConstants.NEW_LINE);
- }
- break;
- }
- }
- }
+ try (BufferedReader innerBuff = new BufferedReader(
+ new FileReader(file))) {
+ while ((line = innerBuff.readLine()) != null) {
+ if (m != null && m.isCanceled()) {
+ return;
+ }
+ int index = line.indexOf('=');
+ Pattern pat = Pattern.compile(line.substring(0, index),
+ Pattern.DOTALL);
+ Matcher matcher = pat.matcher(message);
+
+ if (matcher.matches()) {
+ if (!isErrorRecognized()) {
+ // First error
+ errorMessage
+ .append(Messages
+ .getString("SystemTapErrorHandler.ErrorMessage2")); //$NON-NLS-1$
+ errorRecognized = true;
+ }
+ String errorFound = line.substring(index + 1);
+
+ if (!errorMessage.toString().contains(errorFound)) {
+ errorMessage.append(errorFound
+ + PluginConstants.NEW_LINE);
+ }
+ break;
+ }
+ }
+ }
}
logContents.append(errors);
@@ -148,8 +148,8 @@ public class SystemTapErrorHandler {
* time.
*/
private void writeToLog() {
- IStatus status = new Status(IStatus.ERROR,CallgraphCorePlugin.PLUGIN_ID,logContents.toString());
- CallgraphCorePlugin.getDefault().getLog().log(status);
+ IStatus status = new Status(IStatus.ERROR,CallgraphCorePlugin.PLUGIN_ID,logContents.toString());
+ CallgraphCorePlugin.getDefault().getLog().log(status);
logContents = new StringBuilder();
}
@@ -166,6 +166,6 @@ public class SystemTapErrorHandler {
* @return The error message string
*/
public String getErrorMessage(){
- return errorMessage.toString();
+ return errorMessage.toString();
}
} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapParser.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapParser.java
index 7356689d6a..e558a220a0 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapParser.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapParser.java
@@ -22,309 +22,309 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
public abstract class SystemTapParser extends Job {
- protected IProgressMonitor monitor;
- protected String sourcePath;
- protected String viewID;
- protected SystemTapView view;
- protected boolean realTime = false;
- protected Object data;
- protected Object internalData;
- private String secondaryID = ""; //$NON-NLS-1$
-
- public boolean done;
-
- public SystemTapParser() {
- super("Parsing data"); //$NON-NLS-1$
- this.sourcePath = PluginConstants.getDefaultIOPath();
- this.viewID = null;
- initialize();
- done = false;
-
- //PURELY FOR TESTING
- if (monitor == null){
- monitor = new NullProgressMonitor();
- }
- }
-
-
- public SystemTapParser(String name, String filePath) {
- super(name);
- // BY DEFAULT READ/WRITE FROM HERE
- if (filePath != null) {
- this.sourcePath = filePath;
- } else {
- this.sourcePath = PluginConstants.getDefaultIOPath();
- }
- this.viewID = null;
- initialize();
- }
-
-
- /**
- * Initialize will be called in the constructors for this class. Use this
- * method to initialize variables.
- */
- protected abstract void initialize();
-
-
- /**
- * Implement this method to execute parsing. The return from
- * executeParsing() will be the return value of the run command.
- *
- * SystemTapParser will call executeParsing() within its run method. (i.e.
- * will execute in a separate, non-UI thread)
- *
- * @return
- */
- public abstract IStatus nonRealTimeParsing();
-
-
- /**
- * Implement this method if your parser is to execute in realtime. This method
- * will be called as part of a while loop in a separate Job. Use the setInternalData
- * method to initialize some data object for use in realTimeParsing. The default
- * setInternalMethod method will set internalData to a BufferedReader
- * <br> <br>
- * After the isDone flag is set to true, the realTimeParsing() method will
- * be run one more time to catch any stragglers.
- */
- public abstract IStatus realTimeParsing();
-
-
- /**
- * Cleans names of form 'name").return', returning just the name
- *
- * @param name
- */
- protected String cleanFunctionName(String name) {
- return name.split("\"")[0]; //$NON-NLS-1$
- }
-
- /**
- * Checks for quotations and brackets in the function name
- *
- * @param name
- */
- protected boolean isFunctionNameClean(String name) {
- if (name.contains("\"") || name.contains(")")) //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- return true;
- }
-
- /**
- * Creates a popup error dialog in a separate UI thread. Dialog title is
- * 'Unexpected symbol,' name is 'ParseError' and body is the specified
- * message.
- *
- * @param message
- */
- protected void parsingError(String message) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapParser.ParseErr"), //$NON-NLS-1$
- Messages.getString("SystemTapParser.ErrSymbol"), //$NON-NLS-1$
- message);
- mess.schedule();
- }
-
- /**
- * Load the specified viewID by creating a StapUIJob. Does not return until the StapUIJob has.
- * Returns true if the makeView was successful, false otherwise.
- */
- private boolean makeView() {
- // Create a UIJob to handle the rest
- if (viewID != null && viewID.length() > 0) {
- try {
- StapUIJob uijob = new StapUIJob(
- Messages.getString("StapGraphParser.JobName"), this, viewID); //$NON-NLS-1$
- uijob.schedule();
- uijob.join();
- view = uijob.getViewer();
- return true;
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- return false;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- // Generate real-time job
- IStatus returnStatus = Status.CANCEL_STATUS;
- this.monitor = monitor;
- if (this.monitor == null) {
- this.monitor = new NullProgressMonitor();
- }
-
- makeView();
- if (realTime) {
- try {
- setInternalData();
- while (!done){
- returnStatus = realTimeParsing();
- if (monitor.isCanceled() || returnStatus == Status.CANCEL_STATUS) {
- done = true;
- return Status.CANCEL_STATUS;
- }
-
- Thread.sleep(500);
- }
- if (!monitor.isCanceled()) returnStatus = realTimeParsing();
- done = true;
- return returnStatus;
- } catch (InterruptedException e) {
- SystemTapUIErrorMessages m = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapParser.InternalData"), //$NON-NLS-1$
- Messages.getString("SystemTapParser.FailedToSetData"), //$NON-NLS-1$
- Messages.getString("SystemTapParser.FailedToSetDataMessage")); //$NON-NLS-1$
- m.schedule();
- return Status.CANCEL_STATUS;
- } catch (FileNotFoundException e) {
- SystemTapUIErrorMessages m = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapParser.InternalData"), //$NON-NLS-1$
- Messages.getString("SystemTapParser.FailedToSetData"), //$NON-NLS-1$
- Messages.getString("SystemTapParser.FailedToSetDataMessage")); //$NON-NLS-1$
- m.schedule();
- return Status.CANCEL_STATUS;
- }
- } else {
- returnStatus = nonRealTimeParsing();
- if (!returnStatus.isOK()){
- return returnStatus;
- }
-
- setData(this);
- return returnStatus;
- }
-
- }
-
- /**
- * For easier JUnit testing only. Allows public access to run method without
- * scheduling an extra job.
- *
- * @param m
- * @return
- */
- public IStatus testRun(IProgressMonitor m, boolean realTime) {
- try {
- internalData = new BufferedReader(new FileReader(new File(
- sourcePath)));
- if (realTime) {
- return realTimeParsing();
- } else {
- return nonRealTimeParsing();
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- return Status.CANCEL_STATUS;
- }
-
-
- /**
- * @return the Data object
- */
- public Object getData() {
- return data;
- }
-
- /**
- * Generic method for setting the internalData object. This will be called
- * by a real-time-parser immediately before its main polling loop. By default,
- * this method will attempt to create a bufferedReader around File(filePath)
- * @throws FileNotFoundException
- */
- protected void setInternalData() throws FileNotFoundException {
- File file = new File(sourcePath);
- internalData = new BufferedReader(new FileReader(file));
- }
-
- /**
- * Gets the file to read from
- *
- * @return
- */
- public String getFile() {
- return sourcePath;
- }
-
- /**
- * Sets the file to read from
- *
- * @param source
- */
- public void setSourcePath(String source) {
- this.sourcePath = source;
- }
-
- /**
- * Will terminate the parser at the next opportunity (~once every 0.5s)s
- *
- * @param val
- */
- public void setDone(boolean val) {
- done = val;
- }
-
- public void setMonitor(IProgressMonitor m) {
- this.monitor = m;
- }
-
- /**
- * Set whether or not this parser runs in real time. If viewID has already
- * been set, this will also attempt to open the view.
- */
- public void setRealTime(boolean val) {
- realTime = val;
-
- }
-
- /**
- * Set the viewID to use for this parser -- see the callgraph.core view
- * extension point. If realTime is set to true, this will also attempt to
- * open the view.
- */
- public void setViewID(String value) {
- viewID = value;
- }
-
- /**
- * Called at the end of a non-realtime run.
- * Feel free to override this method if using non-realtime functions.
- * The setData method will be called after executeParsing() is run.
- * The getData() method will be used by the SystemTapView to get the
- * data associated with this parser.
- * <br><br>
- * Alternatively, you can cast the parser within SystemTapView to your
- * own parser class and access its data structures that way.
- */
- public void setData(Object obj) {
- data = obj;
- }
-
- /**
- * Sends a message to cancel the job. Job may not terminate immediately.
- */
- public void cancelJob() {
- done = true;
- }
-
- public boolean isDone() {
- return done;
- }
-
- public void setKillButtonEnabled(boolean val) {
- if (view != null) {
- view.setKillButtonEnabled(val);
- }
- }
-
- public void setSecondaryID(String secondaryID) {
- this.secondaryID = secondaryID;
- }
-
- public String getSecondaryID() {
- return secondaryID;
- }
+ protected IProgressMonitor monitor;
+ protected String sourcePath;
+ protected String viewID;
+ protected SystemTapView view;
+ protected boolean realTime = false;
+ protected Object data;
+ protected Object internalData;
+ private String secondaryID = ""; //$NON-NLS-1$
+
+ public boolean done;
+
+ public SystemTapParser() {
+ super("Parsing data"); //$NON-NLS-1$
+ this.sourcePath = PluginConstants.getDefaultIOPath();
+ this.viewID = null;
+ initialize();
+ done = false;
+
+ //PURELY FOR TESTING
+ if (monitor == null){
+ monitor = new NullProgressMonitor();
+ }
+ }
+
+
+ public SystemTapParser(String name, String filePath) {
+ super(name);
+ // BY DEFAULT READ/WRITE FROM HERE
+ if (filePath != null) {
+ this.sourcePath = filePath;
+ } else {
+ this.sourcePath = PluginConstants.getDefaultIOPath();
+ }
+ this.viewID = null;
+ initialize();
+ }
+
+
+ /**
+ * Initialize will be called in the constructors for this class. Use this
+ * method to initialize variables.
+ */
+ protected abstract void initialize();
+
+
+ /**
+ * Implement this method to execute parsing. The return from
+ * executeParsing() will be the return value of the run command.
+ *
+ * SystemTapParser will call executeParsing() within its run method. (i.e.
+ * will execute in a separate, non-UI thread)
+ *
+ * @return
+ */
+ public abstract IStatus nonRealTimeParsing();
+
+
+ /**
+ * Implement this method if your parser is to execute in realtime. This method
+ * will be called as part of a while loop in a separate Job. Use the setInternalData
+ * method to initialize some data object for use in realTimeParsing. The default
+ * setInternalMethod method will set internalData to a BufferedReader
+ * <br> <br>
+ * After the isDone flag is set to true, the realTimeParsing() method will
+ * be run one more time to catch any stragglers.
+ */
+ public abstract IStatus realTimeParsing();
+
+
+ /**
+ * Cleans names of form 'name").return', returning just the name
+ *
+ * @param name
+ */
+ protected String cleanFunctionName(String name) {
+ return name.split("\"")[0]; //$NON-NLS-1$
+ }
+
+ /**
+ * Checks for quotations and brackets in the function name
+ *
+ * @param name
+ */
+ protected boolean isFunctionNameClean(String name) {
+ if (name.contains("\"") || name.contains(")")) //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
+ return true;
+ }
+
+ /**
+ * Creates a popup error dialog in a separate UI thread. Dialog title is
+ * 'Unexpected symbol,' name is 'ParseError' and body is the specified
+ * message.
+ *
+ * @param message
+ */
+ protected void parsingError(String message) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapParser.ParseErr"), //$NON-NLS-1$
+ Messages.getString("SystemTapParser.ErrSymbol"), //$NON-NLS-1$
+ message);
+ mess.schedule();
+ }
+
+ /**
+ * Load the specified viewID by creating a StapUIJob. Does not return until the StapUIJob has.
+ * Returns true if the makeView was successful, false otherwise.
+ */
+ private boolean makeView() {
+ // Create a UIJob to handle the rest
+ if (viewID != null && viewID.length() > 0) {
+ try {
+ StapUIJob uijob = new StapUIJob(
+ Messages.getString("StapGraphParser.JobName"), this, viewID); //$NON-NLS-1$
+ uijob.schedule();
+ uijob.join();
+ view = uijob.getViewer();
+ return true;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // Generate real-time job
+ IStatus returnStatus = Status.CANCEL_STATUS;
+ this.monitor = monitor;
+ if (this.monitor == null) {
+ this.monitor = new NullProgressMonitor();
+ }
+
+ makeView();
+ if (realTime) {
+ try {
+ setInternalData();
+ while (!done){
+ returnStatus = realTimeParsing();
+ if (monitor.isCanceled() || returnStatus == Status.CANCEL_STATUS) {
+ done = true;
+ return Status.CANCEL_STATUS;
+ }
+
+ Thread.sleep(500);
+ }
+ if (!monitor.isCanceled()) returnStatus = realTimeParsing();
+ done = true;
+ return returnStatus;
+ } catch (InterruptedException e) {
+ SystemTapUIErrorMessages m = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapParser.InternalData"), //$NON-NLS-1$
+ Messages.getString("SystemTapParser.FailedToSetData"), //$NON-NLS-1$
+ Messages.getString("SystemTapParser.FailedToSetDataMessage")); //$NON-NLS-1$
+ m.schedule();
+ return Status.CANCEL_STATUS;
+ } catch (FileNotFoundException e) {
+ SystemTapUIErrorMessages m = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapParser.InternalData"), //$NON-NLS-1$
+ Messages.getString("SystemTapParser.FailedToSetData"), //$NON-NLS-1$
+ Messages.getString("SystemTapParser.FailedToSetDataMessage")); //$NON-NLS-1$
+ m.schedule();
+ return Status.CANCEL_STATUS;
+ }
+ } else {
+ returnStatus = nonRealTimeParsing();
+ if (!returnStatus.isOK()){
+ return returnStatus;
+ }
+
+ setData(this);
+ return returnStatus;
+ }
+
+ }
+
+ /**
+ * For easier JUnit testing only. Allows public access to run method without
+ * scheduling an extra job.
+ *
+ * @param m
+ * @return
+ */
+ public IStatus testRun(IProgressMonitor m, boolean realTime) {
+ try {
+ internalData = new BufferedReader(new FileReader(new File(
+ sourcePath)));
+ if (realTime) {
+ return realTimeParsing();
+ } else {
+ return nonRealTimeParsing();
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ return Status.CANCEL_STATUS;
+ }
+
+
+ /**
+ * @return the Data object
+ */
+ public Object getData() {
+ return data;
+ }
+
+ /**
+ * Generic method for setting the internalData object. This will be called
+ * by a real-time-parser immediately before its main polling loop. By default,
+ * this method will attempt to create a bufferedReader around File(filePath)
+ * @throws FileNotFoundException
+ */
+ protected void setInternalData() throws FileNotFoundException {
+ File file = new File(sourcePath);
+ internalData = new BufferedReader(new FileReader(file));
+ }
+
+ /**
+ * Gets the file to read from
+ *
+ * @return
+ */
+ public String getFile() {
+ return sourcePath;
+ }
+
+ /**
+ * Sets the file to read from
+ *
+ * @param source
+ */
+ public void setSourcePath(String source) {
+ this.sourcePath = source;
+ }
+
+ /**
+ * Will terminate the parser at the next opportunity (~once every 0.5s)s
+ *
+ * @param val
+ */
+ public void setDone(boolean val) {
+ done = val;
+ }
+
+ public void setMonitor(IProgressMonitor m) {
+ this.monitor = m;
+ }
+
+ /**
+ * Set whether or not this parser runs in real time. If viewID has already
+ * been set, this will also attempt to open the view.
+ */
+ public void setRealTime(boolean val) {
+ realTime = val;
+
+ }
+
+ /**
+ * Set the viewID to use for this parser -- see the callgraph.core view
+ * extension point. If realTime is set to true, this will also attempt to
+ * open the view.
+ */
+ public void setViewID(String value) {
+ viewID = value;
+ }
+
+ /**
+ * Called at the end of a non-realtime run.
+ * Feel free to override this method if using non-realtime functions.
+ * The setData method will be called after executeParsing() is run.
+ * The getData() method will be used by the SystemTapView to get the
+ * data associated with this parser.
+ * <br><br>
+ * Alternatively, you can cast the parser within SystemTapView to your
+ * own parser class and access its data structures that way.
+ */
+ public void setData(Object obj) {
+ data = obj;
+ }
+
+ /**
+ * Sends a message to cancel the job. Job may not terminate immediately.
+ */
+ public void cancelJob() {
+ done = true;
+ }
+
+ public boolean isDone() {
+ return done;
+ }
+
+ public void setKillButtonEnabled(boolean val) {
+ if (view != null) {
+ view.setKillButtonEnabled(val);
+ }
+ }
+
+ public void setSecondaryID(String secondaryID) {
+ this.secondaryID = secondaryID;
+ }
+
+ public String getSecondaryID() {
+ return secondaryID;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextParser.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextParser.java
index c658ee2f70..14ee480726 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextParser.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextParser.java
@@ -18,47 +18,47 @@ import org.eclipse.core.runtime.Status;
public class SystemTapTextParser extends SystemTapParser{
- protected String contents;
+ protected String contents;
- @Override
- public IStatus nonRealTimeParsing() {
- contents = Helper.readFile(sourcePath);
- System.out.println(contents);
- return Status.OK_STATUS;
- }
+ @Override
+ public IStatus nonRealTimeParsing() {
+ contents = Helper.readFile(sourcePath);
+ System.out.println(contents);
+ return Status.OK_STATUS;
+ }
- @Override
- protected void initialize() {
- // Empty
- }
+ @Override
+ protected void initialize() {
+ // Empty
+ }
- @Override
- public IStatus realTimeParsing() {
- if (!(internalData instanceof BufferedReader)) {
- return Status.CANCEL_STATUS;
- }
+ @Override
+ public IStatus realTimeParsing() {
+ if (!(internalData instanceof BufferedReader)) {
+ return Status.CANCEL_STATUS;
+ }
- BufferedReader buff = (BufferedReader) internalData;
- StringBuffer text = new StringBuffer();
+ BufferedReader buff = (BufferedReader) internalData;
+ StringBuffer text = new StringBuffer();
- String line;
- try {
- while ((line = buff.readLine()) != null) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- text.append(line + "\n"); //$NON-NLS-1$
- }
- setData(text.toString());
- if (text.length() > 0) {
- System.out.println(text.toString());
- }
- view.update();
- } catch (IOException|InterruptedException e) {
- e.printStackTrace();
- }
+ String line;
+ try {
+ while ((line = buff.readLine()) != null) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ text.append(line + "\n"); //$NON-NLS-1$
+ }
+ setData(text.toString());
+ if (text.length() > 0) {
+ System.out.println(text.toString());
+ }
+ view.update();
+ } catch (IOException|InterruptedException e) {
+ e.printStackTrace();
+ }
- return Status.OK_STATUS;
- }
+ return Status.OK_STATUS;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextView.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextView.java
index 493cc5e707..b646b14162 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextView.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapTextView.java
@@ -26,209 +26,209 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
public class SystemTapTextView extends SystemTapView {
- private StyledText viewer;
-
- private Display display;
- private int previousEnd;
-
-
- /**
- * Passing the focus request to the viewer's control.
- */
- @Override
- public void setFocus() {
- if (viewer != null && !viewer.isDisposed()) {
- viewer.setFocus();
- }
- }
-
- private void createViewer(Composite parent) {
- viewer = new StyledText(parent, SWT.READ_ONLY | SWT.MULTI
- | SWT.V_SCROLL | SWT.WRAP);
-
- viewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- Font font = new Font(parent.getDisplay(), "Monospace", 11, SWT.NORMAL); //$NON-NLS-1$
- viewer.setFont(font);
- masterComposite = parent;
- display = masterComposite.getDisplay();
- }
-
- /**
- * Print with colour codes. Colour codes accepted in the form of ~(R,G,B)~,
- * and apply for the rest of the line or until another code is encountered
- * @param text
- */
- private void prettyPrintln(String text) {
- List<StyleRange> styles = new ArrayList<>();
- String[] txt = text.split("\\n"); //$NON-NLS-1$
- int lineOffset = 0;
- int inLineOffset;
-
- // txt[] contains text, with one entry for each new line
- for (String line: txt) {
-
- // Skip blank strings
- if (line.isEmpty()) {
- viewer.append(PluginConstants.NEW_LINE);
- continue;
- }
-
- // Search for colour codes, if none exist then continue
- String[] split_txt = line.split("~\\("); //$NON-NLS-1$
- if (split_txt.length == 1) {
- viewer.append(split_txt[0]);
- viewer.append(PluginConstants.NEW_LINE);
- continue;
- }
-
- inLineOffset = 0;
- for (String split: split_txt) {
- // Skip blank substrings
- if (split.isEmpty()) {
- continue;
- }
-
- // Split for the number codes
- String[] coloursAndText = split.split("\\)~"); //$NON-NLS-1$
-
- // If the string is properly formatted, colours should be length
- // 2
- // If it is not properly formatted, don't colour (just print)
- if (coloursAndText.length != 2) {
- for (String colourAndText: coloursAndText) {
- viewer.append(colourAndText);
- inLineOffset += colourAndText.length();
- }
- continue;
- }
-
- // The first element in the array should contain the colours
- String[] colours = coloursAndText[0].split(","); //$NON-NLS-1$
- if (colours.length < 3) {
- continue;
- }
-
- // The second element in the array should contain the text
- viewer.append(coloursAndText[1]);
-
- // Create a colour based on the 3 integers (if there are any
- // more integers, just ignore)
- int R = new Integer(colours[0].replaceAll(" ", "")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
- int G = new Integer(colours[1].replaceAll(" ", "")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
- int B = new Integer(colours[2].replaceAll(" ", "")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (R > 255) R = 255;
- if (G > 255) G = 255;
- if (B > 255) B = 255;
-
- if (R < 0) R = 0;
- if (G < 0) G = 0;
- if (B < 0) B = 0;
-
- Color newColor = new Color(display, R, G, B);
-
- // Find the offset of the current line
- lineOffset = viewer.getOffsetAtLine(viewer.getLineCount() - 1);
-
- // Create a new style that lasts no further than the length of
- // the line
- StyleRange newStyle = new StyleRange(lineOffset + inLineOffset,
- coloursAndText[1].length(), newColor, null);
- styles.add(newStyle);
-
- inLineOffset += coloursAndText[1].length();
- }
-
- viewer.append(PluginConstants.NEW_LINE);
- }
-
- // Create a new style range
- StyleRange[] s = new StyleRange[styles.size()];
- styles.toArray(s);
-
- int cnt = viewer.getCharCount();
-
- // Using replaceStyleRanges with previousEnd, etc, effectively adds
- // the StyleRange to the existing set of Style Ranges (so we don't
- // waste time fudging with old style ranges that haven't changed)
- viewer.replaceStyleRanges(previousEnd, cnt - previousEnd, s);
- previousEnd = cnt;
-
- // Change focus and update
- viewer.setTopIndex(viewer.getLineCount() - 1);
- viewer.update();
- }
-
- /**
- * Default print, just dumps text into the viewer.
- * @param text
- */
- public void println(String text) {
- if (viewer != null && !viewer.isDisposed()) {
- viewer.append(text);
- viewer.setTopIndex(viewer.getLineCount() - 1);
- viewer.update();
- }
- }
-
- public void clearAll() {
- if (viewer != null && !viewer.isDisposed()) {
- previousEnd = 0;
- viewer.setText(""); //$NON-NLS-1$
- viewer.update();
- }
- }
-
- /**
- * Testing convenience method to see what was printed
- *
- * @return viewer text
- */
- public String getText() {
- return viewer.getText();
- }
-
-
- @Override
- public IStatus initializeView(Display targetDisplay, IProgressMonitor monitor) {
- previousEnd = 0;
- viewer.setText(""); //$NON-NLS-1$
- viewer.update();
- return Status.OK_STATUS;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- createViewer(parent);
-
- addKillButton();
- addFileMenu();
- addHelpMenu();
- ViewFactory.addView(this);
- }
-
- @Override
- public void updateMethod() {
- if (getParser().getData() instanceof String) {
- String data = (String) getParser().getData();
- if (data.length() > 0) {
- prettyPrintln((String) getParser().getData());
- }
- }
- }
-
- @Override
- public void setViewID() {
- viewID = "org.eclipse.linuxtools.callgraph.core.staptextview"; //$NON-NLS-1$
- }
-
- @Override
- protected boolean createOpenAction() {
- return false;
- }
-
- @Override
- protected boolean createOpenDefaultAction() {
- return false;
- }
+ private StyledText viewer;
+
+ private Display display;
+ private int previousEnd;
+
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus() {
+ if (viewer != null && !viewer.isDisposed()) {
+ viewer.setFocus();
+ }
+ }
+
+ private void createViewer(Composite parent) {
+ viewer = new StyledText(parent, SWT.READ_ONLY | SWT.MULTI
+ | SWT.V_SCROLL | SWT.WRAP);
+
+ viewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ Font font = new Font(parent.getDisplay(), "Monospace", 11, SWT.NORMAL); //$NON-NLS-1$
+ viewer.setFont(font);
+ masterComposite = parent;
+ display = masterComposite.getDisplay();
+ }
+
+ /**
+ * Print with colour codes. Colour codes accepted in the form of ~(R,G,B)~,
+ * and apply for the rest of the line or until another code is encountered
+ * @param text
+ */
+ private void prettyPrintln(String text) {
+ List<StyleRange> styles = new ArrayList<>();
+ String[] txt = text.split("\\n"); //$NON-NLS-1$
+ int lineOffset = 0;
+ int inLineOffset;
+
+ // txt[] contains text, with one entry for each new line
+ for (String line: txt) {
+
+ // Skip blank strings
+ if (line.isEmpty()) {
+ viewer.append(PluginConstants.NEW_LINE);
+ continue;
+ }
+
+ // Search for colour codes, if none exist then continue
+ String[] split_txt = line.split("~\\("); //$NON-NLS-1$
+ if (split_txt.length == 1) {
+ viewer.append(split_txt[0]);
+ viewer.append(PluginConstants.NEW_LINE);
+ continue;
+ }
+
+ inLineOffset = 0;
+ for (String split: split_txt) {
+ // Skip blank substrings
+ if (split.isEmpty()) {
+ continue;
+ }
+
+ // Split for the number codes
+ String[] coloursAndText = split.split("\\)~"); //$NON-NLS-1$
+
+ // If the string is properly formatted, colours should be length
+ // 2
+ // If it is not properly formatted, don't colour (just print)
+ if (coloursAndText.length != 2) {
+ for (String colourAndText: coloursAndText) {
+ viewer.append(colourAndText);
+ inLineOffset += colourAndText.length();
+ }
+ continue;
+ }
+
+ // The first element in the array should contain the colours
+ String[] colours = coloursAndText[0].split(","); //$NON-NLS-1$
+ if (colours.length < 3) {
+ continue;
+ }
+
+ // The second element in the array should contain the text
+ viewer.append(coloursAndText[1]);
+
+ // Create a colour based on the 3 integers (if there are any
+ // more integers, just ignore)
+ int R = new Integer(colours[0].replaceAll(" ", "")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
+ int G = new Integer(colours[1].replaceAll(" ", "")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
+ int B = new Integer(colours[2].replaceAll(" ", "")).intValue(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (R > 255) R = 255;
+ if (G > 255) G = 255;
+ if (B > 255) B = 255;
+
+ if (R < 0) R = 0;
+ if (G < 0) G = 0;
+ if (B < 0) B = 0;
+
+ Color newColor = new Color(display, R, G, B);
+
+ // Find the offset of the current line
+ lineOffset = viewer.getOffsetAtLine(viewer.getLineCount() - 1);
+
+ // Create a new style that lasts no further than the length of
+ // the line
+ StyleRange newStyle = new StyleRange(lineOffset + inLineOffset,
+ coloursAndText[1].length(), newColor, null);
+ styles.add(newStyle);
+
+ inLineOffset += coloursAndText[1].length();
+ }
+
+ viewer.append(PluginConstants.NEW_LINE);
+ }
+
+ // Create a new style range
+ StyleRange[] s = new StyleRange[styles.size()];
+ styles.toArray(s);
+
+ int cnt = viewer.getCharCount();
+
+ // Using replaceStyleRanges with previousEnd, etc, effectively adds
+ // the StyleRange to the existing set of Style Ranges (so we don't
+ // waste time fudging with old style ranges that haven't changed)
+ viewer.replaceStyleRanges(previousEnd, cnt - previousEnd, s);
+ previousEnd = cnt;
+
+ // Change focus and update
+ viewer.setTopIndex(viewer.getLineCount() - 1);
+ viewer.update();
+ }
+
+ /**
+ * Default print, just dumps text into the viewer.
+ * @param text
+ */
+ public void println(String text) {
+ if (viewer != null && !viewer.isDisposed()) {
+ viewer.append(text);
+ viewer.setTopIndex(viewer.getLineCount() - 1);
+ viewer.update();
+ }
+ }
+
+ public void clearAll() {
+ if (viewer != null && !viewer.isDisposed()) {
+ previousEnd = 0;
+ viewer.setText(""); //$NON-NLS-1$
+ viewer.update();
+ }
+ }
+
+ /**
+ * Testing convenience method to see what was printed
+ *
+ * @return viewer text
+ */
+ public String getText() {
+ return viewer.getText();
+ }
+
+
+ @Override
+ public IStatus initializeView(Display targetDisplay, IProgressMonitor monitor) {
+ previousEnd = 0;
+ viewer.setText(""); //$NON-NLS-1$
+ viewer.update();
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ createViewer(parent);
+
+ addKillButton();
+ addFileMenu();
+ addHelpMenu();
+ ViewFactory.addView(this);
+ }
+
+ @Override
+ public void updateMethod() {
+ if (getParser().getData() instanceof String) {
+ String data = (String) getParser().getData();
+ if (data.length() > 0) {
+ prettyPrintln((String) getParser().getData());
+ }
+ }
+ }
+
+ @Override
+ public void setViewID() {
+ viewID = "org.eclipse.linuxtools.callgraph.core.staptextview"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected boolean createOpenAction() {
+ return false;
+ }
+
+ @Override
+ protected boolean createOpenDefaultAction() {
+ return false;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapUIErrorMessages.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapUIErrorMessages.java
index c7ec1b3bf6..ead7506ca6 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapUIErrorMessages.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapUIErrorMessages.java
@@ -24,35 +24,35 @@ import org.eclipse.ui.progress.UIJob;
*
*/
public class SystemTapUIErrorMessages extends UIJob {
- private String title, message;
- private static boolean active = true;
+ private String title, message;
+ private static boolean active = true;
- public SystemTapUIErrorMessages(String name, String title, String message) {
- super(name);
- this.title = title;
- this.message = message;
- }
+ public SystemTapUIErrorMessages(String name, String title, String message) {
+ super(name);
+ this.title = title;
+ this.message = message;
+ }
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!active) {
- return Status.CANCEL_STATUS;
- }
- //Test that this job is running in the UI thread
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!active) {
+ return Status.CANCEL_STATUS;
+ }
+ //Test that this job is running in the UI thread
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return Status.CANCEL_STATUS; //Something is wrong!
- }
+ if (window == null) {
+ return Status.CANCEL_STATUS; //Something is wrong!
+ }
- Shell sh = new Shell();
+ Shell sh = new Shell();
- MessageDialog.openError(sh, title, message);
- return Status.OK_STATUS;
- }
+ MessageDialog.openError(sh, title, message);
+ return Status.OK_STATUS;
+ }
- public static void setActive(boolean val) {
- active = val;
- }
+ public static void setActive(boolean val) {
+ active = val;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapView.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapView.java
index fd74e61757..5294858310 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapView.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapView.java
@@ -140,7 +140,7 @@ public abstract class SystemTapView extends ViewPart {
* @return
*/
public SystemTapParser getParser() {
- return parser;
+ return parser;
}
/**
@@ -152,11 +152,11 @@ public abstract class SystemTapView extends ViewPart {
* @return
*/
public boolean setParser(SystemTapParser parser) {
- this.parser = parser;
- if (this.parser == null) {
- return false;
+ this.parser = parser;
+ if (this.parser == null) {
+ return false;
}
- return true;
+ return true;
}
/**
@@ -231,9 +231,9 @@ public abstract class SystemTapView extends ViewPart {
private void createHelpActions() {
helpVersion = new Action(Messages.getString("SystemTapView.Version")) { //$NON-NLS-1$
@Override
- public void run() {
+ public void run() {
try {
- Process pr = RuntimeProcessFactory.getFactory().exec("stap -V", null); //$NON-NLS-1$
+ Process pr = RuntimeProcessFactory.getFactory().exec("stap -V", null); //$NON-NLS-1$
BufferedReader buf = new BufferedReader(
new InputStreamReader(pr.getErrorStream()));
String line = ""; //$NON-NLS-1$
@@ -265,7 +265,7 @@ public abstract class SystemTapView extends ViewPart {
//Save callgraph.out
saveFile = new Action(Messages.getString("SystemTapView.SaveMenu")){ //$NON-NLS-1$
@Override
- public void run(){
+ public void run(){
Shell sh = new Shell();
FileDialog dialog = new FileDialog(sh, SWT.SAVE);
String filePath = dialog.open();
@@ -283,7 +283,7 @@ public abstract class SystemTapView extends ViewPart {
kill = new Action(Messages.getString("SystemTapView.StopScript"), //$NON-NLS-1$
AbstractUIPlugin.imageDescriptorFromPlugin(CallgraphCorePlugin.PLUGIN_ID, "icons/progress_stop.gif")) { //$NON-NLS-1$
@Override
- public void run() {
+ public void run() {
getParser().cancelJob();
}
};
@@ -306,33 +306,33 @@ public abstract class SystemTapView extends ViewPart {
* @param sourcePath
*/
public void saveData(String targetFile) {
- try {
- File file = new File(targetFile);
- file.delete();
- file.createNewFile();
-
- File sFile = new File(sourcePath);
- if (!sFile.exists()) {
- return;
- }
-
- try (FileInputStream fileIn = new FileInputStream(sFile); FileOutputStream fileOut = new FileOutputStream(file);
- FileChannel channelIn = fileIn.getChannel(); FileChannel channelOut = fileOut.getChannel()){
-
- if (channelIn == null || channelOut == null) {
- return;
- }
-
- long size = channelIn.size();
- MappedByteBuffer buf = channelIn.map(
- FileChannel.MapMode.READ_ONLY, 0, size);
-
- channelOut.write(buf);
- }
- } catch (IOException e) {
- CallgraphCorePlugin.logException(e);
- }
- }
+ try {
+ File file = new File(targetFile);
+ file.delete();
+ file.createNewFile();
+
+ File sFile = new File(sourcePath);
+ if (!sFile.exists()) {
+ return;
+ }
+
+ try (FileInputStream fileIn = new FileInputStream(sFile); FileOutputStream fileOut = new FileOutputStream(file);
+ FileChannel channelIn = fileIn.getChannel(); FileChannel channelOut = fileOut.getChannel()){
+
+ if (channelIn == null || channelOut == null) {
+ return;
+ }
+
+ long size = channelIn.size();
+ MappedByteBuffer buf = channelIn.map(
+ FileChannel.MapMode.READ_ONLY, 0, size);
+
+ channelOut.write(buf);
+ }
+ } catch (IOException e) {
+ CallgraphCorePlugin.logException(e);
+ }
+ }
public void setSourcePath(String file) {
sourcePath = file;
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/ViewFactory.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/ViewFactory.java
index 265e98243e..ca31107d83 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/ViewFactory.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/ViewFactory.java
@@ -25,75 +25,75 @@ import org.eclipse.ui.PlatformUI;
*/
public class ViewFactory {
- private static List<IViewPart> views;
- private static SystemTapView newView;
+ private static List<IViewPart> views;
+ private static SystemTapView newView;
- /**
- * Create a view of type designated by the viewID argument
- * @param viewID : A string corresponding to a type of View
- * @return : The view object that corresponds to the viewID
- */
- public static SystemTapView createView(final String viewID) {
- Display.getDefault().syncExec(new Runnable() {
+ /**
+ * Create a view of type designated by the viewID argument
+ * @param viewID : A string corresponding to a type of View
+ * @return : The view object that corresponds to the viewID
+ */
+ public static SystemTapView createView(final String viewID) {
+ Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- IViewPart view = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().
- showView(viewID);
- if (!(view instanceof SystemTapView)) {
- return;
- }
+ @Override
+ public void run() {
+ try {
+ IViewPart view = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().
+ showView(viewID);
+ if (!(view instanceof SystemTapView)) {
+ return;
+ }
- newView = ((SystemTapView) view);
- newView.setViewID();
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- });
+ newView = ((SystemTapView) view);
+ newView.setViewID();
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ });
- addView(newView);
- return newView;
- }
+ addView(newView);
+ return newView;
+ }
- /**
- * Create a view of type designated by the viewID argument
- * @param viewID : A string corresponding to a type of View
- * @return : The view object that corresponds to the viewID
- */
- public static SystemTapView createView(final String viewID, final String secondaryID) {
- Display.getDefault().syncExec(new Runnable() {
+ /**
+ * Create a view of type designated by the viewID argument
+ * @param viewID : A string corresponding to a type of View
+ * @return : The view object that corresponds to the viewID
+ */
+ public static SystemTapView createView(final String viewID, final String secondaryID) {
+ Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- IViewPart view = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().showView(viewID, secondaryID, IWorkbenchPage.VIEW_VISIBLE);
- if (!(view instanceof SystemTapView)) {
- return;
- }
- newView = ((SystemTapView) view);
- newView.setViewID();
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- });
+ @Override
+ public void run() {
+ try {
+ IViewPart view = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().showView(viewID, secondaryID, IWorkbenchPage.VIEW_VISIBLE);
+ if (!(view instanceof SystemTapView)) {
+ return;
+ }
+ newView = ((SystemTapView) view);
+ newView.setViewID();
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ });
- addView(newView);
- return newView;
- }
+ addView(newView);
+ return newView;
+ }
- /**
- * Adds a view to the factory's list of active SystemTapViews.
- */
- public static void addView(SystemTapView view) {
- if (views == null) {
- views = new ArrayList<>();
- }
- views.add(view);
- }
+ /**
+ * Adds a view to the factory's list of active SystemTapViews.
+ */
+ public static void addView(SystemTapView view) {
+ if (views == null) {
+ views = new ArrayList<>();
+ }
+ views.add(view);
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/XMLParser.java b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/XMLParser.java
index 70d78cf9ad..8f39292c15 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/XMLParser.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/XMLParser.java
@@ -21,168 +21,168 @@ import java.util.Map;
public class XMLParser {
- private Map<Integer, HashMap<String,String>> keyValues;
- private List<Integer> idList;
- private int id;
- private int currentlyIn;
- private static final String ATTR_NAME = "name"; //$NON-NLS-1$
- private static final String ATTR_TEXT = "text"; //$NON-NLS-1$
- private static final String noName = "NoName"; //$NON-NLS-1$
- private boolean textMode;
- XMLParser() {
- id = 0;
- currentlyIn = 0;
- if (keyValues != null) {
- keyValues.clear();
- }
- keyValues = new HashMap<>();
-
- if (idList != null) {
- idList.clear();
- }
- idList = new ArrayList<>();
-
- textMode = false;
- }
-
- /**
- * Helper method to call parse on the contents of a file.
- * @param file
- */
- public void parse(File file) {
- parse(getContents(file));
- }
-
-
- /**
- * Parses a String according to XML formatting rules. Will return a HashMap indexed by an
- * identification number, where each value is a further HashMap of String, String pairs representing
- * attributes.
- * @param message
- */
- public void parse(String message) {
- String tabstrip = message.replaceAll("\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
- String[] lines = tabstrip.split("\n"); //$NON-NLS-1$
-
- for (String line : lines) {
- if (line.length() < 1) {
- continue;
- }
-
- if (line.charAt(0) == '<') {
- //Either an open or close tag
- if (line.charAt(1) == '/') {
- //Closing tag -- assume properly formed
- idList.remove((Integer) currentlyIn);
- currentlyIn = -1;
- if (idList.size() > 0) {
- currentlyIn = idList.get(idList.size()-1);
- }
- setTextMode(true);
-
- } else if (line.substring(line.length()-2, line.length() - 1).equals("/>")) { //$NON-NLS-1$
- //This tag opens and closes in one line
- id++;
- String[] tokens = line.split(" "); //$NON-NLS-1$
- HashMap<String,String> map = new HashMap<>();
- map.put(ATTR_NAME, tokens[0]);
- keyValues.put(id,map);
- textMode = false;
- addAttributes(currentlyIn, tokens, 1);
-
- } else {
- //Open tag
- idList.add(id);
- id++;
- currentlyIn = id;
-
- String[] tokens = line.split(" "); //$NON-NLS-1$
-
- //Add name variable
- HashMap<String,String> map = new HashMap<>();
- map.put(ATTR_NAME, tokens[0]);
- keyValues.put(id,map);
-
- addAttributes(currentlyIn, tokens, 1);
- }
- } else {
- //Attribute addition
- if (currentlyIn < 0 ) {
- continue;
- }
-
- if (textMode) {
- HashMap<String,String> map = keyValues.get(currentlyIn);
- map.put(ATTR_TEXT, line);
- }
-
- String[] tokens = line.split(" "); //$NON-NLS-1$
- addAttributes(currentlyIn, tokens, 0);
- }
- }
- }
-
- /**
- * Turns an array of Strings of form attribute=value into attribute/value pairings for the specified node.
- * Starts looking at token number start.
- * @param tokens
- * @param start
- */
- private void addAttributes(int id, String[] tokens, int start) {
- HashMap<String,String> map = keyValues.get(id);
- int nameless = 0;
-
-
- for (int j = start; j < tokens.length; j++) {
- String[] kvPair = tokens[j].split("="); //$NON-NLS-1$
- String value = ""; //$NON-NLS-1$
- String key = ""; //$NON-NLS-1$
- if (kvPair.length < 1) {
- continue;
- }
-
- if (kvPair.length < 2) {
- value = kvPair[0];
- if (value.charAt(value.length() - 1) == '>') {
-
- setTextMode(true);
- value = value.substring(0, value.length()-1);
- }
- map.put(noName + nameless, value);
- nameless++;
- continue;
- }
-
- value = kvPair[0];
- key = kvPair[1];
- if (value.charAt(value.length() - 1) == '>') {
- setTextMode(true);
- value = value.substring(0, value.length()-1);
- }
-
- map.put(key, value);
- }
-
- keyValues.put(id, map);
- }
-
- private static String getContents(File file) {
- StringBuilder contents = new StringBuilder();
-
- try (BufferedReader input = new BufferedReader(new FileReader(file))) {
- String line = null;
- while ((line = input.readLine()) != null) {
- contents.append(line);
- contents.append("\n"); //$NON-NLS-1$
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- }
-
- return contents.toString();
- }
-
- private void setTextMode(boolean val) {
- textMode = val;
- }
+ private Map<Integer, HashMap<String,String>> keyValues;
+ private List<Integer> idList;
+ private int id;
+ private int currentlyIn;
+ private static final String ATTR_NAME = "name"; //$NON-NLS-1$
+ private static final String ATTR_TEXT = "text"; //$NON-NLS-1$
+ private static final String noName = "NoName"; //$NON-NLS-1$
+ private boolean textMode;
+ XMLParser() {
+ id = 0;
+ currentlyIn = 0;
+ if (keyValues != null) {
+ keyValues.clear();
+ }
+ keyValues = new HashMap<>();
+
+ if (idList != null) {
+ idList.clear();
+ }
+ idList = new ArrayList<>();
+
+ textMode = false;
+ }
+
+ /**
+ * Helper method to call parse on the contents of a file.
+ * @param file
+ */
+ public void parse(File file) {
+ parse(getContents(file));
+ }
+
+
+ /**
+ * Parses a String according to XML formatting rules. Will return a HashMap indexed by an
+ * identification number, where each value is a further HashMap of String, String pairs representing
+ * attributes.
+ * @param message
+ */
+ public void parse(String message) {
+ String tabstrip = message.replaceAll("\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ String[] lines = tabstrip.split("\n"); //$NON-NLS-1$
+
+ for (String line : lines) {
+ if (line.length() < 1) {
+ continue;
+ }
+
+ if (line.charAt(0) == '<') {
+ //Either an open or close tag
+ if (line.charAt(1) == '/') {
+ //Closing tag -- assume properly formed
+ idList.remove((Integer) currentlyIn);
+ currentlyIn = -1;
+ if (idList.size() > 0) {
+ currentlyIn = idList.get(idList.size()-1);
+ }
+ setTextMode(true);
+
+ } else if (line.substring(line.length()-2, line.length() - 1).equals("/>")) { //$NON-NLS-1$
+ //This tag opens and closes in one line
+ id++;
+ String[] tokens = line.split(" "); //$NON-NLS-1$
+ HashMap<String,String> map = new HashMap<>();
+ map.put(ATTR_NAME, tokens[0]);
+ keyValues.put(id,map);
+ textMode = false;
+ addAttributes(currentlyIn, tokens, 1);
+
+ } else {
+ //Open tag
+ idList.add(id);
+ id++;
+ currentlyIn = id;
+
+ String[] tokens = line.split(" "); //$NON-NLS-1$
+
+ //Add name variable
+ HashMap<String,String> map = new HashMap<>();
+ map.put(ATTR_NAME, tokens[0]);
+ keyValues.put(id,map);
+
+ addAttributes(currentlyIn, tokens, 1);
+ }
+ } else {
+ //Attribute addition
+ if (currentlyIn < 0 ) {
+ continue;
+ }
+
+ if (textMode) {
+ HashMap<String,String> map = keyValues.get(currentlyIn);
+ map.put(ATTR_TEXT, line);
+ }
+
+ String[] tokens = line.split(" "); //$NON-NLS-1$
+ addAttributes(currentlyIn, tokens, 0);
+ }
+ }
+ }
+
+ /**
+ * Turns an array of Strings of form attribute=value into attribute/value pairings for the specified node.
+ * Starts looking at token number start.
+ * @param tokens
+ * @param start
+ */
+ private void addAttributes(int id, String[] tokens, int start) {
+ HashMap<String,String> map = keyValues.get(id);
+ int nameless = 0;
+
+
+ for (int j = start; j < tokens.length; j++) {
+ String[] kvPair = tokens[j].split("="); //$NON-NLS-1$
+ String value = ""; //$NON-NLS-1$
+ String key = ""; //$NON-NLS-1$
+ if (kvPair.length < 1) {
+ continue;
+ }
+
+ if (kvPair.length < 2) {
+ value = kvPair[0];
+ if (value.charAt(value.length() - 1) == '>') {
+
+ setTextMode(true);
+ value = value.substring(0, value.length()-1);
+ }
+ map.put(noName + nameless, value);
+ nameless++;
+ continue;
+ }
+
+ value = kvPair[0];
+ key = kvPair[1];
+ if (value.charAt(value.length() - 1) == '>') {
+ setTextMode(true);
+ value = value.substring(0, value.length()-1);
+ }
+
+ map.put(key, value);
+ }
+
+ keyValues.put(id, map);
+ }
+
+ private static String getContents(File file) {
+ StringBuilder contents = new StringBuilder();
+
+ try (BufferedReader input = new BufferedReader(new FileReader(file))) {
+ String line = null;
+ while ((line = input.readLine()) != null) {
+ contents.append(line);
+ contents.append("\n"); //$NON-NLS-1$
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+
+ return contents.toString();
+ }
+
+ private void setTextMode(boolean val) {
+ textMode = val;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.docs/build-doc.xml b/systemtap/org.eclipse.linuxtools.callgraph.docs/build-doc.xml
index c19d6e84d6..4b6161bf65 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.docs/build-doc.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.docs/build-doc.xml
@@ -11,62 +11,62 @@
-->
<project name="org.eclipse.mylyn.wikitext.example" default="all">
- <description>
+ <description>
Generate Eclipse help content from the Eclipsepedia wiki
</description>
- <property name="help.doc.url.base" value="http://wiki.eclipse.org" />
- <property name="imageFolder" value="images" />
+ <property name="help.doc.url.base" value="http://wiki.eclipse.org" />
+ <property name="imageFolder" value="images" />
- <path id="wikitext.tasks.classpath">
- <!-- Replace dir with the dir you have wikitext installed into.-->
- <fileset dir="/usr/share/eclipse/dropins/mylyn/eclipse/plugins">
- <include name="org.eclipse.mylyn.wikitext.*core*.jar" />
- </fileset>
- </path>
+ <path id="wikitext.tasks.classpath">
+ <!-- Replace dir with the dir you have wikitext installed into.-->
+ <fileset dir="/usr/share/eclipse/dropins/mylyn/eclipse/plugins">
+ <include name="org.eclipse.mylyn.wikitext.*core*.jar" />
+ </fileset>
+ </path>
- <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties" />
- <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" />
+ <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties" />
+ <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" />
- <target name="all" description="Generate Eclipse help content for the Linux Tools Callgraph user guide">
- <mediawiki-to-eclipse-help wikiBaseUrl="${help.doc.url.base}" title="Callgraph User Guide" formatoutput="true" dest="." templateExcludes="*eclipseproject*">
+ <target name="all" description="Generate Eclipse help content for the Linux Tools Callgraph user guide">
+ <mediawiki-to-eclipse-help wikiBaseUrl="${help.doc.url.base}" title="Callgraph User Guide" formatoutput="true" dest="." templateExcludes="*eclipseproject*">
- <path name="Linux_Tools_Project/Callgraph/User_Guide" title="Callgraph User Guide" generateToc="false" />
- <stylesheet url="book.css" />
- <pageAppendum>
- = Updating This Document =
+ <path name="Linux_Tools_Project/Callgraph/User_Guide" title="Callgraph User Guide" generateToc="false" />
+ <stylesheet url="book.css" />
+ <pageAppendum>
+ = Updating This Document =
- This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
- http://wiki.eclipse.org/Linux_Tools_Project/Callgraph/User_Guide .
- </pageAppendum>
- </mediawiki-to-eclipse-help>
- <antcall target="test" />
- </target>
+ This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
+ http://wiki.eclipse.org/Linux_Tools_Project/Callgraph/User_Guide .
+ </pageAppendum>
+ </mediawiki-to-eclipse-help>
+ <antcall target="test" />
+ </target>
- <target name="test" description="verify that all of the HTML files are well-formed XML">
- <echo level="info">
+ <target name="test" description="verify that all of the HTML files are well-formed XML">
+ <echo level="info">
Validating help content XML and HTML files: The Eclipse help system expects well-formed XML
-
+
If validation fails it is because either:
-
+
* the userguide source code is poorly formed, or
* the WikiText MediaWiki parser has a bug
-
+
Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source,
or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block)
- </echo>
+ </echo>
- <!--
- Don't bother with DTD validation: we only care if the files are well-formed.
- We therefore provide an empty DTD
- -->
- <echo file="tmp/__empty.dtd" message="" />
- <xmlvalidate lenient="true">
- <fileset dir="Linux_Tools_Project">
- <include name="**/*.html" />
- </fileset>
- <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd" />
- </xmlvalidate>
- <delete dir="tmp" />
- </target>
+ <!--
+ Don't bother with DTD validation: we only care if the files are well-formed.
+ We therefore provide an empty DTD
+ -->
+ <echo file="tmp/__empty.dtd" message="" />
+ <xmlvalidate lenient="true">
+ <fileset dir="Linux_Tools_Project">
+ <include name="**/*.html" />
+ </fileset>
+ <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd" />
+ </xmlvalidate>
+ <delete dir="tmp" />
+ </target>
</project>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.docs/toc-doc.xml b/systemtap/org.eclipse.linuxtools.callgraph.docs/toc-doc.xml
index 87e0e40bff..03325308b8 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.docs/toc-doc.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.docs/toc-doc.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<toc topic="Linux_Tools_Project/Callgraph/User_Guide/User-Guide.html" label="Callgraph User Guide">
-<link toc="toc.xml" />
-<topic href="notices.html" label="Legal" />
+<link toc="toc.xml" />
+<topic href="notices.html" label="Legal" />
</toc>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.docs/toc.xml b/systemtap/org.eclipse.linuxtools.callgraph.docs/toc.xml
index 1431d7206f..e8f26b1f31 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.docs/toc.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.docs/toc.xml
@@ -1,21 +1,21 @@
<?xml version='1.0' encoding='utf-8' ?>
<toc topic="Linux_Tools_Project/Callgraph/User_Guide/User-Guide.html" label="Callgraph User Guide">
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/User-Guide.html" label="Callgraph User Guide">
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/User-Guide.html" label="Overview"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Installation.html" label="Installation"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage.html" label="General Usage"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html" label="Callgraph Perspectives">
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Radial_View" label="Radial View"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Tree_View" label="Tree View"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Level_View" label="Level View"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Aggregate_View" label="Aggregate View"></topic>
- </topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html" label="General Usage">
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Collapse_Mode" label="Collapse Mode"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Watching_function_calls_in_chronological_order" label="Watching function calls in chronological order"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Code_link" label="Code link"></topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Save.2Fload_profile_runs" label="Save/load profile runs"></topic>
- </topic>
- <topic href="Linux_Tools_Project/Callgraph/User_Guide/Updating-This-Document.html" label="Updating This Document"></topic>
- </topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/User-Guide.html" label="Callgraph User Guide">
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/User-Guide.html" label="Overview"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Installation.html" label="Installation"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage.html" label="General Usage"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html" label="Callgraph Perspectives">
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Radial_View" label="Radial View"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Tree_View" label="Tree View"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Level_View" label="Level View"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Callgraph-Perspectives.html#Aggregate_View" label="Aggregate View"></topic>
+ </topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html" label="General Usage">
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Collapse_Mode" label="Collapse Mode"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Watching_function_calls_in_chronological_order" label="Watching function calls in chronological order"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Code_link" label="Code link"></topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/General-Usage2.html#Save.2Fload_profile_runs" label="Save/load profile runs"></topic>
+ </topic>
+ <topic href="Linux_Tools_Project/Callgraph/User_Guide/Updating-This-Document.html" label="Updating This Document"></topic>
+ </topic>
</toc> \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/pom.xml b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/pom.xml
index c462f3b22f..aad27f361f 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/pom.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/pom.xml
@@ -35,7 +35,7 @@
</excludes>
<testSuite>org.eclipse.linuxtools.callgraph.launch.tests</testSuite>
<testClass>org.eclipse.linuxtools.callgraph.launch.tests.AllTests</testClass>
- <useUIHarness>true</useUIHarness>
+ <useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<product>org.eclipse.platform.ide</product>
</configuration>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
index f11bde40cd..13431f198f 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
- <section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
- <item value="true" key="group_libraries"/>
- <item value="false" key="linkWithEditor"/>
- <item value="2" key="layout"/>
- <item value="1" key="rootMode"/>
- <item value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0A;&lt;packageExplorer group_libraries=&quot;1&quot; layout=&quot;2&quot; linkWithEditor=&quot;0&quot; rootMode=&quot;1&quot; workingSetName=&quot;Aggregate for window 1253542278535&quot;&gt;&#x0A;&lt;customFilters userDefinedPatternsEnabled=&quot;false&quot;&gt;&#x0A;&lt;xmlDefinedFilters&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.StaticsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.ExternalPluginLibrariesFilter1&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.FieldsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.BinaryProjectFilter1&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.mylyn.java.ui.MembersFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;/xmlDefinedFilters&gt;&#x0A;&lt;/customFilters&gt;&#x0A;&lt;/packageExplorer&gt;" key="memento"/>
- </section>
+ <section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
+ <item value="true" key="group_libraries"/>
+ <item value="false" key="linkWithEditor"/>
+ <item value="2" key="layout"/>
+ <item value="1" key="rootMode"/>
+ <item value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0A;&lt;packageExplorer group_libraries=&quot;1&quot; layout=&quot;2&quot; linkWithEditor=&quot;0&quot; rootMode=&quot;1&quot; workingSetName=&quot;Aggregate for window 1253542278535&quot;&gt;&#x0A;&lt;customFilters userDefinedPatternsEnabled=&quot;false&quot;&gt;&#x0A;&lt;xmlDefinedFilters&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.StaticsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.ExternalPluginLibrariesFilter1&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.FieldsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.BinaryProjectFilter1&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0A;&lt;child filterId=&quot;org.eclipse.mylyn.java.ui.MembersFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0A;&lt;/xmlDefinedFilters&gt;&#x0A;&lt;/customFilters&gt;&#x0A;&lt;/packageExplorer&gt;" key="memento"/>
+ </section>
</section>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml
index 27eb4040f4..d8e25565f4 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
- <section name="RefactoringWizard.preview">
- <item value="400" key="height"/>
- <item value="600" key="width"/>
- </section>
+ <section name="RefactoringWizard.preview">
+ <item value="400" key="height"/>
+ <item value="600" key="width"/>
+ </section>
</section>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml
index eed015db7b..554cbca74e 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
- <section name="ExternalProjectImportWizard">
- <item value="false" key="WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"/>
- <item value="true" key="WizardProjectsImportPage.STORE_COPY_PROJECT_ID"/>
- </section>
+ <section name="ExternalProjectImportWizard">
+ <item value="false" key="WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"/>
+ <item value="true" key="WizardProjectsImportPage.STORE_COPY_PROJECT_ID"/>
+ </section>
</section>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml
index 5b583c4bea..7c9d4e8b32 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/resources/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
- <section name="ImportExportAction">
- </section>
+ <section name="ImportExportAction">
+ </section>
</section>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AbstractStapTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AbstractStapTest.java
index 6fab0e16ec..f3d3504079 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AbstractStapTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AbstractStapTest.java
@@ -30,42 +30,42 @@ import org.osgi.framework.FrameworkUtil;
public class AbstractStapTest extends AbstractTest {
- @Override
- protected ILaunchConfigurationType getLaunchConfigType() {
- return getLaunchManager().getLaunchConfigurationType(PluginConstants.CONFIGURATION_TYPE_ID);
- }
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(PluginConstants.CONFIGURATION_TYPE_ID);
+ }
- @Override
- protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) {
- ILaunchConfigurationTab tab = new SystemTapOptionsTab();
- tab.setDefaults(wc);
- }
+ @Override
+ protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) {
+ ILaunchConfigurationTab tab = new SystemTapOptionsTab();
+ tab.setDefaults(wc);
+ }
- protected ICProject createProjectAndBuild(String projname) throws Exception {
- return createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), projname);
- }
+ protected ICProject createProjectAndBuild(String projname) throws Exception {
+ return createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), projname);
+ }
- public void killStap() {
- try {
- RuntimeProcessFactory.getFactory().exec("kill stap", null);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ public void killStap() {
+ try {
+ RuntimeProcessFactory.getFactory().exec("kill stap", null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
- private List<ILaunch> launches;
+ private List<ILaunch> launches;
- @Before
- public void setUp() {
- launches = new ArrayList<>();
- }
+ @Before
+ public void setUp() {
+ launches = new ArrayList<>();
+ }
- @After
- public void tearDown() {
- if (!launches.isEmpty()) {
- DebugPlugin.getDefault().getLaunchManager().removeLaunches(launches.toArray(new ILaunch[launches.size()]));
- launches.clear();
- }
- }
+ @After
+ public void tearDown() {
+ if (!launches.isEmpty()) {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunches(launches.toArray(new ILaunch[launches.size()]));
+ launches.clear();
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AllTests.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AllTests.java
index bb21b2d9d3..c8cddd4cfd 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AllTests.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AllTests.java
@@ -15,7 +15,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ SystemTapCommandTest.class, ConfigurationTest.class,
- SystemTapCommandGeneratorTest.class, SystemTapTabTest.class,
- LaunchShortcutsTest.class, SystemTapErrorHandlerTest.class })
+ SystemTapCommandGeneratorTest.class, SystemTapTabTest.class,
+ LaunchShortcutsTest.class, SystemTapErrorHandlerTest.class })
public class AllTests {
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/ConfigurationTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/ConfigurationTest.java
index d24d0db486..7ebb84f85e 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/ConfigurationTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/ConfigurationTest.java
@@ -26,86 +26,86 @@ import org.junit.Test;
public class ConfigurationTest extends AbstractStapTest {
- /**
- * This test checks if the commands sent by SystemTap match exactly the options
- * that are set. Uses the delegate.launch() function.
- *
- * Activates all options!
- * @throws CoreException
- */
- @Test
- public void testConfig() throws CoreException {
-
- LaunchStapGraph shortcut = new LaunchStapGraph();
-
- String testCDirectives = "-DRandomjunk -DMoreJunk";
- String testOutputPath = "/tmp/ThisFileDoesNothingDeleteIt";
- String testBinaryPath = "/path/to/binary";
- String testScriptPath = "/tmp/NotAScriptFile.stp";
- String testArguments = "/path/to/binary";
- int testPid = 413;
- int testBuffer = 100;
- int testPass = 10;
-
- ILaunchConfiguration config = shortcut.outsideGetLaunchConfigType()
- .newInstance(null, "Temp name");
- ILaunchConfigurationWorkingCopy wc = config
- .copy("Testing configuration");
-
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, 1);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY,
- true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_GURU, true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH,
- true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION,
- true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS,
- true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE,
- true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING,
- true);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_PASS, testPass);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES,
- testBuffer);
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID,
- testPid);
-
- wc.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,
- testCDirectives);
- wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH,
- testBinaryPath);
- wc.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,
- testScriptPath);
- wc.setAttribute(LaunchConfigurationConstants.ARGUMENTS, testArguments);
- wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,
- testOutputPath);
-
- config = wc.doSave();
-
- SystemTapLaunchConfigurationDelegate del = new SystemTapLaunchConfigurationDelegate();
- del.launch(config, "profile", null, null);
-
- assertEquals("stap -v -p" + testPass + " -k -g -P -u -w -b -t -s"
- + testBuffer + " -x" + testPid + " " + testCDirectives
- + " -F --skip-badvars --ignore-dwarf -q " + " -c '" + testBinaryPath
- + "' " + testScriptPath + " --runtime=dyninst " + testArguments + " >& "
- + testOutputPath,
- del.generateCommand());
-
- killStap();
- }
-
- @After
- public void deleteFiles() {
- File file = new File("/tmp/ThisFileDoesNothingDeleteIt");
- if (file.exists()) {
- file.delete();
- }
- }
+ /**
+ * This test checks if the commands sent by SystemTap match exactly the options
+ * that are set. Uses the delegate.launch() function.
+ *
+ * Activates all options!
+ * @throws CoreException
+ */
+ @Test
+ public void testConfig() throws CoreException {
+
+ LaunchStapGraph shortcut = new LaunchStapGraph();
+
+ String testCDirectives = "-DRandomjunk -DMoreJunk";
+ String testOutputPath = "/tmp/ThisFileDoesNothingDeleteIt";
+ String testBinaryPath = "/path/to/binary";
+ String testScriptPath = "/tmp/NotAScriptFile.stp";
+ String testArguments = "/path/to/binary";
+ int testPid = 413;
+ int testBuffer = 100;
+ int testPass = 10;
+
+ ILaunchConfiguration config = shortcut.outsideGetLaunchConfigType()
+ .newInstance(null, "Temp name");
+ ILaunchConfigurationWorkingCopy wc = config
+ .copy("Testing configuration");
+
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, 1);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY,
+ true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_GURU, true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH,
+ true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION,
+ true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS,
+ true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE,
+ true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING,
+ true);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_PASS, testPass);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES,
+ testBuffer);
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID,
+ testPid);
+
+ wc.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,
+ testCDirectives);
+ wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH,
+ testBinaryPath);
+ wc.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,
+ testScriptPath);
+ wc.setAttribute(LaunchConfigurationConstants.ARGUMENTS, testArguments);
+ wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,
+ testOutputPath);
+
+ config = wc.doSave();
+
+ SystemTapLaunchConfigurationDelegate del = new SystemTapLaunchConfigurationDelegate();
+ del.launch(config, "profile", null, null);
+
+ assertEquals("stap -v -p" + testPass + " -k -g -P -u -w -b -t -s"
+ + testBuffer + " -x" + testPid + " " + testCDirectives
+ + " -F --skip-badvars --ignore-dwarf -q " + " -c '" + testBinaryPath
+ + "' " + testScriptPath + " --runtime=dyninst " + testArguments + " >& "
+ + testOutputPath,
+ del.generateCommand());
+
+ killStap();
+ }
+
+ @After
+ public void deleteFiles() {
+ File file = new File("/tmp/ThisFileDoesNothingDeleteIt");
+ if (file.exists()) {
+ file.delete();
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/LaunchShortcutsTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/LaunchShortcutsTest.java
index bbf83bb2aa..6592b663b9 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/LaunchShortcutsTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/LaunchShortcutsTest.java
@@ -20,39 +20,39 @@ import org.junit.Test;
public class LaunchShortcutsTest extends AbstractStapTest {
- /**
- * Checks that the scripts are correct/exist and that the expected command
- * is sent.
- */
-
- @Before
- public void prep() throws Exception {
- proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$
- }
-
- @After
- public void clean() throws Exception {
- deleteProject(proj);
- }
-
- @Test
- public void testLaunchCallGraph() throws CModelException {
- SystemTapUIErrorMessages.setActive(false);
-
- LaunchStapGraph launch = new LaunchStapGraph();
- launch.setTestMode(true);
-
- IBinary bin = proj.getBinaryContainer().getBinaries()[0];
- launch.launch(bin, "profile");
- String script = launch.getScript();
-
- assert(script
- .contains("probe process(@1).function(\"calledOnce\").call{ callFunction(probefunc()) } probe process(@1).function(\"calledOnce\").return{ returnFunction(probefunc()) }"));
- assert(script
- .contains("probe process(@1).function(\"calledTwice\").call{ callFunction(probefunc()) } probe process(@1).function(\"calledTwice\").return{ returnFunction(probefunc()) }"));
- assert(script
- .contains("probe process(@1).function(\"main\").call{ callFunction(probefunc()) } probe process(@1).function(\"main\").return{ returnFunction(probefunc()) }"));
-
- }
+ /**
+ * Checks that the scripts are correct/exist and that the expected command
+ * is sent.
+ */
+
+ @Before
+ public void prep() throws Exception {
+ proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$
+ }
+
+ @After
+ public void clean() throws Exception {
+ deleteProject(proj);
+ }
+
+ @Test
+ public void testLaunchCallGraph() throws CModelException {
+ SystemTapUIErrorMessages.setActive(false);
+
+ LaunchStapGraph launch = new LaunchStapGraph();
+ launch.setTestMode(true);
+
+ IBinary bin = proj.getBinaryContainer().getBinaries()[0];
+ launch.launch(bin, "profile");
+ String script = launch.getScript();
+
+ assert(script
+ .contains("probe process(@1).function(\"calledOnce\").call{ callFunction(probefunc()) } probe process(@1).function(\"calledOnce\").return{ returnFunction(probefunc()) }"));
+ assert(script
+ .contains("probe process(@1).function(\"calledTwice\").call{ callFunction(probefunc()) } probe process(@1).function(\"calledTwice\").return{ returnFunction(probefunc()) }"));
+ assert(script
+ .contains("probe process(@1).function(\"main\").call{ callFunction(probefunc()) } probe process(@1).function(\"main\").return{ returnFunction(probefunc()) }"));
+
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandGeneratorTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandGeneratorTest.java
index b18b7c257f..595f86ac5e 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandGeneratorTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandGeneratorTest.java
@@ -20,56 +20,56 @@ import org.junit.Test;
public class SystemTapCommandGeneratorTest extends AbstractStapTest {
- // HACK TO GET THE PATH TO THE TESTING PROJECT
- File file = new File("");
- private String location = file.getAbsolutePath() + "/";
- SystemTapCommandGenerator stapgen = new SystemTapCommandGenerator();
+ // HACK TO GET THE PATH TO THE TESTING PROJECT
+ File file = new File("");
+ private String location = file.getAbsolutePath() + "/";
+ SystemTapCommandGenerator stapgen = new SystemTapCommandGenerator();
- @Test
- public void testExecutionWithScriptAndBinaryAndArgument() {
+ @Test
+ public void testExecutionWithScriptAndBinaryAndArgument() {
- String binaryFilePath = location + "factorial";
- String scriptPath = location + "function_count.stp";
+ String binaryFilePath = location + "factorial";
+ String scriptPath = location + "function_count.stp";
- // RUN
- String cmd = SystemTapCommandGenerator.generateCommand(scriptPath,
- binaryFilePath, "", true, true, binaryFilePath, "",
- PluginConstants.STAP_PATH);
+ // RUN
+ String cmd = SystemTapCommandGenerator.generateCommand(scriptPath,
+ binaryFilePath, "", true, true, binaryFilePath, "",
+ PluginConstants.STAP_PATH);
- assertEquals("stap -c '" + binaryFilePath + "' " + scriptPath
- + " --runtime=dyninst " + binaryFilePath, cmd);
- killStap();
- // END
- }
+ assertEquals("stap -c '" + binaryFilePath + "' " + scriptPath
+ + " --runtime=dyninst " + binaryFilePath, cmd);
+ killStap();
+ // END
+ }
- @Test
- public void testScriptExecution() {
+ @Test
+ public void testScriptExecution() {
- String scriptPath = location + "simple.stp";
+ String scriptPath = location + "simple.stp";
- // RUN
- String cmd = SystemTapCommandGenerator.generateCommand(scriptPath, "",
- "", false, false, "", "", PluginConstants.STAP_PATH);
+ // RUN
+ String cmd = SystemTapCommandGenerator.generateCommand(scriptPath, "",
+ "", false, false, "", "", PluginConstants.STAP_PATH);
- assertEquals("stap " + scriptPath, cmd);
- // END
- }
+ assertEquals("stap " + scriptPath, cmd);
+ // END
+ }
- @Test
- public void testExecutionWithScriptAndBinary() {
+ @Test
+ public void testExecutionWithScriptAndBinary() {
- // RUN
- String binaryFilePath = location + "factorial";
- String scriptPath = location + "allsyscall.stp";
+ // RUN
+ String binaryFilePath = location + "factorial";
+ String scriptPath = location + "allsyscall.stp";
- String cmd = SystemTapCommandGenerator.generateCommand(scriptPath,
- binaryFilePath, "", true, false, "", "",
- PluginConstants.STAP_PATH);
+ String cmd = SystemTapCommandGenerator.generateCommand(scriptPath,
+ binaryFilePath, "", true, false, "", "",
+ PluginConstants.STAP_PATH);
- assertEquals("stap -c '" + binaryFilePath + "' " + scriptPath, cmd);
- // END
+ assertEquals("stap -c '" + binaryFilePath + "' " + scriptPath, cmd);
+ // END
- killStap();
- }
+ killStap();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandTest.java
index 1df109bfb3..8ea5a65796 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandTest.java
@@ -21,29 +21,29 @@ import org.junit.Test;
public class SystemTapCommandTest {
- /**
- * Tests if SystemTapCommand is properly obtaining output from the runtime
- * process
- *
- * @throws FileNotFoundException
- */
- @Test
- public void testCommand() throws IOException {
- // Set up variables
- String testText = "CORRECT";
- String tempLocation = ResourcesPlugin.getWorkspace().getRoot()
- .getLocation().toString()
- + "/DeleteThisScript.stp";
+ /**
+ * Tests if SystemTapCommand is properly obtaining output from the runtime
+ * process
+ *
+ * @throws FileNotFoundException
+ */
+ @Test
+ public void testCommand() throws IOException {
+ // Set up variables
+ String testText = "CORRECT";
+ String tempLocation = ResourcesPlugin.getWorkspace().getRoot()
+ .getLocation().toString()
+ + "/DeleteThisScript.stp";
- // Create temporary file containing the test script
- File temporaryScript = new File(tempLocation);
+ // Create temporary file containing the test script
+ File temporaryScript = new File(tempLocation);
- try (FileOutputStream output = new FileOutputStream(temporaryScript);
- PrintStream printer = new PrintStream(output)) {
- printer.println("probe begin { printf(\"" + testText
- + "\") exit() }");
- }
- // Cleanup
- temporaryScript.delete();
- }
+ try (FileOutputStream output = new FileOutputStream(temporaryScript);
+ PrintStream printer = new PrintStream(output)) {
+ printer.println("probe begin { printf(\"" + testText
+ + "\") exit() }");
+ }
+ // Cleanup
+ temporaryScript.delete();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapErrorHandlerTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapErrorHandlerTest.java
index 61e333b57e..9f9538a400 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapErrorHandlerTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapErrorHandlerTest.java
@@ -21,72 +21,72 @@ import org.junit.Test;
public class SystemTapErrorHandlerTest {
- private SystemTapErrorHandler errHandler;
- private String errorString;
+ private SystemTapErrorHandler errHandler;
+ private String errorString;
- @Before
- public void setUp() {
- errHandler = new SystemTapErrorHandler();
- }
+ @Before
+ public void setUp() {
+ errHandler = new SystemTapErrorHandler();
+ }
- @Test
- public void testErrorNotRecognized(){
+ @Test
+ public void testErrorNotRecognized(){
- errorString = "This error will not be caught \n" +
- "Not even this one \n" +
- "Unrecognized \n" +
- "Not found \n" +
- "Error";
+ errorString = "This error will not be caught \n" +
+ "Not even this one \n" +
+ "Unrecognized \n" +
+ "Not found \n" +
+ "Error";
- errHandler.handle(new NullProgressMonitor(), errorString);
+ errHandler.handle(new NullProgressMonitor(), errorString);
- assertFalse(errHandler.isErrorRecognized());
- }
+ assertFalse(errHandler.isErrorRecognized());
+ }
- @Test
- public void testErrorRecognized(){
+ @Test
+ public void testErrorRecognized(){
- errorString = "As long as the word stapusr or stapdev is here, error is recognized";
+ errorString = "As long as the word stapusr or stapdev is here, error is recognized";
- errHandler.handle(new NullProgressMonitor(), errorString);
+ errHandler.handle(new NullProgressMonitor(), errorString);
- assertTrue(errHandler.isErrorRecognized());
- }
+ assertTrue(errHandler.isErrorRecognized());
+ }
- @Test
- public void testUserGroupError(){
+ @Test
+ public void testUserGroupError(){
- errorString = "ERROR: You are trying to run systemtap as a normal user.\n" +
- "You should either be root, or be part of the group \"stapusr\" and " +
- "possibly one of the groups \"stapsys\" or \"stapdev\".";
+ errorString = "ERROR: You are trying to run systemtap as a normal user.\n" +
+ "You should either be root, or be part of the group \"stapusr\" and " +
+ "possibly one of the groups \"stapsys\" or \"stapdev\".";
- errHandler.handle(new NullProgressMonitor(), errorString);
+ errHandler.handle(new NullProgressMonitor(), errorString);
- assertTrue(errHandler.isErrorRecognized());
- assertTrue(errHandler.getErrorMessage().contains("Please add yourself to the 'stapdev' or 'stapusr' group in order to run stap."));
- }
+ assertTrue(errHandler.isErrorRecognized());
+ assertTrue(errHandler.getErrorMessage().contains("Please add yourself to the 'stapdev' or 'stapusr' group in order to run stap."));
+ }
- @Test
- public void testDebugInfoError(){
+ @Test
+ public void testDebugInfoError(){
- errorString = "missing [architecture] kernel/module debuginfo under '[kernel-build-tree]'";
+ errorString = "missing [architecture] kernel/module debuginfo under '[kernel-build-tree]'";
- errHandler.handle(new NullProgressMonitor(), errorString);
+ errHandler.handle(new NullProgressMonitor(), errorString);
- assertTrue(errHandler.isErrorRecognized());
- assertTrue(errHandler.getErrorMessage().contains("No debuginfo could be found. Make sure you have yum-utils installed, and run debuginfo-install kernel as root."));
- }
+ assertTrue(errHandler.isErrorRecognized());
+ assertTrue(errHandler.getErrorMessage().contains("No debuginfo could be found. Make sure you have yum-utils installed, and run debuginfo-install kernel as root."));
+ }
- @Test
- public void testUprobesError(){
+ @Test
+ public void testUprobesError(){
- errorString = "SystemTap's version of uprobes is out of date. As root, or a member of the 'root' group, run \"make -C /usr/local/share/systemtap/runtime/uprobes\".";
+ errorString = "SystemTap's version of uprobes is out of date. As root, or a member of the 'root' group, run \"make -C /usr/local/share/systemtap/runtime/uprobes\".";
- errHandler.handle(new NullProgressMonitor(), errorString);
+ errHandler.handle(new NullProgressMonitor(), errorString);
- assertTrue(errHandler.isErrorRecognized());
- System.out.println(errHandler.getErrorMessage());
- assertTrue(errHandler.getErrorMessage().contains("SystemTap's version of uprobes is out of date."));
- assertTrue(errHandler.getErrorMessage().contains("make -C /usr/local/share/systemtap/runtime/uprobes\"."));
- }
+ assertTrue(errHandler.isErrorRecognized());
+ System.out.println(errHandler.getErrorMessage());
+ assertTrue(errHandler.getErrorMessage().contains("SystemTap's version of uprobes is out of date."));
+ assertTrue(errHandler.getErrorMessage().contains("make -C /usr/local/share/systemtap/runtime/uprobes\"."));
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapTabTest.java b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapTabTest.java
index 4253d384fe..20e16fd0d6 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapTabTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapTabTest.java
@@ -22,24 +22,24 @@ import org.eclipse.swt.widgets.Shell;
import org.junit.Test;
public class SystemTapTabTest {
- @Test
- public void testTabs() throws CoreException{
- Shell sh = new Shell();
- Composite cmp = new Composite(sh, SWT.NONE);
+ @Test
+ public void testTabs() throws CoreException{
+ Shell sh = new Shell();
+ Composite cmp = new Composite(sh, SWT.NONE);
- LaunchStapGraph shortCut = new LaunchStapGraph();
- SystemTapOptionsTab stp = new SystemTapOptionsTab();
- stp.createControl(cmp);
- ILaunchConfiguration configuration;
- configuration = shortCut.outsideGetLaunchConfigType().newInstance(
- null,
- (DebugPlugin.getDefault().getLaunchManager())
- .generateLaunchConfigurationName("invalid"));
- ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
- stp.setDefaults(wc);
- stp.performApply(wc);
- wc.doSave();
- stp.initializeFrom(configuration);
- sh.open();
- }
+ LaunchStapGraph shortCut = new LaunchStapGraph();
+ SystemTapOptionsTab stp = new SystemTapOptionsTab();
+ stp.createControl(cmp);
+ ILaunchConfiguration configuration;
+ configuration = shortCut.outsideGetLaunchConfigType().newInstance(
+ null,
+ (DebugPlugin.getDefault().getLaunchManager())
+ .generateLaunchConfigurationName("invalid"));
+ ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
+ stp.setDefaults(wc);
+ stp.performApply(wc);
+ wc.doSave();
+ stp.initializeFrom(configuration);
+ sh.open();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/plugin.xml b/systemtap/org.eclipse.linuxtools.callgraph.launch/plugin.xml
index b9f12a6b5a..bf0efbcb53 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/plugin.xml
@@ -21,9 +21,9 @@
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
</launchConfigurationType>
</extension>
-
-
-
+
+
+
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
@@ -33,9 +33,9 @@
type="org.eclipse.linuxtools.callgraph.launch.systemtapLaunch">
</launchConfigurationTabGroup>
</extension>
-
-
- <extension
+
+
+ <extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph"
@@ -106,6 +106,6 @@
type="timing">
</provider>
</extension>
-
+
</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ConfigurationOptionsSetter.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ConfigurationOptionsSetter.java
index 008709716f..39734f8018 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ConfigurationOptionsSetter.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ConfigurationOptionsSetter.java
@@ -16,131 +16,131 @@ import org.eclipse.linuxtools.internal.callgraph.core.LaunchConfigurationConstan
public class ConfigurationOptionsSetter {
- /**
- * Returns a SystemTap command string containing the options specified in
- * the configuration.
- *
- * @param config
- * @return
- */
- public static String setOptions(ILaunchConfiguration config) {
- StringBuilder options = new StringBuilder();
- try {
-
- int verboseLevel = config.getAttribute(
- LaunchConfigurationConstants.COMMAND_VERBOSE,
- LaunchConfigurationConstants.DEFAULT_COMMAND_VERBOSE);
- if (verboseLevel > 0) {
- StringBuilder builder = new StringBuilder();
- builder.append("-"); //$NON-NLS-1$
- for (int i = 0; i < verboseLevel; i++)
- builder.append("v"); //$NON-NLS-1$
- builder.append(" "); //$NON-NLS-1$
- options.append(builder.toString());
- }
-
- if (config.getAttribute(LaunchConfigurationConstants.COMMAND_PASS,
- LaunchConfigurationConstants.DEFAULT_COMMAND_PASS) > 0) {
- options.append("-p" + config.getAttribute(LaunchConfigurationConstants.COMMAND_PASS, LaunchConfigurationConstants.DEFAULT_COMMAND_PASS) + " "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (config
- .getAttribute(
- LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY,
- LaunchConfigurationConstants.DEFAULT_COMMAND_KEEP_TEMPORARY)) {
- options.append("-k "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(LaunchConfigurationConstants.COMMAND_GURU,
- LaunchConfigurationConstants.DEFAULT_COMMAND_GURU)) {
- options.append("-g "); //$NON-NLS-1$
- }
-
- if (config
- .getAttribute(
- LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH,
- LaunchConfigurationConstants.DEFAULT_COMMAND_PROLOGUE_SEARCH)) {
- options.append("-P "); //$NON-NLS-1$
- }
-
- if (config
- .getAttribute(
- LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION,
- LaunchConfigurationConstants.DEFAULT_COMMAND_NO_CODE_ELISION)) {
- options.append("-u "); //$NON-NLS-1$
- }
-
- if (config
- .getAttribute(
- LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS,
- LaunchConfigurationConstants.DEFAULT_COMMAND_DISABLE_WARNINGS)) {
- options.append("-w "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_BULK_MODE,
- LaunchConfigurationConstants.DEFAULT_COMMAND_BULK_MODE)) {
- options.append("-b "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_TIMING_INFO,
- LaunchConfigurationConstants.DEFAULT_COMMAND_TIMING_INFO)) {
- options.append("-t "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_BUFFER_BYTES,
- LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES) > 0) {
- options.append("-s" + config.getAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES) + " "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_TARGET_PID,
- LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID) > 0) {
- options.append("-x" + config.getAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID) + " "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,
- LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES) != LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES) {
- options.append(config
- .getAttribute(
- LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,
- LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES)
- + " "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING,
- LaunchConfigurationConstants.DEFAULT_COMMAND_LEAVE_RUNNING)) {
- options.append("-F "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_SKIP_BADVARS,
- LaunchConfigurationConstants.DEFAULT_COMMAND_SKIP_BADVARS)) {
- options.append("--skip-badvars "); //$NON-NLS-1$
- }
-
- if (config.getAttribute(
- LaunchConfigurationConstants.COMMAND_IGNORE_DWARF,
- LaunchConfigurationConstants.DEFAULT_COMMAND_IGNORE_DWARF)) {
- options.append("--ignore-dwarf "); //$NON-NLS-1$
- }
-
- if (config
- .getAttribute(
- LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE,
- LaunchConfigurationConstants.DEFAULT_COMMAND_TAPSET_COVERAGE)) {
- options.append("-q "); //$NON-NLS-1$
- }
- return options.toString();
-
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- return null;
- }
+ /**
+ * Returns a SystemTap command string containing the options specified in
+ * the configuration.
+ *
+ * @param config
+ * @return
+ */
+ public static String setOptions(ILaunchConfiguration config) {
+ StringBuilder options = new StringBuilder();
+ try {
+
+ int verboseLevel = config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_VERBOSE,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_VERBOSE);
+ if (verboseLevel > 0) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("-"); //$NON-NLS-1$
+ for (int i = 0; i < verboseLevel; i++)
+ builder.append("v"); //$NON-NLS-1$
+ builder.append(" "); //$NON-NLS-1$
+ options.append(builder.toString());
+ }
+
+ if (config.getAttribute(LaunchConfigurationConstants.COMMAND_PASS,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_PASS) > 0) {
+ options.append("-p" + config.getAttribute(LaunchConfigurationConstants.COMMAND_PASS, LaunchConfigurationConstants.DEFAULT_COMMAND_PASS) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (config
+ .getAttribute(
+ LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_KEEP_TEMPORARY)) {
+ options.append("-k "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(LaunchConfigurationConstants.COMMAND_GURU,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_GURU)) {
+ options.append("-g "); //$NON-NLS-1$
+ }
+
+ if (config
+ .getAttribute(
+ LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_PROLOGUE_SEARCH)) {
+ options.append("-P "); //$NON-NLS-1$
+ }
+
+ if (config
+ .getAttribute(
+ LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_NO_CODE_ELISION)) {
+ options.append("-u "); //$NON-NLS-1$
+ }
+
+ if (config
+ .getAttribute(
+ LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_DISABLE_WARNINGS)) {
+ options.append("-w "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_BULK_MODE,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_BULK_MODE)) {
+ options.append("-b "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_TIMING_INFO,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_TIMING_INFO)) {
+ options.append("-t "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_BUFFER_BYTES,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES) > 0) {
+ options.append("-s" + config.getAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_TARGET_PID,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID) > 0) {
+ options.append("-x" + config.getAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES) != LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES) {
+ options.append(config
+ .getAttribute(
+ LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES)
+ + " "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_LEAVE_RUNNING)) {
+ options.append("-F "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_SKIP_BADVARS,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_SKIP_BADVARS)) {
+ options.append("--skip-badvars "); //$NON-NLS-1$
+ }
+
+ if (config.getAttribute(
+ LaunchConfigurationConstants.COMMAND_IGNORE_DWARF,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_IGNORE_DWARF)) {
+ options.append("--ignore-dwarf "); //$NON-NLS-1$
+ }
+
+ if (config
+ .getAttribute(
+ LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE,
+ LaunchConfigurationConstants.DEFAULT_COMMAND_TAPSET_COVERAGE)) {
+ options.append("-q "); //$NON-NLS-1$
+ }
+ return options.toString();
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java
index 37c9c062af..0c7b671dd6 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java
@@ -27,176 +27,176 @@ import org.eclipse.ui.IEditorPart;
public class LaunchStapGraph extends SystemTapLaunchShortcut {
- //TODO: Do not let this class persist, or otherwise change it so persistence doesn't matter.
- private String partialScriptPath;
- private String funcs;
- private List<String> exclusions;
- private String projectName;
- protected static final String ATTR_PARSER = "org.eclipse.linuxtools.callgraph.graphparser"; //$NON-NLS-1$
- protected static final String ATTR_VIEWER = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
-
- public LaunchStapGraph() {
- funcs = null;
- exclusions = new ArrayList<>();
- projectName = null;
- }
-
- @Override
- public void launch(IEditorPart ed, String mode) {
- resourceToSearchFor = ed.getTitle();
- searchForResource = true;
-
- //Note: This launch will eventually end up calling
- //launch(IBinary bin, String mode) below
- super.launch(ed, mode);
- }
-
- @Override
- public void launch(IBinary bin, String mode) {
- launch(bin, mode, null);
- }
-
- public void launch(IBinary bin, String mode, ILaunchConfigurationWorkingCopy wc) {
- super.initialize();
- this.bin = bin;
- name = "SystemTapGraph"; //$NON-NLS-1$
- binName = getName(bin);
- partialScriptPath = PluginConstants.getPluginLocation()
- + "parse_function_partial.stp"; //$NON-NLS-1$
-
- viewID = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
-
-
-
- projectName = bin.getCProject().getElementName();
-
- try {
- if (wc == null) {
- wc = createConfiguration(bin, name);
- }
- binaryPath = bin.getResource().getLocation().toString();
- arguments = binaryPath;
- outputPath = PluginConstants.getDefaultIOPath();
-
- if (writeFunctionListToScript(resourceToSearchFor) == null) {
- return;
- }
- if (funcs == null || funcs.length() < 0) {
- return;
- }
-
- needToGenerate = true;
- finishLaunch(name, mode, wc);
-
- } catch (IOException e) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- "LaunchShortcutScriptGen", //$NON-NLS-1$
- Messages.getString("LaunchStapGraph.ScriptGenErr"), //$NON-NLS-1$
- Messages.getString("LaunchStapGraph.ScriptGenErrMsg")); //$NON-NLS-1$
- mess.schedule();
- e.printStackTrace();
- } finally {
- resourceToSearchFor = ""; //$NON-NLS-1$
- searchForResource = false;
- }
-
-
- }
-
- /**
- * Generates the call and return function probes for the specified function
- * @param function
- * @return
- */
- private String generateProbe(String function) {
- String output = "probe process(@1).function(\"" + function + "\").call ? { if ( ! isinstr(\"" + function + "\", \"___STAP_MARKER___\")) { callFunction(\"" + function + "\",tid()) } } probe process(@1).function(\"" + function + "\").return ? { if ( ! isinstr(\"" + function + "\", \"___STAP_MARKER___\")) returnFunction(\"" + function + "\",tid()) else { printf(\"?%d,,%s\\n\", tid(), user_string(strtol(tokenize($$return, \"return=\"),16)))}}\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- return output;
- }
-
- /**
- * Prompts the user for a list of functions to probe
- *
- * @param bw
- * @return
- */
- private String writeFunctionListToScript(String resourceToSearchFor) {
- String toWrite = getFunctionsFromBinary(bin, resourceToSearchFor);
-
- if (toWrite == null || toWrite.length() < 1) {
- return null;
- }
-
- StringBuffer output = new StringBuffer();
-
- for (String func : toWrite.split(" ")) { //$NON-NLS-1$
- if (func.length() > 0
- && (exclusions == null || exclusions.size() < 1 || exclusions
- .contains(func))) {
- output.append(generateProbe(func));
- }
- }
-
- funcs = output.toString();
- return funcs;
- }
-
- /**
- * Copies the contents of the specified partial script. You should call writeStapMarkers first
- * if you want StapMarkers to function properly.
- *
- * @param bw
- * @return
- * @throws IOException
- */
- private String writeFromPartialScript(String projectName) throws IOException {
- String toWrite = ""; //$NON-NLS-1$
- String temp = ""; //$NON-NLS-1$
- toWrite += "\nprobe begin{\n" + //$NON-NLS-1$
- "printf(\"\\nPROBE_BEGIN\\n\")\n" + //$NON-NLS-1$
- "serial=1\n" + //$NON-NLS-1$
- "startTime = 0;\n" + //$NON-NLS-1$
- "printf(\"" + projectName + "\\n\")\n" + //$NON-NLS-1$ //$NON-NLS-2$
- "}"; //$NON-NLS-1$
- File partialScript = new File(partialScriptPath);
- try (BufferedReader scriptReader = new BufferedReader(new FileReader(
- partialScript))) {
- while ((temp = scriptReader.readLine()) != null) {
- toWrite += temp + "\n"; //$NON-NLS-1$
- }
- scriptReader.close();
- }
-
- return toWrite;
- }
-
-
- @Override
- public String generateScript() throws IOException {
-
- String scriptContents = ""; //$NON-NLS-1$
-
- scriptContents += funcs;
-
- scriptContents += writeFromPartialScript(projectName);
-
- return scriptContents;
- }
-
- @Override
- public String setScriptPath() {
- scriptPath = PluginConstants.getDefaultOutput()
- + "callgraphGen.stp"; //$NON-NLS-1$
- return scriptPath;
- }
-
- @Override
- public String setParserID() {
- parserID = ATTR_PARSER;
- return parserID;
- }
-
- @Override
- public String setViewID() {
- return ATTR_VIEWER;
- }
+ //TODO: Do not let this class persist, or otherwise change it so persistence doesn't matter.
+ private String partialScriptPath;
+ private String funcs;
+ private List<String> exclusions;
+ private String projectName;
+ protected static final String ATTR_PARSER = "org.eclipse.linuxtools.callgraph.graphparser"; //$NON-NLS-1$
+ protected static final String ATTR_VIEWER = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
+
+ public LaunchStapGraph() {
+ funcs = null;
+ exclusions = new ArrayList<>();
+ projectName = null;
+ }
+
+ @Override
+ public void launch(IEditorPart ed, String mode) {
+ resourceToSearchFor = ed.getTitle();
+ searchForResource = true;
+
+ //Note: This launch will eventually end up calling
+ //launch(IBinary bin, String mode) below
+ super.launch(ed, mode);
+ }
+
+ @Override
+ public void launch(IBinary bin, String mode) {
+ launch(bin, mode, null);
+ }
+
+ public void launch(IBinary bin, String mode, ILaunchConfigurationWorkingCopy wc) {
+ super.initialize();
+ this.bin = bin;
+ name = "SystemTapGraph"; //$NON-NLS-1$
+ binName = getName(bin);
+ partialScriptPath = PluginConstants.getPluginLocation()
+ + "parse_function_partial.stp"; //$NON-NLS-1$
+
+ viewID = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
+
+
+
+ projectName = bin.getCProject().getElementName();
+
+ try {
+ if (wc == null) {
+ wc = createConfiguration(bin, name);
+ }
+ binaryPath = bin.getResource().getLocation().toString();
+ arguments = binaryPath;
+ outputPath = PluginConstants.getDefaultIOPath();
+
+ if (writeFunctionListToScript(resourceToSearchFor) == null) {
+ return;
+ }
+ if (funcs == null || funcs.length() < 0) {
+ return;
+ }
+
+ needToGenerate = true;
+ finishLaunch(name, mode, wc);
+
+ } catch (IOException e) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ "LaunchShortcutScriptGen", //$NON-NLS-1$
+ Messages.getString("LaunchStapGraph.ScriptGenErr"), //$NON-NLS-1$
+ Messages.getString("LaunchStapGraph.ScriptGenErrMsg")); //$NON-NLS-1$
+ mess.schedule();
+ e.printStackTrace();
+ } finally {
+ resourceToSearchFor = ""; //$NON-NLS-1$
+ searchForResource = false;
+ }
+
+
+ }
+
+ /**
+ * Generates the call and return function probes for the specified function
+ * @param function
+ * @return
+ */
+ private String generateProbe(String function) {
+ String output = "probe process(@1).function(\"" + function + "\").call ? { if ( ! isinstr(\"" + function + "\", \"___STAP_MARKER___\")) { callFunction(\"" + function + "\",tid()) } } probe process(@1).function(\"" + function + "\").return ? { if ( ! isinstr(\"" + function + "\", \"___STAP_MARKER___\")) returnFunction(\"" + function + "\",tid()) else { printf(\"?%d,,%s\\n\", tid(), user_string(strtol(tokenize($$return, \"return=\"),16)))}}\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ return output;
+ }
+
+ /**
+ * Prompts the user for a list of functions to probe
+ *
+ * @param bw
+ * @return
+ */
+ private String writeFunctionListToScript(String resourceToSearchFor) {
+ String toWrite = getFunctionsFromBinary(bin, resourceToSearchFor);
+
+ if (toWrite == null || toWrite.length() < 1) {
+ return null;
+ }
+
+ StringBuffer output = new StringBuffer();
+
+ for (String func : toWrite.split(" ")) { //$NON-NLS-1$
+ if (func.length() > 0
+ && (exclusions == null || exclusions.size() < 1 || exclusions
+ .contains(func))) {
+ output.append(generateProbe(func));
+ }
+ }
+
+ funcs = output.toString();
+ return funcs;
+ }
+
+ /**
+ * Copies the contents of the specified partial script. You should call writeStapMarkers first
+ * if you want StapMarkers to function properly.
+ *
+ * @param bw
+ * @return
+ * @throws IOException
+ */
+ private String writeFromPartialScript(String projectName) throws IOException {
+ String toWrite = ""; //$NON-NLS-1$
+ String temp = ""; //$NON-NLS-1$
+ toWrite += "\nprobe begin{\n" + //$NON-NLS-1$
+ "printf(\"\\nPROBE_BEGIN\\n\")\n" + //$NON-NLS-1$
+ "serial=1\n" + //$NON-NLS-1$
+ "startTime = 0;\n" + //$NON-NLS-1$
+ "printf(\"" + projectName + "\\n\")\n" + //$NON-NLS-1$ //$NON-NLS-2$
+ "}"; //$NON-NLS-1$
+ File partialScript = new File(partialScriptPath);
+ try (BufferedReader scriptReader = new BufferedReader(new FileReader(
+ partialScript))) {
+ while ((temp = scriptReader.readLine()) != null) {
+ toWrite += temp + "\n"; //$NON-NLS-1$
+ }
+ scriptReader.close();
+ }
+
+ return toWrite;
+ }
+
+
+ @Override
+ public String generateScript() throws IOException {
+
+ String scriptContents = ""; //$NON-NLS-1$
+
+ scriptContents += funcs;
+
+ scriptContents += writeFromPartialScript(projectName);
+
+ return scriptContents;
+ }
+
+ @Override
+ public String setScriptPath() {
+ scriptPath = PluginConstants.getDefaultOutput()
+ + "callgraphGen.stp"; //$NON-NLS-1$
+ return scriptPath;
+ }
+
+ @Override
+ public String setParserID() {
+ parserID = ATTR_PARSER;
+ return parserID;
+ }
+
+ @Override
+ public String setViewID() {
+ return ATTR_VIEWER;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java
index 1d580b72d4..dc517d134c 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java
@@ -46,242 +46,242 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
public class LaunchWizard extends SystemTapLaunchShortcut {
- private Text scriptLocation;
- private Text binaryLocation;
- private Text argumentsLocation;
- private String workspacePath;
- private String mode;
-
- private Shell sh;
- private Composite fileComp;
-
- private static final int WIDTH = 670;
- private static final int HEIGHT = 630;
-
- /**
- * The following protected parameters are provided by SystemTapLaunchShortcut:
- *
- * Optional customization parameters:
- * protected String name;
- * protected String binaryPath;
- * protected String arguments;
- * protected String outputPath;
- * protected String dirPath;
- * protected String generatedScript;
- * protected boolean needToGenerate;
- * protected boolean overwrite;
- *
- * Mandatory:
- * protected String scriptPath;
- * protected ILaunchConfiguration config;
- */
-
-
- /**
- * Launch method for a generated script that executes on a binary
- *
- * MUST specify (String) scriptPath and call config = createConfiguration(bin)!
- *
- * Noteworthy defaults:
- * name defaults to "", but please set it (for usability)
- * overwrite defaults to true - don't change it unless you really have to.
- *
- * To create new launches:
- * -Copy shortcut code in xml, changing class name and label accordingly
- * -Create a class that extends SystemTapLaunchShortcut with a function
- * launch(IBinary bin, String mode)
- * -Call super.Init()
- * -Set name (this is shortcut-specific)
- * -If a binary is used, call binName = getName(bin)
- * -Call createConfiguration(bin, name)
- *
- * -Specify whichever of the optional parameters you need
- * -Set scriptPath
- * -Set an ILaunchConfiguration
- * -Call finishLaunch or finishLaunchWithoutBinary
- */
-
- @Override
- public void launch(IEditorPart ed, String mode) {
- super.initialize();
- promptForInputs();
-
- this.mode = mode;
- }
-
- @Override
- public void launch(ISelection selection, String mode) {
- super.initialize();
- promptForInputs();
-
- this.mode = mode;
- }
-
- private void promptForInputs() {
- InputDialog id = new InputDialog(new Shell(), Messages.getString("LaunchWizard.WelcomeWizard"), //$NON-NLS-1$
- Messages.getString("LaunchWizard.Text1") + //$NON-NLS-1$
- Messages.getString("LaunchWizard.Text2") + //$NON-NLS-1$
- Messages.getString("LaunchWizard.Text3"), //$NON-NLS-1$
- getLaunchManager().generateLaunchConfigurationName(
- Messages.getString("LaunchWizard.NamePrefix")), null); //$NON-NLS-1$
- id.open();
-
- if (id.getReturnCode() == Window.CANCEL){
- return;
- }
-
- name = id.getValue();
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IPath location = root.getLocation();
- workspacePath = location.toString();
-
- sh = new Shell();
- sh.setSize(WIDTH,HEIGHT);
- sh.setLayout(new GridLayout(1, false));
- sh.setText(name);
-
-
- Image img = new Image(sh.getDisplay(), PluginConstants.getPluginLocation() + "systemtapbanner.png"); //$NON-NLS-1$
- Composite imageCmp = new Composite(sh, SWT.BORDER);
- imageCmp.setLayout(new FillLayout());
- GridData imageData = new GridData(650, 157);
- imageData.horizontalAlignment = SWT.CENTER;
- imageCmp.setLayoutData(imageData);
- imageCmp.setBackgroundImage(img);
-
- fileComp = new Composite(sh, SWT.NONE);
- fileComp.setLayout(new GridLayout(2, false));
- fileComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-
- GridDataFactory labelData = GridDataFactory.fillDefaults().grab(true, false)
- .span(2,1);
-
- Label scriptLabel = new Label(fileComp, SWT.HORIZONTAL);
- scriptLabel.setText(Messages.getString("LaunchWizard.Script")); //$NON-NLS-1$
- labelData.applyTo(scriptLabel);
-
- GridDataFactory textData = GridDataFactory.fillDefaults().grab( true, false )
- .hint(WIDTH, SWT.DEFAULT);
-
- scriptLocation = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
- textData.applyTo(scriptLocation);
- Button scriptButton = new Button(fileComp, SWT.PUSH);
- scriptButton.setText(Messages.getString("SystemTapOptionsTab.BrowseFiles")); //$NON-NLS-1$
- scriptButton.setLayoutData(new GridData());
- scriptButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String filePath = scriptLocation.getText();
- FileDialog dialog = new FileDialog(sh, SWT.SAVE);
- filePath = dialog.open();
- if (filePath != null) {
- scriptLocation.setText(filePath);
- }
- }
- });
-
-
- GridData gd2 = new GridData();
- gd2.horizontalSpan = 3;
- Label binaryLabel= new Label(fileComp, SWT.HORIZONTAL);
- binaryLabel.setText(Messages.getString("LaunchWizard.BinFile")); //$NON-NLS-1$
- labelData.applyTo(binaryLabel);
-
- binaryLocation = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
- textData.applyTo(binaryLocation);
- Button binaryButton = new Button(fileComp, SWT.PUSH);
- binaryButton.setText(Messages.getString("SystemTapOptionsTab.WorkspaceButton2")); //$NON-NLS-1$
- binaryButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(sh, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(Messages.getString("SystemTapOptionsTab.SelectResource")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("SystemTapOptionsTab.SelectSuppressions")); //$NON-NLS-1$
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- if (dialog.open() == IDialogConstants.OK_ID) {
- IResource resource = (IResource) dialog.getFirstResult();
- String arg = resource.getFullPath().toString();
- binaryLocation.setText(workspacePath + arg);
- }
- }
- });
-
- Composite argumentsComp = new Composite(sh, SWT.BORDER_DASH);
- argumentsComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- argumentsComp.setLayout(new GridLayout(2, false));
-
- Label argumentsLabel= new Label(argumentsComp, SWT.HORIZONTAL);
- argumentsLabel.setText(Messages.getString("LaunchWizard.Args")); //$NON-NLS-1$
- labelData.applyTo(argumentsLabel);
-
- argumentsLocation = new Text(argumentsComp, SWT.MULTI | SWT.WRAP | SWT.BORDER);
- GridData gd3 = new GridData(GridData.FILL_HORIZONTAL);
- gd3.heightHint=200;
- argumentsLocation.setLayoutData(gd3);
- Button argumentsButton = new Button(argumentsComp, SWT.PUSH);
- argumentsButton.setText(Messages.getString("LaunchWizard.Func")); //$NON-NLS-1$
- argumentsButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- argumentsLocation.setText(
- argumentsLocation.getText() + " process(\"" //$NON-NLS-1$
- + binaryLocation.getText() + "\").function(\"\")"); //$NON-NLS-1$
- }
- });
-
-
- //TODO: Don't use blank labels to move button to the right column :P
- Label blankLabel2 = new Label(argumentsComp, SWT.HORIZONTAL);
- blankLabel2.setText(""); //$NON-NLS-1$
-
-
- Button launch = new Button(sh, SWT.PUSH);
- launch.setLayoutData(new GridData(GridData.CENTER, GridData.BEGINNING, false, false));
- launch.setText(Messages.getString("LaunchWizard.Launch")); //$NON-NLS-1$
- launch.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- scriptPath = scriptLocation.getText();
- binaryPath = binaryLocation.getText();
- arguments = argumentsLocation.getText();
- ILaunchConfigurationWorkingCopy wc = createConfiguration(null, name);
- try {
- finishLaunch(scriptPath + ": " + binName, mode, wc);//$NON-NLS-1$
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- sh.dispose();
- }
-
- });
-
- //TODO: Verify that this works
- Display.getCurrent().asyncExec(new Runnable() {
- @Override
- public void run() {
- sh.open();
- }
- });
- }
-
- @Override
- public String setScriptPath() {
- scriptPath = "IMPLEMENT"; //$NON-NLS-1$
- return scriptPath;
- }
-
- @Override
- public String setParserID() {
- return null;
- }
-
- @Override
- public String setViewID() {
- return null;
- }
+ private Text scriptLocation;
+ private Text binaryLocation;
+ private Text argumentsLocation;
+ private String workspacePath;
+ private String mode;
+
+ private Shell sh;
+ private Composite fileComp;
+
+ private static final int WIDTH = 670;
+ private static final int HEIGHT = 630;
+
+ /**
+ * The following protected parameters are provided by SystemTapLaunchShortcut:
+ *
+ * Optional customization parameters:
+ * protected String name;
+ * protected String binaryPath;
+ * protected String arguments;
+ * protected String outputPath;
+ * protected String dirPath;
+ * protected String generatedScript;
+ * protected boolean needToGenerate;
+ * protected boolean overwrite;
+ *
+ * Mandatory:
+ * protected String scriptPath;
+ * protected ILaunchConfiguration config;
+ */
+
+
+ /**
+ * Launch method for a generated script that executes on a binary
+ *
+ * MUST specify (String) scriptPath and call config = createConfiguration(bin)!
+ *
+ * Noteworthy defaults:
+ * name defaults to "", but please set it (for usability)
+ * overwrite defaults to true - don't change it unless you really have to.
+ *
+ * To create new launches:
+ * -Copy shortcut code in xml, changing class name and label accordingly
+ * -Create a class that extends SystemTapLaunchShortcut with a function
+ * launch(IBinary bin, String mode)
+ * -Call super.Init()
+ * -Set name (this is shortcut-specific)
+ * -If a binary is used, call binName = getName(bin)
+ * -Call createConfiguration(bin, name)
+ *
+ * -Specify whichever of the optional parameters you need
+ * -Set scriptPath
+ * -Set an ILaunchConfiguration
+ * -Call finishLaunch or finishLaunchWithoutBinary
+ */
+
+ @Override
+ public void launch(IEditorPart ed, String mode) {
+ super.initialize();
+ promptForInputs();
+
+ this.mode = mode;
+ }
+
+ @Override
+ public void launch(ISelection selection, String mode) {
+ super.initialize();
+ promptForInputs();
+
+ this.mode = mode;
+ }
+
+ private void promptForInputs() {
+ InputDialog id = new InputDialog(new Shell(), Messages.getString("LaunchWizard.WelcomeWizard"), //$NON-NLS-1$
+ Messages.getString("LaunchWizard.Text1") + //$NON-NLS-1$
+ Messages.getString("LaunchWizard.Text2") + //$NON-NLS-1$
+ Messages.getString("LaunchWizard.Text3"), //$NON-NLS-1$
+ getLaunchManager().generateLaunchConfigurationName(
+ Messages.getString("LaunchWizard.NamePrefix")), null); //$NON-NLS-1$
+ id.open();
+
+ if (id.getReturnCode() == Window.CANCEL){
+ return;
+ }
+
+ name = id.getValue();
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IPath location = root.getLocation();
+ workspacePath = location.toString();
+
+ sh = new Shell();
+ sh.setSize(WIDTH,HEIGHT);
+ sh.setLayout(new GridLayout(1, false));
+ sh.setText(name);
+
+
+ Image img = new Image(sh.getDisplay(), PluginConstants.getPluginLocation() + "systemtapbanner.png"); //$NON-NLS-1$
+ Composite imageCmp = new Composite(sh, SWT.BORDER);
+ imageCmp.setLayout(new FillLayout());
+ GridData imageData = new GridData(650, 157);
+ imageData.horizontalAlignment = SWT.CENTER;
+ imageCmp.setLayoutData(imageData);
+ imageCmp.setBackgroundImage(img);
+
+ fileComp = new Composite(sh, SWT.NONE);
+ fileComp.setLayout(new GridLayout(2, false));
+ fileComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+
+ GridDataFactory labelData = GridDataFactory.fillDefaults().grab(true, false)
+ .span(2,1);
+
+ Label scriptLabel = new Label(fileComp, SWT.HORIZONTAL);
+ scriptLabel.setText(Messages.getString("LaunchWizard.Script")); //$NON-NLS-1$
+ labelData.applyTo(scriptLabel);
+
+ GridDataFactory textData = GridDataFactory.fillDefaults().grab( true, false )
+ .hint(WIDTH, SWT.DEFAULT);
+
+ scriptLocation = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
+ textData.applyTo(scriptLocation);
+ Button scriptButton = new Button(fileComp, SWT.PUSH);
+ scriptButton.setText(Messages.getString("SystemTapOptionsTab.BrowseFiles")); //$NON-NLS-1$
+ scriptButton.setLayoutData(new GridData());
+ scriptButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String filePath = scriptLocation.getText();
+ FileDialog dialog = new FileDialog(sh, SWT.SAVE);
+ filePath = dialog.open();
+ if (filePath != null) {
+ scriptLocation.setText(filePath);
+ }
+ }
+ });
+
+
+ GridData gd2 = new GridData();
+ gd2.horizontalSpan = 3;
+ Label binaryLabel= new Label(fileComp, SWT.HORIZONTAL);
+ binaryLabel.setText(Messages.getString("LaunchWizard.BinFile")); //$NON-NLS-1$
+ labelData.applyTo(binaryLabel);
+
+ binaryLocation = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
+ textData.applyTo(binaryLocation);
+ Button binaryButton = new Button(fileComp, SWT.PUSH);
+ binaryButton.setText(Messages.getString("SystemTapOptionsTab.WorkspaceButton2")); //$NON-NLS-1$
+ binaryButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(sh, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(Messages.getString("SystemTapOptionsTab.SelectResource")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemTapOptionsTab.SelectSuppressions")); //$NON-NLS-1$
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ String arg = resource.getFullPath().toString();
+ binaryLocation.setText(workspacePath + arg);
+ }
+ }
+ });
+
+ Composite argumentsComp = new Composite(sh, SWT.BORDER_DASH);
+ argumentsComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ argumentsComp.setLayout(new GridLayout(2, false));
+
+ Label argumentsLabel= new Label(argumentsComp, SWT.HORIZONTAL);
+ argumentsLabel.setText(Messages.getString("LaunchWizard.Args")); //$NON-NLS-1$
+ labelData.applyTo(argumentsLabel);
+
+ argumentsLocation = new Text(argumentsComp, SWT.MULTI | SWT.WRAP | SWT.BORDER);
+ GridData gd3 = new GridData(GridData.FILL_HORIZONTAL);
+ gd3.heightHint=200;
+ argumentsLocation.setLayoutData(gd3);
+ Button argumentsButton = new Button(argumentsComp, SWT.PUSH);
+ argumentsButton.setText(Messages.getString("LaunchWizard.Func")); //$NON-NLS-1$
+ argumentsButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ argumentsLocation.setText(
+ argumentsLocation.getText() + " process(\"" //$NON-NLS-1$
+ + binaryLocation.getText() + "\").function(\"\")"); //$NON-NLS-1$
+ }
+ });
+
+
+ //TODO: Don't use blank labels to move button to the right column :P
+ Label blankLabel2 = new Label(argumentsComp, SWT.HORIZONTAL);
+ blankLabel2.setText(""); //$NON-NLS-1$
+
+
+ Button launch = new Button(sh, SWT.PUSH);
+ launch.setLayoutData(new GridData(GridData.CENTER, GridData.BEGINNING, false, false));
+ launch.setText(Messages.getString("LaunchWizard.Launch")); //$NON-NLS-1$
+ launch.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ scriptPath = scriptLocation.getText();
+ binaryPath = binaryLocation.getText();
+ arguments = argumentsLocation.getText();
+ ILaunchConfigurationWorkingCopy wc = createConfiguration(null, name);
+ try {
+ finishLaunch(scriptPath + ": " + binName, mode, wc);//$NON-NLS-1$
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ sh.dispose();
+ }
+
+ });
+
+ //TODO: Verify that this works
+ Display.getCurrent().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ sh.open();
+ }
+ });
+ }
+
+ @Override
+ public String setScriptPath() {
+ scriptPath = "IMPLEMENT"; //$NON-NLS-1$
+ return scriptPath;
+ }
+
+ @Override
+ public String setParserID() {
+ return null;
+ }
+
+ @Override
+ public String setViewID() {
+ return null;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ListTreeContentProvider.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ListTreeContentProvider.java
index fc6526a7d9..c9814f484e 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ListTreeContentProvider.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/ListTreeContentProvider.java
@@ -21,130 +21,130 @@ import org.eclipse.jface.viewers.Viewer;
public class ListTreeContentProvider implements ITreeContentProvider {
- @Override
- public Object[] getChildren(Object parentElement) {
-
- ArrayList<Object> output = new ArrayList<>();
-
- if (parentElement instanceof ICContainer) {
- try {
- Object[] list =((ICContainer) parentElement).getChildren();
- for (Object item : list) {
- if (item instanceof ICContainer) {
- if (checkForValidChildren((ICContainer) item))
- output.add(item);
- } else if (item instanceof ICElement) {
- ICElement el = (ICElement) item;
- if (SystemTapLaunchShortcut.validElement(el))
- output.add(el);
- }
-
-
- }
-
- return output.toArray();
- } catch (CModelException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- /**
- * A container is valid if any of its children are valid c/cpp elements
- * or if it contains another container for which the above holds
- * @param cont
- * @return
- */
- private boolean checkForValidChildren(ICContainer cont) {
- try {
- for (ICElement child : cont.getChildren()) {
-
- if ((child != null)
- && SystemTapLaunchShortcut.validElement(child))
- return true;
- if ((child instanceof ICContainer)
- && checkForValidChildren((ICContainer) child)) {
- return true;
- }
- }
- } catch (CModelException e) {
- e.printStackTrace();
- }
-
- return false;
-
- }
-
- @Override
- public Object getParent(Object element) {
- if (element instanceof ICElement) {
- return ((ICElement)element).getAncestor(ICElement.C_CCONTAINER);
- }
- return null;
- }
-
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof ICContainer) {
- try {
- if (((ICContainer) element).getChildren().length > 0)
- return true;
- } catch (CModelException e) {
- e.printStackTrace();
- }
- }
- return false;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List) {
- for (Object element : (List<?>) inputElement)
- if (element instanceof ICContainer)
- try {
- ICElement[] array = ((ICContainer) element).getChildren();
- ArrayList<ICElement> output = new ArrayList<>();
-
- for (ICElement item : array) {
- if ((item instanceof ICContainer)
- && checkForValidChildren((ICContainer) item)) {
- output.add(item);
- }
-
- if (SystemTapLaunchShortcut.validElement(item)) {
- output.add(item);
- }
- }
- return output.toArray();
- } catch (CModelException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- @Override
- public void dispose() {
-
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
-
- public Object[] findElements(Object inputElement) {
- ArrayList<Object> output = new ArrayList<>();
-
- if (inputElement instanceof List) {
- for (Object element : (List<?>) inputElement) {
- Object[] list = (getChildren(element));
- for (Object o : list) {
- output.add(o);
- }
- }
- }
- return output.toArray();
- }
+ @Override
+ public Object[] getChildren(Object parentElement) {
+
+ ArrayList<Object> output = new ArrayList<>();
+
+ if (parentElement instanceof ICContainer) {
+ try {
+ Object[] list =((ICContainer) parentElement).getChildren();
+ for (Object item : list) {
+ if (item instanceof ICContainer) {
+ if (checkForValidChildren((ICContainer) item))
+ output.add(item);
+ } else if (item instanceof ICElement) {
+ ICElement el = (ICElement) item;
+ if (SystemTapLaunchShortcut.validElement(el))
+ output.add(el);
+ }
+
+
+ }
+
+ return output.toArray();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * A container is valid if any of its children are valid c/cpp elements
+ * or if it contains another container for which the above holds
+ * @param cont
+ * @return
+ */
+ private boolean checkForValidChildren(ICContainer cont) {
+ try {
+ for (ICElement child : cont.getChildren()) {
+
+ if ((child != null)
+ && SystemTapLaunchShortcut.validElement(child))
+ return true;
+ if ((child instanceof ICContainer)
+ && checkForValidChildren((ICContainer) child)) {
+ return true;
+ }
+ }
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+
+ return false;
+
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof ICElement) {
+ return ((ICElement)element).getAncestor(ICElement.C_CCONTAINER);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof ICContainer) {
+ try {
+ if (((ICContainer) element).getChildren().length > 0)
+ return true;
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List) {
+ for (Object element : (List<?>) inputElement)
+ if (element instanceof ICContainer)
+ try {
+ ICElement[] array = ((ICContainer) element).getChildren();
+ ArrayList<ICElement> output = new ArrayList<>();
+
+ for (ICElement item : array) {
+ if ((item instanceof ICContainer)
+ && checkForValidChildren((ICContainer) item)) {
+ output.add(item);
+ }
+
+ if (SystemTapLaunchShortcut.validElement(item)) {
+ output.add(item);
+ }
+ }
+ return output.toArray();
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+
+ public Object[] findElements(Object inputElement) {
+ ArrayList<Object> output = new ArrayList<>();
+
+ if (inputElement instanceof List) {
+ for (Object element : (List<?>) inputElement) {
+ Object[] list = (getChildren(element));
+ for (Object o : list) {
+ output.add(o);
+ }
+ }
+ }
+ return output.toArray();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/Messages.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/Messages.java
index 8a806b998f..5ed0e607ef 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/Messages.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/Messages.java
@@ -4,7 +4,7 @@
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
@@ -14,19 +14,19 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.callgraph.launch.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.callgraph.launch.messages"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
- private Messages() {
- }
+ private Messages() {
+ }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/RuledTreeSelectionDialog.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/RuledTreeSelectionDialog.java
index c67d54d3e8..9ca155cd97 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/RuledTreeSelectionDialog.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/RuledTreeSelectionDialog.java
@@ -6,11 +6,11 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog font should be
- * activated and used by other components.
- * Lubomir Marinov <lubomir.marinov@gmail.com> - Fix for bug 182122 -[Dialogs]
- * CheckedTreeSelectionDialog#createSelectionButtons(Composite) fails to
+ * IBM Corporation - initial API and implementation
+ * Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog font should be
+ * activated and used by other components.
+ * Lubomir Marinov <lubomir.marinov@gmail.com> - Fix for bug 182122 -[Dialogs]
+ * CheckedTreeSelectionDialog#createSelectionButtons(Composite) fails to
* align the selection buttons to the right
*******************************************************************************/
package org.eclipse.linuxtools.internal.callgraph.launch;
@@ -30,36 +30,36 @@ import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
/**
* A class to select elements out of a tree structure.
- *
+ *
* @since 2.0
*/
public class RuledTreeSelectionDialog extends CheckedTreeSelectionDialog {
public RuledTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
- ITreeContentProvider contentProvider) {
- super(parent, labelProvider, contentProvider);
- }
+ ITreeContentProvider contentProvider) {
+ super(parent, labelProvider, contentProvider);
+ }
- /*
+ /*
* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
-
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
Label line = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL
| SWT.BOLD);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
line.setLayoutData(gridData);
- GridLayout lay = (GridLayout) composite.getLayout();
- lay.marginHeight=0;
- composite.setLayout(lay);
-
+ GridLayout lay = (GridLayout) composite.getLayout();
+ lay.marginHeight=0;
+ composite.setLayout(lay);
+
return composite;
}
-
+
/*
* @see Dialog#createButtonBar(Composite)
@@ -77,33 +77,33 @@ public class RuledTreeSelectionDialog extends CheckedTreeSelectionDialog {
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setFont(font);
- /*
- * Create the rest of the button bar, but tell it not to
- * create a help button (we've already created it).
- */
- boolean helpAvailable = isHelpAvailable();
- setHelpAvailable(false);
- Composite c = (Composite) super.createButtonBar(composite);
- GridLayout lay = (GridLayout) c.getLayout();
- lay.marginHeight=0;
- c.setLayout(lay);
- composite.setLayout(layout);
-
- setHelpAvailable(helpAvailable);
+ /*
+ * Create the rest of the button bar, but tell it not to
+ * create a help button (we've already created it).
+ */
+ boolean helpAvailable = isHelpAvailable();
+ setHelpAvailable(false);
+ Composite c = (Composite) super.createButtonBar(composite);
+ GridLayout lay = (GridLayout) c.getLayout();
+ lay.marginHeight=0;
+ c.setLayout(lay);
+ composite.setLayout(layout);
+
+ setHelpAvailable(helpAvailable);
return composite;
}
-
+
@Override
- protected Label createMessageArea(Composite composite) {
- Label label = new Label(composite, SWT.NONE);
- if (this.getMessage() != null) {
- label.setText(this.getMessage());
- }
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.verticalIndent=10;
- label.setLayoutData(gd);
-
- label.setFont(composite.getFont());
- return label;
- }
+ protected Label createMessageArea(Composite composite) {
+ Label label = new Label(composite, SWT.NONE);
+ if (this.getMessage() != null) {
+ label.setText(this.getMessage());
+ }
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalIndent=10;
+ label.setLayoutData(gd);
+
+ label.setFont(composite.getFont());
+ return label;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationDelegate.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationDelegate.java
index ff75530241..37a553d5d4 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationDelegate.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationDelegate.java
@@ -49,386 +49,386 @@ import org.eclipse.linuxtools.tools.launch.core.factory.CdtSpawnerProcessFactory
*/
public class SystemTapLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
- private static final String [] escapableChars = new String [] {"(", ")", " "}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- private static final String TEMP_ERROR_OUTPUT =
- PluginConstants.getDefaultOutput() + "stapTempError.error"; //$NON-NLS-1$
- private String cmd;
- private File temporaryScript = null;
- private String arguments = ""; //$NON-NLS-1$
- private String scriptPath = ""; //$NON-NLS-1$
- private String binaryPath = ""; //$NON-NLS-1$
- private String outputPath = ""; //$NON-NLS-1$
- private boolean needsBinary = false; // Set to false if we want to use SystemTap
- private boolean needsArguments = false;
- private String binaryArguments = ""; //$NON-NLS-1$
- private String partialCommand = ""; //$NON-NLS-1$
- private String stap = ""; //$NON-NLS-1$
-
- @Override
- protected String getPluginID() {
- return null;
- }
-
- /**
- * Sets strings to blank, booleans to false and everything else to null
- */
- private void initialize() {
- temporaryScript = null;
- arguments = ""; //$NON-NLS-1$
- scriptPath = ""; //$NON-NLS-1$
- binaryPath = ""; //$NON-NLS-1$
- outputPath = ""; //$NON-NLS-1$
- needsBinary = false; // Set to false if we want to use SystemTap
- needsArguments = false;
- binaryArguments = ""; //$NON-NLS-1$
- }
-
- @Override
- public void launch(ILaunchConfiguration config, String mode,
- ILaunch launch, IProgressMonitor m) throws CoreException {
-
- if (m == null) {
- m = new NullProgressMonitor();
- }
- SubMonitor monitor = SubMonitor.convert(m,
- "SystemTap runtime monitor", 5); //$NON-NLS-1$
- initialize();
-
- // check for cancellation
- if (monitor.isCanceled()) {
- return;
- }
-
- /*
- * Set variables
- */
- if (!config.getAttribute(LaunchConfigurationConstants.ARGUMENTS,
- LaunchConfigurationConstants.DEFAULT_ARGUMENTS).equals(
- LaunchConfigurationConstants.DEFAULT_ARGUMENTS)) {
- arguments = config.getAttribute(
- LaunchConfigurationConstants.ARGUMENTS,
- LaunchConfigurationConstants.DEFAULT_ARGUMENTS);
- needsArguments = true;
- }
- if (!config.getAttribute(LaunchConfigurationConstants.BINARY_PATH,
- LaunchConfigurationConstants.DEFAULT_BINARY_PATH).equals(
- LaunchConfigurationConstants.DEFAULT_BINARY_PATH)) {
- binaryPath = config.getAttribute(
- LaunchConfigurationConstants.BINARY_PATH,
- LaunchConfigurationConstants.DEFAULT_BINARY_PATH);
- needsBinary = true;
- }
- if (!config.getAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS,
- LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS).equals(
- LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS)) {
- binaryArguments = config.getAttribute(
- LaunchConfigurationConstants.BINARY_ARGUMENTS,
- LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS);
- }
- if (!config.getAttribute(LaunchConfigurationConstants.SCRIPT_PATH,
- LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH).equals(
- LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH)) {
- scriptPath = config.getAttribute(
- LaunchConfigurationConstants.SCRIPT_PATH,
- LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH);
- }
- // Generate script if needed
- if (config.getAttribute(LaunchConfigurationConstants.NEED_TO_GENERATE,
- LaunchConfigurationConstants.DEFAULT_NEED_TO_GENERATE)) {
- temporaryScript = new File(scriptPath);
- temporaryScript.delete();
- try {
- temporaryScript.createNewFile();
- try (FileWriter fstream = new FileWriter(temporaryScript);
- BufferedWriter out = new BufferedWriter(fstream)) {
- out.write(config
- .getAttribute(
- LaunchConfigurationConstants.GENERATED_SCRIPT,
- LaunchConfigurationConstants.DEFAULT_GENERATED_SCRIPT));
- }
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- }
-
- stap = config.getAttribute(LaunchConfigurationConstants.COMMAND,
- PluginConstants.STAP_PATH);
-
- /**
- * Generate partial command
- */
- partialCommand = ConfigurationOptionsSetter.setOptions(config);
-
- outputPath = config.getAttribute(
- LaunchConfigurationConstants.OUTPUT_PATH,
- PluginConstants.getDefaultOutput());
-
- boolean fileExists = true;
- try {
- //Make sure the output file exists
- File tempFile = new File(outputPath);
- tempFile.delete();
- fileExists = tempFile.createNewFile();
- } catch (IOException e1) {
- fileExists = false;
- }
-
- // check for cancellation
- if ( !fileExists || monitor.isCanceled() ) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(Messages.getString("SystemTapLaunchConfigurationDelegate.0"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.1"), Messages.getString("SystemTapLaunchConfigurationDelegate.2") + outputPath + //$NON-NLS-1$ //$NON-NLS-2$
- Messages.getString("SystemTapLaunchConfigurationDelegate.3")); //$NON-NLS-1$
- mess.schedule();
- return;
- }
-
- finishLaunch(launch, config, m);
- }
-
- /**
- * Returns the current SystemTap command, or returns an error message.
- * @return
- */
- public String getCommand() {
- if (!cmd.isEmpty()) {
- return cmd;
- } else {
- return Messages.getString("SystemTapLaunchConfigurationDelegate.NoCommand"); //$NON-NLS-1$
- }
- }
-
- private void finishLaunch(ILaunch launch, ILaunchConfiguration config,
- IProgressMonitor monitor) {
-
- try {
- // Check for cancellation
- if (monitor.isCanceled() || launch == null) {
- return;
- }
- monitor.worked(1);
-
- // set the default source locator if required
- setDefaultSourceLocator(launch, config);
-
- /*
- * Fetch a parser
- */
- String parserClass = config.getAttribute(LaunchConfigurationConstants.PARSER_CLASS,
- LaunchConfigurationConstants.DEFAULT_PARSER_CLASS);
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] extensions = reg
- .getConfigurationElementsFor(PluginConstants.PARSER_RESOURCE,
- PluginConstants.PARSER_NAME,
- parserClass);
- if (extensions == null || extensions.length < 1) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser1"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser1"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser2") + //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser3") + parserClass); //$NON-NLS-1$
- mess.schedule();
- return;
- }
-
- IConfigurationElement element = extensions[0];
- SystemTapParser parser =
- (SystemTapParser) element.createExecutableExtension(PluginConstants.ATTR_CLASS);
-
- //Set parser options
- parser.setViewID(config.getAttribute(LaunchConfigurationConstants.VIEW_CLASS,
- LaunchConfigurationConstants.VIEW_CLASS));
- parser.setSourcePath(outputPath);
- parser.setMonitor(SubMonitor.convert(monitor));
- parser.setDone(false);
- parser.setSecondaryID(config.getAttribute(LaunchConfigurationConstants.SECONDARY_VIEW_ID,
- LaunchConfigurationConstants.DEFAULT_SECONDARY_VIEW_ID));
-
- parser.setKillButtonEnabled(true);
-
- monitor.worked(1);
-
- /*
- * Launch
- */
-
- File workDir = getWorkingDirectory(config);
- if (workDir == null) {
- workDir = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- //Put command into a shell script
- String cmd = generateCommand();
- File script = File.createTempFile("org.eclipse.linuxtools.profiling.launch" + System.currentTimeMillis(), ".sh"); //$NON-NLS-1$ //$NON-NLS-2$
- String data = "#!/bin/sh\nexec " + cmd; //$NON-NLS-1$
- try (FileOutputStream out = new FileOutputStream(script)){
- out.write(data.getBytes());
- }
-
- String [] commandArray = new String [] {"sh", script.getAbsolutePath()}; //$NON-NLS-1$
-
- Process subProcess = CdtSpawnerProcessFactory.getFactory().exec(commandArray, getEnvironment(config),
- workDir, true);
-
- IProcess process = DebugPlugin.newProcess(launch, subProcess,
- renderProcessLabel(commandArray[0]));
- // set the command line used
- process.setAttribute(IProcess.ATTR_CMDLINE,cmd);
-
- monitor.worked(1);
-
- StreamListener s = new StreamListener();
- process.getStreamsProxy().getErrorStreamMonitor().addListener(s);
-
- while (!process.isTerminated()) {
- Thread.sleep(100);
- if ((monitor != null && monitor.isCanceled()) || parser.isDone()) {
- parser.cancelJob();
- process.terminate();
- return;
- }
- }
- Thread.sleep(100);
- s.close();
- parser.setKillButtonEnabled(false);
-
- if (process.getExitValue() != 0) {
- parser.cancelJob();
- //exit code for command not found
- if (process.getExitValue() == 127){
- SystemTapUIErrorMessages errorDialog = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.stapNotFound")); //$NON-NLS-1$
-
- errorDialog.schedule();
- }else{
- SystemTapErrorHandler errorHandler = new SystemTapErrorHandler();
-
- //Prepare stap information
- errorHandler.appendToLog(config.getName() + Messages.getString("SystemTapLaunchConfigurationDelegate.stap_command") + cmd+ PluginConstants.NEW_LINE + PluginConstants.NEW_LINE);//$NON-NLS-1$
-
- //Handle error from TEMP_ERROR_OUTPUT
- errorHandler.handle(monitor, new FileReader(TEMP_ERROR_OUTPUT));
- if ((monitor != null && monitor.isCanceled())) {
- return;
- }
-
- errorHandler.finishHandling();
- if (errorHandler.isErrorRecognized()) {
- SystemTapUIErrorMessages errorDialog = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
- errorHandler.getErrorMessage());
-
- errorDialog.schedule();
- }
- }
- return;
- }
-
- if (element.getAttribute(PluginConstants.ATTR_REALTIME).equals(PluginConstants.VAL_TRUE)) {
- parser.setRealTime(true);
- }
-
- parser.schedule();
- monitor.worked(1);
-
- String message = generateErrorMessage(config.getName(), binaryArguments);
-
- DocWriter dw = new DocWriter(Messages.getString("SystemTapLaunchConfigurationDelegate.DocWriterName"), //$NON-NLS-1$
- (Helper.getConsoleByName(config.getName())), message);
- dw.schedule();
-
- } catch (IOException|InterruptedException|CoreException e) {
- e.printStackTrace();
- } finally {
- monitor.done();
-
- }
- }
-
- private String generateErrorMessage(String configName, String binaryCommand) {
- String output = ""; //$NON-NLS-1$
-
- if (binaryCommand == null || binaryCommand.length() < 0) {
- output = PluginConstants.NEW_LINE +
- PluginConstants.NEW_LINE + "-------------" + //$NON-NLS-1$
- PluginConstants.NEW_LINE +
- Messages.getString("SystemTapLaunchConfigurationDelegate.Relaunch10") //$NON-NLS-1$
- + configName + PluginConstants.NEW_LINE +
- Messages.getString("SystemTapLaunchConfigurationDelegate.Relaunch8") + //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.Relaunch9") + //$NON-NLS-1$
- "configuration in Profile As --> Profile Configurations." + //$NON-NLS-1$
- PluginConstants.NEW_LINE + PluginConstants.NEW_LINE;
- } else {
- output = PluginConstants.NEW_LINE
- + PluginConstants.NEW_LINE +"-------------" //$NON-NLS-1$
- + PluginConstants.NEW_LINE
- + Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage1") //$NON-NLS-1$
- + configName + PluginConstants.NEW_LINE +
- Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage2") //$NON-NLS-1$
- + binaryCommand + PluginConstants.NEW_LINE +
- Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage3") + //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage4") + //$NON-NLS-1$
- Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage5") + //$NON-NLS-1$
- PluginConstants.NEW_LINE + PluginConstants.NEW_LINE;
- }
-
- return output;
- }
-
- private static class StreamListener implements IStreamListener{
- private int counter;
- private BufferedWriter bw;
-
- public StreamListener() throws IOException {
- File file = new File(TEMP_ERROR_OUTPUT);
- file.delete();
- file.createNewFile();
- bw = Helper.setBufferedWriter(TEMP_ERROR_OUTPUT);
- counter = 0;
- }
-
- @Override
- public void streamAppended(String text, IStreamMonitor monitor) {
- try {
- if (text.length() < 1) {
- return;
- }
- counter++;
- if (counter < PluginConstants.MAX_ERRORS) {
- bw.append(text);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public void close() throws IOException {
- bw.close();
- }
- }
-
- public String generateCommand() {
- // Generate the command
- cmd = SystemTapCommandGenerator.generateCommand(escapeSpecialCharacters(scriptPath), escapeSpecialCharacters(binaryPath),
- partialCommand, needsBinary, needsArguments, escapeSpecialCharacters(arguments), binaryArguments, stap);
- cmd += " >& " + escapeSpecialCharacters(outputPath); //$NON-NLS-1$
- return cmd;
- }
-
- /**
- * Escapes special characters in the target string
- *
- * @param script the script to be executed by the shell.
- * @return the formatted string that will be executed.
- */
- private String escapeSpecialCharacters(String str) {
- // Modify script to catch escapable characters.
- String res = str;
- for (int i = 0; i < escapableChars.length; i++) {
- res = res.replace(escapableChars[i], "\\" + escapableChars[i]); //$NON-NLS-1$
- }
- return res;
- }
+ private static final String [] escapableChars = new String [] {"(", ")", " "}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ private static final String TEMP_ERROR_OUTPUT =
+ PluginConstants.getDefaultOutput() + "stapTempError.error"; //$NON-NLS-1$
+ private String cmd;
+ private File temporaryScript = null;
+ private String arguments = ""; //$NON-NLS-1$
+ private String scriptPath = ""; //$NON-NLS-1$
+ private String binaryPath = ""; //$NON-NLS-1$
+ private String outputPath = ""; //$NON-NLS-1$
+ private boolean needsBinary = false; // Set to false if we want to use SystemTap
+ private boolean needsArguments = false;
+ private String binaryArguments = ""; //$NON-NLS-1$
+ private String partialCommand = ""; //$NON-NLS-1$
+ private String stap = ""; //$NON-NLS-1$
+
+ @Override
+ protected String getPluginID() {
+ return null;
+ }
+
+ /**
+ * Sets strings to blank, booleans to false and everything else to null
+ */
+ private void initialize() {
+ temporaryScript = null;
+ arguments = ""; //$NON-NLS-1$
+ scriptPath = ""; //$NON-NLS-1$
+ binaryPath = ""; //$NON-NLS-1$
+ outputPath = ""; //$NON-NLS-1$
+ needsBinary = false; // Set to false if we want to use SystemTap
+ needsArguments = false;
+ binaryArguments = ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public void launch(ILaunchConfiguration config, String mode,
+ ILaunch launch, IProgressMonitor m) throws CoreException {
+
+ if (m == null) {
+ m = new NullProgressMonitor();
+ }
+ SubMonitor monitor = SubMonitor.convert(m,
+ "SystemTap runtime monitor", 5); //$NON-NLS-1$
+ initialize();
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ /*
+ * Set variables
+ */
+ if (!config.getAttribute(LaunchConfigurationConstants.ARGUMENTS,
+ LaunchConfigurationConstants.DEFAULT_ARGUMENTS).equals(
+ LaunchConfigurationConstants.DEFAULT_ARGUMENTS)) {
+ arguments = config.getAttribute(
+ LaunchConfigurationConstants.ARGUMENTS,
+ LaunchConfigurationConstants.DEFAULT_ARGUMENTS);
+ needsArguments = true;
+ }
+ if (!config.getAttribute(LaunchConfigurationConstants.BINARY_PATH,
+ LaunchConfigurationConstants.DEFAULT_BINARY_PATH).equals(
+ LaunchConfigurationConstants.DEFAULT_BINARY_PATH)) {
+ binaryPath = config.getAttribute(
+ LaunchConfigurationConstants.BINARY_PATH,
+ LaunchConfigurationConstants.DEFAULT_BINARY_PATH);
+ needsBinary = true;
+ }
+ if (!config.getAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS,
+ LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS).equals(
+ LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS)) {
+ binaryArguments = config.getAttribute(
+ LaunchConfigurationConstants.BINARY_ARGUMENTS,
+ LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS);
+ }
+ if (!config.getAttribute(LaunchConfigurationConstants.SCRIPT_PATH,
+ LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH).equals(
+ LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH)) {
+ scriptPath = config.getAttribute(
+ LaunchConfigurationConstants.SCRIPT_PATH,
+ LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH);
+ }
+ // Generate script if needed
+ if (config.getAttribute(LaunchConfigurationConstants.NEED_TO_GENERATE,
+ LaunchConfigurationConstants.DEFAULT_NEED_TO_GENERATE)) {
+ temporaryScript = new File(scriptPath);
+ temporaryScript.delete();
+ try {
+ temporaryScript.createNewFile();
+ try (FileWriter fstream = new FileWriter(temporaryScript);
+ BufferedWriter out = new BufferedWriter(fstream)) {
+ out.write(config
+ .getAttribute(
+ LaunchConfigurationConstants.GENERATED_SCRIPT,
+ LaunchConfigurationConstants.DEFAULT_GENERATED_SCRIPT));
+ }
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ stap = config.getAttribute(LaunchConfigurationConstants.COMMAND,
+ PluginConstants.STAP_PATH);
+
+ /**
+ * Generate partial command
+ */
+ partialCommand = ConfigurationOptionsSetter.setOptions(config);
+
+ outputPath = config.getAttribute(
+ LaunchConfigurationConstants.OUTPUT_PATH,
+ PluginConstants.getDefaultOutput());
+
+ boolean fileExists = true;
+ try {
+ //Make sure the output file exists
+ File tempFile = new File(outputPath);
+ tempFile.delete();
+ fileExists = tempFile.createNewFile();
+ } catch (IOException e1) {
+ fileExists = false;
+ }
+
+ // check for cancellation
+ if ( !fileExists || monitor.isCanceled() ) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(Messages.getString("SystemTapLaunchConfigurationDelegate.0"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.1"), Messages.getString("SystemTapLaunchConfigurationDelegate.2") + outputPath + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.3")); //$NON-NLS-1$
+ mess.schedule();
+ return;
+ }
+
+ finishLaunch(launch, config, m);
+ }
+
+ /**
+ * Returns the current SystemTap command, or returns an error message.
+ * @return
+ */
+ public String getCommand() {
+ if (!cmd.isEmpty()) {
+ return cmd;
+ } else {
+ return Messages.getString("SystemTapLaunchConfigurationDelegate.NoCommand"); //$NON-NLS-1$
+ }
+ }
+
+ private void finishLaunch(ILaunch launch, ILaunchConfiguration config,
+ IProgressMonitor monitor) {
+
+ try {
+ // Check for cancellation
+ if (monitor.isCanceled() || launch == null) {
+ return;
+ }
+ monitor.worked(1);
+
+ // set the default source locator if required
+ setDefaultSourceLocator(launch, config);
+
+ /*
+ * Fetch a parser
+ */
+ String parserClass = config.getAttribute(LaunchConfigurationConstants.PARSER_CLASS,
+ LaunchConfigurationConstants.DEFAULT_PARSER_CLASS);
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor(PluginConstants.PARSER_RESOURCE,
+ PluginConstants.PARSER_NAME,
+ parserClass);
+ if (extensions == null || extensions.length < 1) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser1"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser1"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser2") + //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.InvalidParser3") + parserClass); //$NON-NLS-1$
+ mess.schedule();
+ return;
+ }
+
+ IConfigurationElement element = extensions[0];
+ SystemTapParser parser =
+ (SystemTapParser) element.createExecutableExtension(PluginConstants.ATTR_CLASS);
+
+ //Set parser options
+ parser.setViewID(config.getAttribute(LaunchConfigurationConstants.VIEW_CLASS,
+ LaunchConfigurationConstants.VIEW_CLASS));
+ parser.setSourcePath(outputPath);
+ parser.setMonitor(SubMonitor.convert(monitor));
+ parser.setDone(false);
+ parser.setSecondaryID(config.getAttribute(LaunchConfigurationConstants.SECONDARY_VIEW_ID,
+ LaunchConfigurationConstants.DEFAULT_SECONDARY_VIEW_ID));
+
+ parser.setKillButtonEnabled(true);
+
+ monitor.worked(1);
+
+ /*
+ * Launch
+ */
+
+ File workDir = getWorkingDirectory(config);
+ if (workDir == null) {
+ workDir = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ //Put command into a shell script
+ String cmd = generateCommand();
+ File script = File.createTempFile("org.eclipse.linuxtools.profiling.launch" + System.currentTimeMillis(), ".sh"); //$NON-NLS-1$ //$NON-NLS-2$
+ String data = "#!/bin/sh\nexec " + cmd; //$NON-NLS-1$
+ try (FileOutputStream out = new FileOutputStream(script)){
+ out.write(data.getBytes());
+ }
+
+ String [] commandArray = new String [] {"sh", script.getAbsolutePath()}; //$NON-NLS-1$
+
+ Process subProcess = CdtSpawnerProcessFactory.getFactory().exec(commandArray, getEnvironment(config),
+ workDir, true);
+
+ IProcess process = DebugPlugin.newProcess(launch, subProcess,
+ renderProcessLabel(commandArray[0]));
+ // set the command line used
+ process.setAttribute(IProcess.ATTR_CMDLINE,cmd);
+
+ monitor.worked(1);
+
+ StreamListener s = new StreamListener();
+ process.getStreamsProxy().getErrorStreamMonitor().addListener(s);
+
+ while (!process.isTerminated()) {
+ Thread.sleep(100);
+ if ((monitor != null && monitor.isCanceled()) || parser.isDone()) {
+ parser.cancelJob();
+ process.terminate();
+ return;
+ }
+ }
+ Thread.sleep(100);
+ s.close();
+ parser.setKillButtonEnabled(false);
+
+ if (process.getExitValue() != 0) {
+ parser.cancelJob();
+ //exit code for command not found
+ if (process.getExitValue() == 127){
+ SystemTapUIErrorMessages errorDialog = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.stapNotFound")); //$NON-NLS-1$
+
+ errorDialog.schedule();
+ }else{
+ SystemTapErrorHandler errorHandler = new SystemTapErrorHandler();
+
+ //Prepare stap information
+ errorHandler.appendToLog(config.getName() + Messages.getString("SystemTapLaunchConfigurationDelegate.stap_command") + cmd+ PluginConstants.NEW_LINE + PluginConstants.NEW_LINE);//$NON-NLS-1$
+
+ //Handle error from TEMP_ERROR_OUTPUT
+ errorHandler.handle(monitor, new FileReader(TEMP_ERROR_OUTPUT));
+ if ((monitor != null && monitor.isCanceled())) {
+ return;
+ }
+
+ errorHandler.finishHandling();
+ if (errorHandler.isErrorRecognized()) {
+ SystemTapUIErrorMessages errorDialog = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.CallGraphGenericError"), //$NON-NLS-1$
+ errorHandler.getErrorMessage());
+
+ errorDialog.schedule();
+ }
+ }
+ return;
+ }
+
+ if (element.getAttribute(PluginConstants.ATTR_REALTIME).equals(PluginConstants.VAL_TRUE)) {
+ parser.setRealTime(true);
+ }
+
+ parser.schedule();
+ monitor.worked(1);
+
+ String message = generateErrorMessage(config.getName(), binaryArguments);
+
+ DocWriter dw = new DocWriter(Messages.getString("SystemTapLaunchConfigurationDelegate.DocWriterName"), //$NON-NLS-1$
+ (Helper.getConsoleByName(config.getName())), message);
+ dw.schedule();
+
+ } catch (IOException|InterruptedException|CoreException e) {
+ e.printStackTrace();
+ } finally {
+ monitor.done();
+
+ }
+ }
+
+ private String generateErrorMessage(String configName, String binaryCommand) {
+ String output = ""; //$NON-NLS-1$
+
+ if (binaryCommand == null || binaryCommand.length() < 0) {
+ output = PluginConstants.NEW_LINE +
+ PluginConstants.NEW_LINE + "-------------" + //$NON-NLS-1$
+ PluginConstants.NEW_LINE +
+ Messages.getString("SystemTapLaunchConfigurationDelegate.Relaunch10") //$NON-NLS-1$
+ + configName + PluginConstants.NEW_LINE +
+ Messages.getString("SystemTapLaunchConfigurationDelegate.Relaunch8") + //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.Relaunch9") + //$NON-NLS-1$
+ "configuration in Profile As --> Profile Configurations." + //$NON-NLS-1$
+ PluginConstants.NEW_LINE + PluginConstants.NEW_LINE;
+ } else {
+ output = PluginConstants.NEW_LINE
+ + PluginConstants.NEW_LINE +"-------------" //$NON-NLS-1$
+ + PluginConstants.NEW_LINE
+ + Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage1") //$NON-NLS-1$
+ + configName + PluginConstants.NEW_LINE +
+ Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage2") //$NON-NLS-1$
+ + binaryCommand + PluginConstants.NEW_LINE +
+ Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage3") + //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage4") + //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchConfigurationDelegate.EndMessage5") + //$NON-NLS-1$
+ PluginConstants.NEW_LINE + PluginConstants.NEW_LINE;
+ }
+
+ return output;
+ }
+
+ private static class StreamListener implements IStreamListener{
+ private int counter;
+ private BufferedWriter bw;
+
+ public StreamListener() throws IOException {
+ File file = new File(TEMP_ERROR_OUTPUT);
+ file.delete();
+ file.createNewFile();
+ bw = Helper.setBufferedWriter(TEMP_ERROR_OUTPUT);
+ counter = 0;
+ }
+
+ @Override
+ public void streamAppended(String text, IStreamMonitor monitor) {
+ try {
+ if (text.length() < 1) {
+ return;
+ }
+ counter++;
+ if (counter < PluginConstants.MAX_ERRORS) {
+ bw.append(text);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void close() throws IOException {
+ bw.close();
+ }
+ }
+
+ public String generateCommand() {
+ // Generate the command
+ cmd = SystemTapCommandGenerator.generateCommand(escapeSpecialCharacters(scriptPath), escapeSpecialCharacters(binaryPath),
+ partialCommand, needsBinary, needsArguments, escapeSpecialCharacters(arguments), binaryArguments, stap);
+ cmd += " >& " + escapeSpecialCharacters(outputPath); //$NON-NLS-1$
+ return cmd;
+ }
+
+ /**
+ * Escapes special characters in the target string
+ *
+ * @param script the script to be executed by the shell.
+ * @return the formatted string that will be executed.
+ */
+ private String escapeSpecialCharacters(String str) {
+ // Modify script to catch escapable characters.
+ String res = str;
+ for (int i = 0; i < escapableChars.length; i++) {
+ res = res.replace(escapableChars[i], "\\" + escapableChars[i]); //$NON-NLS-1$
+ }
+ return res;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationTabGroup.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationTabGroup.java
index cedcca98de..24a622f6d6 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationTabGroup.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchConfigurationTabGroup.java
@@ -26,18 +26,18 @@ import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGrou
*/
public class SystemTapLaunchConfigurationTabGroup extends ProfileLaunchConfigurationTabGroup {
- @Override
- public AbstractLaunchConfigurationTab[] getProfileTabs() {
- return new AbstractLaunchConfigurationTab[] {
- new SystemTapOptionsTab()
- };
- }
+ @Override
+ public AbstractLaunchConfigurationTab[] getProfileTabs() {
+ return new AbstractLaunchConfigurationTab[] {
+ new SystemTapOptionsTab()
+ };
+ }
- @Override
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ArrayList<AbstractLaunchConfigurationTab> tabs = new ArrayList<>();
+ @Override
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ArrayList<AbstractLaunchConfigurationTab> tabs = new ArrayList<>();
- tabs.addAll(Arrays.asList(getProfileTabs()));
- setTabs(tabs.toArray(new AbstractLaunchConfigurationTab[tabs.size()]));
- }
+ tabs.addAll(Arrays.asList(getProfileTabs()));
+ setTabs(tabs.toArray(new AbstractLaunchConfigurationTab[tabs.size()]));
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
index 23c16add7d..556d96c23c 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
@@ -90,735 +90,735 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
* </ul>
*<br>
*<br>
- * The following protected parameters are provided by
- * SystemTapLaunchShortcut:
- *<br> <br>
- * Optional customization parameters: <code> protected String name; protected
- * String binaryPath; protected String arguments; protected String
- * outputPath; protected String dirPath; protected String generatedScript;
- * protected boolean needToGenerate; protected boolean overwrite;</code>
- * <br> <br>
- * Mandatory: <code> protected String scriptPath; protected ILaunchConfiguration
- * config;</code>
+ * The following protected parameters are provided by
+ * SystemTapLaunchShortcut:
+ *<br> <br>
+ * Optional customization parameters: <code> protected String name; protected
+ * String binaryPath; protected String arguments; protected String
+ * outputPath; protected String dirPath; protected String generatedScript;
+ * protected boolean needToGenerate; protected boolean overwrite;</code>
+ * <br> <br>
+ * Mandatory: <code> protected String scriptPath; protected ILaunchConfiguration
+ * config;</code>
*/
public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
- protected IEditorPart editor;
-
- private static final String USER_SELECTED_ALL = "ALL"; //$NON-NLS-1$
- private static final String MAIN_FUNC_NAME = "main"; //$NON-NLS-1$
-
- protected String name;
- protected String binaryPath;
- protected String scriptPath;
- protected String arguments;
- protected String outputPath;
- protected String binName;
- protected String generatedScript;
- protected String parserID;
- protected String viewID;
- protected boolean needToGenerate;
- protected boolean overwrite;
- protected boolean useColours;
- protected String resourceToSearchFor;
- protected boolean searchForResource;
- protected IBinary bin;
-
- private boolean testMode = false;
- protected String secondaryID = ""; //$NON-NLS-1$
-
- /**
- * Initialize variables. Highly recommend calling this function within the
- * launch methods. Will call setScriptPath, setParserID and setViewID.
- */
- public void initialize() {
- name = ""; //$NON-NLS-1$
- binaryPath = LaunchConfigurationConstants.DEFAULT_BINARY_PATH;
- arguments = LaunchConfigurationConstants.DEFAULT_ARGUMENTS;
- outputPath = PluginConstants.getDefaultIOPath();
- overwrite = true;
- generatedScript = LaunchConfigurationConstants.DEFAULT_GENERATED_SCRIPT;
- needToGenerate = false;
- useColours = false;
- secondaryID = ""; //$NON-NLS-1$
- }
-
- @Override
- protected ILaunchConfigurationType getLaunchConfigType() {
- return getLaunchManager().getLaunchConfigurationType(
- PluginConstants.CONFIGURATION_TYPE_ID);
- }
-
- @Override
- protected void setDefaultProfileAttributes(
- ILaunchConfigurationWorkingCopy wc) {
- SystemTapOptionsTab tab = new SystemTapOptionsTab();
- tab.setDefaults(wc);
- }
-
- /**
- * Helper function to complete launches. Uses protected parameters (Strings)
- * scriptPath, binaryPath, arguments, outputPath and (boolean) overwrite.
- * These must be set by the calling function (or else nonsensical results
- * will occur). <br>
- * If scriptPath has not been set, the setScriptPath() method will be
- * called.
- *
- * @param name : Used to generate the name of the new configuration
- * @param bin : Affiliated executable
- * @param mode : Mode setting
- * @param wc : A working copy of the launch configuration
- * @throws IOException
- */
- protected void finishLaunch(String name, String mode, ILaunchConfigurationWorkingCopy wc) throws IOException {
- if (!finishLaunchHelper()) {
- return;
- }
-
- if (wc != null) {
-
- wc.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,scriptPath);
-
- if (!invalid(binaryPath)) {
- wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH,binaryPath);
- }
-
- wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,outputPath);
- wc.setAttribute(LaunchConfigurationConstants.ARGUMENTS, arguments);
- wc.setAttribute(LaunchConfigurationConstants.GENERATED_SCRIPT,generatedScript);
- wc.setAttribute(LaunchConfigurationConstants.NEED_TO_GENERATE,needToGenerate);
- wc.setAttribute(LaunchConfigurationConstants.OVERWRITE, overwrite);
- wc.setAttribute(LaunchConfigurationConstants.USE_COLOUR,useColours);
- wc.setAttribute(LaunchConfigurationConstants.PARSER_CLASS,parserID);
- wc.setAttribute(LaunchConfigurationConstants.VIEW_CLASS, viewID);
- wc.setAttribute(LaunchConfigurationConstants.SECONDARY_VIEW_ID, ""); //$NON-NLS-1$
-
- if (!testMode) {
- DebugUITools.launch(wc, mode);
- }
- }
-
- }
-
- /**
- * returns true if str == null || str.length() < 1. Convenience method.
- *
- * @param str
- * @return
- */
- private static boolean invalid(String str) {
- return (str == null || str.length() < 1);
- }
-
- /**
- * Helper function for methods common to both types of finishLaunch.
- * @throws IOException
- *
- */
- private boolean finishLaunchHelper() throws IOException {
- if (invalid(scriptPath)) {
- scriptPath = setScriptPath();
- }
- if (invalid(scriptPath)) {
- // Setting the variable didn't work, do not launch.
-
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- Messages
- .getString("SystemTapLaunchShortcut.ErrorMessageName"), //$NON-NLS-1$
- Messages
- .getString("SystemTapLaunchShortcut.ErrorMessageTitle"), Messages.getString("SystemTapLaunchShortcut.ErrorMessage") + name); //$NON-NLS-1$ //$NON-NLS-2$
- mess.schedule();
- return false;
- }
-
- if (invalid(parserID)) {
- parserID = setParserID();
- }
- if (invalid(parserID)) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapLaunchShortcut.InvalidParser1"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchShortcut.InvalidParser2"), Messages.getString("SystemTapLaunchShortcut.InvalidParser3")); //$NON-NLS-1$ //$NON-NLS-2$
- mess.schedule();
- return false;
- }
-
- if (invalid(viewID)) {
- viewID = setViewID();
- }
- if (invalid(viewID)) {
- // Setting the variable didn't work, do not launch.
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- Messages.getString("SystemTapLaunchShortcut.InvalidView1"), //$NON-NLS-1$
- Messages.getString("SystemTapLaunchShortcut.InvalidView2"), Messages.getString("SystemTapLaunchShortcut.InvalidView3")); //$NON-NLS-1$ //$NON-NLS-2$
- mess.schedule();
- return false;
- }
-
- if (needToGenerate) {
- if (invalid(generatedScript)) {
- generatedScript = generateScript();
- }
- if (invalid(generatedScript)) {
- // Setting the variable didn't work, do not launch.
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- Messages
- .getString("SystemTapLaunchShortcut.InvalidGeneration1"), //$NON-NLS-1$
- Messages
- .getString("SystemTapLaunchShortcut.InvalidGeneration2"), Messages.getString("SystemTapLaunchShortcut.InvalidGeneration3"));//$NON-NLS-1$ //$NON-NLS-2$
- mess.schedule();
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns bin.getPath().toString()
- *
- * @param bin
- * @return
- */
- public String getName(IBinary bin) {
- if (bin != null) {
- binName = bin.getPath().toString();
- } else {
- binName = ""; //$NON-NLS-1$
- }
- return binName;
- }
-
- /**
- * Creates a configuration for the given IBinary
- *
- */
- @Override
- protected ILaunchConfiguration createConfiguration(IBinary bin) {
- if (bin != null) {
- return super.createConfiguration(bin);
- } else {
- try {
- return getLaunchConfigType()
- .newInstance(
- null,
- getLaunchManager()
- .generateLaunchConfigurationName(
- Messages.getString("SystemTapLaunchShortcut.Invalid"))); //$NON-NLS-1$
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- /**
- * Allows null configurations to be launched. Any launch that uses a binary
- * should never call this configuration with a null parameter, and any
- * launch that does not use a binary should never call this function. The
- * null handling is included for ease of testing.
- *
- * @param bin
- * @param name
- * - Customize the name based on the shortcut being launched
- * @return A launch configuration, or null
- */
- protected ILaunchConfigurationWorkingCopy createConfiguration(IBinary bin,
- String name) {
- ILaunchConfigurationWorkingCopy wc = null;
- if (bin != null) {
- try {
- String projectName = bin.getResource().getProjectRelativePath().toString();
- ILaunchConfigurationType configType = getLaunchConfigType();
- wc = configType.newInstance(
- null,
- getLaunchManager().generateLaunchConfigurationName(
- name + " - " + bin.getElementName())); //$NON-NLS-1$
-
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,projectName);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
- wc.setMappedResources(new IResource[] { bin.getResource(),bin.getResource().getProject() });
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,(String) null);
-
- setDefaultProfileAttributes(wc);
-
- } catch (CoreException e) {
- e.printStackTrace();
- }
- } else {
-
- try {
- wc = getLaunchConfigType().newInstance(
- null,
- getLaunchManager()
- .generateLaunchConfigurationName(name));
- setDefaultProfileAttributes(wc);
- } catch (CoreException e) {
- e.printStackTrace();
- return null;
- }
- }
- return wc;
- }
-
- /*
- * The following are convenience methods for test programs, etc. to check
- * the value of certain protected parameters.
- */
-
- public ILaunchConfigurationType outsideGetLaunchConfigType() {
- return getLaunchConfigType();
- }
-
- public String getArguments() {
- return arguments;
- }
-
- /**
- * Retrieves the names of all functions referenced by the binary. If
- * searchForResource is true, this function will return all function names
- * belonging to an element with name matching the String held by
- * resourceToSearchFor. Otherwise it will create a dialog prompting the user
- * to select from a list of files to profile, or select the only available
- * file if only one file is available.
- *
- *
- * @param bin
- * @return
- */
- protected String getFunctionsFromBinary(IBinary bin, String targetResource) {
- String funcs = ""; //$NON-NLS-1$
- if (bin == null) {
- return funcs;
- }
- try {
- ArrayList<ICContainer> list = new ArrayList<>();
- TranslationUnitVisitor v = new TranslationUnitVisitor();
-
- for (ICElement b : bin.getCProject().getChildrenOfType(
- ICElement.C_CCONTAINER)) {
- ICContainer c = (ICContainer) b;
-
- for (ITranslationUnit tu : c.getTranslationUnits()) {
- if (searchForResource
- && tu.getElementName().contains(targetResource)) {
- tu.accept(v);
- funcs += v.getFunctions();
- return funcs;
- } else {
- if (!list.contains(c)) {
- list.add(c);
- }
- }
- }
-
- // Iterate down to all children, checking for more C_Containers
- while (c.getChildrenOfType(ICElement.C_CCONTAINER).size() > 0) {
- ICContainer e = null;
- for (ICElement d : c
- .getChildrenOfType(ICElement.C_CCONTAINER)) {
- e = (ICContainer) d;
- for (ITranslationUnit tu : e.getTranslationUnits()) {
- if (searchForResource
- && tu.getElementName().contains(
- targetResource)) {
- tu.accept(v);
- funcs += (v.getFunctions());
- return funcs;
- } else {
- if (!list.contains(c)) {
- list.add(c);
- }
- }
- }
- }
- c = e;
- }
- }
-
- int numberOfFiles = numberOfValidFiles(list.toArray());
- if (numberOfFiles == 1) {
- for (ICContainer c : list) {
- for (ITranslationUnit e : c.getTranslationUnits()) {
- if (validElement(e)) {
- e.accept(v);
- funcs += v.getFunctions();
- }
- }
- }
- } else {
-
- Object[] unitList = chooseUnit(list, numberOfFiles);
- if (unitList == null || unitList.length == 0) {
- return null;
- } else if (unitList.length == 1
- && unitList[0].toString().equals(USER_SELECTED_ALL)) {
- funcs = "*"; //$NON-NLS-1$
- return funcs;
- }
-
- StringBuilder tmpFunc = new StringBuilder();
- for (String item : getAllFunctions(bin.getCProject(), unitList)) {
- tmpFunc.append(item);
- tmpFunc.append(" "); //$NON-NLS-1$
- }
- funcs = tmpFunc.toString();
-
- }
-
- return funcs;
-
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- /**
- * Creates a dialog that prompts the user to select from the given list of
- * ICElements
- *
- * @param list
- * : list of ICElements
- * @return
- */
- private Object[] chooseUnit(List<ICContainer> list, int numberOfValidFiles) {
- ListTreeContentProvider prov = new ListTreeContentProvider();
-
- RuledTreeSelectionDialog dialog = new RuledTreeSelectionDialog(
- getActiveWorkbenchShell(), new WorkbenchLabelProvider(), prov);
-
- dialog.setTitle(Messages.getString("SystemTapLaunchShortcut.SelectFiles")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("SystemTapLaunchShortcut.SelectFilesMsg")); //$NON-NLS-1$
- dialog.setInput(list);
- dialog.setHelpAvailable(false);
- dialog.setStatusLineAboveButtons(false);
- dialog.setEmptyListMessage(Messages
- .getString("SystemTapLaunchShortcut.NoFiles")); //$NON-NLS-1$
- dialog.setContainerMode(true);
-
- Object[] topLevel = prov.findElements(list);
- dialog.setInitialSelections(topLevel);
- dialog.setSize(cap(topLevel.length * 10, 30, 55), cap(
- (int) (topLevel.length * 1.5), 3, 13));
-
- dialog.create();
- Button okButton = dialog.getOkButton();
-
- Object[] result = null;
-
- if (testMode) {
- okButton.setSelection(true);
- result = list.toArray();
- ArrayList<Object> output = new ArrayList<>();
- try {
- for (Object obj : result) {
- if (obj instanceof ICContainer) {
- ICElement[] array = ((ICContainer) obj).getChildren();
- for (ICElement c : array) {
- if (!(validElement(c))) {
- continue;
- }
- if (c.getElementName().contains(MAIN_FUNC_NAME) && !output.contains(c)) {
- output.add(c);
- }
- }
- }
- }
-
- if (output.size() >= numberOfValidFiles) {
- output.clear();
- output.add(USER_SELECTED_ALL);
- }
- } catch (CModelException e) {
- e.printStackTrace();
- }
-
- result = output.toArray();
- } else {
- if (dialog.open() == Window.CANCEL) {
- return null;
- }
- result = dialog.getResult();
- }
-
- if (result == null) {
- return null;
- }
-
- ArrayList<Object> output = new ArrayList<>();
- try {
- for (Object obj : result) {
- if (obj instanceof ICContainer) {
- ICElement[] array = ((ICContainer) obj).getChildren();
- for (ICElement c : array) {
- if (!(validElement(c))) {
- continue;
- }
- if (!output.contains(c)) {
- output.add(c);
- }
- }
- } else if ((obj instanceof ICElement)
- && validElement((ICElement) obj)
- && !output.contains(obj)) {
- output.add(obj);
- }
- }
-
- if (output.size() >= numberOfValidFiles) {
- output.clear();
- output.add(USER_SELECTED_ALL);
- }
- } catch (CModelException e) {
- e.printStackTrace();
- }
-
- return output.toArray();
- }
-
- private int numberOfValidFiles(Object[] list) throws CModelException {
- int output = 0;
- for (Object parent : list) {
- if (parent instanceof ICContainer) {
- ICContainer cont = (ICContainer) parent;
- for (ICElement ele : cont.getChildren()) {
- if (ele instanceof ICContainer) {
- output += numberOfValidFiles(((ICContainer) ele)
- .getChildren());
- }
- if (validElement(ele)) {
- output++;
- }
- }
- } else if ((parent instanceof ICElement)
- && validElement((ICElement) parent)) {
- output++;
- }
- }
- return output;
- }
-
- /**
- * @param project
- * : C Project Type
- * @return A String list of all functions contained within the specified C
- * Project
- */
- private static List<String> getAllFunctions(ICProject project,
- Object[] listOfFiles) {
- try {
- GetFunctionsJob j = new GetFunctionsJob(project
- .getHandleIdentifier(), project, listOfFiles);
- j.schedule();
- j.join();
- ArrayList<String> functionList = j.getFunctionList();
-
- return functionList;
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Returns all ICElements in val that contains the given path. WARNING: Uses
- * .contains, so be careful with the String path or you'll get too many
- * hits.
- *
- * @param list
- * @param path
- * @return
- */
- private static boolean specialContains(Object[] list, String path) {
- for (Object val : list) {
- if (val instanceof ICElement) {
- ICElement el = (ICElement) val;
- if (el.getPath().toString().contains(path)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns a number clipped into the range [low,high].
- *
- * @param number
- * @param low
- * @param high
- * @return number if number is in [low,high], low, or high.
- */
- private int cap(int number, int low, int high) {
- if (number > high) {
- return high;
- }
- if (number < low) {
- return low;
- }
- return number;
- }
-
- /**
- * Function for generating scripts. Should be overridden by interested
- * classes
- *
- * @throws IOException
- */
- @SuppressWarnings("unused")
- public String generateScript() throws IOException {
- return null;
- }
-
- private static class GetFunctionsJob extends Job {
- private ArrayList<String> functionList;
- private ICProject project;
- private Object[] listOfFiles;
-
- public GetFunctionsJob(String name, ICProject p, Object[] o) {
- super(name);
- functionList = new ArrayList<>();
- listOfFiles = Arrays.copyOf(o, o.length);
- project = p;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IIndexManager manager = CCorePlugin.getIndexManager();
- IIndex index = null;
- IProgressMonitor m = monitor;
-
- if (m == null) {
- m = new NullProgressMonitor();
- }
- m.worked(1);
-
- try {
- index = manager.getIndex(project);
- index.acquireReadLock();
-
- IIndexFile[] blah = index.getAllFiles();
- for (IIndexFile file : blah) {
- String fullFilePath = file.getLocation().getFullPath();
- if (fullFilePath == null
- || !specialContains(listOfFiles, fullFilePath)) {
- continue;
- }
-
- IIndexName[] indexNamesArray = file.findNames(0,
- Integer.MAX_VALUE);
- for (IIndexName name : indexNamesArray) {
- if (name.isDefinition()
- && specialContains(listOfFiles, name.getFile()
- .getLocation().getFullPath())) {
- IIndexBinding binder = index.findBinding(name);
- if (binder instanceof IFunction
- && !functionList.contains(binder.getName())) {
- functionList.add(binder.getName());
- }
- }
- }
-
- m.worked(1);
- }
- index.releaseReadLock();
-
- } catch (CoreException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- return Status.OK_STATUS;
- }
-
- public ArrayList<String> getFunctionList() {
- return functionList;
- }
- }
-
-
- /**
- * Set the parserID variable. ParserID should point to the ID of an
- * extension extending the org.eclipse.linuxtools.callgraph.core.parser
- * extension point. This function must return the parserID to be set.
- *
- * If not declared, the parserID will be set to the default SystemTap
- * Text parser with colour support
- *
- * @return a valid parserID
- */
- public String setParserID() {
- return PluginConstants.DEFAULT_PARSER_ID;
- }
-
- public String getScript() {
- return generatedScript;
- }
-
- public void setTestMode(boolean val) {
- testMode = val;
- }
-
- /**
- * Set the viewID variable. ViewID should point to the ID of an extension
- * extending the org.eclipse.ui.views extension point. This function must
- * return the viewID to be set. Defaults to the SystemTap Text View, if
- * not overridden.
- *
- * @return a valid viewID
- */
- public String setViewID() {
- return PluginConstants.DEFAULT_VIEW_ID;
- }
-
- public static boolean validElement(ICElement e) {
- return e.getElementName().endsWith(".c") || //$NON-NLS-1$
- e.getElementName().endsWith(".cpp") || //$NON-NLS-1$
- e.getElementName().endsWith(".h"); //$NON-NLS-1$
- }
-
-
- /**
- * Default implementation of launch. It will run stap with the selected binary
- * as an argument and set the output path to <code>PluginConstants.getDefaultIOPath()</code>.
- * <br>
- * The name of the created launch will be 'DefaultSystemTapLaunch'
- */
- @Override
- public void launch(IBinary bin, String mode) {
- initialize();
- this.bin = bin;
- binName = getName(bin);
- name = "DefaultSystemTapLaunch"; //$NON-NLS-1$
-
- try {
-
- ILaunchConfigurationWorkingCopy wc = createConfiguration(bin, name);
- binaryPath = bin.getResource().getLocation().toString();
- arguments = binaryPath;
- outputPath = PluginConstants.getDefaultIOPath();
- finishLaunch(name, mode, wc);
-
- } catch (IOException e) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- "LaunchShortcutScriptGen", //$NON-NLS-1$
- Messages.getString("LaunchStapGraph.ScriptGenErr"), //$NON-NLS-1$
- Messages.getString("LaunchStapGraph.ScriptGenErrMsg")); //$NON-NLS-1$
- mess.schedule();
- e.printStackTrace();
- } finally {
- resourceToSearchFor = ""; //$NON-NLS-1$
- searchForResource = false;
- }
-
-
- }
-
-
- /**
- * Each launch class should define its own script path. Must return the
- * correct script path or launch will fail.
- */
- public abstract String setScriptPath();
+ protected IEditorPart editor;
+
+ private static final String USER_SELECTED_ALL = "ALL"; //$NON-NLS-1$
+ private static final String MAIN_FUNC_NAME = "main"; //$NON-NLS-1$
+
+ protected String name;
+ protected String binaryPath;
+ protected String scriptPath;
+ protected String arguments;
+ protected String outputPath;
+ protected String binName;
+ protected String generatedScript;
+ protected String parserID;
+ protected String viewID;
+ protected boolean needToGenerate;
+ protected boolean overwrite;
+ protected boolean useColours;
+ protected String resourceToSearchFor;
+ protected boolean searchForResource;
+ protected IBinary bin;
+
+ private boolean testMode = false;
+ protected String secondaryID = ""; //$NON-NLS-1$
+
+ /**
+ * Initialize variables. Highly recommend calling this function within the
+ * launch methods. Will call setScriptPath, setParserID and setViewID.
+ */
+ public void initialize() {
+ name = ""; //$NON-NLS-1$
+ binaryPath = LaunchConfigurationConstants.DEFAULT_BINARY_PATH;
+ arguments = LaunchConfigurationConstants.DEFAULT_ARGUMENTS;
+ outputPath = PluginConstants.getDefaultIOPath();
+ overwrite = true;
+ generatedScript = LaunchConfigurationConstants.DEFAULT_GENERATED_SCRIPT;
+ needToGenerate = false;
+ useColours = false;
+ secondaryID = ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(
+ PluginConstants.CONFIGURATION_TYPE_ID);
+ }
+
+ @Override
+ protected void setDefaultProfileAttributes(
+ ILaunchConfigurationWorkingCopy wc) {
+ SystemTapOptionsTab tab = new SystemTapOptionsTab();
+ tab.setDefaults(wc);
+ }
+
+ /**
+ * Helper function to complete launches. Uses protected parameters (Strings)
+ * scriptPath, binaryPath, arguments, outputPath and (boolean) overwrite.
+ * These must be set by the calling function (or else nonsensical results
+ * will occur). <br>
+ * If scriptPath has not been set, the setScriptPath() method will be
+ * called.
+ *
+ * @param name : Used to generate the name of the new configuration
+ * @param bin : Affiliated executable
+ * @param mode : Mode setting
+ * @param wc : A working copy of the launch configuration
+ * @throws IOException
+ */
+ protected void finishLaunch(String name, String mode, ILaunchConfigurationWorkingCopy wc) throws IOException {
+ if (!finishLaunchHelper()) {
+ return;
+ }
+
+ if (wc != null) {
+
+ wc.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,scriptPath);
+
+ if (!invalid(binaryPath)) {
+ wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH,binaryPath);
+ }
+
+ wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,outputPath);
+ wc.setAttribute(LaunchConfigurationConstants.ARGUMENTS, arguments);
+ wc.setAttribute(LaunchConfigurationConstants.GENERATED_SCRIPT,generatedScript);
+ wc.setAttribute(LaunchConfigurationConstants.NEED_TO_GENERATE,needToGenerate);
+ wc.setAttribute(LaunchConfigurationConstants.OVERWRITE, overwrite);
+ wc.setAttribute(LaunchConfigurationConstants.USE_COLOUR,useColours);
+ wc.setAttribute(LaunchConfigurationConstants.PARSER_CLASS,parserID);
+ wc.setAttribute(LaunchConfigurationConstants.VIEW_CLASS, viewID);
+ wc.setAttribute(LaunchConfigurationConstants.SECONDARY_VIEW_ID, ""); //$NON-NLS-1$
+
+ if (!testMode) {
+ DebugUITools.launch(wc, mode);
+ }
+ }
+
+ }
+
+ /**
+ * returns true if str == null || str.length() < 1. Convenience method.
+ *
+ * @param str
+ * @return
+ */
+ private static boolean invalid(String str) {
+ return (str == null || str.length() < 1);
+ }
+
+ /**
+ * Helper function for methods common to both types of finishLaunch.
+ * @throws IOException
+ *
+ */
+ private boolean finishLaunchHelper() throws IOException {
+ if (invalid(scriptPath)) {
+ scriptPath = setScriptPath();
+ }
+ if (invalid(scriptPath)) {
+ // Setting the variable didn't work, do not launch.
+
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ Messages
+ .getString("SystemTapLaunchShortcut.ErrorMessageName"), //$NON-NLS-1$
+ Messages
+ .getString("SystemTapLaunchShortcut.ErrorMessageTitle"), Messages.getString("SystemTapLaunchShortcut.ErrorMessage") + name); //$NON-NLS-1$ //$NON-NLS-2$
+ mess.schedule();
+ return false;
+ }
+
+ if (invalid(parserID)) {
+ parserID = setParserID();
+ }
+ if (invalid(parserID)) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapLaunchShortcut.InvalidParser1"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchShortcut.InvalidParser2"), Messages.getString("SystemTapLaunchShortcut.InvalidParser3")); //$NON-NLS-1$ //$NON-NLS-2$
+ mess.schedule();
+ return false;
+ }
+
+ if (invalid(viewID)) {
+ viewID = setViewID();
+ }
+ if (invalid(viewID)) {
+ // Setting the variable didn't work, do not launch.
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ Messages.getString("SystemTapLaunchShortcut.InvalidView1"), //$NON-NLS-1$
+ Messages.getString("SystemTapLaunchShortcut.InvalidView2"), Messages.getString("SystemTapLaunchShortcut.InvalidView3")); //$NON-NLS-1$ //$NON-NLS-2$
+ mess.schedule();
+ return false;
+ }
+
+ if (needToGenerate) {
+ if (invalid(generatedScript)) {
+ generatedScript = generateScript();
+ }
+ if (invalid(generatedScript)) {
+ // Setting the variable didn't work, do not launch.
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ Messages
+ .getString("SystemTapLaunchShortcut.InvalidGeneration1"), //$NON-NLS-1$
+ Messages
+ .getString("SystemTapLaunchShortcut.InvalidGeneration2"), Messages.getString("SystemTapLaunchShortcut.InvalidGeneration3"));//$NON-NLS-1$ //$NON-NLS-2$
+ mess.schedule();
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns bin.getPath().toString()
+ *
+ * @param bin
+ * @return
+ */
+ public String getName(IBinary bin) {
+ if (bin != null) {
+ binName = bin.getPath().toString();
+ } else {
+ binName = ""; //$NON-NLS-1$
+ }
+ return binName;
+ }
+
+ /**
+ * Creates a configuration for the given IBinary
+ *
+ */
+ @Override
+ protected ILaunchConfiguration createConfiguration(IBinary bin) {
+ if (bin != null) {
+ return super.createConfiguration(bin);
+ } else {
+ try {
+ return getLaunchConfigType()
+ .newInstance(
+ null,
+ getLaunchManager()
+ .generateLaunchConfigurationName(
+ Messages.getString("SystemTapLaunchShortcut.Invalid"))); //$NON-NLS-1$
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Allows null configurations to be launched. Any launch that uses a binary
+ * should never call this configuration with a null parameter, and any
+ * launch that does not use a binary should never call this function. The
+ * null handling is included for ease of testing.
+ *
+ * @param bin
+ * @param name
+ * - Customize the name based on the shortcut being launched
+ * @return A launch configuration, or null
+ */
+ protected ILaunchConfigurationWorkingCopy createConfiguration(IBinary bin,
+ String name) {
+ ILaunchConfigurationWorkingCopy wc = null;
+ if (bin != null) {
+ try {
+ String projectName = bin.getResource().getProjectRelativePath().toString();
+ ILaunchConfigurationType configType = getLaunchConfigType();
+ wc = configType.newInstance(
+ null,
+ getLaunchManager().generateLaunchConfigurationName(
+ name + " - " + bin.getElementName())); //$NON-NLS-1$
+
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,projectName);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
+ wc.setMappedResources(new IResource[] { bin.getResource(),bin.getResource().getProject() });
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,(String) null);
+
+ setDefaultProfileAttributes(wc);
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ } else {
+
+ try {
+ wc = getLaunchConfigType().newInstance(
+ null,
+ getLaunchManager()
+ .generateLaunchConfigurationName(name));
+ setDefaultProfileAttributes(wc);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ return wc;
+ }
+
+ /*
+ * The following are convenience methods for test programs, etc. to check
+ * the value of certain protected parameters.
+ */
+
+ public ILaunchConfigurationType outsideGetLaunchConfigType() {
+ return getLaunchConfigType();
+ }
+
+ public String getArguments() {
+ return arguments;
+ }
+
+ /**
+ * Retrieves the names of all functions referenced by the binary. If
+ * searchForResource is true, this function will return all function names
+ * belonging to an element with name matching the String held by
+ * resourceToSearchFor. Otherwise it will create a dialog prompting the user
+ * to select from a list of files to profile, or select the only available
+ * file if only one file is available.
+ *
+ *
+ * @param bin
+ * @return
+ */
+ protected String getFunctionsFromBinary(IBinary bin, String targetResource) {
+ String funcs = ""; //$NON-NLS-1$
+ if (bin == null) {
+ return funcs;
+ }
+ try {
+ ArrayList<ICContainer> list = new ArrayList<>();
+ TranslationUnitVisitor v = new TranslationUnitVisitor();
+
+ for (ICElement b : bin.getCProject().getChildrenOfType(
+ ICElement.C_CCONTAINER)) {
+ ICContainer c = (ICContainer) b;
+
+ for (ITranslationUnit tu : c.getTranslationUnits()) {
+ if (searchForResource
+ && tu.getElementName().contains(targetResource)) {
+ tu.accept(v);
+ funcs += v.getFunctions();
+ return funcs;
+ } else {
+ if (!list.contains(c)) {
+ list.add(c);
+ }
+ }
+ }
+
+ // Iterate down to all children, checking for more C_Containers
+ while (c.getChildrenOfType(ICElement.C_CCONTAINER).size() > 0) {
+ ICContainer e = null;
+ for (ICElement d : c
+ .getChildrenOfType(ICElement.C_CCONTAINER)) {
+ e = (ICContainer) d;
+ for (ITranslationUnit tu : e.getTranslationUnits()) {
+ if (searchForResource
+ && tu.getElementName().contains(
+ targetResource)) {
+ tu.accept(v);
+ funcs += (v.getFunctions());
+ return funcs;
+ } else {
+ if (!list.contains(c)) {
+ list.add(c);
+ }
+ }
+ }
+ }
+ c = e;
+ }
+ }
+
+ int numberOfFiles = numberOfValidFiles(list.toArray());
+ if (numberOfFiles == 1) {
+ for (ICContainer c : list) {
+ for (ITranslationUnit e : c.getTranslationUnits()) {
+ if (validElement(e)) {
+ e.accept(v);
+ funcs += v.getFunctions();
+ }
+ }
+ }
+ } else {
+
+ Object[] unitList = chooseUnit(list, numberOfFiles);
+ if (unitList == null || unitList.length == 0) {
+ return null;
+ } else if (unitList.length == 1
+ && unitList[0].toString().equals(USER_SELECTED_ALL)) {
+ funcs = "*"; //$NON-NLS-1$
+ return funcs;
+ }
+
+ StringBuilder tmpFunc = new StringBuilder();
+ for (String item : getAllFunctions(bin.getCProject(), unitList)) {
+ tmpFunc.append(item);
+ tmpFunc.append(" "); //$NON-NLS-1$
+ }
+ funcs = tmpFunc.toString();
+
+ }
+
+ return funcs;
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * Creates a dialog that prompts the user to select from the given list of
+ * ICElements
+ *
+ * @param list
+ * : list of ICElements
+ * @return
+ */
+ private Object[] chooseUnit(List<ICContainer> list, int numberOfValidFiles) {
+ ListTreeContentProvider prov = new ListTreeContentProvider();
+
+ RuledTreeSelectionDialog dialog = new RuledTreeSelectionDialog(
+ getActiveWorkbenchShell(), new WorkbenchLabelProvider(), prov);
+
+ dialog.setTitle(Messages.getString("SystemTapLaunchShortcut.SelectFiles")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemTapLaunchShortcut.SelectFilesMsg")); //$NON-NLS-1$
+ dialog.setInput(list);
+ dialog.setHelpAvailable(false);
+ dialog.setStatusLineAboveButtons(false);
+ dialog.setEmptyListMessage(Messages
+ .getString("SystemTapLaunchShortcut.NoFiles")); //$NON-NLS-1$
+ dialog.setContainerMode(true);
+
+ Object[] topLevel = prov.findElements(list);
+ dialog.setInitialSelections(topLevel);
+ dialog.setSize(cap(topLevel.length * 10, 30, 55), cap(
+ (int) (topLevel.length * 1.5), 3, 13));
+
+ dialog.create();
+ Button okButton = dialog.getOkButton();
+
+ Object[] result = null;
+
+ if (testMode) {
+ okButton.setSelection(true);
+ result = list.toArray();
+ ArrayList<Object> output = new ArrayList<>();
+ try {
+ for (Object obj : result) {
+ if (obj instanceof ICContainer) {
+ ICElement[] array = ((ICContainer) obj).getChildren();
+ for (ICElement c : array) {
+ if (!(validElement(c))) {
+ continue;
+ }
+ if (c.getElementName().contains(MAIN_FUNC_NAME) && !output.contains(c)) {
+ output.add(c);
+ }
+ }
+ }
+ }
+
+ if (output.size() >= numberOfValidFiles) {
+ output.clear();
+ output.add(USER_SELECTED_ALL);
+ }
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+
+ result = output.toArray();
+ } else {
+ if (dialog.open() == Window.CANCEL) {
+ return null;
+ }
+ result = dialog.getResult();
+ }
+
+ if (result == null) {
+ return null;
+ }
+
+ ArrayList<Object> output = new ArrayList<>();
+ try {
+ for (Object obj : result) {
+ if (obj instanceof ICContainer) {
+ ICElement[] array = ((ICContainer) obj).getChildren();
+ for (ICElement c : array) {
+ if (!(validElement(c))) {
+ continue;
+ }
+ if (!output.contains(c)) {
+ output.add(c);
+ }
+ }
+ } else if ((obj instanceof ICElement)
+ && validElement((ICElement) obj)
+ && !output.contains(obj)) {
+ output.add(obj);
+ }
+ }
+
+ if (output.size() >= numberOfValidFiles) {
+ output.clear();
+ output.add(USER_SELECTED_ALL);
+ }
+ } catch (CModelException e) {
+ e.printStackTrace();
+ }
+
+ return output.toArray();
+ }
+
+ private int numberOfValidFiles(Object[] list) throws CModelException {
+ int output = 0;
+ for (Object parent : list) {
+ if (parent instanceof ICContainer) {
+ ICContainer cont = (ICContainer) parent;
+ for (ICElement ele : cont.getChildren()) {
+ if (ele instanceof ICContainer) {
+ output += numberOfValidFiles(((ICContainer) ele)
+ .getChildren());
+ }
+ if (validElement(ele)) {
+ output++;
+ }
+ }
+ } else if ((parent instanceof ICElement)
+ && validElement((ICElement) parent)) {
+ output++;
+ }
+ }
+ return output;
+ }
+
+ /**
+ * @param project
+ * : C Project Type
+ * @return A String list of all functions contained within the specified C
+ * Project
+ */
+ private static List<String> getAllFunctions(ICProject project,
+ Object[] listOfFiles) {
+ try {
+ GetFunctionsJob j = new GetFunctionsJob(project
+ .getHandleIdentifier(), project, listOfFiles);
+ j.schedule();
+ j.join();
+ ArrayList<String> functionList = j.getFunctionList();
+
+ return functionList;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * Returns all ICElements in val that contains the given path. WARNING: Uses
+ * .contains, so be careful with the String path or you'll get too many
+ * hits.
+ *
+ * @param list
+ * @param path
+ * @return
+ */
+ private static boolean specialContains(Object[] list, String path) {
+ for (Object val : list) {
+ if (val instanceof ICElement) {
+ ICElement el = (ICElement) val;
+ if (el.getPath().toString().contains(path)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns a number clipped into the range [low,high].
+ *
+ * @param number
+ * @param low
+ * @param high
+ * @return number if number is in [low,high], low, or high.
+ */
+ private int cap(int number, int low, int high) {
+ if (number > high) {
+ return high;
+ }
+ if (number < low) {
+ return low;
+ }
+ return number;
+ }
+
+ /**
+ * Function for generating scripts. Should be overridden by interested
+ * classes
+ *
+ * @throws IOException
+ */
+ @SuppressWarnings("unused")
+ public String generateScript() throws IOException {
+ return null;
+ }
+
+ private static class GetFunctionsJob extends Job {
+ private ArrayList<String> functionList;
+ private ICProject project;
+ private Object[] listOfFiles;
+
+ public GetFunctionsJob(String name, ICProject p, Object[] o) {
+ super(name);
+ functionList = new ArrayList<>();
+ listOfFiles = Arrays.copyOf(o, o.length);
+ project = p;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IIndexManager manager = CCorePlugin.getIndexManager();
+ IIndex index = null;
+ IProgressMonitor m = monitor;
+
+ if (m == null) {
+ m = new NullProgressMonitor();
+ }
+ m.worked(1);
+
+ try {
+ index = manager.getIndex(project);
+ index.acquireReadLock();
+
+ IIndexFile[] blah = index.getAllFiles();
+ for (IIndexFile file : blah) {
+ String fullFilePath = file.getLocation().getFullPath();
+ if (fullFilePath == null
+ || !specialContains(listOfFiles, fullFilePath)) {
+ continue;
+ }
+
+ IIndexName[] indexNamesArray = file.findNames(0,
+ Integer.MAX_VALUE);
+ for (IIndexName name : indexNamesArray) {
+ if (name.isDefinition()
+ && specialContains(listOfFiles, name.getFile()
+ .getLocation().getFullPath())) {
+ IIndexBinding binder = index.findBinding(name);
+ if (binder instanceof IFunction
+ && !functionList.contains(binder.getName())) {
+ functionList.add(binder.getName());
+ }
+ }
+ }
+
+ m.worked(1);
+ }
+ index.releaseReadLock();
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ public ArrayList<String> getFunctionList() {
+ return functionList;
+ }
+ }
+
+
+ /**
+ * Set the parserID variable. ParserID should point to the ID of an
+ * extension extending the org.eclipse.linuxtools.callgraph.core.parser
+ * extension point. This function must return the parserID to be set.
+ *
+ * If not declared, the parserID will be set to the default SystemTap
+ * Text parser with colour support
+ *
+ * @return a valid parserID
+ */
+ public String setParserID() {
+ return PluginConstants.DEFAULT_PARSER_ID;
+ }
+
+ public String getScript() {
+ return generatedScript;
+ }
+
+ public void setTestMode(boolean val) {
+ testMode = val;
+ }
+
+ /**
+ * Set the viewID variable. ViewID should point to the ID of an extension
+ * extending the org.eclipse.ui.views extension point. This function must
+ * return the viewID to be set. Defaults to the SystemTap Text View, if
+ * not overridden.
+ *
+ * @return a valid viewID
+ */
+ public String setViewID() {
+ return PluginConstants.DEFAULT_VIEW_ID;
+ }
+
+ public static boolean validElement(ICElement e) {
+ return e.getElementName().endsWith(".c") || //$NON-NLS-1$
+ e.getElementName().endsWith(".cpp") || //$NON-NLS-1$
+ e.getElementName().endsWith(".h"); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Default implementation of launch. It will run stap with the selected binary
+ * as an argument and set the output path to <code>PluginConstants.getDefaultIOPath()</code>.
+ * <br>
+ * The name of the created launch will be 'DefaultSystemTapLaunch'
+ */
+ @Override
+ public void launch(IBinary bin, String mode) {
+ initialize();
+ this.bin = bin;
+ binName = getName(bin);
+ name = "DefaultSystemTapLaunch"; //$NON-NLS-1$
+
+ try {
+
+ ILaunchConfigurationWorkingCopy wc = createConfiguration(bin, name);
+ binaryPath = bin.getResource().getLocation().toString();
+ arguments = binaryPath;
+ outputPath = PluginConstants.getDefaultIOPath();
+ finishLaunch(name, mode, wc);
+
+ } catch (IOException e) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ "LaunchShortcutScriptGen", //$NON-NLS-1$
+ Messages.getString("LaunchStapGraph.ScriptGenErr"), //$NON-NLS-1$
+ Messages.getString("LaunchStapGraph.ScriptGenErrMsg")); //$NON-NLS-1$
+ mess.schedule();
+ e.printStackTrace();
+ } finally {
+ resourceToSearchFor = ""; //$NON-NLS-1$
+ searchForResource = false;
+ }
+
+
+ }
+
+
+ /**
+ * Each launch class should define its own script path. Must return the
+ * correct script path or launch will fail.
+ */
+ public abstract String setScriptPath();
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapOptionsTab.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapOptionsTab.java
index 555fe696a0..408e502e55 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapOptionsTab.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapOptionsTab.java
@@ -76,897 +76,897 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
*/
public class SystemTapOptionsTab extends CLaunchConfigurationTab{
- //Controls
- private Text scriptFile;
- private Text binaryFile;
- private Text arguments;
- private Text outputFile;
- private Text button_D_text;
- private Text binaryArguments;
- private Text parser;
- private Text viewer;
-
- private Button fileBrowseButton;
- private Button workspaceBrowseButton;
-
- private Button button_k;
- private Button button_u;
- private Button button_w;
- private Button button_b;
- private Button button_g;
- private Button button_P;
- private Button button_t;
- private Button button_F;
- private Button buttonSkipBadvars;
- private Button buttonIgnoreDwarf;
- private Button button_q;
- private Button buttonGraphicsMode;
-
-
- private Spinner button_p_Spinner;
- private Spinner button_s_Spinner;
- private Spinner button_x_Spinner;
- private Spinner button_v_Spinner;
-
- private Button useColourButton;
-
- //Other variables
- private String workspacePath;
- private boolean outputFileHasChanged = false;
- private boolean needsOverwritePermission = false;
- private boolean overwritePermission = false;
- private boolean changeOverwrite = false;
-
- /**
- * The code below is very long, but it boils down to this.
- *
- * The main function is createControl. This function prepares
- * some space for the various tabs and calls the other create*Option
- * functions to create buttons, text fields and spinners.
- *
- * The create*Option functions create their respective sub-tabs.
- *
- * Each of the controls (button, text, spinner) needs to have a listener
- * attached so Eclipse knows what to do with them.
- *
- * There are a bunch of functions to update/set defaults/initialize,
- * and a final
- */
-
- private SelectionListener graphicsModeListener = new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (scriptFile.isEnabled()){
- scriptFile.setEnabled(false);
- workspaceBrowseButton.setEnabled(false);
- fileBrowseButton.setEnabled(false);
- scriptFile.setText(PluginConstants.getPluginLocation()+"parse_function.stp"); //$NON-NLS-1$
- }else{
- scriptFile.setEnabled(true);
- workspaceBrowseButton.setEnabled(true);
- fileBrowseButton.setEnabled(true);
- }
- updateLaunchConfigurationDialog();
- }
- };
-
- private SelectionListener selectListener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- };
-
- private ModifyListener modifyListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }
- };
-
- private ModifyListener modifyListenerOutput = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- outputFileHasChanged = true;
- }
- };
-
- private FocusListener focusListener = new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- if (outputFileHasChanged) {
- checkOverwrite();
- }
- outputFileHasChanged = false;
-
- updateLaunchConfigurationDialog();
- }
- };
-
- /**
- * Convenience method to check if the overwrite permissions are consistent
- *
- * Helps ensure validity of configuration.
- */
- private void checkOverwrite() {
- File f = new File(outputFile.getText());
- changeOverwrite = true;
- if (f.exists()) {
- needsOverwritePermission = true;
- Shell sh = new Shell();
- if (MessageDialog.openConfirm(sh, Messages.getString("SystemTapOptionsTab.ConfirmOverwriteFileTitle"), //$NON-NLS-1$
- Messages.getString("SystemTapOptionsTab.ConfirmOverwriteFileMessage"))) { //$NON-NLS-1$
- overwritePermission = true;
- } else {
- overwritePermission = false;
- }
- }
- else
- needsOverwritePermission = false;
- }
-
- /**
- * This function prepares some space for the various
- * tabs and calls and sets the other create*Option
- * functions to create buttons, text fields and spinners.
- */
- @Override
- public void createControl(Composite parent) {
- /*
- * File folder - tab for selecting binary/stp file
- */
- TabFolder fileFolder = new TabFolder(parent, SWT.BORDER);
- fileFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
- setControl(fileFolder);
-
- TabItem fileTab = new TabItem(fileFolder, SWT.NONE);
- fileTab.setText(Messages.getString("SystemTapOptionsTab.FilesTab")); //$NON-NLS-1$
-
- Composite fileTop = new Composite(fileFolder, SWT.NONE);
- fileTop.setLayout(new GridLayout());
- fileTop.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createFileOption(fileTop);
- fileTab.setControl(fileTop);
-
-
- /*
- * Commands tab - tab for selecting SystemTap commands
- */
-
- TabItem commandTab = new TabItem(fileFolder, SWT.NONE);
- commandTab.setText(Messages.getString("SystemTapOptionsTab.CommandsTab")); //$NON-NLS-1$
-
- Composite commandTop = new Composite(fileFolder, SWT.NONE);
- commandTop.setLayout(new GridLayout());
- commandTop.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createCommandOption(commandTop);
- commandTab.setControl(commandTop);
-
- /*
- * Arguments tab - tab for selecting script arguments
- */
- TabItem argumentsTab = new TabItem(fileFolder, SWT.NONE);
- argumentsTab.setText(Messages.getString("SystemTapOptionsTab.Arguments")); //$NON-NLS-1$
-
- Composite argumentsTop = new Composite(fileFolder, SWT.NONE);
- argumentsTop.setLayout(new GridLayout());
- argumentsTop.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createArgumentsOption(argumentsTop);
- argumentsTab.setControl(argumentsTop);
-
-
- /*
- * Binary Argument tab - tab for supplying arguments for a binary
- */
- TabItem binaryArgumentsTab = new TabItem(fileFolder, SWT.NONE);
- binaryArgumentsTab.setText(Messages.getString("SystemTapOptionsTab.44")); //$NON-NLS-1$
-
- Composite binaryArgumentsTop = new Composite(fileFolder, SWT.NONE);
- binaryArgumentsTop.setLayout(new GridLayout());
- binaryArgumentsTop.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createBinaryArgumentsOption(binaryArgumentsTop);
- binaryArgumentsTab.setControl(binaryArgumentsTop);
-
-
- /*
- * Parser tab -- Tab for selecting a parser and viewer to use
- */
- TabItem parserTab = new TabItem(fileFolder, SWT.NONE);
- parserTab.setText("Parser"); //$NON-NLS-1$
-
- Composite parserTop = new Composite(fileFolder, SWT.NONE);
- parserTop.setLayout(new GridLayout());
- parserTop.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createParserOption(parserTop);
- parserTab.setControl(parserTop);
- }
-
-
- private void createBinaryArgumentsOption(Composite binaryArgumentsTop) {
- Composite browseTop = new Composite(binaryArgumentsTop, SWT.NONE);
- browseTop.setLayout(new GridLayout(1, false));
- GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
- browseTop.setLayoutData(browseData);
-
- Label suppFileLabel = new Label(browseTop, SWT.NONE);
- suppFileLabel.setText(Messages.getString("SystemTapOptionsTab.45")); //$NON-NLS-1$
-
- binaryArguments = new Text(browseTop,SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 200;
- binaryArguments.setLayoutData(gd);
- binaryArguments.addModifyListener(modifyListener);
- }
-
- private void createParserOption(Composite parserTop) {
- Composite browseTop = new Composite(parserTop, SWT.NONE);
- browseTop.setLayout(new GridLayout(1, false));
- GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
- browseTop.setLayoutData(browseData);
-
- Label suppFileLabel = new Label(browseTop, SWT.NONE);
- suppFileLabel.setText("Parser"); //$NON-NLS-1$
-
- parser = new Text(browseTop, SWT.BORDER);
- parser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- parser.addModifyListener(modifyListener);
-
- Button parserButton = createPushButton(browseTop,
- "Find parsers", null); //$NON-NLS-1$
- parserButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
- new ListLabelProvider());
- dialog.setTitle("Select parser"); //$NON-NLS-1$
- dialog.setMessage("Select parser to use."); //$NON-NLS-1$
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] extensions = reg
- .getConfigurationElementsFor(PluginConstants.PARSER_RESOURCE,
- PluginConstants.PARSER_NAME);
-
- dialog.setElements(extensions);
- if (dialog.open() == IDialogConstants.OK_ID) {
- String arg = getUsefulLabel(dialog.getFirstResult());
- parser.setText(arg);
- }
- }
- });
-
-
- viewer = new Text(browseTop, SWT.BORDER);
- viewer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- viewer.addModifyListener(modifyListener);
-
- Button viewerButton = createPushButton(browseTop,
- "Find viewers", null); //$NON-NLS-1$
- viewerButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
- new ListLabelProvider());
- dialog.setTitle("Select viewer"); //$NON-NLS-1$
- dialog.setMessage("Select viewer to use."); //$NON-NLS-1$
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] extensions = reg
- .getConfigurationElementsFor(PluginConstants.VIEW_RESOURCE,
- PluginConstants.VIEW_NAME);
- ArrayList<IConfigurationElement> ext = new ArrayList<>();
- for (IConfigurationElement el : extensions) {
- if (!el.getNamespaceIdentifier().contains("org.eclipse.linuxtools")) //$NON-NLS-1$
- continue;
- //TODO: Rough hack to get all the objects. We restrict to id's containing org.eclipse.linuxtools, then see if the class extends SystemTapView
- try {
- if (el.createExecutableExtension(PluginConstants.ATTR_CLASS)
- instanceof SystemTapView) {
- ext.add(el);
- }
- } catch (CoreException e1) {
- }
- }
-
- dialog.setElements(ext.toArray());
- if (dialog.open() == IDialogConstants.OK_ID) {
- String arg = getUsefulLabel(dialog.getFirstResult());
- viewer.setText(arg);
- }
- }
- });
-
- }
-
- private void createArgumentsOption(Composite argumentsTop) {
- Composite browseTop = new Composite(argumentsTop, SWT.NONE);
- browseTop.setLayout(new GridLayout(1, false));
- GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
- browseTop.setLayoutData(browseData);
-
-
- Label suppFileLabel = new Label(browseTop, SWT.NONE);
- suppFileLabel.setText(Messages.getString("SystemTapOptionsTab.SelectArguments")); //$NON-NLS-1$
-
- arguments = new Text(browseTop,SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 200;
- arguments.setLayoutData(gd);
- arguments.addModifyListener(modifyListener);
-
-
- Button probeFunctionButton = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.ProbeFunction"), null); //$NON-NLS-1$
- probeFunctionButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- arguments.setText(arguments.getText() + " process(\"" + binaryFile.getText() + "\").function(\"\")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- }
-
- private void createFileOption(Composite top) {
- Composite browseTop = new Composite(top, SWT.NONE);
- browseTop.setLayout(new GridLayout(4, false));
- browseTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label suppFileLabel = new Label(browseTop, SWT.NONE);
- suppFileLabel.setText(Messages.getString("SystemTapOptionsTab.ScriptSelector")); //$NON-NLS-1$
-
- scriptFile = new Text(browseTop, SWT.BORDER);
- scriptFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- scriptFile.addModifyListener(modifyListener);
-
- workspaceBrowseButton = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.WorkspaceButton"), null); //$NON-NLS-1$
- workspaceBrowseButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(Messages.getString("SystemTapOptionsTab.ResourceButton")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("SystemTapOptionsTab.SuppresionsFile")); //$NON-NLS-1$
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- if (dialog.open() == IDialogConstants.OK_ID) {
- IResource resource = (IResource) dialog.getFirstResult();
- String arg = resource.getFullPath().toString();
- scriptFile.setText(workspacePath + arg);
- }
- }
- });
-
- fileBrowseButton = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.FileSystem"), null); //$NON-NLS-1$
- fileBrowseButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String filePath = scriptFile.getText();
- FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
- filePath = dialog.open();
- if (filePath != null) {
- scriptFile.setText(filePath);
- }
- }
- });
-
-
- Label binaryFileLabel = new Label(browseTop, SWT.NONE);
- binaryFileLabel.setText(Messages.getString("SystemTapOptionsTab.SelectBinary")); //$NON-NLS-1$
-
- binaryFile = new Text(browseTop, SWT.BORDER);
- binaryFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- binaryFile.addModifyListener(modifyListener);
-
-
- Button workspaceBrowseButton2 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.WorkspaceButton2"), null); //$NON-NLS-1$
- workspaceBrowseButton2.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(Messages.getString("SystemTapOptionsTab.SelectResource")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("SystemTapOptionsTab.SelectSuppressions")); //$NON-NLS-1$
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- if (dialog.open() == IDialogConstants.OK_ID) {
- IResource resource = (IResource) dialog.getFirstResult();
- String arg = resource.getFullPath().toString();
- binaryFile.setText(workspacePath + arg);
- }
- }
- });
-
-
- Button fileBrowseButton2 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.BrowseFiles"), null); //$NON-NLS-1$
- fileBrowseButton2.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String filePath = binaryFile.getText();
- FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
- filePath = dialog.open();
- if (filePath != null) {
- File file = new File(filePath);
- if (file.exists()) binaryFile.setText(filePath);
- }
- }
- });
-
-
- Label outputFileLabel = new Label(browseTop, SWT.NONE);
- outputFileLabel.setText(Messages.getString("SystemTapOptionsTab.SelectOutput")); //$NON-NLS-1$
-
- outputFile = new Text(browseTop, SWT.BORDER);
- outputFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- outputFile.addModifyListener(modifyListenerOutput);
- outputFile.addFocusListener(focusListener);
-
- Button workspaceBrowseButton3 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.WorkspaceButton2"), null); //$NON-NLS-1$
- workspaceBrowseButton3.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(Messages.getString("SystemTapOptionsTab.SelectResource")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("SystemTapOptionsTab.SelectSuppressions")); //$NON-NLS-1$
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- if (dialog.open() == IDialogConstants.OK_ID) {
- IResource resource = (IResource) dialog.getFirstResult();
- String arg = resource.getFullPath().toString();
- outputFile.setText(workspacePath + arg);
- checkOverwrite();
- updateLaunchConfigurationDialog();
-
- }
- }
- });
-
- Button fileBrowseButton3 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.BrowseFiles"), null); //$NON-NLS-1$
- fileBrowseButton3.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String filePath = outputFile.getText();
- FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
- filePath = dialog.open();
- if (filePath != null) {
- outputFile.setText(filePath);
- checkOverwrite();
- updateLaunchConfigurationDialog();
- }
- }
- });
-
- useColourButton = new Button(browseTop, SWT.CHECK);
- useColourButton.setText(Messages.getString("SystemTapOptionsTab.ColourCodes")); //$NON-NLS-1$
- useColourButton.addSelectionListener(selectListener);
- useColourButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
-
-
- private void createCommandOption(Composite top) {
- Composite buttonsTop = new Composite(top, SWT.NONE);
- GridLayout gl = new GridLayout(2, true);
- buttonsTop.setLayout( gl );
- GridData buttonsData = new GridData(SWT.FILL, SWT.BEGINNING, true, true);
- buttonsTop.setLayoutData(buttonsData);
-
- button_k = new Button(buttonsTop, SWT.CHECK);
- button_k.setText(Messages.getString("SystemTapOptionsTab.KeepTemp")); //$NON-NLS-1$
- button_k.addSelectionListener(selectListener);
- button_k.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_k.setToolTipText(Messages.getString("SystemTapOptionsTab.KeepTempToolTip")); //$NON-NLS-1$
-
- button_g = new Button(buttonsTop, SWT.CHECK);
- button_g.setText(Messages.getString("SystemTapOptionsTab.Guru")); //$NON-NLS-1$
- button_g.addSelectionListener(selectListener);
- button_g.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_g.setToolTipText(Messages.getString("SystemTapOptionsTab.GuruToolTip")); //$NON-NLS-1$
-
- button_P = new Button(buttonsTop, SWT.CHECK);
- button_P.setText(Messages.getString("SystemTapOptionsTab.Prologue")); //$NON-NLS-1$
- button_P.addSelectionListener(selectListener);
- button_P.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_P.setToolTipText(Messages.getString("SystemTapOptionsTab.PrologueSearchToolTip")); //$NON-NLS-1$
-
- button_u = new Button(buttonsTop, SWT.CHECK);
- button_u.setText(Messages.getString("SystemTapOptionsTab.Unused")); //$NON-NLS-1$
- button_u.addSelectionListener(selectListener);
- button_u.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_u.setToolTipText(
- Messages.getString("SystemTapOptionsTab.12")); //$NON-NLS-1$
-
- button_w = new Button(buttonsTop, SWT.CHECK);
- button_w.setText(Messages.getString("SystemTapOptionsTab.Warnings")); //$NON-NLS-1$
- button_w.addSelectionListener(selectListener);
- button_w.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_w.setToolTipText(Messages.getString("SystemTapOptionsTab.DisableWarningsToolTip")); //$NON-NLS-1$
-
- button_b = new Button(buttonsTop, SWT.CHECK);
- button_b.setText(Messages.getString("SystemTapOptionsTab.Bulk")); //$NON-NLS-1$
- button_b.addSelectionListener(selectListener);
- button_b.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_b.setToolTipText(
- Messages.getString("SystemTapOptionsTab.15")); //$NON-NLS-1$
-
- button_t = new Button(buttonsTop, SWT.CHECK);
- button_t.setText(Messages.getString("SystemTapOptionsTab.Timing")); //$NON-NLS-1$
- button_t.addSelectionListener(selectListener);
- button_t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_t.setToolTipText(Messages.getString("SystemTapOptionsTab.CollectTimingToolTip")); //$NON-NLS-1$
-
- button_F = new Button(buttonsTop, SWT.CHECK);
- button_F.setText(Messages.getString("SystemTapOptionsTab.LeaveProbesRunning")); //$NON-NLS-1$
- button_F.addSelectionListener(selectListener);
- button_F.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_F.setToolTipText(Messages.getString("SystemTapOptionsTab.LeaveProbesToolTip")); //$NON-NLS-1$
-
- buttonSkipBadvars = new Button(buttonsTop, SWT.CHECK);
- buttonSkipBadvars.setText(Messages.getString("SystemTapOptionsTab.IgnoreBadVars")); //$NON-NLS-1$
- buttonSkipBadvars.addSelectionListener(selectListener);
- buttonSkipBadvars.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttonSkipBadvars.setToolTipText(
- Messages.getString("SystemTapOptionsTab.30")); //$NON-NLS-1$
-
- buttonIgnoreDwarf = new Button(buttonsTop, SWT.CHECK);
- buttonIgnoreDwarf.setText(Messages.getString("SystemTapOptionsTab.ForTesting")); //$NON-NLS-1$
- buttonIgnoreDwarf.addSelectionListener(selectListener);
- buttonIgnoreDwarf.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttonIgnoreDwarf.setToolTipText(Messages.getString("SystemTapOptionsTab.IgnoreDebugToolTip")); //$NON-NLS-1$
-
- button_q = new Button(buttonsTop, SWT.CHECK);
- button_q.setText(Messages.getString("SystemTapOptionsTab.Button_qInfo")); //$NON-NLS-1$
- button_q.addSelectionListener(selectListener);
- button_q.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_q.setToolTipText(Messages.getString("SystemTapOptionsTab.33")); //$NON-NLS-1$
-
- buttonGraphicsMode = new Button(buttonsTop, SWT.CHECK);
- buttonGraphicsMode.setText(Messages.getString("SystemTapOptionsTab.3")); //$NON-NLS-1$
- buttonGraphicsMode.addSelectionListener(graphicsModeListener);
- buttonGraphicsMode.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttonGraphicsMode.setToolTipText(
- Messages.getString("SystemTapOptionsTab.41")); //$NON-NLS-1$
-
- Composite button_p_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
- button_p_Spinner_Top.setLayout(new GridLayout(2, true));
- button_p_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label button_p_Spinner_Label = new Label(button_p_Spinner_Top, SWT.NONE);
- button_p_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.19")); //$NON-NLS-1$
- button_p_Spinner = new Spinner(button_p_Spinner_Top, SWT.BORDER);
- button_p_Spinner.setMaximum(Integer.MAX_VALUE);
- button_p_Spinner.addModifyListener(modifyListener);
- button_p_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_p_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.StopAfterPassToolTip")); //$NON-NLS-1$
-
- Composite button_s_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
- button_s_Spinner_Top.setLayout(new GridLayout(2, true));
- button_s_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label button_s_Spinner_Label = new Label(button_s_Spinner_Top, SWT.NONE);
- button_s_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.BufferWith")); //$NON-NLS-1$
- button_s_Spinner = new Spinner(button_s_Spinner_Top, SWT.BORDER);
- button_s_Spinner.setMaximum(Integer.MAX_VALUE);
- button_s_Spinner.addModifyListener(modifyListener);
- button_s_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_s_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.BufferWithToolTip")); //$NON-NLS-1$
-
- Composite button_x_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
- button_x_Spinner_Top.setLayout(new GridLayout(2, true));
- button_x_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label button_x_Spinner_Label = new Label(button_x_Spinner_Top, SWT.NONE);
- button_x_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.TargetPID")); //$NON-NLS-1$
- button_x_Spinner = new Spinner(button_x_Spinner_Top, SWT.BORDER);
- button_x_Spinner.setMaximum(Integer.MAX_VALUE);
- button_x_Spinner.addModifyListener(modifyListener);
- button_x_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_x_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.TargetPIDToolTip")); //$NON-NLS-1$
-
- Composite button_v_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
- button_v_Spinner_Top.setLayout(new GridLayout(2, true));
- button_v_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label button_v_Spinner_Label = new Label(button_v_Spinner_Top, SWT.NONE);
- button_v_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.18")); //$NON-NLS-1$
- button_v_Spinner = new Spinner(button_v_Spinner_Top, SWT.BORDER);
- button_v_Spinner.setMaximum(3);
- button_v_Spinner.addModifyListener(modifyListener);
- button_v_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_v_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.TargetPIDToolTip")); //$NON-NLS-1$
-
-
- Label button_D_label = new Label(buttonsTop, SWT.NONE);
- button_D_label.setText(Messages.getString("SystemTapOptionsTab.PreprocessorDirective")); //$NON-NLS-1$
- button_D_text = new Text(buttonsTop, SWT.BORDER);
- button_D_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- button_D_text.addModifyListener(modifyListener);
- button_D_label.setToolTipText(
- Messages.getString("SystemTapOptionsTab.PreprocessorToolTip")); //$NON-NLS-1$
- }
-
- @Override
- public String getName() {
- return Messages.getString("SystemTapOptionsTab.MainTabName"); //$NON-NLS-1$
- }
-
- private Shell getActiveWorkbenchShell() {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- }
-
- private IBinary chooseBinary(IBinary[] binaries) {
- ILabelProvider programLabelProvider = new CElementLabelProvider() {
- @Override
- public String getText(Object element) {
- if (element instanceof IBinary) {
- IBinary bin = (IBinary)element;
- StringBuffer name = new StringBuffer();
- name.append(bin.getPath().lastSegment());
- return name.toString();
- }
- return super.getText(element);
- }
- };
-
- ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
- @Override
- public String getText(Object element) {
- if (element instanceof IBinary) {
- IBinary bin = (IBinary)element;
- StringBuffer name = new StringBuffer();
- name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$
- name.append(" - "); //$NON-NLS-1$
- name.append(bin.getPath().toString());
- return name.toString();
- }
- return super.getText(element);
- }
- };
-
- TwoPaneElementSelector dialog = new TwoPaneElementSelector(getActiveWorkbenchShell(), programLabelProvider, qualifierLabelProvider);
- dialog.setElements(binaries);
- dialog.setTitle(Messages.getString("SystemtTapOptionsTab.Callgraph")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("SystemtTapOptionsTab.Choose_a_local_application")); //$NON-NLS-1$
- dialog.setUpperListLabel(Messages.getString("SystemtTapOptionsTab.Binaries")); //$NON-NLS-1$
- dialog.setLowerListLabel(Messages.getString("SystemtTapOptionsTab.Qualifier")); //$NON-NLS-1$
- dialog.setMultipleSelection(false);
- if (dialog.open() == Window.OK) {
- return (IBinary) dialog.getFirstResult();
- }
-
- return null;
- }
-
- private IBinary getBinary(ILaunchConfiguration config) {
- try {
- ICProject project = CDebugUtils.verifyCProject(config);
- IBinary[] binaries = project.getBinaryContainer().getBinaries();
- if (binaries != null && binaries.length > 0) {
- if (binaries.length == 1 && binaries[0] != null) {
- return binaries[0];
- } else
- return chooseBinary(binaries);
- }
- return null;
- } catch (CoreException e) {
- return null;
- }
- }
-
- @Override
- public void initializeFrom(ILaunchConfiguration configuration) {
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IPath location = root.getLocation();
- workspacePath = location.toString();
-
- try {
- button_k.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY, LaunchConfigurationConstants.DEFAULT_COMMAND_KEEP_TEMPORARY));
- button_u.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION, LaunchConfigurationConstants.DEFAULT_COMMAND_NO_CODE_ELISION));
- button_w.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS, LaunchConfigurationConstants.DEFAULT_COMMAND_DISABLE_WARNINGS));
- button_b.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, LaunchConfigurationConstants.DEFAULT_COMMAND_BULK_MODE));
- button_g.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_GURU, LaunchConfigurationConstants.DEFAULT_COMMAND_GURU));
- button_P.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH, LaunchConfigurationConstants.DEFAULT_COMMAND_PROLOGUE_SEARCH));
- button_t.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, LaunchConfigurationConstants.DEFAULT_COMMAND_TIMING_INFO));
- buttonSkipBadvars.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, LaunchConfigurationConstants.DEFAULT_COMMAND_SKIP_BADVARS));
- buttonIgnoreDwarf.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, LaunchConfigurationConstants.DEFAULT_COMMAND_IGNORE_DWARF));
- button_q.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE, LaunchConfigurationConstants.DEFAULT_COMMAND_TAPSET_COVERAGE));
- button_F.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING, LaunchConfigurationConstants.DEFAULT_COMMAND_LEAVE_RUNNING));
- button_s_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES));
- button_x_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID));
- button_v_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, LaunchConfigurationConstants.DEFAULT_COMMAND_VERBOSE));
- button_p_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_PASS, LaunchConfigurationConstants.DEFAULT_COMMAND_PASS));
-
- button_D_text.setText(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES, LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES));
- binaryFile.setText(configuration.getAttribute(LaunchConfigurationConstants.BINARY_PATH, LaunchConfigurationConstants.DEFAULT_BINARY_PATH));
- scriptFile.setText(configuration.getAttribute(LaunchConfigurationConstants.SCRIPT_PATH, LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH));
- outputFile.setText(configuration.getAttribute(LaunchConfigurationConstants.OUTPUT_PATH, LaunchConfigurationConstants.DEFAULT_OUTPUT_PATH));
- arguments.setText(configuration.getAttribute(LaunchConfigurationConstants.ARGUMENTS, LaunchConfigurationConstants.DEFAULT_ARGUMENTS));
- binaryArguments.setText(configuration.getAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS, LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS));
-
- parser.setText(configuration.getAttribute(LaunchConfigurationConstants.PARSER_CLASS, LaunchConfigurationConstants.DEFAULT_PARSER_CLASS));
- viewer.setText(configuration.getAttribute(LaunchConfigurationConstants.VIEW_CLASS, LaunchConfigurationConstants.DEFAULT_VIEW_CLASS));
-
- useColourButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.USE_COLOUR, LaunchConfigurationConstants.DEFAULT_USE_COLOUR));
-
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
-
- }
-
- @Override
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
-
- getControl().setRedraw(false);
-
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY, button_k.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_GURU, button_g.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH, button_P.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION, button_u.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS, button_w.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, button_b.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, button_t.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, buttonSkipBadvars.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, buttonIgnoreDwarf.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE, button_q.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING, button_F.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PASS, button_p_Spinner.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, button_s_Spinner.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, button_x_Spinner.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, button_v_Spinner.getSelection());
-
- configuration.setAttribute(LaunchConfigurationConstants.PARSER_CLASS, parser.getText());
- configuration.setAttribute(LaunchConfigurationConstants.VIEW_CLASS, viewer.getText());
-
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES, button_D_text.getText());
- configuration.setAttribute(LaunchConfigurationConstants.BINARY_PATH, binaryFile.getText());
- configuration.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH, scriptFile.getText());
- configuration.setAttribute(LaunchConfigurationConstants.ARGUMENTS, arguments.getText());
- configuration.setAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS, binaryArguments.getText());
- configuration.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH, outputFile.getText());
-
- configuration.setAttribute(LaunchConfigurationConstants.USE_COLOUR, useColourButton.getSelection());
-
- if (buttonGraphicsMode.getSelection()){
- scriptFile.setEnabled(false);
- workspaceBrowseButton.setEnabled(false);
- fileBrowseButton.setEnabled(false);
-
- }else{
- scriptFile.setEnabled(true);
- workspaceBrowseButton.setEnabled(true);
- fileBrowseButton.setEnabled(true);
- }
-
- if (changeOverwrite) {
- if (needsOverwritePermission && overwritePermission || !needsOverwritePermission) {
- configuration.setAttribute(LaunchConfigurationConstants.OVERWRITE, true);
- } else {
- configuration.setAttribute(LaunchConfigurationConstants.OVERWRITE, false);
- }
- changeOverwrite = false;
- }
-
- getControl().setRedraw(true);
- }
-
- @Override
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE,LaunchConfigurationConstants.DEFAULT_COMMAND_VERBOSE);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY,LaunchConfigurationConstants.DEFAULT_COMMAND_KEEP_TEMPORARY);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_GURU,LaunchConfigurationConstants.DEFAULT_COMMAND_GURU);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH,LaunchConfigurationConstants.DEFAULT_COMMAND_PROLOGUE_SEARCH);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION,LaunchConfigurationConstants.DEFAULT_COMMAND_NO_CODE_ELISION);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS,LaunchConfigurationConstants.DEFAULT_COMMAND_DISABLE_WARNINGS);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE,LaunchConfigurationConstants.DEFAULT_COMMAND_BULK_MODE);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO,LaunchConfigurationConstants.DEFAULT_COMMAND_TIMING_INFO);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS,LaunchConfigurationConstants.DEFAULT_COMMAND_SKIP_BADVARS);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF,LaunchConfigurationConstants.DEFAULT_COMMAND_IGNORE_DWARF);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE,LaunchConfigurationConstants.DEFAULT_COMMAND_TAPSET_COVERAGE);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING,LaunchConfigurationConstants.DEFAULT_COMMAND_LEAVE_RUNNING);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PASS,LaunchConfigurationConstants.DEFAULT_COMMAND_PASS);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES,LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES);
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID,LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID);
-
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES);
- configuration.setAttribute(LaunchConfigurationConstants.BINARY_PATH,LaunchConfigurationConstants.DEFAULT_BINARY_PATH);
- configuration.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH);
- configuration.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,LaunchConfigurationConstants.DEFAULT_OUTPUT_PATH);
- configuration.setAttribute(LaunchConfigurationConstants.ARGUMENTS,LaunchConfigurationConstants.DEFAULT_ARGUMENTS);
- configuration.setAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS,LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS);
-
- configuration.setAttribute(LaunchConfigurationConstants.GENERATED_SCRIPT, LaunchConfigurationConstants.DEFAULT_GENERATED_SCRIPT);
- configuration.setAttribute(LaunchConfigurationConstants.NEED_TO_GENERATE, LaunchConfigurationConstants.DEFAULT_NEED_TO_GENERATE);
- configuration.setAttribute(LaunchConfigurationConstants.PARSER_CLASS, LaunchConfigurationConstants.DEFAULT_PARSER_CLASS);
- configuration.setAttribute(LaunchConfigurationConstants.VIEW_CLASS, LaunchConfigurationConstants.DEFAULT_VIEW_CLASS);
-
- configuration.setAttribute(LaunchConfigurationConstants.USE_COLOUR, LaunchConfigurationConstants.DEFAULT_USE_COLOUR);
-
- configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LIST, ConfigurationOptionsSetter.setOptions(configuration));
-
- ICElement cElement = null;
- cElement = getContext(configuration, getPlatform(configuration));
- if (cElement != null) {
- initializeCProject(cElement, configuration);
- } else {
- // don't want to remember the interim value from before
- configuration.setMappedResources(null);
- }
-
- IBinary bin = getBinary(configuration);
- if (bin != null) {
- String programName = bin.getResource().getProjectRelativePath().toString();
- configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
- configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
-
- LaunchStapGraph launch = new LaunchStapGraph();
- launch.setTestMode(true); //Do not run callgraph
- launch.launch(bin, "", configuration); //$NON-NLS-1$
- }
- }
-
-
- @Override
- public boolean isValid(ILaunchConfiguration launchConfig) {
- // Check that the major options are sane
- boolean valid = true;
- try {
- String sPath = launchConfig.getAttribute(
- LaunchConfigurationConstants.SCRIPT_PATH,
- LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH);
-
- File script = new File(sPath);
-
- if (sPath.equals(LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH) || !script.exists()) {
- //No script path specified or no such script exists
- valid = false;
- }
-
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- return valid;
- }
-
- private String getUsefulLabel(Object element) {
- if (element instanceof IConfigurationElement) {
- Object o = ((IConfigurationElement) element).getParent();
- if (o instanceof IExtension) {
- IExtension e = (IExtension) ((IConfigurationElement) element).getParent();
- return e.getUniqueIdentifier();
- }
- }
- return Messages.getString("SystemTapOptionsTab.1"); //$NON-NLS-1$
- }
-
- private static class ListLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- if (element instanceof IConfigurationElement) {
- Object o = ((IConfigurationElement) element).getParent();
- if (o instanceof IExtension) {
- IExtension e = (IExtension) ((IConfigurationElement) element).getParent();
- return e.getLabel();
- }
- else if (o instanceof IConfigurationElement) {
- IConfigurationElement e = (IConfigurationElement) ((IConfigurationElement) element).getParent();
- return e.getName();
- }
-
- }
- return Messages.getString("SystemTapOptionsTab.46"); //$NON-NLS-1$
- }
-
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
- }
+ //Controls
+ private Text scriptFile;
+ private Text binaryFile;
+ private Text arguments;
+ private Text outputFile;
+ private Text button_D_text;
+ private Text binaryArguments;
+ private Text parser;
+ private Text viewer;
+
+ private Button fileBrowseButton;
+ private Button workspaceBrowseButton;
+
+ private Button button_k;
+ private Button button_u;
+ private Button button_w;
+ private Button button_b;
+ private Button button_g;
+ private Button button_P;
+ private Button button_t;
+ private Button button_F;
+ private Button buttonSkipBadvars;
+ private Button buttonIgnoreDwarf;
+ private Button button_q;
+ private Button buttonGraphicsMode;
+
+
+ private Spinner button_p_Spinner;
+ private Spinner button_s_Spinner;
+ private Spinner button_x_Spinner;
+ private Spinner button_v_Spinner;
+
+ private Button useColourButton;
+
+ //Other variables
+ private String workspacePath;
+ private boolean outputFileHasChanged = false;
+ private boolean needsOverwritePermission = false;
+ private boolean overwritePermission = false;
+ private boolean changeOverwrite = false;
+
+ /**
+ * The code below is very long, but it boils down to this.
+ *
+ * The main function is createControl. This function prepares
+ * some space for the various tabs and calls the other create*Option
+ * functions to create buttons, text fields and spinners.
+ *
+ * The create*Option functions create their respective sub-tabs.
+ *
+ * Each of the controls (button, text, spinner) needs to have a listener
+ * attached so Eclipse knows what to do with them.
+ *
+ * There are a bunch of functions to update/set defaults/initialize,
+ * and a final
+ */
+
+ private SelectionListener graphicsModeListener = new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (scriptFile.isEnabled()){
+ scriptFile.setEnabled(false);
+ workspaceBrowseButton.setEnabled(false);
+ fileBrowseButton.setEnabled(false);
+ scriptFile.setText(PluginConstants.getPluginLocation()+"parse_function.stp"); //$NON-NLS-1$
+ }else{
+ scriptFile.setEnabled(true);
+ workspaceBrowseButton.setEnabled(true);
+ fileBrowseButton.setEnabled(true);
+ }
+ updateLaunchConfigurationDialog();
+ }
+ };
+
+ private SelectionListener selectListener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ };
+
+ private ModifyListener modifyListener = new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ };
+
+ private ModifyListener modifyListenerOutput = new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ outputFileHasChanged = true;
+ }
+ };
+
+ private FocusListener focusListener = new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ if (outputFileHasChanged) {
+ checkOverwrite();
+ }
+ outputFileHasChanged = false;
+
+ updateLaunchConfigurationDialog();
+ }
+ };
+
+ /**
+ * Convenience method to check if the overwrite permissions are consistent
+ *
+ * Helps ensure validity of configuration.
+ */
+ private void checkOverwrite() {
+ File f = new File(outputFile.getText());
+ changeOverwrite = true;
+ if (f.exists()) {
+ needsOverwritePermission = true;
+ Shell sh = new Shell();
+ if (MessageDialog.openConfirm(sh, Messages.getString("SystemTapOptionsTab.ConfirmOverwriteFileTitle"), //$NON-NLS-1$
+ Messages.getString("SystemTapOptionsTab.ConfirmOverwriteFileMessage"))) { //$NON-NLS-1$
+ overwritePermission = true;
+ } else {
+ overwritePermission = false;
+ }
+ }
+ else
+ needsOverwritePermission = false;
+ }
+
+ /**
+ * This function prepares some space for the various
+ * tabs and calls and sets the other create*Option
+ * functions to create buttons, text fields and spinners.
+ */
+ @Override
+ public void createControl(Composite parent) {
+ /*
+ * File folder - tab for selecting binary/stp file
+ */
+ TabFolder fileFolder = new TabFolder(parent, SWT.BORDER);
+ fileFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ setControl(fileFolder);
+
+ TabItem fileTab = new TabItem(fileFolder, SWT.NONE);
+ fileTab.setText(Messages.getString("SystemTapOptionsTab.FilesTab")); //$NON-NLS-1$
+
+ Composite fileTop = new Composite(fileFolder, SWT.NONE);
+ fileTop.setLayout(new GridLayout());
+ fileTop.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createFileOption(fileTop);
+ fileTab.setControl(fileTop);
+
+
+ /*
+ * Commands tab - tab for selecting SystemTap commands
+ */
+
+ TabItem commandTab = new TabItem(fileFolder, SWT.NONE);
+ commandTab.setText(Messages.getString("SystemTapOptionsTab.CommandsTab")); //$NON-NLS-1$
+
+ Composite commandTop = new Composite(fileFolder, SWT.NONE);
+ commandTop.setLayout(new GridLayout());
+ commandTop.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createCommandOption(commandTop);
+ commandTab.setControl(commandTop);
+
+ /*
+ * Arguments tab - tab for selecting script arguments
+ */
+ TabItem argumentsTab = new TabItem(fileFolder, SWT.NONE);
+ argumentsTab.setText(Messages.getString("SystemTapOptionsTab.Arguments")); //$NON-NLS-1$
+
+ Composite argumentsTop = new Composite(fileFolder, SWT.NONE);
+ argumentsTop.setLayout(new GridLayout());
+ argumentsTop.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createArgumentsOption(argumentsTop);
+ argumentsTab.setControl(argumentsTop);
+
+
+ /*
+ * Binary Argument tab - tab for supplying arguments for a binary
+ */
+ TabItem binaryArgumentsTab = new TabItem(fileFolder, SWT.NONE);
+ binaryArgumentsTab.setText(Messages.getString("SystemTapOptionsTab.44")); //$NON-NLS-1$
+
+ Composite binaryArgumentsTop = new Composite(fileFolder, SWT.NONE);
+ binaryArgumentsTop.setLayout(new GridLayout());
+ binaryArgumentsTop.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createBinaryArgumentsOption(binaryArgumentsTop);
+ binaryArgumentsTab.setControl(binaryArgumentsTop);
+
+
+ /*
+ * Parser tab -- Tab for selecting a parser and viewer to use
+ */
+ TabItem parserTab = new TabItem(fileFolder, SWT.NONE);
+ parserTab.setText("Parser"); //$NON-NLS-1$
+
+ Composite parserTop = new Composite(fileFolder, SWT.NONE);
+ parserTop.setLayout(new GridLayout());
+ parserTop.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createParserOption(parserTop);
+ parserTab.setControl(parserTop);
+ }
+
+
+ private void createBinaryArgumentsOption(Composite binaryArgumentsTop) {
+ Composite browseTop = new Composite(binaryArgumentsTop, SWT.NONE);
+ browseTop.setLayout(new GridLayout(1, false));
+ GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
+ browseTop.setLayoutData(browseData);
+
+ Label suppFileLabel = new Label(browseTop, SWT.NONE);
+ suppFileLabel.setText(Messages.getString("SystemTapOptionsTab.45")); //$NON-NLS-1$
+
+ binaryArguments = new Text(browseTop,SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 200;
+ binaryArguments.setLayoutData(gd);
+ binaryArguments.addModifyListener(modifyListener);
+ }
+
+ private void createParserOption(Composite parserTop) {
+ Composite browseTop = new Composite(parserTop, SWT.NONE);
+ browseTop.setLayout(new GridLayout(1, false));
+ GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
+ browseTop.setLayoutData(browseData);
+
+ Label suppFileLabel = new Label(browseTop, SWT.NONE);
+ suppFileLabel.setText("Parser"); //$NON-NLS-1$
+
+ parser = new Text(browseTop, SWT.BORDER);
+ parser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ parser.addModifyListener(modifyListener);
+
+ Button parserButton = createPushButton(browseTop,
+ "Find parsers", null); //$NON-NLS-1$
+ parserButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
+ new ListLabelProvider());
+ dialog.setTitle("Select parser"); //$NON-NLS-1$
+ dialog.setMessage("Select parser to use."); //$NON-NLS-1$
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor(PluginConstants.PARSER_RESOURCE,
+ PluginConstants.PARSER_NAME);
+
+ dialog.setElements(extensions);
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ String arg = getUsefulLabel(dialog.getFirstResult());
+ parser.setText(arg);
+ }
+ }
+ });
+
+
+ viewer = new Text(browseTop, SWT.BORDER);
+ viewer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ viewer.addModifyListener(modifyListener);
+
+ Button viewerButton = createPushButton(browseTop,
+ "Find viewers", null); //$NON-NLS-1$
+ viewerButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
+ new ListLabelProvider());
+ dialog.setTitle("Select viewer"); //$NON-NLS-1$
+ dialog.setMessage("Select viewer to use."); //$NON-NLS-1$
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor(PluginConstants.VIEW_RESOURCE,
+ PluginConstants.VIEW_NAME);
+ ArrayList<IConfigurationElement> ext = new ArrayList<>();
+ for (IConfigurationElement el : extensions) {
+ if (!el.getNamespaceIdentifier().contains("org.eclipse.linuxtools")) //$NON-NLS-1$
+ continue;
+ //TODO: Rough hack to get all the objects. We restrict to id's containing org.eclipse.linuxtools, then see if the class extends SystemTapView
+ try {
+ if (el.createExecutableExtension(PluginConstants.ATTR_CLASS)
+ instanceof SystemTapView) {
+ ext.add(el);
+ }
+ } catch (CoreException e1) {
+ }
+ }
+
+ dialog.setElements(ext.toArray());
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ String arg = getUsefulLabel(dialog.getFirstResult());
+ viewer.setText(arg);
+ }
+ }
+ });
+
+ }
+
+ private void createArgumentsOption(Composite argumentsTop) {
+ Composite browseTop = new Composite(argumentsTop, SWT.NONE);
+ browseTop.setLayout(new GridLayout(1, false));
+ GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
+ browseTop.setLayoutData(browseData);
+
+
+ Label suppFileLabel = new Label(browseTop, SWT.NONE);
+ suppFileLabel.setText(Messages.getString("SystemTapOptionsTab.SelectArguments")); //$NON-NLS-1$
+
+ arguments = new Text(browseTop,SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 200;
+ arguments.setLayoutData(gd);
+ arguments.addModifyListener(modifyListener);
+
+
+ Button probeFunctionButton = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.ProbeFunction"), null); //$NON-NLS-1$
+ probeFunctionButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ arguments.setText(arguments.getText() + " process(\"" + binaryFile.getText() + "\").function(\"\")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ }
+
+ private void createFileOption(Composite top) {
+ Composite browseTop = new Composite(top, SWT.NONE);
+ browseTop.setLayout(new GridLayout(4, false));
+ browseTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label suppFileLabel = new Label(browseTop, SWT.NONE);
+ suppFileLabel.setText(Messages.getString("SystemTapOptionsTab.ScriptSelector")); //$NON-NLS-1$
+
+ scriptFile = new Text(browseTop, SWT.BORDER);
+ scriptFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ scriptFile.addModifyListener(modifyListener);
+
+ workspaceBrowseButton = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.WorkspaceButton"), null); //$NON-NLS-1$
+ workspaceBrowseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(Messages.getString("SystemTapOptionsTab.ResourceButton")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemTapOptionsTab.SuppresionsFile")); //$NON-NLS-1$
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ String arg = resource.getFullPath().toString();
+ scriptFile.setText(workspacePath + arg);
+ }
+ }
+ });
+
+ fileBrowseButton = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.FileSystem"), null); //$NON-NLS-1$
+ fileBrowseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String filePath = scriptFile.getText();
+ FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
+ filePath = dialog.open();
+ if (filePath != null) {
+ scriptFile.setText(filePath);
+ }
+ }
+ });
+
+
+ Label binaryFileLabel = new Label(browseTop, SWT.NONE);
+ binaryFileLabel.setText(Messages.getString("SystemTapOptionsTab.SelectBinary")); //$NON-NLS-1$
+
+ binaryFile = new Text(browseTop, SWT.BORDER);
+ binaryFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ binaryFile.addModifyListener(modifyListener);
+
+
+ Button workspaceBrowseButton2 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.WorkspaceButton2"), null); //$NON-NLS-1$
+ workspaceBrowseButton2.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(Messages.getString("SystemTapOptionsTab.SelectResource")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemTapOptionsTab.SelectSuppressions")); //$NON-NLS-1$
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ String arg = resource.getFullPath().toString();
+ binaryFile.setText(workspacePath + arg);
+ }
+ }
+ });
+
+
+ Button fileBrowseButton2 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.BrowseFiles"), null); //$NON-NLS-1$
+ fileBrowseButton2.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String filePath = binaryFile.getText();
+ FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
+ filePath = dialog.open();
+ if (filePath != null) {
+ File file = new File(filePath);
+ if (file.exists()) binaryFile.setText(filePath);
+ }
+ }
+ });
+
+
+ Label outputFileLabel = new Label(browseTop, SWT.NONE);
+ outputFileLabel.setText(Messages.getString("SystemTapOptionsTab.SelectOutput")); //$NON-NLS-1$
+
+ outputFile = new Text(browseTop, SWT.BORDER);
+ outputFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ outputFile.addModifyListener(modifyListenerOutput);
+ outputFile.addFocusListener(focusListener);
+
+ Button workspaceBrowseButton3 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.WorkspaceButton2"), null); //$NON-NLS-1$
+ workspaceBrowseButton3.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(Messages.getString("SystemTapOptionsTab.SelectResource")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemTapOptionsTab.SelectSuppressions")); //$NON-NLS-1$
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ String arg = resource.getFullPath().toString();
+ outputFile.setText(workspacePath + arg);
+ checkOverwrite();
+ updateLaunchConfigurationDialog();
+
+ }
+ }
+ });
+
+ Button fileBrowseButton3 = createPushButton(browseTop, Messages.getString("SystemTapOptionsTab.BrowseFiles"), null); //$NON-NLS-1$
+ fileBrowseButton3.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String filePath = outputFile.getText();
+ FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
+ filePath = dialog.open();
+ if (filePath != null) {
+ outputFile.setText(filePath);
+ checkOverwrite();
+ updateLaunchConfigurationDialog();
+ }
+ }
+ });
+
+ useColourButton = new Button(browseTop, SWT.CHECK);
+ useColourButton.setText(Messages.getString("SystemTapOptionsTab.ColourCodes")); //$NON-NLS-1$
+ useColourButton.addSelectionListener(selectListener);
+ useColourButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+
+
+ private void createCommandOption(Composite top) {
+ Composite buttonsTop = new Composite(top, SWT.NONE);
+ GridLayout gl = new GridLayout(2, true);
+ buttonsTop.setLayout( gl );
+ GridData buttonsData = new GridData(SWT.FILL, SWT.BEGINNING, true, true);
+ buttonsTop.setLayoutData(buttonsData);
+
+ button_k = new Button(buttonsTop, SWT.CHECK);
+ button_k.setText(Messages.getString("SystemTapOptionsTab.KeepTemp")); //$NON-NLS-1$
+ button_k.addSelectionListener(selectListener);
+ button_k.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_k.setToolTipText(Messages.getString("SystemTapOptionsTab.KeepTempToolTip")); //$NON-NLS-1$
+
+ button_g = new Button(buttonsTop, SWT.CHECK);
+ button_g.setText(Messages.getString("SystemTapOptionsTab.Guru")); //$NON-NLS-1$
+ button_g.addSelectionListener(selectListener);
+ button_g.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_g.setToolTipText(Messages.getString("SystemTapOptionsTab.GuruToolTip")); //$NON-NLS-1$
+
+ button_P = new Button(buttonsTop, SWT.CHECK);
+ button_P.setText(Messages.getString("SystemTapOptionsTab.Prologue")); //$NON-NLS-1$
+ button_P.addSelectionListener(selectListener);
+ button_P.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_P.setToolTipText(Messages.getString("SystemTapOptionsTab.PrologueSearchToolTip")); //$NON-NLS-1$
+
+ button_u = new Button(buttonsTop, SWT.CHECK);
+ button_u.setText(Messages.getString("SystemTapOptionsTab.Unused")); //$NON-NLS-1$
+ button_u.addSelectionListener(selectListener);
+ button_u.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_u.setToolTipText(
+ Messages.getString("SystemTapOptionsTab.12")); //$NON-NLS-1$
+
+ button_w = new Button(buttonsTop, SWT.CHECK);
+ button_w.setText(Messages.getString("SystemTapOptionsTab.Warnings")); //$NON-NLS-1$
+ button_w.addSelectionListener(selectListener);
+ button_w.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_w.setToolTipText(Messages.getString("SystemTapOptionsTab.DisableWarningsToolTip")); //$NON-NLS-1$
+
+ button_b = new Button(buttonsTop, SWT.CHECK);
+ button_b.setText(Messages.getString("SystemTapOptionsTab.Bulk")); //$NON-NLS-1$
+ button_b.addSelectionListener(selectListener);
+ button_b.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_b.setToolTipText(
+ Messages.getString("SystemTapOptionsTab.15")); //$NON-NLS-1$
+
+ button_t = new Button(buttonsTop, SWT.CHECK);
+ button_t.setText(Messages.getString("SystemTapOptionsTab.Timing")); //$NON-NLS-1$
+ button_t.addSelectionListener(selectListener);
+ button_t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_t.setToolTipText(Messages.getString("SystemTapOptionsTab.CollectTimingToolTip")); //$NON-NLS-1$
+
+ button_F = new Button(buttonsTop, SWT.CHECK);
+ button_F.setText(Messages.getString("SystemTapOptionsTab.LeaveProbesRunning")); //$NON-NLS-1$
+ button_F.addSelectionListener(selectListener);
+ button_F.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_F.setToolTipText(Messages.getString("SystemTapOptionsTab.LeaveProbesToolTip")); //$NON-NLS-1$
+
+ buttonSkipBadvars = new Button(buttonsTop, SWT.CHECK);
+ buttonSkipBadvars.setText(Messages.getString("SystemTapOptionsTab.IgnoreBadVars")); //$NON-NLS-1$
+ buttonSkipBadvars.addSelectionListener(selectListener);
+ buttonSkipBadvars.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ buttonSkipBadvars.setToolTipText(
+ Messages.getString("SystemTapOptionsTab.30")); //$NON-NLS-1$
+
+ buttonIgnoreDwarf = new Button(buttonsTop, SWT.CHECK);
+ buttonIgnoreDwarf.setText(Messages.getString("SystemTapOptionsTab.ForTesting")); //$NON-NLS-1$
+ buttonIgnoreDwarf.addSelectionListener(selectListener);
+ buttonIgnoreDwarf.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ buttonIgnoreDwarf.setToolTipText(Messages.getString("SystemTapOptionsTab.IgnoreDebugToolTip")); //$NON-NLS-1$
+
+ button_q = new Button(buttonsTop, SWT.CHECK);
+ button_q.setText(Messages.getString("SystemTapOptionsTab.Button_qInfo")); //$NON-NLS-1$
+ button_q.addSelectionListener(selectListener);
+ button_q.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_q.setToolTipText(Messages.getString("SystemTapOptionsTab.33")); //$NON-NLS-1$
+
+ buttonGraphicsMode = new Button(buttonsTop, SWT.CHECK);
+ buttonGraphicsMode.setText(Messages.getString("SystemTapOptionsTab.3")); //$NON-NLS-1$
+ buttonGraphicsMode.addSelectionListener(graphicsModeListener);
+ buttonGraphicsMode.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ buttonGraphicsMode.setToolTipText(
+ Messages.getString("SystemTapOptionsTab.41")); //$NON-NLS-1$
+
+ Composite button_p_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
+ button_p_Spinner_Top.setLayout(new GridLayout(2, true));
+ button_p_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label button_p_Spinner_Label = new Label(button_p_Spinner_Top, SWT.NONE);
+ button_p_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.19")); //$NON-NLS-1$
+ button_p_Spinner = new Spinner(button_p_Spinner_Top, SWT.BORDER);
+ button_p_Spinner.setMaximum(Integer.MAX_VALUE);
+ button_p_Spinner.addModifyListener(modifyListener);
+ button_p_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_p_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.StopAfterPassToolTip")); //$NON-NLS-1$
+
+ Composite button_s_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
+ button_s_Spinner_Top.setLayout(new GridLayout(2, true));
+ button_s_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label button_s_Spinner_Label = new Label(button_s_Spinner_Top, SWT.NONE);
+ button_s_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.BufferWith")); //$NON-NLS-1$
+ button_s_Spinner = new Spinner(button_s_Spinner_Top, SWT.BORDER);
+ button_s_Spinner.setMaximum(Integer.MAX_VALUE);
+ button_s_Spinner.addModifyListener(modifyListener);
+ button_s_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_s_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.BufferWithToolTip")); //$NON-NLS-1$
+
+ Composite button_x_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
+ button_x_Spinner_Top.setLayout(new GridLayout(2, true));
+ button_x_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label button_x_Spinner_Label = new Label(button_x_Spinner_Top, SWT.NONE);
+ button_x_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.TargetPID")); //$NON-NLS-1$
+ button_x_Spinner = new Spinner(button_x_Spinner_Top, SWT.BORDER);
+ button_x_Spinner.setMaximum(Integer.MAX_VALUE);
+ button_x_Spinner.addModifyListener(modifyListener);
+ button_x_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_x_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.TargetPIDToolTip")); //$NON-NLS-1$
+
+ Composite button_v_Spinner_Top = new Composite(buttonsTop, SWT.NONE);
+ button_v_Spinner_Top.setLayout(new GridLayout(2, true));
+ button_v_Spinner_Top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label button_v_Spinner_Label = new Label(button_v_Spinner_Top, SWT.NONE);
+ button_v_Spinner_Label.setText(Messages.getString("SystemTapOptionsTab.18")); //$NON-NLS-1$
+ button_v_Spinner = new Spinner(button_v_Spinner_Top, SWT.BORDER);
+ button_v_Spinner.setMaximum(3);
+ button_v_Spinner.addModifyListener(modifyListener);
+ button_v_Spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_v_Spinner_Label.setToolTipText(Messages.getString("SystemTapOptionsTab.TargetPIDToolTip")); //$NON-NLS-1$
+
+
+ Label button_D_label = new Label(buttonsTop, SWT.NONE);
+ button_D_label.setText(Messages.getString("SystemTapOptionsTab.PreprocessorDirective")); //$NON-NLS-1$
+ button_D_text = new Text(buttonsTop, SWT.BORDER);
+ button_D_text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ button_D_text.addModifyListener(modifyListener);
+ button_D_label.setToolTipText(
+ Messages.getString("SystemTapOptionsTab.PreprocessorToolTip")); //$NON-NLS-1$
+ }
+
+ @Override
+ public String getName() {
+ return Messages.getString("SystemTapOptionsTab.MainTabName"); //$NON-NLS-1$
+ }
+
+ private Shell getActiveWorkbenchShell() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+
+ private IBinary chooseBinary(IBinary[] binaries) {
+ ILabelProvider programLabelProvider = new CElementLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IBinary) {
+ IBinary bin = (IBinary)element;
+ StringBuffer name = new StringBuffer();
+ name.append(bin.getPath().lastSegment());
+ return name.toString();
+ }
+ return super.getText(element);
+ }
+ };
+
+ ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IBinary) {
+ IBinary bin = (IBinary)element;
+ StringBuffer name = new StringBuffer();
+ name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$
+ name.append(" - "); //$NON-NLS-1$
+ name.append(bin.getPath().toString());
+ return name.toString();
+ }
+ return super.getText(element);
+ }
+ };
+
+ TwoPaneElementSelector dialog = new TwoPaneElementSelector(getActiveWorkbenchShell(), programLabelProvider, qualifierLabelProvider);
+ dialog.setElements(binaries);
+ dialog.setTitle(Messages.getString("SystemtTapOptionsTab.Callgraph")); //$NON-NLS-1$
+ dialog.setMessage(Messages.getString("SystemtTapOptionsTab.Choose_a_local_application")); //$NON-NLS-1$
+ dialog.setUpperListLabel(Messages.getString("SystemtTapOptionsTab.Binaries")); //$NON-NLS-1$
+ dialog.setLowerListLabel(Messages.getString("SystemtTapOptionsTab.Qualifier")); //$NON-NLS-1$
+ dialog.setMultipleSelection(false);
+ if (dialog.open() == Window.OK) {
+ return (IBinary) dialog.getFirstResult();
+ }
+
+ return null;
+ }
+
+ private IBinary getBinary(ILaunchConfiguration config) {
+ try {
+ ICProject project = CDebugUtils.verifyCProject(config);
+ IBinary[] binaries = project.getBinaryContainer().getBinaries();
+ if (binaries != null && binaries.length > 0) {
+ if (binaries.length == 1 && binaries[0] != null) {
+ return binaries[0];
+ } else
+ return chooseBinary(binaries);
+ }
+ return null;
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IPath location = root.getLocation();
+ workspacePath = location.toString();
+
+ try {
+ button_k.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY, LaunchConfigurationConstants.DEFAULT_COMMAND_KEEP_TEMPORARY));
+ button_u.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION, LaunchConfigurationConstants.DEFAULT_COMMAND_NO_CODE_ELISION));
+ button_w.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS, LaunchConfigurationConstants.DEFAULT_COMMAND_DISABLE_WARNINGS));
+ button_b.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, LaunchConfigurationConstants.DEFAULT_COMMAND_BULK_MODE));
+ button_g.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_GURU, LaunchConfigurationConstants.DEFAULT_COMMAND_GURU));
+ button_P.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH, LaunchConfigurationConstants.DEFAULT_COMMAND_PROLOGUE_SEARCH));
+ button_t.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, LaunchConfigurationConstants.DEFAULT_COMMAND_TIMING_INFO));
+ buttonSkipBadvars.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, LaunchConfigurationConstants.DEFAULT_COMMAND_SKIP_BADVARS));
+ buttonIgnoreDwarf.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, LaunchConfigurationConstants.DEFAULT_COMMAND_IGNORE_DWARF));
+ button_q.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE, LaunchConfigurationConstants.DEFAULT_COMMAND_TAPSET_COVERAGE));
+ button_F.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING, LaunchConfigurationConstants.DEFAULT_COMMAND_LEAVE_RUNNING));
+ button_s_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES));
+ button_x_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID));
+ button_v_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, LaunchConfigurationConstants.DEFAULT_COMMAND_VERBOSE));
+ button_p_Spinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_PASS, LaunchConfigurationConstants.DEFAULT_COMMAND_PASS));
+
+ button_D_text.setText(configuration.getAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES, LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES));
+ binaryFile.setText(configuration.getAttribute(LaunchConfigurationConstants.BINARY_PATH, LaunchConfigurationConstants.DEFAULT_BINARY_PATH));
+ scriptFile.setText(configuration.getAttribute(LaunchConfigurationConstants.SCRIPT_PATH, LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH));
+ outputFile.setText(configuration.getAttribute(LaunchConfigurationConstants.OUTPUT_PATH, LaunchConfigurationConstants.DEFAULT_OUTPUT_PATH));
+ arguments.setText(configuration.getAttribute(LaunchConfigurationConstants.ARGUMENTS, LaunchConfigurationConstants.DEFAULT_ARGUMENTS));
+ binaryArguments.setText(configuration.getAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS, LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS));
+
+ parser.setText(configuration.getAttribute(LaunchConfigurationConstants.PARSER_CLASS, LaunchConfigurationConstants.DEFAULT_PARSER_CLASS));
+ viewer.setText(configuration.getAttribute(LaunchConfigurationConstants.VIEW_CLASS, LaunchConfigurationConstants.DEFAULT_VIEW_CLASS));
+
+ useColourButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.USE_COLOUR, LaunchConfigurationConstants.DEFAULT_USE_COLOUR));
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+
+ getControl().setRedraw(false);
+
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY, button_k.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_GURU, button_g.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH, button_P.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION, button_u.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS, button_w.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, button_b.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, button_t.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, buttonSkipBadvars.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, buttonIgnoreDwarf.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE, button_q.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING, button_F.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PASS, button_p_Spinner.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, button_s_Spinner.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, button_x_Spinner.getSelection());
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, button_v_Spinner.getSelection());
+
+ configuration.setAttribute(LaunchConfigurationConstants.PARSER_CLASS, parser.getText());
+ configuration.setAttribute(LaunchConfigurationConstants.VIEW_CLASS, viewer.getText());
+
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES, button_D_text.getText());
+ configuration.setAttribute(LaunchConfigurationConstants.BINARY_PATH, binaryFile.getText());
+ configuration.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH, scriptFile.getText());
+ configuration.setAttribute(LaunchConfigurationConstants.ARGUMENTS, arguments.getText());
+ configuration.setAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS, binaryArguments.getText());
+ configuration.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH, outputFile.getText());
+
+ configuration.setAttribute(LaunchConfigurationConstants.USE_COLOUR, useColourButton.getSelection());
+
+ if (buttonGraphicsMode.getSelection()){
+ scriptFile.setEnabled(false);
+ workspaceBrowseButton.setEnabled(false);
+ fileBrowseButton.setEnabled(false);
+
+ }else{
+ scriptFile.setEnabled(true);
+ workspaceBrowseButton.setEnabled(true);
+ fileBrowseButton.setEnabled(true);
+ }
+
+ if (changeOverwrite) {
+ if (needsOverwritePermission && overwritePermission || !needsOverwritePermission) {
+ configuration.setAttribute(LaunchConfigurationConstants.OVERWRITE, true);
+ } else {
+ configuration.setAttribute(LaunchConfigurationConstants.OVERWRITE, false);
+ }
+ changeOverwrite = false;
+ }
+
+ getControl().setRedraw(true);
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE,LaunchConfigurationConstants.DEFAULT_COMMAND_VERBOSE);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY,LaunchConfigurationConstants.DEFAULT_COMMAND_KEEP_TEMPORARY);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_GURU,LaunchConfigurationConstants.DEFAULT_COMMAND_GURU);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH,LaunchConfigurationConstants.DEFAULT_COMMAND_PROLOGUE_SEARCH);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION,LaunchConfigurationConstants.DEFAULT_COMMAND_NO_CODE_ELISION);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS,LaunchConfigurationConstants.DEFAULT_COMMAND_DISABLE_WARNINGS);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE,LaunchConfigurationConstants.DEFAULT_COMMAND_BULK_MODE);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO,LaunchConfigurationConstants.DEFAULT_COMMAND_TIMING_INFO);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS,LaunchConfigurationConstants.DEFAULT_COMMAND_SKIP_BADVARS);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF,LaunchConfigurationConstants.DEFAULT_COMMAND_IGNORE_DWARF);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE,LaunchConfigurationConstants.DEFAULT_COMMAND_TAPSET_COVERAGE);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING,LaunchConfigurationConstants.DEFAULT_COMMAND_LEAVE_RUNNING);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_PASS,LaunchConfigurationConstants.DEFAULT_COMMAND_PASS);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES,LaunchConfigurationConstants.DEFAULT_COMMAND_BUFFER_BYTES);
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID,LaunchConfigurationConstants.DEFAULT_COMMAND_TARGET_PID);
+
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES,LaunchConfigurationConstants.DEFAULT_COMMAND_C_DIRECTIVES);
+ configuration.setAttribute(LaunchConfigurationConstants.BINARY_PATH,LaunchConfigurationConstants.DEFAULT_BINARY_PATH);
+ configuration.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH);
+ configuration.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,LaunchConfigurationConstants.DEFAULT_OUTPUT_PATH);
+ configuration.setAttribute(LaunchConfigurationConstants.ARGUMENTS,LaunchConfigurationConstants.DEFAULT_ARGUMENTS);
+ configuration.setAttribute(LaunchConfigurationConstants.BINARY_ARGUMENTS,LaunchConfigurationConstants.DEFAULT_BINARY_ARGUMENTS);
+
+ configuration.setAttribute(LaunchConfigurationConstants.GENERATED_SCRIPT, LaunchConfigurationConstants.DEFAULT_GENERATED_SCRIPT);
+ configuration.setAttribute(LaunchConfigurationConstants.NEED_TO_GENERATE, LaunchConfigurationConstants.DEFAULT_NEED_TO_GENERATE);
+ configuration.setAttribute(LaunchConfigurationConstants.PARSER_CLASS, LaunchConfigurationConstants.DEFAULT_PARSER_CLASS);
+ configuration.setAttribute(LaunchConfigurationConstants.VIEW_CLASS, LaunchConfigurationConstants.DEFAULT_VIEW_CLASS);
+
+ configuration.setAttribute(LaunchConfigurationConstants.USE_COLOUR, LaunchConfigurationConstants.DEFAULT_USE_COLOUR);
+
+ configuration.setAttribute(LaunchConfigurationConstants.COMMAND_LIST, ConfigurationOptionsSetter.setOptions(configuration));
+
+ ICElement cElement = null;
+ cElement = getContext(configuration, getPlatform(configuration));
+ if (cElement != null) {
+ initializeCProject(cElement, configuration);
+ } else {
+ // don't want to remember the interim value from before
+ configuration.setMappedResources(null);
+ }
+
+ IBinary bin = getBinary(configuration);
+ if (bin != null) {
+ String programName = bin.getResource().getProjectRelativePath().toString();
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
+
+ LaunchStapGraph launch = new LaunchStapGraph();
+ launch.setTestMode(true); //Do not run callgraph
+ launch.launch(bin, "", configuration); //$NON-NLS-1$
+ }
+ }
+
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ // Check that the major options are sane
+ boolean valid = true;
+ try {
+ String sPath = launchConfig.getAttribute(
+ LaunchConfigurationConstants.SCRIPT_PATH,
+ LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH);
+
+ File script = new File(sPath);
+
+ if (sPath.equals(LaunchConfigurationConstants.DEFAULT_SCRIPT_PATH) || !script.exists()) {
+ //No script path specified or no such script exists
+ valid = false;
+ }
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return valid;
+ }
+
+ private String getUsefulLabel(Object element) {
+ if (element instanceof IConfigurationElement) {
+ Object o = ((IConfigurationElement) element).getParent();
+ if (o instanceof IExtension) {
+ IExtension e = (IExtension) ((IConfigurationElement) element).getParent();
+ return e.getUniqueIdentifier();
+ }
+ }
+ return Messages.getString("SystemTapOptionsTab.1"); //$NON-NLS-1$
+ }
+
+ private static class ListLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IConfigurationElement) {
+ Object o = ((IConfigurationElement) element).getParent();
+ if (o instanceof IExtension) {
+ IExtension e = (IExtension) ((IConfigurationElement) element).getParent();
+ return e.getLabel();
+ }
+ else if (o instanceof IConfigurationElement) {
+ IConfigurationElement e = (IConfigurationElement) ((IConfigurationElement) element).getParent();
+ return e.getName();
+ }
+
+ }
+ return Messages.getString("SystemTapOptionsTab.46"); //$NON-NLS-1$
+ }
+
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/TranslationUnitVisitor.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/TranslationUnitVisitor.java
index a5cd69cef1..c01b6e75dc 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/TranslationUnitVisitor.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/TranslationUnitVisitor.java
@@ -14,23 +14,23 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementVisitor;
public class TranslationUnitVisitor implements ICElementVisitor {
- private String functions;
+ private String functions;
- public TranslationUnitVisitor() {
- super();
- functions = ""; //$NON-NLS-1$
- }
+ public TranslationUnitVisitor() {
+ super();
+ functions = ""; //$NON-NLS-1$
+ }
- @Override
- public boolean visit(ICElement arg0) {
- if (arg0.getElementType() == ICElement.C_FUNCTION) {
- functions += arg0.getElementName() + " "; //$NON-NLS-1$
- return false;
- }
- return true;
- }
+ @Override
+ public boolean visit(ICElement arg0) {
+ if (arg0.getElementType() == ICElement.C_FUNCTION) {
+ functions += arg0.getElementName() + " "; //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
- public String getFunctions() {
- return functions;
- }
+ public String getFunctions() {
+ return functions;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.tests/pom.xml b/systemtap/org.eclipse.linuxtools.callgraph.tests/pom.xml
index 2310972a8f..4d035a0db2 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.tests/pom.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph.tests/pom.xml
@@ -35,7 +35,7 @@
</excludes>
<testSuite>org.eclipse.linuxtools.callgraph.tests</testSuite>
<testClass>org.eclipse.linuxtools.callgraph.tests.AllTests</testClass>
- <useUIHarness>true</useUIHarness>
+ <useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<product>org.eclipse.platform.ide</product>
</configuration>
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/Activator.java b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/Activator.java
index 4939385d72..7ee23e1072 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/Activator.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/Activator.java
@@ -23,19 +23,19 @@ import org.osgi.framework.Bundle;
*/
public class Activator {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.callgraph.tests";
-
- public static String getPluginLocation() {
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.callgraph.tests";
- URL locationUrl = FileLocator.find(bundle,new Path("/"), null); //$NON-NLS-1$
- URL fileUrl = null;
- try {
- fileUrl = FileLocator.toFileURL(locationUrl);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return fileUrl.getFile();
- }
+ public static String getPluginLocation() {
+ Bundle bundle = Platform.getBundle(PLUGIN_ID);
+
+ URL locationUrl = FileLocator.find(bundle,new Path("/"), null); //$NON-NLS-1$
+ URL fileUrl = null;
+ try {
+ fileUrl = FileLocator.toFileURL(locationUrl);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return fileUrl.getFile();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/MouseListenerTest.java b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/MouseListenerTest.java
index 1bf66fc347..d7cf916eed 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/MouseListenerTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/MouseListenerTest.java
@@ -23,30 +23,30 @@ import org.junit.Test;
public class MouseListenerTest {
- @Test
- public void test() {
- StapGraphParser parse = new StapGraphParser();
- parse.setSourcePath(Activator.getPluginLocation() + "eag.graph");
- parse.testRun(new NullProgressMonitor(), true);
+ @Test
+ public void test() {
+ StapGraphParser parse = new StapGraphParser();
+ parse.setSourcePath(Activator.getPluginLocation() + "eag.graph");
+ parse.testRun(new NullProgressMonitor(), true);
- CallgraphView cView = (CallgraphView) ViewFactory.createView("org.eclipse.linuxtools.callgraph.callgraphview");
+ CallgraphView cView = (CallgraphView) ViewFactory.createView("org.eclipse.linuxtools.callgraph.callgraphview");
- StapUIJob j = new StapUIJob("Test Graph UI Job", parse,
- CallGraphConstants.VIEW_ID);
- j.runInUIThread(new NullProgressMonitor());
+ StapUIJob j = new StapUIJob("Test Graph UI Job", parse,
+ CallGraphConstants.VIEW_ID);
+ j.runInUIThread(new NullProgressMonitor());
- StapGraphMouseListener mListener = cView.getGraph().getMouseListener();
+ StapGraphMouseListener mListener = cView.getGraph().getMouseListener();
- StapGraph g = cView.getGraph();
- g.setProject(parse.project);
+ StapGraph g = cView.getGraph();
+ g.setProject(parse.project);
- GraphItem[] nodes = { g.getNode(g.getFirstUsefulNode()) };
- g.setSelection(nodes);
+ GraphItem[] nodes = { g.getNode(g.getFirstUsefulNode()) };
+ g.setSelection(nodes);
- mListener.mouseDownEvent(0, 0);
- g.draw(StapGraph.CONSTANT_DRAWMODE_TREE,
- StapGraph.CONSTANT_ANIMATION_FASTEST, g.getFirstUsefulNode());
- mListener.mouseUp(null);
+ mListener.mouseDownEvent(0, 0);
+ g.draw(StapGraph.CONSTANT_DRAWMODE_TREE,
+ StapGraph.CONSTANT_ANIMATION_FASTEST, g.getFirstUsefulNode());
+ mListener.mouseUp(null);
- }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/StapGraphParserTest.java b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/StapGraphParserTest.java
index c1ea25b893..9ed5eb873b 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/StapGraphParserTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/StapGraphParserTest.java
@@ -23,117 +23,117 @@ import org.junit.Test;
public class StapGraphParserTest {
- //RENDER THE GRAPH
- public static StapGraphParser initializeGraph(String filePath){
- StapGraphParser grph = new StapGraphParser();
- grph.setSourcePath(filePath);
- grph.nonRealTimeParsing();
- return grph;
- }
-
- public static void assertSanity(StapGraphParser grph){
- /*if (grph.serialMap.size() == 0 || grph.timeMap.size() == 0
- || grph.outNeighbours.size() == 0 || grph.countMap.size() == 0
- || grph.aggregateTimeMap.size() == 0){
- fail("Parsing Error : One or more data structures were empty.");
- }*/
-
- //SAME NUMBER OF NODES ENTRIES
- assertEquals(grph.serialMap.size(),grph.timeMap.size());
- int nsize = 0;
- for (int key : grph.neighbourMaps.keySet())
- if (grph.neighbourMaps.get(key)!= null)
- nsize+=grph.neighbourMaps.get(key).size();
- assertEquals(grph.serialMap.size(),nsize);
- //ALL UNIQUE FUNCTIONS HAVE A TIME
- //ALL FUNCTIONS HAVE A CUMULATIVE TIME
- for (int val : grph.serialMap.keySet()){
- String fname = grph.serialMap.get(val);
- assertNotNull(grph.timeMap.get(val));
- assertNotNull(grph.aggregateTimeMap.get(fname));
- }
- }
-
-
- public static void assertTimes(StapGraphParser grph){
- //NO FUNCTION HAS TIME/CUMULATIVE TIME LARGER THAN TOTAL
- for (int val : grph.serialMap.keySet()){
- String fname = grph.serialMap.get(val);
- assertTrue(grph.totalTime >= grph.timeMap.get(val));
- assertTrue(grph.totalTime >= grph.aggregateTimeMap.get(fname));
- }
- }
-
-
- public static void assertConnectedness (StapGraphParser grph){
- boolean hasParent;
- //ALL NODES MUST HAVE A PARENT EXCEPT THE ROOT
- for (int key : grph.serialMap.keySet()){
- hasParent = false;
- for (int k:grph.neighbourMaps.keySet()) {
- HashMap<Integer, ArrayList<Integer>> outNeighbours = grph.neighbourMaps.get(k);
- if (outNeighbours != null && outNeighbours.size() > 0)
- for (ArrayList<Integer> list : outNeighbours.values()){
- if (list.contains(key)){
- hasParent = true;
- break;
- }
- }
-
- if (!hasParent){
- for (int other : grph.serialMap.keySet()){
- if (key > other){
- fail(key + " " + grph.serialMap.get(key) + " had no parent");
- }
- }
- }
- }
- }
-
- }
-
-
- public final String currentPath = Activator.getPluginLocation();
- public String graphDataPath= "";
-
- //FOR TESTING THE GRAPH PARSING
- public void executeGraphTests(){
- StapGraphParser grph = StapGraphParserTest.initializeGraph(graphDataPath);
- StapGraphParserTest.assertSanity(grph);
- StapGraphParserTest.assertTimes(grph);
- StapGraphParserTest.assertConnectedness(grph);
- }
+ //RENDER THE GRAPH
+ public static StapGraphParser initializeGraph(String filePath){
+ StapGraphParser grph = new StapGraphParser();
+ grph.setSourcePath(filePath);
+ grph.nonRealTimeParsing();
+ return grph;
+ }
+
+ public static void assertSanity(StapGraphParser grph){
+ /*if (grph.serialMap.size() == 0 || grph.timeMap.size() == 0
+ || grph.outNeighbours.size() == 0 || grph.countMap.size() == 0
+ || grph.aggregateTimeMap.size() == 0){
+ fail("Parsing Error : One or more data structures were empty.");
+ }*/
+
+ //SAME NUMBER OF NODES ENTRIES
+ assertEquals(grph.serialMap.size(),grph.timeMap.size());
+ int nsize = 0;
+ for (int key : grph.neighbourMaps.keySet())
+ if (grph.neighbourMaps.get(key)!= null)
+ nsize+=grph.neighbourMaps.get(key).size();
+ assertEquals(grph.serialMap.size(),nsize);
+ //ALL UNIQUE FUNCTIONS HAVE A TIME
+ //ALL FUNCTIONS HAVE A CUMULATIVE TIME
+ for (int val : grph.serialMap.keySet()){
+ String fname = grph.serialMap.get(val);
+ assertNotNull(grph.timeMap.get(val));
+ assertNotNull(grph.aggregateTimeMap.get(fname));
+ }
+ }
+
+
+ public static void assertTimes(StapGraphParser grph){
+ //NO FUNCTION HAS TIME/CUMULATIVE TIME LARGER THAN TOTAL
+ for (int val : grph.serialMap.keySet()){
+ String fname = grph.serialMap.get(val);
+ assertTrue(grph.totalTime >= grph.timeMap.get(val));
+ assertTrue(grph.totalTime >= grph.aggregateTimeMap.get(fname));
+ }
+ }
+
+
+ public static void assertConnectedness (StapGraphParser grph){
+ boolean hasParent;
+ //ALL NODES MUST HAVE A PARENT EXCEPT THE ROOT
+ for (int key : grph.serialMap.keySet()){
+ hasParent = false;
+ for (int k:grph.neighbourMaps.keySet()) {
+ HashMap<Integer, ArrayList<Integer>> outNeighbours = grph.neighbourMaps.get(k);
+ if (outNeighbours != null && outNeighbours.size() > 0)
+ for (ArrayList<Integer> list : outNeighbours.values()){
+ if (list.contains(key)){
+ hasParent = true;
+ break;
+ }
+ }
+
+ if (!hasParent){
+ for (int other : grph.serialMap.keySet()){
+ if (key > other){
+ fail(key + " " + grph.serialMap.get(key) + " had no parent");
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+
+ public final String currentPath = Activator.getPluginLocation();
+ public String graphDataPath= "";
+
+ //FOR TESTING THE GRAPH PARSING
+ public void executeGraphTests(){
+ StapGraphParser grph = StapGraphParserTest.initializeGraph(graphDataPath);
+ StapGraphParserTest.assertSanity(grph);
+ StapGraphParserTest.assertTimes(grph);
+ StapGraphParserTest.assertConnectedness(grph);
+ }
@Test
- public void testJustMain(){
- graphDataPath = currentPath+"main.graph";
- executeGraphTests();
- }
+ public void testJustMain(){
+ graphDataPath = currentPath+"main.graph";
+ executeGraphTests();
+ }
@Test
- public void testCallGraphRunBasic(){
- graphDataPath = currentPath+"basic.graph";
- executeGraphTests();
- }
+ public void testCallGraphRunBasic(){
+ graphDataPath = currentPath+"basic.graph";
+ executeGraphTests();
+ }
@Test
- public void testCallGraphRunRecursive(){
- graphDataPath = currentPath+"catlan.graph";
- executeGraphTests();
- }
+ public void testCallGraphRunRecursive(){
+ graphDataPath = currentPath+"catlan.graph";
+ executeGraphTests();
+ }
@Test
- public void testManyFuncs(){
- graphDataPath = currentPath+"eag.graph";
- executeGraphTests();
- }
+ public void testManyFuncs(){
+ graphDataPath = currentPath+"eag.graph";
+ executeGraphTests();
+ }
@Test
- public void testComprehensive(){
- graphDataPath = currentPath+"comprehensive.graph";
- executeGraphTests();
- }
+ public void testComprehensive(){
+ graphDataPath = currentPath+"comprehensive.graph";
+ executeGraphTests();
+ }
@Test
- public void testHeavy(){
- graphDataPath = currentPath+"heavy.graph";
- executeGraphTests();
- }
+ public void testHeavy(){
+ graphDataPath = currentPath+"heavy.graph";
+ executeGraphTests();
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphTest.java b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphTest.java
index 8e35ede8ec..df8e5518c9 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphTest.java
@@ -28,93 +28,93 @@ import org.junit.Test;
public class SystemTapGraphTest {
- private boolean manual = false;
- @Test
- public void testGraphLoading() {
+ private boolean manual = false;
+ @Test
+ public void testGraphLoading() {
- StapGraphParser parse = new StapGraphParser();
- parse.setSourcePath(Activator.getPluginLocation()+"eag.graph");
- assertEquals(Status.OK_STATUS, parse.testRun(new NullProgressMonitor(), true));
+ StapGraphParser parse = new StapGraphParser();
+ parse.setSourcePath(Activator.getPluginLocation()+"eag.graph");
+ assertEquals(Status.OK_STATUS, parse.testRun(new NullProgressMonitor(), true));
- StapUIJob j = new StapUIJob("Test Graph UI Job", parse, CallGraphConstants.VIEW_ID);
- j.runInUIThread(new NullProgressMonitor());
- CallgraphView cView = (CallgraphView) ViewFactory.createView(CallGraphConstants.VIEW_ID);
+ StapUIJob j = new StapUIJob("Test Graph UI Job", parse, CallGraphConstants.VIEW_ID);
+ j.runInUIThread(new NullProgressMonitor());
+ CallgraphView cView = (CallgraphView) ViewFactory.createView(CallGraphConstants.VIEW_ID);
- if (!manual) {
- ArrayList<String> tasks = new ArrayList<>();
+ if (!manual) {
+ ArrayList<String> tasks = new ArrayList<>();
- tasks.add("(Manually) Maximize CallgraphView");
- tasks.add("Refresh");
- tasks.add("Tree View");
- tasks.add("Aggregate View");
- tasks.add("Box View");
- tasks.add("Animation->Fast");
- tasks.add("Collapse");
- tasks.add("Uncollapse");
- tasks.add("Radial View");
- tasks.add("Collapse.");
- tasks.add("(Manually) Double-click node with no children in TreeViewer");
- tasks.add("(Manually) Expand an arrow in the TreeViewer");
- tasks.add("(Manually) Collapse an arrow in the TreeViewer");
- tasks.add("Save file");
- tasks.add("Reload file");
- tasks.add("Maximize");
+ tasks.add("(Manually) Maximize CallgraphView");
+ tasks.add("Refresh");
+ tasks.add("Tree View");
+ tasks.add("Aggregate View");
+ tasks.add("Box View");
+ tasks.add("Animation->Fast");
+ tasks.add("Collapse");
+ tasks.add("Uncollapse");
+ tasks.add("Radial View");
+ tasks.add("Collapse.");
+ tasks.add("(Manually) Double-click node with no children in TreeViewer");
+ tasks.add("(Manually) Expand an arrow in the TreeViewer");
+ tasks.add("(Manually) Collapse an arrow in the TreeViewer");
+ tasks.add("Save file");
+ tasks.add("Reload file");
+ tasks.add("Maximize");
- for (int taskNumber = 0; taskNumber < tasks.size(); taskNumber++) {
+ for (int taskNumber = 0; taskNumber < tasks.size(); taskNumber++) {
- Action act = null;
- switch (taskNumber) {
- case 1:
- break;
- case 2:
- act = cView.getViewRefresh();
- break;
- case 3:
- act = cView.getViewTreeview();
- break;
- case 4:
- act = cView.getViewAggregateview();
- break;
- case 5:
- act = cView.getViewLevelview();
- break;
- case 6:
- act = cView.getAnimationFast();
- break;
- case 7:
- case 8:
- act = cView.getModeCollapsednodes();
- break;
- case 9:
- act = cView.getViewRadialview();
- break;
- case 10:
- act = cView.getModeCollapsednodes();
- break;
- case 14:
- String tempLocation = Activator.getPluginLocation()+"eag.graph2";
- File temp = new File(tempLocation);
- temp.delete();
- cView.saveData(tempLocation);
- temp.delete();
- break;
- case 15:
- StapGraphParser new_parser = new StapGraphParser();
- new_parser.setSourcePath(Activator.getPluginLocation()+"eag.graph");
- new_parser.testRun(new NullProgressMonitor(), true);
- break;
- case 16:
- cView.maximizeIfUnmaximized();
- break;
- default:
- break;
- }
- if (act != null) {
- act.run();
- }
- }
- return;
- }
- }
+ Action act = null;
+ switch (taskNumber) {
+ case 1:
+ break;
+ case 2:
+ act = cView.getViewRefresh();
+ break;
+ case 3:
+ act = cView.getViewTreeview();
+ break;
+ case 4:
+ act = cView.getViewAggregateview();
+ break;
+ case 5:
+ act = cView.getViewLevelview();
+ break;
+ case 6:
+ act = cView.getAnimationFast();
+ break;
+ case 7:
+ case 8:
+ act = cView.getModeCollapsednodes();
+ break;
+ case 9:
+ act = cView.getViewRadialview();
+ break;
+ case 10:
+ act = cView.getModeCollapsednodes();
+ break;
+ case 14:
+ String tempLocation = Activator.getPluginLocation()+"eag.graph2";
+ File temp = new File(tempLocation);
+ temp.delete();
+ cView.saveData(tempLocation);
+ temp.delete();
+ break;
+ case 15:
+ StapGraphParser new_parser = new StapGraphParser();
+ new_parser.setSourcePath(Activator.getPluginLocation()+"eag.graph");
+ new_parser.testRun(new NullProgressMonitor(), true);
+ break;
+ case 16:
+ cView.maximizeIfUnmaximized();
+ break;
+ default:
+ break;
+ }
+ if (act != null) {
+ act.run();
+ }
+ }
+ return;
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphViewTest.java b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphViewTest.java
index 4ebe75fdba..cce4bb5ec5 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphViewTest.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.tests/src/org/eclipse/linuxtools/callgraph/tests/SystemTapGraphViewTest.java
@@ -18,19 +18,19 @@ import org.eclipse.linuxtools.internal.callgraph.core.ViewFactory;
import org.junit.Test;
public class SystemTapGraphViewTest {
- private SystemTapTextView stapView = new SystemTapTextView();
- private String testText = "blah";
+ private SystemTapTextView stapView = new SystemTapTextView();
+ private String testText = "blah";
- //TODO: write some better tests here
- @Test
- public void test() {
- stapView = (SystemTapTextView) ViewFactory.createView("org.eclipse.linuxtools.callgraph.core.staptextview");
+ //TODO: write some better tests here
+ @Test
+ public void test() {
+ stapView = (SystemTapTextView) ViewFactory.createView("org.eclipse.linuxtools.callgraph.core.staptextview");
- stapView.println(testText);
- assertEquals(stapView.getText(), testText);
+ stapView.println(testText);
+ assertEquals(stapView.getText(), testText);
- stapView.clearAll();
- assertEquals(stapView.getText(), "");
- }
+ stapView.clearAll();
+ assertEquals(stapView.getText(), "");
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/plugin.xml b/systemtap/org.eclipse.linuxtools.callgraph/plugin.xml
index 02fa15ce6b..82723f2a21 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.callgraph/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
-
+
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
@@ -15,7 +15,7 @@
</perspectiveExtension>
</extension>
-
+
<extension
id="org.eclipse.linuxtools.callgraph.callgraphview"
name="%extension.name"
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/AggregateLayoutAlgorithm.java b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/AggregateLayoutAlgorithm.java
index c2b4963292..e1ee85ddac 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/AggregateLayoutAlgorithm.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/AggregateLayoutAlgorithm.java
@@ -25,59 +25,59 @@ import org.eclipse.zest.layouts.dataStructures.InternalRelationship;
*/
public class AggregateLayoutAlgorithm extends GridLayoutAlgorithm{
- private ArrayList<Long> list;
- private Long totalTime;
- private int graphWidth;
+ private ArrayList<Long> list;
+ private Long totalTime;
+ private int graphWidth;
- /**
- * Layout algorithm for the Aggregate View in Eclipse Callgraph, based on the GridLayoutAlgorithm in Zest.
- * @param styles
- * @param entries
- * @param time
- * @param width
- */
- public AggregateLayoutAlgorithm(int styles, TreeSet<Entry<String, Long>> entries, Long time, int width){
- super(styles);
+ /**
+ * Layout algorithm for the Aggregate View in Eclipse Callgraph, based on the GridLayoutAlgorithm in Zest.
+ * @param styles
+ * @param entries
+ * @param time
+ * @param width
+ */
+ public AggregateLayoutAlgorithm(int styles, TreeSet<Entry<String, Long>> entries, Long time, int width){
+ super(styles);
- list = new ArrayList<>();
- for (Entry<String, Long> ent : entries) {
- list.add(ent.getValue());
- }
+ list = new ArrayList<>();
+ for (Entry<String, Long> ent : entries) {
+ list.add(ent.getValue());
+ }
- this.totalTime = time;
- this.graphWidth = width;
- }
+ this.totalTime = time;
+ this.graphWidth = width;
+ }
- /**
- * Called at the end of the layout algorithm -- change the size and colour
- * of each node according to times called/total time
- */
- @Override
- protected void postLayoutAlgorithm(InternalNode[] entitiesToLayout,
- InternalRelationship[] relationshipsToConsider) {
- final int minimumSize = 40;
- double xcursor = 0.0;
- double ycursor = 0.0;
+ /**
+ * Called at the end of the layout algorithm -- change the size and colour
+ * of each node according to times called/total time
+ */
+ @Override
+ protected void postLayoutAlgorithm(InternalNode[] entitiesToLayout,
+ InternalRelationship[] relationshipsToConsider) {
+ final int minimumSize = 40;
+ double xcursor = 0.0;
+ double ycursor = 0.0;
- for (InternalNode sn : entitiesToLayout) {
- Long time = list.remove(0);
- double percent = (double) time / (double) totalTime;
- double snWidth = (sn.getInternalWidth() * percent) + minimumSize;
- double snHeight = (sn.getInternalHeight() * percent) + minimumSize;
+ for (InternalNode sn : entitiesToLayout) {
+ Long time = list.remove(0);
+ double percent = (double) time / (double) totalTime;
+ double snWidth = (sn.getInternalWidth() * percent) + minimumSize;
+ double snHeight = (sn.getInternalHeight() * percent) + minimumSize;
- sn.setSize(snWidth, snHeight);
- if (xcursor + snWidth > graphWidth) {
- //reaching the end of row, move to lower column
- ycursor += snHeight;
- xcursor = 0;
- sn.setLocation(xcursor, ycursor);
- } else {
- sn.setLocation(xcursor, ycursor);
- xcursor += snWidth;
- }
- }
- }
+ sn.setSize(snWidth, snHeight);
+ if (xcursor + snWidth > graphWidth) {
+ //reaching the end of row, move to lower column
+ ycursor += snHeight;
+ xcursor = 0;
+ sn.setLocation(xcursor, ycursor);
+ } else {
+ sn.setLocation(xcursor, ycursor);
+ xcursor += snWidth;
+ }
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallGraphConstants.java b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallGraphConstants.java
index 5fac488bfc..3abf265d41 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallGraphConstants.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallGraphConstants.java
@@ -13,7 +13,7 @@ package org.eclipse.linuxtools.internal.callgraph;
public interface CallGraphConstants {
- String VIEW_ID = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
- String PLUGIN_ID = "org.eclipse.linuxtools.callgraph"; //$NON-NLS-1$
+ String VIEW_ID = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
+ String PLUGIN_ID = "org.eclipse.linuxtools.callgraph"; //$NON-NLS-1$
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallgraphView.java b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallgraphView.java
index b8df8287e0..f7506eb8ba 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallgraphView.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/CallgraphView.java
@@ -54,985 +54,985 @@ import org.eclipse.swt.widgets.Spinner;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
- * The SystemTap View for displaying output of the 'stap' command, and acts
- * as a container for any graph to be rendered. Any buttons/controls/actions
- * necessary to the smooth running of SystemTap could be placed here.
+ * The SystemTap View for displaying output of the 'stap' command, and acts
+ * as a container for any graph to be rendered. Any buttons/controls/actions
+ * necessary to the smooth running of SystemTap could be placed here.
*/
public class CallgraphView extends SystemTapView {
- private StapGraphParser parser;
-
- private Action viewTreeview;
- private Action viewRadialview;
- private Action viewAggregateview;
- private Action viewLevelview;
- private Action viewRefresh;
- private Action animationSlow;
- private Action animationFast;
- private Action modeCollapsedNodes;
- private Action markersNext;
- private Action markersPrevious;
- private Action limits;
- private Action gotoNext;
- private Action gotoPrevious;
- private Action gotoLast;
- private Action play;
- private Action saveDot;
- private Action saveColDot;
- private Action saveCurDot;
- private Action saveText;
- private ImageDescriptor playImage = getImageDescriptor("icons/perform.png"); //$NON-NLS-1$
- private ImageDescriptor pauseImage = getImageDescriptor("icons/pause.gif"); //$NON-NLS-1$
-
- private Composite graphComp;
- private Composite treeComp;
-
- private StapGraph g;
- private int treeSize = 200;
-
-
-
- /**
- * Initializes the view by creating composites (if necessary) and canvases
- * Calls loadData(), and calls finishLoad() if not in realTime mode (otherwise
- * it is up to the user-defined update methods to finish loading).
- *
- * @return status
- *
- */
- @Override
- public IStatus initializeView(Display targetDisplay, IProgressMonitor monitor) {
-
- if (targetDisplay == null && Display.getCurrent() == null) {
- Display.getDefault();
- }
-
- treeSize = 200;
- makeTreeComp(treeSize);
- makeGraphComp();
- graphComp.setBackgroundMode(SWT.INHERIT_FORCE);
-
- //Create papa canvas
- Canvas papaCanvas = new Canvas(graphComp, SWT.BORDER);
- GridLayout papaLayout = new GridLayout(1, true);
- papaLayout.horizontalSpacing=0;
- papaLayout.verticalSpacing=0;
- papaLayout.marginHeight=0;
- papaLayout.marginWidth=0;
- papaCanvas.setLayout(papaLayout);
- GridData papaGD = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
- papaGD.widthHint=160;
- papaCanvas.setLayoutData(papaGD);
-
- //Add first button
- Image image = getImageDescriptor("icons/up.gif").createImage(); //$NON-NLS-1$
- Button up = new Button(papaCanvas, SWT.PUSH);
- GridData buttonData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
- buttonData.widthHint = 150;
- buttonData.heightHint = 20;
- up.setData(buttonData);
- up.setImage(image);
- up.setToolTipText(Messages.getString("CallgraphView.ThumbNailUp")); //$NON-NLS-1$
-
- //Add thumb canvas
- Canvas thumbCanvas = new Canvas(papaCanvas, SWT.NONE);
-
- //Add second button
- image = getImageDescriptor("icons/down.gif").createImage(); //$NON-NLS-1$
- Button down = new Button(papaCanvas, SWT.PUSH);
- buttonData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
- buttonData.widthHint = 150;
- buttonData.heightHint = 0;
- down.setData(buttonData);
- down.setImage(image);
- down.setToolTipText(Messages.getString("CallgraphView.ThumbNailDown")); //$NON-NLS-1$
-
- //Initialize graph
- g = new StapGraph(graphComp, SWT.BORDER, treeComp, papaCanvas, this);
- g.setLayoutData(new GridData(masterComposite.getBounds().width,Display.getCurrent().getBounds().height - treeSize));
-
- up.addSelectionListener(new AutoScrollSelectionListener(
- AutoScrollSelectionListener.AUTO_SCROLL_UP, g));
- down.addSelectionListener(new AutoScrollSelectionListener(
- AutoScrollSelectionListener.AUTO_SCROLL_DOWN, g));
-
- //Initialize thumbnail
- GridData thumbGD = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
- thumbGD.widthHint=160;
- thumbCanvas.setLayoutData(thumbGD);
- LightweightSystem lws = new LightweightSystem(thumbCanvas);
- ScrollableThumbnail thumb = new ScrollableThumbnail(g.getViewport());
- thumb.setSource(g.getContents());
- lws.setContents(thumb);
-
- loadData(monitor);
- return finishLoad(monitor);
- }
-
- /**
- * Load data.
- * @param mon -- Progress monitor.
- * @return
- */
- private IStatus loadData(IProgressMonitor mon) {
- IProgressMonitor monitor = mon;
- //Dummy node, set start time
- if (g.getNodeData(0) == null) {
- g.loadData(SWT.NONE, 0, StapGraph.CONSTANT_TOP_NODE_NAME,
- 1, 1, -1, false, ""); //$NON-NLS-1$
- }
- g.setStartTime(parser.startTime);
- g.setEndTime(parser.endingTimeInNS);
-
-
- /*
- * Load graph data
- */
- for (int id_parent : parser.serialMap.keySet()) {
- if (id_parent < 0) {
- continue;
- }
- boolean marked = false;
- String msg = ""; //$NON-NLS-1$
- if (g.getNodeData(id_parent) == null) {
- if (parser.markedMap.get(id_parent) != null) {
- marked = true;
- msg = parser.markedMap.remove(id_parent);
- }
- g.loadData(SWT.NONE, id_parent, parser.serialMap.get(id_parent), parser.timeMap.get(id_parent),
- 1, 0, marked, msg);
- }
-
- for (int key :parser.neighbourMaps.keySet()) {
- HashMap<Integer, ArrayList<Integer>> outNeighbours = parser.neighbourMaps.get(key);
- if (outNeighbours == null || outNeighbours.get(id_parent) == null) {
- continue;
- }
- for (int id_child : outNeighbours.get(id_parent)) {
- if (g.getNodeData(id_child) != null && id_child < 0) {
- //Assume this is an additional call of the same node
- //Should only happen in dot-files!!
- g.addCalled(id_child);
- continue;
- } else if (g.getNodeData(id_child) != null) {
- continue;
- }
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
-
- marked = false;
- msg = ""; //$NON-NLS-1$
- if (parser.markedMap.get(id_child) != null) {
- marked = true;
- msg = parser.markedMap.remove(id_child);
- }
- if (id_child != -1) {
- if (parser.timeMap.get(id_child) == null){
- g.loadData(SWT.NONE, id_child, parser.serialMap
- .get(id_child), parser.timeMap.get(0),
- 1, id_parent, marked,msg);
- }else{
- g.loadData(SWT.NONE, id_child, parser.serialMap
- .get(id_child), parser.timeMap.get(id_child),
- 1, id_parent, marked,msg);
- }
- }
- }
- }
-
- if (parser.neighbourMaps.size() > 1) {
- g.setThreaded();
- }
- }
-
- monitor.worked(1);
- if (parser.markedMap.size() > 0) {
- //Still some markers left
- for (int key : parser.markedMap.keySet()) {
- g.insertMessage(key, parser.markedMap.get(key));
- }
-
- //Erase the remaining nodes, just in case
- parser.markedMap.clear();
- }
-
-
- if (g.aggregateTime == null) {
- g.aggregateTime = new HashMap<>();
- }
- if (g.aggregateCount == null) {
- g.aggregateCount = new HashMap<>();
- }
-
- g.aggregateCount.putAll(parser.countMap);
- g.aggregateTime.putAll(parser.aggregateTimeMap);
- //TODO: Do not set to 0.
- g.setLastFunctionCalled(0);
-
-
- //Finish off by collapsing nodes, initializing the tree and setting options
- g.recursivelyCollapseAllChildrenOfNode(g.getTopNode());
- monitor.worked(1);
- setGraphOptions(true);
- g.initializeTree();
- g.setProject(parser.project);
-
-
- return Status.OK_STATUS;
- }
-
- /**
- * Completes the loading process by calculating aggregate data.
- *
- * @param monitor
- * @return
- */
- private IStatus finishLoad(IProgressMonitor monitor) {
-
- if (g.aggregateCount == null) {
- g.aggregateCount = new HashMap<>();
- }
-
- g.aggregateCount.putAll(parser.countMap);
-
- if (g.aggregateTime == null) {
- g.aggregateTime = new HashMap<>();
- }
- g.aggregateTime.putAll(parser.aggregateTimeMap);
-
- //Set total time
- if (parser.totalTime != -1) {
- g.setTotalTime(parser.totalTime);
- }
-
- //-------------Finish initializations
- //Generate data for collapsed nodes
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- g.initializeTree();
-
-
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- g.setCallOrderList(parser.callOrderList);
- g.setProject(parser.project);
-
-
- this.initializePartControl();
- return Status.OK_STATUS;
- }
-
-
- /**
- * Enable or Disable the graph options
- * @param visible
- */
- private void setGraphOptions (boolean visible){
- play.setEnabled(visible);
- saveFile.setEnabled(visible);
- saveDot.setEnabled(visible);
- saveColDot.setEnabled(visible);
- saveCurDot.setEnabled(visible);
- saveText.setEnabled(visible);
-
- viewTreeview.setEnabled(visible);
- viewRadialview.setEnabled(visible);
- viewAggregateview.setEnabled(visible);
- viewLevelview.setEnabled(visible);
- viewRefresh.setEnabled(visible);
- limits.setEnabled(visible);
-
- markersNext.setEnabled(visible);
- markersPrevious.setEnabled(visible);
-
- animationSlow.setEnabled(visible);
- animationFast.setEnabled(visible);
- modeCollapsedNodes.setEnabled(visible);
-
- gotoNext.setEnabled(visible);
- gotoPrevious.setEnabled(visible);
- gotoLast.setEnabled(visible);
- }
-
-
-
- private void makeTreeComp(int treeSize) {
- if (treeComp != null && !treeComp.isDisposed()) {
- treeComp.dispose();
- }
-
- treeComp = new Composite(this.masterComposite, SWT.NONE);
- GridData treegd = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
- treegd.widthHint = treeSize;
- treeComp.setLayout(new FillLayout());
- treeComp.setLayoutData(treegd);
- }
-
- private void makeGraphComp() {
- if (graphComp != null && !graphComp.isDisposed()) {
- graphComp.dispose();
- }
- graphComp = new Composite(this.masterComposite, SWT.NONE);
- GridData graphgd = new GridData(SWT.FILL, SWT.FILL, true, true);
- GridLayout gl = new GridLayout(2, false);
- gl.horizontalSpacing=0;
- gl.verticalSpacing=0;
-
- graphComp.setLayout(gl);
- graphComp.setLayoutData(graphgd);
- }
-
-
- /**
- * This must be executed before a Graph is displayed
- */
- private void initializePartControl(){
- setGraphOptions(true);
- if (graphComp == null) {
- return;
- }
- graphComp.setParent(masterComposite);
-
- if (treeComp != null) {
- treeComp.setParent(masterComposite);
- }
-
- graphComp.setSize(masterComposite.getSize().x ,masterComposite.getSize().y);
- }
-
- /**
- * The action performed by saveText.
- */
- private void saveTextAction() {
- //Prints an 80 char table
+ private StapGraphParser parser;
+
+ private Action viewTreeview;
+ private Action viewRadialview;
+ private Action viewAggregateview;
+ private Action viewLevelview;
+ private Action viewRefresh;
+ private Action animationSlow;
+ private Action animationFast;
+ private Action modeCollapsedNodes;
+ private Action markersNext;
+ private Action markersPrevious;
+ private Action limits;
+ private Action gotoNext;
+ private Action gotoPrevious;
+ private Action gotoLast;
+ private Action play;
+ private Action saveDot;
+ private Action saveColDot;
+ private Action saveCurDot;
+ private Action saveText;
+ private ImageDescriptor playImage = getImageDescriptor("icons/perform.png"); //$NON-NLS-1$
+ private ImageDescriptor pauseImage = getImageDescriptor("icons/pause.gif"); //$NON-NLS-1$
+
+ private Composite graphComp;
+ private Composite treeComp;
+
+ private StapGraph g;
+ private int treeSize = 200;
+
+
+
+ /**
+ * Initializes the view by creating composites (if necessary) and canvases
+ * Calls loadData(), and calls finishLoad() if not in realTime mode (otherwise
+ * it is up to the user-defined update methods to finish loading).
+ *
+ * @return status
+ *
+ */
+ @Override
+ public IStatus initializeView(Display targetDisplay, IProgressMonitor monitor) {
+
+ if (targetDisplay == null && Display.getCurrent() == null) {
+ Display.getDefault();
+ }
+
+ treeSize = 200;
+ makeTreeComp(treeSize);
+ makeGraphComp();
+ graphComp.setBackgroundMode(SWT.INHERIT_FORCE);
+
+ //Create papa canvas
+ Canvas papaCanvas = new Canvas(graphComp, SWT.BORDER);
+ GridLayout papaLayout = new GridLayout(1, true);
+ papaLayout.horizontalSpacing=0;
+ papaLayout.verticalSpacing=0;
+ papaLayout.marginHeight=0;
+ papaLayout.marginWidth=0;
+ papaCanvas.setLayout(papaLayout);
+ GridData papaGD = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
+ papaGD.widthHint=160;
+ papaCanvas.setLayoutData(papaGD);
+
+ //Add first button
+ Image image = getImageDescriptor("icons/up.gif").createImage(); //$NON-NLS-1$
+ Button up = new Button(papaCanvas, SWT.PUSH);
+ GridData buttonData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
+ buttonData.widthHint = 150;
+ buttonData.heightHint = 20;
+ up.setData(buttonData);
+ up.setImage(image);
+ up.setToolTipText(Messages.getString("CallgraphView.ThumbNailUp")); //$NON-NLS-1$
+
+ //Add thumb canvas
+ Canvas thumbCanvas = new Canvas(papaCanvas, SWT.NONE);
+
+ //Add second button
+ image = getImageDescriptor("icons/down.gif").createImage(); //$NON-NLS-1$
+ Button down = new Button(papaCanvas, SWT.PUSH);
+ buttonData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
+ buttonData.widthHint = 150;
+ buttonData.heightHint = 0;
+ down.setData(buttonData);
+ down.setImage(image);
+ down.setToolTipText(Messages.getString("CallgraphView.ThumbNailDown")); //$NON-NLS-1$
+
+ //Initialize graph
+ g = new StapGraph(graphComp, SWT.BORDER, treeComp, papaCanvas, this);
+ g.setLayoutData(new GridData(masterComposite.getBounds().width,Display.getCurrent().getBounds().height - treeSize));
+
+ up.addSelectionListener(new AutoScrollSelectionListener(
+ AutoScrollSelectionListener.AUTO_SCROLL_UP, g));
+ down.addSelectionListener(new AutoScrollSelectionListener(
+ AutoScrollSelectionListener.AUTO_SCROLL_DOWN, g));
+
+ //Initialize thumbnail
+ GridData thumbGD = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
+ thumbGD.widthHint=160;
+ thumbCanvas.setLayoutData(thumbGD);
+ LightweightSystem lws = new LightweightSystem(thumbCanvas);
+ ScrollableThumbnail thumb = new ScrollableThumbnail(g.getViewport());
+ thumb.setSource(g.getContents());
+ lws.setContents(thumb);
+
+ loadData(monitor);
+ return finishLoad(monitor);
+ }
+
+ /**
+ * Load data.
+ * @param mon -- Progress monitor.
+ * @return
+ */
+ private IStatus loadData(IProgressMonitor mon) {
+ IProgressMonitor monitor = mon;
+ //Dummy node, set start time
+ if (g.getNodeData(0) == null) {
+ g.loadData(SWT.NONE, 0, StapGraph.CONSTANT_TOP_NODE_NAME,
+ 1, 1, -1, false, ""); //$NON-NLS-1$
+ }
+ g.setStartTime(parser.startTime);
+ g.setEndTime(parser.endingTimeInNS);
+
+
+ /*
+ * Load graph data
+ */
+ for (int id_parent : parser.serialMap.keySet()) {
+ if (id_parent < 0) {
+ continue;
+ }
+ boolean marked = false;
+ String msg = ""; //$NON-NLS-1$
+ if (g.getNodeData(id_parent) == null) {
+ if (parser.markedMap.get(id_parent) != null) {
+ marked = true;
+ msg = parser.markedMap.remove(id_parent);
+ }
+ g.loadData(SWT.NONE, id_parent, parser.serialMap.get(id_parent), parser.timeMap.get(id_parent),
+ 1, 0, marked, msg);
+ }
+
+ for (int key :parser.neighbourMaps.keySet()) {
+ HashMap<Integer, ArrayList<Integer>> outNeighbours = parser.neighbourMaps.get(key);
+ if (outNeighbours == null || outNeighbours.get(id_parent) == null) {
+ continue;
+ }
+ for (int id_child : outNeighbours.get(id_parent)) {
+ if (g.getNodeData(id_child) != null && id_child < 0) {
+ //Assume this is an additional call of the same node
+ //Should only happen in dot-files!!
+ g.addCalled(id_child);
+ continue;
+ } else if (g.getNodeData(id_child) != null) {
+ continue;
+ }
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+
+ marked = false;
+ msg = ""; //$NON-NLS-1$
+ if (parser.markedMap.get(id_child) != null) {
+ marked = true;
+ msg = parser.markedMap.remove(id_child);
+ }
+ if (id_child != -1) {
+ if (parser.timeMap.get(id_child) == null){
+ g.loadData(SWT.NONE, id_child, parser.serialMap
+ .get(id_child), parser.timeMap.get(0),
+ 1, id_parent, marked,msg);
+ }else{
+ g.loadData(SWT.NONE, id_child, parser.serialMap
+ .get(id_child), parser.timeMap.get(id_child),
+ 1, id_parent, marked,msg);
+ }
+ }
+ }
+ }
+
+ if (parser.neighbourMaps.size() > 1) {
+ g.setThreaded();
+ }
+ }
+
+ monitor.worked(1);
+ if (parser.markedMap.size() > 0) {
+ //Still some markers left
+ for (int key : parser.markedMap.keySet()) {
+ g.insertMessage(key, parser.markedMap.get(key));
+ }
+
+ //Erase the remaining nodes, just in case
+ parser.markedMap.clear();
+ }
+
+
+ if (g.aggregateTime == null) {
+ g.aggregateTime = new HashMap<>();
+ }
+ if (g.aggregateCount == null) {
+ g.aggregateCount = new HashMap<>();
+ }
+
+ g.aggregateCount.putAll(parser.countMap);
+ g.aggregateTime.putAll(parser.aggregateTimeMap);
+ //TODO: Do not set to 0.
+ g.setLastFunctionCalled(0);
+
+
+ //Finish off by collapsing nodes, initializing the tree and setting options
+ g.recursivelyCollapseAllChildrenOfNode(g.getTopNode());
+ monitor.worked(1);
+ setGraphOptions(true);
+ g.initializeTree();
+ g.setProject(parser.project);
+
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Completes the loading process by calculating aggregate data.
+ *
+ * @param monitor
+ * @return
+ */
+ private IStatus finishLoad(IProgressMonitor monitor) {
+
+ if (g.aggregateCount == null) {
+ g.aggregateCount = new HashMap<>();
+ }
+
+ g.aggregateCount.putAll(parser.countMap);
+
+ if (g.aggregateTime == null) {
+ g.aggregateTime = new HashMap<>();
+ }
+ g.aggregateTime.putAll(parser.aggregateTimeMap);
+
+ //Set total time
+ if (parser.totalTime != -1) {
+ g.setTotalTime(parser.totalTime);
+ }
+
+ //-------------Finish initializations
+ //Generate data for collapsed nodes
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ g.initializeTree();
+
+
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ g.setCallOrderList(parser.callOrderList);
+ g.setProject(parser.project);
+
+
+ this.initializePartControl();
+ return Status.OK_STATUS;
+ }
+
+
+ /**
+ * Enable or Disable the graph options
+ * @param visible
+ */
+ private void setGraphOptions (boolean visible){
+ play.setEnabled(visible);
+ saveFile.setEnabled(visible);
+ saveDot.setEnabled(visible);
+ saveColDot.setEnabled(visible);
+ saveCurDot.setEnabled(visible);
+ saveText.setEnabled(visible);
+
+ viewTreeview.setEnabled(visible);
+ viewRadialview.setEnabled(visible);
+ viewAggregateview.setEnabled(visible);
+ viewLevelview.setEnabled(visible);
+ viewRefresh.setEnabled(visible);
+ limits.setEnabled(visible);
+
+ markersNext.setEnabled(visible);
+ markersPrevious.setEnabled(visible);
+
+ animationSlow.setEnabled(visible);
+ animationFast.setEnabled(visible);
+ modeCollapsedNodes.setEnabled(visible);
+
+ gotoNext.setEnabled(visible);
+ gotoPrevious.setEnabled(visible);
+ gotoLast.setEnabled(visible);
+ }
+
+
+
+ private void makeTreeComp(int treeSize) {
+ if (treeComp != null && !treeComp.isDisposed()) {
+ treeComp.dispose();
+ }
+
+ treeComp = new Composite(this.masterComposite, SWT.NONE);
+ GridData treegd = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
+ treegd.widthHint = treeSize;
+ treeComp.setLayout(new FillLayout());
+ treeComp.setLayoutData(treegd);
+ }
+
+ private void makeGraphComp() {
+ if (graphComp != null && !graphComp.isDisposed()) {
+ graphComp.dispose();
+ }
+ graphComp = new Composite(this.masterComposite, SWT.NONE);
+ GridData graphgd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ GridLayout gl = new GridLayout(2, false);
+ gl.horizontalSpacing=0;
+ gl.verticalSpacing=0;
+
+ graphComp.setLayout(gl);
+ graphComp.setLayoutData(graphgd);
+ }
+
+
+ /**
+ * This must be executed before a Graph is displayed
+ */
+ private void initializePartControl(){
+ setGraphOptions(true);
+ if (graphComp == null) {
+ return;
+ }
+ graphComp.setParent(masterComposite);
+
+ if (treeComp != null) {
+ treeComp.setParent(masterComposite);
+ }
+
+ graphComp.setSize(masterComposite.getSize().x ,masterComposite.getSize().y);
+ }
+
+ /**
+ * The action performed by saveText.
+ */
+ private void saveTextAction() {
+ //Prints an 80 char table
Shell sh = new Shell();
FileDialog dialog = new FileDialog(sh, SWT.SAVE);
String filePath = dialog.open();
if (filePath == null) {
- return;
+ return;
}
File f = new File(filePath);
f.delete();
try (BufferedWriter out = new BufferedWriter(new FileWriter(f))) {
- f.createNewFile();
- StringBuilder builder = new StringBuilder();
- builder.append(" Function | Called | Time\n"); //$NON-NLS-1$
-
- for (StapData k : g.nodeDataMap.values()) {
- if ( (!k.isCollapsed ) && !k.isOnlyChildWithThisName()) {
- continue;
- }
- if (k.isCollapsed) {
- StringBuilder name = new StringBuilder(k.name);
- name = fixString(name, 60);
- builder.append(" " + name + " | "); //$NON-NLS-1$ //$NON-NLS-2$
-
- StringBuilder called = new StringBuilder("" + k.timesCalled); //$NON-NLS-1$
- called = fixString(called, 6);
-
- StringBuilder time = new StringBuilder("" + //$NON-NLS-1$
- StapNode.numberFormat.format((float) k.getTime()/g.getTotalTime() * 100)
- + "%"); //$NON-NLS-1$
- time = fixString(time, 6);
-
- builder.append(called + " | " + time + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (builder.length() > 0) {
- out.append(builder.toString());
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * This is a callback that will allow us to create the viewer and
- * initialize it.
- */
- @Override
- public void createPartControl(Composite parent) {
- if (masterComposite != null) {
- masterComposite.dispose();
- }
- masterComposite = parent;
- GridLayout layout = new GridLayout(2, false);
- layout.horizontalSpacing=0;
- GridData gd = new GridData(100, 100);
-
- parent.setLayout(layout);
- parent.setLayoutData(gd);
-
- // LOAD ALL ACTIONS
- createActions();
-
- //MENU FOR SYSTEMTAP BUTTONS
- IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
-
-
- //MENU FOR SYSTEMTAP GRAPH OPTIONS
- IMenuManager menu = getViewSite().getActionBars().getMenuManager();
-
- // ADD OPTIONS TO THE GRAPH MENU
- addFileMenu();
-
- saveCurDot = new Action(Messages.getString("CallgraphView.SaveViewAsDot")) { //$NON-NLS-1$
- @Override
- public void run(){
- writeToDot(g.getCollapseMode(), g.nodeMap.keySet());
- }
-
- };
- saveDot = new Action(Messages.getString("CallgraphView.SaveAllUncollapsedAsDot")) { //$NON-NLS-1$
+ f.createNewFile();
+ StringBuilder builder = new StringBuilder();
+ builder.append(" Function | Called | Time\n"); //$NON-NLS-1$
+
+ for (StapData k : g.nodeDataMap.values()) {
+ if ( (!k.isCollapsed ) && !k.isOnlyChildWithThisName()) {
+ continue;
+ }
+ if (k.isCollapsed) {
+ StringBuilder name = new StringBuilder(k.name);
+ name = fixString(name, 60);
+ builder.append(" " + name + " | "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ StringBuilder called = new StringBuilder("" + k.timesCalled); //$NON-NLS-1$
+ called = fixString(called, 6);
+
+ StringBuilder time = new StringBuilder("" + //$NON-NLS-1$
+ StapNode.numberFormat.format((float) k.getTime()/g.getTotalTime() * 100)
+ + "%"); //$NON-NLS-1$
+ time = fixString(time, 6);
+
+ builder.append(called + " | " + time + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (builder.length() > 0) {
+ out.append(builder.toString());
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This is a callback that will allow us to create the viewer and
+ * initialize it.
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ if (masterComposite != null) {
+ masterComposite.dispose();
+ }
+ masterComposite = parent;
+ GridLayout layout = new GridLayout(2, false);
+ layout.horizontalSpacing=0;
+ GridData gd = new GridData(100, 100);
+
+ parent.setLayout(layout);
+ parent.setLayoutData(gd);
+
+ // LOAD ALL ACTIONS
+ createActions();
+
+ //MENU FOR SYSTEMTAP BUTTONS
+ IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
+
+
+ //MENU FOR SYSTEMTAP GRAPH OPTIONS
+ IMenuManager menu = getViewSite().getActionBars().getMenuManager();
+
+ // ADD OPTIONS TO THE GRAPH MENU
+ addFileMenu();
+
+ saveCurDot = new Action(Messages.getString("CallgraphView.SaveViewAsDot")) { //$NON-NLS-1$
@Override
- public void run(){
+ public void run(){
+ writeToDot(g.getCollapseMode(), g.nodeMap.keySet());
+ }
+
+ };
+ saveDot = new Action(Messages.getString("CallgraphView.SaveAllUncollapsedAsDot")) { //$NON-NLS-1$
+ @Override
+ public void run(){
writeToDot(false, g.nodeDataMap.keySet());
}
- };
-
- saveColDot = new Action (Messages.getString("CallgraphView.SaveAllCollapsedAsDot")) { //$NON-NLS-1$
- @Override
- public void run(){
- writeToDot(true, g.nodeDataMap.keySet());
- }
-
- };
-
- saveText = new Action (Messages.getString("CallgraphView.SaveCollapsedAsASCII")) { //$NON-NLS-1$
- @Override
- public void run() {
- saveTextAction();
- }
- };
- IMenuManager saveMenu = new MenuManager(Messages.getString("CallgraphView.SaveMenu")); //$NON-NLS-1$
- file.add(saveMenu);
- saveMenu.add(saveCurDot);
- saveMenu.add(saveColDot);
- saveMenu.add(saveText);
- saveMenu.add(saveDot);
- IMenuManager view = new MenuManager(Messages.getString("CallgraphView.ViewMenu")); //$NON-NLS-1$
- IMenuManager animation = new MenuManager(Messages.getString("CallgraphView.AnimationMenu")); //$NON-NLS-1$
- IMenuManager markers = new MenuManager(Messages.getString("CallgraphView.Markers")); //$NON-NLS-1$
- IMenuManager gotoMenu = new MenuManager(Messages.getString("CallgraphView.GoTo")); //$NON-NLS-1$
- menu.add(view);
- menu.add(gotoMenu);
- addHelpMenu();
-
- view.add(viewTreeview);
- view.add(viewRadialview);
- view.add(viewAggregateview);
- view.add(viewLevelview);
- view.add(getViewRefresh());
- view.add(modeCollapsedNodes);
- view.add(limits);
- view.add(animation);
-
-
- gotoMenu.add(play);
- gotoMenu.add(gotoPrevious);
- gotoMenu.add(gotoNext);
- gotoMenu.add(gotoLast);
- gotoMenu.add(markers);
-
- addKillButton();
- mgr.add(play);
- mgr.add(viewRadialview);
- mgr.add(viewTreeview);
- mgr.add(viewLevelview);
- mgr.add(viewAggregateview);
- mgr.add(modeCollapsedNodes);
-
- markers.add(markersNext);
- markers.add(markersPrevious);
-
- animation.add(animationSlow);
- animation.add(animationFast);
-
- setGraphOptions(false);
- }
-
-
- private static StringBuilder fixString(StringBuilder name, int length) {
- if (name.length() > length) {
- name = new StringBuilder(name.substring(0, length - 1));
- } else {
- int diff = length - name.length();
- boolean left = true;
- while (diff > 0) {
- if (left) {
- name.insert(0, " "); //$NON-NLS-1$
- left = false;
- } else {
- name.append(" "); //$NON-NLS-1$
- left = true;
- }
- diff--;
- }
- }
- return name;
- }
-
-
- private void createViewActions() {
- viewTreeview = new Action(Messages.getString("CallgraphView.TreeView")){ //$NON-NLS-1$
- @Override
- public void run() {
- g.draw(StapGraph.CONSTANT_DRAWMODE_TREE,
- g.getAnimationMode(), g.getRootVisibleNodeNumber());
- g.scrollTo(g.getNode(g.getRootVisibleNodeNumber())
- .getLocation().x - g.getBounds().width / 2, g
- .getNode(g.getRootVisibleNodeNumber())
- .getLocation().y);
- if (play != null) {
- play.setEnabled(true);
- }
- }
- };
- ImageDescriptor treeImage = getImageDescriptor("icons/tree_view.gif"); //$NON-NLS-1$
- viewTreeview.setImageDescriptor(treeImage);
-
-
- //Set drawmode to radial view
- viewRadialview = new Action(Messages.getString("CallgraphView.RadialView")){ //$NON-NLS-1$
- @Override
- public void run(){
- g.draw(StapGraph.CONSTANT_DRAWMODE_RADIAL,
- g.getAnimationMode(), g.getRootVisibleNodeNumber());
- if (play != null) {
- play.setEnabled(true);
- }
- }
- };
- ImageDescriptor d = getImageDescriptor("/icons/radial_view.gif"); //$NON-NLS-1$
- viewRadialview.setImageDescriptor(d);
-
- //Set drawmode to aggregate view
- viewAggregateview = new Action(Messages.getString("CallgraphView.AggregateView")){ //$NON-NLS-1$
- @Override
- public void run(){
- g.draw(StapGraph.CONSTANT_DRAWMODE_AGGREGATE,
- g.getAnimationMode(), g.getRootVisibleNodeNumber());
- if (play != null) {
- play.setEnabled(false);
- }
- }
- };
- ImageDescriptor aggregateImage = getImageDescriptor("/icons/view_aggregateview.gif"); //$NON-NLS-1$
- viewAggregateview.setImageDescriptor(aggregateImage);
-
-
- //Set drawmode to level view
- viewLevelview = new Action(Messages.getString("CallgraphView.LevelView")){ //$NON-NLS-1$
- @Override
- public void run(){
- g.draw(StapGraph.CONSTANT_DRAWMODE_LEVEL,
- g.getAnimationMode(), g.getRootVisibleNodeNumber());
- if (play != null) {
- play.setEnabled(true);
- }
- }
- };
- ImageDescriptor levelImage = getImageDescriptor("/icons/showchild_mode.gif"); //$NON-NLS-1$
- viewLevelview.setImageDescriptor(levelImage);
-
-
- this.viewRefresh = new Action(Messages.getString("CallgraphView.Reset")){ //$NON-NLS-1$
- @Override
- public void run(){
- g.reset();
- }
- };
- ImageDescriptor refreshImage = getImageDescriptor("/icons/nav_refresh.gif"); //$NON-NLS-1$
- getViewRefresh().setImageDescriptor(refreshImage);
-
- }
-
- /**
- * Populates Animate menu.
- */
- private void createAnimateActions() {
- //Set animation mode to slow
- animationSlow = new Action(Messages.getString("CallgraphView.AnimationSlow"), IAction.AS_RADIO_BUTTON){ //$NON-NLS-1$
- @Override
- public void run(){
- g.setAnimationMode(StapGraph.CONSTANT_ANIMATION_SLOW);
- this.setChecked(true);
- animationSlow.setChecked(true);
- animationFast.setChecked(false);
- }
- };
-
- animationSlow.setChecked(true);
-
- //Set animation mode to fast
- animationFast = new Action(Messages.getString("CallgraphView.AnimationFast"), IAction.AS_RADIO_BUTTON){ //$NON-NLS-1$
- @Override
- public void run(){
- g.setAnimationMode(StapGraph.CONSTANT_ANIMATION_FASTEST);
- animationSlow.setChecked(false);
- animationFast.setChecked(true);
- }
- };
-
- //Toggle collapse mode
- modeCollapsedNodes = new Action(Messages.getString("CallgraphView.CollapsedMode"), IAction.AS_CHECK_BOX){ //$NON-NLS-1$
- @Override
- public void run(){
-
- if (g.isCollapseMode()) {
- g.setCollapseMode(false);
- g.draw(g.getRootVisibleNodeNumber());
- } else {
- g.setCollapseMode(true);
- g.draw(g.getRootVisibleNodeNumber());
- }
- }
- };
-
- ImageDescriptor newImage = getImageDescriptor("icons/mode_collapsednodes.gif"); //$NON-NLS-1$
- modeCollapsedNodes.setImageDescriptor(newImage);
-
- limits = new Action(Messages.getString("CallgraphView.SetLimits"), IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$
- private Spinner limit;
- private Spinner buffer;
- private Shell sh;
- @Override
- public void run() {
- sh = new Shell();
- sh.setLayout(new GridLayout());
- sh.setSize(150, 200);
- Label limitLabel = new Label(sh, SWT.NONE);
- limitLabel.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
- limitLabel.setText(Messages.getString("CallgraphView.MaxNodes")); //$NON-NLS-1$
- limit = new Spinner(sh, SWT.BORDER);
- limit.setMaximum(5000);
- limit.setSelection(g.getMaxNodes());
- limit.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
-
- Label bufferLabel = new Label(sh, SWT.NONE);
- bufferLabel.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
- bufferLabel.setText(Messages.getString("CallgraphView.MaxDepth")); //$NON-NLS-1$
- buffer = new Spinner(sh, SWT.BORDER);
- buffer.setMaximum(5000);
- buffer.setSelection(g.getLevelBuffer());
- buffer.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
-
- Button setLimit = new Button(sh, SWT.PUSH);
- setLimit.setText(Messages.getString("CallgraphView.SetValues")); //$NON-NLS-1$
- setLimit.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
- setLimit.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean redraw = false;
- if (limit.getSelection() >= 0 && buffer.getSelection() >= 0) {
- g.setMaxNodes(limit.getSelection());
- g.setLevelBuffer(buffer.getSelection());
-
- if (g.changeLevelLimits(g.getLevelOfNode(g.getRootVisibleNodeNumber()))) {
- SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
- Messages.getString("CallgraphView.BufferTooHigh"), Messages.getString("CallgraphView.BufferTooHigh"), //$NON-NLS-1$ //$NON-NLS-2$
- Messages.getString("CallgraphView.BufferMessage1") + //$NON-NLS-1$
- Messages.getString("CallgraphView.BufferMessage2") + //$NON-NLS-1$
- Messages.getString("CallgraphView.BufferMessage3") + //$NON-NLS-1$
- Messages.getString("CallgraphView.BufferMessage4") + g.getLevelBuffer() + //$NON-NLS-1$
- Messages.getString("CallgraphView.BufferMessage5") + PluginConstants.NEW_LINE + PluginConstants.NEW_LINE + //$NON-NLS-1$
- Messages.getString("CallgraphView.BufferMessage6") + //$NON-NLS-1$
- Messages.getString("CallgraphView.BufferMessage7")); //$NON-NLS-1$
- mess.schedule();
- }
-
- redraw = true;
- }
- sh.dispose();
-
- if (redraw) {
- g.draw();
- }
- }
-
- });
-
-
- sh.open(); }
- };
-
- }
+ };
+
+ saveColDot = new Action (Messages.getString("CallgraphView.SaveAllCollapsedAsDot")) { //$NON-NLS-1$
+ @Override
+ public void run(){
+ writeToDot(true, g.nodeDataMap.keySet());
+ }
+
+ };
+
+ saveText = new Action (Messages.getString("CallgraphView.SaveCollapsedAsASCII")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ saveTextAction();
+ }
+ };
+ IMenuManager saveMenu = new MenuManager(Messages.getString("CallgraphView.SaveMenu")); //$NON-NLS-1$
+ file.add(saveMenu);
+ saveMenu.add(saveCurDot);
+ saveMenu.add(saveColDot);
+ saveMenu.add(saveText);
+ saveMenu.add(saveDot);
+ IMenuManager view = new MenuManager(Messages.getString("CallgraphView.ViewMenu")); //$NON-NLS-1$
+ IMenuManager animation = new MenuManager(Messages.getString("CallgraphView.AnimationMenu")); //$NON-NLS-1$
+ IMenuManager markers = new MenuManager(Messages.getString("CallgraphView.Markers")); //$NON-NLS-1$
+ IMenuManager gotoMenu = new MenuManager(Messages.getString("CallgraphView.GoTo")); //$NON-NLS-1$
+ menu.add(view);
+ menu.add(gotoMenu);
+ addHelpMenu();
+
+ view.add(viewTreeview);
+ view.add(viewRadialview);
+ view.add(viewAggregateview);
+ view.add(viewLevelview);
+ view.add(getViewRefresh());
+ view.add(modeCollapsedNodes);
+ view.add(limits);
+ view.add(animation);
+
+
+ gotoMenu.add(play);
+ gotoMenu.add(gotoPrevious);
+ gotoMenu.add(gotoNext);
+ gotoMenu.add(gotoLast);
+ gotoMenu.add(markers);
+
+ addKillButton();
+ mgr.add(play);
+ mgr.add(viewRadialview);
+ mgr.add(viewTreeview);
+ mgr.add(viewLevelview);
+ mgr.add(viewAggregateview);
+ mgr.add(modeCollapsedNodes);
+
+ markers.add(markersNext);
+ markers.add(markersPrevious);
+
+ animation.add(animationSlow);
+ animation.add(animationFast);
+
+ setGraphOptions(false);
+ }
+
+
+ private static StringBuilder fixString(StringBuilder name, int length) {
+ if (name.length() > length) {
+ name = new StringBuilder(name.substring(0, length - 1));
+ } else {
+ int diff = length - name.length();
+ boolean left = true;
+ while (diff > 0) {
+ if (left) {
+ name.insert(0, " "); //$NON-NLS-1$
+ left = false;
+ } else {
+ name.append(" "); //$NON-NLS-1$
+ left = true;
+ }
+ diff--;
+ }
+ }
+ return name;
+ }
+
+
+ private void createViewActions() {
+ viewTreeview = new Action(Messages.getString("CallgraphView.TreeView")){ //$NON-NLS-1$
+ @Override
+ public void run() {
+ g.draw(StapGraph.CONSTANT_DRAWMODE_TREE,
+ g.getAnimationMode(), g.getRootVisibleNodeNumber());
+ g.scrollTo(g.getNode(g.getRootVisibleNodeNumber())
+ .getLocation().x - g.getBounds().width / 2, g
+ .getNode(g.getRootVisibleNodeNumber())
+ .getLocation().y);
+ if (play != null) {
+ play.setEnabled(true);
+ }
+ }
+ };
+ ImageDescriptor treeImage = getImageDescriptor("icons/tree_view.gif"); //$NON-NLS-1$
+ viewTreeview.setImageDescriptor(treeImage);
+
+
+ //Set drawmode to radial view
+ viewRadialview = new Action(Messages.getString("CallgraphView.RadialView")){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ g.draw(StapGraph.CONSTANT_DRAWMODE_RADIAL,
+ g.getAnimationMode(), g.getRootVisibleNodeNumber());
+ if (play != null) {
+ play.setEnabled(true);
+ }
+ }
+ };
+ ImageDescriptor d = getImageDescriptor("/icons/radial_view.gif"); //$NON-NLS-1$
+ viewRadialview.setImageDescriptor(d);
+
+ //Set drawmode to aggregate view
+ viewAggregateview = new Action(Messages.getString("CallgraphView.AggregateView")){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ g.draw(StapGraph.CONSTANT_DRAWMODE_AGGREGATE,
+ g.getAnimationMode(), g.getRootVisibleNodeNumber());
+ if (play != null) {
+ play.setEnabled(false);
+ }
+ }
+ };
+ ImageDescriptor aggregateImage = getImageDescriptor("/icons/view_aggregateview.gif"); //$NON-NLS-1$
+ viewAggregateview.setImageDescriptor(aggregateImage);
+
+
+ //Set drawmode to level view
+ viewLevelview = new Action(Messages.getString("CallgraphView.LevelView")){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ g.draw(StapGraph.CONSTANT_DRAWMODE_LEVEL,
+ g.getAnimationMode(), g.getRootVisibleNodeNumber());
+ if (play != null) {
+ play.setEnabled(true);
+ }
+ }
+ };
+ ImageDescriptor levelImage = getImageDescriptor("/icons/showchild_mode.gif"); //$NON-NLS-1$
+ viewLevelview.setImageDescriptor(levelImage);
+
+
+ this.viewRefresh = new Action(Messages.getString("CallgraphView.Reset")){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ g.reset();
+ }
+ };
+ ImageDescriptor refreshImage = getImageDescriptor("/icons/nav_refresh.gif"); //$NON-NLS-1$
+ getViewRefresh().setImageDescriptor(refreshImage);
+
+ }
+
+ /**
+ * Populates Animate menu.
+ */
+ private void createAnimateActions() {
+ //Set animation mode to slow
+ animationSlow = new Action(Messages.getString("CallgraphView.AnimationSlow"), IAction.AS_RADIO_BUTTON){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ g.setAnimationMode(StapGraph.CONSTANT_ANIMATION_SLOW);
+ this.setChecked(true);
+ animationSlow.setChecked(true);
+ animationFast.setChecked(false);
+ }
+ };
+
+ animationSlow.setChecked(true);
+
+ //Set animation mode to fast
+ animationFast = new Action(Messages.getString("CallgraphView.AnimationFast"), IAction.AS_RADIO_BUTTON){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ g.setAnimationMode(StapGraph.CONSTANT_ANIMATION_FASTEST);
+ animationSlow.setChecked(false);
+ animationFast.setChecked(true);
+ }
+ };
+
+ //Toggle collapse mode
+ modeCollapsedNodes = new Action(Messages.getString("CallgraphView.CollapsedMode"), IAction.AS_CHECK_BOX){ //$NON-NLS-1$
+ @Override
+ public void run(){
+
+ if (g.isCollapseMode()) {
+ g.setCollapseMode(false);
+ g.draw(g.getRootVisibleNodeNumber());
+ } else {
+ g.setCollapseMode(true);
+ g.draw(g.getRootVisibleNodeNumber());
+ }
+ }
+ };
+
+ ImageDescriptor newImage = getImageDescriptor("icons/mode_collapsednodes.gif"); //$NON-NLS-1$
+ modeCollapsedNodes.setImageDescriptor(newImage);
+
+ limits = new Action(Messages.getString("CallgraphView.SetLimits"), IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$
+ private Spinner limit;
+ private Spinner buffer;
+ private Shell sh;
+ @Override
+ public void run() {
+ sh = new Shell();
+ sh.setLayout(new GridLayout());
+ sh.setSize(150, 200);
+ Label limitLabel = new Label(sh, SWT.NONE);
+ limitLabel.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
+ limitLabel.setText(Messages.getString("CallgraphView.MaxNodes")); //$NON-NLS-1$
+ limit = new Spinner(sh, SWT.BORDER);
+ limit.setMaximum(5000);
+ limit.setSelection(g.getMaxNodes());
+ limit.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
+
+ Label bufferLabel = new Label(sh, SWT.NONE);
+ bufferLabel.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
+ bufferLabel.setText(Messages.getString("CallgraphView.MaxDepth")); //$NON-NLS-1$
+ buffer = new Spinner(sh, SWT.BORDER);
+ buffer.setMaximum(5000);
+ buffer.setSelection(g.getLevelBuffer());
+ buffer.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
+
+ Button setLimit = new Button(sh, SWT.PUSH);
+ setLimit.setText(Messages.getString("CallgraphView.SetValues")); //$NON-NLS-1$
+ setLimit.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, false));
+ setLimit.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean redraw = false;
+ if (limit.getSelection() >= 0 && buffer.getSelection() >= 0) {
+ g.setMaxNodes(limit.getSelection());
+ g.setLevelBuffer(buffer.getSelection());
+
+ if (g.changeLevelLimits(g.getLevelOfNode(g.getRootVisibleNodeNumber()))) {
+ SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
+ Messages.getString("CallgraphView.BufferTooHigh"), Messages.getString("CallgraphView.BufferTooHigh"), //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.getString("CallgraphView.BufferMessage1") + //$NON-NLS-1$
+ Messages.getString("CallgraphView.BufferMessage2") + //$NON-NLS-1$
+ Messages.getString("CallgraphView.BufferMessage3") + //$NON-NLS-1$
+ Messages.getString("CallgraphView.BufferMessage4") + g.getLevelBuffer() + //$NON-NLS-1$
+ Messages.getString("CallgraphView.BufferMessage5") + PluginConstants.NEW_LINE + PluginConstants.NEW_LINE + //$NON-NLS-1$
+ Messages.getString("CallgraphView.BufferMessage6") + //$NON-NLS-1$
+ Messages.getString("CallgraphView.BufferMessage7")); //$NON-NLS-1$
+ mess.schedule();
+ }
+
+ redraw = true;
+ }
+ sh.dispose();
+
+ if (redraw) {
+ g.draw();
+ }
+ }
+
+ });
+
+
+ sh.open(); }
+ };
+
+ }
/**
* Convenience method for creating all the various actions
*/
- private void createActions() {
- createViewActions();
- createAnimateActions();
- createMarkerActions();
- createMovementActions();
-
- modeCollapsedNodes.setChecked(true);
-
- }
-
- private void createMovementActions() {
- gotoNext = new Action(Messages.getString("CallgraphView.Next")) { //$NON-NLS-1$
- @Override
- public void run() {
- g.drawNextNode();
- }
- };
-
- gotoPrevious = new Action(Messages.getString("CallgraphView.Previous")) { //$NON-NLS-1$
- @Override
- public void run() {
- if (g.isCollapseMode()) {
- g.setCollapseMode(false);
- }
- int toDraw = g.getPreviousCalledNode(g.getRootVisibleNodeNumber());
- if (toDraw != -1)
- g.draw(toDraw);
- }
- };
-
- gotoLast = new Action(Messages.getString("CallgraphView.Last")) { //$NON-NLS-1$
- @Override
- public void run() {
- if (g.isCollapseMode())
- g.setCollapseMode(false);
- g.draw(g.getLastFunctionCalled());
- }
- };
-
- play = new Action(Messages.getString("CallgraphView.Play")) { //$NON-NLS-1$
- @Override
- public void run() {
- if (g.getDrawMode() != StapGraph.CONSTANT_DRAWMODE_AGGREGATE) {
- g.play();
- togglePlayImage();
- }
- }
- };
- play.setImageDescriptor(playImage);
- }
-
- /**
- * Toggles the play/pause image
- * @param play
- */
- private void togglePlayImage() {
- if (play.getToolTipText() == Messages.getString("CallgraphView.Pause")) { //$NON-NLS-1$
- play.setImageDescriptor(playImage);
- play.setToolTipText(Messages.getString("CallgraphView.Play")); //$NON-NLS-1$
- }
- else {
- play.setImageDescriptor(pauseImage);
- play.setToolTipText(""); //$NON-NLS-1$
- }
- }
-
- private void createMarkerActions() {
- markersNext = new Action(Messages.getString("CallgraphView.nextMarker")) { //$NON-NLS-1$
- @Override
- public void run() {
- g.draw(g.getNextMarkedNode());
- }
- };
-
- markersPrevious = new Action(Messages.getString("CallgraphView.previousMarker")) { //$NON-NLS-1$
- @Override
- public void run() {
- g.draw(g.getPreviousMarkedNode());
- }
- };
- }
-
- @Override
- protected boolean createOpenAction() {
- //Opens from specified location
- openFile = new Action(Messages.getString("CallgraphView.Open")){ //$NON-NLS-1$
- @Override
- public void run(){
- FileDialog dialog = new FileDialog(new Shell(), SWT.DEFAULT);
- String filePath = dialog.open();
- if (filePath != null){
- StapGraphParser new_parser = new StapGraphParser();
- new_parser.setSourcePath(filePath);
- new_parser.setViewID(CallGraphConstants.VIEW_ID);
- new_parser.schedule();
- }
- }
- };
- return true;
- }
-
-
- @Override
- protected boolean createOpenDefaultAction() {
- //Opens from the default location
- openDefault = new Action(Messages.getString("CallgraphView.OpenLastRun")){ //$NON-NLS-1$
- @Override
- public void run(){
- StapGraphParser new_parser = new StapGraphParser();
- new_parser.setViewID(CallGraphConstants.VIEW_ID);
- new_parser.schedule();
- }
- };
-
- return true;
- }
-
- @Override
- public boolean setParser(SystemTapParser newParser) {
- if (newParser instanceof StapGraphParser) {
- parser = (StapGraphParser) newParser;
- return true;
- }
- return false;
-
- }
-
- @Override
- public void setViewID() {
- viewID = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
- }
-
- public Action getAnimationSlow() {
- return animationSlow;
- }
-
- public Action getAnimationFast() {
- return animationFast;
- }
-
- public Action getModeCollapsednodes() {
- return modeCollapsedNodes;
- }
-
- public Action getViewRefresh() {
- return viewRefresh;
- }
-
- public Action getGotoNext() {
- return gotoNext;
- }
-
- public Action getGotoPrevious() {
- return gotoPrevious;
- }
-
- public Action getGotoLast() {
- return gotoLast;
- }
-
- public Action getViewTreeview() {
- return viewTreeview;
- }
-
- public Action getViewRadialview() {
- return viewRadialview;
- }
-
- public Action getViewAggregateview() {
- return viewAggregateview;
- }
-
- public Action getViewLevelview() {
- return viewLevelview;
- }
-
- public Action getPlay() {
- return play;
- }
-
- public StapGraph getGraph() {
- return g;
- }
-
- @Override
- public void setFocus() {
- if(masterComposite != null){
- masterComposite.setFocus();
- }
- }
-
-
- @Override
- public void updateMethod() {
- IProgressMonitor m = new NullProgressMonitor();
- m.beginTask("Updating callgraph", 4); //$NON-NLS-1$
-
- loadData(m);
- m.worked(1);
- if (parser.totalTime > 0) {
- finishLoad(m);
- }
- m.worked(1);
-
- g.draw(StapGraph.CONSTANT_DRAWMODE_RADIAL, StapGraph.CONSTANT_ANIMATION_SLOW, g.getFirstUsefulNode());
- }
-
- @Override
- public SystemTapParser getParser() {
- return parser;
- }
-
- private void writeToDot(boolean mode, Set<Integer> keySet) {
+ private void createActions() {
+ createViewActions();
+ createAnimateActions();
+ createMarkerActions();
+ createMovementActions();
+
+ modeCollapsedNodes.setChecked(true);
+
+ }
+
+ private void createMovementActions() {
+ gotoNext = new Action(Messages.getString("CallgraphView.Next")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ g.drawNextNode();
+ }
+ };
+
+ gotoPrevious = new Action(Messages.getString("CallgraphView.Previous")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ if (g.isCollapseMode()) {
+ g.setCollapseMode(false);
+ }
+ int toDraw = g.getPreviousCalledNode(g.getRootVisibleNodeNumber());
+ if (toDraw != -1)
+ g.draw(toDraw);
+ }
+ };
+
+ gotoLast = new Action(Messages.getString("CallgraphView.Last")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ if (g.isCollapseMode())
+ g.setCollapseMode(false);
+ g.draw(g.getLastFunctionCalled());
+ }
+ };
+
+ play = new Action(Messages.getString("CallgraphView.Play")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ if (g.getDrawMode() != StapGraph.CONSTANT_DRAWMODE_AGGREGATE) {
+ g.play();
+ togglePlayImage();
+ }
+ }
+ };
+ play.setImageDescriptor(playImage);
+ }
+
+ /**
+ * Toggles the play/pause image
+ * @param play
+ */
+ private void togglePlayImage() {
+ if (play.getToolTipText() == Messages.getString("CallgraphView.Pause")) { //$NON-NLS-1$
+ play.setImageDescriptor(playImage);
+ play.setToolTipText(Messages.getString("CallgraphView.Play")); //$NON-NLS-1$
+ }
+ else {
+ play.setImageDescriptor(pauseImage);
+ play.setToolTipText(""); //$NON-NLS-1$
+ }
+ }
+
+ private void createMarkerActions() {
+ markersNext = new Action(Messages.getString("CallgraphView.nextMarker")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ g.draw(g.getNextMarkedNode());
+ }
+ };
+
+ markersPrevious = new Action(Messages.getString("CallgraphView.previousMarker")) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ g.draw(g.getPreviousMarkedNode());
+ }
+ };
+ }
+
+ @Override
+ protected boolean createOpenAction() {
+ //Opens from specified location
+ openFile = new Action(Messages.getString("CallgraphView.Open")){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ FileDialog dialog = new FileDialog(new Shell(), SWT.DEFAULT);
+ String filePath = dialog.open();
+ if (filePath != null){
+ StapGraphParser new_parser = new StapGraphParser();
+ new_parser.setSourcePath(filePath);
+ new_parser.setViewID(CallGraphConstants.VIEW_ID);
+ new_parser.schedule();
+ }
+ }
+ };
+ return true;
+ }
+
+
+ @Override
+ protected boolean createOpenDefaultAction() {
+ //Opens from the default location
+ openDefault = new Action(Messages.getString("CallgraphView.OpenLastRun")){ //$NON-NLS-1$
+ @Override
+ public void run(){
+ StapGraphParser new_parser = new StapGraphParser();
+ new_parser.setViewID(CallGraphConstants.VIEW_ID);
+ new_parser.schedule();
+ }
+ };
+
+ return true;
+ }
+
+ @Override
+ public boolean setParser(SystemTapParser newParser) {
+ if (newParser instanceof StapGraphParser) {
+ parser = (StapGraphParser) newParser;
+ return true;
+ }
+ return false;
+
+ }
+
+ @Override
+ public void setViewID() {
+ viewID = "org.eclipse.linuxtools.callgraph.callgraphview"; //$NON-NLS-1$
+ }
+
+ public Action getAnimationSlow() {
+ return animationSlow;
+ }
+
+ public Action getAnimationFast() {
+ return animationFast;
+ }
+
+ public Action getModeCollapsednodes() {
+ return modeCollapsedNodes;
+ }
+
+ public Action getViewRefresh() {
+ return viewRefresh;
+ }
+
+ public Action getGotoNext() {
+ return gotoNext;
+ }
+
+ public Action getGotoPrevious() {
+ return gotoPrevious;
+ }
+
+ public Action getGotoLast() {
+ return gotoLast;
+ }
+
+ public Action getViewTreeview() {
+ return viewTreeview;
+ }
+
+ public Action getViewRadialview() {
+ return viewRadialview;
+ }
+
+ public Action getViewAggregateview() {
+ return viewAggregateview;
+ }
+
+ public Action getViewLevelview() {
+ return viewLevelview;
+ }
+
+ public Action getPlay() {
+ return play;
+ }
+
+ public StapGraph getGraph() {
+ return g;
+ }
+
+ @Override
+ public void setFocus() {
+ if(masterComposite != null){
+ masterComposite.setFocus();
+ }
+ }
+
+
+ @Override
+ public void updateMethod() {
+ IProgressMonitor m = new NullProgressMonitor();
+ m.beginTask("Updating callgraph", 4); //$NON-NLS-1$
+
+ loadData(m);
+ m.worked(1);
+ if (parser.totalTime > 0) {
+ finishLoad(m);
+ }
+ m.worked(1);
+
+ g.draw(StapGraph.CONSTANT_DRAWMODE_RADIAL, StapGraph.CONSTANT_ANIMATION_SLOW, g.getFirstUsefulNode());
+ }
+
+ @Override
+ public SystemTapParser getParser() {
+ return parser;
+ }
+
+ private void writeToDot(boolean mode, Set<Integer> keySet) {
Shell sh = new Shell();
FileDialog dialog = new FileDialog(sh, SWT.SAVE);
String filePath = dialog.open();
if (filePath != null) {
- File f = new File(filePath);
+ File f = new File(filePath);
f.delete();
try {
- f.createNewFile();
- } catch (IOException e) {
- return;
- }
+ f.createNewFile();
+ } catch (IOException e) {
+ return;
+ }
try (BufferedWriter out = new BufferedWriter(new FileWriter(f))) {
- StringBuilder build = new StringBuilder(""); //$NON-NLS-1$
-
- out.write("digraph stapgraph {\n"); //$NON-NLS-1$
- for (int i : keySet) {
- if (i == 0) {
- continue;
- }
- StapData d = g.getNodeData(i);
- if ( (d.isCollapsed != mode) && !d.isOnlyChildWithThisName()) {
- continue;
- }
- build.append(i + " [label=\"" + d.name + " " ); //$NON-NLS-1$ //$NON-NLS-2$
- build.append(StapNode.numberFormat.format((float) d.getTime()/g.getTotalTime() * 100) + "%\"]\n"); //$NON-NLS-1$
- int j = d.parent;
- if (mode) {
- j = d.collapsedParent;
- }
-
- if (!keySet.contains(j) || j == 0) {
- continue;
- }
-
- String called = mode ? " [label=\"" + g.getNodeData(i).timesCalled + "\"]\n" : "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- build.append( j + "->" + i ); //$NON-NLS-1$
- build.append( called );
- out.write(build.toString());
- build.setLength(0);
- }
- out.write("}"); //$NON-NLS-1$
- out.flush();
+ StringBuilder build = new StringBuilder(""); //$NON-NLS-1$
+
+ out.write("digraph stapgraph {\n"); //$NON-NLS-1$
+ for (int i : keySet) {
+ if (i == 0) {
+ continue;
+ }
+ StapData d = g.getNodeData(i);
+ if ( (d.isCollapsed != mode) && !d.isOnlyChildWithThisName()) {
+ continue;
+ }
+ build.append(i + " [label=\"" + d.name + " " ); //$NON-NLS-1$ //$NON-NLS-2$
+ build.append(StapNode.numberFormat.format((float) d.getTime()/g.getTotalTime() * 100) + "%\"]\n"); //$NON-NLS-1$
+ int j = d.parent;
+ if (mode) {
+ j = d.collapsedParent;
+ }
+
+ if (!keySet.contains(j) || j == 0) {
+ continue;
+ }
+
+ String called = mode ? " [label=\"" + g.getNodeData(i).timesCalled + "\"]\n" : "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ build.append( j + "->" + i ); //$NON-NLS-1$
+ build.append( called );
+ out.write(build.toString());
+ build.setLength(0);
+ }
+ out.write("}"); //$NON-NLS-1$
+ out.flush();
} catch (IOException e) {
- e.printStackTrace();
- }
+ e.printStackTrace();
+ }
}
- }
+ }
- private static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(CallGraphConstants.PLUGIN_ID, path);
- }
+ private static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(CallGraphConstants.PLUGIN_ID, path);
+ }
} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/Messages.java b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/Messages.java
index fcb6dd5106..49d3929c63 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/Messages.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/Messages.java
@@ -4,7 +4,7 @@
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
@@ -14,19 +14,19 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.callgraph.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.callgraph.messages"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
- private Messages() {
- }
+ private Messages() {
+ }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapData.java b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapData.java
index f7fd655368..1156584555 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapData.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapData.java
@@ -18,34 +18,34 @@ import java.util.List;
*
*/
public class StapData {
- public static final int NOT_PART_OF_COLLAPSED_NODE = -10;
- public boolean hasCollapsedChildren, isCollapsed, marked;
- public boolean onlyChildWithThisName; //Should show up as collapsed and uncollapsed
+ public static final int NOT_PART_OF_COLLAPSED_NODE = -10;
+ public boolean hasCollapsedChildren, isCollapsed, marked;
+ public boolean onlyChildWithThisName; //Should show up as collapsed and uncollapsed
public int id;
public int timesCalled, parent, style;
public int levelOfRecursion;
public int collapsedParent, uncollapsedPiece, partOfCollapsedNode;
- private long time; //execution time of this node
- public String markedMessage; //alt text for this node
- public String name; //text to be displayed
+ private long time; //execution time of this node
+ public String markedMessage; //alt text for this node
+ public String name; //text to be displayed
public List<Integer> children, collapsedChildren;
- private StapGraph graph; //Store a reference to the parent graph
-
-
- /**
- * Initialize StapData object. This object is not intended to be called by users.
- *
- * @param graphModel StapGraph containing the StapNode that matches this StapData
- * @param style
- * @param txt Text to be displayed when rendering the StapNode
- * @param time Time taken for this particular node to execute
- * @param called Number of times this particular node was called
- * @param currentID The unique identifier for this node
- * @param caller The parent of this node
- * @param isMarked
- */
- public StapData(StapGraph graphModel, int style, String txt,
- long time, int called, int currentID, int parent, boolean isMarked) {
+ private StapGraph graph; //Store a reference to the parent graph
+
+
+ /**
+ * Initialize StapData object. This object is not intended to be called by users.
+ *
+ * @param graphModel StapGraph containing the StapNode that matches this StapData
+ * @param style
+ * @param txt Text to be displayed when rendering the StapNode
+ * @param time Time taken for this particular node to execute
+ * @param called Number of times this particular node was called
+ * @param currentID The unique identifier for this node
+ * @param caller The parent of this node
+ * @param isMarked
+ */