From a6a7ce50cad7a5bb5aac595736e7e1d7943612fd Mon Sep 17 00:00:00 2001 From: Elliott Baron Date: Thu, 30 Jul 2009 19:39:43 +0000 Subject: Created internal packages. --- .../.project | 6 + .../ChangeLog | 8 + .../META-INF/MANIFEST.MF | 13 +- .../cachegrind/tests/AbstractCachegrindTest.java | 52 -- .../valgrind/cachegrind/tests/AllTests.java | 32 -- .../cachegrind/tests/BasicCachegrindTest.java | 63 -- .../cachegrind/tests/CModelLabelsTest.java | 142 ----- .../cachegrind/tests/CachegrindTestsPlugin.java | 60 -- .../valgrind/cachegrind/tests/DoubleClickTest.java | 139 ----- .../cachegrind/tests/ExpandCollapseTest.java | 90 --- .../cachegrind/tests/LaunchConfigTabTest.java | 210 ------- .../cachegrind/tests/MultiProcessTest.java | 110 ---- .../test.xml | 2 +- .../.project | 6 + .../ChangeLog | 10 + .../META-INF/MANIFEST.MF | 10 +- .../plugin.xml | 6 +- .../cachegrind/CachegrindCommandConstants.java | 21 - .../cachegrind/CachegrindLabelProvider.java | 101 ---- .../cachegrind/CachegrindLaunchConstants.java | 44 -- .../cachegrind/CachegrindLaunchDelegate.java | 103 ---- .../valgrind/cachegrind/CachegrindParser.java | 138 ----- .../valgrind/cachegrind/CachegrindPlugin.java | 63 -- .../valgrind/cachegrind/CachegrindToolPage.java | 379 ------------ .../valgrind/cachegrind/CachegrindViewPart.java | 361 ------------ .../linuxtools/valgrind/cachegrind/Messages.java | 32 -- .../valgrind/cachegrind/messages.properties | 40 -- .../cachegrind/model/CachegrindDescription.java | 46 -- .../valgrind/cachegrind/model/CachegrindFile.java | 89 --- .../cachegrind/model/CachegrindFunction.java | 140 ----- .../valgrind/cachegrind/model/CachegrindLine.java | 55 -- .../cachegrind/model/CachegrindOutput.java | 99 ---- .../cachegrind/model/ICachegrindElement.java | 23 - .../valgrind/cachegrind/model/Messages.java | 32 -- .../valgrind/cachegrind/model/messages.properties | 1 - .../org.eclipse.linuxtools.valgrind.core/ChangeLog | 6 + .../META-INF/MANIFEST.MF | 5 +- .../core/LaunchConfigurationConstants.java | 7 +- .../valgrind/core/AbstractValgrindMessage.java | 55 -- .../valgrind/core/AbstractValgrindTextParser.java | 143 ----- .../valgrind/core/CommandLineConstants.java | 37 -- .../core/LaunchConfigurationConstants.java | 51 -- .../eclipse/linuxtools/valgrind/core/Messages.java | 32 -- .../linuxtools/valgrind/core/PluginConstants.java | 27 - .../linuxtools/valgrind/core/ValgrindCommand.java | 97 ---- .../valgrind/core/ValgrindCoreParser.java | 109 ---- .../linuxtools/valgrind/core/ValgrindError.java | 32 -- .../linuxtools/valgrind/core/ValgrindPlugin.java | 57 -- .../valgrind/core/ValgrindStackFrame.java | 37 -- .../linuxtools/valgrind/core/messages.properties | 1 - .../.project | 6 + .../ChangeLog | 9 + .../META-INF/MANIFEST.MF | 7 +- .../plugin.xml | 10 +- .../ValgrindLaunchConfigurationDelegate.java | 7 +- .../valgrind/launch/ValgrindOptionsTab.java | 84 ++- .../internal/valgrind/launch/messages.properties | 3 +- .../linuxtools/valgrind/launch/ExportHandler.java | 39 -- .../valgrind/launch/ExportWizardConstants.java | 19 - .../linuxtools/valgrind/launch/Messages.java | 32 -- .../valgrind/launch/ValgrindExportWizard.java | 112 ---- .../valgrind/launch/ValgrindExportWizardPage.java | 237 -------- .../ValgrindLaunchConfigurationDelegate.java | 333 ----------- .../ValgrindLaunchConfigurationTabGroup.java | 26 - .../valgrind/launch/ValgrindLaunchPlugin.java | 303 ---------- .../valgrind/launch/ValgrindLaunchShortcut.java | 39 -- .../valgrind/launch/ValgrindOptionsTab.java | 635 --------------------- .../launch/ValgrindOutputDirectoryProvider.java | 31 - .../linuxtools/valgrind/launch/messages.properties | 54 -- .../.project | 6 + .../ChangeLog | 8 + .../META-INF/MANIFEST.MF | 13 +- .../valgrind/massif/tests/AbstractMassifTest.java | 83 --- .../linuxtools/valgrind/massif/tests/AllTests.java | 36 -- .../valgrind/massif/tests/BasicMassifTest.java | 38 -- .../valgrind/massif/tests/ChartExportTest.java | 66 --- .../valgrind/massif/tests/ChartTests.java | 176 ------ .../valgrind/massif/tests/DoubleClickTest.java | 90 --- .../valgrind/massif/tests/ExpandCollapseTest.java | 88 --- .../valgrind/massif/tests/ExportWizardTest.java | 192 ------- .../valgrind/massif/tests/LaunchConfigTabTest.java | 351 ------------ .../valgrind/massif/tests/MassifTestsPlugin.java | 60 -- .../valgrind/massif/tests/MultiProcessTest.java | 137 ----- .../linuxtools/valgrind/massif/tests/SortTest.java | 118 ---- .../linuxtools/valgrind/massif/tests/TreeTest.java | 70 --- .../test.xml | 2 +- .../.project | 6 + .../ChangeLog | 10 + .../META-INF/MANIFEST.MF | 10 +- .../plugin.xml | 17 +- .../internal/valgrind/massif/MassifViewPart.java | 2 +- .../valgrind/massif/MassifCommandConstants.java | 27 - .../valgrind/massif/MassifHeapTreeNode.java | 141 ----- .../valgrind/massif/MassifLaunchConstants.java | 46 -- .../valgrind/massif/MassifLaunchDelegate.java | 107 ---- .../linuxtools/valgrind/massif/MassifOutput.java | 34 -- .../linuxtools/valgrind/massif/MassifParser.java | 273 --------- .../valgrind/massif/MassifPidMenuAction.java | 86 --- .../linuxtools/valgrind/massif/MassifPlugin.java | 118 ---- .../linuxtools/valgrind/massif/MassifSnapshot.java | 107 ---- .../linuxtools/valgrind/massif/MassifToolPage.java | 394 ------------- .../valgrind/massif/MassifTreeLabelProvider.java | 36 -- .../valgrind/massif/MassifTreeViewer.java | 105 ---- .../linuxtools/valgrind/massif/MassifViewPart.java | 491 ---------------- .../linuxtools/valgrind/massif/Messages.java | 32 -- .../valgrind/massif/birt/ChartControl.java | 246 -------- .../valgrind/massif/birt/ChartEditor.java | 86 --- .../valgrind/massif/birt/ChartEditorInput.java | 64 --- .../valgrind/massif/birt/ChartLocationsDialog.java | 80 --- .../linuxtools/valgrind/massif/birt/ChartSVG.java | 113 ---- .../linuxtools/valgrind/massif/birt/HeapChart.java | 404 ------------- .../linuxtools/valgrind/massif/birt/Messages.java | 32 -- .../valgrind/massif/birt/messages.properties | 21 - .../linuxtools/valgrind/massif/messages.properties | 38 -- .../.project | 6 + .../ChangeLog | 8 + .../META-INF/MANIFEST.MF | 10 +- .../valgrind/memcheck/tests/DoubleClickTest.java | 31 - .../memcheck/tests/LaunchConfigTabTest.java | 27 +- .../tests/AbstractLinkedResourceMemcheckTest.java | 64 --- .../memcheck/tests/AbstractMemcheckTest.java | 28 - .../valgrind/memcheck/tests/AllTests.java | 37 -- .../valgrind/memcheck/tests/BasicMemcheckTest.java | 40 -- .../valgrind/memcheck/tests/DoubleClickTest.java | 120 ---- .../memcheck/tests/ExpandCollapseTest.java | 88 --- .../memcheck/tests/LaunchConfigTabTest.java | 514 ----------------- .../tests/LinkedResourceDoubleClickTest.java | 112 ---- .../memcheck/tests/LinkedResourceMarkerTest.java | 83 --- .../valgrind/memcheck/tests/MarkerTest.java | 94 --- .../memcheck/tests/MemcheckTestsPlugin.java | 57 -- .../valgrind/memcheck/tests/MinVersionTest.java | 89 --- .../valgrind/memcheck/tests/MultiProcessTest.java | 54 -- .../valgrind/memcheck/tests/ShortcutTest.java | 85 --- .../valgrind/memcheck/tests/SignalTest.java | 41 -- .../test.xml | 2 +- .../.project | 6 + .../ChangeLog | 8 + .../META-INF/MANIFEST.MF | 7 +- .../plugin.xml | 6 +- .../memcheck/MemcheckCommandConstants.java | 26 - .../valgrind/memcheck/MemcheckLaunchConstants.java | 42 -- .../valgrind/memcheck/MemcheckLaunchDelegate.java | 53 -- .../valgrind/memcheck/MemcheckPlugin.java | 59 -- .../valgrind/memcheck/MemcheckToolPage.java | 310 ---------- .../valgrind/memcheck/MemcheckViewPart.java | 35 -- .../linuxtools/valgrind/memcheck/Messages.java | 32 -- .../valgrind/memcheck/messages.properties | 15 - .../ChangeLog | 4 + .../feature.xml | 14 +- .../ChangeLog | 7 + .../META-INF/MANIFEST.MF | 7 +- .../valgrind/tests/AbstractValgrindTest.java | 202 ------- .../valgrind/tests/ResourceChangePrinter.java | 71 --- .../valgrind/tests/ValgrindStubCommand.java | 44 -- .../valgrind/tests/ValgrindStubProcess.java | 76 --- .../valgrind/tests/ValgrindStubStreamsProxy.java | 31 - .../valgrind/tests/ValgrindTestLaunchDelegate.java | 65 --- .../valgrind/tests/ValgrindTestLaunchShortcut.java | 29 - .../valgrind/tests/ValgrindTestsPlugin.java | 78 --- .../org.eclipse.linuxtools.valgrind.tests/test.xml | 6 +- .../.project | 6 + .../ChangeLog | 8 + .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 2 +- .../editor/SuppressionsContentAssistProcessor.java | 50 +- .../valgrind/ui/editor/ColorManager.java | 42 -- .../ui/editor/ISuppressionsColorConstants.java | 23 - .../linuxtools/valgrind/ui/editor/Messages.java | 32 -- .../valgrind/ui/editor/SuppressionKindRule.java | 154 ----- .../valgrind/ui/editor/SuppressionToolRule.java | 115 ---- .../ui/editor/SuppressionsConfiguration.java | 84 --- .../editor/SuppressionsContentAssistProcessor.java | 128 ----- .../ui/editor/SuppressionsDocumentProvider.java | 38 -- .../valgrind/ui/editor/SuppressionsEditor.java | 80 --- .../ui/editor/SuppressionsElementScanner.java | 98 ---- .../ui/editor/SuppressionsPartitionScanner.java | 38 -- .../ui/editor/SuppressionsReconcilingStrategy.java | 89 --- .../valgrind/ui/editor/ValgrindEditorPlugin.java | 60 -- .../valgrind/ui/editor/messages.properties | 1 - .../org.eclipse.linuxtools.valgrind.ui/.project | 6 + .../org.eclipse.linuxtools.valgrind.ui/ChangeLog | 8 + .../META-INF/MANIFEST.MF | 6 +- .../org.eclipse.linuxtools.valgrind.ui/plugin.xml | 2 +- .../linuxtools/valgrind/ui/CollapseAction.java | 33 -- .../linuxtools/valgrind/ui/CoreMessagesViewer.java | 193 ------- .../linuxtools/valgrind/ui/ExpandAction.java | 33 -- .../eclipse/linuxtools/valgrind/ui/Messages.java | 32 -- .../linuxtools/valgrind/ui/ValgrindUIPlugin.java | 205 ------- .../linuxtools/valgrind/ui/ValgrindViewPart.java | 190 ------ .../linuxtools/valgrind/ui/messages.properties | 7 - 190 files changed, 299 insertions(+), 14358 deletions(-) delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AbstractCachegrindTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AllTests.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/BasicCachegrindTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CModelLabelsTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CachegrindTestsPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/DoubleClickTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/ExpandCollapseTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/LaunchConfigTabTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/MultiProcessTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindCommandConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLabelProvider.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchDelegate.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindParser.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindToolPage.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindViewPart.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindDescription.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFile.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFunction.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindLine.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindOutput.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/ICachegrindElement.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindMessage.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindTextParser.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/CommandLineConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/LaunchConfigurationConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/PluginConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCommand.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCoreParser.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindError.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindStackFrame.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportHandler.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportWizardConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizard.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizardPage.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationDelegate.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationTabGroup.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOutputDirectoryProvider.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AbstractMassifTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AllTests.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/BasicMassifTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartExportTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartTests.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/DoubleClickTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExpandCollapseTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExportWizardTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/LaunchConfigTabTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MassifTestsPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MultiProcessTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/SortTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/TreeTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifCommandConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifHeapTreeNode.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifOutput.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifParser.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPidMenuAction.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifSnapshot.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifToolPage.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeLabelProvider.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeViewer.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditor.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditorInput.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartLocationsDialog.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartSVG.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/HeapChart.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractLinkedResourceMemcheckTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractMemcheckTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AllTests.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/BasicMemcheckTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/DoubleClickTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ExpandCollapseTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LaunchConfigTabTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MarkerTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MemcheckTestsPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MinVersionTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MultiProcessTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ShortcutTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/SignalTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckCommandConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckToolPage.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/AbstractValgrindTest.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ResourceChangePrinter.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubCommand.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubProcess.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubStreamsProxy.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchDelegate.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchShortcut.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestsPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ColorManager.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ISuppressionsColorConstants.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionKindRule.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionToolRule.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsConfiguration.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsContentAssistProcessor.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsDocumentProvider.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsEditor.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsElementScanner.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsPartitionScanner.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsReconcilingStrategy.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ValgrindEditorPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/messages.properties delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CollapseAction.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CoreMessagesViewer.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/Messages.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindUIPlugin.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindViewPart.java delete mode 100644 valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/messages.properties diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.project b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.project index 675ef62d0a..7831c66e46 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/ChangeLog index 4f05c4acc2..c2b687d6a6 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/ChangeLog @@ -1,3 +1,11 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/cachegrind/tests: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests: New package. + * .project: Enabled API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * test.xml: Update class references. + 2009-06-23 Elliott Baron * CachegrindTestToolPage.java: Removed. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/META-INF/MANIFEST.MF index 6cc50f1c5a..10721c8156 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.cachegrind.tests Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.cachegrind.tests.CachegrindTestsPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.cachegrind.tests.CachegrindTestsPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -18,12 +18,15 @@ Import-Package: org.eclipse.cdt.core.model, org.eclipse.debug.core.model, org.eclipse.debug.ui, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.cachegrind, + org.eclipse.linuxtools.internal.valgrind.cachegrind.model, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, + org.eclipse.linuxtools.internal.valgrind.tests, + org.eclipse.linuxtools.internal.valgrind.ui, org.eclipse.linuxtools.profiling.tests, - org.eclipse.linuxtools.valgrind.cachegrind, - org.eclipse.linuxtools.valgrind.cachegrind.model, - org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch, - org.eclipse.linuxtools.valgrind.tests, org.eclipse.linuxtools.valgrind.ui, org.eclipse.ui, org.eclipse.ui.texteditor +Export-Package: org.eclipse.linuxtools.internal.valgrind.cachegrind.tests diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AbstractCachegrindTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AbstractCachegrindTest.java deleted file mode 100644 index daa30ec207..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AbstractCachegrindTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindPlugin; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFunction; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.tests.AbstractValgrindTest; -import org.osgi.framework.Bundle; - -public abstract class AbstractCachegrindTest extends AbstractValgrindTest { - - @Override - protected Bundle getBundle() { - return CachegrindTestsPlugin.getDefault().getBundle(); - } - - @Override - protected String getToolID() { - return CachegrindPlugin.TOOL_ID; - } - - protected CachegrindFile getFileByName(CachegrindOutput output, String name) { - CachegrindFile file = null; - for (CachegrindFile f : output.getFiles()) { - if (f.getName().equals(name)) { - file = f; - } - } - return file; - } - - protected CachegrindFunction getFunctionByName(CachegrindFile file, String name) { - CachegrindFunction function = null; - for (CachegrindFunction f : file.getFunctions()) { - if (f.getName().equals(name)) { - function = f; - } - } - return function; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AllTests.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AllTests.java deleted file mode 100644 index cee2e5c33c..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/AllTests.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite( - "Tests for org.eclipse.linuxtools.valgrind.cachegrind.tests"); //$NON-NLS-1$ - //$JUnit-BEGIN$ - suite.addTestSuite(BasicCachegrindTest.class); - suite.addTestSuite(CModelLabelsTest.class); - suite.addTestSuite(DoubleClickTest.class); - suite.addTestSuite(LaunchConfigTabTest.class); - suite.addTestSuite(MultiProcessTest.class); - suite.addTestSuite(ExpandCollapseTest.class); - //$JUnit-END$ - return suite; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/BasicCachegrindTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/BasicCachegrindTest.java deleted file mode 100644 index 06b66ee6c7..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/BasicCachegrindTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindViewPart; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; - -public class BasicCachegrindTest extends AbstractCachegrindTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("cpptest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testNumPIDs() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNumPIDs"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - assertEquals(1, view.getOutputs().length); - } - - public void testFileNames() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testFileNames"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - assertNotNull(file); - file = getFileByName(output, "cpptest.h"); //$NON-NLS-1$ - assertNotNull(file); - } - - public void testNumFunctions() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNumFunctions"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - assertNotNull(file); - assertEquals(8, file.getFunctions().length); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CModelLabelsTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CModelLabelsTest.java deleted file mode 100644 index 22656172f2..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CModelLabelsTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import org.eclipse.cdt.core.model.IFunction; -import org.eclipse.cdt.core.model.IMethod; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.ui.CElementLabelProvider; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindLabelProvider; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindViewPart; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFunction; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.cachegrind.model.ICachegrindElement; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.widgets.TreeItem; - -public class CModelLabelsTest extends AbstractCachegrindTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("cpptest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testFileLabelsCPP() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testFileLabelsCPP"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - - assertTrue(file.getModel() instanceof ITranslationUnit); - - checkLabelProvider(file); - } - - public void testFileLabelsH() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testFileLabelsH"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.h"); //$NON-NLS-1$ - - assertTrue(file.getModel() instanceof ITranslationUnit); - assertTrue(((ITranslationUnit) file.getModel()).isHeaderUnit()); - - checkLabelProvider(file); - } - - public void testFunctionLabel() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testFunctionLabel"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - CachegrindFunction func = getFunctionByName(file, "main"); //$NON-NLS-1$ - - assertTrue(func.getModel() instanceof IFunction); - - checkLabelProvider(func, file); - } - - public void testMethodLabel() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testMethodLabel"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - CachegrindFunction func = getFunctionByName(file, "A::A()"); //$NON-NLS-1$ - - assertTrue(func.getModel() instanceof IMethod); - - checkLabelProvider(func, file); - } - - public void testNestedMethodLabel() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNestedMethodLabel"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - CachegrindFunction func = getFunctionByName(file, "A::B::e()"); //$NON-NLS-1$ - - assertTrue(func.getModel() instanceof IMethod); - - checkLabelProvider(func, file); - } - - private void checkLabelProvider(CachegrindFile file) { - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - TreeViewer viewer = view.getViewer(); - - TreePath path = new TreePath(new Object[] { view.getOutputs()[0], file }); - checkLabelProvider(viewer, path, file); - } - - private void checkLabelProvider(CachegrindFunction func, CachegrindFile file) { - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - TreeViewer viewer = view.getViewer(); - - TreePath path = new TreePath(new Object[] { view.getOutputs()[0], file, func }); - checkLabelProvider(viewer, path, func); - } - - private void checkLabelProvider(TreeViewer viewer, TreePath path, ICachegrindElement element) { - // expand only the interesting item - viewer.expandToLevel(element, TreeViewer.ALL_LEVELS); - TreeSelection selection = new TreeSelection(path); - viewer.setSelection(selection); - TreeItem item = viewer.getTree().getSelection()[0]; - - // ensure the CElementLabelProvider is called correctly - CElementLabelProvider provider = ((CachegrindLabelProvider) viewer.getLabelProvider(0)).getCLabelProvider(); - assertEquals(provider.getText(element.getModel()), item.getText()); - assertEquals(provider.getImage(element.getModel()), item.getImage()); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CachegrindTestsPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CachegrindTestsPlugin.java deleted file mode 100644 index 337bb1b02c..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/CachegrindTestsPlugin.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class CachegrindTestsPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.cachegrind.tests"; //$NON-NLS-1$ - - // The shared instance - private static CachegrindTestsPlugin plugin; - - /** - * The constructor - */ - public CachegrindTestsPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static CachegrindTestsPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/DoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/DoubleClickTest.java deleted file mode 100644 index 6c802d5b70..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/DoubleClickTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import java.io.File; - -import org.eclipse.cdt.core.model.IFunction; -import org.eclipse.core.resources.IResource; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindViewPart; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFunction; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindLine; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.cachegrind.model.ICachegrindElement; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.ITextEditor; - -public class DoubleClickTest extends AbstractCachegrindTest { - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("cpptest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - private void doDoubleClick(TreePath path) { - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - TreeViewer treeViewer = (TreeViewer) view.getViewer(); - - ICachegrindElement element = (ICachegrindElement) path.getLastSegment(); - treeViewer.expandToLevel(element, TreeViewer.ALL_LEVELS); - TreeSelection selection = new TreeSelection(path); - - IDoubleClickListener listener = view.getDoubleClickListener(); - listener.doubleClick(new DoubleClickEvent(treeViewer, selection)); - } - - public void testDoubleClickFile() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDoubleClickFile"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - TreePath path = new TreePath(new Object[] { output, file }); - - doDoubleClick(path); - - checkFile(file); - } - - public void testDoubleClickFunction() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDoubleClickFunction"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - CachegrindFunction func = getFunctionByName(file, "main"); //$NON-NLS-1$ - TreePath path = new TreePath(new Object[] { output, file, func }); - - doDoubleClick(path); - - // check file in editor - IEditorPart editor = checkFile(file); - - // check line number - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - int expectedLine = ((IFunction) func.getModel()).getSourceRange().getStartLine(); - assertEquals(expectedLine, line); - } - - public void testDoubleClickLine() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDoubleClickFunction"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - CachegrindOutput output = view.getOutputs()[0]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - CachegrindFunction func = getFunctionByName(file, "main"); //$NON-NLS-1$ - CachegrindLine line = func.getLines()[0]; - TreePath path = new TreePath(new Object[] { output, file, func }); - - doDoubleClick(path); - - // check file in editor - IEditorPart editor = checkFile(file); - - // check line number - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - TextSelection textSelection = (TextSelection) selection; - int actualLine = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(line.getLine(), actualLine); - } - - private IEditorPart checkFile(CachegrindFile file) { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - IEditorInput input = editor.getEditorInput(); - IFileEditorInput fileInput = (IFileEditorInput) input; - IResource expectedResource = proj.getProject().findMember(file.getName()); - File expectedFile = expectedResource.getLocation().toFile(); - File actualFile = fileInput.getFile().getLocation().toFile(); - assertEquals(expectedFile, actualFile); - return editor; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/ExpandCollapseTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/ExpandCollapseTest.java deleted file mode 100644 index 7885166174..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/ExpandCollapseTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindViewPart; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.cachegrind.model.ICachegrindElement; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Menu; - -public class ExpandCollapseTest extends AbstractCachegrindTest { - - protected TreeViewer viewer; - protected Menu contextMenu; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("cpptest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testExpand() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDefaults"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - viewer = view.getViewer(); - contextMenu = viewer.getTree().getMenu(); - - // Select first snapshot and expand it - CachegrindOutput[] outputs = (CachegrindOutput[]) viewer.getInput(); - CachegrindOutput output = outputs[0]; - TreeSelection selection = new TreeSelection(new TreePath(new Object[] { output })); - viewer.setSelection(selection); - contextMenu.notifyListeners(SWT.Show, null); - contextMenu.getItem(0).notifyListeners(SWT.Selection, null); - - checkExpanded(output, true); - } - - public void testCollapse() throws Exception { - // Expand the element first - testExpand(); - - // Then collapse it - CachegrindOutput[] outputs = (CachegrindOutput[]) viewer.getInput(); - CachegrindOutput output = outputs[0]; - TreeSelection selection = new TreeSelection(new TreePath(new Object[] { output })); - viewer.setSelection(selection); - contextMenu.notifyListeners(SWT.Show, null); - contextMenu.getItem(1).notifyListeners(SWT.Selection, null); - - checkExpanded(output, false); - } - - private void checkExpanded(ICachegrindElement element, boolean expanded) { - if (element.getChildren() != null && element.getChildren().length > 0) { - // only applicable to internal nodes - if (expanded) { - assertTrue(viewer.getExpandedState(element)); - } - else { - assertFalse(viewer.getExpandedState(element)); - } - for (ICachegrindElement child : element.getChildren()) { - checkExpanded(child, expanded); - } - } - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/LaunchConfigTabTest.java deleted file mode 100644 index 0d8d6780ab..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/LaunchConfigTabTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import java.util.Arrays; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindPlugin; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindToolPage; -import org.eclipse.linuxtools.valgrind.launch.ValgrindOptionsTab; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class LaunchConfigTabTest extends AbstractCachegrindTest { - - protected ILaunchConfiguration config; - protected Shell testShell; - protected ValgrindOptionsTab tab; - protected CachegrindToolPage dynamicTab; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("cpptest"); //$NON-NLS-1$ - - config = createConfiguration(proj.getProject()); - - testShell = new Shell(Display.getDefault()); - testShell.setLayout(new GridLayout()); - tab = new ValgrindOptionsTab(); - } - - @Override - protected void tearDown() throws Exception { - tab.dispose(); - testShell.dispose(); - deleteProject(proj); - super.tearDown(); - } - - private ILaunchConfigurationWorkingCopy initConfig() throws CoreException { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - tab.setDefaults(wc); - tab.createControl(testShell); - tab.initializeFrom(config); - int ix = Arrays.asList(tab.getTools()).indexOf(CachegrindPlugin.TOOL_ID); - tab.getToolsCombo().select(ix); - ILaunchConfigurationTab dynamicTab = tab.getDynamicTab(); - this.dynamicTab = (CachegrindToolPage) dynamicTab; - return wc; - } - - private ILaunch saveAndLaunch(ILaunchConfigurationWorkingCopy wc, String testName) - throws Exception { - tab.performApply(wc); - config = wc.doSave(); - - ILaunch launch = doLaunch(config, testName); - return launch; - } - - public void testDefaults() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - ILaunch launch = saveAndLaunch(wc, "testDefaults"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--tool=cachegrind")); //$NON-NLS-1$ - assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("-q")); //$NON-NLS-1$ - assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ - assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ - assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ - - assertTrue(cmd.contains("--cache-sim=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--branch-sim=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testNoSim() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getCacheButton().setSelection(false); - tab.performApply(wc); - wc.doSave(); - - assertFalse(tab.isValid(config)); - } - - public void testBranchSim() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getBranchButton().setSelection(true); - tab.performApply(wc); - wc.doSave(); - - ILaunch launch = saveAndLaunch(wc, "testBranchSim"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--branch-sim=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testI1Cache() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - - assertFalse(dynamicTab.getI1SizeSpinner().isEnabled()); - dynamicTab.getI1Button().setSelection(true); - dynamicTab.getI1Button().notifyListeners(SWT.Selection, null); - assertTrue(dynamicTab.getI1SizeSpinner().isEnabled()); - - dynamicTab.getI1SizeSpinner().setSelection(16384); - dynamicTab.getI1AssocSpinner().setSelection(1); - dynamicTab.getI1LineSizeSpinner().setSelection(16); - - tab.performApply(wc); - wc.doSave(); - - ILaunch launch = saveAndLaunch(wc, "testI1Cache"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertTrue(cmd.contains("--I1=16384,1,16")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testD1Cache() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - - assertFalse(dynamicTab.getD1SizeSpinner().isEnabled()); - dynamicTab.getD1Button().setSelection(true); - dynamicTab.getD1Button().notifyListeners(SWT.Selection, null); - assertTrue(dynamicTab.getD1SizeSpinner().isEnabled()); - - dynamicTab.getD1SizeSpinner().setSelection(16384); - dynamicTab.getD1AssocSpinner().setSelection(1); - dynamicTab.getD1LineSizeSpinner().setSelection(16); - - tab.performApply(wc); - wc.doSave(); - - ILaunch launch = saveAndLaunch(wc, "testD1Cache"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertTrue(cmd.contains("--D1=16384,1,16")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testL2Cache() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - - assertFalse(dynamicTab.getL2SizeSpinner().isEnabled()); - dynamicTab.getL2Button().setSelection(true); - dynamicTab.getL2Button().notifyListeners(SWT.Selection, null); - assertTrue(dynamicTab.getL2SizeSpinner().isEnabled()); - - dynamicTab.getL2SizeSpinner().setSelection(16384); - dynamicTab.getL2AssocSpinner().setSelection(1); - dynamicTab.getL2LineSizeSpinner().setSelection(16); - - tab.performApply(wc); - wc.doSave(); - - ILaunch launch = saveAndLaunch(wc, "testL2Cache"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertTrue(cmd.contains("--L2=16384,1,16")); //$NON-NLS-1$ - } - else { - fail(); - } - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/MultiProcessTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/MultiProcessTest.java deleted file mode 100644 index c57a75dbd0..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/valgrind/cachegrind/tests/MultiProcessTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.tests; - -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.linuxtools.valgrind.cachegrind.CachegrindViewPart; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; - -public class MultiProcessTest extends AbstractCachegrindTest { - ICProject refProj; - - @Override - protected void setUp() throws Exception { - super.setUp(); - refProj = createProjectAndBuild("cpptest"); //$NON-NLS-1$ - proj = createProjectAndBuild("multiProcTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - deleteProject(refProj); - super.tearDown(); - } - - public void testNoExec() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNoExec"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - assertEquals(1, view.getOutputs().length); - } - - public void testNumPids() throws Exception { - ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy(); - config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true); - config.doSave(); - doLaunch(config, "testExec"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - assertEquals(2, view.getOutputs().length); - } - - public void testFileNames() throws Exception { - ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy(); - config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true); - config.doSave(); - doLaunch(config, "testExec"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - - int pidIx = 0; - CachegrindOutput output = view.getOutputs()[pidIx]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - if (file == null) { - pidIx = 1; - output = view.getOutputs()[pidIx]; - file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - } - assertNotNull(file); - file = getFileByName(output, "cpptest.h"); //$NON-NLS-1$ - assertNotNull(file); - - // test other pid - pidIx = (pidIx + 1) % 2; - output = view.getOutputs()[pidIx]; - file = getFileByName(output, "parent.cpp"); //$NON-NLS-1$ - assertNotNull(file); - } - - public void testNumFunctions() throws Exception { - ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy(); - config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true); - config.doSave();; - doLaunch(config, "testExec"); //$NON-NLS-1$ - - CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - - int pidIx = 0; - CachegrindOutput output = view.getOutputs()[pidIx]; - CachegrindFile file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - if (file == null) { - pidIx = 1; - output = view.getOutputs()[pidIx]; - file = getFileByName(output, "cpptest.cpp"); //$NON-NLS-1$ - } - assertNotNull(file); - assertEquals(8, file.getFunctions().length); - - // test other pid - pidIx = (pidIx + 1) % 2; - output = view.getOutputs()[pidIx]; - file = getFileByName(output, "parent.cpp"); //$NON-NLS-1$ - assertNotNull(file); - assertEquals(6, file.getFunctions().length); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/test.xml b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/test.xml index 7570d0f5ab..a431252ffe 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/test.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/test.xml @@ -1,7 +1,7 @@ - + diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/.project b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/.project index 65e4f365ec..3f300e83dc 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/ChangeLog index 44ebc05d56..101bf9bc12 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/ChangeLog @@ -1,3 +1,13 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/cachegrind: Removed. + * src/org/eclipse/linuxtools/valgrind/cachegrind/model: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/cachegrind: New package. + * src/org/eclipse/linuxtools/internal/valgrind/cachegrind/model: New package. + * .project: Enabled API analysis. + * META-INF/MANIFEST.MF: Export internal packages. + * plugin.xml: Update class references. + 2009-06-23 Elliott Baron * CachegrindToolPage.java (getD1LineSizeSpinner): Created getter. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/META-INF/MANIFEST.MF index e8148f47f1..2bffe9413b 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.cachegrind;singleton:=true Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.cachegrind.CachegrindPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime @@ -20,9 +20,11 @@ Import-Package: org.eclipse.cdt.core.dom.ast, org.eclipse.debug.core, org.eclipse.debug.ui, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, + org.eclipse.linuxtools.internal.valgrind.ui, org.eclipse.linuxtools.profiling.ui, - org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch, org.eclipse.linuxtools.valgrind.ui -Export-Package: org.eclipse.linuxtools.valgrind.cachegrind, - org.eclipse.linuxtools.valgrind.cachegrind.model +Export-Package: org.eclipse.linuxtools.internal.valgrind.cachegrind, + org.eclipse.linuxtools.internal.valgrind.cachegrind.model diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/plugin.xml index effaf3faa5..24746eb332 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/plugin.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/plugin.xml @@ -4,16 +4,16 @@ + page="org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindToolPage"> diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindCommandConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindCommandConstants.java deleted file mode 100644 index dc2ceafdf9..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindCommandConstants.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -public final class CachegrindCommandConstants { - // Valgrind program arguments - public static final String OPT_CACHEGRIND_OUTFILE = "--cachegrind-out-file"; //$NON-NLS-1$ - public static final String OPT_I1 = "--I1"; //$NON-NLS-1$ - public static final String OPT_D1 = "--D1"; //$NON-NLS-1$ - public static final String OPT_L2 = "--L2"; //$NON-NLS-1$ - public static final String OPT_CACHE_SIM = "--cache-sim"; //$NON-NLS-1$ - public static final String OPT_BRANCH_SIM = "--branch-sim"; //$NON-NLS-1$ -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLabelProvider.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLabelProvider.java deleted file mode 100644 index be33af3be1..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLabelProvider.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import java.text.DecimalFormat; - -import org.eclipse.cdt.core.model.util.CElementBaseLabels; -import org.eclipse.cdt.ui.CElementLabelProvider; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.viewers.CellLabelProvider; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFunction; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindLine; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.cachegrind.model.ICachegrindElement; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -public class CachegrindLabelProvider extends CellLabelProvider { - - protected CElementLabelProvider cLabelProvider = new CElementLabelProvider(CElementLabelProvider.SHOW_SMALL_ICONS | CElementLabelProvider.SHOW_PARAMETERS | CElementLabelProvider.SHOW_RETURN_TYPE) { - @Override - public int getTextFlags() { - int flags = super.getTextFlags(); - return flags |= CElementBaseLabels.M_FULLY_QUALIFIED; - } - }; - - protected DecimalFormat df = new DecimalFormat("#,##0"); //$NON-NLS-1$ - - protected static final Image FUNC_IMG = CachegrindPlugin.imageDescriptorFromPlugin(CachegrindPlugin.PLUGIN_ID, "icons/function_obj.gif").createImage(); //$NON-NLS-1$ - - @Override - public void update(ViewerCell cell) { - ICachegrindElement element = ((ICachegrindElement) cell.getElement()); - int index = cell.getColumnIndex(); - - if (index == 0) { - if (element instanceof CachegrindFile) { - // Try to use the CElementLabelProvider - IAdaptable model = ((CachegrindFile) element).getModel(); - if (model != null) { - cell.setText(cLabelProvider.getText(model)); - cell.setImage(cLabelProvider.getImage(model)); - } - else { // Fall back - String name = ((CachegrindFile) element).getName(); - cell.setText(name); - cell.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE)); - } - } - else if (element instanceof CachegrindFunction) { - // Try to use the CElementLabelProvider - IAdaptable model = ((CachegrindFunction) element).getModel(); - if (model != null) { - cell.setText(cLabelProvider.getText(model)); - cell.setImage(cLabelProvider.getImage(model)); - } - else { // Fall back - String name = ((CachegrindFunction) element).getName(); - cell.setText(name); - cell.setImage(FUNC_IMG); - } - } - else if (element instanceof CachegrindLine) { - cell.setText(NLS.bind(Messages.getString("CachegrindViewPart.line"), ((CachegrindLine) element).getLine())); //$NON-NLS-1$ - cell.setImage(DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_INSTRUCTION_POINTER_TOP)); - } - else if (element instanceof CachegrindOutput) { - cell.setText(NLS.bind(Messages.getString("CachegrindViewPart.Total_PID"), ((CachegrindOutput) element).getPid())); //$NON-NLS-1$ - cell.setImage(DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_REGISTER)); - } - } - else if (element instanceof CachegrindFunction) { - cell.setText(df.format(((CachegrindFunction) element).getTotals()[index - 1])); - } - else if (element instanceof CachegrindLine) { - cell.setText(df.format(((CachegrindLine) element).getValues()[index - 1])); - } - else if (element instanceof CachegrindOutput) { - cell.setText(df.format(((CachegrindOutput) element).getSummary()[index - 1])); - } - } - - public CElementLabelProvider getCLabelProvider() { - return cLabelProvider; - } -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchConstants.java deleted file mode 100644 index 2af44408cd..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchConstants.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -public final class CachegrindLaunchConstants { - // LaunchConfiguration attributes - public static final String ATTR_CACHEGRIND_CACHE_SIM = CachegrindPlugin.PLUGIN_ID + ".CACHE_SIM"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_BRANCH_SIM = CachegrindPlugin.PLUGIN_ID + ".BRANCH_SIM"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_I1 = CachegrindPlugin.PLUGIN_ID + ".I1"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_I1_SIZE = CachegrindPlugin.PLUGIN_ID + ".I1_SIZE"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_I1_ASSOC = CachegrindPlugin.PLUGIN_ID + ".I1_ASSOC"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_I1_LSIZE = CachegrindPlugin.PLUGIN_ID + ".I1_LSIZE"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_D1 = CachegrindPlugin.PLUGIN_ID + ".D1"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_D1_SIZE = CachegrindPlugin.PLUGIN_ID + ".D1_SIZE"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_D1_ASSOC = CachegrindPlugin.PLUGIN_ID + ".D1_ASSOC"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_D1_LSIZE = CachegrindPlugin.PLUGIN_ID + ".D1_LSIZE"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_L2 = CachegrindPlugin.PLUGIN_ID + ".L2"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_L2_SIZE = CachegrindPlugin.PLUGIN_ID + ".L2_SIZE"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_L2_ASSOC = CachegrindPlugin.PLUGIN_ID + ".L2_ASSOC"; //$NON-NLS-1$ - public static final String ATTR_CACHEGRIND_L2_LSIZE = CachegrindPlugin.PLUGIN_ID + ".L2_LSIZE"; //$NON-NLS-1$ - - public static final boolean DEFAULT_CACHEGRIND_CACHE_SIM = true; - public static final boolean DEFAULT_CACHEGRIND_BRANCH_SIM = false; - public static final boolean DEFAULT_CACHEGRIND_I1 = false; - public static final int DEFAULT_CACHEGRIND_I1_SIZE = 0; - public static final int DEFAULT_CACHEGRIND_I1_ASSOC = 0; - public static final int DEFAULT_CACHEGRIND_I1_LSIZE = 0; - public static final boolean DEFAULT_CACHEGRIND_D1 = false; - public static final int DEFAULT_CACHEGRIND_D1_SIZE = 0; - public static final int DEFAULT_CACHEGRIND_D1_ASSOC = 0; - public static final int DEFAULT_CACHEGRIND_D1_LSIZE = 0; - public static final boolean DEFAULT_CACHEGRIND_L2 = false; - public static final int DEFAULT_CACHEGRIND_L2_SIZE = 0; - public static final int DEFAULT_CACHEGRIND_L2_ASSOC = 0; - public static final int DEFAULT_CACHEGRIND_L2_LSIZE = 0; -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchDelegate.java deleted file mode 100644 index 0a26905de9..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindLaunchDelegate.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.ArrayList; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.launch.IValgrindLaunchDelegate; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchConfigurationDelegate; -import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class CachegrindLaunchDelegate extends - ValgrindLaunchConfigurationDelegate implements IValgrindLaunchDelegate { - protected static final String OUT_PREFIX = "cachegrind_"; //$NON-NLS-1$ - protected static final String OUT_FILE = OUT_PREFIX + "%p.txt"; //$NON-NLS-1$ - protected static final FileFilter CACHEGRIND_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return pathname.getName().startsWith(OUT_PREFIX); - } - }; - - private static final String COMMA = ","; //$NON-NLS-1$ - - public void handleLaunch(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException { - try { - monitor.beginTask(Messages.getString("CachegrindLaunchDelegate.Parsing_Cachegrind_Output"), 3); //$NON-NLS-1$ - - IPath outputPath = verifyOutputPath(config); - File[] cachegrindOutputs = outputPath.toFile().listFiles(CACHEGRIND_FILTER); - - if (cachegrindOutputs.length > 0) { - parseOutput(cachegrindOutputs, monitor); - } - } catch (IOException e) { - e.printStackTrace(); - abort(Messages.getString("CachegrindLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$ - } finally { - monitor.done(); - } - } - - protected void parseOutput(File[] cachegrindOutputs, IProgressMonitor monitor) throws IOException { - CachegrindOutput[] outputs = new CachegrindOutput[cachegrindOutputs.length]; - - for (int i = 0; i < cachegrindOutputs.length; i++) { - outputs[i] = new CachegrindOutput(); - CachegrindParser.getParser().parse(outputs[i], cachegrindOutputs[i]); - } - monitor.worked(2); - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindToolView cachegrindPart = view.getDynamicView(); - if (cachegrindPart instanceof CachegrindViewPart) { - ((CachegrindViewPart) cachegrindPart).setOutputs(outputs); - } - monitor.worked(1); - } - - public String[] getCommandArray(ILaunchConfiguration config) throws CoreException { - ArrayList opts = new ArrayList(); - - IPath outputPath = verifyOutputPath(config); - opts.add(CachegrindCommandConstants.OPT_CACHEGRIND_OUTFILE + EQUALS + outputPath.append(OUT_FILE).toOSString()); - opts.add(CachegrindCommandConstants.OPT_CACHE_SIM + EQUALS + (config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_CACHE_SIM, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_CACHE_SIM) ? YES : NO)); - opts.add(CachegrindCommandConstants.OPT_BRANCH_SIM + EQUALS + (config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_BRANCH_SIM, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_BRANCH_SIM) ? YES : NO)); - if (config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1)) { - opts.add(CachegrindCommandConstants.OPT_I1 + EQUALS + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_SIZE) - + COMMA + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_ASSOC) - + COMMA + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_LSIZE)); - } - if (config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1)) { - opts.add(CachegrindCommandConstants.OPT_D1 + EQUALS + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_SIZE) - + COMMA + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_ASSOC) - + COMMA + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_LSIZE)); - } - if (config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2)) { - opts.add(CachegrindCommandConstants.OPT_L2 + EQUALS + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_SIZE) - + COMMA + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_ASSOC) - + COMMA + config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_LSIZE)); - } - return opts.toArray(new String[opts.size()]); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindParser.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindParser.java deleted file mode 100644 index d49bbd9247..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindParser.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindDescription; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFunction; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindLine; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.core.AbstractValgrindTextParser; - -public class CachegrindParser extends AbstractValgrindTextParser { - private static final String CMD = "cmd"; //$NON-NLS-1$ - private static final String DESC = "desc"; //$NON-NLS-1$ - private static final String FL = "fl"; //$NON-NLS-1$ - private static final String FN = "fn"; //$NON-NLS-1$ - private static final String EVENTS = "events"; //$NON-NLS-1$ - private static final String SUMMARY = "summary"; //$NON-NLS-1$ - - private static final String COMMA = ","; //$NON-NLS-1$ - - protected static CachegrindParser instance; - - protected CachegrindParser() { - } - - public static CachegrindParser getParser() { - if (instance == null) { - instance = new CachegrindParser(); - } - return instance; - } - - public void parse(CachegrindOutput output, File cgOut) throws IOException { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(cgOut)); - output.setPid(parsePID(cgOut.getName(), CachegrindLaunchDelegate.OUT_PREFIX)); - - String line; - CachegrindFile curFl = null; - CachegrindFunction curFn = null; - while ((line = br.readLine()) != null) { - if (line.startsWith(EVENTS + COLON)) { - output.setEvents(parseStrValue(line, COLON + SPACE).split(SPACE)); - } - else if (line.startsWith(CMD + COLON)) { - output.setCommand(parseStrValue(line, COLON + SPACE)); - } - else if (line.startsWith(DESC + COLON)) { - CachegrindDescription description = parseDescription(line); - output.addDescription(description); - } - else if (line.startsWith(FL + EQUALS)) { - curFl = new CachegrindFile(output, parseStrValue(line, EQUALS)); - output.addFile(curFl); - } - else if (line.startsWith(FN + EQUALS)) { - if (curFl != null) { - curFn = new CachegrindFunction(curFl, parseStrValue(line, EQUALS)); - curFl.addFunction(curFn); - } - else { - fail(line); - } - } - else if (line.startsWith(SUMMARY + COLON)) { - long[] summary = parseData(line, parseStrValue(line, COLON + SPACE).split(SPACE)); - output.setSummary(summary); - } - else { // line data - String[] tokens = line.split(SPACE, 2); - if (isNumber(tokens[0])) { - int lineNo = Integer.parseInt(tokens[0]); - - long[] data = parseData(line, tokens[1].split(SPACE)); - if (curFn != null) { - curFn.addLine(new CachegrindLine(curFn, lineNo, data)); - } - else { - fail(line); - } - } - else { - fail(line); - } - } - } - } finally { - if (br != null) { - br.close(); - } - } - } - - private long[] parseData(String line, String[] data) throws IOException { - long[] result = new long[data.length]; - for (int i = 0; i < data.length; i++) { - if (!isNumber(data[i])) { - fail(line); - } - result[i] = Long.parseLong(data[i]); - } - return result; - } - - private CachegrindDescription parseDescription(String line) throws IOException { - CachegrindDescription desc = null; - String[] tokens = line.split(COLON + "\\s+"); //$NON-NLS-1$ - if (tokens.length == 3) { - String name = tokens[1]; - tokens = tokens[2].split(COMMA + SPACE); - if (tokens.length == 3) { - desc = new CachegrindDescription(name, tokens[0], tokens[1], tokens[2]); - } - else { - fail(line); - } - } - else { - fail(line); - } - return desc; - } -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindPlugin.java deleted file mode 100644 index 4dc703ebf0..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindPlugin.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import org.eclipse.linuxtools.valgrind.core.PluginConstants; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class CachegrindPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.cachegrind"; //$NON-NLS-1$ - - // The shared instance - private static CachegrindPlugin plugin; - - public static final String TOOL_ID = PluginConstants.LAUNCH_PLUGIN_ID + ".cachegrind"; //$NON-NLS-1$ - - /** - * The constructor - */ - public CachegrindPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static CachegrindPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindToolPage.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindToolPage.java deleted file mode 100644 index 92e6785b7f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindToolPage.java +++ /dev/null @@ -1,379 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.linuxtools.valgrind.launch.IValgrindToolPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -public class CachegrindToolPage extends AbstractLaunchConfigurationTab - implements IValgrindToolPage { - public static final String CACHEGRIND = "cachegrind"; //$NON-NLS-1$ - public static final String PLUGIN_ID = CachegrindPlugin.PLUGIN_ID; - - // Cachegrind controls - protected Button cacheButton; - protected Button branchButton; - protected Composite i1Top; - protected Spinner i1SizeSpinner; - protected Spinner i1AssocSpinner; - protected Spinner i1LineSizeSpinner; - protected Button i1Button; - protected Composite d1Top; - protected Spinner d1SizeSpinner; - protected Spinner d1AssocSpinner; - protected Spinner d1LineSizeSpinner; - protected Button d1Button; - protected Composite l2Top; - protected Spinner l2SizeSpinner; - protected Spinner l2AssocSpinner; - protected Spinner l2LineSizeSpinner; - protected Button l2Button; - - protected boolean isInitializing = false; - protected SelectionListener selectListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }; - protected ModifyListener modifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }; - - public void createControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - top.setLayout(new GridLayout()); - top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Event options - cacheButton = new Button(top, SWT.CHECK); - cacheButton.setText(Messages.getString("CachegrindToolPage.Profile_Cache")); //$NON-NLS-1$ - cacheButton.addSelectionListener(selectListener); - - branchButton = new Button(top, SWT.CHECK); - branchButton.setText(Messages.getString("CachegrindToolPage.Profile_Branch")); //$NON-NLS-1$ - branchButton.addSelectionListener(selectListener); - - createVerticalSpacer(top, 1); - - Group cacheGroup = new Group(top, SWT.SHADOW_OUT); - cacheGroup.setLayout(new GridLayout(2, false)); - cacheGroup.setText(Messages.getString("CachegrindToolPage.Manually_Set_Cache")); //$NON-NLS-1$ - - // I1 Cache - i1Button = new Button(cacheGroup, SWT.CHECK); - i1Button.setText(Messages.getString("CachegrindToolPage.I1_Cache")); //$NON-NLS-1$ - i1Button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - checkI1Enablement(); - updateLaunchConfigurationDialog(); - } - }); - - i1Top = new Composite(cacheGroup, SWT.BORDER); - GridLayout i1Layout = new GridLayout(6, false); - i1Layout.horizontalSpacing = 10; - i1Top.setLayout(i1Layout); - - Label i1SizeLabel = new Label(i1Top, SWT.NONE); - i1SizeLabel.setText(Messages.getString("CachegrindToolPage.Size")); //$NON-NLS-1$ - - i1SizeSpinner = new Spinner(i1Top, SWT.BORDER); - i1SizeSpinner.setMaximum(Integer.MAX_VALUE); - i1SizeSpinner.addModifyListener(modifyListener); - - Label i1AssocLabel = new Label(i1Top, SWT.NONE); - i1AssocLabel.setText(Messages.getString("CachegrindToolPage.Assoc")); //$NON-NLS-1$ - - i1AssocSpinner = new Spinner(i1Top, SWT.BORDER); - i1AssocSpinner.setMaximum(Integer.MAX_VALUE); - i1AssocSpinner.addModifyListener(modifyListener); - - Label i1LineSizeLabel = new Label(i1Top, SWT.NONE); - i1LineSizeLabel.setText(Messages.getString("CachegrindToolPage.Line_Size")); //$NON-NLS-1$ - - i1LineSizeSpinner = new Spinner(i1Top, SWT.BORDER); - i1LineSizeSpinner.setMaximum(Integer.MAX_VALUE); - i1LineSizeSpinner.addModifyListener(modifyListener); - - // D1 Cache - d1Button = new Button(cacheGroup, SWT.CHECK); - d1Button.setText(Messages.getString("CachegrindToolPage.D1_Cache")); //$NON-NLS-1$ - d1Button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - checkD1Enablement(); - updateLaunchConfigurationDialog(); - } - }); - - d1Top = new Composite(cacheGroup, SWT.BORDER); - GridLayout d1Layout = new GridLayout(6, false); - d1Layout.horizontalSpacing = 10; - d1Top.setLayout(d1Layout); - - Label d1SizeLabel = new Label(d1Top, SWT.NONE); - d1SizeLabel.setText(Messages.getString("CachegrindToolPage.Size")); //$NON-NLS-1$ - - d1SizeSpinner = new Spinner(d1Top, SWT.BORDER); - d1SizeSpinner.setMaximum(Integer.MAX_VALUE); - d1SizeSpinner.addModifyListener(modifyListener); - - Label d1AssocLabel = new Label(d1Top, SWT.NONE); - d1AssocLabel.setText(Messages.getString("CachegrindToolPage.Assoc")); //$NON-NLS-1$ - - d1AssocSpinner = new Spinner(d1Top, SWT.BORDER); - d1AssocSpinner.setMaximum(Integer.MAX_VALUE); - d1AssocSpinner.addModifyListener(modifyListener); - - Label d1LineSizeLabel = new Label(d1Top, SWT.NONE); - d1LineSizeLabel.setText(Messages.getString("CachegrindToolPage.Line_Size")); //$NON-NLS-1$ - - d1LineSizeSpinner = new Spinner(d1Top, SWT.BORDER); - d1LineSizeSpinner.setMaximum(Integer.MAX_VALUE); - d1LineSizeSpinner.addModifyListener(modifyListener); - - // D1 Cache - l2Button = new Button(cacheGroup, SWT.CHECK); - l2Button.setText(Messages.getString("CachegrindToolPage.L2_Cache")); //$NON-NLS-1$ - l2Button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - checkL2Enablement(); - updateLaunchConfigurationDialog(); - } - }); - - l2Top = new Composite(cacheGroup, SWT.BORDER); - GridLayout l2Layout = new GridLayout(6, false); - l2Layout.horizontalSpacing = 10; - l2Top.setLayout(l2Layout); - - Label l2SizeLabel = new Label(l2Top, SWT.NONE); - l2SizeLabel.setText(Messages.getString("CachegrindToolPage.Size")); //$NON-NLS-1$ - - l2SizeSpinner = new Spinner(l2Top, SWT.BORDER); - l2SizeSpinner.setMaximum(Integer.MAX_VALUE); - l2SizeSpinner.addModifyListener(modifyListener); - - Label l2AssocLabel = new Label(l2Top, SWT.NONE); - l2AssocLabel.setText(Messages.getString("CachegrindToolPage.Assoc")); //$NON-NLS-1$ - - l2AssocSpinner = new Spinner(l2Top, SWT.BORDER); - l2AssocSpinner.setMaximum(Integer.MAX_VALUE); - l2AssocSpinner.addModifyListener(modifyListener); - - Label l2LineSizeLabel = new Label(l2Top, SWT.NONE); - l2LineSizeLabel.setText(Messages.getString("CachegrindToolPage.Line_Size")); //$NON-NLS-1$ - - l2LineSizeSpinner = new Spinner(l2Top, SWT.BORDER); - l2LineSizeSpinner.setMaximum(Integer.MAX_VALUE); - l2LineSizeSpinner.addModifyListener(modifyListener); - } - - public String getName() { - return Messages.getString("CachegrindToolPage.Cachegrind_Options"); //$NON-NLS-1$ - } - - public void initializeFrom(ILaunchConfiguration config) { - try { - cacheButton.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_CACHE_SIM, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_CACHE_SIM)); - branchButton.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_BRANCH_SIM, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_BRANCH_SIM)); - - i1Button.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1)); - i1SizeSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_SIZE)); - i1AssocSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_ASSOC)); - i1LineSizeSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_LSIZE)); - checkI1Enablement(); - - d1Button.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1)); - d1SizeSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_SIZE)); - d1AssocSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_ASSOC)); - d1LineSizeSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_LSIZE)); - checkD1Enablement(); - - l2Button.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2)); - l2SizeSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_SIZE)); - l2AssocSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_ASSOC)); - l2LineSizeSpinner.setSelection(config.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_LSIZE)); - checkL2Enablement(); - } catch (CoreException e) { - e.printStackTrace(); - } - } - - public void performApply(ILaunchConfigurationWorkingCopy config) { - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_CACHE_SIM, cacheButton.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_BRANCH_SIM, branchButton.getSelection()); - - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1, i1Button.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_SIZE, i1SizeSpinner.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_ASSOC, i1AssocSpinner.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_LSIZE, i1LineSizeSpinner.getSelection()); - - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1, d1Button.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_SIZE, d1SizeSpinner.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_ASSOC, d1AssocSpinner.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_LSIZE, d1LineSizeSpinner.getSelection()); - - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2, l2Button.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_SIZE, l2SizeSpinner.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_ASSOC, l2AssocSpinner.getSelection()); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_LSIZE, l2LineSizeSpinner.getSelection()); - } - - public void setDefaults(ILaunchConfigurationWorkingCopy config) { - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_CACHE_SIM, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_CACHE_SIM); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_BRANCH_SIM, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_BRANCH_SIM); - - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_SIZE); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_ASSOC); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_I1_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_I1_LSIZE); - - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_SIZE); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_ASSOC); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_D1_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_D1_LSIZE); - - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_SIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_SIZE); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_ASSOC, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_ASSOC); - config.setAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_L2_LSIZE, CachegrindLaunchConstants.DEFAULT_CACHEGRIND_L2_LSIZE); - } - - @Override - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - - boolean result = false; - try { - result = launchConfig.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_CACHE_SIM, true) - || launchConfig.getAttribute(CachegrindLaunchConstants.ATTR_CACHEGRIND_BRANCH_SIM, false); - } catch (CoreException e) { - e.printStackTrace(); - } - if (!result) { - setErrorMessage(Messages.getString("CachegrindToolPage.At_least_one_of")); //$NON-NLS-1$ - } - return result; - } - - protected void createHorizontalSpacer(Composite comp, int numlines) { - Label lbl = new Label(comp, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = numlines; - lbl.setLayoutData(gd); - } - - @Override - protected void updateLaunchConfigurationDialog() { - if (!isInitializing) { - super.updateLaunchConfigurationDialog(); - } - } - - protected void checkI1Enablement() { - boolean checked = i1Button.getSelection(); - i1SizeSpinner.setEnabled(checked); - i1AssocSpinner.setEnabled(checked); - i1LineSizeSpinner.setEnabled(checked); - } - - protected void checkD1Enablement() { - boolean checked = d1Button.getSelection(); - d1SizeSpinner.setEnabled(checked); - d1AssocSpinner.setEnabled(checked); - d1LineSizeSpinner.setEnabled(checked); - } - - protected void checkL2Enablement() { - boolean checked = l2Button.getSelection(); - l2SizeSpinner.setEnabled(checked); - l2AssocSpinner.setEnabled(checked); - l2LineSizeSpinner.setEnabled(checked); - } - - public Button getCacheButton() { - return cacheButton; - } - - public Button getBranchButton() { - return branchButton; - } - - public Spinner getI1SizeSpinner() { - return i1SizeSpinner; - } - - public Spinner getI1AssocSpinner() { - return i1AssocSpinner; - } - - public Spinner getI1LineSizeSpinner() { - return i1LineSizeSpinner; - } - - public Button getI1Button() { - return i1Button; - } - - public Spinner getD1SizeSpinner() { - return d1SizeSpinner; - } - - public Spinner getD1AssocSpinner() { - return d1AssocSpinner; - } - - public Spinner getD1LineSizeSpinner() { - return d1LineSizeSpinner; - } - - public Button getD1Button() { - return d1Button; - } - - public Spinner getL2SizeSpinner() { - return l2SizeSpinner; - } - - public Spinner getL2AssocSpinner() { - return l2AssocSpinner; - } - - public Spinner getL2LineSizeSpinner() { - return l2LineSizeSpinner; - } - - public Button getL2Button() { - return l2Button; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindViewPart.java deleted file mode 100644 index 93ec681d0a..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/CachegrindViewPart.java +++ /dev/null @@ -1,361 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import java.util.Arrays; - -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.ISourceRange; -import org.eclipse.cdt.core.model.ISourceReference; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.TreeViewerColumn; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.linuxtools.profiling.ui.ProfileUIUtils; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFile; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindFunction; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindLine; -import org.eclipse.linuxtools.valgrind.cachegrind.model.CachegrindOutput; -import org.eclipse.linuxtools.valgrind.cachegrind.model.ICachegrindElement; -import org.eclipse.linuxtools.valgrind.ui.CollapseAction; -import org.eclipse.linuxtools.valgrind.ui.ExpandAction; -import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.ViewPart; - -public class CachegrindViewPart extends ViewPart implements IValgrindToolView { - - protected CachegrindOutput[] outputs; - protected TreeViewer viewer; - - protected static final int COLUMN_SIZE = 75; - protected CachegrindLabelProvider labelProvider; - protected CachegrindTreeContentProvider contentProvider; - protected IDoubleClickListener doubleClickListener; - protected ExpandAction expandAction; - protected CollapseAction collapseAction; - - // Events - Cache - protected static final String IR = "Ir"; //$NON-NLS-1$ - protected static final String I1MR = "I1mr"; //$NON-NLS-1$ - protected static final String I2MR = "I2mr"; //$NON-NLS-1$ - protected static final String DR = "Dr"; //$NON-NLS-1$ - protected static final String D1MR = "D1mr"; //$NON-NLS-1$ - protected static final String D2MR = "D2mr"; //$NON-NLS-1$ - protected static final String DW = "Dw"; //$NON-NLS-1$ - protected static final String D1MW = "D1mw"; //$NON-NLS-1$ - protected static final String D2MW = "D2mw"; //$NON-NLS-1$ - - // Events - Branch - protected static final String BC = "Bc"; //$NON-NLS-1$ - protected static final String BCM = "Bcm"; //$NON-NLS-1$ - protected static final String BI = "Bi"; //$NON-NLS-1$ - protected static final String BIM = "Bim"; //$NON-NLS-1$ - - @Override - public void createPartControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - GridLayout topLayout = new GridLayout(); - topLayout.marginHeight = topLayout.marginWidth = 0; - top.setLayout(topLayout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - viewer = new TreeViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.FULL_SELECTION); - - labelProvider = new CachegrindLabelProvider(); - - Tree tree = viewer.getTree(); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - tree.setLayoutData(new GridData(GridData.FILL_BOTH)); - - TreeViewerColumn column = new TreeViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.getString("CachegrindViewPart.Location")); //$NON-NLS-1$ - column.getColumn().setWidth(COLUMN_SIZE * 4); - column.getColumn().setResizable(true); - column.getColumn().addSelectionListener(getHeaderListener()); - column.setLabelProvider(labelProvider); - - contentProvider = new CachegrindTreeContentProvider(); - viewer.setContentProvider(contentProvider); - viewer.setLabelProvider(labelProvider); - viewer.setAutoExpandLevel(2); - doubleClickListener = new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - Object selection = ((StructuredSelection) event.getSelection()).getFirstElement(); - String path = null; - int line = 0; - if (selection instanceof CachegrindFile) { - path = ((CachegrindFile) selection).getPath(); - } - else if (selection instanceof CachegrindLine) { - CachegrindLine element = (CachegrindLine) selection; - CachegrindFile file = (CachegrindFile) element.getParent().getParent(); - path = file.getPath(); - line = element.getLine(); - } - else if (selection instanceof CachegrindFunction) { - CachegrindFunction function = (CachegrindFunction) selection; - path = ((CachegrindFile) function.getParent()).getPath(); - if (function.getModel() instanceof ISourceReference) { - ISourceReference model = (ISourceReference) function.getModel(); - try { - ISourceRange sr = model.getSourceRange(); - if (sr != null) { - line = sr.getStartLine(); - } - } catch (CModelException e) { - e.printStackTrace(); - } - } - } - if (path != null) { - try { - ProfileUIUtils.openEditorAndSelect(path, line); - } catch (PartInitException e) { - e.printStackTrace(); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } - }; - viewer.addDoubleClickListener(doubleClickListener); - - expandAction = new ExpandAction(viewer); - collapseAction = new CollapseAction(viewer); - - MenuManager manager = new MenuManager(); - manager.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - ITreeSelection selection = (ITreeSelection) viewer.getSelection(); - ICachegrindElement element = (ICachegrindElement) selection.getFirstElement(); - if (contentProvider.hasChildren(element)) { - manager.add(expandAction); - manager.add(collapseAction); - } - } - }); - - manager.setRemoveAllWhenShown(true); - Menu contextMenu = manager.createContextMenu(viewer.getTree()); - viewer.getControl().setMenu(contextMenu); - } - - @Override - public void setFocus() { - viewer.getTree().setFocus(); - } - - public IAction[] getToolbarActions() { - return null; - } - - public void refreshView() { - if (outputs != null && outputs.length > 0) { - String[] events = outputs[0].getEvents(); - for (int i = 0; i < events.length; i++) { - TreeViewerColumn column = new TreeViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(events[i]); - column.getColumn().setWidth(COLUMN_SIZE); - column.getColumn().setToolTipText(getFullEventName(events[i])); - column.getColumn().setResizable(true); - column.getColumn().addSelectionListener(getHeaderListener()); - column.setLabelProvider(labelProvider); - } - viewer.setInput(outputs); - viewer.getTree().layout(true); - } - } - - public void setOutputs(CachegrindOutput[] outputs) { - this.outputs = outputs; - } - - public CachegrindOutput[] getOutputs() { - return outputs; - } - - public TreeViewer getViewer() { - return viewer; - } - - public IDoubleClickListener getDoubleClickListener() { - return doubleClickListener; - } - - private SelectionListener getHeaderListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - TreeColumn column = (TreeColumn) e.widget; - Tree tree = viewer.getTree(); - if (column.equals(tree.getSortColumn())) { - int direction = tree.getSortDirection() == SWT.UP ? SWT.DOWN - : SWT.UP; - tree.setSortDirection(direction); - } else { - tree.setSortDirection(SWT.UP); - } - tree.setSortColumn(column); - viewer.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - Tree tree = ((TreeViewer) viewer).getTree(); - int direction = tree.getSortDirection(); - ICachegrindElement o1 = (ICachegrindElement) e1; - ICachegrindElement o2 = (ICachegrindElement) e2; - long result = 0; - - int sortIndex = Arrays.asList(tree.getColumns()).indexOf(tree.getSortColumn()); - if (sortIndex == 0) { // use compareTo - result = o1.compareTo(o2); - } - else { - long[] v1 = null; - long[] v2 = null; - if (o1 instanceof CachegrindFunction && o2 instanceof CachegrindFunction) { - v1 = ((CachegrindFunction) o1).getTotals(); - v2 = ((CachegrindFunction) o2).getTotals(); - } - else if (o1 instanceof CachegrindLine && o2 instanceof CachegrindLine) { - v1 = ((CachegrindLine) o1).getValues(); - v2 = ((CachegrindLine) o2).getValues(); - } - else if (o1 instanceof CachegrindOutput && o2 instanceof CachegrindOutput) { - v1 = ((CachegrindOutput) o1).getSummary(); - v2 = ((CachegrindOutput) o2).getSummary(); - } - - if (v1 != null && v2 != null) { - result = v1[sortIndex - 1] - v2[sortIndex - 1]; - } - } - - // ascending or descending - result = direction == SWT.UP ? result : -result; - - // overflow check - if (result > Integer.MAX_VALUE) { - result = Integer.MAX_VALUE; - } else if (result < Integer.MIN_VALUE) { - result = Integer.MIN_VALUE; - } - - return (int) result; - } - }); - } - }; - } - - private String getFullEventName(String event) { - String result = event; - if (event.equals(IR)) { - result = Messages.getString("CachegrindViewPart.Ir_long"); //$NON-NLS-1$ - } - else if (event.equals(I1MR)) { - result = Messages.getString("CachegrindViewPart.I1mr_long"); //$NON-NLS-1$ - } - else if (event.equals(I2MR)) { - result = Messages.getString("CachegrindViewPart.I2mr_long"); //$NON-NLS-1$ - } - else if (event.equals(DR)) { - result = Messages.getString("CachegrindViewPart.Dr_long"); //$NON-NLS-1$ - } - else if (event.equals(D1MR)) { - result = Messages.getString("CachegrindViewPart.D1mr_long"); //$NON-NLS-1$ - } - else if (event.equals(D2MR)) { - result = Messages.getString("CachegrindViewPart.D2mr_long"); //$NON-NLS-1$ - } - else if (event.equals(DW)) { - result = Messages.getString("CachegrindViewPart.Dw_long"); //$NON-NLS-1$ - } - else if (event.equals(D1MW)) { - result = Messages.getString("CachegrindViewPart.D1mw_long"); //$NON-NLS-1$ - } - else if (event.equals(D2MW)) { - result = Messages.getString("CachegrindViewPart.D2mw_long"); //$NON-NLS-1$ - } - else if (event.equals(BC)) { - result = Messages.getString("CachegrindViewPart.Bc_long"); //$NON-NLS-1$ - } - else if (event.equals(BCM)) { - result = Messages.getString("CachegrindViewPart.Bcm_long"); //$NON-NLS-1$ - } - else if (event.equals(BI)) { - result = Messages.getString("CachegrindViewPart.Bi_long"); //$NON-NLS-1$ - } - else if (event.equals(BIM)) { - result = Messages.getString("CachegrindViewPart.Bim_long"); //$NON-NLS-1$ - } - return result; - } - - protected class CachegrindTreeContentProvider implements ITreeContentProvider { - - public Object[] getChildren(Object parentElement) { - Object[] result = null; - if (parentElement instanceof CachegrindOutput[]) { - result = (CachegrindOutput[]) parentElement; - } - else if (parentElement instanceof ICachegrindElement) { - result = ((ICachegrindElement) parentElement).getChildren(); - } - return result; - } - - public Object getParent(Object element) { - return ((ICachegrindElement) element).getParent(); - } - - public boolean hasChildren(Object element) { - ICachegrindElement[] children = (ICachegrindElement[]) getChildren(element); - return children != null && children.length > 0; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - - } - - - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/Messages.java deleted file mode 100644 index e14dd02714..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.cachegrind.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/messages.properties deleted file mode 100644 index f14411ec64..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/messages.properties +++ /dev/null @@ -1,40 +0,0 @@ -CachegrindLaunchDelegate.Error_parsing_output=Error parsing output -CachegrindLaunchDelegate.Parsing_Cachegrind_Output=Parsing Cachegrind Output -CachegrindLaunchDelegate.Retrieving_cachegrind_data_dir_failed=Retrieving cachegrind data dir failed. -CachegrindParser.Parsing_cachegrind_output_failed=Parsing cachegrind output failed on line: {0} -CachegrindToolPage.Assoc=Associativity: -CachegrindToolPage.At_least_one_of=At least one of Cache and Branch Profiling must be selected -CachegrindToolPage.Cachegrind_Options=Cachegrind Options -CachegrindToolPage.D1_Cache=D1 Cache: -CachegrindToolPage.I1_Cache=I1 Cache: -CachegrindToolPage.L2_Cache=L2 Cache: -CachegrindToolPage.Line_Size=Line Size (B): -CachegrindToolPage.Manually_Set_Cache=Manually Set Cache Specifications -CachegrindToolPage.Profile_Branch=Profile Branch Instructions/Mispredictions -CachegrindToolPage.Profile_Cache=Profile Cache Accesses/Misses -CachegrindToolPage.Size=Size (B): -CachegrindViewPart.Bc_long=Conditional Branches Executed -CachegrindViewPart.Bcm_long=Conditional Branches Mispredicted -CachegrindViewPart.Bi_long=Indirect Branches Executed -CachegrindViewPart.Bim_long=Indirect Branches Mispredicted -CachegrindViewPart.D1mr_long=L1 Data Read Miss -CachegrindViewPart.D1mr_short=D1 rd miss -CachegrindViewPart.D1mw_long=L1 Data Write Miss -CachegrindViewPart.D1mw_short=D1 wr miss -CachegrindViewPart.D2mr_long=L2 Data Read Miss -CachegrindViewPart.D2mr_short=L2d rd miss -CachegrindViewPart.D2mw_long=L2 Data Write Miss -CachegrindViewPart.D2mw_short=L2d wr miss -CachegrindViewPart.Dr_long=Data Read Access -CachegrindViewPart.Dr_short=D rd ref -CachegrindViewPart.Dw_long=Data Write Access -CachegrindViewPart.Dw_short=D wr ref -CachegrindViewPart.I1mr_long=L1 Instruction Fetch Miss -CachegrindViewPart.I1mr_short=I1 miss -CachegrindViewPart.I2mr_long=L2 Instruction Fetch Miss -CachegrindViewPart.I2mr_short=L2i miss -CachegrindViewPart.Ir_long=Instruction Fetch -CachegrindViewPart.Ir_short=I ref -CachegrindViewPart.Location=Location -CachegrindViewPart.line=line {0} -CachegrindViewPart.Total_PID=Total [PID: {0}] diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindDescription.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindDescription.java deleted file mode 100644 index 46d0075e58..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindDescription.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -public class CachegrindDescription { - protected String name; - protected String size; - protected String lineSize; - protected String assoc; - - public CachegrindDescription(String name, String size, String lineSize, String assoc) { - this.name = name; - this.size = size; - this.lineSize = lineSize; - this.assoc = assoc; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof CachegrindDescription && name.equals(((CachegrindDescription) obj).getName()); - } - - public String getName() { - return name; - } - - public String getSize() { - return size; - } - - public String getLineSize() { - return lineSize; - } - - public String getAssoc() { - return assoc; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFile.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFile.java deleted file mode 100644 index 436a48221d..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFile.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -public class CachegrindFile implements ICachegrindElement { - private static final String UNKNOWN_FILE = "???"; //$NON-NLS-1$ - - - protected CachegrindOutput parent; - protected String path; - protected List functions; - - protected IAdaptable model; - - public CachegrindFile(CachegrindOutput parent, String path) { - this.parent = parent; - this.path = path; - functions = new ArrayList(); - - IPath pathObj = Path.fromOSString(path); - if (path.equals(UNKNOWN_FILE)) { - model = null; - } - else { - model = CoreModel.getDefault().create(pathObj); - if (model == null) { - model = ResourcesPlugin.getWorkspace().getRoot().getFile(pathObj); - } - } - } - - public void addFunction(CachegrindFunction func) { - functions.add(func); - } - - public CachegrindFunction[] getFunctions() { - return functions.toArray(new CachegrindFunction[functions.size()]); - } - - public ICachegrindElement[] getChildren() { - return getFunctions(); - } - - public IAdaptable getModel() { - return model; - } - - public String getPath() { - return path; - } - - public String getName() { - String name = path; - if (Path.ROOT.isValidPath(path)) { - name = Path.fromOSString(path).lastSegment(); - } - return name; - } - - public ICachegrindElement getParent() { - return parent; - } - - public int compareTo(ICachegrindElement o) { - int result = 0; - if (o instanceof CachegrindFile) { - result = getName().compareTo(((CachegrindFile) o).getName()); - } - return result; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFunction.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFunction.java deleted file mode 100644 index 8df0a07ca7..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindFunction.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.IFunction; -import org.eclipse.cdt.core.model.IMethod; -import org.eclipse.cdt.core.model.IParent; -import org.eclipse.cdt.core.model.IStructure; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; - -public class CachegrindFunction implements ICachegrindElement { - protected CachegrindFile parent; - protected String name; - protected List lines; - protected long[] totals; - - protected IAdaptable model; - - private static String SCOPE_RESOLUTION = "::"; //$NON-NLS-1$ - - public CachegrindFunction(CachegrindFile parent, String name) { - this.parent = parent; - this.name = name; - lines = new ArrayList(); - - IAdaptable pModel = parent.getModel(); - if (pModel instanceof ICElement) { - ICElement element = (ICElement) pModel; - try { - if (element instanceof ITranslationUnit) { - // Cachegrind labels parameter types for C++ methods - int paramIndex = name.indexOf("("); //$NON-NLS-1$ - if (paramIndex >= 0) { - name = name.substring(0, paramIndex); - } - - model = findElement(name, (IParent) element); - if (model == null) { - while (name.contains(SCOPE_RESOLUTION)) { - String[] parts = name.split(SCOPE_RESOLUTION, 2); - String structureName = parts[0]; - name = parts[1]; - - List dom = ((IParent) element).getChildrenOfType(ICElement.C_CLASS); - dom.addAll(((IParent) element).getChildrenOfType(ICElement.C_STRUCT)); - dom.addAll(((IParent) element).getChildrenOfType(ICElement.C_UNION)); - for (int i = 0; i < dom.size(); i++) { - ICElement e = dom.get(i); - if (e instanceof IStructure && e.getElementName().equals(structureName)) { - element = (IStructure) e; - } - } - } - model = findElement(name, (IParent) element); - } - } - } catch (CoreException e) { - e.printStackTrace(); - } - } - } - - protected ICElement findElement(String name, IParent parent) - throws CModelException { - ICElement element = null; - List dom = parent.getChildrenOfType(ICElement.C_FUNCTION); - dom.addAll(parent.getChildrenOfType(ICElement.C_METHOD)); - for (int i = 0; i < dom.size(); i++) { - ICElement func = dom.get(i); - if ((func instanceof IFunction || func instanceof IMethod) && func.getElementName().equals(name)) { - element = func; - } - } - return element; - } - - public void addLine(CachegrindLine line) { - long[] values = line.getValues(); - if (totals == null) { - totals = new long[values.length]; - } - for (int i = 0; i < values.length; i++) { - totals[i] += values[i]; - } - lines.add(line); - } - - public String getName() { - return name; - } - - public IAdaptable getModel() { - return model; - } - - public long[] getTotals() { - return totals; - } - - public CachegrindLine[] getLines() { - return lines.toArray(new CachegrindLine[lines.size()]); - } - - public ICachegrindElement[] getChildren() { - ICachegrindElement[] children = null; - // if there is only a summary don't return any children - if (lines.get(0).getLine() > 0) { - children = getLines(); - } - return children; - } - - public ICachegrindElement getParent() { - return parent; - } - - public int compareTo(ICachegrindElement o) { - int result = 0; - if (o instanceof CachegrindFunction) { - result = name.compareTo(((CachegrindFunction) o).getName()); - } - return result; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindLine.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindLine.java deleted file mode 100644 index 9d6c40038d..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindLine.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -import org.eclipse.core.runtime.IAdaptable; - - -public class CachegrindLine implements ICachegrindElement { - protected CachegrindFunction parent; - protected int line; - protected long[] values; - - public CachegrindLine(CachegrindFunction parent, int line, long[] values) { - this.parent = parent; - this.line = line; - this.values = values; - } - - public ICachegrindElement[] getChildren() { - return null; - } - - public int getLine() { - return line; - } - - public long[] getValues() { - return values; - } - - public ICachegrindElement getParent() { - return parent; - } - - public int compareTo(ICachegrindElement o) { - int result = 0; - if (o instanceof CachegrindLine) { - result = line - ((CachegrindLine) o).getLine(); - } - return result; - } - - public IAdaptable getModel() { - return null; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindOutput.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindOutput.java deleted file mode 100644 index bd7e60107f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/CachegrindOutput.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; - -public class CachegrindOutput implements ICachegrindElement { - protected List descriptions; - protected List files; - protected Integer pid; - protected String cmd; - protected String[] events; - protected long[] summary; - - public CachegrindOutput() { - descriptions = new ArrayList(); - files = new ArrayList(); - } - - public void addDescription(CachegrindDescription desc) { - descriptions.add(desc); - } - - public void addFile(CachegrindFile file) { - files.add(file); - } - - public void setCommand(String cmd) { - this.cmd = cmd; - } - - public void setEvents(String[] events) { - this.events = events; - } - - public void setSummary(long[] summary) { - this.summary = summary; - } - - public void setPid(Integer pid) { - this.pid = pid; - } - - public String getCmd() { - return cmd; - } - - public CachegrindDescription[] getDescriptions() { - return descriptions.toArray(new CachegrindDescription[descriptions.size()]); - } - - public String[] getEvents() { - return events; - } - - public CachegrindFile[] getFiles() { - return files.toArray(new CachegrindFile[files.size()]); - } - - public long[] getSummary() { - return summary; - } - - public ICachegrindElement[] getChildren() { - return getFiles(); - } - - public ICachegrindElement getParent() { - return null; - } - - public Integer getPid() { - return pid; - } - - public int compareTo(ICachegrindElement o) { - int result = 0; - if (o instanceof CachegrindOutput) { - result = pid - ((CachegrindOutput) o).getPid(); - } - return result; - } - - public IAdaptable getModel() { - return null; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/ICachegrindElement.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/ICachegrindElement.java deleted file mode 100644 index c4199c3f62..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/ICachegrindElement.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -import org.eclipse.core.runtime.IAdaptable; - -public interface ICachegrindElement extends Comparable { - - public ICachegrindElement getParent(); - - public ICachegrindElement[] getChildren(); - - public IAdaptable getModel(); - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/Messages.java deleted file mode 100644 index d15f811efc..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.cachegrind.model; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.cachegrind.model.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/messages.properties deleted file mode 100644 index 8b13789179..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind/src/org/eclipse/linuxtools/valgrind/cachegrind/model/messages.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.core/ChangeLog index b3c166a9c8..04b9571e55 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.core/ChangeLog @@ -1,3 +1,9 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/core: Moved all but IValgrindMessage. + * src/org/eclipse/linuxtools/internal/valgrind/core: New package. + * META-INF/MANIFEST.MF: Export internal package. + 2009-05-26 Elliott Baron * AbstractValgrindTextParser.java: Add constant. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.core/META-INF/MANIFEST.MF index b6ae71457a..7e181e2d50 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.core/META-INF/MANIFEST.MF @@ -3,13 +3,14 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.core;singleton:=true Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.core.ValgrindPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.core.ValgrindPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.linuxtools.valgrind.core +Export-Package: org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.valgrind.core Import-Package: org.eclipse.cdt.utils, org.eclipse.cdt.utils.pty, org.eclipse.cdt.utils.spawner, diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/LaunchConfigurationConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/LaunchConfigurationConstants.java index 3b5a830d75..ba963591dc 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/LaunchConfigurationConstants.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/LaunchConfigurationConstants.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.valgrind.core; -import java.util.Collections; -import java.util.List; - public final class LaunchConfigurationConstants { @@ -30,7 +27,7 @@ public final class LaunchConfigurationConstants { public static final String ATTR_GENERAL_ERRLIMIT = PLUGIN_ID + ".GENERAL_ERRLIMIT"; //$NON-NLS-1$ public static final String ATTR_GENERAL_BELOWMAIN = PLUGIN_ID + ".GENERAL_BELOWMAIN"; //$NON-NLS-1$ public static final String ATTR_GENERAL_MAXFRAME = PLUGIN_ID + ".GENERAL_MAXFRAME"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_SUPPFILES = PLUGIN_ID + ".GENERAL_SUPPFILES"; //$NON-NLS-1$ + public static final String ATTR_GENERAL_SUPPFILE = PLUGIN_ID + ".GENERAL_SUPPFILE"; //$NON-NLS-1$ // 3.4.0 specific public static final String ATTR_GENERAL_MAINSTACK_BOOL = PLUGIN_ID + ".GENERAL_MAINSTACK_BOOL"; //$NON-NLS-1$ @@ -46,7 +43,7 @@ public final class LaunchConfigurationConstants { public static final boolean DEFAULT_GENERAL_ERRLIMIT = true; public static final boolean DEFAULT_GENERAL_BELOWMAIN = false; public static final int DEFAULT_GENERAL_MAXFRAME = 2000000; - public static final List DEFAULT_GENERAL_SUPPFILES = Collections.EMPTY_LIST; + public static final String DEFAULT_GENERAL_SUPPFILE = ""; //$NON-NLS-1$ // 3.4.0 specific public static final boolean DEFAULT_GENERAL_MAINSTACK_BOOL = false; diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindMessage.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindMessage.java deleted file mode 100644 index 432b317d63..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindMessage.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import java.util.ArrayList; - -import org.eclipse.debug.core.ILaunch; - -public class AbstractValgrindMessage implements IValgrindMessage { - - protected IValgrindMessage parent; - protected ILaunch launch; - protected ArrayList children; - protected String text; - - public AbstractValgrindMessage(IValgrindMessage parent, String text, ILaunch launch) { - children = new ArrayList(); - this.parent = parent; - this.text = text; - this.launch = launch; - - if (parent != null) { - parent.addChild(this); - } - } - - public void addChild(IValgrindMessage message) { - children.add(message); - } - - public ILaunch getLaunch() { - return launch; - } - - public IValgrindMessage getParent() { - return parent; - } - - public IValgrindMessage[] getChildren() { - return children.toArray(new IValgrindMessage[children.size()]); - } - - public String getText() { - return text; - } - -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindTextParser.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindTextParser.java deleted file mode 100644 index 4a0d3c6eb4..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/AbstractValgrindTextParser.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import java.io.IOException; - -import org.eclipse.osgi.util.NLS; - -public abstract class AbstractValgrindTextParser { - - private static final String DOT = "."; //$NON-NLS-1$ - protected static final String COLON = ":"; //$NON-NLS-1$ - protected static final String SPACE = " "; //$NON-NLS-1$ - protected static final String EQUALS = "="; //$NON-NLS-1$ - protected static final String DASH = "-"; //$NON-NLS-1$ - protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - /** - * Retrieves ARGUMENT portion of [OPTION][DELIMITER][ARGUMENT] - * where ARGUMENT is a Long - * @param line - the line to parse - * @param delim - the DELIMITER to separate on - * @return Long value of ARGUMENT - * @throws IOException - */ - protected Long parseLongValue(String line, String delim) - throws IOException { - Long result = null; - String[] parts = line.split(delim, 2); - if (parts.length > 1 && isNumber(parts[1])) { - result = Long.parseLong(parts[1]); - } - else { - fail(line); - } - return result; - } - - /** - * Retrieves ARGUMENT portion of [OPTION][DELIMITER][ARGUMENT] - * where ARGUMENT is a String - * @param line - the line to parse - * @param delim - the DELIMITER to separate fields - * @return String value of ARGUMENT - * @throws IOException - */ - protected String parseStrValue(String line, String delim) - throws IOException { - String result = null; - String[] parts = line.split(delim, 2); - if (parts.length > 1) { - result = parts[1]; - } - else { - fail(line); - } - return result; - } - - /** - * Retrieves PID from filename with format [PREFIX][PID].[EXTENSION] - * @param filename - the file name to parse - * @param prefix - the prefix of the filename up to the PID - * @return - the PID portion of the filename as an Integer - * @throws IOException - */ - protected Integer parsePID(String filename, String prefix) throws IOException { - String pidstr = filename.substring(prefix.length(), filename.lastIndexOf(DOT)); - if (isNumber(pidstr)) { - return new Integer(pidstr); - } - else { - throw new IOException("Cannot parse PID from output file"); //$NON-NLS-1$ - } - } - - /** - * Throws an IOException indicating parsing failed on a given line - * @param line - line that parsing failed - * @throws IOException - */ - protected void fail(String line) throws IOException { - throw new IOException(NLS.bind(Messages.getString("AbstractValgrindTextParser.Parsing_output_failed"), line)); //$NON-NLS-1$ - } - - /** - * Determines if argument is a number - * @param string - argument to test - * @return - true if argument is a number - */ - protected boolean isNumber(String string) { - boolean result = true; - char[] chars = string.toCharArray(); - for (int i = 0; i < chars.length; i++) { - if (!Character.isDigit(chars[i])) { - result = false; - } - } - return result; - } - - /** - * Parses string ending with format ([FILE]:[LINE]) - * Assumes syntax is: "\(.*:[0-9]+\)$" - * @param line - String with the above criteria - * @return a tuple of [String filename, Integer line] - */ - protected Object[] parseFilename(String line) { - String filename = null; - int lineNo = 0; - - int ix = line.lastIndexOf("("); //$NON-NLS-1$ - if (ix >= 0) { - String part = line.substring(ix, line.length()); - part = part.substring(1, part.length() - 1); // remove leading and trailing parentheses - if ((ix = part.lastIndexOf(":")) >= 0) { //$NON-NLS-1$ - String strLineNo = part.substring(ix + 1); - if (isNumber(strLineNo)) { - lineNo = Integer.parseInt(strLineNo); - filename = part.substring(0, ix); - } - } - else { - // check for "in " token (lib, with symbol) - part = part.replaceFirst("^in ", EMPTY_STRING); //$NON-NLS-1$ - // check for "within " token (lib, without symbol) - part = part.replaceFirst("^within ", EMPTY_STRING); //$NON-NLS-1$ - filename = part; // library, no line number - } - } - - return new Object[] { filename, lineNo }; - } - -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/CommandLineConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/CommandLineConstants.java deleted file mode 100644 index 99d0b303a8..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/CommandLineConstants.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -public final class CommandLineConstants { - public static final String OPT_TOOL = "--tool"; //$NON-NLS-1$ - - public static final String OPT_XML = "--xml"; //$NON-NLS-1$ - public static final String OPT_LOGFILE = "--log-file"; //$NON-NLS-1$ - public static final String OPT_QUIET = "-q"; //$NON-NLS-1$ - public static final String OPT_VERSION = "--version"; //$NON-NLS-1$ - - public static final String OPT_TRACECHILD = "--trace-children"; //$NON-NLS-1$ - public static final String OPT_CHILDSILENT = "--child-silent-after-fork"; //$NON-NLS-1$ - public static final String OPT_TRACKFDS = "--track-fds"; //$NON-NLS-1$ - public static final String OPT_TIMESTAMP = "--time-stamp"; //$NON-NLS-1$ - public static final String OPT_FREERES = "--run-libc-freeres"; //$NON-NLS-1$ - public static final String OPT_DEMANGLE = "--demangle"; //$NON-NLS-1$ - public static final String OPT_NUMCALLERS = "--num-callers"; //$NON-NLS-1$ - public static final String OPT_ERRLIMIT = "--error-limit"; //$NON-NLS-1$ - public static final String OPT_BELOWMAIN = "--show-below-main"; //$NON-NLS-1$ - public static final String OPT_MAXFRAME = "--max-stackframe"; //$NON-NLS-1$ - public static final String OPT_SUPPFILE = "--suppressions"; //$NON-NLS-1$ - - // 3.4.0 specific - public static final String OPT_MAINSTACK = "--main-stacksize"; //$NON-NLS-1$ - - public static final String LOG_PREFIX = "valgrind_"; //$NON-NLS-1$ -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/LaunchConfigurationConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/LaunchConfigurationConstants.java deleted file mode 100644 index 1adceba341..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/LaunchConfigurationConstants.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - - -public final class LaunchConfigurationConstants { - - // LaunchConfiguration constants - private static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.launch"; //$NON-NLS-1$ - - public static final String ATTR_TOOL = PLUGIN_ID + ".TOOL"; //$NON-NLS-1$ - public static final String ATTR_INTERNAL_OUTPUT_DIR = PLUGIN_ID + ".OUTPUT_DIR"; //$NON-NLS-1$ - - public static final String ATTR_GENERAL_TRACECHILD = PLUGIN_ID + ".GENERAL_TRACECHILD"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_CHILDSILENT = PLUGIN_ID + ".GENERAL_CHILDSILENT"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_FREERES = PLUGIN_ID + ".GENERAL_FREERES"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_DEMANGLE = PLUGIN_ID + ".GENERAL_DEMANGLE"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_NUMCALLERS = PLUGIN_ID + ".GENERAL_NUMCALLERS"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_ERRLIMIT = PLUGIN_ID + ".GENERAL_ERRLIMIT"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_BELOWMAIN = PLUGIN_ID + ".GENERAL_BELOWMAIN"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_MAXFRAME = PLUGIN_ID + ".GENERAL_MAXFRAME"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_SUPPFILE = PLUGIN_ID + ".GENERAL_SUPPFILE"; //$NON-NLS-1$ - - // 3.4.0 specific - public static final String ATTR_GENERAL_MAINSTACK_BOOL = PLUGIN_ID + ".GENERAL_MAINSTACK_BOOL"; //$NON-NLS-1$ - public static final String ATTR_GENERAL_MAINSTACK = PLUGIN_ID + ".GENERAL_MAINSTACK"; //$NON-NLS-1$ - - public static final String DEFAULT_TOOL = PluginConstants.TOOL_EXT_DEFAULT; - - public static final boolean DEFAULT_GENERAL_TRACECHILD = false; - public static final boolean DEFAULT_GENERAL_CHILDSILENT = true; // necessary for parsing - public static final boolean DEFAULT_GENERAL_FREERES = true; - public static final boolean DEFAULT_GENERAL_DEMANGLE = true; - public static final int DEFAULT_GENERAL_NUMCALLERS = 12; - public static final boolean DEFAULT_GENERAL_ERRLIMIT = true; - public static final boolean DEFAULT_GENERAL_BELOWMAIN = false; - public static final int DEFAULT_GENERAL_MAXFRAME = 2000000; - public static final String DEFAULT_GENERAL_SUPPFILE = ""; //$NON-NLS-1$ - - // 3.4.0 specific - public static final boolean DEFAULT_GENERAL_MAINSTACK_BOOL = false; - public static final int DEFAULT_GENERAL_MAINSTACK = 0; -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/Messages.java deleted file mode 100644 index 2dea736e80..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.core.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/PluginConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/PluginConstants.java deleted file mode 100644 index 7eeec7bfbe..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/PluginConstants.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -public final class PluginConstants { - // IDs for important plugins - public static final String CORE_PLUGIN_ID = "org.eclipse.linuxtools.valgrind.core"; //$NON-NLS-1$ - public static final String LAUNCH_PLUGIN_ID = "org.eclipse.linuxtools.valgrind.launch"; //$NON-NLS-1$ - public static final String UI_PLUGIN_ID = "org.eclipse.linuxtools.valgrind.ui"; //$NON-NLS-1$ - - // Extension point constants - public static final String TOOL_EXT_ID = "valgrindTools"; //$NON-NLS-1$ - public static final String TOOL_EXT_DEFAULT = LAUNCH_PLUGIN_ID + ".memcheck"; //$NON-NLS-1$ - public static final String VIEW_EXT_ID = "valgrindToolViews"; //$NON-NLS-1$ - public static final String OUTPUT_DIR_EXT_ID = "outputDirectoryProviders"; //$NON-NLS-1$ - - // Extension constants - public static final String EXPORT_CMD_ID = LAUNCH_PLUGIN_ID + ".exportCommand"; //$NON-NLS-1$ -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCommand.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCommand.java deleted file mode 100644 index 23c2874ed3..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCommand.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.cdt.utils.pty.PTY; -import org.eclipse.cdt.utils.spawner.ProcessFactory; - -public class ValgrindCommand { - protected static final String WHICH_CMD = "which"; //$NON-NLS-1$ - protected static final String VALGRIND_CMD = "valgrind"; //$NON-NLS-1$ - - protected Process process; - protected String[] args; - - public String whichValgrind() throws IOException { - StringBuffer out = new StringBuffer(); - Process p = Runtime.getRuntime().exec(WHICH_CMD + " " + VALGRIND_CMD); //$NON-NLS-1$ - readIntoBuffer(out, p); - return out.toString().trim(); - } - - public String whichVersion(String whichValgrind) throws IOException { - StringBuffer out = new StringBuffer(); - Process p = Runtime.getRuntime().exec(new String[] { whichValgrind, CommandLineConstants.OPT_VERSION }); - readIntoBuffer(out, p); - return out.toString().trim(); - } - - public void execute(String[] commandArray, String[] env, File wd, boolean usePty) throws IOException { - args = commandArray; - try { - if (wd == null) { - process = ProcessFactory.getFactory().exec(commandArray, env); - } - else { - if (PTY.isSupported() && usePty) { - process = ProcessFactory.getFactory().exec(commandArray, env, wd, new PTY()); - } - else { - process = ProcessFactory.getFactory().exec(commandArray, env, wd); - } - } - } - catch (IOException e) { - if (process != null) { - process.destroy(); - } - throw e; - } - } - - public Process getProcess() { - return process; - } - - public String getCommandLine() { - StringBuffer ret = new StringBuffer(); - for (String arg : args) { - ret.append(arg + " "); //$NON-NLS-1$ - } - return ret.toString().trim(); - } - - private void readIntoBuffer(StringBuffer out, Process p) throws IOException { - boolean success; - InputStream in; - try { - if (success = (p.waitFor() == 0)) { - in = p.getInputStream(); - } - else { - in = p.getErrorStream(); - } - int ch; - while ((ch = in.read()) != -1) { - out.append((char) ch); - } - if (!success) { - throw new IOException(out.toString()); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCoreParser.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCoreParser.java deleted file mode 100644 index ae8e2de4db..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindCoreParser.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - -import org.eclipse.debug.core.ILaunch; - -public class ValgrindCoreParser extends AbstractValgrindTextParser { - private static final String AT = "at"; //$NON-NLS-1$ - private static final String BY = "by"; //$NON-NLS-1$ - - protected List messages; - protected int pid; - protected ILaunch launch; - - public ValgrindCoreParser(File inputFile, ILaunch launch) throws IOException { - this.launch = launch; - BufferedReader br = new BufferedReader(new FileReader(inputFile)); - // keep track of nested messages and their corresponding indents - Stack messageStack = new Stack(); - Stack indentStack = new Stack(); - messages = new ArrayList(); - - try { - pid = parsePID(inputFile.getName(), CommandLineConstants.LOG_PREFIX); - String line; - while ((line = br.readLine()) != null) { - // remove PID string - line = line.replaceFirst("==\\d+==", EMPTY_STRING); //$NON-NLS-1$ - - int indent; - for (indent = 0; indent < line.length() - && line.charAt(indent) == ' '; indent++) - ; - - line = line.trim(); - if (!line.equals(EMPTY_STRING)) { - /* - * indent == 1 -> top level message - * indent > 1 -> child message - * indent == 0 -> should not occur - */ - if (indent == 1) { - // top-level message, clear stacks - IValgrindMessage message = getMessage(null, line); - messages.add(message); - messageStack.clear(); - messageStack.push(message); - indentStack.clear(); - indentStack.push(indent); - } - else if (indent > 1) { - // find this message's parent - while (indent <= indentStack.peek()) { - messageStack.pop(); - indentStack.pop(); - } - - messageStack.push(getMessage(messageStack.peek(), line)); - indentStack.push(indent); - } - } - } - } finally { - if (br != null) { - br.close(); - } - } - } - - protected IValgrindMessage getMessage(IValgrindMessage message, String line) throws IOException { - if (line.startsWith(AT) || line.startsWith(BY)) { - Object[] parsed = parseFilename(line); - String filename = (String) parsed[0]; - int lineNo = (Integer) parsed[1]; - return new ValgrindStackFrame(message, line, launch, filename, lineNo); - } - return new ValgrindError(message, line, launch, pid); - } - - public IValgrindMessage[] getMessages() { - return messages.toArray(new IValgrindMessage[messages.size()]); - } - - public void printMessages(IValgrindMessage m, int indent) { - for (int i = 0; i < indent; i++) { - System.out.print(SPACE); - } - System.out.println(m.getText()); - for (IValgrindMessage child : m.getChildren()) { - printMessages(child, indent + 1); - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindError.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindError.java deleted file mode 100644 index f2c8198729..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindError.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import org.eclipse.debug.core.ILaunch; - - -public class ValgrindError extends AbstractValgrindMessage { - protected int pid; - - public ValgrindError(IValgrindMessage message, String text, ILaunch launch, int pid) { - super(message, text, launch); - this.pid = pid; - } - - public int getPid() { - return pid; - } - - @Override - public String getText() { - return super.getText() + " [PID: " + pid + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindPlugin.java deleted file mode 100644 index 1a40b5b627..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindPlugin.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class ValgrindPlugin extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = PluginConstants.CORE_PLUGIN_ID; - - // The shared instance - private static ValgrindPlugin plugin; - - /** - * The constructor - */ - public ValgrindPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static ValgrindPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindStackFrame.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindStackFrame.java deleted file mode 100644 index 4735240885..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindStackFrame.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.core; - -import org.eclipse.debug.core.ILaunch; - -public class ValgrindStackFrame extends AbstractValgrindMessage { - protected String file; - protected int line; - - public ValgrindStackFrame(IValgrindMessage message, String text, ILaunch launch, String file, int line) { - super(message, text, launch); - this.file = file; - this.line = line; - } - - public ILaunch getLaunch() { - return launch; - } - - public String getFile() { - return file; - } - - public int getLine() { - return line; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/messages.properties deleted file mode 100644 index e6824529f7..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/messages.properties +++ /dev/null @@ -1 +0,0 @@ -AbstractValgrindTextParser.Parsing_output_failed=Parsing output failed on line: {0} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/.project b/valgrind/org.eclipse.linuxtools.valgrind.launch/.project index 21b8833ffd..a8cd5803ba 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.launch/ChangeLog index 8932bdf2e6..3bafd4beac 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/ChangeLog @@ -1,3 +1,12 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/launch: Moved all but IValgrindLaunchDelegate, + IValgrindOutputDirectoryProvider, IValgrindToolPage. + * src/org/eclipse/linuxtools/internal/valgrind/launch: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * plugin.xml: Update class references. + 2009-07-09 Elliott Baron * ValgrindLaunchPlugin.java (parseWSPath): Don't report undef variables as errors. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF index 633b81a2da..d3a1056417 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.launch;singleton:=true Bundle-Version: 0.2.1.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.launch.ValgrindLaunchPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime @@ -23,11 +23,14 @@ Import-Package: org.eclipse.cdt.core, org.eclipse.debug.ui, org.eclipse.debug.ui.console, org.eclipse.debug.ui.sourcelookup, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.ui, org.eclipse.linuxtools.profiling.launch, org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.ui, org.eclipse.ui.console, org.eclipse.ui.model, org.eclipse.ui.views.navigator -Export-Package: org.eclipse.linuxtools.valgrind.launch +Export-Package: org.eclipse.linuxtools.internal.valgrind.launch, + org.eclipse.linuxtools.valgrind.launch Bundle-Localization: plugin diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.launch/plugin.xml index 952452a006..27b57eb7b8 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/plugin.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/plugin.xml @@ -6,7 +6,7 @@ @@ -35,7 +35,7 @@ @@ -118,7 +118,7 @@ diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java index fcfdd1975b..c24d060e38 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindLaunchConfigurationDelegate.java @@ -309,13 +309,14 @@ public class ValgrindLaunchConfigurationDelegate extends AbstractCLaunchDelegate } } - List suppFiles = config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILES, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILES); - for (Object strpath : suppFiles) { - IPath suppfile = getPlugin().parseWSPath((String) strpath); + String strpath = config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILE); + if (!strpath.equals(EMPTY_STRING)) { + IPath suppfile = getPlugin().parseWSPath(strpath); if (suppfile != null) { opts.add(CommandLineConstants.OPT_SUPPFILE + EQUALS + suppfile.toOSString()); } } + opts.addAll(Arrays.asList(dynamicDelegate.getCommandArray(config))); String[] ret = new String[opts.size()]; diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java index 378bc9de85..4d44610fd4 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/ValgrindOptionsTab.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.linuxtools.internal.valgrind.launch; -import java.util.Arrays; - import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -44,10 +42,10 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; @@ -69,7 +67,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { protected Spinner maxStackFrameSpinner; protected Button mainStackSizeButton; protected Spinner mainStackSizeSpinner; - protected List suppFileList; + protected Text suppFileText; protected String tool; protected String[] tools; @@ -308,26 +306,19 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { } protected void createSuppressionsOption(Composite top) { - Composite browseTop = new Composite(top, SWT.BORDER); - browseTop.setLayout(new GridLayout(2, false)); - GridData browseData = new GridData(GridData.FILL_BOTH); + Composite browseTop = new Composite(top, SWT.NONE); + browseTop.setLayout(new GridLayout(4, false)); + GridData browseData = new GridData(GridData.FILL_HORIZONTAL); browseTop.setLayoutData(browseData); Label suppFileLabel = new Label(browseTop, SWT.NONE); suppFileLabel.setText(Messages.getString("ValgrindOptionsTab.suppressions_file")); //$NON-NLS-1$ - createVerticalSpacer(browseTop, 1); - - suppFileList = new List(browseTop, SWT.BORDER); - suppFileList.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite buttonTop = new Composite(browseTop, SWT.NONE); - GridLayout buttonLayout = new GridLayout(); - buttonLayout.marginWidth = buttonLayout.marginHeight = 0; - buttonTop.setLayout(buttonLayout); - buttonTop.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false)); - - Button workspaceBrowseButton = createPushButton(buttonTop, Messages.getString("ValgrindOptionsTab.Workspace"), null); //$NON-NLS-1$ + suppFileText = new Text(browseTop, SWT.BORDER); + suppFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + suppFileText.addModifyListener(modifyListener); + + Button workspaceBrowseButton = createPushButton(browseTop, Messages.getString("ValgrindOptionsTab.Workspace"), null); //$NON-NLS-1$ workspaceBrowseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); @@ -339,31 +330,18 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { IResource resource = (IResource) dialog.getFirstResult(); String arg = resource.getFullPath().toString(); String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$ - suppFileList.add(fileLoc); - updateLaunchConfigurationDialog(); + suppFileText.setText(fileLoc); } } }); - Button fileBrowseButton = createPushButton(buttonTop, Messages.getString("ValgrindOptionsTab.File_System"), null); //$NON-NLS-1$ + Button fileBrowseButton = createPushButton(browseTop, Messages.getString("ValgrindOptionsTab.File_System"), null); //$NON-NLS-1$ fileBrowseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - String filePath = null; + String filePath = suppFileText.getText(); FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); filePath = dialog.open(); if (filePath != null) { - suppFileList.add(filePath); - updateLaunchConfigurationDialog(); - } - } - }); - Button removeButton = createPushButton(buttonTop, Messages.getString("ValgrindOptionsTab.Supp_remove"), null); //$NON-NLS-1$ - removeButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - int[] selected = suppFileList.getSelectionIndices(); - if (selected.length > 0) { - suppFileList.remove(selected); - updateLaunchConfigurationDialog(); + suppFileText.setText(filePath); } } }); @@ -464,8 +442,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { errorLimitButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, LaunchConfigurationConstants.DEFAULT_GENERAL_ERRLIMIT)); showBelowMainButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, LaunchConfigurationConstants.DEFAULT_GENERAL_BELOWMAIN)); maxStackFrameSpinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, LaunchConfigurationConstants.DEFAULT_GENERAL_MAXFRAME)); - java.util.List suppFiles = configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILES, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILES); - suppFileList.setItems(suppFiles.toArray(new String[suppFiles.size()])); + suppFileText.setText(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILE)); // 3.4.0 specific Version ver = getPlugin().getValgrindVersion(); @@ -497,21 +474,26 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { } private boolean isGeneralValid() { - String[] suppFiles = suppFileList.getItems(); - boolean result = true; - for (int i = 0; i < suppFiles.length && result; i++) { + String strpath = suppFileText.getText(); + boolean result = false; + if (strpath.equals(EMPTY_STRING)) { + result = true; + } + else { try { - IPath suppfile = getPlugin().parseWSPath(suppFiles[i]); - if (!suppfile.toFile().exists()) { - setErrorMessage(NLS.bind(Messages.getString("ValgrindOptionsTab.suppressions_file_doesnt_exist"), suppFiles[i])); //$NON-NLS-1$ - result = false; + IPath suppfile = getPlugin().parseWSPath(strpath); + if (suppfile.toFile().exists()) { + result = true; } } catch (CoreException e) { // should only occur if there's a cycle in variable substitution e.printStackTrace(); } } - + + if (!result) { + setErrorMessage(NLS.bind(Messages.getString("ValgrindOptionsTab.suppressions_file_doesnt_exist"), strpath)); //$NON-NLS-1$ + } return result; } @@ -526,7 +508,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, errorLimitButton.getSelection()); configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, showBelowMainButton.getSelection()); configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, maxStackFrameSpinner.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILES, Arrays.asList(suppFileList.getItems())); + configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, suppFileText.getText()); // 3.4.0 specific try { @@ -555,7 +537,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, LaunchConfigurationConstants.DEFAULT_GENERAL_ERRLIMIT); configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, LaunchConfigurationConstants.DEFAULT_GENERAL_BELOWMAIN); configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, LaunchConfigurationConstants.DEFAULT_GENERAL_MAXFRAME); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILES, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILES); + configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILE); // 3.4.0 specific try { @@ -599,7 +581,7 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { private void checkMainStackEnablement() { mainStackSizeSpinner.setEnabled(mainStackSizeButton.getSelection()); } - + public Button getTraceChildrenButton() { return traceChildrenButton; } @@ -640,8 +622,8 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { return mainStackSizeSpinner; } - public List getSuppFileList() { - return suppFileList; + public Text getSuppFileText() { + return suppFileText; } public Combo getToolsCombo() { diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties index 6a4526f299..4a9c1e2e0e 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties +++ b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/internal/valgrind/launch/messages.properties @@ -41,10 +41,9 @@ ValgrindOptionsTab.num_callers=Callers in stack trace: ValgrindOptionsTab.run_freeres=Run __libc_freeres on exit ValgrindOptionsTab.Select_a_Resource=Select a Resource: ValgrindOptionsTab.Select_a_Suppressions_File=Select a Suppressions File: -ValgrindOptionsTab.Supp_remove=&Remove File ValgrindOptionsTab.Suppressions=Suppressions ValgrindOptionsTab.show_errors_below_main=Show errors below main -ValgrindOptionsTab.suppressions_file=Suppression files: +ValgrindOptionsTab.suppressions_file=Suppressions file: ValgrindOptionsTab.suppressions_file_doesnt_exist=Suppressions file: {0} doesn't exist. ValgrindOptionsTab.Tool=Tool ValgrindOptionsTab.Tool_to_run=Tool to run: diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportHandler.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportHandler.java deleted file mode 100644 index 984902a565..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchWizard; -import org.eclipse.ui.PlatformUI; - -public class ExportHandler extends AbstractHandler { - - public Object execute(ExecutionEvent event) throws ExecutionException { - Display.getDefault().syncExec(new Runnable() { - public void run() { - Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - IWorkbenchWizard wizard = new ValgrindExportWizard(); - wizard.init(PlatformUI.getWorkbench(), null); - - WizardDialog dialog = new WizardDialog(parent, wizard); - dialog.open(); - } - }); - - return null; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportWizardConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportWizardConstants.java deleted file mode 100644 index b4d3f6e789..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ExportWizardConstants.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -public final class ExportWizardConstants { - - public static final String WIZARD_TITLE = Messages.getString("ExportWizardConstants.Wizard_title"); //$NON-NLS-1$ - public static final String WIZARD_WINDOW_TITLE = Messages.getString("ExportWizardConstants.Window_title"); //$NON-NLS-1$ - public static final String WIZARD_DESCRIPTION = Messages.getString("ExportWizardConstants.Wizard_desc"); //$NON-NLS-1$ - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/Messages.java deleted file mode 100644 index 399a1269f1..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.launch.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizard.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizard.java deleted file mode 100644 index 9d543db844..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizard.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.nio.channels.FileChannel; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.linuxtools.valgrind.core.PluginConstants; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.progress.IProgressService; - -public class ValgrindExportWizard extends Wizard implements IExportWizard { - - protected ValgrindExportWizardPage exportPage; - - @Override - public boolean performFinish() { - final File[] logs = exportPage.getSelectedFiles(); - final IPath outputPath = exportPage.getOutputPath(); - - IProgressService ps = PlatformUI.getWorkbench().getProgressService(); - try { - ps.busyCursorWhile(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - if (logs.length > 0) { - File outputDir = outputPath.toFile(); - monitor.beginTask(NLS.bind(Messages.getString("ValgrindExportWizard.Export_task"), outputPath.toOSString()), logs.length); //$NON-NLS-1$ - FileChannel inChan = null; - FileChannel outChan = null; - try { - for (File log : logs) { - monitor.subTask(NLS.bind(Messages.getString("ValgrindExportWizard.Export_subtask"), log.getName())); //$NON-NLS-1$ - - File outLog = new File(outputDir, log.getName()); - inChan = new FileInputStream(log).getChannel(); - outChan = new FileOutputStream(outLog).getChannel(); - - outChan.transferFrom(inChan, 0, inChan.size()); - - inChan.close(); - outChan.close(); - - monitor.worked(1); - } - } catch (IOException e) { - throw new InvocationTargetException(e); - } finally { - try { - if (inChan != null && inChan.isOpen()) { - inChan.close(); - } - if (outChan != null && outChan.isOpen()) { - outChan.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - monitor.done(); - } - } - } - - }); - - } catch (InvocationTargetException e) { - IStatus status = new Status(IStatus.ERROR, PluginConstants.LAUNCH_PLUGIN_ID, Messages.getString("ValgrindExportWizard.Export_fail"), e); //$NON-NLS-1$ - ErrorDialog.openError(getShell(), ExportWizardConstants.WIZARD_TITLE, null, status); - e.printStackTrace(); - return false; - } catch (InterruptedException e) { - } - - return true; - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - setWindowTitle(ExportWizardConstants.WIZARD_WINDOW_TITLE); - exportPage = getWizardPage(); - exportPage.setDescription(ExportWizardConstants.WIZARD_DESCRIPTION); - addPage(exportPage); - } - - protected ValgrindExportWizardPage getWizardPage() { - return new ValgrindExportWizardPage(Messages.getString("ValgrindExportWizard.Page_name"), ExportWizardConstants.WIZARD_TITLE, null); //$NON-NLS-1$ - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizardPage.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizardPage.java deleted file mode 100644 index 15fdc0de7c..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindExportWizardPage.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import java.io.File; -import java.io.FileFilter; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -public class ValgrindExportWizardPage extends WizardPage implements IWizardPage { - - protected IPath outputPath; - protected CheckboxTableViewer viewer; - protected Text destText; - protected Button selectAllButton; - protected Button deselectAllButton; - - protected ValgrindExportWizardPage(String pageName) { - super(pageName); - } - - protected ValgrindExportWizardPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - - public void createControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - top.setLayout(new GridLayout()); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - IPath logPath = null; - - // Retrieve location of Valgrind logs from launch configuration - ILaunchConfiguration config = getPlugin().getCurrentLaunchConfiguration(); - if (config != null && config.exists()) { - String strpath; - try { - strpath = config.getAttribute(LaunchConfigurationConstants.ATTR_INTERNAL_OUTPUT_DIR, (String) null); - if (strpath != null) { - logPath = Path.fromPortableString(strpath); - } - } catch (CoreException e) { - setErrorMessage(e.getLocalizedMessage()); - e.printStackTrace(); - } - } - - Label selectFilesLabel = new Label(top, SWT.NONE); - selectFilesLabel.setText(Messages.getString("ValgrindExportWizardPage.Viewer_label")); //$NON-NLS-1$ - - viewer = CheckboxTableViewer.newCheckList(top, SWT.BORDER); - viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((File) element).getName(); - } - - @Override - public Image getImage(Object element) { - return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE); - } - }); - - Composite selectAllNoneTop = new Composite(top, SWT.NONE); - selectAllNoneTop.setLayout(new GridLayout(2, true)); - selectAllNoneTop.setLayoutData(new GridData(SWT.TRAIL, SWT.DEFAULT, false, false)); - - selectAllButton = new Button(selectAllNoneTop, SWT.NONE); - selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - selectAllButton.setText(Messages.getString("ValgrindExportWizardPage.Select_all")); //$NON-NLS-1$ - selectAllButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - viewer.setAllChecked(true); - } - }); - - deselectAllButton = new Button(selectAllNoneTop, SWT.NONE); - deselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - deselectAllButton.setText(Messages.getString("ValgrindExportWizardPage.Deselect_all")); //$NON-NLS-1$ - deselectAllButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - viewer.setAllChecked(false); - } - }); - - createDestinationGroup(top); - - if (logPath != null) { - // List all output files in our output directory from the recent launch - File logs[] = logPath.toFile().listFiles(new FileFilter() { - public boolean accept(File pathname) { - return pathname.isFile(); - } - }); - viewer.setInput(logs); - viewer.setAllChecked(true); - } - - // catch any errors so far - setPageComplete(isValid()); - - setControl(top); - } - - public IPath getOutputPath() { - return outputPath; - } - - public File[] getSelectedFiles() { - Object[] selected = viewer.getCheckedElements(); - File[] files = new File[selected.length]; - System.arraycopy(selected, 0, files, 0, selected.length); - return files; - } - - private void createDestinationGroup(Composite top) { - Group destGroup = new Group(top, SWT.SHADOW_OUT); - destGroup.setText(Messages.getString("ValgrindExportWizardPage.Destination_group")); //$NON-NLS-1$ - destGroup.setLayout(new GridLayout(2, false)); - destGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - destText = new Text(destGroup, SWT.BORDER); - destText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - destText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(isValid()); - } - }); - - Button browseButton = new Button(destGroup, SWT.PUSH); - browseButton.setText(Messages.getString("ValgrindExportWizardPage.Browse")); //$NON-NLS-1$ - browseButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - // Prompt for output directory - Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - DirectoryDialog dialog = new DirectoryDialog(parent); - dialog.setText(Messages.getString("ValgrindLaunchConfigurationDelegate.Select_Destination")); //$NON-NLS-1$ - String strpath = dialog.open(); - if (strpath != null) { - destText.setText(strpath); - } - } - }); - } - - protected boolean isValid() { - boolean valid = false; - - setErrorMessage(null); - setMessage(null); - - if (viewer.getInput() == null) { - setErrorMessage(Messages.getString("ValgrindExportWizardPage.Err_No_Valgrind_run")); //$NON-NLS-1$ - } - else if (destText.getText().equals("")) { //$NON-NLS-1$ - setMessage(Messages.getString("ValgrindExportWizardPage.Msg_Select_destination")); //$NON-NLS-1$ - } - else { - IPath path = Path.fromOSString(destText.getText()); - if (!path.toFile().exists()) { - setErrorMessage(NLS.bind(Messages.getString("ValgrindExportWizardPage.Err_Dir_not_exist"), path.toOSString())); //$NON-NLS-1$ - } - else if (!path.toFile().isDirectory()) { - setErrorMessage(NLS.bind(Messages.getString("ValgrindExportWizardPage.Err_Not_dir"), path.toOSString())); //$NON-NLS-1$ - } - else { - outputPath = path; - valid = true; - } - } - - return valid; - } - - protected ValgrindLaunchPlugin getPlugin() { - return ValgrindLaunchPlugin.getDefault(); - } - - public CheckboxTableViewer getViewer() { - return viewer; - } - - public Text getDestText() { - return destText; - } - - public Button getSelectAllButton() { - return selectAllButton; - } - - public Button getDeselectAllButton() { - return deselectAllButton; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationDelegate.java deleted file mode 100644 index fa5c66ecdf..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationDelegate.java +++ /dev/null @@ -1,333 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Stack; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.launch.AbstractCLaunchDelegate; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult; -import org.eclipse.linuxtools.valgrind.core.CommandLineConstants; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.linuxtools.valgrind.core.ValgrindCommand; -import org.eclipse.linuxtools.valgrind.core.ValgrindCoreParser; -import org.eclipse.linuxtools.valgrind.core.ValgrindError; -import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.osgi.util.NLS; -import org.osgi.framework.Version; - -public class ValgrindLaunchConfigurationDelegate extends AbstractCLaunchDelegate { - - protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ - protected static final String NO = "no"; //$NON-NLS-1$ - protected static final String YES = "yes"; //$NON-NLS-1$ - protected static final String EQUALS = "="; //$NON-NLS-1$ - - protected static final String LOG_FILE = CommandLineConstants.LOG_PREFIX + "%p.txt"; //$NON-NLS-1$ - protected static final FileFilter LOG_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return pathname.getName().startsWith(CommandLineConstants.LOG_PREFIX); - } - }; - - protected String toolID; - protected ValgrindCommand command; - protected IPath outputPath; - protected IValgrindLaunchDelegate dynamicDelegate; - protected ILaunchConfiguration config; - protected ILaunch launch; - protected IProcess process; - protected String launchStr; - - public void launch(ILaunchConfiguration config, String mode, - ILaunch launch, IProgressMonitor m) throws CoreException { - if (m == null) { - m = new NullProgressMonitor(); - } - - SubMonitor monitor = SubMonitor.convert(m, Messages.getString("ValgrindLaunchConfigurationDelegate.Profiling_Local_CCPP_Application"), 10); //$NON-NLS-1$ - // check for cancellation - if (monitor.isCanceled()) { - return; - } - - this.config = config; - this.launch = launch; - try { - command = getValgrindCommand(); - - // remove any output from previous run - ValgrindUIPlugin.getDefault().resetView(); - // reset stored launch data - getPlugin().setCurrentLaunchConfiguration(null); - getPlugin().setCurrentLaunch(null); - - // find Valgrind binary if not already done - IPath valgrindLocation = getPlugin().getValgrindLocation(); - // also ensure Valgrind version is usable - getPlugin().getValgrindVersion(); - - monitor.worked(1); - IPath exePath = verifyProgramPath(config); - String[] arguments = getProgramArgumentsArray(config); - File workDir = getWorkingDirectory(config); - if (workDir == null) { - workDir = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // set output directory in config - setOutputPath(config); - outputPath = verifyOutputPath(config); - // create/empty output directory - createDirectory(outputPath); - - // tool that was launched - toolID = getTool(config); - // ask tool extension for arguments - dynamicDelegate = getDynamicDelegate(toolID); - String[] opts = getValgrindArgumentsArray(config); - - // set the default source locator if required - setDefaultSourceLocator(launch, config); - - ArrayList cmdLine = new ArrayList(1 + arguments.length); - cmdLine.add(valgrindLocation.toOSString()); - cmdLine.addAll(Arrays.asList(opts)); - cmdLine.add(exePath.toOSString()); - cmdLine.addAll(Arrays.asList(arguments)); - String[] commandArray = (String[]) cmdLine.toArray(new String[cmdLine.size()]); - boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT); - monitor.worked(1); - - // check for cancellation - if (monitor.isCanceled()) { - return; - } - // call Valgrind - command.execute(commandArray, getEnvironment(config), workDir, usePty); - monitor.worked(3); - process = createNewProcess(launch, command.getProcess() ,commandArray[0]); - // set the command line used - process.setAttribute(IProcess.ATTR_CMDLINE, command.getCommandLine()); - while (!process.isTerminated()) { - Thread.sleep(100); - } - - // store these for use by other classes - getPlugin().setCurrentLaunchConfiguration(config); - getPlugin().setCurrentLaunch(launch); - - // parse Valgrind logs - IValgrindMessage[] messages = parseLogs(outputPath); - - // create launch summary string to distinguish this launch - launchStr = createLaunchStr(); - - // create view - ValgrindUIPlugin.getDefault().createView(launchStr, toolID); - // set log messages - ValgrindUIPlugin.getDefault().getView().setMessages(messages); - monitor.worked(1); - - // pass off control to extender - dynamicDelegate.handleLaunch(config, launch, monitor.newChild(3)); - - // refresh view - ValgrindUIPlugin.getDefault().refreshView(); - - // show view - ValgrindUIPlugin.getDefault().showView(); - monitor.worked(1); - } catch (IOException e) { - abort(Messages.getString("ValgrindLaunchConfigurationDelegate.Error_starting_process"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$ - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } finally { - m.done(); - } - } - - protected IValgrindMessage[] parseLogs(IPath outputPath) throws IOException, CoreException { - List messages = new ArrayList(); - - for (File log : outputPath.toFile().listFiles(LOG_FILTER)) { - ValgrindCoreParser parser = new ValgrindCoreParser(log, launch); - IValgrindMessage[] results = parser.getMessages(); - messages.addAll(Arrays.asList(results)); - createMarkers(results); - } - - return messages.toArray(new IValgrindMessage[messages.size()]); - } - - protected void createMarkers(IValgrindMessage[] messages) throws CoreException, IOException { - // find the topmost stack frame within the workspace to annotate with marker - // traverse nested errors as well - Stack messageStack = new Stack(); - messageStack.addAll(Arrays.asList(messages)); - while (!messageStack.isEmpty()) { - IValgrindMessage message = messageStack.pop(); - IMarker marker = null; - IValgrindMessage[] children = message.getChildren(); - for (int i = 0; i < children.length; i++) { - // if we've found our marker we don't care about any further frames in this stack - if (children[i] instanceof ValgrindStackFrame && marker == null) { - ValgrindStackFrame frame = (ValgrindStackFrame) children[i]; - if (frame.getLine() > 0) { - ISourceLocator locator = frame.getLaunch().getSourceLocator(); - ISourceLookupResult result = DebugUITools.lookupSource(frame.getFile(), locator); - Object sourceElement = result.getSourceElement(); - - if (sourceElement != null && sourceElement instanceof IResource) { - IResource resource = (IResource) sourceElement; - marker = resource.createMarker(ValgrindLaunchPlugin.MARKER_TYPE); - marker.setAttribute(IMarker.MESSAGE, message.getText()); - marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); - marker.setAttribute(IMarker.LINE_NUMBER, frame.getLine()); - } - } - } - else if (children[i] instanceof ValgrindError) { - // nested error - messageStack.push(children[i]); - } - } - } - } - - protected IProcess createNewProcess(ILaunch launch, Process systemProcess, String programName) { - return DebugPlugin.newProcess(launch, systemProcess, renderProcessLabel(programName)); - } - - protected ValgrindCommand getValgrindCommand() { - return getPlugin().getValgrindCommand(); - } - - protected ValgrindLaunchPlugin getPlugin() { - return ValgrindLaunchPlugin.getDefault(); - } - - protected IValgrindLaunchDelegate getDynamicDelegate(String toolID) throws CoreException { - return getPlugin().getToolDelegate(toolID); - } - - protected IPath verifyOutputPath(ILaunchConfiguration config) throws CoreException { - IPath result = null; - String strPath = config.getAttribute(LaunchConfigurationConstants.ATTR_INTERNAL_OUTPUT_DIR, (String) null); - if (strPath != null) { - result = Path.fromPortableString(strPath); - } - if (result == null) { - abort(Messages.getString("ValgrindLaunchConfigurationDelegate.Retrieving_location_failed"), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$ - } - return result; - } - - protected void setOutputPath(ILaunchConfiguration config) throws CoreException, IOException { - IValgrindOutputDirectoryProvider provider = getPlugin().getOutputDirectoryProvider(); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(LaunchConfigurationConstants.ATTR_INTERNAL_OUTPUT_DIR, provider.getOutputPath().toPortableString()); - wc.doSave(); - } - - protected void createDirectory(IPath path) throws IOException { - File outputDir = path.toFile(); - - if (outputDir.exists()) { - // delete any preexisting files - for (File outputFile : outputDir.listFiles()) { - if (outputFile.isFile() && !outputFile.delete()) { - throw new IOException(NLS.bind(Messages.getString("ValgrindOutputDirectory.Couldnt_delete"), outputFile.getAbsolutePath())); //$NON-NLS-1$ - } - } - } - else if (!outputDir.mkdir()) { - throw new IOException(NLS.bind(Messages.getString("ValgrindOutputDirectory.Couldnt_create"), outputDir.getAbsolutePath())); //$NON-NLS-1$ - } - } - - protected String createLaunchStr() { - return config.getName() + " [" + getPlugin().getToolName(toolID) + "] " + process.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected String[] getValgrindArgumentsArray(ILaunchConfiguration config) throws CoreException, IOException { - ArrayList opts = new ArrayList(); - opts.add(CommandLineConstants.OPT_TOOL + EQUALS + getPlugin().getToolName(toolID)); - opts.add(CommandLineConstants.OPT_QUIET); // suppress uninteresting output - opts.add(CommandLineConstants.OPT_LOGFILE + EQUALS + outputPath.append(LOG_FILE).toOSString()); - - opts.add(CommandLineConstants.OPT_TRACECHILD + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, LaunchConfigurationConstants.DEFAULT_GENERAL_TRACECHILD) ? YES : NO)); - opts.add(CommandLineConstants.OPT_CHILDSILENT + EQUALS + YES); // necessary for parsing - opts.add(CommandLineConstants.OPT_FREERES + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, LaunchConfigurationConstants.DEFAULT_GENERAL_FREERES) ? YES : NO)); - - opts.add(CommandLineConstants.OPT_DEMANGLE + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, LaunchConfigurationConstants.DEFAULT_GENERAL_DEMANGLE) ? YES : NO)); - opts.add(CommandLineConstants.OPT_NUMCALLERS + EQUALS + config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, LaunchConfigurationConstants.DEFAULT_GENERAL_NUMCALLERS)); - opts.add(CommandLineConstants.OPT_ERRLIMIT + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, LaunchConfigurationConstants.DEFAULT_GENERAL_ERRLIMIT) ? YES : NO)); - opts.add(CommandLineConstants.OPT_BELOWMAIN + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, LaunchConfigurationConstants.DEFAULT_GENERAL_BELOWMAIN) ? YES : NO)); - opts.add(CommandLineConstants.OPT_MAXFRAME + EQUALS + config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, LaunchConfigurationConstants.DEFAULT_GENERAL_MAXFRAME)); - - // 3.4.0 specific - Version ver = getPlugin().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - boolean useMainStack = config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK_BOOL, LaunchConfigurationConstants.DEFAULT_GENERAL_MAINSTACK_BOOL); - if (useMainStack) { - opts.add(CommandLineConstants.OPT_MAINSTACK + EQUALS + config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK, LaunchConfigurationConstants.DEFAULT_GENERAL_MAINSTACK)); - } - } - - String strpath = config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILE); - if (!strpath.equals(EMPTY_STRING)) { - IPath suppfile = getPlugin().parseWSPath(strpath); - if (suppfile != null) { - opts.add(CommandLineConstants.OPT_SUPPFILE + EQUALS + suppfile.toOSString()); - } - } - - opts.addAll(Arrays.asList(dynamicDelegate.getCommandArray(config))); - - String[] ret = new String[opts.size()]; - return opts.toArray(ret); - } - - protected String getTool(ILaunchConfiguration config) throws CoreException { - return config.getAttribute(LaunchConfigurationConstants.ATTR_TOOL, LaunchConfigurationConstants.DEFAULT_TOOL); - } - - @Override - protected String getPluginID() { - return ValgrindLaunchPlugin.PLUGIN_ID; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationTabGroup.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationTabGroup.java deleted file mode 100644 index 85123636b4..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchConfigurationTabGroup.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup; - -public class ValgrindLaunchConfigurationTabGroup extends - ProfileLaunchConfigurationTabGroup { - - @Override - public AbstractLaunchConfigurationTab[] getProfileTabs() { - return new AbstractLaunchConfigurationTab[] { - new ValgrindOptionsTab() - }; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchPlugin.java deleted file mode 100644 index 2b357cea55..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchPlugin.java +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - * Patrick Hofer (Noser Engineering AG) - fix for Bug 275685 - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Set; - -import org.eclipse.cdt.launch.LaunchUtils; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.core.PluginConstants; -import org.eclipse.linuxtools.valgrind.core.ValgrindCommand; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Version; - -public class ValgrindLaunchPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = PluginConstants.LAUNCH_PLUGIN_ID; - public static final String LAUNCH_ID = PLUGIN_ID + ".valgrindLaunch"; //$NON-NLS-1$ - public static final String MARKER_TYPE = PLUGIN_ID + ".marker"; //$NON-NLS-1$ - - // Extension point constants - protected static final String EXT_ELEMENT_TOOL = "tool"; //$NON-NLS-1$ - protected static final String EXT_ATTR_NAME = "name"; //$NON-NLS-1$ - protected static final String EXT_ATTR_ID = "id"; //$NON-NLS-1$ - protected static final String EXT_ATTR_PAGE = "page"; //$NON-NLS-1$ - protected static final String EXT_ATTR_DELEGATE = "delegate"; //$NON-NLS-1$ - - protected static final String EXT_ELEMENT_PROVIDER = "provider"; //$NON-NLS-1$ - protected static final String EXT_ATTR_CLASS = "class"; //$NON-NLS-1$ - - public static final Version VER_3_3_0 = new Version(3, 3, 0); - public static final Version VER_3_3_1 = new Version(3, 3, 1); - public static final Version VER_3_4_0 = new Version(3, 4, 0); - public static final Version VER_3_4_1 = new Version(3, 4, 1); - private static final Version MIN_VER = VER_3_3_0; - private static final String VERSION_PREFIX = "valgrind-"; //$NON-NLS-1$ - private static final char VERSION_DELIMITER = '-'; - - protected HashMap toolMap; - - private ValgrindCommand valgrindCommand; - private IPath valgrindLocation; - private Version valgrindVersion; - private ILaunchConfiguration config; - private ILaunch launch; - - // The shared instance - private static ValgrindLaunchPlugin plugin; - - /** - * The constructor - */ - public ValgrindLaunchPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static ValgrindLaunchPlugin getDefault() { - return plugin; - } - - public IPath getValgrindLocation() throws CoreException { - if (valgrindLocation == null) { - findValgrindLocation(); - } - return valgrindLocation; - } - - public void setValgrindLocation(IPath valgrindLocation) { - this.valgrindLocation = valgrindLocation; - } - - public Version getValgrindVersion() throws CoreException { - if (valgrindVersion == null) { - findValgrindVersion(); - } - // check for minimum supported version - if (valgrindVersion.compareTo(MIN_VER) < 0) { - throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, NLS.bind(Messages.getString("ValgrindLaunchPlugin.Error_min_version"), valgrindVersion.toString(), MIN_VER.toString()))); //$NON-NLS-1$ - } - return valgrindVersion; - } - - public void setValgrindVersion(Version valgrindVersion) { - this.valgrindVersion = valgrindVersion; - } - - private void findValgrindLocation() throws CoreException { - try { - valgrindLocation = Path.fromOSString(getValgrindCommand().whichValgrind()); - } catch (IOException e) { - IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, Messages.getString("ValgrindLaunchPlugin.Please_ensure_Valgrind"), e); //$NON-NLS-1$ - throw new CoreException(status); - } - } - - private void findValgrindVersion() throws CoreException { - try { - if (valgrindLocation == null) { - findValgrindLocation(); - } - - String verString = getValgrindCommand().whichVersion(valgrindLocation.toOSString()); - verString = verString.replace(VERSION_PREFIX, ""); //$NON-NLS-1$ - if (verString.indexOf(VERSION_DELIMITER) > 0) { - verString = verString.substring(0, verString.indexOf(VERSION_DELIMITER)); - } - if (verString.length() > 0) { - valgrindVersion = Version.parseVersion(verString); - } - else { - throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, NLS.bind(Messages.getString("ValgrindLaunchPlugin.Couldn't_determine_version"), valgrindLocation))); //$NON-NLS-1$ - } - } catch (IOException e) { - IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, NLS.bind(Messages.getString("ValgrindLaunchPlugin.Couldn't_determine_version"), valgrindLocation), e); //$NON-NLS-1$ - throw new CoreException(status); - } - } - - public void setValgrindCommand(ValgrindCommand command) { - valgrindCommand = command; - } - - protected ValgrindCommand getValgrindCommand() { - if (valgrindCommand == null) { - valgrindCommand = new ValgrindCommand(); - } - return valgrindCommand; - } - - public String[] getRegisteredToolIDs() { - Set ids = getToolMap().keySet(); - return ids.toArray(new String[ids.size()]); - } - - public String getToolName(String id) { - String name = null; - IConfigurationElement config = getToolMap().get(id); - if (config != null) { - name = config.getAttribute(EXT_ATTR_NAME); - } - return name; - } - - public IValgrindToolPage getToolPage(String id) throws CoreException { - IValgrindToolPage tab = null; - IConfigurationElement config = getToolMap().get(id); - if (config != null) { - Object obj = config.createExecutableExtension(EXT_ATTR_PAGE); - if (obj instanceof IValgrindToolPage) { - tab = (IValgrindToolPage) obj; - } - } - if (tab == null) { - throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, Messages.getString("ValgrindLaunchPlugin.Cannot_retrieve_page"))); //$NON-NLS-1$ - } - return tab; - } - - public IValgrindLaunchDelegate getToolDelegate(String id) throws CoreException { - IValgrindLaunchDelegate delegate = null; - IConfigurationElement config = getToolMap().get(id); - if (config != null) { - Object obj = config.createExecutableExtension(EXT_ATTR_DELEGATE); - if (obj instanceof IValgrindLaunchDelegate) { - delegate = (IValgrindLaunchDelegate) obj; - } - } - if (delegate == null) { - throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, Messages.getString("ValgrindLaunchPlugin.Cannot_retrieve_delegate"))); //$NON-NLS-1$ - } - return delegate; - } - - public IValgrindOutputDirectoryProvider getOutputDirectoryProvider() throws CoreException { - IValgrindOutputDirectoryProvider provider = null; - IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, PluginConstants.OUTPUT_DIR_EXT_ID); - - // if we find more than one provider just take the first one - IConfigurationElement[] configs = extPoint.getConfigurationElements(); - for (int i = 0; i < configs.length && provider == null; i++) { - IConfigurationElement config = configs[i]; - if (config.getName().equals(EXT_ELEMENT_PROVIDER)) { - Object obj = config.createExecutableExtension(EXT_ATTR_CLASS); - if (obj instanceof IValgrindOutputDirectoryProvider) { - provider = (IValgrindOutputDirectoryProvider) obj; - } - } - } - - // if no extender, use default - if (provider == null) { - provider = new ValgrindOutputDirectoryProvider(); - } - - return provider; - } - - public void setCurrentLaunchConfiguration(ILaunchConfiguration config) { - this.config = config; - } - - /** - * @return ILaunchConfiguration associated with Valgrind execution - * currently displayed in the Valgrind view. - */ - public ILaunchConfiguration getCurrentLaunchConfiguration() { - return config; - } - - public void setCurrentLaunch(ILaunch launch) { - this.launch = launch; - } - - /** - * @return ILaunch associated with Valgrind execution currently displayed - * in the Valgrind view. - */ - public ILaunch getCurrentLaunch() { - return launch; - } - - IPath parseWSPath(String strpath) throws CoreException { - strpath = LaunchUtils.getStringVariableManager().performStringSubstitution(strpath, false); - IPath path = new Path(strpath); - if (!path.isAbsolute()) { - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - if (res != null) { - path = res.getLocation(); - } - } - return path; - } - - protected void initializeToolMap() { - toolMap = new HashMap(); - IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, PluginConstants.TOOL_EXT_ID); - IConfigurationElement[] configs = extPoint.getConfigurationElements(); - for (IConfigurationElement config : configs) { - if (config.getName().equals(EXT_ELEMENT_TOOL)) { - String id = config.getAttribute(EXT_ATTR_ID); - if (id != null && config.getAttribute(EXT_ATTR_NAME) != null - && config.getAttribute(EXT_ATTR_PAGE) != null - && config.getAttribute(EXT_ATTR_DELEGATE) != null) { - toolMap.put(id, config); - } - } - } - } - - protected HashMap getToolMap() { - if (toolMap == null) { - initializeToolMap(); - } - return toolMap; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java deleted file mode 100644 index 01e422c7f0..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindLaunchShortcut.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut; -import org.eclipse.linuxtools.valgrind.core.PluginConstants; - -public class ValgrindLaunchShortcut extends ProfileLaunchShortcut { - - - protected void setDefaultProfileAttributes( - ILaunchConfigurationWorkingCopy wc) throws CoreException { - ValgrindOptionsTab tab = new ValgrindOptionsTab(); - tab.setDefaults(wc); - ILaunchConfigurationTab defaultTab = ValgrindLaunchPlugin.getDefault().getToolPage(PluginConstants.TOOL_EXT_DEFAULT); - defaultTab.setDefaults(wc); - } - - /** - * Method getValgrindLaunchConfigType. - * @return ILaunchConfigurationType - */ - protected ILaunchConfigurationType getLaunchConfigType() { - return getLaunchManager().getLaunchConfigurationType(ValgrindLaunchPlugin.LAUNCH_ID); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java deleted file mode 100644 index 9c7bdbf8c4..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java +++ /dev/null @@ -1,635 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; -import org.eclipse.ui.views.navigator.ResourceComparator; -import org.osgi.framework.Version; - -public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { - protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - // General controls - protected Button traceChildrenButton; - protected Button childSilentButton; - protected Button runFreeresButton; - - protected Button demangleButton; - protected Spinner numCallersSpinner; - protected Button errorLimitButton; - protected Button showBelowMainButton; - protected Spinner maxStackFrameSpinner; - protected Button mainStackSizeButton; - protected Spinner mainStackSizeSpinner; - protected Text suppFileText; - - protected String tool; - protected String[] tools; - - protected Composite top; - protected ScrolledComposite scrollTop; - protected Combo toolsCombo; - protected TabFolder optionsFolder; - protected TabItem toolTab; - - protected ILaunchConfigurationWorkingCopy launchConfigurationWorkingCopy; - protected ILaunchConfiguration launchConfiguration; - - protected IValgrindToolPage dynamicTab; - protected Composite dynamicTabHolder; - - protected boolean isInitializing = false; - protected boolean initDefaults = false; - - protected IPath valgrindLocation; - protected Version valgrindVersion; - protected Exception ex; - - protected SelectionListener selectListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }; - protected ModifyListener modifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }; - - public void createControl(Composite parent) { - scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); - scrollTop.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - scrollTop.setExpandVertical(true); - scrollTop.setExpandHorizontal(true); - - setControl(scrollTop); - - top = new Composite(scrollTop, SWT.NONE); - top.setLayout(new GridLayout()); - - createVerticalSpacer(top, 1); - - createToolCombo(top); - - createVerticalSpacer(top, 1); - - optionsFolder = new TabFolder(top, SWT.BORDER); - optionsFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); - - // "general" tab - TabItem generalTab = new TabItem(optionsFolder, SWT.NONE); - generalTab.setText(Messages.getString("ValgrindOptionsTab.General")); //$NON-NLS-1$ - - Composite generalTop = new Composite(optionsFolder, SWT.NONE); - generalTop.setLayout(new GridLayout()); - generalTop.setLayoutData(new GridData(GridData.FILL_BOTH)); - - createBasicOptions(generalTop); - - createVerticalSpacer(generalTop, 1); - - createErrorOptions(generalTop); - - generalTab.setControl(generalTop); - - TabItem suppTab = new TabItem(optionsFolder, SWT.NONE); - suppTab.setText(Messages.getString("ValgrindOptionsTab.Suppressions")); //$NON-NLS-1$ - - Composite suppTop = new Composite(optionsFolder, SWT.NONE); - suppTop.setLayout(new GridLayout()); - suppTop.setLayoutData(new GridData(GridData.FILL_BOTH)); - - createSuppressionsOption(suppTop); - - suppTab.setControl(suppTop); - - toolTab = new TabItem(optionsFolder, SWT.NONE); - toolTab.setText(Messages.getString("ValgrindOptionsTab.Tool")); //$NON-NLS-1$ - - dynamicTabHolder = new Composite(optionsFolder, SWT.NONE); - dynamicTabHolder.setLayout(new GridLayout()); - dynamicTabHolder.setLayoutData(new GridData(GridData.FILL_BOTH)); - - toolTab.setControl(dynamicTabHolder); - - scrollTop.setContent(top); - recomputeSize(); - } - - protected void recomputeSize() { - Point point = top.computeSize(SWT.DEFAULT, SWT.DEFAULT); - top.setSize(point); - scrollTop.setMinSize(point); - } - - private void createToolCombo(Composite top) { - Composite comboTop = new Composite(top, SWT.NONE); - comboTop.setLayout(new GridLayout(2, false)); - Label toolLabel = new Label(comboTop, SWT.NONE); - toolLabel.setText(Messages.getString("ValgrindOptionsTab.Tool_to_run")); //$NON-NLS-1$ - toolsCombo = new Combo(comboTop, SWT.READ_ONLY); - tools = getPlugin().getRegisteredToolIDs(); - - String[] names = new String[tools.length]; - for (int i = 0; i < names.length; i++) { - names[i] = capitalize(getPlugin().getToolName(tools[i])); - } - toolsCombo.setItems(names); - - toolsCombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - // user selected change, set defaults in new tool - if (!isInitializing) { - initDefaults = true; - int ix = toolsCombo.getSelectionIndex(); - tool = tools[ix]; - handleToolChanged(); - updateLaunchConfigurationDialog(); - } - } - }); - } - - private String capitalize(String str) { - if (str.length() > 0) { - char[] buf = str.toCharArray(); - buf[0] = Character.toUpperCase(buf[0]); - - str = String.valueOf(buf); - } - return str; - } - - protected void createBasicOptions(Composite top) { - Group basicGroup = new Group(top, SWT.NONE); - basicGroup.setLayout(new GridLayout()); - basicGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - basicGroup.setText(Messages.getString("ValgrindOptionsTab.Basic_Options")); //$NON-NLS-1$ - - Composite basicTop = new Composite(basicGroup, SWT.NONE); - basicTop.setLayout(new GridLayout(2, true)); - basicTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - traceChildrenButton = new Button(basicTop, SWT.CHECK); - traceChildrenButton.setText(Messages.getString("ValgrindOptionsTab.trace_children")); //$NON-NLS-1$ - traceChildrenButton.addSelectionListener(selectListener); - traceChildrenButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Must be on to prevent mangled XML output - childSilentButton = new Button(basicTop, SWT.CHECK); - childSilentButton.setText(Messages.getString("ValgrindOptionsTab.child_silent")); //$NON-NLS-1$ - childSilentButton.setSelection(true); - childSilentButton.setEnabled(false); - childSilentButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - runFreeresButton = new Button(basicTop, SWT.CHECK); - runFreeresButton.setText(Messages.getString("ValgrindOptionsTab.run_freeres")); //$NON-NLS-1$ - runFreeresButton.addSelectionListener(selectListener); - runFreeresButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - protected void createErrorOptions(Composite top) { - Group errorGroup = new Group(top, SWT.NONE); - errorGroup.setLayout(new GridLayout()); - errorGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - errorGroup.setText(Messages.getString("ValgrindOptionsTab.Error_Options")); //$NON-NLS-1$ - - Composite errorTop = new Composite(errorGroup, SWT.NONE); - errorTop.setLayout(new GridLayout(2, true)); - errorTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - demangleButton = new Button(errorTop, SWT.CHECK); - demangleButton.setText(Messages.getString("ValgrindOptionsTab.demangle")); //$NON-NLS-1$ - demangleButton.addSelectionListener(selectListener); - demangleButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Composite numCallersTop = new Composite(errorTop, SWT.NONE); - numCallersTop.setLayout(new GridLayout(2, false)); - Label numCallersLabel = new Label(numCallersTop, SWT.NONE); - numCallersLabel.setText(Messages.getString("ValgrindOptionsTab.num_callers")); //$NON-NLS-1$ - numCallersSpinner = new Spinner(numCallersTop, SWT.BORDER); - numCallersSpinner.setMaximum(50); - numCallersSpinner.addModifyListener(modifyListener); - numCallersSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - errorLimitButton = new Button(errorTop, SWT.CHECK); - errorLimitButton.setText(Messages.getString("ValgrindOptionsTab.limit_errors")); //$NON-NLS-1$ - errorLimitButton.addSelectionListener(selectListener); - errorLimitButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - showBelowMainButton = new Button(errorTop, SWT.CHECK); - showBelowMainButton.setText(Messages.getString("ValgrindOptionsTab.show_errors_below_main")); //$NON-NLS-1$ - showBelowMainButton.addSelectionListener(selectListener); - showBelowMainButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Composite maxStackFrameTop = new Composite(errorTop, SWT.NONE); - maxStackFrameTop.setLayout(new GridLayout(2, false)); - Label maxStackFrameLabel = new Label(maxStackFrameTop, SWT.NONE); - maxStackFrameLabel.setText(Messages.getString("ValgrindOptionsTab.max_size_of_stack_frame")); //$NON-NLS-1$ - maxStackFrameSpinner = new Spinner(maxStackFrameTop, SWT.BORDER); - maxStackFrameSpinner.setMaximum(Integer.MAX_VALUE); - maxStackFrameSpinner.addModifyListener(modifyListener); - maxStackFrameSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // 3.4.0 specific - try { - Version ver = getPlugin().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - Composite mainStackSizeTop = new Composite(errorTop, SWT.NONE); - GridLayout mainStackSizeLayout = new GridLayout(2, false); - mainStackSizeLayout.marginHeight = mainStackSizeLayout.marginWidth = 0; - mainStackSizeTop.setLayout(mainStackSizeLayout); - mainStackSizeButton = new Button(mainStackSizeTop, SWT.CHECK); - mainStackSizeButton.setText(Messages.getString("ValgrindOptionsTab.Main_stack_size")); //$NON-NLS-1$ - mainStackSizeButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - checkMainStackEnablement(); - updateLaunchConfigurationDialog(); - } - }); - mainStackSizeSpinner = new Spinner(mainStackSizeTop, SWT.BORDER); - mainStackSizeSpinner.setMaximum(Integer.MAX_VALUE); - mainStackSizeSpinner.addModifyListener(modifyListener); - mainStackSizeSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - } catch (CoreException e) { - ex = e; - } - } - - protected void createSuppressionsOption(Composite top) { - Composite browseTop = new Composite(top, SWT.NONE); - browseTop.setLayout(new GridLayout(4, false)); - GridData browseData = new GridData(GridData.FILL_HORIZONTAL); - browseTop.setLayoutData(browseData); - - Label suppFileLabel = new Label(browseTop, SWT.NONE); - suppFileLabel.setText(Messages.getString("ValgrindOptionsTab.suppressions_file")); //$NON-NLS-1$ - - suppFileText = new Text(browseTop, SWT.BORDER); - suppFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - suppFileText.addModifyListener(modifyListener); - - Button workspaceBrowseButton = createPushButton(browseTop, Messages.getString("ValgrindOptionsTab.Workspace"), null); //$NON-NLS-1$ - workspaceBrowseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); - dialog.setTitle(Messages.getString("ValgrindOptionsTab.Select_a_Resource")); //$NON-NLS-1$ - dialog.setMessage(Messages.getString("ValgrindOptionsTab.Select_a_Suppressions_File")); //$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(); - String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$ - suppFileText.setText(fileLoc); - } - } - }); - Button fileBrowseButton = createPushButton(browseTop, Messages.getString("ValgrindOptionsTab.File_System"), null); //$NON-NLS-1$ - fileBrowseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - String filePath = suppFileText.getText(); - FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); - filePath = dialog.open(); - if (filePath != null) { - suppFileText.setText(filePath); - } - } - }); - } - - protected void handleToolChanged() { - try { - // create dynamicTab - loadDynamicArea(); - - if (launchConfigurationWorkingCopy == null) { - if (launchConfiguration.isWorkingCopy()) { - launchConfigurationWorkingCopy = (ILaunchConfigurationWorkingCopy) launchConfiguration; - } else { - launchConfigurationWorkingCopy = launchConfiguration.getWorkingCopy(); - } - } - - // setDefaults called on this tab so call on dynamicTab OR - // user changed tool, not just restoring state - if (initDefaults) { - dynamicTab.setDefaults(launchConfigurationWorkingCopy); - } - initDefaults = false; - dynamicTab.initializeFrom(launchConfigurationWorkingCopy); - - // change name of tool TabItem - toolTab.setText(dynamicTab.getName()); - optionsFolder.layout(true); - - // adjust minimum size for ScrolledComposite - recomputeSize(); - } catch (CoreException e) { - ex = e; - } - } - - private void loadDynamicArea() throws CoreException { - for (Control child : dynamicTabHolder.getChildren()) { - child.dispose(); - } - - loadDynamicTab(); - if (dynamicTab == null) { - throw new CoreException(new Status(IStatus.ERROR, ValgrindLaunchPlugin.PLUGIN_ID, Messages.getString("ValgrindOptionsTab.No_options_tab_found") + tool)); //$NON-NLS-1$ - } - dynamicTab.setLaunchConfigurationDialog(getLaunchConfigurationDialog()); - dynamicTab.createControl(dynamicTabHolder); - - dynamicTabHolder.layout(true); - } - - private void loadDynamicTab() throws CoreException { - dynamicTab = getPlugin().getToolPage(tool); - } - - public IValgrindToolPage getDynamicTab() { - return dynamicTab; - } - - protected ValgrindLaunchPlugin getPlugin() { - return ValgrindLaunchPlugin.getDefault(); - } - - public String getName() { - return Messages.getString("ValgrindOptionsTab.Valgrind_Options"); //$NON-NLS-1$ - } - - @Override - public Image getImage() { - return ValgrindLaunchPlugin.imageDescriptorFromPlugin(ValgrindLaunchPlugin.PLUGIN_ID, "icons/valgrind-icon.png").createImage(); //$NON-NLS-1$ - } - - public void initializeFrom(ILaunchConfiguration configuration) { - isInitializing = true; - getControl().setRedraw(false); - launchConfiguration = configuration; - launchConfigurationWorkingCopy = null; - - try { - tool = configuration.getAttribute(LaunchConfigurationConstants.ATTR_TOOL, LaunchConfigurationConstants.DEFAULT_TOOL); - int select = -1; - for (int i = 0; i < tools.length && select < 0; i++) { - if (tool.equals(tools[i])) { - select = i; - } - } - - if (select != -1) { - toolsCombo.select(select); - } - handleToolChanged(); - - traceChildrenButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, LaunchConfigurationConstants.DEFAULT_GENERAL_TRACECHILD)); - runFreeresButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, LaunchConfigurationConstants.DEFAULT_GENERAL_FREERES)); - demangleButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, LaunchConfigurationConstants.DEFAULT_GENERAL_DEMANGLE)); - numCallersSpinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, LaunchConfigurationConstants.DEFAULT_GENERAL_NUMCALLERS)); - errorLimitButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, LaunchConfigurationConstants.DEFAULT_GENERAL_ERRLIMIT)); - showBelowMainButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, LaunchConfigurationConstants.DEFAULT_GENERAL_BELOWMAIN)); - maxStackFrameSpinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, LaunchConfigurationConstants.DEFAULT_GENERAL_MAXFRAME)); - suppFileText.setText(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILE)); - - // 3.4.0 specific - Version ver = getPlugin().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - mainStackSizeButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK_BOOL, LaunchConfigurationConstants.DEFAULT_GENERAL_MAINSTACK_BOOL)); - mainStackSizeSpinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK, LaunchConfigurationConstants.DEFAULT_GENERAL_MAINSTACK)); - checkMainStackEnablement(); - } - } catch (CoreException e) { - ex = e; - } - getControl().setRedraw(true); - isInitializing = false; - } - - @Override - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - - boolean result = false; - if (ex != null) { - setErrorMessage(ex.getLocalizedMessage()); - } - else if (result = isGeneralValid() && dynamicTab != null) { - result = dynamicTab.isValid(launchConfig); - setErrorMessage(dynamicTab.getErrorMessage()); - } - return result; - } - - private boolean isGeneralValid() { - String strpath = suppFileText.getText(); - boolean result = false; - if (strpath.equals(EMPTY_STRING)) { - result = true; - } - else { - try { - IPath suppfile = getPlugin().parseWSPath(strpath); - if (suppfile.toFile().exists()) { - result = true; - } - } catch (CoreException e) { - // should only occur if there's a cycle in variable substitution - e.printStackTrace(); - } - } - - if (!result) { - setErrorMessage(NLS.bind(Messages.getString("ValgrindOptionsTab.suppressions_file_doesnt_exist"), strpath)); //$NON-NLS-1$ - } - return result; - } - - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(LaunchConfigurationConstants.ATTR_TOOL, tool); - - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, traceChildrenButton.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, runFreeresButton.getSelection()); - - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, demangleButton.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, numCallersSpinner.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, errorLimitButton.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, showBelowMainButton.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, maxStackFrameSpinner.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, suppFileText.getText()); - - // 3.4.0 specific - try { - Version ver = getPlugin().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK_BOOL, mainStackSizeButton.getSelection()); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK, mainStackSizeSpinner.getSelection()); - } - } catch (CoreException e) { - ex = e; - } - if (dynamicTab != null) { - dynamicTab.performApply(configuration); - } - } - - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - launchConfigurationWorkingCopy = configuration; - - configuration.setAttribute(LaunchConfigurationConstants.ATTR_TOOL, LaunchConfigurationConstants.DEFAULT_TOOL); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, LaunchConfigurationConstants.DEFAULT_GENERAL_TRACECHILD); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, LaunchConfigurationConstants.DEFAULT_GENERAL_FREERES); - - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, LaunchConfigurationConstants.DEFAULT_GENERAL_DEMANGLE); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, LaunchConfigurationConstants.DEFAULT_GENERAL_NUMCALLERS); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, LaunchConfigurationConstants.DEFAULT_GENERAL_ERRLIMIT); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, LaunchConfigurationConstants.DEFAULT_GENERAL_BELOWMAIN); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, LaunchConfigurationConstants.DEFAULT_GENERAL_MAXFRAME); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, LaunchConfigurationConstants.DEFAULT_GENERAL_SUPPFILE); - - // 3.4.0 specific - try { - Version ver = getPlugin().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK_BOOL, LaunchConfigurationConstants.DEFAULT_GENERAL_MAINSTACK_BOOL); - configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAINSTACK, LaunchConfigurationConstants.DEFAULT_GENERAL_MAINSTACK); - } - } catch (CoreException e) { - ex = e; - } - - if (dynamicTab != null) { - dynamicTab.setDefaults(configuration); - initDefaults = false; - } - } - - @Override - public void dispose() { - if (dynamicTab != null) { - dynamicTab.dispose(); - } - super.dispose(); - } - - protected void createHorizontalSpacer(Composite comp, int numlines) { - Label lbl = new Label(comp, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = numlines; - lbl.setLayoutData(gd); - } - - @Override - protected void updateLaunchConfigurationDialog() { - if (!isInitializing) { - super.updateLaunchConfigurationDialog(); - } - } - - private void checkMainStackEnablement() { - mainStackSizeSpinner.setEnabled(mainStackSizeButton.getSelection()); - } - - public Button getTraceChildrenButton() { - return traceChildrenButton; - } - - public Button getChildSilentButton() { - return childSilentButton; - } - - public Button getRunFreeresButton() { - return runFreeresButton; - } - - public Button getDemangleButton() { - return demangleButton; - } - - public Spinner getNumCallersSpinner() { - return numCallersSpinner; - } - - public Button getErrorLimitButton() { - return errorLimitButton; - } - - public Button getShowBelowMainButton() { - return showBelowMainButton; - } - - public Spinner getMaxStackFrameSpinner() { - return maxStackFrameSpinner; - } - - public Button getMainStackSizeButton() { - return mainStackSizeButton; - } - - public Spinner getMainStackSizeSpinner() { - return mainStackSizeSpinner; - } - - public Text getSuppFileText() { - return suppFileText; - } - - public Combo getToolsCombo() { - return toolsCombo; - } - - public String[] getTools() { - return tools; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOutputDirectoryProvider.java b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOutputDirectoryProvider.java deleted file mode 100644 index 53ac9a32e9..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOutputDirectoryProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.launch; - -import java.io.IOException; - -import org.eclipse.core.runtime.IPath; - -public class ValgrindOutputDirectoryProvider implements IValgrindOutputDirectoryProvider { - protected IPath outputPath; - - public ValgrindOutputDirectoryProvider() { - outputPath = ValgrindLaunchPlugin.getDefault().getStateLocation(); - } - - /* (non-Javadoc) - * @see org.eclipse.linuxtools.valgrind.launch.IValgrindOutputDirectoryProvider#getOutputPath() - */ - public IPath getOutputPath() throws IOException { - return outputPath; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/messages.properties deleted file mode 100644 index 4a9c1e2e0e..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/messages.properties +++ /dev/null @@ -1,54 +0,0 @@ -ExportWizardConstants.Window_title=Export -ExportWizardConstants.Wizard_desc=Export Valgrind's output logs from a recent launch to the file system. -ExportWizardConstants.Wizard_title=Valgrind Log Files -ValgrindExportWizard.Export_fail=Problems were encountered during export. -ValgrindExportWizard.Export_subtask=Copying {0} -ValgrindExportWizard.Export_task=Copying Valgrind output logs to {0} -ValgrindExportWizard.Page_name=Export Page -ValgrindExportWizardPage.Browse=Browse... -ValgrindExportWizardPage.Deselect_all=&Deselect All -ValgrindExportWizardPage.Destination_group=Destination directory -ValgrindExportWizardPage.Err_Dir_not_exist=Directory {0} does not exist. -ValgrindExportWizardPage.Err_No_Valgrind_run=No Valgrind run available. -ValgrindExportWizardPage.Err_Not_dir={0} is not a directory. -ValgrindExportWizardPage.Msg_Select_destination=Select a destination for files. -ValgrindExportWizardPage.Select_all=&Select All -ValgrindExportWizardPage.Viewer_label=Log files to export: -ValgrindLaunchConfigurationDelegate.Error_starting_process=Error starting process -ValgrindLaunchConfigurationDelegate.Launch_unsuccessful=Valgrind launch unsuccessful. Check console for details. -ValgrindLaunchConfigurationDelegate.Profiling_Local_CCPP_Application=Profiling Local C/C++ Application -ValgrindLaunchConfigurationDelegate.Saving_Valgrind_output=Saving Valgrind output -ValgrindLaunchConfigurationDelegate.Select_Destination=Select Destination -ValgrindLaunchConfigurationDelegate.Retrieving_location_failed=Retrieving location of output directory failed -ValgrindLaunchConfigurationDelegate.Valgrind_error_msg=Valgrind encountered an error during execution. -ValgrindLaunchConfigurationDelegate.Valgrind_error_title=Valgrind Error -ValgrindLaunchPlugin.Cannot_retrieve_delegate=Cannot retrieve delegate from extension -ValgrindLaunchPlugin.Cannot_retrieve_page=Cannot retrieve page from extension -ValgrindLaunchPlugin.Please_ensure_Valgrind=Please ensure Valgrind is installed and in your path. -ValgrindLaunchPlugin.Couldn't_determine_version=Couldn't determine version of Valgrind located at {0}. -ValgrindLaunchPlugin.Error_min_version=The installed Valgrind ({0}) is older than the minimum supported version ({1}). -ValgrindOptionsTab.Basic_Options=Basic Options -ValgrindOptionsTab.child_silent=Child silent after fork -ValgrindOptionsTab.demangle=Demangle C++ names -ValgrindOptionsTab.Error_Options=Error Options -ValgrindOptionsTab.File_System=File Syste&m... -ValgrindOptionsTab.General=General Options -ValgrindOptionsTab.limit_errors=Limit errors reported -ValgrindOptionsTab.Main_stack_size=Set main thread's stack size (B): -ValgrindOptionsTab.max_size_of_stack_frame=Max stack frame size (B): -ValgrindOptionsTab.No_options_tab_found=No options tab found for tool -ValgrindOptionsTab.num_callers=Callers in stack trace: -ValgrindOptionsTab.run_freeres=Run __libc_freeres on exit -ValgrindOptionsTab.Select_a_Resource=Select a Resource: -ValgrindOptionsTab.Select_a_Suppressions_File=Select a Suppressions File: -ValgrindOptionsTab.Suppressions=Suppressions -ValgrindOptionsTab.show_errors_below_main=Show errors below main -ValgrindOptionsTab.suppressions_file=Suppressions file: -ValgrindOptionsTab.suppressions_file_doesnt_exist=Suppressions file: {0} doesn't exist. -ValgrindOptionsTab.Tool=Tool -ValgrindOptionsTab.Tool_to_run=Tool to run: -ValgrindOptionsTab.trace_children=Trace children on exec -ValgrindOptionsTab.Valgrind_Options=Valgrind Options -ValgrindOptionsTab.Workspace=&Workspace... -ValgrindOutputDirectory.Couldnt_create=Couldn't create {0} -ValgrindOutputDirectory.Couldnt_delete=Couldn't delete {0} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.project b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.project index 5fc6e91d13..a4b8b49942 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/ChangeLog index 607b909165..1901f0bd6d 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/ChangeLog @@ -1,3 +1,11 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/massif/tests: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/massif/tests: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * test.xml: Update class references. + 2009-06-23 Elliott Baron * ChartExportTest.java (testChartExportSVG): Fix test name. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF index dac565276c..caa80b4b29 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.massif.tests Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.massif.tests.MassifTestsPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.massif.tests.MassifTestsPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -24,12 +24,15 @@ Import-Package: org.eclipse.birt.chart.computation, org.eclipse.emf.common, org.eclipse.emf.ecore, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, + org.eclipse.linuxtools.internal.valgrind.massif, + org.eclipse.linuxtools.internal.valgrind.massif.birt, + org.eclipse.linuxtools.internal.valgrind.tests, + org.eclipse.linuxtools.internal.valgrind.ui, org.eclipse.linuxtools.profiling.tests, - org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch, - org.eclipse.linuxtools.valgrind.massif, - org.eclipse.linuxtools.valgrind.massif.birt, - org.eclipse.linuxtools.valgrind.tests, org.eclipse.linuxtools.valgrind.ui, org.eclipse.ui, org.eclipse.ui.texteditor +Export-Package: org.eclipse.linuxtools.internal.valgrind.massif.tests diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AbstractMassifTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AbstractMassifTest.java deleted file mode 100644 index 935a912758..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AbstractMassifTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import java.io.File; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.linuxtools.valgrind.massif.MassifHeapTreeNode; -import org.eclipse.linuxtools.valgrind.massif.MassifPlugin; -import org.eclipse.linuxtools.valgrind.tests.AbstractValgrindTest; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.ITextEditor; -import org.osgi.framework.Bundle; - - -public abstract class AbstractMassifTest extends AbstractValgrindTest { - - @Override - protected Bundle getBundle() { - return MassifTestsPlugin.getDefault().getBundle(); - } - - @Override - protected String getToolID() { - return MassifPlugin.TOOL_ID; - } - - protected void checkFile(IProject proj, MassifHeapTreeNode node) { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - IEditorInput input = editor.getEditorInput(); - if (input instanceof IFileEditorInput) { - IFileEditorInput fileInput = (IFileEditorInput) input; - IResource expectedResource = proj.findMember(node.getFilename()); - if (expectedResource != null) { - File expectedFile = expectedResource.getLocation().toFile(); - File actualFile = fileInput.getFile().getLocation().toFile(); - assertEquals(expectedFile, actualFile); - } - else { - fail(); - } - } - else { - fail(); - } - } - - protected void checkLine(MassifHeapTreeNode node) { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(node.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AllTests.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AllTests.java deleted file mode 100644 index 92d5ee17a5..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/AllTests.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite( - "Tests for org.eclipse.linuxtools.valgrind.massif"); //$NON-NLS-1$ - //$JUnit-BEGIN$ - suite.addTestSuite(DoubleClickTest.class); - suite.addTestSuite(ChartTests.class); - suite.addTestSuite(TreeTest.class); - suite.addTestSuite(BasicMassifTest.class); - suite.addTestSuite(LaunchConfigTabTest.class); - suite.addTestSuite(ExportWizardTest.class); - suite.addTestSuite(MultiProcessTest.class); - suite.addTestSuite(ExpandCollapseTest.class); - suite.addTestSuite(SortTest.class); - suite.addTestSuite(ChartExportTest.class); - //$JUnit-END$ - return suite; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/BasicMassifTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/BasicMassifTest.java deleted file mode 100644 index eee9c10f17..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/BasicMassifTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; - -public class BasicMassifTest extends AbstractMassifTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testNumSnapshots() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNumSnapshots"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - assertEquals(14, view.getSnapshots().length); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartExportTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartExportTest.java deleted file mode 100644 index b5577632c6..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartExportTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import java.io.File; - -import org.eclipse.birt.chart.model.Chart; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartEditorInput; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartSVG; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.PlatformUI; - -public class ChartExportTest extends AbstractMassifTest { - private IPath svgPath; - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - - svgPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); - assertNotNull(svgPath); - svgPath = svgPath.append("alloctest").append("chart.svg"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Override - protected void tearDown() throws Exception { - File chartFile = svgPath.toFile(); - if (chartFile.exists()) { - chartFile.delete(); - } - - deleteProject(proj); - super.tearDown(); - } - - public void testChartExportSVG() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDefaults"); //$NON-NLS-1$ - - IEditorInput input = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput(); - if (input instanceof ChartEditorInput) { - Chart chart = ((ChartEditorInput) input).getChart(); - - ChartSVG svg = new ChartSVG(chart); - svg.renderSVG(svgPath); - - File chartFile = svgPath.toFile(); - assertTrue(chartFile.exists()); - assertTrue(chartFile.length() > 0); - } else { - fail(); - } - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartTests.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartTests.java deleted file mode 100644 index 24a9c41a5d..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ChartTests.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import java.util.Arrays; - -import org.eclipse.birt.chart.computation.DataPointHints; -import org.eclipse.birt.chart.event.WrappedStructureSource; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifHeapTreeNode; -import org.eclipse.linuxtools.valgrind.massif.MassifLaunchConstants; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartControl; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartEditor; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartEditorInput; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartLocationsDialog; -import org.eclipse.linuxtools.valgrind.massif.birt.HeapChart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.PlatformUI; - -public class ChartTests extends AbstractMassifTest { - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testEditorName() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testEditorName"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IAction chartAction = getChartAction(view); - assertNotNull(chartAction); - chartAction.run(); - - IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - assertEquals("Heap Chart - alloctest", part.getTitle()); //$NON-NLS-1$ - } - - public void testByteScalingKiB() throws Exception { - byteScalingHelper(1, 1, 1024 * 10, "testByteScalingKiB"); //$NON-NLS-1$ - } - - public void testByteScalingMiB() throws Exception { - byteScalingHelper(2, 1, 1024 * 1024 * 10, "testByteScalingMiB"); //$NON-NLS-1$ - } - - public void testByteScalingGiB() throws Exception { - byteScalingHelper(3, 1024, 1024 * 1024 * 10, "testByteScalingGiB"); //$NON-NLS-1$ - } - - public void testByteScalingTiB() throws Exception { - byteScalingHelper(4, 1024 * 1024, 1024 * 1024 *10, "testByteScalingTiB"); //$NON-NLS-1$ - } - - public void testChartCallback() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testChartCallback"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IAction chartAction = getChartAction(view); - assertNotNull(chartAction); - chartAction.run(); - - IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (part instanceof ChartEditor) { - ChartControl control = ((ChartEditor) part).getControl(); - Event event = new Event(); - event.button = 1; - event.count = 1; - event.widget = control; - MouseEvent mEvent = new MouseEvent(event); - DataPointHints source = new DataPointHints(null, null, null, null, null, null, null, null, null, 4, null, 0, null); - control.callback(mEvent, new WrappedStructureSource(source), null); - - TableViewer viewer = ((MassifViewPart) view.getDynamicView()).getTableViewer(); - MassifSnapshot[] snapshots = (MassifSnapshot[]) viewer.getInput(); - MassifSnapshot snapshot = (MassifSnapshot) ((StructuredSelection) viewer.getSelection()).getFirstElement(); - assertEquals(4, Arrays.asList(snapshots).indexOf(snapshot)); - } else { - fail(); - } - } - - public void testChartLocationsDialog() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testChartCallback"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - MassifSnapshot snapshot = view.getSnapshots()[7]; // peak - assertTrue(snapshot.isDetailed()); - - Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - ChartLocationsDialog dialog = new ChartLocationsDialog(parent); - dialog.setInput(snapshot); - dialog.setBlockOnOpen(false); - dialog.open(); - - MassifHeapTreeNode element = snapshot.getRoot().getChildren()[1]; - dialog.getTableViewer().setSelection(new StructuredSelection(element)); - dialog.getOkButton().notifyListeners(SWT.Selection, null); - dialog.openEditorForResult(); - - checkFile(proj.getProject(), element); - checkLine(element); - } - - private void byteScalingHelper(int ix, long times, long bytes, String testName) throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, String.valueOf(bytes) + " " + String.valueOf(times)); //$NON-NLS-1$ - wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, MassifLaunchConstants.TIME_B); - config = wc.doSave(); - - doLaunch(config, testName); - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IAction chartAction = getChartAction(view); - assertNotNull(chartAction); - chartAction.run(); - - IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (part.getEditorInput() instanceof ChartEditorInput) { - ChartEditorInput input = (ChartEditorInput) part.getEditorInput(); - HeapChart chart = input.getChart(); - assertEquals(HeapChart.getByteUnits()[ix], chart.getXUnits()); - } else { - fail(); - } - } - - private IAction getChartAction(IViewPart view) { - IAction result = null; - IToolBarManager manager = view.getViewSite().getActionBars().getToolBarManager(); - for (IContributionItem item : manager.getItems()) { - if (item instanceof ActionContributionItem) { - ActionContributionItem actionItem = (ActionContributionItem) item; - if (actionItem.getAction().getId().equals(MassifViewPart.CHART_ACTION)) { - result = actionItem.getAction(); - } - } - } - return result; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/DoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/DoubleClickTest.java deleted file mode 100644 index 3dd392dd3b..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/DoubleClickTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifHeapTreeNode; -import org.eclipse.linuxtools.valgrind.massif.MassifLaunchConstants; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifTreeViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; - -public class DoubleClickTest extends AbstractMassifTest { - private MassifHeapTreeNode node; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - private void doDoubleClick() { - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - MassifTreeViewer treeViewer = (MassifTreeViewer) view.getTreeViewer(); - - MassifSnapshot[] snapshots = view.getSnapshots(); - node = snapshots[1].getRoot(); // first detailed - TreePath path = new TreePath(new Object[] { node }); - while (node.getChildren().length > 0 && !node.hasSourceFile()) { - node = node.getChildren()[0]; - path = path.createChildPath(node); - } - if (node.hasSourceFile()) { - treeViewer.expandToLevel(node, TreeViewer.ALL_LEVELS); - TreeSelection selection = new TreeSelection(path); - - // do double click - IDoubleClickListener listener = treeViewer.getDoubleClickListener(); - listener.doubleClick(new DoubleClickEvent(treeViewer, selection)); - } - else { - fail(); - } - } - - public void testDoubleClickFile() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2); - wc.doSave(); - doLaunch(config, "testDoubleClickFile"); //$NON-NLS-1$ - - doDoubleClick(); - - checkFile(proj.getProject(), node); - } - - public void testDoubleClickLine() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2); - wc.doSave(); - doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$ - - doDoubleClick(); - - checkLine(node); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExpandCollapseTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExpandCollapseTest.java deleted file mode 100644 index 73c6888afa..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExpandCollapseTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifHeapTreeNode; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Menu; - -public class ExpandCollapseTest extends AbstractMassifTest { - - protected TreeViewer viewer; - protected Menu contextMenu; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testExpand() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDefaults"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - viewer = view.getTreeViewer(); - contextMenu = viewer.getTree().getMenu(); - - // Select first snapshot and expand it - MassifHeapTreeNode[] snapshots = (MassifHeapTreeNode[]) viewer.getInput(); - MassifHeapTreeNode snapshot = snapshots[0]; - TreeSelection selection = new TreeSelection(new TreePath(new Object[] { snapshot })); - viewer.setSelection(selection); - contextMenu.notifyListeners(SWT.Show, null); - contextMenu.getItem(0).notifyListeners(SWT.Selection, null); - - checkExpanded(snapshot, true); - } - - public void testCollapse() throws Exception { - // Expand the element first - testExpand(); - - // Then collapse it - MassifHeapTreeNode[] snapshots = (MassifHeapTreeNode[]) viewer.getInput(); - MassifHeapTreeNode snapshot = snapshots[0]; - TreeSelection selection = new TreeSelection(new TreePath(new Object[] { snapshot })); - viewer.setSelection(selection); - contextMenu.notifyListeners(SWT.Show, null); - contextMenu.getItem(1).notifyListeners(SWT.Selection, null); - - checkExpanded(snapshot, false); - } - - private void checkExpanded(MassifHeapTreeNode element, boolean expanded) { - if (element.getChildren().length > 0) { - // only applicable to internal nodes - if (expanded) { - assertTrue(viewer.getExpandedState(element)); - } - else { - assertFalse(viewer.getExpandedState(element)); - } - } - for (MassifHeapTreeNode child : element.getChildren()) { - checkExpanded(child, expanded); - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExportWizardTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExportWizardTest.java deleted file mode 100644 index e368e4b21d..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/ExportWizardTest.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import java.io.File; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.linuxtools.valgrind.launch.ValgrindExportWizard; -import org.eclipse.linuxtools.valgrind.launch.ValgrindExportWizardPage; -import org.eclipse.ui.PlatformUI; - -public class ExportWizardTest extends AbstractMassifTest { - - protected ValgrindExportWizard wizard; - protected WizardDialog dialog; - protected ValgrindExportWizardPage page; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - - // close dialog just in case - if (dialog != null) { - dialog.close(); - } - super.tearDown(); - } - - public void testExportNoLaunch() throws Exception { - // No Valgrind launch to export - createWizard(); - - assertNotNull(page.getErrorMessage()); - } - - public void testExportBadPath() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunch launch = doLaunch(config, "testExport"); //$NON-NLS-1$ - - IProcess p = launch.getProcesses()[0]; - assertEquals(0, p.getExitValue()); - - createWizard(); - - // set the output path, should trigger modify listener - page.getDestText().setText("DOESNOTEXIST"); //$NON-NLS-1$ - - assertNotNull(page.getErrorMessage()); - assertFalse(page.isPageComplete()); - assertFalse(wizard.canFinish()); - } - - public void testExportNotDir() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunch launch = doLaunch(config, "testExport"); //$NON-NLS-1$ - - IProcess p = launch.getProcesses()[0]; - assertEquals(0, p.getExitValue()); - - createWizard(); - - // set the output path, should trigger modify listener - IPath pathToFiles = proj.getProject().getLocation(); - pathToFiles = pathToFiles.append("alloctest.c"); //$NON-NLS-1$ - assertTrue(pathToFiles.toFile().exists()); - page.getDestText().setText(pathToFiles.toOSString()); - - assertNotNull(page.getErrorMessage()); - assertFalse(page.isPageComplete()); - assertFalse(wizard.canFinish()); - } - - public void testExportBoth() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunch launch = doLaunch(config, "testExport"); //$NON-NLS-1$ - - IProcess p = launch.getProcesses()[0]; - assertEquals(0, p.getExitValue()); - - createWizard(); - - // set the output path, should trigger modify listener - File[] selectedFiles = page.getSelectedFiles(); - IPath pathToFiles = proj.getProject().getLocation(); - page.getDestText().setText(pathToFiles.toOSString()); - - assertTrue(page.isPageComplete()); - assertTrue(wizard.canFinish()); - - assertTrue(wizard.performFinish()); - - // check files were copied - for (File log : selectedFiles) { - File copy = new File(pathToFiles.toFile(), log.getName()); - assertTrue(copy.exists()); - } - } - - public void testExportOne() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunch launch = doLaunch(config, "testExport"); //$NON-NLS-1$ - - IProcess p = launch.getProcesses()[0]; - assertEquals(0, p.getExitValue()); - - createWizard(); - - // set the output path, should trigger modify listener - File[] selectedFiles = page.getSelectedFiles(); - // uncheck first file - File unselectedFile = selectedFiles[0]; - page.getViewer().setChecked(unselectedFile, false); - selectedFiles = page.getSelectedFiles(); - - IPath pathToFiles = proj.getProject().getLocation(); - page.getDestText().setText(pathToFiles.toOSString()); - - assertTrue(page.isPageComplete()); - assertTrue(wizard.canFinish()); - - assertTrue(wizard.performFinish()); - - // check only selected file was copied - for (File log : selectedFiles) { - File copy = new File(pathToFiles.toFile(), log.getName()); - assertTrue(copy.exists()); - } - File copy = new File(pathToFiles.toFile(), unselectedFile.getName()); - assertFalse(copy.exists()); - } - - public void testExportNone() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunch launch = doLaunch(config, "testExport"); //$NON-NLS-1$ - - IProcess p = launch.getProcesses()[0]; - assertEquals(0, p.getExitValue()); - - createWizard(); - - // set the output path, should trigger modify listener - File[] selectedFiles = page.getSelectedFiles(); - page.getViewer().setCheckedElements(new Object[0]); - assertEquals(0, page.getSelectedFiles().length); - - IPath pathToFiles = proj.getProject().getLocation(); - page.getDestText().setText(pathToFiles.toOSString()); - - assertTrue(page.isPageComplete()); - assertTrue(wizard.canFinish()); - - assertTrue(wizard.performFinish()); - - // check files were not copied - for (File log : selectedFiles) { - File copy = new File(pathToFiles.toFile(), log.getName()); - assertFalse(copy.exists()); - } - } - - protected void createWizard() { - wizard = new ValgrindExportWizard(); - wizard.init(PlatformUI.getWorkbench(), null); - - dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard); - dialog.setBlockOnOpen(false); - dialog.open(); - - assertFalse(wizard.canFinish()); - - page = (ValgrindExportWizardPage) wizard.getPages()[0]; - assertFalse(page.isPageComplete()); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/LaunchConfigTabTest.java deleted file mode 100644 index 18584379eb..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/LaunchConfigTabTest.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import java.util.Arrays; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.linuxtools.valgrind.launch.ValgrindOptionsTab; -import org.eclipse.linuxtools.valgrind.massif.MassifPlugin; -import org.eclipse.linuxtools.valgrind.massif.MassifToolPage; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class LaunchConfigTabTest extends AbstractMassifTest { - - protected ValgrindOptionsTab tab; - protected MassifToolPage dynamicTab; - protected ILaunchConfiguration config; - protected Shell testShell; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - - config = createConfiguration(proj.getProject()); - - testShell = new Shell(Display.getDefault()); - testShell.setLayout(new GridLayout()); - tab = new ValgrindOptionsTab(); - } - - @Override - protected void tearDown() throws Exception { - tab.dispose(); - testShell.dispose(); - deleteProject(proj); - super.tearDown(); - } - - private ILaunchConfigurationWorkingCopy initConfig() throws CoreException { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - tab.setDefaults(wc); - tab.createControl(testShell); - tab.initializeFrom(config); - int ix = Arrays.asList(tab.getTools()).indexOf(MassifPlugin.TOOL_ID); - tab.getToolsCombo().select(ix); - ILaunchConfigurationTab dynamicTab = tab.getDynamicTab(); - this.dynamicTab = (MassifToolPage) dynamicTab; - return wc; - } - - private ILaunch saveAndLaunch(ILaunchConfigurationWorkingCopy wc, String testName) - throws Exception { - tab.performApply(wc); - config = wc.doSave(); - - ILaunch launch = doLaunch(config, testName); - return launch; - } - - public void testDefaults() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - ILaunch launch = saveAndLaunch(wc, "testDefaults"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--tool=massif")); //$NON-NLS-1$ - assertFalse(cmd.contains("--xml=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("-q")); //$NON-NLS-1$ - assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ - assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ - assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ - - assertTrue(cmd.contains("--heap=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--heap-admin=8")); //$NON-NLS-1$ - assertTrue(cmd.contains("--stacks=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--alloc-fn")); //$NON-NLS-1$ - assertTrue(cmd.contains("--threshold=1.0")); //$NON-NLS-1$ - assertTrue(cmd.contains("--peak-inaccuracy=1.0")); //$NON-NLS-1$ - assertTrue(cmd.contains("--time-unit=i")); //$NON-NLS-1$ - assertTrue(cmd.contains("--detailed-freq=10")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-snapshots=100")); //$NON-NLS-1$ - assertTrue(cmd.contains("--alignment=8")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testHeap() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getHeapButton().setSelection(false); - ILaunch launch = saveAndLaunch(wc, "testHeap"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--heap=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testHeapAdmin() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getHeapAdminSpinner().setSelection(30); - ILaunch launch = saveAndLaunch(wc, "testHeapAdmin"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--heap-admin=30")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testStacks() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getStacksButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testStacks"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--stacks=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testDepth() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getDepthSpinner().setSelection(50); - ILaunch launch = saveAndLaunch(wc, "testDepth"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--depth=50")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAllocFn() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAllocFnList().add("foo"); //$NON-NLS-1$ - ILaunch launch = saveAndLaunch(wc, "testAllocFn"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alloc-fn=foo")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAllocFnMultiple() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAllocFnList().add("foo"); //$NON-NLS-1$ - dynamicTab.getAllocFnList().add("bar"); //$NON-NLS-1$ - ILaunch launch = saveAndLaunch(wc, "testAllocFnMultiple"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alloc-fn=foo")); //$NON-NLS-1$ - assertTrue(cmd.contains("--alloc-fn=bar")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAllocFnSpace() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAllocFnList().add("operator new(unsigned)"); //$NON-NLS-1$ - ILaunch launch = saveAndLaunch(wc, "testAllocFnSpace"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alloc-fn=operator new(unsigned)")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testThreshold() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getThresholdSpinner().setSelection(20); - ILaunch launch = saveAndLaunch(wc, "testThreshold"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--threshold=2.0")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testPeakInaccuracy() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getPeakInaccuracySpinner().setSelection(0); - ILaunch launch = saveAndLaunch(wc, "testPeakInaccuracy"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--peak-inaccuracy=0.0")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testTimeUnitBytes() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - String[] items = dynamicTab.getTimeUnitCombo().getItems(); - int ix = -1; - for (int i = 0; i < items.length; i++) { - if (items[i].equals(MassifToolPage.TIME_B_STRING)) { - ix = i; - } - } - dynamicTab.getTimeUnitCombo().select(ix); - ILaunch launch = saveAndLaunch(wc, "testTimeUnitBytes"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--time-unit=B")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testTimeUnitMilliseconds() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - String[] items = dynamicTab.getTimeUnitCombo().getItems(); - int ix = -1; - for (int i = 0; i < items.length; i++) { - if (items[i].equals(MassifToolPage.TIME_MS_STRING)) { - ix = i; - } - } - dynamicTab.getTimeUnitCombo().select(ix); - ILaunch launch = saveAndLaunch(wc, "testTimeUnitMilliseconds"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--time-unit=ms")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testDetailedFreq() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getDetailedFreqSpinner().setSelection(1); - ILaunch launch = saveAndLaunch(wc, "testDetailedFreq"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--detailed-freq=1")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testMaxSnapshots() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getMaxSnapshotsSpinner().setSelection(200); - ILaunch launch = saveAndLaunch(wc, "testMaxSpapshots"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--max-snapshots=200")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAlignment() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAlignmentSpinner().setSelection(512); - tab.performApply(wc); - config = wc.doSave(); - - assertTrue(tab.isValid(config)); - - ILaunch launch = doLaunch(config, "testAlignment"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alignment=512")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAlignmentBad() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAlignmentSpinner().setSelection(63); - tab.performApply(wc); - config = wc.doSave(); - - assertFalse(tab.isValid(config)); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MassifTestsPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MassifTestsPlugin.java deleted file mode 100644 index 093be97650..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MassifTestsPlugin.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class MassifTestsPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.massif.tests"; //$NON-NLS-1$ - - // The shared instance - private static MassifTestsPlugin plugin; - - /** - * The constructor - */ - public MassifTestsPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static MassifTestsPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MultiProcessTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MultiProcessTest.java deleted file mode 100644 index fc10f8857e..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/MultiProcessTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.linuxtools.valgrind.massif.MassifOutput; -import org.eclipse.linuxtools.valgrind.massif.MassifPidMenuAction; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Shell; - -public class MultiProcessTest extends AbstractMassifTest { - ICProject refProj; - - @Override - protected void setUp() throws Exception { - super.setUp(); - refProj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - proj = createProjectAndBuild("multiProcTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - deleteProject(refProj); - super.tearDown(); - } - - public void testNoExec() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNoExec"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - MassifOutput output = view.getOutput(); - assertEquals(1, output.getPids().length); - assertEquals(8, view.getSnapshots().length); - } - - public void testExec() throws Exception { - ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy(); - config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true); - config.doSave(); - doLaunch(config, "testExec"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - MassifOutput output = view.getOutput(); - - Integer[] pids = output.getPids(); - assertEquals(2, pids.length); - - // child not necessarily higher PID than parent - MassifSnapshot[] snapshots1 = output.getSnapshots(pids[0]); - assertTrue(snapshots1.length == 8 || snapshots1.length == 14); - MassifSnapshot[] snapshots2 = output.getSnapshots(pids[1]); - assertTrue(snapshots2.length == 8 || snapshots2.length == 14); - assertTrue(snapshots1.length != snapshots2.length); - } - - public void testExecPidMenu() throws Exception { - ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy(); - config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true); - config.doSave(); - doLaunch(config, "testExec"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - MassifViewPart dynamicView = (MassifViewPart) view.getDynamicView(); - MassifOutput output = dynamicView.getOutput(); - - MassifPidMenuAction menuAction = null; - IToolBarManager manager = view.getViewSite().getActionBars().getToolBarManager(); - for (IContributionItem item : manager.getItems()) { - if (item instanceof ActionContributionItem - && ((ActionContributionItem) item).getAction() instanceof MassifPidMenuAction) { - menuAction = (MassifPidMenuAction) ((ActionContributionItem) item).getAction(); - } - } - - assertNotNull(menuAction); - - Integer[] pids = dynamicView.getOutput().getPids(); - Shell shell = new Shell(Display.getCurrent()); - Menu pidMenu = menuAction.getMenu(shell); - - assertEquals(2, pidMenu.getItemCount()); - ActionContributionItem firstPid = (ActionContributionItem) pidMenu.getItem(0).getData(); - ActionContributionItem secondPid = (ActionContributionItem) pidMenu.getItem(1).getData(); - - // check initial state - assertTrue(firstPid.getAction().isChecked()); - assertFalse(secondPid.getAction().isChecked()); - assertEquals(output.getSnapshots(pids[0]), dynamicView.getSnapshots()); - - // select second pid - selectItem(pidMenu, 1); - - assertFalse(firstPid.getAction().isChecked()); - assertTrue(secondPid.getAction().isChecked()); - assertEquals(output.getSnapshots(pids[1]), dynamicView.getSnapshots()); - - // select second pid again - selectItem(pidMenu, 1); - - assertFalse(firstPid.getAction().isChecked()); - assertTrue(secondPid.getAction().isChecked()); - assertEquals(output.getSnapshots(pids[1]), dynamicView.getSnapshots()); - - // select first pid - selectItem(pidMenu, 0); - - assertTrue(firstPid.getAction().isChecked()); - assertFalse(secondPid.getAction().isChecked()); - assertEquals(output.getSnapshots(pids[0]), dynamicView.getSnapshots()); - } - - protected void selectItem(Menu pidMenu, int index) { - pidMenu.getItem(index).notifyListeners(SWT.Selection, null); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/SortTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/SortTest.java deleted file mode 100644 index 4e6886133b..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/SortTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifLaunchConstants; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; - -public class SortTest extends AbstractMassifTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, true); - wc.doSave(); - doLaunch(config, "testStacks"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testSortSnapshots() throws Exception { - checkSortColumn(0); - } - - public void testSortTime() throws Exception { - checkSortColumn(1); - } - - public void testSortTotal() throws Exception { - checkSortColumn(2); - } - - public void testSortUseful() throws Exception { - checkSortColumn(3); - } - - public void testSortExtra() throws Exception { - checkSortColumn(4); - } - - public void testSortStacks() throws Exception { - checkSortColumn(5); - } - - private void checkSortColumn(int column) throws CoreException, Exception { - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault() - .getView().getDynamicView(); - TableViewer viewer = view.getTableViewer(); - TableColumn control = viewer.getTable().getColumn(column); - - // Test ascending - control.notifyListeners(SWT.Selection, null); - assertEquals(SWT.UP, viewer.getTable().getSortDirection()); - assertEquals(control, viewer.getTable().getSortColumn()); - checkOrder(viewer, column, true); - - // Test descending - control.notifyListeners(SWT.Selection, null); - assertEquals(SWT.DOWN, viewer.getTable().getSortDirection()); - assertEquals(control, viewer.getTable().getSortColumn()); - checkOrder(viewer, column, false); - } - - private void checkOrder(TableViewer viewer, int column, boolean ascending) { - TableItem[] items = viewer.getTable().getItems(); - for (int i = 0; i < items.length - 1; i++) { - MassifSnapshot first = (MassifSnapshot) items[i].getData(); - MassifSnapshot second = (MassifSnapshot) items[i + 1].getData(); - - switch (column) { - case 0: - assertTrue(ascending ? first.getNumber() <= second.getNumber() : first.getNumber() >= second.getNumber()); - break; - case 1: - assertTrue(ascending ? first.getTime() <= second.getTime() : first.getTime() >= second.getTime()); - break; - case 2: - assertTrue(ascending ? first.getTotal() <= second.getTotal() : first.getTotal() >= second.getTotal()); - break; - case 3: - assertTrue(ascending ? first.getHeapBytes() <= second.getHeapBytes() : first.getHeapBytes() >= second.getHeapBytes()); - break; - case 4: - assertTrue(ascending ? first.getHeapExtra() <= second.getHeapExtra() : first.getHeapExtra() >= second.getHeapExtra()); - break; - case 5: - assertTrue(ascending ? first.getStacks() <= second.getStacks() : first.getStacks() >= second.getStacks()); - break; - default: - fail(); - } - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/TreeTest.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/TreeTest.java deleted file mode 100644 index 725189c192..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/valgrind/massif/tests/TreeTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifHeapTreeNode; -import org.eclipse.linuxtools.valgrind.massif.MassifLaunchConstants; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; - -public class TreeTest extends AbstractMassifTest { - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testTreeNodes() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2); - wc.doSave(); - doLaunch(config, "testTreeNodes"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - TreeViewer treeViewer = view.getTreeViewer(); - - MassifSnapshot[] snapshots = view.getSnapshots(); - MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput(); - for (int i = 0; i < nodes.length; i++) { - // every odd snapshot should be detailed with --detailed-freq=2 - // and thus in the tree - assertEquals(snapshots[2 * i + 1].getRoot(), nodes[i]); - } - } - - public void testNoDetailed() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 12); // > #snapshots - wc.doSave(); - doLaunch(config, "testNoDetailed"); //$NON-NLS-1$ - - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - TreeViewer treeViewer = view.getTreeViewer(); - - MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput(); - - assertNotNull(nodes); - assertEquals(1, nodes.length); // should always contain peak - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/test.xml b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/test.xml index 64b2aa0bdf..f43672afe3 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/test.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/test.xml @@ -1,7 +1,7 @@ - + diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/.project b/valgrind/org.eclipse.linuxtools.valgrind.massif/.project index e2fc22227f..309958f914 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.massif/ChangeLog index 1c527c0f55..3429e78fe4 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/ChangeLog @@ -1,3 +1,13 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/massif/birt: Removed. + * src/org/eclipse/linuxtools/valgrind/massif: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/massif: New package. + * src/org/eclipse/linuxtools/internal/valgrind/massif/birt: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal packages. + * plugin.xml: Update class references. + 2009-06-25 Elliott Baron * MassifHeapTreeNode.java (MassifHeapTreeNode): Handle ??? symbol case. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.massif/META-INF/MANIFEST.MF index 8b41b8778c..bb91c6f1cb 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.massif;singleton:=true Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.massif.MassifPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.massif.MassifPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -43,11 +43,13 @@ Import-Package: org.eclipse.birt.chart.device, org.eclipse.emf.common.util, org.eclipse.emf.ecore, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, + org.eclipse.linuxtools.internal.valgrind.ui, org.eclipse.linuxtools.profiling.ui, - org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch, org.eclipse.linuxtools.valgrind.ui, org.eclipse.ui, org.mozilla.javascript -Export-Package: org.eclipse.linuxtools.valgrind.massif, - org.eclipse.linuxtools.valgrind.massif.birt;uses:="org.eclipse.swt.events,org.eclipse.swt.widgets,org.eclipse.birt.chart.model" +Export-Package: org.eclipse.linuxtools.internal.valgrind.massif, + org.eclipse.linuxtools.internal.valgrind.massif.birt;uses:="org.eclipse.swt.events,org.eclipse.swt.widgets,org.eclipse.birt.chart.model" diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.massif/plugin.xml index 1d0f34cb60..0e755d2787 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/plugin.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/plugin.xml @@ -4,36 +4,27 @@ + page="org.eclipse.linuxtools.internal.valgrind.massif.MassifToolPage"> - diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifViewPart.java index 99eacb266d..d6c1787015 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifViewPart.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifViewPart.java @@ -248,7 +248,7 @@ public class MassifViewPart extends ViewPart implements IValgrindToolView { @Override public void run() { ChartEditorInput currentInput = getChartInput(pid); - String path = getChartSavePath(currentInput.getName() + ".svg"); //$NON-NLS-1$ + String path = getChartSavePath(currentInput.getName()); if (path != null) { ChartSVG renderer = new ChartSVG(currentInput.getChart()); renderer.renderSVG(Path.fromOSString(path)); diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifCommandConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifCommandConstants.java deleted file mode 100644 index e6a67ed5dd..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifCommandConstants.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -public final class MassifCommandConstants { - // Valgrind program arguments - public static final String OPT_MASSIF_OUTFILE = "--massif-out-file"; //$NON-NLS-1$ - public static final String OPT_HEAP = "--heap"; //$NON-NLS-1$ - public static final String OPT_HEAPADMIN = "--heap-admin"; //$NON-NLS-1$ - public static final String OPT_STACKS = "--stacks"; //$NON-NLS-1$ - public static final String OPT_DEPTH = "--depth"; //$NON-NLS-1$ - public static final String OPT_ALLOCFN = "--alloc-fn"; //$NON-NLS-1$ - public static final String OPT_THRESHOLD = "--threshold"; //$NON-NLS-1$ - public static final String OPT_PEAKINACCURACY = "--peak-inaccuracy"; //$NON-NLS-1$ - public static final String OPT_TIMEUNIT = "--time-unit"; //$NON-NLS-1$ - public static final String OPT_DETAILEDFREQ = "--detailed-freq"; //$NON-NLS-1$ - public static final String OPT_MAXSNAPSHOTS = "--max-snapshots"; //$NON-NLS-1$ - public static final String OPT_ALIGNMENT = "--alignment"; //$NON-NLS-1$ -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifHeapTreeNode.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifHeapTreeNode.java deleted file mode 100644 index b7d63e2881..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifHeapTreeNode.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; - -public class MassifHeapTreeNode { - protected MassifHeapTreeNode parent; - protected String text; - protected double percent; - protected long bytes; - protected String address; - protected String function; - protected String filename; - protected int line; - protected List children; - - public MassifHeapTreeNode(MassifHeapTreeNode parent, double percent, long bytes, String address, String function, String filename, int line) { - this.parent = parent; - - StringBuffer nodeText = new StringBuffer(); - formatBytes(percent, bytes, nodeText); - nodeText.append(address).append(":"); //$NON-NLS-1$ - if (function.length() > 0) { - nodeText.append(" "); //$NON-NLS-1$ - nodeText.append(function); - } - if (filename != null) { - nodeText.append(" (").append(filename); //$NON-NLS-1$ - if (line > 0) { - nodeText.append(":").append(line);//$NON-NLS-1$ - } - nodeText.append(")"); //$NON-NLS-1$ - } - this.percent = percent; - this.bytes = bytes; - this.address = address; - this.function = function; - this.filename = filename; - this.line = line; - this.text = nodeText.toString(); - children = new ArrayList(); - } - - public MassifHeapTreeNode(MassifHeapTreeNode parent, double percent, long bytes, String text) { - this.parent = parent; - - StringBuffer nodeText = new StringBuffer(); - formatBytes(percent, bytes, nodeText); - nodeText.append(text); - this.percent = percent; - this.bytes = bytes; - this.address = null; - this.function = null; - this.filename = null; - this.line = 0; - this.text = nodeText.toString(); - children = new ArrayList(); - } - - private void formatBytes(double percent, long bytes, StringBuffer buffer) { - buffer.append(new DecimalFormat("0.##").format(percent) + "%"); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append(" ("); //$NON-NLS-1$ - buffer.append(new DecimalFormat("#,##0").format(bytes) + "B"); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append(") "); //$NON-NLS-1$ - } - - public void addChild(MassifHeapTreeNode child) { - children.add(child); - } - - public MassifHeapTreeNode getParent() { - return parent; - } - - public MassifHeapTreeNode[] getChildren() { - return children.toArray(new MassifHeapTreeNode[children.size()]); - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public double getPercent() { - return percent; - } - - public long getBytes() { - return bytes; - } - - public String getAddress() { - return address; - } - - public String getFunction() { - return function; - } - - public String getFilename() { - return filename; - } - - public int getLine() { - return line; - } - - @Override - public String toString() { - return text; - } - - public boolean hasSourceFile() { - return filename != null && line > 0; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof MassifHeapTreeNode - && text.equals(((MassifHeapTreeNode) obj).getText()); - } - - @Override - public int hashCode() { - return text.hashCode(); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchConstants.java deleted file mode 100644 index aa5045e60f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchConstants.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.util.Collections; -import java.util.List; - -public final class MassifLaunchConstants { - // LaunchConfiguration attributes - public static final String ATTR_MASSIF_OUTFILE = MassifPlugin.PLUGIN_ID + ".MASSIF_OUTFILE"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_HEAP = MassifPlugin.PLUGIN_ID + ".MASSIF_HEAP"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_HEAPADMIN = MassifPlugin.PLUGIN_ID + ".MASSIF_HEAPADMIN"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_STACKS = MassifPlugin.PLUGIN_ID + ".MASSIF_STACKS"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_DEPTH = MassifPlugin.PLUGIN_ID + ".MASSIF_DEPTH"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_ALLOCFN = MassifPlugin.PLUGIN_ID + ".MASSIF_ALLOCFN"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_THRESHOLD = MassifPlugin.PLUGIN_ID + ".MASSIF_THRESHOLD"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_PEAKINACCURACY = MassifPlugin.PLUGIN_ID + ".MASSIF_PEAKINACCURACY"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_TIMEUNIT = MassifPlugin.PLUGIN_ID + ".MASSIF_TIMEUNIT"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_DETAILEDFREQ = MassifPlugin.PLUGIN_ID + ".MASSIF_DETAILEDFREQ"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_MAXSNAPSHOTS = MassifPlugin.PLUGIN_ID + ".MASSIF_MAXSNAPSHOTS"; //$NON-NLS-1$ - public static final String ATTR_MASSIF_ALIGNMENT = MassifPlugin.PLUGIN_ID + ".MASSIF_ALIGNMENT"; //$NON-NLS-1$ - - public static final String TIME_I = "i"; //$NON-NLS-1$ - public static final String TIME_MS = "ms"; //$NON-NLS-1$ - public static final String TIME_B = "B"; //$NON-NLS-1$ - - public static final boolean DEFAULT_MASSIF_HEAP = true; - public static final int DEFAULT_MASSIF_HEAPADMIN = 8; - public static final boolean DEFAULT_MASSIF_STACKS = false; - public static final int DEFAULT_MASSIF_DEPTH = 30; - public static final List DEFAULT_MASSIF_ALLOCFN = Collections.EMPTY_LIST; - public static final int DEFAULT_MASSIF_THRESHOLD = 10; - public static final int DEFAULT_MASSIF_PEAKINACCURACY = 10; - public static final String DEFAULT_MASSIF_TIMEUNIT = TIME_I; - public static final int DEFAULT_MASSIF_DETAILEDFREQ = 10; - public static final int DEFAULT_MASSIF_MAXSNAPSHOTS = 100; - public static final int DEFAULT_MASSIF_ALIGNMENT = 8; -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java deleted file mode 100644 index 7c3c4468fc..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.launch.IValgrindLaunchDelegate; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchConfigurationDelegate; -import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class MassifLaunchDelegate extends ValgrindLaunchConfigurationDelegate -implements IValgrindLaunchDelegate { - protected static final String OUT_PREFIX = "massif_"; //$NON-NLS-1$ - protected static final String OUT_FILE = OUT_PREFIX + "%p.txt"; //$NON-NLS-1$ - protected static final FileFilter MASSIF_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return pathname.getName().startsWith(OUT_PREFIX); - } - }; - - protected MassifOutput output; - - public void handleLaunch(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) - throws CoreException { - MassifPlugin.getDefault().setConfig(config); - MassifPlugin.getDefault().setSourceLocator(launch.getSourceLocator()); - try { - monitor.beginTask(Messages.getString("MassifLaunchDelegate.Parsing_Massif_Output"), 3); //$NON-NLS-1$ - - IPath outputPath = verifyOutputPath(config); - File[] massifOutputs = outputPath.toFile().listFiles(MASSIF_FILTER); - - if (massifOutputs.length > 0) { - parseOutput(massifOutputs, monitor); - } - } catch (IOException e) { - e.printStackTrace(); - abort(Messages.getString("MassifLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$ - } finally { - monitor.done(); - } - } - - protected void parseOutput(File[] massifOutputs, IProgressMonitor monitor) throws IOException { - output = new MassifOutput(); - for (File file : massifOutputs) { - MassifParser parser = new MassifParser(file); - output.putSnapshots(parser.getPid(), parser.getSnapshots()); - } - monitor.worked(2); - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindToolView massifPart = view.getDynamicView(); - if (massifPart instanceof MassifViewPart) { - ((MassifViewPart) massifPart).setOutput(output); - // initialize to first pid - ((MassifViewPart) massifPart).setPid(output.getPids()[0]); - } - monitor.worked(1); - } - - @SuppressWarnings("unchecked") - public String[] getCommandArray(ILaunchConfiguration config) - throws CoreException { - ArrayList opts = new ArrayList(); - - IPath outputPath = verifyOutputPath(config); - opts.add(MassifCommandConstants.OPT_MASSIF_OUTFILE + EQUALS + outputPath.append(OUT_FILE).toOSString()); - - opts.add(MassifCommandConstants.OPT_HEAP + EQUALS + (config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, MassifLaunchConstants.DEFAULT_MASSIF_HEAP) ? YES : NO)); - opts.add(MassifCommandConstants.OPT_HEAPADMIN + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, MassifLaunchConstants.DEFAULT_MASSIF_HEAPADMIN)); - opts.add(MassifCommandConstants.OPT_STACKS + EQUALS + (config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, MassifLaunchConstants.DEFAULT_MASSIF_STACKS) ? YES : NO)); - opts.add(MassifCommandConstants.OPT_DEPTH + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, MassifLaunchConstants.DEFAULT_MASSIF_DEPTH)); - List allocFns = config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, MassifLaunchConstants.DEFAULT_MASSIF_ALLOCFN); - for (String func : allocFns) { - opts.add(MassifCommandConstants.OPT_ALLOCFN + EQUALS + func); - } - opts.add(MassifCommandConstants.OPT_THRESHOLD + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, MassifLaunchConstants.DEFAULT_MASSIF_THRESHOLD) / 10.0); - opts.add(MassifCommandConstants.OPT_PEAKINACCURACY + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, MassifLaunchConstants.DEFAULT_MASSIF_PEAKINACCURACY) / 10.0); - opts.add(MassifCommandConstants.OPT_TIMEUNIT + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, MassifLaunchConstants.DEFAULT_MASSIF_TIMEUNIT)); - opts.add(MassifCommandConstants.OPT_DETAILEDFREQ + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, MassifLaunchConstants.DEFAULT_MASSIF_DETAILEDFREQ)); - opts.add(MassifCommandConstants.OPT_MAXSNAPSHOTS + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_MAXSNAPSHOTS, MassifLaunchConstants.DEFAULT_MASSIF_MAXSNAPSHOTS)); - opts.add(MassifCommandConstants.OPT_ALIGNMENT + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALIGNMENT, MassifLaunchConstants.DEFAULT_MASSIF_ALIGNMENT)); - - return opts.toArray(new String[opts.size()]); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifOutput.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifOutput.java deleted file mode 100644 index 33a94ea76c..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifOutput.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.util.HashMap; -import java.util.Map; - -public class MassifOutput { - protected Map pidMap; - - public MassifOutput() { - pidMap = new HashMap(); - } - - public void putSnapshots(Integer pid, MassifSnapshot[] snapshots) { - pidMap.put(pid, snapshots); - } - - public MassifSnapshot[] getSnapshots(Integer pid) { - return pidMap.get(pid); - } - - public Integer[] getPids() { - return pidMap.keySet().toArray(new Integer[pidMap.size()]); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifParser.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifParser.java deleted file mode 100644 index 357c22d8ba..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifParser.java +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; - -import org.eclipse.linuxtools.valgrind.core.AbstractValgrindTextParser; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot.SnapshotType; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot.TimeUnit; -import org.eclipse.osgi.util.NLS; - -public class MassifParser extends AbstractValgrindTextParser { - private static final String CMD = "cmd"; //$NON-NLS-1$ - private static final String TIME_UNIT = "time_unit"; //$NON-NLS-1$ - private static final String SNAPSHOT = "snapshot"; //$NON-NLS-1$ - private static final String TIME = "time"; //$NON-NLS-1$ - private static final String MEM_HEAP_B = "mem_heap_B"; //$NON-NLS-1$ - private static final String MEM_HEAP_EXTRA_B = "mem_heap_extra_B"; //$NON-NLS-1$ - private static final String MEM_STACKS_B = "mem_stacks_B"; //$NON-NLS-1$ - private static final String HEAP_TREE = "heap_tree"; //$NON-NLS-1$ - - private static final String INSTRUCTIONS = "i"; //$NON-NLS-1$ - private static final String MILLISECONDS = "ms"; //$NON-NLS-1$ - private static final String BYTES = "B"; //$NON-NLS-1$ - private static final String PEAK = "peak"; //$NON-NLS-1$ - private static final String DETAILED = "detailed"; //$NON-NLS-1$ - private static final String EMPTY = "empty"; //$NON-NLS-1$ - - protected Integer pid; - protected MassifSnapshot[] snapshots; - - public MassifParser(File inputFile) throws IOException { - ArrayList list = new ArrayList(); - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(inputFile)); - String line; - MassifSnapshot snapshot = null; - String cmd = null; - TimeUnit unit = null; - int n = 0; - - // retrive PID from filename - String filename = inputFile.getName(); - pid = parsePID(filename, MassifLaunchDelegate.OUT_PREFIX); - - // parse contents of file - while ((line = br.readLine()) != null) { - if (line.startsWith(CMD + COLON)){ - cmd = parseStrValue(line, COLON + SPACE); - } - else if (line.startsWith(TIME_UNIT + COLON)) { - unit = parseTimeUnit(line); - } - else if (line.startsWith(SNAPSHOT)) { - if (snapshot != null) { - // this snapshot finished parsing - list.add(snapshot); - n++; - } - snapshot = new MassifSnapshot(n); - snapshot.setCmd(cmd); - snapshot.setUnit(unit); - } - else if (line.startsWith(TIME + EQUALS)) { - snapshot.setTime(parseLongValue(line, EQUALS)); - } - else if (line.startsWith(MEM_HEAP_B + EQUALS)) { - snapshot.setHeapBytes(parseLongValue(line, EQUALS)); - } - else if (line.startsWith(MEM_HEAP_EXTRA_B + EQUALS)) { - snapshot.setHeapExtra(parseLongValue(line, EQUALS)); - } - else if (line.startsWith(MEM_STACKS_B + EQUALS)) { - snapshot.setStacks(parseLongValue(line, EQUALS)); - } - else if (line.startsWith(HEAP_TREE + EQUALS)) { - SnapshotType type = parseSnapshotType(line); - snapshot.setType(type); - switch (type) { - case DETAILED: - case PEAK: - MassifHeapTreeNode node = parseTree(snapshot, null, br); - node.setText(NLS.bind(Messages.getString("MassifParser.Snapshot_n"), n, node.getText())); // prepend snapshot number //$NON-NLS-1$ - snapshot.setRoot(node); - } - } - } - if (snapshot != null) { - // last snapshot that finished parsing - list.add(snapshot); - } - snapshots = list.toArray(new MassifSnapshot[list.size()]); - } finally { - if (br != null) { - br.close(); - } - } - } - - private MassifHeapTreeNode parseTree(MassifSnapshot snapshot, MassifHeapTreeNode parent, BufferedReader br) throws IOException { - String line = br.readLine(); - if (line == null) { - throw new IOException(Messages.getString("MassifParser.Unexpected_EOF")); //$NON-NLS-1$ - } - line = line.trim(); // remove leading whitespace - String[] parts = line.split(" "); //$NON-NLS-1$ - // bounds checking so we can fail with a more informative error - if (parts.length < 2) { - fail(line); - } - - Integer numChildren = parseNumChildren(parts[0]); - if (numChildren == null) { - fail(line); - } - - Long numBytes = parseNumBytes(parts[1]); - if (numBytes == null) { - fail(line); - } - - double percentage; - if (numBytes.intValue() == 0) { - percentage = 0; - } - else { - percentage = numBytes.doubleValue() / snapshot.getTotal() * 100; - } - - MassifHeapTreeNode node; - String address = null; - String function = null; - String filename = null; - int lineNo = 0; - if (parts[2].startsWith("0x")) { //$NON-NLS-1$ - // we extend the above bounds checking - if (parts.length < 3) { - fail(line); - } - // remove colon from address - address = parts[2].substring(0, parts[2].length() - 1); - - function = parseFunction(parts[3], line); - - // Parse source file if specified - Object[] subparts = parseFilename(line); - filename = (String) subparts[0]; - lineNo = (Integer) subparts[1]; - - node = new MassifHeapTreeNode(parent, percentage, numBytes, address, function, filename, lineNo); - } - else { - // concatenate the rest - StringBuffer text = new StringBuffer(); - for (int i = 2; i < parts.length; i++) { - text.append(parts[i]); - text.append(" "); //$NON-NLS-1$ - } - - node = new MassifHeapTreeNode(parent, percentage, numBytes, text.toString().trim()); - } - - - for (int i = 0; i < numChildren.intValue(); i++) { - node.addChild(parseTree(snapshot, node, br)); - } - return node; - } - - private String parseFunction(String start, String line) throws IOException { - String function = null; - int ix = line.lastIndexOf("("); //$NON-NLS-1$ - if (ix >= 0) { - function = line.substring(line.indexOf(start), ix); - } - else { - function = line.substring(line.indexOf(start)); - } - if (function != null) { - function = function.trim(); - } - else { - fail(line); - } - - return function; - } - - private Long parseNumBytes(String string) { - Long result = null; - if (isNumber(string)) { - result = Long.parseLong(string); - } - return result; - } - - /* - * format is "n[0-9]+:" - */ - private Integer parseNumChildren(String string) { - Integer result = null; - if (string.length() >= 3) { - String number = string.substring(1, string.length() - 1); - if (isNumber(number)) { - result = Integer.parseInt(number); - } - } - return result; - } - - public Integer getPid() { - return pid; - } - - public MassifSnapshot[] getSnapshots() { - return snapshots; - } - - protected SnapshotType parseSnapshotType(String line) throws IOException { - SnapshotType result = null; - String[] parts = line.split(EQUALS); - if (parts.length > 1) { - String type = parts[1]; - if (type.equals(EMPTY)) { - result = SnapshotType.EMPTY; - } - else if (type.equals(DETAILED)) { - result = SnapshotType.DETAILED; - } - else if (type.equals(PEAK)) { - result = SnapshotType.PEAK; - } - } - if (result == null) { - fail(line); - } - return result; - } - - protected TimeUnit parseTimeUnit(String line) throws IOException { - TimeUnit result = null; - String[] parts = line.split(COLON + SPACE); - if (parts.length > 1) { - String type = parts[1]; - if (type.equals(INSTRUCTIONS)) { - result = TimeUnit.INSTRUCTIONS; - } - else if (type.equals(MILLISECONDS)) { - result = TimeUnit.MILLISECONDS; - } - else if (type.equals(BYTES)) { - result = TimeUnit.BYTES; - } - } - if (result == null) { - fail(line); - } - return result; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPidMenuAction.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPidMenuAction.java deleted file mode 100644 index 3460ad99e2..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPidMenuAction.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuCreator; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; - -public class MassifPidMenuAction extends Action implements IMenuCreator { - - protected Menu menu; - protected MassifViewPart view; - protected Integer[] pids; - - public MassifPidMenuAction(MassifViewPart view) { - super(Messages.getString("MassifPidMenuAction.Select_Process_ID"), IAction.AS_DROP_DOWN_MENU); //$NON-NLS-1$ - this.view = view; - - setToolTipText(Messages.getString("MassifPidMenuAction.Select_Process_ID")); //$NON-NLS-1$ - setImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)); - setMenuCreator(this); - } - - public void dispose() { - if (menu != null) { - menu.dispose(); - } - } - - public Menu getMenu(Control parent) { - if (menu == null) { - if (pids != null) { - menu = new Menu(parent); - for (int i = 0; i < pids.length; i++) { - final Integer pid = pids[i]; - ActionContributionItem item = new ActionContributionItem(new Action("PID " + String.valueOf(pids[i]), IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$ - @Override - public void run() { - MenuItem[] items = menu.getItems(); - for (int j = 0; j < items.length; j++) { - IAction action = ((ActionContributionItem) items[j].getData()).getAction(); - action.setChecked(false); - } - setChecked(true); - view.setPid(pid); - Display.getDefault().syncExec(new Runnable() { - public void run() { - view.refreshView(); - } - }); - } - }); - item.fill(menu, -1); - } - } - // Check first item - ActionContributionItem item = (ActionContributionItem) menu.getItem(0).getData(); - item.getAction().setChecked(true); - } - return menu; - } - - public Menu getMenu(Menu parent) { - return null; - } - - public void setPids(Integer[] pids) { - this.pids = pids; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPlugin.java deleted file mode 100644 index 47ab8dcac4..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifPlugin.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import org.eclipse.core.resources.IFile; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.linuxtools.profiling.ui.ProfileUIUtils; -import org.eclipse.linuxtools.valgrind.core.PluginConstants; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class MassifPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.massif"; //$NON-NLS-1$ - public static final String EDITOR_ID = PLUGIN_ID + ".chartEditor"; //$NON-NLS-1$ - - // The shared instance - private static MassifPlugin plugin; - - protected ILaunchConfiguration config; - - // Needed for source lookup on massif output, since massif only supplies filenames - // and not full paths - protected ISourceLocator locator; - - public static final String TOOL_ID = PluginConstants.LAUNCH_PLUGIN_ID + ".massif"; //$NON-NLS-1$ - - /** - * The constructor - */ - public MassifPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - public static FontMetrics getFontMetrics(Control control) { - GC gc = new GC(control); - gc.setFont(control.getFont()); - FontMetrics fontMetrics = gc.getFontMetrics(); - gc.dispose(); - return fontMetrics; - } - - public void openEditorForNode(MassifHeapTreeNode element) { - // do source lookup - ISourceLocator sourceLocator = MassifPlugin.getDefault().getSourceLocator(); - if (sourceLocator instanceof ISourceLookupDirector) { - Object obj = ((ISourceLookupDirector) sourceLocator).getSourceElement(element.getFilename()); - if (obj != null && obj instanceof IFile) { - try { - ProfileUIUtils.openEditorAndSelect(((IFile) obj).getLocation().toOSString(), element.getLine()); - } catch (PartInitException e) { - e.printStackTrace(); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } - } - - public ISourceLocator getSourceLocator() { - return locator; - } - - protected void setSourceLocator(ISourceLocator locator) { - this.locator = locator; - } - - public ILaunchConfiguration getConfig() { - return config; - } - - public void setConfig(ILaunchConfiguration config) { - this.config = config; - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static MassifPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifSnapshot.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifSnapshot.java deleted file mode 100644 index 32b8adcc00..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifSnapshot.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -public class MassifSnapshot { - public static enum TimeUnit { INSTRUCTIONS, MILLISECONDS, BYTES }; - public static enum SnapshotType { EMPTY, DETAILED, PEAK }; - - protected long number; - protected long time; - protected long heapBytes; - protected long heapExtra; - protected long stacks; - - protected String cmd; - protected TimeUnit unit; - protected SnapshotType type; - protected MassifHeapTreeNode root; - - public MassifSnapshot(int number) { - this.number = number; - } - - public long getNumber() { - return number; - } - - public long getHeapBytes() { - return heapBytes; - } - - public long getHeapExtra() { - return heapExtra; - } - - public long getStacks() { - return stacks; - } - - public long getTime() { - return time; - } - - public long getTotal() { - return heapBytes + heapExtra + stacks; - } - - public SnapshotType getType() { - return type; - } - - public String getCmd() { - return cmd; - } - - public TimeUnit getUnit() { - return unit; - } - - public MassifHeapTreeNode getRoot() { - return root; - } - - public boolean isDetailed() { - return !type.equals(SnapshotType.EMPTY); - } - - protected void setTime(long time) { - this.time = time; - } - - protected void setHeapBytes(long heapBytes) { - this.heapBytes = heapBytes; - } - - protected void setHeapExtra(long heapExtra) { - this.heapExtra = heapExtra; - } - - protected void setStacks(long stacks) { - this.stacks = stacks; - } - - protected void setType(SnapshotType type) { - this.type = type; - } - - protected void setCmd(String cmd) { - this.cmd = cmd; - } - - protected void setUnit(TimeUnit unit) { - this.unit = unit; - } - - protected void setRoot(MassifHeapTreeNode root) { - this.root = root; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifToolPage.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifToolPage.java deleted file mode 100644 index 5718b25c04..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifToolPage.java +++ /dev/null @@ -1,394 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.util.Arrays; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.linuxtools.valgrind.launch.IValgrindToolPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Spinner; - -public class MassifToolPage extends AbstractLaunchConfigurationTab - implements IValgrindToolPage { - public static final String TIME_B_STRING = Messages.getString("MassifToolPage.bytes"); //$NON-NLS-1$ - public static final String TIME_MS_STRING = Messages.getString("MassifToolPage.milliseconds"); //$NON-NLS-1$ - public static final String TIME_I_STRING = Messages.getString("MassifToolPage.instructions"); //$NON-NLS-1$ - public static final String MASSIF = "massif"; //$NON-NLS-1$ - public static final String PLUGIN_ID = MassifPlugin.PLUGIN_ID; - - // Massif controls - protected Button heapButton; - protected Spinner heapAdminSpinner; - protected Button stacksButton; - protected Spinner depthSpinner; - protected List allocFnList; - protected Spinner thresholdSpinner; - protected Spinner peakInaccuracySpinner; - protected Combo timeUnitCombo; - protected Spinner detailedFreqSpinner; - protected Spinner maxSnapshotsSpinner; - protected Spinner alignmentSpinner; - - protected boolean isInitializing = false; - protected SelectionListener selectListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }; - protected ModifyListener modifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }; - - public void createControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - - GridLayout topLayout = new GridLayout(2, true); - topLayout.horizontalSpacing = 10; - top.setLayout(topLayout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite heapTop = new Composite(top, SWT.NONE); - heapTop.setLayout(new GridLayout(2, false)); - - heapButton = new Button(heapTop, SWT.CHECK); - heapButton.setText(Messages.getString("MassifToolPage.profile_heap")); //$NON-NLS-1$ - heapButton.addSelectionListener(selectListener); - - Composite heapAdminTop = new Composite(top, SWT.NONE); - heapAdminTop.setLayout(new GridLayout(2, false)); - - Label heapAdminLabel = new Label(heapAdminTop, SWT.NONE); - heapAdminLabel.setText(Messages.getString("MassifToolPage.administrative_bytes")); //$NON-NLS-1$ - - heapAdminSpinner = new Spinner(heapAdminTop, SWT.BORDER); - heapAdminSpinner.addModifyListener(modifyListener); - - Composite stacksTop = new Composite(top, SWT.NONE); - stacksTop.setLayout(new GridLayout(2, false)); - - stacksButton = new Button(stacksTop, SWT.CHECK); - stacksButton.setText(Messages.getString("MassifToolPage.profile_stack")); //$NON-NLS-1$ - stacksButton.addSelectionListener(selectListener); - - Composite depthTop = new Composite(top, SWT.NONE); - depthTop.setLayout(new GridLayout(2, false)); - - Label depthLabel = new Label(depthTop, SWT.NONE); - depthLabel.setText(Messages.getString("MassifToolPage.allocation_tree_depth")); //$NON-NLS-1$ - - depthSpinner = new Spinner(depthTop, SWT.BORDER); - depthSpinner.addModifyListener(modifyListener); - - Composite thresholdTop = new Composite(top, SWT.NONE); - thresholdTop.setLayout(new GridLayout(3, false)); - - Label thresholdLabel = new Label(thresholdTop, SWT.NONE); - thresholdLabel.setText(Messages.getString("MassifToolPage.heap_allocation_threshold")); //$NON-NLS-1$ - - thresholdSpinner = new Spinner(thresholdTop, SWT.BORDER); - thresholdSpinner.setDigits(1); - thresholdSpinner.setMaximum(1000); - thresholdSpinner.addModifyListener(modifyListener); - - Label thresholdPercentLabel = new Label(thresholdTop, SWT.NONE); - thresholdPercentLabel.setText("%"); //$NON-NLS-1$ - - Composite peakInaccuracyTop = new Composite(top, SWT.NONE); - peakInaccuracyTop.setLayout(new GridLayout(3, false)); - - Label peakInaccuracyLabel = new Label(peakInaccuracyTop, SWT.NONE); - peakInaccuracyLabel.setText(Messages.getString("MassifToolPage.allocation_peak_inaccuracy")); //$NON-NLS-1$ - - peakInaccuracySpinner = new Spinner(peakInaccuracyTop, SWT.BORDER); - peakInaccuracySpinner.setDigits(1); - peakInaccuracySpinner.setMaximum(1000); - peakInaccuracySpinner.addModifyListener(modifyListener); - - Label peakInaccuracyPercentLabel = new Label(peakInaccuracyTop, SWT.NONE); - peakInaccuracyPercentLabel.setText("%"); //$NON-NLS-1$ - - Composite timeUnitTop = new Composite(top, SWT.NONE); - timeUnitTop.setLayout(new GridLayout(2, false)); - - Label timeUnitLabel = new Label(timeUnitTop, SWT.NONE); - timeUnitLabel.setText(Messages.getString("MassifToolPage.time_unit")); //$NON-NLS-1$ - - timeUnitCombo = new Combo(timeUnitTop, SWT.READ_ONLY); - String[] items = new String[] { TIME_I_STRING, TIME_MS_STRING, TIME_B_STRING }; - timeUnitCombo.setItems(items); - timeUnitCombo.addSelectionListener(selectListener); - - Composite detailedFreqTop = new Composite(top, SWT.NONE); - detailedFreqTop.setLayout(new GridLayout(2, false)); - - Label detailedFreqLabel = new Label(detailedFreqTop, SWT.NONE); - detailedFreqLabel.setText(Messages.getString("MassifToolPage.detailed_snapshot_freq")); //$NON-NLS-1$ - - detailedFreqSpinner = new Spinner(detailedFreqTop, SWT.BORDER); - detailedFreqSpinner.setMinimum(1); - detailedFreqSpinner.setMaximum(Integer.MAX_VALUE); - detailedFreqSpinner.addModifyListener(modifyListener); - - Composite maxSnapshotsTop = new Composite(top, SWT.NONE); - maxSnapshotsTop.setLayout(new GridLayout(2, false)); - - Label maxSnapshotsLabel = new Label(maxSnapshotsTop, SWT.NONE); - maxSnapshotsLabel.setText(Messages.getString("MassifToolPage.max_snapshots")); //$NON-NLS-1$ - - maxSnapshotsSpinner = new Spinner(maxSnapshotsTop, SWT.BORDER); - maxSnapshotsSpinner.setMaximum(Integer.MAX_VALUE); - maxSnapshotsSpinner.addModifyListener(modifyListener); - - Composite alignmentTop = new Composite(top, SWT.NONE); - alignmentTop.setLayout(new GridLayout(2, false)); - - Label alignmentLabel = new Label(alignmentTop, SWT.NONE); - alignmentLabel.setText(Messages.getString("MassifToolPage.minimum_heap_block")); //$NON-NLS-1$ - - alignmentSpinner = new Spinner(alignmentTop, SWT.BORDER); - alignmentSpinner.setMinimum(8); - alignmentSpinner.setMaximum(4096); - alignmentSpinner.addModifyListener(modifyListener); - - Composite allocFnTop = new Composite(top, SWT.NONE); - allocFnTop.setLayout(new GridLayout(3, false)); - allocFnTop.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1)); - - Label allocFnLabel = new Label(allocFnTop, SWT.NONE); - allocFnLabel.setText(Messages.getString("MassifToolPage.allocation_functions")); //$NON-NLS-1$ - allocFnLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); - - createAllocFnControls(allocFnTop); - } - - private void createAllocFnControls(Composite top) { - - allocFnList = new List(top, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - FontMetrics fm = MassifPlugin.getFontMetrics(allocFnList); - allocFnList.setLayoutData(new GridData(Dialog.convertWidthInCharsToPixels(fm, 50), Dialog.convertHeightInCharsToPixels(fm, 5))); - - Composite allocButtons = new Composite(top, SWT.NONE); - GridLayout allocButtonsLayout = new GridLayout(); - allocButtonsLayout.marginWidth = allocButtonsLayout.marginHeight = 0; - allocButtons.setLayout(allocButtonsLayout); - allocButtons.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); - - Button newButton = new Button(allocButtons, SWT.PUSH); - newButton.setText(Messages.getString("MassifToolPage.New")); //$NON-NLS-1$ - newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - newButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleNewButtonPressed(); - updateLaunchConfigurationDialog(); - } - }); - - Button removeButton = new Button(allocButtons, SWT.PUSH); - removeButton.setText(Messages.getString("MassifToolPage.Remove")); //$NON-NLS-1$ - removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleRemoveButtonPressed(); - updateLaunchConfigurationDialog(); - } - }); - } - - protected void handleNewButtonPressed() { - InputDialog dialog = new InputDialog(getShell(), Messages.getString("MassifToolPage.New_Allocation_Function"), Messages.getString("MassifToolPage.Function_name"), "", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - if (dialog.open() == Window.OK) { - String function = dialog.getValue(); - if (!function.equals("")) { //$NON-NLS-1$ - allocFnList.add(function); - } - } - } - - protected void handleRemoveButtonPressed() { - int[] selections = allocFnList.getSelectionIndices(); - allocFnList.remove(selections); - } - - public String getName() { - return Messages.getString("MassifToolPage.Massif_Options"); //$NON-NLS-1$ - } - - @SuppressWarnings("unchecked") - public void initializeFrom(ILaunchConfiguration configuration) { - isInitializing = true; - try { - heapButton.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, MassifLaunchConstants.DEFAULT_MASSIF_HEAP)); - heapAdminSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, MassifLaunchConstants.DEFAULT_MASSIF_HEAPADMIN)); - stacksButton.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, MassifLaunchConstants.DEFAULT_MASSIF_STACKS)); - depthSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, MassifLaunchConstants.DEFAULT_MASSIF_DEPTH)); - java.util.List allocFns = configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, MassifLaunchConstants.DEFAULT_MASSIF_ALLOCFN); - allocFnList.setItems(allocFns.toArray(new String[allocFns.size()])); - thresholdSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, MassifLaunchConstants.DEFAULT_MASSIF_THRESHOLD)); - peakInaccuracySpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, MassifLaunchConstants.DEFAULT_MASSIF_PEAKINACCURACY)); - String timeUnit = configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, MassifLaunchConstants.DEFAULT_MASSIF_TIMEUNIT); - if (timeUnit.equals(MassifLaunchConstants.TIME_I)) { - timeUnitCombo.select(0); - } - else if (timeUnit.equals(MassifLaunchConstants.TIME_MS)) { - timeUnitCombo.select(1); - } - else { - timeUnitCombo.select(2); - } - detailedFreqSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, MassifLaunchConstants.DEFAULT_MASSIF_DETAILEDFREQ)); - maxSnapshotsSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_MAXSNAPSHOTS, MassifLaunchConstants.DEFAULT_MASSIF_MAXSNAPSHOTS)); - int alignment = configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALIGNMENT, MassifLaunchConstants.DEFAULT_MASSIF_ALIGNMENT); - alignmentSpinner.setSelection(alignment); - } catch (CoreException e) { - e.printStackTrace(); - } - isInitializing = false; - } - - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, heapButton.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, heapAdminSpinner.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, stacksButton.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, depthSpinner.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, Arrays.asList(allocFnList.getItems())); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, thresholdSpinner.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, peakInaccuracySpinner.getSelection()); - int ix = timeUnitCombo.getSelectionIndex(); - String value; - if (ix == 0) { - value = MassifLaunchConstants.TIME_I; - } - else if (ix == 1) { - value = MassifLaunchConstants.TIME_MS; - } - else { - value = MassifLaunchConstants.TIME_B; - } - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, value); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, detailedFreqSpinner.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_MAXSNAPSHOTS, maxSnapshotsSpinner.getSelection()); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_ALIGNMENT, alignmentSpinner.getSelection()); - } - - @Override - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - - boolean result = false; - try { - int alignment = launchConfig.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALIGNMENT, MassifLaunchConstants.DEFAULT_MASSIF_ALIGNMENT); - result = (alignment & (alignment - 1)) == 0; // is power of two? - } catch (CoreException e) { - e.printStackTrace(); - } - - if (!result) { - setErrorMessage(Messages.getString("MassifToolPage.Alignment_must_be_power_2")); //$NON-NLS-1$ - } - return result; - } - - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, MassifLaunchConstants.DEFAULT_MASSIF_HEAP); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, MassifLaunchConstants.DEFAULT_MASSIF_HEAPADMIN); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, MassifLaunchConstants.DEFAULT_MASSIF_STACKS); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, MassifLaunchConstants.DEFAULT_MASSIF_DEPTH); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, MassifLaunchConstants.DEFAULT_MASSIF_ALLOCFN); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, MassifLaunchConstants.DEFAULT_MASSIF_THRESHOLD); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, MassifLaunchConstants.DEFAULT_MASSIF_PEAKINACCURACY); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, MassifLaunchConstants.DEFAULT_MASSIF_TIMEUNIT); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, MassifLaunchConstants.DEFAULT_MASSIF_DETAILEDFREQ); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_MAXSNAPSHOTS, MassifLaunchConstants.DEFAULT_MASSIF_MAXSNAPSHOTS); - configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_ALIGNMENT, MassifLaunchConstants.DEFAULT_MASSIF_ALIGNMENT); - } - - protected void createHorizontalSpacer(Composite comp, int numlines) { - Label lbl = new Label(comp, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = numlines; - lbl.setLayoutData(gd); - } - - @Override - protected void updateLaunchConfigurationDialog() { - if (!isInitializing) { - super.updateLaunchConfigurationDialog(); - } - } - - public Button getHeapButton() { - return heapButton; - } - - public Spinner getHeapAdminSpinner() { - return heapAdminSpinner; - } - - public Button getStacksButton() { - return stacksButton; - } - - public Spinner getDepthSpinner() { - return depthSpinner; - } - - public List getAllocFnList() { - return allocFnList; - } - - public Spinner getThresholdSpinner() { - return thresholdSpinner; - } - - public Spinner getPeakInaccuracySpinner() { - return peakInaccuracySpinner; - } - - public Combo getTimeUnitCombo() { - return timeUnitCombo; - } - - public Spinner getDetailedFreqSpinner() { - return detailedFreqSpinner; - } - - public Spinner getMaxSnapshotsSpinner() { - return maxSnapshotsSpinner; - } - - public Spinner getAlignmentSpinner() { - return alignmentSpinner; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeLabelProvider.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeLabelProvider.java deleted file mode 100644 index b72be40af4..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeLabelProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -public class MassifTreeLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - return ((MassifHeapTreeNode) element).getText(); - } - - @Override - public Image getImage(Object element) { - Image img = null; - if (((MassifHeapTreeNode) element).getParent() == null) { // only show for root elements - img = MassifPlugin.imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, "icons/memory_view.gif").createImage(); //$NON-NLS-1$ - } else { // stack frame - img = DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_STACKFRAME); - } - return img; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeViewer.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeViewer.java deleted file mode 100644 index a980510367..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifTreeViewer.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.linuxtools.valgrind.ui.CollapseAction; -import org.eclipse.linuxtools.valgrind.ui.ExpandAction; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; - -public class MassifTreeViewer extends TreeViewer { - - protected IDoubleClickListener doubleClickListener; - protected ITreeContentProvider contentProvider; - protected Action expandAction; - protected Action collapseAction; - - public MassifTreeViewer(Composite parent) { - super(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); - - contentProvider = new ITreeContentProvider() { - public Object[] getChildren(Object parentElement) { - return ((MassifHeapTreeNode) parentElement).getChildren(); - } - - public Object getParent(Object element) { - return ((MassifHeapTreeNode) element).getParent(); - } - - public boolean hasChildren(Object element) { - MassifHeapTreeNode[] children = ((MassifHeapTreeNode) element).getChildren(); - return children != null && children.length > 0; - } - - public Object[] getElements(Object inputElement) { - return (Object[]) inputElement; - } - - public void dispose() {} - - public void inputChanged(Viewer viewer, Object oldInput, - Object newInput) {} - - }; - setContentProvider(contentProvider); - - setLabelProvider(new MassifTreeLabelProvider()); - - doubleClickListener = new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - MassifHeapTreeNode element = (MassifHeapTreeNode) ((TreeSelection) event.getSelection()).getFirstElement(); - if (element.hasSourceFile()) { - MassifPlugin.getDefault().openEditorForNode(element); - } - if (contentProvider.hasChildren(element)) { - expandToLevel(element, 1); - } - } - }; - addDoubleClickListener(doubleClickListener); - - expandAction = new ExpandAction(this); - collapseAction = new CollapseAction(this); - - MenuManager manager = new MenuManager(); - manager.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - ITreeSelection selection = (ITreeSelection) getSelection(); - MassifHeapTreeNode element = (MassifHeapTreeNode) selection.getFirstElement(); - if (contentProvider.hasChildren(element)) { - manager.add(expandAction); - manager.add(collapseAction); - } - } - }); - - manager.setRemoveAllWhenShown(true); - Menu contextMenu = manager.createContextMenu(getTree()); - getControl().setMenu(contextMenu); - } - - public IDoubleClickListener getDoubleClickListener() { - return doubleClickListener; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java deleted file mode 100644 index a6ce319b9b..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java +++ /dev/null @@ -1,491 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IFontProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot.SnapshotType; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartEditorInput; -import org.eclipse.linuxtools.valgrind.massif.birt.ChartSVG; -import org.eclipse.linuxtools.valgrind.massif.birt.HeapChart; -import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -public class MassifViewPart extends ViewPart implements IValgrindToolView { - - protected static final String TITLE_STACKS = Messages - .getString("MassifViewPart.Stacks"); //$NON-NLS-1$ - protected static final String TITLE_EXTRA = Messages - .getString("MassifViewPart.Extra_Heap"); //$NON-NLS-1$ - protected static final String TITLE_USEFUL = Messages - .getString("MassifViewPart.Useful_Heap"); //$NON-NLS-1$ - protected static final String TITLE_TOTAL = Messages - .getString("MassifViewPart.Total"); //$NON-NLS-1$ - protected static final String TITLE_TIME = Messages - .getString("MassifViewPart.Time"); //$NON-NLS-1$ - protected static final String TITLE_NUMBER = Messages - .getString("MassifViewPart.Snapshot"); //$NON-NLS-1$ - protected static final String TREE_ACTION = MassifPlugin.PLUGIN_ID - + ".treeAction"; //$NON-NLS-1$ - public static final String CHART_ACTION = MassifPlugin.PLUGIN_ID - + ".chartAction"; //$NON-NLS-1$ - public static final String PID_ACTION = MassifPlugin.PLUGIN_ID - + ".pidAction"; //$NON-NLS-1$ - public static final String SAVE_CHART_ACTION = MassifPlugin.PLUGIN_ID - + ".saveChartAction"; //$NON-NLS-1$ - - protected MassifOutput output; - protected Integer pid; - - protected Composite top; - protected StackLayout stackLayout; - protected TableViewer viewer; - protected MassifTreeViewer treeViewer; - protected MassifHeapTreeNode[] nodes; - - protected static final int COLUMN_SIZE = 125; - - protected Action treeAction; - protected Action chartAction; - protected MassifPidMenuAction pidAction; - protected Action saveChartAction; - - protected List chartInputs; - - @Override - public void createPartControl(Composite parent) { - chartInputs = new ArrayList(); - - top = new Composite(parent, SWT.NONE); - stackLayout = new StackLayout(); - top.setLayout(stackLayout); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - - viewer = new TableViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.FULL_SELECTION); - - Table table = viewer.getTable(); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - - - String[] columnTitles = { TITLE_NUMBER, TITLE_TIME, TITLE_TOTAL, - TITLE_USEFUL, TITLE_EXTRA, TITLE_STACKS }; - - for (int i = 0; i < columnTitles.length; i++) { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(columnTitles[i]); - column.getColumn().setWidth(COLUMN_SIZE); - column.getColumn().setResizable(true); - column.getColumn().addSelectionListener(getHeaderListener()); - } - table.setHeaderVisible(true); - table.setLinesVisible(true); - - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new MassifLabelProvider()); - - treeViewer = new MassifTreeViewer(top); - treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - MassifSnapshot snapshot = (MassifSnapshot) ((IStructuredSelection) event - .getSelection()).getFirstElement(); - if (snapshot.getType() != SnapshotType.EMPTY) { - treeAction.setChecked(true); - setTopControl(treeViewer.getControl()); - treeViewer.setSelection(new StructuredSelection(snapshot - .getRoot()), true); - treeViewer.expandToLevel(snapshot.getRoot(), - TreeViewer.ALL_LEVELS); - } - } - }); - - stackLayout.topControl = viewer.getControl(); - top.layout(); - } - - private String getUnitString(MassifSnapshot[] snapshots) { - String result; - MassifSnapshot snapshot = snapshots[0]; - switch (snapshot.getUnit()) { - case BYTES: - result = "B"; //$NON-NLS-1$ - break; - case INSTRUCTIONS: - result = "i"; //$NON-NLS-1$ - break; - default: - result = "ms"; //$NON-NLS-1$ - break; - } - return result; - } - - private SelectionListener getHeaderListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - TableColumn column = (TableColumn) e.widget; - Table table = viewer.getTable(); - if (column.equals(table.getSortColumn())) { - int direction = table.getSortDirection() == SWT.UP ? SWT.DOWN - : SWT.UP; - table.setSortDirection(direction); - } else { - table.setSortDirection(SWT.UP); - } - table.setSortColumn(column); - viewer.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object o1, Object o2) { - Table table = ((TableViewer) viewer).getTable(); - int direction = table.getSortDirection(); - MassifSnapshot s1 = (MassifSnapshot) o1; - MassifSnapshot s2 = (MassifSnapshot) o2; - long result; - TableColumn column = table.getSortColumn(); - if (column.getText().equals(TITLE_NUMBER)) { - result = s1.getNumber() - s2.getNumber(); - } else if (column.getText().startsWith(TITLE_TIME)) { - result = s1.getTime() - s2.getTime(); - } else if (column.getText().equals(TITLE_TOTAL)) { - result = s1.getTotal() - s2.getTotal(); - } else if (column.getText().equals(TITLE_USEFUL)) { - result = s1.getHeapBytes() - s2.getHeapBytes(); - } else if (column.getText().equals(TITLE_EXTRA)) { - result = s1.getHeapExtra() - s2.getHeapExtra(); - } else { - result = s1.getStacks() - s2.getStacks(); - } - - // ascending / descending - result = direction == SWT.UP ? result : -result; - - // overflow check - if (result > Integer.MAX_VALUE) { - result = Integer.MAX_VALUE; - } else if (result < Integer.MIN_VALUE) { - result = Integer.MIN_VALUE; - } - return (int) result; - } - }); - } - }; - } - - public IAction[] getToolbarActions() { - pidAction = new MassifPidMenuAction(this); - pidAction.setId(PID_ACTION); - - chartAction = new Action( - Messages.getString("MassifViewPart.Display_Heap_Allocation"), IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$ - @Override - public void run() { - ChartEditorInput input = getChartInput(pid); - if (input != null) { - displayChart(input); - } - } - }; - chartAction.setId(CHART_ACTION); - chartAction.setImageDescriptor(MassifPlugin.imageDescriptorFromPlugin( - MassifPlugin.PLUGIN_ID, "icons/linecharticon.gif")); //$NON-NLS-1$ - chartAction.setToolTipText(Messages - .getString("MassifViewPart.Display_Heap_Allocation")); //$NON-NLS-1$ - - saveChartAction = new Action(Messages.getString("MassifViewPart.Save_Chart"), IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$ - @Override - public void run() { - ChartEditorInput currentInput = getChartInput(pid); - String path = getChartSavePath(currentInput.getName()); - if (path != null) { - ChartSVG renderer = new ChartSVG(currentInput.getChart()); - renderer.renderSVG(Path.fromOSString(path)); - } - } - }; - saveChartAction.setId(SAVE_CHART_ACTION); - saveChartAction.setImageDescriptor(MassifPlugin.imageDescriptorFromPlugin( - MassifPlugin.PLUGIN_ID, "icons/chart-save.png")); //$NON-NLS-1$ - saveChartAction.setToolTipText(Messages.getString("MassifViewPart.Save_Chart")); //$NON-NLS-1$ - - treeAction = new Action( - Messages.getString("MassifViewPart.Show_Heap_Tree"), IAction.AS_CHECK_BOX) { //$NON-NLS-1$ - @Override - public void run() { - if (isChecked()) { - stackLayout.topControl = treeViewer.getControl(); - top.layout(); - } else { - stackLayout.topControl = viewer.getControl(); - top.layout(); - } - } - }; - treeAction.setId(TREE_ACTION); - treeAction.setImageDescriptor(MassifPlugin.imageDescriptorFromPlugin( - MassifPlugin.PLUGIN_ID, "icons/call_hierarchy.gif")); //$NON-NLS-1$ - treeAction.setToolTipText(Messages - .getString("MassifViewPart.Show_Heap_Tree")); //$NON-NLS-1$ - - return new IAction[] { pidAction, chartAction, saveChartAction, treeAction }; - } - - protected String getChartSavePath(String defaultName) { - Shell parent = new Shell(Display.getDefault()); - FileDialog dialog = new FileDialog(parent, SWT.SAVE); - dialog.setText(Messages.getString("MassifViewPart.Save_chart_dialog_title")); //$NON-NLS-1$ - dialog.setOverwrite(true); - dialog.setFilterExtensions(new String[] { ".svg" }); //$NON-NLS-1$ - dialog.setFileName(defaultName); - - return dialog.open(); - } - - protected void createChart(MassifSnapshot[] snapshots) { - HeapChart chart = new HeapChart(snapshots); - String title = ValgrindUIPlugin.getDefault().getView().getContentDescription() + " [PID: " + pid + "]"; //$NON-NLS-1$//$NON-NLS-2$ - chart.getTitle().getLabel().getCaption().setValue(title); - - String name = getInputName(title); - ChartEditorInput input = new ChartEditorInput(chart, name, pid); - chartInputs.add(input); - - // open the editor - displayChart(input); - } - - protected void displayChart(final ChartEditorInput chartInput) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - try { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - page.openEditor(chartInput, MassifPlugin.EDITOR_ID); - } catch (PartInitException e) { - e.printStackTrace(); - } - } - }); - } - - protected String getInputName(String description) { - String launchName = description.substring(0, description - .indexOf("[massif]")); //$NON-NLS-1$ - return launchName.trim(); - } - - @Override - public void setFocus() { - viewer.getTable().setFocus(); - } - - public void refreshView() { - if (output != null && pid != null) { - MassifSnapshot[] snapshots = output.getSnapshots(pid); - pidAction.setPids(output.getPids()); - if (snapshots != null) { - viewer.setInput(snapshots); - - String timeWithUnit = TITLE_TIME + " (" + getUnitString(snapshots) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - for (TableColumn column : viewer.getTable().getColumns()) { - if (column.getText().startsWith(TITLE_TIME)) { - column.setText(timeWithUnit); - } - viewer.getTable().layout(true); - } - MassifSnapshot[] detailed = getDetailed(snapshots); - nodes = new MassifHeapTreeNode[detailed.length]; - for (int i = 0; i < detailed.length; i++) { - nodes[i] = detailed[i].getRoot(); - } - treeViewer.setInput(nodes); - - // create and display chart - if (snapshots.length > 0) { - ChartEditorInput input = getChartInput(pid); - if (input == null) { - createChart(snapshots); - } - else { - displayChart(input); - } - } - } - } - } - - @Override - public void dispose() { - // Close all chart editors to keep Valgrind output consistent throughout workbench - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page != null) { - for (IEditorInput input : chartInputs) { - IEditorPart part = page.findEditor(input); - if (part != null) { - page.closeEditor(part, false); - } - } - } - super.dispose(); - } - - public void setTopControl(Control control) { - stackLayout.topControl = control; - top.layout(true); - } - - public void setOutput(MassifOutput output) { - this.output = output; - } - - public MassifOutput getOutput() { - return output; - } - - public void setPid(Integer pid) { - this.pid = pid; - } - - public Integer getPid() { - return pid; - } - - public MassifSnapshot[] getSnapshots() { - return output != null && pid != null ? output.getSnapshots(pid) : null; - } - - public TableViewer getTableViewer() { - return viewer; - } - - public TreeViewer getTreeViewer() { - return treeViewer; - } - - protected class MassifLabelProvider extends LabelProvider implements - ITableLabelProvider, IFontProvider { - - public Image getColumnImage(Object element, int columnIndex) { - Image image = null; - if (columnIndex == 0) { - MassifSnapshot snapshot = (MassifSnapshot) element; - switch (snapshot.getType()) { - case EMPTY: - break; - case PEAK: - case DETAILED: - image = MassifPlugin - .imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, - "icons/call_hierarchy.gif").createImage(); //$NON-NLS-1$ - } - } - return image; - } - - public String getColumnText(Object element, int columnIndex) { - MassifSnapshot snapshot = (MassifSnapshot) element; - DecimalFormat df = new DecimalFormat("#,##0"); //$NON-NLS-1$ - switch (columnIndex) { - case 0: - return df.format(snapshot.getNumber()); - case 1: - return df.format(snapshot.getTime()); - case 2: - return df.format(snapshot.getTotal()); - case 3: - return df.format(snapshot.getHeapBytes()); - case 4: - return df.format(snapshot.getHeapExtra()); - default: - return df.format(snapshot.getStacks()); - } - } - - public Font getFont(Object element) { - Font font = null; - MassifSnapshot snapshot = (MassifSnapshot) element; - switch (snapshot.getType()) { - case EMPTY: - case DETAILED: - break; - case PEAK: - font = JFaceResources.getFontRegistry().getBold( - JFaceResources.DIALOG_FONT); - } - return font; - } - } - - private MassifSnapshot[] getDetailed(MassifSnapshot[] snapshots) { - ArrayList list = new ArrayList(); - for (MassifSnapshot snapshot : snapshots) { - if (snapshot.getType() != SnapshotType.EMPTY) { - list.add(snapshot); - } - } - return list.toArray(new MassifSnapshot[list.size()]); - } - - private ChartEditorInput getChartInput(Integer pid) { - ChartEditorInput result = null; - for (int i = 0; i < chartInputs.size(); i++) { - ChartEditorInput input = chartInputs.get(i); - if (input.getPid().equals(pid)) { - result = input; - } - } - return result; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/Messages.java deleted file mode 100644 index 56fb907860..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.massif.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java deleted file mode 100644 index 6c6ef2d3ab..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java +++ /dev/null @@ -1,246 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2004, 2005 Actuate Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Actuate Corporation - initial API and implementation - * Elliott Baron - Modified implementation - ***********************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import org.eclipse.birt.chart.computation.DataPointHints; -import org.eclipse.birt.chart.device.ICallBackNotifier; -import org.eclipse.birt.chart.device.IDeviceRenderer; -import org.eclipse.birt.chart.event.WrappedStructureSource; -import org.eclipse.birt.chart.exception.ChartException; -import org.eclipse.birt.chart.factory.GeneratedChartState; -import org.eclipse.birt.chart.factory.Generator; -import org.eclipse.birt.chart.factory.RunTimeContext; -import org.eclipse.birt.chart.model.Chart; -import org.eclipse.birt.chart.model.attribute.Bounds; -import org.eclipse.birt.chart.model.attribute.CallBackValue; -import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl; -import org.eclipse.birt.chart.util.PluginSettings; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Canvas; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class ChartControl extends Canvas implements PaintListener, ControlListener, ICallBackNotifier { - - private transient boolean bIsPainting = false; - - private transient Image buffer; - - private static int X_OFFSET = 3; - - private static int Y_OFFSET = 3; - - protected Chart cm = null; - - protected GeneratedChartState state = null; - - protected IDeviceRenderer deviceRenderer = null; - - private boolean needsGeneration = true; - - public ChartControl(Composite parent, Chart chart, int style) { - super(parent, SWT.BORDER); - cm = chart; - setLayoutData(new GridData(GridData.FILL_BOTH)); - setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); - - try { - deviceRenderer = PluginSettings.instance().getDevice("dv.SWT"); //$NON-NLS-1$ - deviceRenderer.setProperty(IDeviceRenderer.UPDATE_NOTIFIER, this); - - addDisposeListener(new DisposeListener() { - public void widgetDisposed(DisposeEvent e) { - deviceRenderer.dispose(); - } - }); - - addPaintListener(this); - addControlListener(this); - } catch (ChartException e) { - e.printStackTrace(); - } - } - - public void callback(Object event, Object source, CallBackValue value) { - // give Valgrind view focus - ValgrindUIPlugin.getDefault().showView(); - MouseEvent mEvent = (MouseEvent) event; - - DataPointHints point = ((DataPointHints)((WrappedStructureSource)source).getSource()); - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - // select the corresponding snapshot in the TableViewer - TableViewer viewer = view.getTableViewer(); - view.setTopControl(viewer.getControl()); - - MassifSnapshot snapshot = (MassifSnapshot) viewer.getElementAt(point.getIndex()); - - switch (mEvent.count) { - case 1: // single click - viewer.setSelection(new StructuredSelection(snapshot)); - break; - case 2: // double click - if (snapshot.isDetailed()) { - ChartLocationsDialog dialog = new ChartLocationsDialog(getShell()); - dialog.setInput(snapshot); - - if (dialog.open() == Window.OK) { - dialog.openEditorForResult(); - } - } - } - } - - public Chart getDesignTimeModel() { - return cm; - } - - public Chart getRunTimeModel() { - return state.getChartModel(); - } - - public Object peerInstance() { - return this; - } - - public void regenerateChart() { - needsGeneration = true; - redraw(); - } - - public void repaintChart() { - redraw(); - } - - public void paintControl(PaintEvent pe) { - if (bIsPainting) { - return; - } - Throwable paintError = null; - - Rectangle re = getClientArea(); - final Rectangle adjustedRe = new Rectangle(0, 0, re.width, re.height); - - if (adjustedRe.width - 2 * X_OFFSET <= 0 - || adjustedRe.height - 2 * Y_OFFSET <= 0) { - if (buffer != null && !buffer.isDisposed()) { - buffer.dispose(); - buffer = null; - } - return; - } - - if (cm == null) { - buffer = null; - } else { - bIsPainting = true; - Image oldBuffer = null; - if (buffer == null) { - buffer = new Image(Display.getDefault(), adjustedRe); - } else { - Rectangle ore = buffer.getBounds(); - - oldBuffer = buffer; - - if (!adjustedRe.equals(ore)) { - buffer = new Image(Display.getDefault(), adjustedRe); - } - } - - GC gcImage = new GC(buffer); - - // fill default background as white. - gcImage.setForeground(Display.getDefault().getSystemColor( - SWT.COLOR_WHITE)); - gcImage.fillRectangle(buffer.getBounds()); - - Bounds bo = BoundsImpl.create(X_OFFSET, Y_OFFSET, - adjustedRe.width - 2 * X_OFFSET, adjustedRe.height - 2 - * Y_OFFSET); - - try { - deviceRenderer.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, gcImage); - - bo.scale(72d / deviceRenderer.getDisplayServer() - .getDpiResolution()); // convert to points - - // generate and render the cart - Generator gr = Generator.instance(); - if (needsGeneration) { - needsGeneration = false; - RunTimeContext rtc = new RunTimeContext(); - - state = gr.build(deviceRenderer - .getDisplayServer(), cm, bo, null, rtc, null); - - } - gr.render(deviceRenderer, state); - if (paintError != null) { - buffer = oldBuffer; - } - if (oldBuffer != null && oldBuffer != buffer) { - oldBuffer.dispose(); - } - GC gc = pe.gc; - if (buffer != null) { - gc.drawImage(buffer, 0, 0); - } - } catch (Exception ex) { - paintError = ex; - } finally { - gcImage.dispose(); - } - bIsPainting = false; - } - - - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events - * .ControlEvent) - */ - public void controlMoved(ControlEvent e) { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.ControlListener#controlResized(org.eclipse.swt - * .events.ControlEvent) - */ - public void controlResized(ControlEvent e) { - needsGeneration = true; - redraw(); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditor.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditor.java deleted file mode 100644 index 009f7945af..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditor.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import org.eclipse.birt.chart.model.Chart; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.EditorPart; - -public class ChartEditor extends EditorPart { - protected ChartControl control; - - @Override - public void doSave(IProgressMonitor monitor) { - } - - @Override - public void doSaveAs() { - } - - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - if (input instanceof ChartEditorInput) { - setInput(input); - setSite(site); - setPartName(NLS.bind(Messages.getString("ChartEditor.Heap_Chart"), input.getName())); //$NON-NLS-1$ - } - else { - throw new PartInitException(NLS.bind(Messages.getString("ChartEditor.Editor_input_must_be"), ChartEditorInput.class.getName())); //$NON-NLS-1$ - } - } - - @Override - public boolean isDirty() { - return false; - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - @Override - public void createPartControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - top.setLayout(new GridLayout()); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - ChartEditorInput input = (ChartEditorInput) getEditorInput(); - Chart chart = input.getChart(); - control = new ChartControl(top, chart, SWT.NONE); - } - - public ChartControl getControl() { - return control; - } - - @Override - public void setFocus() { - if (control != null) { - control.setFocus(); - } - } - - @Override - public void dispose() { - super.dispose(); - control.dispose(); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditorInput.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditorInput.java deleted file mode 100644 index e2c25c6bd3..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartEditorInput.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.linuxtools.valgrind.massif.MassifPlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IPersistableElement; - -public class ChartEditorInput implements IEditorInput { - - protected HeapChart chart; - protected String name; - protected Integer pid; - - public ChartEditorInput(HeapChart chart, String name, Integer pid) { - this.chart = chart; - this.name = name; - this.pid = pid; - } - - public boolean exists() { - return false; - } - - public ImageDescriptor getImageDescriptor() { - return MassifPlugin.imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, "icons/linecharticon.gif"); //$NON-NLS-1$ - } - - public String getName() { - return name; - } - - public Integer getPid() { - return pid; - } - - public IPersistableElement getPersistable() { - return null; - } - - public String getToolTipText() { - return NLS.bind(Messages.getString("ChartEditorInput.Heap_allocation_chart_for"), name); //$NON-NLS-1$ - } - - @SuppressWarnings("unchecked") - public Object getAdapter(Class adapter) { - return null; - } - - public HeapChart getChart() { - return chart; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartLocationsDialog.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartLocationsDialog.java deleted file mode 100644 index 5719cf856d..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartLocationsDialog.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.linuxtools.valgrind.massif.MassifHeapTreeNode; -import org.eclipse.linuxtools.valgrind.massif.MassifPlugin; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifTreeLabelProvider; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.ListDialog; - -public class ChartLocationsDialog extends ListDialog { - - protected List allocs; - - public ChartLocationsDialog(Shell parent) { - super(parent); - setContentProvider(new ArrayContentProvider()); - setLabelProvider(new MassifTreeLabelProvider()); - setMessage(Messages.getString("ChartLocationsDialog.Message")); //$NON-NLS-1$ - setTitle(Messages.getString("ChartLocationsDialog.Title")); //$NON-NLS-1$ - } - - @Override - public void setInput(Object input) { - setInput((MassifSnapshot) input); - } - - public void setInput(MassifSnapshot snapshot) { - MassifHeapTreeNode node = snapshot.getRoot(); - - allocs = new ArrayList(node.getChildren().length); - - for (MassifHeapTreeNode alloc : node.getChildren()) { - if (alloc.hasSourceFile()) { - allocs.add(alloc); - } - } - super.setInput(allocs); - } - - @Override - public int open() { - int result = OK; - - if (allocs.size() > 1) { - result = super.open(); - } - - return result; - } - - public void openEditorForResult() { - MassifHeapTreeNode element = null; - - if (allocs.size() > 1) { - element = (MassifHeapTreeNode) getResult()[0]; - } - else if (allocs.size() == 1) { - element = allocs.get(0); - } - - if (element != null) { - MassifPlugin.getDefault().openEditorForNode(element); - } - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartSVG.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartSVG.java deleted file mode 100644 index fb68a10ade..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartSVG.java +++ /dev/null @@ -1,113 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2004, 2005 Actuate Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Actuate Corporation - initial API and implementation - * Elliott Baron - Modified implementation - ***********************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import org.eclipse.birt.chart.computation.DataPointHints; -import org.eclipse.birt.chart.device.ICallBackNotifier; -import org.eclipse.birt.chart.device.IDeviceRenderer; -import org.eclipse.birt.chart.event.WrappedStructureSource; -import org.eclipse.birt.chart.exception.ChartException; -import org.eclipse.birt.chart.factory.GeneratedChartState; -import org.eclipse.birt.chart.factory.Generator; -import org.eclipse.birt.chart.factory.RunTimeContext; -import org.eclipse.birt.chart.model.Chart; -import org.eclipse.birt.chart.model.attribute.Bounds; -import org.eclipse.birt.chart.model.attribute.CallBackValue; -import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl; -import org.eclipse.birt.chart.util.PluginSettings; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifViewPart; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.swt.events.MouseEvent; - -public class ChartSVG implements ICallBackNotifier { - - protected Chart cm = null; - - protected GeneratedChartState state = null; - - protected IDeviceRenderer deviceRenderer = null; - - public ChartSVG(Chart chart) { - cm = chart; - } - - public void renderSVG(IPath svgPath) { - try { - RunTimeContext rtc = new RunTimeContext(); - - deviceRenderer = PluginSettings.instance().getDevice("dv.SVG"); //$NON-NLS-1$ - Generator gr = Generator.instance(); - Bounds bo = BoundsImpl.create(0, 0, 800, 600); - state = gr.build(deviceRenderer.getDisplayServer(), cm, bo, null, - rtc, null); - deviceRenderer.setProperty(IDeviceRenderer.FILE_IDENTIFIER, svgPath - .toOSString()); - deviceRenderer.setProperty(IDeviceRenderer.UPDATE_NOTIFIER, this); - - gr.render(deviceRenderer, state); - } catch (ChartException e) { - e.printStackTrace(); - } - } - - public void callback(Object event, Object source, CallBackValue value) { - // give Valgrind view focus - ValgrindUIPlugin.getDefault().showView(); - MouseEvent mEvent = (MouseEvent) event; - - DataPointHints point = ((DataPointHints)((WrappedStructureSource)source).getSource()); - MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView(); - // select the corresponding snapshot in the TableViewer - TableViewer viewer = view.getTableViewer(); - view.setTopControl(viewer.getControl()); - - MassifSnapshot snapshot = (MassifSnapshot) viewer.getElementAt(point.getIndex()); - - switch (mEvent.count) { - case 1: // single click - viewer.setSelection(new StructuredSelection(snapshot)); - break; - case 2: // double click -// if (snapshot.isDetailed()) { -// ChartLocationsDialog dialog = new ChartLocationsDialog(getShell()); -// dialog.setInput(snapshot); -// -// if (dialog.open() == Window.OK) { -// dialog.openEditorForResult(); -// } -// } - } - } - - public Chart getDesignTimeModel() { - return cm; - } - - public Chart getRunTimeModel() { - return state.getChartModel(); - } - - public Object peerInstance() { - return this; - } - - public void regenerateChart() { - } - - public void repaintChart() { - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/HeapChart.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/HeapChart.java deleted file mode 100644 index 4f8dbc1358..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/HeapChart.java +++ /dev/null @@ -1,404 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2004, 2005 Actuate Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Actuate Corporation - initial API and implementation - * Elliott Baron - Modified implementation - ***********************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import org.eclipse.birt.chart.model.attribute.ActionType; -import org.eclipse.birt.chart.model.attribute.AxisType; -import org.eclipse.birt.chart.model.attribute.ChartDimension; -import org.eclipse.birt.chart.model.attribute.FontDefinition; -import org.eclipse.birt.chart.model.attribute.IntersectionType; -import org.eclipse.birt.chart.model.attribute.Marker; -import org.eclipse.birt.chart.model.attribute.MarkerType; -import org.eclipse.birt.chart.model.attribute.Orientation; -import org.eclipse.birt.chart.model.attribute.Position; -import org.eclipse.birt.chart.model.attribute.TickStyle; -import org.eclipse.birt.chart.model.attribute.TriggerCondition; -import org.eclipse.birt.chart.model.attribute.impl.CallBackValueImpl; -import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl; -import org.eclipse.birt.chart.model.component.Axis; -import org.eclipse.birt.chart.model.component.Series; -import org.eclipse.birt.chart.model.component.impl.SeriesImpl; -import org.eclipse.birt.chart.model.data.BaseSampleData; -import org.eclipse.birt.chart.model.data.DataFactory; -import org.eclipse.birt.chart.model.data.NumberDataSet; -import org.eclipse.birt.chart.model.data.OrthogonalSampleData; -import org.eclipse.birt.chart.model.data.SampleData; -import org.eclipse.birt.chart.model.data.SeriesDefinition; -import org.eclipse.birt.chart.model.data.Trigger; -import org.eclipse.birt.chart.model.data.impl.ActionImpl; -import org.eclipse.birt.chart.model.data.impl.NumberDataSetImpl; -import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl; -import org.eclipse.birt.chart.model.data.impl.TriggerImpl; -import org.eclipse.birt.chart.model.impl.ChartWithAxesImpl; -import org.eclipse.birt.chart.model.layout.Legend; -import org.eclipse.birt.chart.model.layout.Plot; -import org.eclipse.birt.chart.model.type.LineSeries; -import org.eclipse.birt.chart.model.type.impl.LineSeriesImpl; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot; -import org.eclipse.linuxtools.valgrind.massif.MassifSnapshot.TimeUnit; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; - -public class HeapChart extends ChartWithAxesImpl { - - private static String[] byteUnits = { Messages.getString("HeapChart.B"), //$NON-NLS-1$ - Messages.getString("HeapChart.KiB"), //$NON-NLS-1$ - Messages.getString("HeapChart.MiB"), //$NON-NLS-1$ - Messages.getString("HeapChart.GiB"), //$NON-NLS-1$ - Messages.getString("HeapChart.TiB") //$NON-NLS-1$ - }; - private static String[] instrUnits = { Messages.getString("HeapChart.i"), //$NON-NLS-1$ - Messages.getString("HeapChart.Ki"), //$NON-NLS-1$ - Messages.getString("HeapChart.Mi"), //$NON-NLS-1$ - Messages.getString("HeapChart.Gi"), //$NON-NLS-1$ - Messages.getString("HeapChart.Ti") //$NON-NLS-1$ - }; - private static String[] secondUnits = { Messages.getString("HeapChart.ms"), //$NON-NLS-1$ - Messages.getString("HeapChart.s") //$NON-NLS-1$ - }; - - protected static final int BYTE_MULT = 1024; - protected static final int BYTE_LIMIT = byteUnits.length - 1; - protected static final int INSTR_MULT = 1000; - protected static final int INSTR_LIMIT = instrUnits.length - 1; - protected static final int MS_MULT = 1000; - protected static final int MS_LIMIT = secondUnits.length - 1; - - protected static final int SCALING_THRESHOLD = 20; - - protected String xUnits; - protected String yUnits; - - public HeapChart(MassifSnapshot[] snapshots) { - TimeUnit timeUnit = snapshots[0].getUnit(); - long xScaling = getXScaling(snapshots, timeUnit); - long yScaling = getYScaling(snapshots); - - double[] time = new double[snapshots.length]; - double[] dataUseful = new double[snapshots.length]; - double[] dataExtra = new double[snapshots.length]; - double[] dataStacks = null; - - boolean isStack = isStackProfiled(snapshots); - if (isStack) { - dataStacks = new double[snapshots.length]; - } - double[] dataTotal = new double[snapshots.length]; - for (int i = 0; i < snapshots.length; i++) { - time[i] = snapshots[i].getTime() / xScaling; - dataUseful[i] = snapshots[i].getHeapBytes() / yScaling; - dataExtra[i] = snapshots[i].getHeapExtra() / yScaling; - dataTotal[i] = dataUseful[i] + dataExtra[i]; - if (isStack) { - dataStacks[i] = snapshots[i].getStacks() / yScaling; - dataStacks[i] += dataStacks[i]; - } - } - - initialize(); - setDimension(ChartDimension.TWO_DIMENSIONAL_LITERAL); - setType("Line Chart"); //$NON-NLS-1$ - setSubType("Overlay"); //$NON-NLS-1$ - - Font font = JFaceResources.getDialogFont(); - FontData fd = font.getFontData()[0]; - - // Title - FontDefinition titleFont = getTitle().getLabel().getCaption().getFont(); - titleFont.setName(fd.getName()); - titleFont.setSize(fd.getHeight() + 2); - - // Plot - getBlock().setBackground(ColorDefinitionImpl.WHITE()); - Plot p = getPlot(); - p.getClientArea().setBackground( - ColorDefinitionImpl.create(255, 255, 225)); - - // X-Axis - Axis xAxisPrimary = getPrimaryBaseAxes()[0]; - xAxisPrimary.setType(AxisType.LINEAR_LITERAL); - xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL); - xAxisPrimary.getOrigin().setType(IntersectionType.VALUE_LITERAL); - xAxisPrimary.getTitle().getCaption().setValue(xUnits); - xAxisPrimary.getTitle().setVisible(true); - - FontDefinition xAxisFont = xAxisPrimary.getTitle().getCaption() - .getFont(); - xAxisFont.setName(fd.getName()); - xAxisFont.setSize(fd.getHeight()); - - xAxisFont = xAxisPrimary.getLabel().getCaption().getFont(); - xAxisFont.setName(fd.getName()); - xAxisFont.setSize(fd.getHeight()); - - // Y-Axis - Axis yAxisPrimary = getPrimaryOrthogonalAxis(xAxisPrimary); - yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL); - yAxisPrimary.getMajorGrid().getLineAttributes().setVisible(true); - yAxisPrimary.getTitle().getCaption().setValue(yUnits); - yAxisPrimary.getTitle().setVisible(true); - - FontDefinition yAxisFont = yAxisPrimary.getTitle().getCaption() - .getFont(); - yAxisFont.setName(fd.getName()); - yAxisFont.setSize(fd.getHeight()); - - yAxisFont = yAxisPrimary.getLabel().getCaption().getFont(); - yAxisFont.setName(fd.getName()); - yAxisFont.setSize(fd.getHeight()); - - // // Z-Axis - // Axis zAxis = AxisImpl.create(Axis.ANCILLARY_BASE); - // zAxis.setType(AxisType.LINEAR_LITERAL); - // zAxis.setLabelPosition(Position.BELOW_LITERAL); - // zAxis.setTitlePosition(Position.BELOW_LITERAL); - // zAxis.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL); - // zAxis.setOrientation(Orientation.HORIZONTAL_LITERAL); - // xAxisPrimary.getAncillaryAxes().add(zAxis); - - // Legend - Legend legend = getLegend(); - legend.setPosition(Position.BELOW_LITERAL); - legend.setOrientation(Orientation.HORIZONTAL_LITERAL); - - FontDefinition legendFont = legend.getText().getFont(); - legendFont.setName(fd.getName()); - legendFont.setSize(fd.getHeight()); - - // Data Set - NumberDataSet mainValues = NumberDataSetImpl.create(time); - NumberDataSet orthoValues1 = NumberDataSetImpl.create(dataUseful); - NumberDataSet orthoValues2 = NumberDataSetImpl.create(dataExtra); - NumberDataSet orthoValuesS = null; - if (isStack) { - orthoValuesS = NumberDataSetImpl.create(dataStacks); - } - NumberDataSet orthoValues3 = NumberDataSetImpl.create(dataTotal); - - SampleData sd = DataFactory.eINSTANCE.createSampleData(); - BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData(); - sdBase.setDataSetRepresentation("");//$NON-NLS-1$ - sd.getBaseSampleData().add(sdBase); - - OrthogonalSampleData sdOrthogonal1 = DataFactory.eINSTANCE - .createOrthogonalSampleData(); - sdOrthogonal1.setDataSetRepresentation("");//$NON-NLS-1$ - sdOrthogonal1.setSeriesDefinitionIndex(0); - sd.getOrthogonalSampleData().add(sdOrthogonal1); - - OrthogonalSampleData sdOrthogonal2 = DataFactory.eINSTANCE - .createOrthogonalSampleData(); - sdOrthogonal2.setDataSetRepresentation("");//$NON-NLS-1$ - sdOrthogonal2.setSeriesDefinitionIndex(1); - sd.getOrthogonalSampleData().add(sdOrthogonal2); - - if (isStack) { - OrthogonalSampleData sdOrthogonalS = DataFactory.eINSTANCE - .createOrthogonalSampleData(); - sdOrthogonalS.setDataSetRepresentation("");//$NON-NLS-1$ - sdOrthogonalS.setSeriesDefinitionIndex(2); - sd.getOrthogonalSampleData().add(sdOrthogonalS); - } - - OrthogonalSampleData sdOrthogonal3 = DataFactory.eINSTANCE - .createOrthogonalSampleData(); - sdOrthogonal3.setDataSetRepresentation("");//$NON-NLS-1$ - sdOrthogonal3.setSeriesDefinitionIndex(isStack ? 3 : 2); - sd.getOrthogonalSampleData().add(sdOrthogonal3); - - setSampleData(sd); - - // X-Series - Series seCategory = SeriesImpl.create(); - seCategory.setDataSet(mainValues); - SeriesDefinition sdX = SeriesDefinitionImpl.create(); - xAxisPrimary.getSeriesDefinitions().add(sdX); - sdX.getSeries().add(seCategory); - - // Y-Series - LineSeries ls1 = (LineSeries) LineSeriesImpl.create(); - ls1.setDataSet(orthoValues1); - ls1.getLineAttributes().setColor(ColorDefinitionImpl.CREAM()); - for (int i = 0; i < ls1.getMarkers().size(); i++) { - Marker marker = (Marker) ls1.getMarkers().get(i); - marker.setType(MarkerType.DIAMOND_LITERAL); - } - - ls1.setPaletteLineColor(true); - ls1.setSeriesIdentifier(Messages.getString("HeapChart.Useful_Heap")); //$NON-NLS-1$ - ls1.getTriggers().add(getClickTrigger(ls1)); - ls1.getTriggers().add(getDblClickTrigger(ls1)); - - // Y-Series - LineSeries ls2 = (LineSeries) LineSeriesImpl.create(); - ls2.setDataSet(orthoValues2); - ls2.getLineAttributes().setColor(ColorDefinitionImpl.CREAM()); - for (int i = 0; i < ls2.getMarkers().size(); i++) { - Marker marker = (Marker) ls2.getMarkers().get(i); - marker.setType(MarkerType.DIAMOND_LITERAL); - } - ls2.setPaletteLineColor(true); - ls2.setSeriesIdentifier(Messages.getString("HeapChart.Extra_Heap")); //$NON-NLS-1$ - ls2.getTriggers().add(getClickTrigger(ls2)); - ls2.getTriggers().add(getDblClickTrigger(ls2)); - - // Y-Series - LineSeries lsS = null; - if (isStack) { - lsS = (LineSeries) LineSeriesImpl.create(); - lsS.setDataSet(orthoValuesS); - lsS.getLineAttributes().setColor(ColorDefinitionImpl.CREAM()); - for (int i = 0; i < lsS.getMarkers().size(); i++) { - Marker marker = (Marker) lsS.getMarkers().get(i); - marker.setType(MarkerType.DIAMOND_LITERAL); - } - lsS.setPaletteLineColor(true); - lsS.setSeriesIdentifier(Messages.getString("HeapChart.Stacks")); //$NON-NLS-1$ - lsS.getTriggers().add(getClickTrigger(lsS)); - lsS.getTriggers().add(getDblClickTrigger(lsS)); - } - - // Y-Series - LineSeries ls3 = (LineSeries) LineSeriesImpl.create(); - ls3.setDataSet(orthoValues3); - ls3.getLineAttributes().setColor(ColorDefinitionImpl.CREAM()); - for (int i = 0; i < ls3.getMarkers().size(); i++) { - Marker marker = (Marker) ls3.getMarkers().get(i); - marker.setType(MarkerType.DIAMOND_LITERAL); - } - ls3.setPaletteLineColor(true); - ls3.setSeriesIdentifier(Messages.getString("HeapChart.Total_Heap")); //$NON-NLS-1$ - ls3.getTriggers().add(getClickTrigger(ls3)); - ls3.getTriggers().add(getDblClickTrigger(ls3)); - - SeriesDefinition sdY = SeriesDefinitionImpl.create(); - sdY.getSeriesPalette().shift(-1); - yAxisPrimary.getSeriesDefinitions().add(sdY); - sdY.getSeries().add(ls1); - sdY.getSeries().add(ls2); - if (isStack) { - sdY.getSeries().add(lsS); - } - sdY.getSeries().add(ls3); - - // // Z-Series - // SeriesDefinition sdZ = SeriesDefinitionImpl.create(); - // zAxis.getSeriesDefinitions().add(sdZ); - } - - private Trigger getClickTrigger(LineSeries ls) { - return TriggerImpl.create(TriggerCondition.ONCLICK_LITERAL, ActionImpl - .create(ActionType.CALL_BACK_LITERAL, CallBackValueImpl - .create(String.valueOf(ls - .getSeriesIdentifier())))); - } - - private Trigger getDblClickTrigger(LineSeries ls) { - return TriggerImpl.create(TriggerCondition.ONDBLCLICK_LITERAL, ActionImpl - .create(ActionType.CALL_BACK_LITERAL, CallBackValueImpl - .create(String.valueOf(ls - .getSeriesIdentifier())))); - } - - private boolean isStackProfiled(MassifSnapshot[] snapshots) { - return getMaxStack(snapshots) > 0; - } - - private long getYScaling(MassifSnapshot[] snapshots) { - long max = getMaxValue(snapshots); - - int count = 0; - while (max > BYTE_MULT * SCALING_THRESHOLD && count < BYTE_LIMIT) { - max /= BYTE_MULT; - count++; - } - - yUnits = byteUnits[count]; - - return (long) Math.pow(BYTE_MULT, count); - } - - private long getXScaling(MassifSnapshot[] snapshots, TimeUnit unit) { - long max = snapshots[snapshots.length - 1].getTime(); - int mult, limit; - String[] units; - switch (unit) { - case BYTES: - mult = BYTE_MULT; - limit = BYTE_LIMIT; - units = byteUnits; - break; - case INSTRUCTIONS: - mult = INSTR_MULT; - limit = INSTR_LIMIT; - units = instrUnits; - break; - default: - mult = MS_MULT; - limit = MS_LIMIT; - units = secondUnits; - break; - } - - int count = 0; - while (max > mult * SCALING_THRESHOLD && count < limit) { - max /= mult; - count++; - } - - xUnits = units[count]; - - return (long) Math.pow(mult, count); - } - - private static long getMaxValue(MassifSnapshot[] snapshots) { - long max = 0; - for (MassifSnapshot snapshot : snapshots) { - if (snapshot.getTotal() > max) { - max = snapshot.getTotal(); - } - } - return max; - } - - private static long getMaxStack(MassifSnapshot[] snapshots) { - long max = 0; - for (MassifSnapshot snapshot : snapshots) { - if (snapshot.getTotal() > max) { - max = snapshot.getStacks(); - } - } - return max; - } - - public String getXUnits() { - return xUnits; - } - - public String getYUnits() { - return yUnits; - } - - public static String[] getByteUnits() { - return byteUnits; - } - - public static String[] getInstrUnits() { - return instrUnits; - } - - public static String[] getSecondUnits() { - return secondUnits; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/Messages.java deleted file mode 100644 index e9a5b28474..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.massif.birt; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.massif.birt.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/messages.properties deleted file mode 100644 index cacef06bc5..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/messages.properties +++ /dev/null @@ -1,21 +0,0 @@ -HeapChart.B=bytes (B) -HeapChart.Extra_Heap=Extra Heap -HeapChart.Gi=instructions (billions) -HeapChart.GiB=gibibytes (GiB) -HeapChart.i=instructions -HeapChart.Ki=instructions (thousands) -HeapChart.KiB=kibibytes (KiB) -HeapChart.Mi=instructions (millions) -HeapChart.MiB=mebibytes (MiB) -HeapChart.ms=milliseconds (ms) -HeapChart.s=seconds (s) -HeapChart.Ti=instructions (trillions) -HeapChart.TiB=tebibytes (TiB) -HeapChart.Total_Heap=Total Heap -HeapChart.Useful_Heap=Useful Heap -HeapChart.Stacks=Stacks -ChartEditor.Editor_input_must_be=Editor input must be of type {0} -ChartEditor.Heap_Chart=Heap Chart - {0} -ChartEditorInput.Heap_allocation_chart_for=Heap allocation chart for {0} -ChartLocationsDialog.Message=Locations within this snapshot: -ChartLocationsDialog.Title=Open Allocation Function Call diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/messages.properties deleted file mode 100644 index 4589ec5ea3..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/messages.properties +++ /dev/null @@ -1,38 +0,0 @@ -MassifLaunchDelegate.Error_parsing_output=Error parsing output -MassifLaunchDelegate.Parsing_Massif_Output=Parsing Massif Output -MassifLaunchDelegate.Retrieving_massif_data_dir=Retrieving massif data dir failed. -MassifParser.Parsing_massif_output_failed=Parsing massif output failed on line: {0} -MassifParser.Snapshot_n=Snapshot {0} - {1} -MassifParser.Unexpected_EOF=Unexpected EOF -MassifPidMenuAction.Select_Process_ID=Select Process ID -MassifToolPage.administrative_bytes=administrative bytes per block: -MassifToolPage.Alignment_must_be_power_2=Alignment must be a power of 2 between 8 and 4096 inclusive -MassifToolPage.allocation_functions=allocation functions: -MassifToolPage.allocation_peak_inaccuracy=allocation peak inaccuracy: -MassifToolPage.allocation_tree_depth=allocation tree depth: -MassifToolPage.bytes=bytes -MassifToolPage.detailed_snapshot_freq=detailed snapshot frequency: -MassifToolPage.Edit=E&dit -MassifToolPage.Function_name=Function name: -MassifToolPage.heap_allocation_threshold=heap allocation threshold: -MassifToolPage.instructions=instructions -MassifToolPage.Massif_Options=Massif Options -MassifToolPage.max_snapshots=max snapshots: -MassifToolPage.milliseconds=milliseconds -MassifToolPage.minimum_heap_block=minimum heap block alignment: -MassifToolPage.New=N&ew -MassifToolPage.New_Allocation_Function=New Allocation Function -MassifToolPage.profile_heap=profile heap -MassifToolPage.profile_stack=profile stack -MassifToolPage.Remove=Rem&ove -MassifToolPage.time_unit=time unit: -MassifViewPart.Display_Heap_Allocation=Display Heap Allocation Graph -MassifViewPart.Extra_Heap=Extra Heap (B) -MassifViewPart.Save_Chart=Save Chart As SVG -MassifViewPart.Save_chart_dialog_title=Save Chart -MassifViewPart.Show_Heap_Tree=Show Heap Tree -MassifViewPart.Snapshot=Snapshot -MassifViewPart.Stacks=Stacks (B) -MassifViewPart.Time=Time -MassifViewPart.Total=Total (B) -MassifViewPart.Useful_Heap=Useful Heap (B) diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.project b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.project index 537bae7bb7..407e14365f 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/ChangeLog index 316e7f9694..fbc7ac6ae8 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/ChangeLog @@ -1,3 +1,11 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/memcheck/tests: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * test.xml: Update class references. + 2009-07-07 Elliott Baron * LaunchConfigTabTest.java (testNoLeakCheck): New test. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/META-INF/MANIFEST.MF index 18107972df..0ad3258e8b 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.memcheck.tests;singleton:=true Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.memcheck.tests.MemcheckTestsPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.memcheck.tests.MemcheckTestsPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -25,12 +25,15 @@ Import-Package: org.eclipse.cdt.core, org.eclipse.debug.ui.console, org.eclipse.debug.ui.sourcelookup, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, + org.eclipse.linuxtools.internal.valgrind.memcheck, + org.eclipse.linuxtools.internal.valgrind.tests, + org.eclipse.linuxtools.internal.valgrind.ui, org.eclipse.linuxtools.profiling.launch, org.eclipse.linuxtools.profiling.tests, org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch, - org.eclipse.linuxtools.valgrind.memcheck, - org.eclipse.linuxtools.valgrind.tests, org.eclipse.linuxtools.valgrind.ui, org.eclipse.ui, org.eclipse.ui.actions, @@ -38,3 +41,4 @@ Import-Package: org.eclipse.cdt.core, org.eclipse.ui.ide, org.eclipse.ui.texteditor, org.eclipse.ui.wizards.datatransfer +Export-Package: org.eclipse.linuxtools.internal.valgrind.memcheck.tests diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java index 0a622a7da8..a1ddf578d8 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/DoubleClickTest.java @@ -12,8 +12,6 @@ package org.eclipse.linuxtools.internal.valgrind.memcheck.tests; import java.io.File; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -119,33 +117,4 @@ public class DoubleClickTest extends AbstractMemcheckTest { fail(); } } - - public void testDoubleClickLaunchRemoved() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - ILaunch launch = doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$ - - // Remove launch - tests #284919 - DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch); - - doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(frame.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } - } } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java index 43ffa80eec..831d943595 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/internal/valgrind/memcheck/tests/LaunchConfigTabTest.java @@ -129,7 +129,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { public void testWSSuppresions() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); String text = "${workspace_loc:/basicTest/testsuppfile.supp}"; //$NON-NLS-1$ - tab.getSuppFileList().add(text); + tab.getSuppFileText().setText(text); ILaunch launch = saveAndLaunch(wc, "testWSSuppresions"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); if (p.length > 0) { @@ -146,7 +146,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { public void testSuppressions() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/testsuppfile.supp")).getLocation(); //$NON-NLS-1$ - tab.getSuppFileList().add(suppPath.toOSString()); + tab.getSuppFileText().setText(suppPath.toOSString()); ILaunch launch = saveAndLaunch(wc, "testSuppressions"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); if (p.length > 0) { @@ -158,30 +158,11 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { fail(); } } - - public void testSuppressionsMultiple() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/testsuppfile.supp")).getLocation(); //$NON-NLS-1$ - IPath suppPath2 = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/testsuppfile2.supp")).getLocation(); //$NON-NLS-1$ - tab.getSuppFileList().add(suppPath.toOSString()); - tab.getSuppFileList().add(suppPath2.toOSString()); - ILaunch launch = saveAndLaunch(wc, "testSuppressionsMultiple"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--suppressions=" + suppPath.toOSString())); //$NON-NLS-1$ - assertTrue(cmd.contains("--suppressions=" + suppPath2.toOSString())); //$NON-NLS-1$ - } - else { - fail(); - } - } public void testSuppressionsSpaces() throws Exception { ILaunchConfigurationWorkingCopy wc = initConfig(); IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/test suppfile.supp")).getLocation(); //$NON-NLS-1$ - tab.getSuppFileList().add(suppPath.toOSString()); + tab.getSuppFileText().setText(suppPath.toOSString()); ILaunch launch = saveAndLaunch(wc, "testSuppressionsSpaces"); //$NON-NLS-1$ IProcess[] p = launch.getProcesses(); if (p.length > 0) { @@ -515,7 +496,7 @@ public class LaunchConfigTabTest extends AbstractMemcheckTest { public void testValgrindError() throws Exception { String notExistentFile = "DOES NOT EXIST"; //$NON-NLS-1$ ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getSuppFileList().add(notExistentFile); + tab.getSuppFileText().setText(notExistentFile); tab.performApply(wc); config = wc.doSave(); diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractLinkedResourceMemcheckTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractLinkedResourceMemcheckTest.java deleted file mode 100644 index 5c0288ce92..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractLinkedResourceMemcheckTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import java.net.URL; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; - -public abstract class AbstractLinkedResourceMemcheckTest extends AbstractMemcheckTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - - proj = createProject(getBundle(), "linkedTest"); //$NON-NLS-1$ - - // delete source folder and replace it with a link to its bundle location - final Exception[] ex = new Exception[1]; - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - - public void run(IProgressMonitor monitor) throws CoreException { - try { - URL location = FileLocator.find(getBundle(), new Path("resources/linkedTest/src"), null); //$NON-NLS-1$ - IFolder srcFolder = proj.getProject().getFolder("src"); //$NON-NLS-1$ - srcFolder.delete(true, null); - srcFolder.createLink(FileLocator.toFileURL(location).toURI(), IResource.REPLACE, null); - } catch (Exception e) { - ex[0] = e; - } - } - - }, null); - - if (ex[0] != null) { - throw ex[0]; - } - - assertEquals(0, proj.getBinaryContainer().getBinaries().length); - - buildProject(proj); - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractMemcheckTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractMemcheckTest.java deleted file mode 100644 index 84bb02b3cc..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AbstractMemcheckTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.linuxtools.valgrind.memcheck.MemcheckPlugin; -import org.eclipse.linuxtools.valgrind.tests.AbstractValgrindTest; -import org.osgi.framework.Bundle; - -public abstract class AbstractMemcheckTest extends AbstractValgrindTest { - - @Override - public Bundle getBundle() { - return MemcheckTestsPlugin.getDefault().getBundle(); - } - - public String getToolID() { - return MemcheckPlugin.TOOL_ID; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AllTests.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AllTests.java deleted file mode 100644 index 4cade48e79..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/AllTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite( - "Tests for org.eclipse.linuxtools.valgrind.memcheck"); //$NON-NLS-1$ - // $JUnit-BEGIN$ - suite.addTestSuite(BasicMemcheckTest.class); - suite.addTestSuite(DoubleClickTest.class); - suite.addTestSuite(LaunchConfigTabTest.class); - suite.addTestSuite(MarkerTest.class); - suite.addTestSuite(LinkedResourceDoubleClickTest.class); - suite.addTestSuite(LinkedResourceMarkerTest.class); - suite.addTestSuite(MultiProcessTest.class); - suite.addTestSuite(ExpandCollapseTest.class); - suite.addTestSuite(ShortcutTest.class); - suite.addTestSuite(SignalTest.class); - suite.addTestSuite(MinVersionTest.class); - // $JUnit-END$ - return suite; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/BasicMemcheckTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/BasicMemcheckTest.java deleted file mode 100644 index 97a02fe0e3..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/BasicMemcheckTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class BasicMemcheckTest extends AbstractMemcheckTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testNumErrors() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNumErrors"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - assertEquals(3, view.getMessages().length); - } - - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/DoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/DoubleClickTest.java deleted file mode 100644 index 1d0ba9837a..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/DoubleClickTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import java.io.File; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame; -import org.eclipse.linuxtools.valgrind.ui.CoreMessagesViewer; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.ITextEditor; - -public class DoubleClickTest extends AbstractMemcheckTest { - private ValgrindStackFrame frame; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - } - - private void doDoubleClick() throws Exception { - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - CoreMessagesViewer viewer = view.getMessagesViewer(); - - // get first leaf - IValgrindMessage[] elements = (IValgrindMessage[]) viewer.getInput(); - IValgrindMessage element = elements[0]; - TreePath path = new TreePath(new Object[] { element }); - frame = null; - while (element.getChildren().length > 0) { - element = element.getChildren()[0]; - path = path.createChildPath(element); - if (element instanceof ValgrindStackFrame) { - frame = (ValgrindStackFrame) element; - } - } - assertNotNull(frame); - - viewer.expandToLevel(frame, TreeViewer.ALL_LEVELS); - TreeSelection selection = new TreeSelection(path); - - // do double click - IDoubleClickListener listener = viewer.getDoubleClickListener(); - listener.doubleClick(new DoubleClickEvent(viewer, selection)); - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testDoubleClickFile() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDoubleClickFile"); //$NON-NLS-1$ - - doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - IEditorInput input = editor.getEditorInput(); - if (input instanceof IFileEditorInput) { - IFileEditorInput fileInput = (IFileEditorInput) input; - File expectedFile = new File(proj.getProject().getLocation().toOSString(), frame.getFile()); - File actualFile = fileInput.getFile().getLocation().toFile(); - - assertEquals(expectedFile.getCanonicalPath(), actualFile.getCanonicalPath()); - } - else { - fail(); - } - } - - public void testDoubleClickLine() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$ - - doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(frame.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ExpandCollapseTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ExpandCollapseTest.java deleted file mode 100644 index 5fc4a22111..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ExpandCollapseTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.ui.CoreMessagesViewer; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Menu; - -public class ExpandCollapseTest extends AbstractMemcheckTest { - - protected CoreMessagesViewer viewer; - protected Menu contextMenu; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testExpand() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDefaults"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - viewer = view.getMessagesViewer(); - contextMenu = viewer.getTree().getMenu(); - - // Select first error and expand it - IValgrindMessage[] messages = (IValgrindMessage[]) viewer.getInput(); - IValgrindMessage element = messages[0]; - TreeSelection selection = new TreeSelection(new TreePath(new Object[] { element })); - viewer.setSelection(selection); - contextMenu.notifyListeners(SWT.Show, null); - contextMenu.getItem(0).notifyListeners(SWT.Selection, null); - - checkExpanded(element, true); - } - - public void testCollapse() throws Exception { - // Expand the element first - testExpand(); - - // Then collapse it - IValgrindMessage[] messages = (IValgrindMessage[]) viewer.getInput(); - IValgrindMessage element = messages[0]; - TreeSelection selection = new TreeSelection(new TreePath(new Object[] { element })); - viewer.setSelection(selection); - contextMenu.notifyListeners(SWT.Show, null); - contextMenu.getItem(1).notifyListeners(SWT.Selection, null); - - checkExpanded(element, false); - } - - private void checkExpanded(IValgrindMessage element, boolean expanded) { - if (element.getChildren().length > 0) { - // only applicable to internal nodes - if (expanded) { - assertTrue(viewer.getExpandedState(element)); - } - else { - assertFalse(viewer.getExpandedState(element)); - } - } - for (IValgrindMessage child : element.getChildren()) { - checkExpanded(child, expanded); - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LaunchConfigTabTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LaunchConfigTabTest.java deleted file mode 100644 index f43ef34a09..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LaunchConfigTabTest.java +++ /dev/null @@ -1,514 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import java.util.Arrays; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.eclipse.linuxtools.valgrind.launch.ValgrindOptionsTab; -import org.eclipse.linuxtools.valgrind.memcheck.MemcheckLaunchConstants; -import org.eclipse.linuxtools.valgrind.memcheck.MemcheckPlugin; -import org.eclipse.linuxtools.valgrind.memcheck.MemcheckToolPage; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.osgi.framework.Version; - -public class LaunchConfigTabTest extends AbstractMemcheckTest { - - protected ValgrindOptionsTab tab; - protected MemcheckToolPage dynamicTab; - protected ILaunchConfiguration config; - protected Shell testShell; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - - config = createConfiguration(proj.getProject()); - - testShell = new Shell(Display.getDefault()); - testShell.setLayout(new GridLayout()); - tab = new ValgrindOptionsTab(); - } - - @Override - protected void tearDown() throws Exception { - tab.dispose(); - testShell.dispose(); - deleteProject(proj); - super.tearDown(); - } - - private ILaunchConfigurationWorkingCopy initConfig() throws CoreException { - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - tab.setDefaults(wc); - tab.createControl(testShell); - tab.initializeFrom(config); - int ix = Arrays.asList(tab.getTools()).indexOf(MemcheckPlugin.TOOL_ID); - tab.getToolsCombo().select(ix); - ILaunchConfigurationTab dynamicTab = tab.getDynamicTab(); - this.dynamicTab = (MemcheckToolPage) dynamicTab; - return wc; - } - - private ILaunch saveAndLaunch(ILaunchConfigurationWorkingCopy wc, String testName) - throws Exception { - tab.performApply(wc); - config = wc.doSave(); - - ILaunch launch = doLaunch(config, testName); - return launch; - } - - public void testDefaults() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - ILaunch launch = saveAndLaunch(wc, "testDefaults"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--tool=memcheck")); //$NON-NLS-1$ - assertTrue(cmd.contains("-q")); //$NON-NLS-1$ - assertTrue(cmd.contains("--trace-children=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--child-silent-after-fork=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--demangle=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--num-callers=12")); //$NON-NLS-1$ - assertTrue(cmd.contains("--error-limit=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--show-below-main=no")); //$NON-NLS-1$ - assertFalse(cmd.contains("--suppressions")); //$NON-NLS-1$ - assertTrue(cmd.contains("--max-stackframe=2000000")); //$NON-NLS-1$ - assertTrue(cmd.contains("--alignment=8")); //$NON-NLS-1$ - assertTrue(cmd.contains("--run-libc-freeres=yes")); //$NON-NLS-1$ - - assertTrue(cmd.contains("--leak-check=yes")); //$NON-NLS-1$ - assertTrue(cmd.contains("--show-reachable=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--leak-resolution=low")); //$NON-NLS-1$ - assertTrue(cmd.contains("--freelist-vol=10000000")); //$NON-NLS-1$ - assertTrue(cmd.contains("--workaround-gcc296-bugs=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--partial-loads-ok=no")); //$NON-NLS-1$ - assertTrue(cmd.contains("--undef-value-errors=yes")); //$NON-NLS-1$ - - // 3.4.0 specific - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - assertTrue(cmd.contains("--track-origins=no")); //$NON-NLS-1$ - } - else { - assertFalse(cmd.contains("--track-origins")); //$NON-NLS-1$ - } - assertFalse(cmd.contains("--main-stacksize")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testWSSuppresions() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - String text = "${workspace_loc:/basicTest/testsuppfile.supp}"; //$NON-NLS-1$ - tab.getSuppFileText().setText(text); - ILaunch launch = saveAndLaunch(wc, "testWSSuppresions"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/testsuppfile.supp")).getLocation(); //$NON-NLS-1$ - assertTrue(cmd.contains("--suppressions=" + suppPath.toOSString())); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testSuppressions() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/testsuppfile.supp")).getLocation(); //$NON-NLS-1$ - tab.getSuppFileText().setText(suppPath.toOSString()); - ILaunch launch = saveAndLaunch(wc, "testSuppressions"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--suppressions=" + suppPath.toOSString())); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testSuppressionsSpaces() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - IPath suppPath = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path("basicTest/test suppfile.supp")).getLocation(); //$NON-NLS-1$ - tab.getSuppFileText().setText(suppPath.toOSString()); - ILaunch launch = saveAndLaunch(wc, "testSuppressionsSpaces"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--suppressions=" + suppPath.toOSString())); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testTraceChildren() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getTraceChildrenButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testTraceChildren"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--trace-children=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testDemangle() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getDemangleButton().setSelection(false); - ILaunch launch = saveAndLaunch(wc, "testDemangle"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--demangle=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testNumCallers() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getNumCallersSpinner().setSelection(24); - ILaunch launch = saveAndLaunch(wc, "testNumCallers"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--num-callers=24")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testErrorLimit() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getErrorLimitButton().setSelection(false); - ILaunch launch = saveAndLaunch(wc, "testErrorLimit"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--error-limit=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testShowBelowMain() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getShowBelowMainButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testShowBelowMain"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--show-below-main=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testMaxStackframe() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getMaxStackFrameSpinner().setSelection(50000000); - ILaunch launch = saveAndLaunch(wc, "testMaxStackframe"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--max-stackframe=50000000")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testRunFreeRes() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getRunFreeresButton().setSelection(false); - ILaunch launch = saveAndLaunch(wc, "testRunFreeRes"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--run-libc-freeres=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAlignment() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAlignmentSpinner().setSelection(512); - tab.performApply(wc); - config = wc.doSave(); - - assertTrue(tab.isValid(config)); - - ILaunch launch = doLaunch(config, "testAlignment"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--alignment=512")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testAlignmentBad() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getAlignmentSpinner().setSelection(63); - tab.performApply(wc); - config = wc.doSave(); - - assertFalse(tab.isValid(config)); - } - - public void testNoLeakCheck() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getLeakCheckButton().setSelection(false); - ILaunch launch = saveAndLaunch(wc, "testNoLeakCheck"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--leak-check=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testShowReachable() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getShowReachableButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testShowReachable"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--show-reachable=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testLeakResolutionMed() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - String[] opts = dynamicTab.getLeakResCombo().getItems(); - int ix = Arrays.asList(opts).indexOf(MemcheckLaunchConstants.LEAK_RES_MED); - dynamicTab.getLeakResCombo().select(ix); - ILaunch launch = saveAndLaunch(wc, "testLeakResolutionMed"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--leak-resolution=med")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testLeakResolutionHigh() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - String[] opts = dynamicTab.getLeakResCombo().getItems(); - int ix = Arrays.asList(opts).indexOf(MemcheckLaunchConstants.LEAK_RES_HIGH); - dynamicTab.getLeakResCombo().select(ix); - ILaunch launch = saveAndLaunch(wc, "testLeakResolutionHigh"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--leak-resolution=high")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testFreeListVol() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getFreelistSpinner().setSelection(2000000); - ILaunch launch = saveAndLaunch(wc, "testFreeListVol"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--freelist-vol=2000000")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testWorkaroundGCCBugs() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getGccWorkaroundButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testWorkaroundGCCBugs"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--workaround-gcc296-bugs=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testPartialLoads() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getPartialLoadsButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testPartialLoads"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--partial-loads-ok=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testUndefValueErrors() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - dynamicTab.getUndefValueButton().setSelection(false); - ILaunch launch = saveAndLaunch(wc, "testUndefValueErrors"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--undef-value-errors=no")); //$NON-NLS-1$ - } - else { - fail(); - } - } - - public void testMainStackSize() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - assertFalse(tab.getMainStackSizeSpinner().isEnabled()); - tab.getMainStackSizeButton().setSelection(true); - tab.getMainStackSizeButton().notifyListeners(SWT.Selection, null); - assertTrue(tab.getMainStackSizeSpinner().isEnabled()); - tab.getMainStackSizeSpinner().setSelection(2048); - ILaunch launch = saveAndLaunch(wc, "testMainStackFrame"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--main-stacksize=2048")); //$NON-NLS-1$ - } - else { - fail(); - } - } - else { - assertNull(tab.getMainStackSizeButton()); - assertNull(tab.getMainStackSizeSpinner()); - } - } - - public void testTrackOrigins() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - dynamicTab.getTrackOriginsButton().setSelection(true); - ILaunch launch = saveAndLaunch(wc, "testTrackOrigins"); //$NON-NLS-1$ - IProcess[] p = launch.getProcesses(); - if (p.length > 0) { - String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE); - assertEquals(0, p[0].getExitValue()); - assertTrue(cmd.contains("--track-origins=yes")); //$NON-NLS-1$ - } - else { - fail(); - } - } - else { - assertNull(dynamicTab.getTrackOriginsButton()); - } - } - - public void testTrackOriginsValidity() throws Exception { - ILaunchConfigurationWorkingCopy wc = initConfig(); - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - dynamicTab.getTrackOriginsButton().setSelection(true); - tab.performApply(wc); - assertTrue(tab.isValid(wc)); - dynamicTab.getUndefValueButton().setSelection(false); - tab.performApply(wc); - assertFalse(tab.isValid(wc)); - } - } - - public void testValgrindError() throws Exception { - String notExistentFile = "DOES NOT EXIST"; //$NON-NLS-1$ - ILaunchConfigurationWorkingCopy wc = initConfig(); - tab.getSuppFileText().setText(notExistentFile); - tab.performApply(wc); - config = wc.doSave(); - - assertFalse(tab.isValid(config)); - - doLaunch(config, "testValgrindError"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindMessage[] messages = view.getMessages(); - assertTrue(messages.length > 0); - - String text = messages[0].getText(); - assertTrue(text.contains(notExistentFile)); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java deleted file mode 100644 index 8631b56606..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceDoubleClickTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import java.io.File; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame; -import org.eclipse.linuxtools.valgrind.ui.CoreMessagesViewer; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.texteditor.ITextEditor; - -public class LinkedResourceDoubleClickTest extends AbstractLinkedResourceMemcheckTest { - private ValgrindStackFrame frame; - - public void testLinkedDoubleClickFile() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testLinkedDoubleClickFile"); //$NON-NLS-1$ - - doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - IEditorInput input = editor.getEditorInput(); - if (input instanceof IFileEditorInput) { - IFileEditorInput fileInput = (IFileEditorInput) input; - IFolder srcFolder = proj.getProject().getFolder("src"); //$NON-NLS-1$ - File expectedFile = new File(srcFolder.getLocation().toOSString(), frame.getFile()); - File actualFile = fileInput.getFile().getLocation().toFile(); - - assertTrue(fileInput.getFile().isLinked(IResource.CHECK_ANCESTORS)); - assertEquals(expectedFile.getCanonicalPath(), actualFile.getCanonicalPath()); - } - else { - fail(); - } - } - - public void testLinkedDoubleClickLine() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testLinkedDoubleClickLine"); //$NON-NLS-1$ - - doDoubleClick(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof ITextEditor) { - ITextEditor textEditor = (ITextEditor) editor; - - ISelection selection = textEditor.getSelectionProvider().getSelection(); - if (selection instanceof TextSelection) { - TextSelection textSelection = (TextSelection) selection; - int line = textSelection.getStartLine() + 1; // zero-indexed - - assertEquals(frame.getLine(), line); - } - else { - fail(); - } - } - else { - fail(); - } - } - - private void doDoubleClick() throws Exception { - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - CoreMessagesViewer viewer = view.getMessagesViewer(); - - // get first leaf - IValgrindMessage[] elements = (IValgrindMessage[]) viewer.getInput(); - IValgrindMessage element = elements[0]; - TreePath path = new TreePath(new Object[] { element }); - frame = null; - while (element.getChildren().length > 0) { - element = element.getChildren()[0]; - path = path.createChildPath(element); - if (element instanceof ValgrindStackFrame) { - frame = (ValgrindStackFrame) element; - } - } - assertNotNull(frame); - - viewer.expandToLevel(frame, TreeViewer.ALL_LEVELS); - TreeSelection selection = new TreeSelection(path); - - // do double click - IDoubleClickListener listener = viewer.getDoubleClickListener(); - listener.doubleClick(new DoubleClickEvent(viewer, selection)); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java deleted file mode 100644 index 620c077f70..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.core.ValgrindError; -import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class LinkedResourceMarkerTest extends AbstractLinkedResourceMemcheckTest { - - public void testLinkedMarkers() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testLinkedMarkers"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindMessage[] errors = view.getMessages(); - - ArrayList markers = new ArrayList(Arrays.asList(proj - .getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE, - true, IResource.DEPTH_INFINITE))); - assertEquals(4, markers.size()); - for (IValgrindMessage error : errors) { - findMarker(markers, error); - } - assertEquals(0, markers.size()); - } - - private void findMarker(ArrayList markers, IValgrindMessage error) - throws Exception, CoreException { - ValgrindStackFrame frame = null; - IValgrindMessage[] children = error.getChildren(); - for (int i = 0; i < children.length; i++) { - if (frame == null && children[i] instanceof ValgrindStackFrame - && isWorkspaceFrame((ValgrindStackFrame) children[i])) { - frame = (ValgrindStackFrame) children[i]; - } else if (children[i] instanceof ValgrindError) { - findMarker(markers, children[i]); - } - } - - int ix = -1; - for (int i = 0; i < markers.size(); i++) { - IMarker marker = markers.get(i); - if (marker.getAttribute(IMarker.MESSAGE).equals(error.getText()) - && marker.getResource().getName().equals(frame.getFile()) - && marker.getAttribute(IMarker.LINE_NUMBER).equals( - frame.getLine())) { - ix = i; - } - } - if (ix < 0) { - fail(); - } - markers.remove(ix); - } - - private boolean isWorkspaceFrame(ValgrindStackFrame frame) throws Exception { - ISourceLocator locator = frame.getLaunch().getSourceLocator(); - Object result = DebugUITools.lookupSource(frame.getFile(), locator) - .getSourceElement(); - return result != null && result instanceof IResource; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MarkerTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MarkerTest.java deleted file mode 100644 index db9785cd97..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MarkerTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.core.ValgrindError; -import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class MarkerTest extends AbstractMemcheckTest { - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testMarkers() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testDefaults"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindMessage[] errors = view.getMessages(); - - ArrayList markers = new ArrayList(Arrays.asList(proj - .getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE, - true, IResource.DEPTH_INFINITE))); - assertEquals(4, markers.size()); - for (IValgrindMessage error : errors) { - findMarker(markers, error); - } - assertEquals(0, markers.size()); - } - - private void findMarker(ArrayList markers, IValgrindMessage error) - throws Exception, CoreException { - ValgrindStackFrame frame = null; - IValgrindMessage[] children = error.getChildren(); - for (int i = 0; i < children.length; i++) { - if (frame == null && children[i] instanceof ValgrindStackFrame - && isWorkspaceFrame((ValgrindStackFrame) children[i])) { - frame = (ValgrindStackFrame) children[i]; - } else if (children[i] instanceof ValgrindError) { - findMarker(markers, children[i]); - } - } - - int ix = -1; - for (int i = 0; i < markers.size(); i++) { - IMarker marker = markers.get(i); - if (marker.getAttribute(IMarker.MESSAGE).equals(error.getText()) - && marker.getResource().getName().equals(frame.getFile()) - && marker.getAttribute(IMarker.LINE_NUMBER).equals( - frame.getLine())) { - ix = i; - } - } - if (ix < 0) { - fail(); - } - markers.remove(ix); - } - - private boolean isWorkspaceFrame(ValgrindStackFrame frame) throws Exception { - ISourceLocator locator = frame.getLaunch().getSourceLocator(); - Object result = DebugUITools.lookupSource(frame.getFile(), locator) - .getSourceElement(); - return result != null && result instanceof IResource; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MemcheckTestsPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MemcheckTestsPlugin.java deleted file mode 100644 index 61e20bf38e..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MemcheckTestsPlugin.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class MemcheckTestsPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.memcheck.tests"; //$NON-NLS-1$ - - // The shared instance - private static MemcheckTestsPlugin plugin; - - /** - * The constructor - */ - public MemcheckTestsPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static MemcheckTestsPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MinVersionTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MinVersionTest.java deleted file mode 100644 index b21f841fad..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MinVersionTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.eclipse.linuxtools.valgrind.launch.ValgrindOptionsTab; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.osgi.framework.Version; - -public class MinVersionTest extends AbstractMemcheckTest { - private static final Version VER_3_2_1 = new Version(3, 2, 1); - private Version verSave; - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - - saveVersion(); - } - - private void saveVersion() throws CoreException { - verSave = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - ValgrindLaunchPlugin.getDefault().setValgrindVersion(VER_3_2_1); - } - - @Override - protected void tearDown() throws Exception { - restoreVersion(); - - deleteProject(proj); - super.tearDown(); - } - - private void restoreVersion() { - ValgrindLaunchPlugin.getDefault().setValgrindVersion(verSave); - } - - public void testLaunchBadVersion() throws Exception { - // Put this back so we can make a valid config - restoreVersion(); - ILaunchConfiguration config = createConfiguration(proj.getProject()); - // For some reason we downgraded - saveVersion(); - - CoreException ce = null; - try { - doLaunch(config, "testDefaults"); //$NON-NLS-1$ - } catch (CoreException e) { - ce = e; - } - - assertNotNull(ce); - } - - public void testTabsBadVersion() throws Exception { - Shell testShell = new Shell(Display.getDefault()); - testShell.setLayout(new GridLayout()); - ValgrindOptionsTab tab = new ValgrindOptionsTab(); - - ILaunchConfiguration config = getLaunchConfigType().newInstance(null, getLaunchManager() - .generateUniqueLaunchConfigurationNameFrom( - proj.getProject().getName())); - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - tab.setDefaults(wc); - tab.createControl(testShell); - tab.initializeFrom(config); - tab.performApply(wc); - - assertFalse(tab.isValid(config)); - assertNotNull(tab.getErrorMessage()); - - testShell.dispose(); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MultiProcessTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MultiProcessTest.java deleted file mode 100644 index e24f73064f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/MultiProcessTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class MultiProcessTest extends AbstractMemcheckTest { - ICProject refProj; - - @Override - protected void setUp() throws Exception { - super.setUp(); - refProj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - proj = createProjectAndBuild("multiProcTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - deleteProject(refProj); - super.tearDown(); - } - - public void testNoExec() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testNoExec"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - assertEquals(1, view.getMessages().length); - } - - public void testExec() throws Exception { - ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy(); - config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true); - config.doSave(); - doLaunch(config, "testExec"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - assertEquals(4, view.getMessages().length); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ShortcutTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ShortcutTest.java deleted file mode 100644 index 33750d2adf..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/ShortcutTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.valgrind.tests.ValgrindTestLaunchShortcut; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; - -public class ShortcutTest extends AbstractMemcheckTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testShortcutSelection() throws Exception { - ValgrindTestLaunchShortcut shortcut = new ValgrindTestLaunchShortcut(); - - shortcut.launch(new StructuredSelection(proj.getProject()), ILaunchManager.PROFILE_MODE); - ILaunchConfiguration config = shortcut.getConfig(); - - compareWithDefaults(config); - } - - public void testShortcutEditor() throws Exception { - ValgrindTestLaunchShortcut shortcut = new ValgrindTestLaunchShortcut(); - - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IFile file = proj.getProject().getFile("test.c"); //$NON-NLS-1$ - IEditorPart editor = IDE.openEditor(page, file); - - assertNotNull(editor); - - shortcut.launch(editor, ILaunchManager.PROFILE_MODE); - ILaunchConfiguration config = shortcut.getConfig(); - - compareWithDefaults(config); - } - - public void testShortcutExistingConfig() throws Exception { - ILaunchConfiguration prev = createConfiguration(proj.getProject()); - - ValgrindTestLaunchShortcut shortcut = new ValgrindTestLaunchShortcut(); - shortcut.launch(new StructuredSelection(proj.getProject()), ILaunchManager.PROFILE_MODE); - ILaunchConfiguration current = shortcut.getConfig(); - - assertEquals(prev, current); - } - - private void compareWithDefaults(ILaunchConfiguration config) - throws CoreException { - // tests launch in foreground, this is not typical - ILaunchConfiguration defaults = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = defaults.getWorkingCopy(); - wc.removeAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND); - wc.doSave(); - - // Compare launch config with defaults - assertEquals(config.getAttributes(), defaults.getAttributes()); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/SignalTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/SignalTest.java deleted file mode 100644 index 0e31fdfd69..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/SignalTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck.tests; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin; -import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart; - -public class SignalTest extends AbstractMemcheckTest { - - @Override - protected void setUp() throws Exception { - super.setUp(); - proj = createProjectAndBuild("segvtest"); //$NON-NLS-1$ - } - - @Override - protected void tearDown() throws Exception { - deleteProject(proj); - super.tearDown(); - } - - public void testSegfaultHandle() throws Exception { - ILaunchConfiguration config = createConfiguration(proj.getProject()); - doLaunch(config, "testSegfault"); //$NON-NLS-1$ - - ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView(); - IValgrindMessage[] messages = view.getMessages(); - assertTrue(messages.length > 0); - assertTrue(messages[0].getText().contains("SIGSEGV")); //$NON-NLS-1$ - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/test.xml b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/test.xml index af2f654a06..b07e573e8d 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/test.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/test.xml @@ -1,7 +1,7 @@ - + diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/.project b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/.project index edeca935df..f0a1638749 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/ChangeLog index b5cb5c75a7..e18ae4d3cc 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/ChangeLog @@ -1,3 +1,11 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/memcheck: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/memcheck: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * plugin.xml: Updated class references. + 2009-07-09 Elliott Baron * MemcheckToolPage.java: Display version exceptions only in tab's errorMessage. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/META-INF/MANIFEST.MF index 948e74e9be..37f38ad110 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.memcheck;singleton:=true Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.memcheck.MemcheckPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.memcheck.MemcheckPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime @@ -18,11 +18,12 @@ Import-Package: org.eclipse.cdt.debug.core, org.eclipse.debug.ui, org.eclipse.debug.ui.sourcelookup, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, org.eclipse.linuxtools.profiling.ui, - org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch, org.eclipse.linuxtools.valgrind.ui, org.eclipse.ui.ide, org.eclipse.ui.texteditor Bundle-Localization: plugin -Export-Package: org.eclipse.linuxtools.valgrind.memcheck +Export-Package: org.eclipse.linuxtools.internal.valgrind.memcheck diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/plugin.xml index aca2cbc9f1..536a6f54dc 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/plugin.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/plugin.xml @@ -4,16 +4,16 @@ + page="org.eclipse.linuxtools.internal.valgrind.memcheck.MemcheckToolPage"> diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckCommandConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckCommandConstants.java deleted file mode 100644 index e4ed0426d2..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckCommandConstants.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -public final class MemcheckCommandConstants { - // Valgrind program arguments - public static final String OPT_LEAKCHECK = "--leak-check"; //$NON-NLS-1$ - public static final String OPT_SHOWREACH = "--show-reachable"; //$NON-NLS-1$ - public static final String OPT_LEAKRES = "--leak-resolution"; //$NON-NLS-1$ - public static final String OPT_FREELIST = "--freelist-vol"; //$NON-NLS-1$ - public static final String OPT_GCCWORK = "--workaround-gcc296-bugs"; //$NON-NLS-1$ - public static final String OPT_PARTIAL = "--partial-loads-ok"; //$NON-NLS-1$ - public static final String OPT_UNDEF = "--undef-value-errors"; //$NON-NLS-1$ - public static final String OPT_ALIGNMENT = "--alignment"; //$NON-NLS-1$ - - // VG >= 3.4.0 - public static final String OPT_TRACKORIGINS = "--track-origins"; //$NON-NLS-1$ -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchConstants.java deleted file mode 100644 index e58fa094cb..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchConstants.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -public final class MemcheckLaunchConstants { - // LaunchConfiguration attributes - public static final String ATTR_MEMCHECK_LEAKCHECK = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_LEAKCHECK"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_LEAKRES = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_LEAKRES"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_SHOWREACH = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_SHOWREACH"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_PARTIAL = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_PARTIAL"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_UNDEF = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_UNDEF"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_FREELIST = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_FREELIST"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_GCCWORK = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_GCCWORK"; //$NON-NLS-1$ - public static final String ATTR_MEMCHECK_ALIGNMENT = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_ALIGNMENT"; //$NON-NLS-1$ - - // VG >= 3.4.0 - public static final String ATTR_MEMCHECK_TRACKORIGINS = MemcheckPlugin.PLUGIN_ID + ".MEMCHECK_TRACKORIGINS"; //$NON-NLS-1$ - - public static final String LEAK_RES_LOW = "low"; //$NON-NLS-1$ - public static final String LEAK_RES_MED = "med"; //$NON-NLS-1$ - public static final String LEAK_RES_HIGH = "high"; //$NON-NLS-1$ - - public static final boolean DEFAULT_MEMCHECK_LEAKCHECK = true; - public static final String DEFAULT_MEMCHECK_LEAKRES = LEAK_RES_LOW; - public static final boolean DEFAULT_MEMCHECK_SHOWREACH = false; - public static final boolean DEFAULT_MEMCHECK_PARTIAL = false; - public static final boolean DEFAULT_MEMCHECK_UNDEF = true; - public static final int DEFAULT_MEMCHECK_FREELIST = 10000000; - public static final boolean DEFAULT_MEMCHECK_GCCWORK = false; - public static final int DEFAULT_MEMCHECK_ALIGNMENT = 8; - - // VG >= 3.4.0 - public static final boolean DEFAULT_MEMCHECK_TRACKORIGINS = false; -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java deleted file mode 100644 index df155c4f14..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.launch.IValgrindLaunchDelegate; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchConfigurationDelegate; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.osgi.framework.Version; - -public class MemcheckLaunchDelegate extends ValgrindLaunchConfigurationDelegate implements IValgrindLaunchDelegate { - - public void handleLaunch(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException { - } - - public String[] getCommandArray(ILaunchConfiguration config) throws CoreException { - ArrayList opts = new ArrayList(); - - opts.add(MemcheckCommandConstants.OPT_LEAKCHECK + EQUALS + (config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKCHECK, MemcheckLaunchConstants.DEFAULT_MEMCHECK_LEAKCHECK) ? YES : NO)); - opts.add(MemcheckCommandConstants.OPT_SHOWREACH + EQUALS + (config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_SHOWREACH, MemcheckLaunchConstants.DEFAULT_MEMCHECK_SHOWREACH) ? YES : NO)); - opts.add(MemcheckCommandConstants.OPT_LEAKRES + EQUALS + config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKRES, MemcheckLaunchConstants.DEFAULT_MEMCHECK_LEAKRES)); - opts.add(MemcheckCommandConstants.OPT_FREELIST + EQUALS + config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_FREELIST, MemcheckLaunchConstants.DEFAULT_MEMCHECK_FREELIST)); - opts.add(MemcheckCommandConstants.OPT_GCCWORK + EQUALS + (config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_GCCWORK, MemcheckLaunchConstants.DEFAULT_MEMCHECK_GCCWORK) ? YES : NO)); - opts.add(MemcheckCommandConstants.OPT_PARTIAL + EQUALS + (config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_PARTIAL, MemcheckLaunchConstants.DEFAULT_MEMCHECK_PARTIAL) ? YES : NO)); - opts.add(MemcheckCommandConstants.OPT_UNDEF + EQUALS + (config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_UNDEF, MemcheckLaunchConstants.DEFAULT_MEMCHECK_UNDEF) ? YES : NO)); - opts.add(MemcheckCommandConstants.OPT_ALIGNMENT + EQUALS + config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_ALIGNMENT, MemcheckLaunchConstants.DEFAULT_MEMCHECK_ALIGNMENT)); - - // 3.4.0 specific - try { - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - opts.add(MemcheckCommandConstants.OPT_TRACKORIGINS + EQUALS + (config.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_TRACKORIGINS, MemcheckLaunchConstants.DEFAULT_MEMCHECK_TRACKORIGINS) ? YES : NO)); - } - } catch (CoreException e) { - e.printStackTrace(); - } - - return opts.toArray(new String[opts.size()]); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckPlugin.java deleted file mode 100644 index e0847565c0..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckPlugin.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -import org.eclipse.linuxtools.valgrind.core.PluginConstants; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class MemcheckPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.memcheck"; //$NON-NLS-1$ - // The shared instance - private static MemcheckPlugin plugin; - - public static final String TOOL_ID = PluginConstants.LAUNCH_PLUGIN_ID + ".memcheck"; //$NON-NLS-1$ - - /** - * The constructor - */ - public MemcheckPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static MemcheckPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckToolPage.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckToolPage.java deleted file mode 100644 index e1a839dc12..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckToolPage.java +++ /dev/null @@ -1,310 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.linuxtools.valgrind.launch.IValgrindToolPage; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; -import org.osgi.framework.Version; - -public class MemcheckToolPage extends AbstractLaunchConfigurationTab implements IValgrindToolPage { - public static final String MEMCHECK = "memcheck"; //$NON-NLS-1$ - public static final String PLUGIN_ID = MemcheckPlugin.PLUGIN_ID; - - // MEMCHECK controls - protected Button leakCheckButton; - protected Combo leakResCombo; - protected Button showReachableButton; - protected Spinner freelistSpinner; - protected Button partialLoadsButton; - protected Button undefValueButton; - protected Button gccWorkaroundButton; - protected Spinner alignmentSpinner; - - // VG >= 3.4.0 - protected Button trackOriginsButton; - - protected boolean isInitializing = false; - protected CoreException ex = null; - - protected SelectionListener selectListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - updateLaunchConfigurationDialog(); - } - }; - protected ModifyListener modifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }; - - public void createControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - GridLayout memcheckLayout = new GridLayout(2, true); - top.setLayout(memcheckLayout); - top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - leakCheckButton = new Button(top, SWT.CHECK); - leakCheckButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - leakCheckButton.setText(Messages.getString("MemcheckToolPage.leak_check")); //$NON-NLS-1$ - leakCheckButton.addSelectionListener(selectListener); - - Composite leakResTop = new Composite(top, SWT.NONE); - leakResTop.setLayout(new GridLayout(2, false)); - leakResTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label leakResLabel = new Label(leakResTop, SWT.NONE); - leakResLabel.setText(Messages.getString("MemcheckToolPage.leak_resolution")); //$NON-NLS-1$ - leakResCombo = new Combo(leakResTop, SWT.READ_ONLY); - String[] leakResOpts = { MemcheckLaunchConstants.LEAK_RES_LOW, MemcheckLaunchConstants.LEAK_RES_MED, MemcheckLaunchConstants.LEAK_RES_HIGH }; - leakResCombo.setItems(leakResOpts); - leakResCombo.addSelectionListener(selectListener); - - Composite freelistTop = new Composite(top, SWT.NONE); - freelistTop.setLayout(new GridLayout(2, false)); - freelistTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label freelistLabel = new Label(freelistTop, SWT.NONE); - freelistLabel.setText(Messages.getString("MemcheckToolPage.freelist_size")); //$NON-NLS-1$ - freelistSpinner = new Spinner(freelistTop, SWT.BORDER); - freelistSpinner.setMaximum(Integer.MAX_VALUE); - freelistSpinner.addModifyListener(modifyListener); - - showReachableButton = new Button(top, SWT.CHECK); - showReachableButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - showReachableButton.setText(Messages.getString("MemcheckToolPage.show_reachable")); //$NON-NLS-1$ - showReachableButton.addSelectionListener(selectListener); - - partialLoadsButton = new Button(top, SWT.CHECK); - partialLoadsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - partialLoadsButton.setText(Messages.getString("MemcheckToolPage.allow_partial")); //$NON-NLS-1$ - partialLoadsButton.addSelectionListener(selectListener); - - undefValueButton = new Button(top, SWT.CHECK); - undefValueButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - undefValueButton.setText(Messages.getString("MemcheckToolPage.undef_value_errors")); //$NON-NLS-1$ - undefValueButton.addSelectionListener(selectListener); - - // 3.4.0 specific - try { - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - trackOriginsButton = new Button(top, SWT.CHECK); - trackOriginsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - trackOriginsButton.setText(Messages.getString("MemcheckToolPage.Track_origins")); //$NON-NLS-1$ - trackOriginsButton.addSelectionListener(selectListener); - } - } catch (CoreException e) { - ex = e; - } - - gccWorkaroundButton = new Button(top, SWT.CHECK); - gccWorkaroundButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - gccWorkaroundButton.setText(Messages.getString("MemcheckToolPage.gcc_296_workarounds")); //$NON-NLS-1$ - gccWorkaroundButton.addSelectionListener(selectListener); - - Composite alignmentTop = new Composite(top, SWT.NONE); - alignmentTop.setLayout(new GridLayout(2, false)); - alignmentTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label alignmentLabel = new Label(alignmentTop, SWT.NONE); - alignmentLabel.setText(Messages.getString("MemcheckToolPage.minimum_heap_block")); //$NON-NLS-1$ - alignmentSpinner = new Spinner(alignmentTop, SWT.BORDER); - alignmentSpinner.setMinimum(8); - alignmentSpinner.setMaximum(4096); - alignmentSpinner.addModifyListener(modifyListener); - } - - - public String getName() { - return Messages.getString("MemcheckToolPage.Memcheck_Options"); //$NON-NLS-1$ - } - - public void initializeFrom(ILaunchConfiguration configuration) { - isInitializing = true; - try { - leakCheckButton.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKCHECK, MemcheckLaunchConstants.DEFAULT_MEMCHECK_LEAKCHECK)); - leakResCombo.setText(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKRES, MemcheckLaunchConstants.DEFAULT_MEMCHECK_LEAKRES)); - showReachableButton.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_SHOWREACH, MemcheckLaunchConstants.DEFAULT_MEMCHECK_SHOWREACH)); - freelistSpinner.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_FREELIST, MemcheckLaunchConstants.DEFAULT_MEMCHECK_FREELIST)); - partialLoadsButton.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_PARTIAL, MemcheckLaunchConstants.DEFAULT_MEMCHECK_PARTIAL)); - undefValueButton.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_UNDEF, MemcheckLaunchConstants.DEFAULT_MEMCHECK_UNDEF)); - gccWorkaroundButton.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_GCCWORK, MemcheckLaunchConstants.DEFAULT_MEMCHECK_GCCWORK)); - alignmentSpinner.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_ALIGNMENT, MemcheckLaunchConstants.DEFAULT_MEMCHECK_ALIGNMENT)); - - // 3.4.0 specific - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - trackOriginsButton.setSelection(configuration.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_TRACKORIGINS, MemcheckLaunchConstants.DEFAULT_MEMCHECK_TRACKORIGINS)); - } - } catch (CoreException e) { - ex = e; - } - isInitializing = false; - } - - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKCHECK, leakCheckButton.getSelection()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKRES, leakResCombo.getText()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_SHOWREACH, showReachableButton.getSelection()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_FREELIST, freelistSpinner.getSelection()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_PARTIAL, partialLoadsButton.getSelection()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_UNDEF, undefValueButton.getSelection()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_GCCWORK, gccWorkaroundButton.getSelection()); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_ALIGNMENT, alignmentSpinner.getSelection()); - - // 3.4.0 specific - try { - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_TRACKORIGINS, trackOriginsButton.getSelection()); - } - } catch (CoreException e) { - ex = e; - } - } - - @Override - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - - boolean result = false; - try { - // check alignment - int alignment = launchConfig.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_ALIGNMENT, MemcheckLaunchConstants.DEFAULT_MEMCHECK_ALIGNMENT); - result = (alignment & (alignment - 1)) == 0; // is power of two? - if (!result) { - setErrorMessage(Messages.getString("MemcheckToolPage.Alignment_must_be_power_2")); //$NON-NLS-1$ - } - else { - // 3.4.0 specific - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - // check track-origins - boolean trackOrigins = launchConfig.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_TRACKORIGINS, MemcheckLaunchConstants.DEFAULT_MEMCHECK_TRACKORIGINS); - if (trackOrigins) { - // undef-value-errors must be selected - result = launchConfig.getAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_UNDEF, MemcheckLaunchConstants.DEFAULT_MEMCHECK_UNDEF); - if (!result) { - setErrorMessage(NLS.bind(Messages.getString("MemcheckToolPage.Track_origins_needs_undef"), Messages.getString("MemcheckToolPage.Track_origins"), Messages.getString("MemcheckToolPage.undef_value_errors"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - } - } - } catch (CoreException e) { - ex = e; - } - - if (ex != null) { - setErrorMessage(ex.getLocalizedMessage()); - } - return result; - } - - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKCHECK, MemcheckLaunchConstants.DEFAULT_MEMCHECK_LEAKCHECK); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_LEAKRES, MemcheckLaunchConstants.DEFAULT_MEMCHECK_LEAKRES); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_SHOWREACH, MemcheckLaunchConstants.DEFAULT_MEMCHECK_SHOWREACH); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_FREELIST, MemcheckLaunchConstants.DEFAULT_MEMCHECK_FREELIST); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_PARTIAL, MemcheckLaunchConstants.DEFAULT_MEMCHECK_PARTIAL); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_UNDEF, MemcheckLaunchConstants.DEFAULT_MEMCHECK_UNDEF); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_GCCWORK, MemcheckLaunchConstants.DEFAULT_MEMCHECK_GCCWORK); - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_ALIGNMENT, MemcheckLaunchConstants.DEFAULT_MEMCHECK_ALIGNMENT); - - // 3.4.0 specific - try { - Version ver = ValgrindLaunchPlugin.getDefault().getValgrindVersion(); - if (ver.compareTo(ValgrindLaunchPlugin.VER_3_4_0) >= 0) { - configuration.setAttribute(MemcheckLaunchConstants.ATTR_MEMCHECK_TRACKORIGINS, MemcheckLaunchConstants.DEFAULT_MEMCHECK_TRACKORIGINS); - } - } catch (CoreException e) { - ex = e; - } - } - - protected void createHorizontalSpacer(Composite comp, int numlines) { - Label lbl = new Label(comp, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = numlines; - lbl.setLayoutData(gd); - } - - @Override - protected void updateLaunchConfigurationDialog() { - if (!isInitializing) { - super.updateLaunchConfigurationDialog(); - } - } - - - public Button getLeakCheckButton() { - return leakCheckButton; - } - - - public Combo getLeakResCombo() { - return leakResCombo; - } - - - public Button getShowReachableButton() { - return showReachableButton; - } - - - public Spinner getFreelistSpinner() { - return freelistSpinner; - } - - - public Button getPartialLoadsButton() { - return partialLoadsButton; - } - - - public Button getUndefValueButton() { - return undefValueButton; - } - - - public Button getGccWorkaroundButton() { - return gccWorkaroundButton; - } - - - public Spinner getAlignmentSpinner() { - return alignmentSpinner; - } - - - public Button getTrackOriginsButton() { - return trackOriginsButton; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java deleted file mode 100644 index 9e7ede117e..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -import org.eclipse.jface.action.IAction; -import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.part.ViewPart; - -public class MemcheckViewPart extends ViewPart implements IValgrindToolView { - - @Override - public void createPartControl(Composite parent) { - } - - @Override - public void setFocus() { - } - - public void refreshView() { - } - - public IAction[] getToolbarActions() { - return null; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/Messages.java deleted file mode 100644 index 76896bd5d7..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.memcheck; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.memcheck.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/messages.properties deleted file mode 100644 index 0c5d282d62..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/messages.properties +++ /dev/null @@ -1,15 +0,0 @@ -MemcheckLaunchDelegate.Error_parsing_output=Error parsing output -MemcheckLaunchDelegate.Parsing_Memcheck_Output=Parsing Memcheck Output -MemcheckToolPage.Alignment_must_be_power_2=Alignment must be a power of 2 between 8 and 4096 inclusive -MemcheckToolPage.allow_partial=Allow partial loads -MemcheckToolPage.freelist_size=Freelist size (blocks): -MemcheckToolPage.gcc_296_workarounds=GCC 2.96 workarounds -MemcheckToolPage.leak_check=Leak check: -MemcheckToolPage.leak_check=Check for memory leaks -MemcheckToolPage.leak_resolution=Leak resolution: -MemcheckToolPage.Memcheck_Options=Memcheck Options -MemcheckToolPage.show_reachable=Show reachable blocks -MemcheckToolPage.undef_value_errors=Undefined value errors -MemcheckToolPage.minimum_heap_block=Minimum heap block alignment: -MemcheckToolPage.Track_origins=Track origins of uninitialized values -MemcheckToolPage.Track_origins_needs_undef="{0}" cannot be used without selecting "{1}" diff --git a/valgrind/org.eclipse.linuxtools.valgrind.test-feature/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.test-feature/ChangeLog index bbb0ef77ab..af3b8ab71f 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.test-feature/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.test-feature/ChangeLog @@ -1,3 +1,7 @@ +2009-07-30 Elliott Baron + + * feature.xml: Recomputed dependencies. + 2009-05-28 Elliott Baron * feature.properties: Fix featureProvider key. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.test-feature/feature.xml b/valgrind/org.eclipse.linuxtools.valgrind.test-feature/feature.xml index c74bc18d69..db297849b7 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.test-feature/feature.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.test-feature/feature.xml @@ -22,28 +22,30 @@ + + - - + + - - - - + + + + + + * src/org/eclipse/linuxtools/valgrind/tests: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/tests: New package. + * META-INF/MANIFEST.MF: Export internal package. + * test.xml: Update class references. + 2009-06-25 Elliott Baron * ValgrindStubProcess.java: Removed unused code. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.tests/META-INF/MANIFEST.MF index 6d9e35c7fb..7171cfde4d 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.tests/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 0.2.0.qualifier Bundle-Vendor: %Bundle-Vendor.0 Bundle-Localization: plugin Bundle-ActivationPolicy: lazy -Bundle-Activator: org.eclipse.linuxtools.valgrind.tests.ValgrindTestsPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.tests.ValgrindTestsPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.junit;bundle-version="[0.0.0,4.0.0)" @@ -18,8 +18,9 @@ Import-Package: org.eclipse.cdt.core.model, org.eclipse.debug.core, org.eclipse.debug.core.model, org.eclipse.debug.ui, + org.eclipse.linuxtools.internal.valgrind.core, + org.eclipse.linuxtools.internal.valgrind.launch, org.eclipse.linuxtools.profiling.launch, org.eclipse.linuxtools.profiling.tests, - org.eclipse.linuxtools.valgrind.core, org.eclipse.linuxtools.valgrind.launch -Export-Package: org.eclipse.linuxtools.valgrind.tests +Export-Package: org.eclipse.linuxtools.internal.valgrind.tests diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/AbstractValgrindTest.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/AbstractValgrindTest.java deleted file mode 100644 index bcb901ef67..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/AbstractValgrindTest.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileFilter; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.Launch; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.linuxtools.profiling.tests.AbstractTest; -import org.eclipse.linuxtools.valgrind.core.LaunchConfigurationConstants; -import org.eclipse.linuxtools.valgrind.core.ValgrindCommand; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin; -import org.eclipse.linuxtools.valgrind.launch.ValgrindOptionsTab; -import org.osgi.framework.Bundle; - -public abstract class AbstractValgrindTest extends AbstractTest { - - private static final String TEMPLATE_PREFIX = "template_"; //$NON-NLS-1$ - private static final FileFilter TEMPLATE_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return pathname.getName().startsWith(TEMPLATE_PREFIX) && !pathname.isHidden(); - } - }; - private static final FileFilter NOT_TEMPLATE_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return !pathname.getName().startsWith(TEMPLATE_PREFIX) && !pathname.isHidden(); - } - }; - - private static final String SEARCH_STRING_WS = "XXXXXXXXXXXX"; //$NON-NLS-1$ - private static final String SEARCH_STRING_BL = "YYYYYYYYYYYY"; //$NON-NLS-1$ - - private List launches; - - @Override - protected void setUp() throws Exception { - launches = new ArrayList(); - - // Substitute Valgrind command line interaction - ValgrindLaunchPlugin.getDefault().setValgrindCommand(getValgrindCommand()); - - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - if (launches.size() > 0) { - DebugPlugin.getDefault().getLaunchManager().removeLaunches(launches.toArray(new ILaunch[launches.size()])); - launches.clear(); - } - super.tearDown(); - } - - @Override - protected ILaunchConfigurationType getLaunchConfigType() { - return getLaunchManager().getLaunchConfigurationType(ValgrindLaunchPlugin.LAUNCH_ID); - } - - protected ILaunch doLaunch(ILaunchConfiguration config, String testName) throws Exception { - ILaunch launch; - IPath pathToFiles = getPathToFiles(testName); - - if (!ValgrindTestsPlugin.RUN_VALGRIND) { - bindLocation(pathToFiles); - } - - ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - wc.setAttribute(LaunchConfigurationConstants.ATTR_INTERNAL_OUTPUT_DIR, pathToFiles.toOSString()); - wc.doSave(); - - ValgrindTestLaunchDelegate delegate = new ValgrindTestLaunchDelegate(); - launch = new Launch(config, ILaunchManager.PROFILE_MODE, null); - - DebugPlugin.getDefault().getLaunchManager().addLaunch(launch); - launches.add(launch); - delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null); - - if (ValgrindTestsPlugin.GENERATE_FILES) { - unbindLocation(pathToFiles); - } - return launch; - } - - protected IPath getPathToFiles(String testName) throws URISyntaxException, - IOException { - URL location = FileLocator.find(getBundle(), new Path("valgrindFiles"), null); //$NON-NLS-1$ - File file = new File(FileLocator.toFileURL(location).toURI()); - IPath pathToFiles = new Path(file.getCanonicalPath()).append(testName); - return pathToFiles; - } - - private void unbindLocation(IPath pathToFiles) throws IOException { - String bundleLoc = FileLocator.getBundleFile(getBundle()).getCanonicalPath(); - String workspaceLoc = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); - File testDir = pathToFiles.toFile(); - for (File log : testDir.listFiles(NOT_TEMPLATE_FILTER)) { - File template = new File(testDir, TEMPLATE_PREFIX + log.getName()); - replaceLocation(log, template, new String[] { bundleLoc, workspaceLoc }, new String[] { SEARCH_STRING_BL , SEARCH_STRING_WS }); - } - } - - private void bindLocation(IPath pathToFiles) throws IOException { - String bundleLoc = FileLocator.getBundleFile(getBundle()).getCanonicalPath(); - String workspaceLoc = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); - File testDir = pathToFiles.toFile(); - for (File template : testDir.listFiles(TEMPLATE_FILTER)) { - String name = template.getName().replace(TEMPLATE_PREFIX, ""); //$NON-NLS-1$ - File log = new File(testDir, name.substring(name.indexOf(TEMPLATE_PREFIX) + 1)); - replaceLocation(template, log, new String[] { SEARCH_STRING_BL, SEARCH_STRING_WS }, new String[] { bundleLoc, workspaceLoc }); - } - } - - private void replaceLocation(File oldFile, File newFile, String[] from, String[] to) { - if (oldFile.isFile()) { - BufferedReader br = null; - PrintWriter pw = null; - try { - br = new BufferedReader(new FileReader(oldFile)); - pw = new PrintWriter(new FileWriter(newFile)); - - String line; - while ((line = br.readLine()) != null) { - for (int i = 0; i < from.length; i++) { - line = line.replaceAll(from[i], to[i]); - } - pw.println(line); - } - - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - if (pw != null) { - pw.close(); - } - } - } - } - - @Override - protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException { - ILaunchConfigurationTab tab = new ValgrindOptionsTab(); - tab.setDefaults(wc); - tab = ValgrindLaunchPlugin.getDefault().getToolPage(getToolID()); - tab.setDefaults(wc); - wc.setAttribute(LaunchConfigurationConstants.ATTR_TOOL, getToolID()); - } - - protected ICProject createProjectAndBuild(String projname) throws Exception { - return createProjectAndBuild(getBundle(), projname); - } - - protected abstract Bundle getBundle(); - - protected abstract String getToolID(); - - private ValgrindCommand getValgrindCommand() { - if (!ValgrindTestsPlugin.RUN_VALGRIND) { - return new ValgrindStubCommand(); - } - else { - return new ValgrindCommand(); - } - } - -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ResourceChangePrinter.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ResourceChangePrinter.java deleted file mode 100644 index 3905827bff..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ResourceChangePrinter.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import java.io.PrintStream; -import java.io.PrintWriter; - -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; - -public class ResourceChangePrinter implements IResourceChangeListener { - - private PrintWriter resourceChangeWriter; - - public ResourceChangePrinter(PrintStream out) { - resourceChangeWriter = new PrintWriter(out); - } - - public void resourceChanged(IResourceChangeEvent event) { - switch (event.getType()) { - case IResourceChangeEvent.POST_BUILD: - resourceChangeWriter.println("POST_BUILD " + event.getSource()); //$NON-NLS-1$ - break; - case IResourceChangeEvent.PRE_BUILD: - resourceChangeWriter.println("PRE_BUILD " + event.getSource()); //$NON-NLS-1$ - break; - case IResourceChangeEvent.PRE_DELETE: - resourceChangeWriter.println("PRE_DELETE " + event.getResource()); //$NON-NLS-1$ - break; - case IResourceChangeEvent.PRE_REFRESH: - resourceChangeWriter.println("PRE_REFRESH " + event.getResource()); //$NON-NLS-1$ - break; - case IResourceChangeEvent.POST_CHANGE: - resourceChangeWriter.println("POST_CHANGE "); //$NON-NLS-1$ - printDelta(event.getDelta(), 0); - break; - } - } - - private void printDelta(IResourceDelta delta, int depth) { - for (int i = 0; i < depth; i++) { - resourceChangeWriter.print("\t"); //$NON-NLS-1$ - } - switch (delta.getKind()) { - case IResourceDelta.ADDED: - resourceChangeWriter.print("ADDED "); //$NON-NLS-1$ - break; - case IResourceDelta.CHANGED: - resourceChangeWriter.print("CHANGED "); //$NON-NLS-1$ - break; - case IResourceDelta.REMOVED: - resourceChangeWriter.print("REMOVED "); //$NON-NLS-1$ - break; - } - if (delta.getResource() != null) { - resourceChangeWriter.println(delta.getResource()); - } - for (IResourceDelta child : delta.getAffectedChildren()) { - printDelta(child, depth + 1); - } - } -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubCommand.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubCommand.java deleted file mode 100644 index e0b7b282b8..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubCommand.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.linuxtools.valgrind.core.ValgrindCommand; - -public class ValgrindStubCommand extends ValgrindCommand { - protected static final String VERSION_FILE = ".version"; //$NON-NLS-1$ - - protected int exitcode; - - @Override - public String whichValgrind() throws IOException { - return "/path/to/valgrind"; //$NON-NLS-1$ - } - - @Override - public String whichVersion(String whichValgrind) throws IOException { - return "valgrind-3.4.0"; //$NON-NLS-1$ - } - - @Override - public void execute(String[] commandArray, String[] env, File wd, - boolean usePty) throws IOException { - args = commandArray; - } - - @Override - public Process getProcess() { - return null; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubProcess.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubProcess.java deleted file mode 100644 index 45df8c15b7..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubProcess.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.IStreamsProxy; - -public class ValgrindStubProcess implements IProcess { - protected Map attributes; - protected ILaunch launch; - protected String label; - protected IStreamsProxy streamsProxy; - - public ValgrindStubProcess(ILaunch launch, String label) { - attributes = new HashMap(); - streamsProxy = new ValgrindStubStreamsProxy(); - this.launch = launch; - this.label = label; - - launch.addProcess(this); - } - - public String getAttribute(String key) { - return attributes.get(key); - } - - public int getExitValue() throws DebugException { - return 0; - } - - public String getLabel() { - return label; - } - - public ILaunch getLaunch() { - return launch; - } - - public IStreamsProxy getStreamsProxy() { - return streamsProxy; - } - - public void setAttribute(String key, String value) { - attributes.put(key, value); - } - - @SuppressWarnings("unchecked") - public Object getAdapter(Class adapter) { - return null; - } - - public boolean canTerminate() { - return true; - } - - public boolean isTerminated() { - return true; - } - - public void terminate() throws DebugException { - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubStreamsProxy.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubStreamsProxy.java deleted file mode 100644 index 3e94edb1f9..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindStubStreamsProxy.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import java.io.IOException; - -import org.eclipse.debug.core.model.IStreamMonitor; -import org.eclipse.debug.core.model.IStreamsProxy; - -public class ValgrindStubStreamsProxy implements IStreamsProxy { - - public IStreamMonitor getErrorStreamMonitor() { - return null; - } - - public IStreamMonitor getOutputStreamMonitor() { - return null; - } - - public void write(String input) throws IOException { - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchDelegate.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchDelegate.java deleted file mode 100644 index 9c9b11ef6e..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchDelegate.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.linuxtools.valgrind.core.ValgrindCommand; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchConfigurationDelegate; - -public class ValgrindTestLaunchDelegate extends ValgrindLaunchConfigurationDelegate { - - protected static final String ERROR_CODE_FILE = ".errorCode"; //$NON-NLS-1$ - - @Override - protected ValgrindCommand getValgrindCommand() { - if (!ValgrindTestsPlugin.RUN_VALGRIND) { - return new ValgrindStubCommand(); - } - else { - return super.getValgrindCommand(); - } - } - - @Override - protected void createDirectory(IPath path) throws IOException { - if (ValgrindTestsPlugin.RUN_VALGRIND) { - super.createDirectory(path); - } - } - - @Override - protected IProcess createNewProcess(ILaunch launch, Process systemProcess, - String programName) { - IProcess process; - if (ValgrindTestsPlugin.RUN_VALGRIND) { - process = super.createNewProcess(launch, systemProcess, programName); - } - else { - process = new ValgrindStubProcess(launch, programName); - } - return process; - } - - @Override - protected void setOutputPath(ILaunchConfiguration config) - throws CoreException, IOException { - if (!ValgrindTestsPlugin.GENERATE_FILES && ValgrindTestsPlugin.RUN_VALGRIND) { - super.setOutputPath(config); - } - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchShortcut.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchShortcut.java deleted file mode 100644 index c0388a2c10..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestLaunchShortcut.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import org.eclipse.cdt.core.model.IBinary; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchShortcut; - -public class ValgrindTestLaunchShortcut extends ValgrindLaunchShortcut { - - private ILaunchConfiguration config; - - @Override - public void launch(IBinary bin, String mode) { - config = findLaunchConfiguration(bin, mode); - } - - public ILaunchConfiguration getConfig() { - return config; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestsPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestsPlugin.java deleted file mode 100644 index 8d854cf629..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/valgrind/tests/ValgrindTestsPlugin.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.tests; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class ValgrindTestsPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.tests"; //$NON-NLS-1$ - - // Java Runtime System Properties - /** - * usage: -Declipse.valgrind.tests.generateFiles= [default: no] - * if yes, will run Valgrind and store its output files for each test under - * /valgrindFiles - * no, will use default output directory for valgrind's output - */ - public static final String SYSTEM_PROPERTY_GENERATE_FILES = "eclipse.valgrind.tests.generateFiles"; //$NON-NLS-1$ - public static final boolean GENERATE_FILES = System.getProperty(SYSTEM_PROPERTY_GENERATE_FILES, "no").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * usage: -Declipse.valgrind.tests.runValgrind= [default: yes] - * if yes, will run Valgrind as in a normal launch - * no, will simulate Valgrind execution with pregenerated log files - */ - public static final String SYSTEM_PROPERTY_RUN_VALGRIND = "eclipse.valgrind.tests.runValgrind"; //$NON-NLS-1$ - // generateFiles implies runValgrind - public static final boolean RUN_VALGRIND = GENERATE_FILES || System.getProperty(SYSTEM_PROPERTY_RUN_VALGRIND, "yes").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$ - - // Launch config attribute to mock valgrind's exit code - public static final String ATTR_MOCK_EXIT_CODE = PLUGIN_ID + ".MOCK_EXIT_CODE"; //$NON-NLS-1$ - - // The shared instance - private static ValgrindTestsPlugin plugin; - - /** - * The constructor - */ - public ValgrindTestsPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static ValgrindTestsPlugin getDefault() { - return plugin; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/test.xml b/valgrind/org.eclipse.linuxtools.valgrind.tests/test.xml index 6db666622b..6f072efeb6 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.tests/test.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.tests/test.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/.project b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/.project index 12f9b62f26..fa69d42d0f 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/ChangeLog index 9b33e1dce9..1aff30d931 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/ChangeLog @@ -1,3 +1,11 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/ui/editor: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/ui/editor: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * plugin.xml: Update class references. + 2009-07-13 Elliott Baron * .classpath: New file. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/META-INF/MANIFEST.MF index 2935f9c3c5..c49b6ca46a 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.ui.editor;singleton:=true Bundle-Version: 0.3.0.qualifer -Bundle-Activator: org.eclipse.linuxtools.valgrind.ui.editor.ValgrindEditorPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.ui.editor.ValgrindEditorPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime @@ -18,3 +18,4 @@ Import-Package: org.eclipse.jface.text, org.eclipse.jface.text.source.projection, org.eclipse.ui.editors.text, org.eclipse.ui.texteditor +Export-Package: org.eclipse.linuxtools.internal.valgrind.ui.editor diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/plugin.xml index 2b736b30d3..1518d077e2 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/plugin.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/plugin.xml @@ -4,7 +4,7 @@ 0) { - for (int n = offset - 1; n >= 0 && word == null; n--) { - char c = doc.getChar(n); - if (!Character.isLetterOrDigit(c)) { - word = doc.get(n + 1, offset - n - 1); - } - else if (n == 0) { - // beginning of file - word = doc.get(0, offset - n); - } + for (int n = offset - 1; n >= 0 && word == null; n--) { + char c = doc.getChar(n); + if (!Character.isLetterOrDigit(c)) { + word = doc.get(n + 1, offset - n - 1); } } return word; @@ -95,6 +89,9 @@ public class SuppressionsContentAssistProcessor implements private String[] getCompletionStrings(String prefix, String toolName) { List words = new ArrayList(); + if (prefix == null || SuppressionsElementScanner.MEMCHECK.startsWith(prefix)) { + words.add(SuppressionsElementScanner.MEMCHECK + ":"); //$NON-NLS-1$ + } // If the cursor is after "Memcheck:" if (toolName != null && toolName.equals(SuppressionsElementScanner.MEMCHECK)) { @@ -104,15 +101,10 @@ public class SuppressionsContentAssistProcessor implements } } } - else { - if (prefix == null || SuppressionsElementScanner.MEMCHECK.startsWith(prefix)) { - words.add(SuppressionsElementScanner.MEMCHECK + ":"); //$NON-NLS-1$ - } - - for (String word : SuppressionsElementScanner.CONTEXTS) { - if (prefix == null || word.startsWith(prefix)) { - words.add(word + ":"); //$NON-NLS-1$ - } + + for (String word : SuppressionsElementScanner.CONTEXTS) { + if (prefix == null || word.startsWith(prefix)) { + words.add(word + ":"); //$NON-NLS-1$ } } return words.toArray(new String[words.size()]); @@ -120,19 +112,13 @@ public class SuppressionsContentAssistProcessor implements private String getToolName(IDocument doc, int offset) throws BadLocationException { String tool = null; - if (offset > 0) { - char c = doc.getChar(--offset); - // syntax is "toolName:suppressionKind" - if (c == ':' && offset > 0) { - for (int n = offset - 1; n >= 0 && tool == null; n--) { - c = doc.getChar(n); - if (!Character.isLetter(c)) { - tool = doc.get(n + 1, offset - n - 1); - } - else if (n == 0) { - // Beginning of file - tool = doc.get(0, offset - n); - } + char c = doc.getChar(--offset); + // syntax is "toolName:suppressionKind" + if (c == ':') { + for (int n = offset - 1; n >= 0 && tool == null; n--) { + c = doc.getChar(n); + if (!Character.isLetter(c)) { + tool = doc.get(n + 1, offset - n - 1); } } } diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ColorManager.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ColorManager.java deleted file mode 100644 index cb558f30ff..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ColorManager.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API and implementation. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ - -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; - -public class ColorManager { - - protected Map colorTable = new HashMap(10); - - public void dispose() { - Iterator e = colorTable.values().iterator(); - while (e.hasNext()) - e.next().dispose(); - } - - public Color getColor(RGB rgb) { - Color color = colorTable.get(rgb); - if (color == null) { - color = new Color(Display.getCurrent(), rgb); - colorTable.put(rgb, color); - } - return color; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ISuppressionsColorConstants.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ISuppressionsColorConstants.java deleted file mode 100644 index feb5166025..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ISuppressionsColorConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import org.eclipse.swt.graphics.RGB; - -public interface ISuppressionsColorConstants { - public static final RGB DEFAULT = new RGB(0, 0, 0); - public static final RGB TOOL = new RGB(153, 122, 0); - public static final RGB SUPP_TYPE = new RGB(0, 153, 122); - public static final RGB CONTEXT = new RGB(122, 0, 153); - public static final RGB COMMENT = new RGB(0, 99, 166); -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/Messages.java deleted file mode 100644 index 243f0ec279..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.ui.editor.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionKindRule.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionKindRule.java deleted file mode 100644 index e7fb2e932f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionKindRule.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jface.text.rules.ICharacterScanner; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WordRule; - -public class SuppressionKindRule implements IRule { - private Map> kinds; - private IToken token; - private WordRule subrule; - - private static final IToken DUMMY_TOKEN = new Token(null); - private static final char[] COLON = new char[] { ':' }; - - public SuppressionKindRule(Map> suppKinds, IToken successToken) { - kinds = suppKinds; - token = successToken; - - final List suppKindsList = new ArrayList(); - Set tools = suppKinds.keySet(); - for (String tool : tools) { - suppKindsList.addAll(suppKinds.get(tool)); - } - - subrule = new WordRule(new IWordDetector() { - - public boolean isWordStart(char c) { - for (String kind : suppKindsList) { - if (c == kind.charAt(0)) { - return true; - } - } - return false; - } - - public boolean isWordPart(char c) { - return Character.isJavaIdentifierPart(c); - } - - }); - - for (String kind : suppKindsList) { - subrule.addWord(kind, DUMMY_TOKEN); - } - } - - public IToken evaluate(ICharacterScanner scanner) { - IToken result = subrule.evaluate(scanner); - StringBuffer tool = new StringBuffer(); - StringBuffer kind = new StringBuffer(); - - if (!result.isUndefined()) { - boolean match = true; - - // move to beginning of token - int tokenLength = ((SuppressionsElementScanner) scanner).getTokenLength(); - for (int i = 0; i < tokenLength; i++) { - scanner.unread(); - } - - // check first char before token is a ':' - match = checkColon(scanner); - if (match) { - // move to beginning of line - int preTokenLength = 0; - while (scanner.getColumn() > 0) { - scanner.unread(); - preTokenLength++; - } - - // ensure any leading characters are whitespace - boolean foundChar = false; - while (preTokenLength-- > 1) { // skip colon - int ch = scanner.read(); - if (match && !Character.isWhitespace(ch)) { - foundChar = true; - tool.append(Character.toChars(ch)); - } - else if (foundChar) { - // encountered whitespace after tool name started - match = false; - } - } - - scanner.read(); // consume colon - - // reset to end of token - for (int i = 0; i < tokenLength; i++) { - int ch = scanner.read(); - if (match) { - kind.append(Character.toChars(ch)); - } - } - - // assert kind is valid for tool - if (match) { - List kindList = kinds.get(tool.toString()); - if (kindList == null || !kindList.contains(kind.toString())) { - match = false; - } - } - else { - // reset to beginning of token - unreadBuffer(scanner, tokenLength); - } - } - - if (!match) { - result = Token.UNDEFINED; - } - else { - result = token; - } - } - - return result; - } - - private void unreadBuffer(ICharacterScanner scanner, int length) { - for (int i = 0; i < length; i++) { - scanner.unread(); - } - } - - private boolean checkColon(ICharacterScanner scanner) { - if (scanner.getColumn() == 0) { - // nothing to read - return false; - } - scanner.unread(); - int ch = scanner.read(); - return Arrays.equals(Character.toChars(ch), COLON); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionToolRule.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionToolRule.java deleted file mode 100644 index 5b8ecf494f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionToolRule.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.Arrays; - -import org.eclipse.jface.text.rules.ICharacterScanner; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WordRule; - -public class SuppressionToolRule implements IRule { - private String[] toolList; - private IToken token; - private WordRule subrule; - - private static final IToken DUMMY_TOKEN = new Token(null); - private static final char[] COLON = new char[] { ':' }; - - public SuppressionToolRule(String[] tools, IToken successToken) { - toolList = tools; - token = successToken; - subrule = new WordRule(new IWordDetector() { - - public boolean isWordStart(char c) { - for (String tool : toolList) { - if (c == tool.charAt(0)) { - return true; - } - } - return false; - } - - public boolean isWordPart(char c) { - return c != ':'; - } - - }); - - for (String tool : toolList) { - subrule.addWord(tool, DUMMY_TOKEN); - } - } - - public IToken evaluate(ICharacterScanner scanner) { - IToken result = subrule.evaluate(scanner); - if (!result.isUndefined()) { - boolean match = true; - - int tokenLength = ((SuppressionsElementScanner) scanner).getTokenLength(); - match = checkColon(scanner); - if (match) { - // move to beginning of token - for (int i = 0; i < tokenLength; i++) { - scanner.unread(); - } - - // move to beginning of line - int indentLength = 0; - while (scanner.getColumn() > 0) { - scanner.unread(); - indentLength++; - } - - // ensure any leading characters are whitespace - while (indentLength-- > 0) { - int ch = scanner.read(); - if (!Character.isWhitespace(ch)) { - match = false; - } - } - - // reset to end of token - for (int i = 0; i < tokenLength; i++) { - scanner.read(); - } - } - - if (!match) { - unreadBuffer(scanner, tokenLength); - result = Token.UNDEFINED; - } - else { - result = token; - } - } - - return result; - } - - private boolean checkColon(ICharacterScanner scanner) { - int ch = scanner.read(); - if (ch == ICharacterScanner.EOF) { - return false; - } - scanner.unread(); - return Arrays.equals(Character.toChars(ch), COLON); - } - - private void unreadBuffer(ICharacterScanner scanner, int length) { - for (int i = 0; i < length; i++) { - scanner.unread(); - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsConfiguration.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsConfiguration.java deleted file mode 100644 index 51276070fb..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsConfiguration.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.reconciler.IReconciler; -import org.eclipse.jface.text.reconciler.MonoReconciler; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; - -public class SuppressionsConfiguration extends SourceViewerConfiguration { - - private SuppressionsEditor editor; - private SuppressionsElementScanner elementScanner; - - public SuppressionsConfiguration(ColorManager colorManager, SuppressionsEditor editor) { - this.editor = editor; - elementScanner = new SuppressionsElementScanner(colorManager); - } - - @Override - public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - return SuppressionsPartitionScanner.SUPP_CONTENT_TYPES; - } - - @Override - public IPresentationReconciler getPresentationReconciler( - ISourceViewer sourceViewer) { - PresentationReconciler reconciler = new PresentationReconciler(); - - DefaultDamagerRepairer dr = new DefaultDamagerRepairer(elementScanner); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - - dr = new DefaultDamagerRepairer(elementScanner); - reconciler.setDamager(dr, SuppressionsPartitionScanner.SUPP_TOOL); - reconciler.setRepairer(dr, SuppressionsPartitionScanner.SUPP_TOOL); - - dr = new DefaultDamagerRepairer(elementScanner); - reconciler.setDamager(dr, SuppressionsPartitionScanner.SUPP_TYPE); - reconciler.setRepairer(dr, SuppressionsPartitionScanner.SUPP_TYPE); - - dr = new DefaultDamagerRepairer(elementScanner); - reconciler.setDamager(dr, SuppressionsPartitionScanner.SUPP_CONTEXT); - reconciler.setRepairer(dr, SuppressionsPartitionScanner.SUPP_CONTEXT); - - return reconciler; - } - - @Override - public IReconciler getReconciler(ISourceViewer sourceViewer) { - SuppressionsReconcilingStrategy strategy = new SuppressionsReconcilingStrategy(editor); - MonoReconciler reconciler = new MonoReconciler(strategy, false); - return reconciler; - } - - @Override - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - ContentAssistant assistant = new ContentAssistant(); - assistant.setContentAssistProcessor(new SuppressionsContentAssistProcessor(), IDocument.DEFAULT_CONTENT_TYPE); - assistant.setContentAssistProcessor(new SuppressionsContentAssistProcessor(), SuppressionsPartitionScanner.SUPP_TOOL); - assistant.setContentAssistProcessor(new SuppressionsContentAssistProcessor(), SuppressionsPartitionScanner.SUPP_TYPE); - assistant.setContentAssistProcessor(new SuppressionsContentAssistProcessor(), SuppressionsPartitionScanner.SUPP_CONTEXT); - assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); - assistant.enableAutoInsert(true); - return assistant; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsContentAssistProcessor.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsContentAssistProcessor.java deleted file mode 100644 index 91388519b1..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsContentAssistProcessor.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.CompletionProposal; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationValidator; - -public class SuppressionsContentAssistProcessor implements - IContentAssistProcessor { - - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, - int offset) { - List completions = new ArrayList(); - - IDocument doc = viewer.getDocument(); - try { - // check if we're in the middle of a word - String prefix = completionWord(doc, offset); - - int replacementOffset = offset; - int replacementLength = 0; - if (prefix != null) { - // replacing what's been typed so far - replacementLength = prefix.length(); - // subtract prefix length from offset - replacementOffset -= replacementLength; - } - String toolName = getToolName(doc, replacementOffset); - String[] words = getCompletionStrings(prefix, toolName); - for (String word : words) { - completions.add(new CompletionProposal(word, replacementOffset, replacementLength, word.length())); - } - } catch (BadLocationException e) { - e.printStackTrace(); - } - - return completions.toArray(new ICompletionProposal[completions.size()]); - } - - public IContextInformation[] computeContextInformation(ITextViewer viewer, - int offset) { - return new IContextInformation[0]; - } - - public char[] getCompletionProposalAutoActivationCharacters() { - return null; - } - - public char[] getContextInformationAutoActivationCharacters() { - return null; - } - - public IContextInformationValidator getContextInformationValidator() { - return null; - } - - public String getErrorMessage() { - return null; - } - - private String completionWord(IDocument doc, int offset) - throws BadLocationException { - String word = null; - for (int n = offset - 1; n >= 0 && word == null; n--) { - char c = doc.getChar(n); - if (!Character.isLetterOrDigit(c)) { - word = doc.get(n + 1, offset - n - 1); - } - } - return word; - } - - private String[] getCompletionStrings(String prefix, String toolName) { - List words = new ArrayList(); - if (prefix == null || SuppressionsElementScanner.MEMCHECK.startsWith(prefix)) { - words.add(SuppressionsElementScanner.MEMCHECK + ":"); //$NON-NLS-1$ - } - - // If the cursor is after "Memcheck:" - if (toolName != null && toolName.equals(SuppressionsElementScanner.MEMCHECK)) { - for (String word : SuppressionsElementScanner.MEMCHECK_SUPP_TYPES) { - if (prefix == null || word.startsWith(prefix)) { - words.add(word); - } - } - } - - for (String word : SuppressionsElementScanner.CONTEXTS) { - if (prefix == null || word.startsWith(prefix)) { - words.add(word + ":"); //$NON-NLS-1$ - } - } - return words.toArray(new String[words.size()]); - } - - private String getToolName(IDocument doc, int offset) throws BadLocationException { - String tool = null; - char c = doc.getChar(--offset); - // syntax is "toolName:suppressionKind" - if (c == ':') { - for (int n = offset - 1; n >= 0 && tool == null; n--) { - c = doc.getChar(n); - if (!Character.isLetter(c)) { - tool = doc.get(n + 1, offset - n - 1); - } - } - } - return tool; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsDocumentProvider.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsDocumentProvider.java deleted file mode 100644 index b4f268835a..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsDocumentProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.rules.FastPartitioner; -import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; -import org.eclipse.ui.editors.text.TextFileDocumentProvider; - -public class SuppressionsDocumentProvider extends TextFileDocumentProvider { - - @Override - public IDocument getDocument(Object element) { - IDocument document = super.getDocument(element); - if (document != null) { - FastPartitioner partitioner = new FastPartitioner( - new RuleBasedPartitionScanner(), - SuppressionsPartitionScanner.SUPP_CONTENT_TYPES); - - partitioner.connect(document, false); - if (document.getDocumentPartitioner() == null) - document.setDocumentPartitioner(partitioner); - } - return document; - - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsEditor.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsEditor.java deleted file mode 100644 index a301fa616a..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsEditor.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; -import java.util.HashMap; - -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.IVerticalRuler; -import org.eclipse.jface.text.source.projection.ProjectionAnnotation; -import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; -import org.eclipse.jface.text.source.projection.ProjectionSupport; -import org.eclipse.jface.text.source.projection.ProjectionViewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.editors.text.TextEditor; - - -public class SuppressionsEditor extends TextEditor { - - private ColorManager colorManager; - private ProjectionSupport projectionSupport; - private ProjectionAnnotationModel annotationModel; - private Annotation[] oldAnnotations; - - public SuppressionsEditor() { - this.colorManager = new ColorManager(); - setSourceViewerConfiguration(new SuppressionsConfiguration(colorManager, this)); - setDocumentProvider(new SuppressionsDocumentProvider()); - oldAnnotations = null; - } - - @Override - public void createPartControl(Composite parent) { - super.createPartControl(parent); - ProjectionViewer viewer =(ProjectionViewer)getSourceViewer(); - projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors()); - projectionSupport.install(); - viewer.doOperation(ProjectionViewer.TOGGLE); - annotationModel = viewer.getProjectionAnnotationModel(); - } - - @Override - protected ISourceViewer createSourceViewer(Composite parent, - IVerticalRuler ruler, int styles) { - - ISourceViewer viewer = new ProjectionViewer(parent, ruler, - getOverviewRuler(), isOverviewRulerVisible(), styles); - getSourceViewerDecorationSupport(viewer); - return viewer; - } - - public void updateFoldingStructure(Position[] updatedPositions) { - Annotation[] updatedAnnotations = new Annotation[updatedPositions.length]; - HashMap newAnnotations = new HashMap(); - for (int i = 0; i < updatedPositions.length; i++) { - ProjectionAnnotation annotation = new ProjectionAnnotation(); - newAnnotations.put(annotation, updatedPositions[i]); - updatedAnnotations[i] = annotation; - } - annotationModel.modifyAnnotations(oldAnnotations, newAnnotations, null); - oldAnnotations = updatedAnnotations; - } - - @Override - public void dispose() { - colorManager.dispose(); - super.dispose(); - } - -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsElementScanner.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsElementScanner.java deleted file mode 100644 index e2eed4f9b6..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsElementScanner.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; -import org.eclipse.jface.text.rules.EndOfLineRule; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.IWhitespaceDetector; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WhitespaceRule; -import org.eclipse.swt.SWT; - -public class SuppressionsElementScanner extends BufferedRuleBasedScanner { - - public static final String MEMCHECK = "Memcheck"; //$NON-NLS-1$ - public static final String[] MEMCHECK_SUPP_TYPES = new String[] { - "Value0", "Value1", "Value2", "Value4", "Value8", "Value16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - "Cond", //$NON-NLS-1$ - "Addr1", "Addr2", "Addr4", "Addr8", "Addr16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "Jump", //$NON-NLS-1$ - "Param", //$NON-NLS-1$ - "Free", //$NON-NLS-1$ - "Overlap", //$NON-NLS-1$ - "Leak" //$NON-NLS-1$ - }; - public static final String[] CONTEXTS = new String[] { "obj", "fun" //$NON-NLS-1$ //$NON-NLS-2$ - }; - - public SuppressionsElementScanner(ColorManager colorManager) { - String[] tools = { MEMCHECK }; - Map> kinds = new HashMap>(); - kinds.put(MEMCHECK, Arrays.asList(MEMCHECK_SUPP_TYPES)); - - IToken defaultToken = new Token(new TextAttribute(colorManager - .getColor(ISuppressionsColorConstants.DEFAULT))); - IToken toolToken = new Token(new TextAttribute(colorManager - .getColor(ISuppressionsColorConstants.TOOL), null, SWT.BOLD)); - IToken suppKindToken = new Token(new TextAttribute(colorManager - .getColor(ISuppressionsColorConstants.SUPP_TYPE))); - IToken contextToken = new Token(new TextAttribute(colorManager - .getColor(ISuppressionsColorConstants.CONTEXT), null, SWT.BOLD)); - IToken commentToken = new Token(new TextAttribute(colorManager - .getColor(ISuppressionsColorConstants.COMMENT))); - - // Handle keywords -// WordRule keywordsRule = new WordRule(new IWordDetector() { -// -// public boolean isWordPart(char c) { -// return Character.isJavaIdentifierPart(c); -// } -// -// public boolean isWordStart(char c) { -// return Character.isJavaIdentifierStart(c); -// } -// -// }, defaultToken); - -// for (String tool : TOOLS) { -// keywordsRule.addWord(tool, toolToken); -// } -// for (String keyword : SUPP_TYPES) { -// keywordsRule.addWord(keyword, suppTypeToken); -// } -// for (String context : CONTEXTS) { -// keywordsRule.addWord(context, contextToken); -// } - - setDefaultReturnToken(defaultToken); - setRules(new IRule[] { - new EndOfLineRule("#", commentToken), //$NON-NLS-1$ - new SuppressionToolRule(tools, toolToken), - new SuppressionKindRule(kinds, suppKindToken), - new SuppressionToolRule(CONTEXTS, contextToken), -// keywordsRule, - new WhitespaceRule(new IWhitespaceDetector() { - public boolean isWhitespace(char c) { - return Character.isWhitespace(c); - } - }) }); - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsPartitionScanner.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsPartitionScanner.java deleted file mode 100644 index 65cdea2abc..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsPartitionScanner.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.rules.EndOfLineRule; -import org.eclipse.jface.text.rules.IPredicateRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; -import org.eclipse.jface.text.rules.Token; - -public class SuppressionsPartitionScanner extends RuleBasedPartitionScanner { - public static final String SUPP_TOOL = "__supp_tool"; //$NON-NLS-1$ - public static final String SUPP_TYPE = "__supp_type"; //$NON-NLS-1$ - public static final String SUPP_CONTEXT = "__supp_context"; //$NON-NLS-1$ - public static final String SUPP_COMMENT = "__supp_comment"; //$NON-NLS-1$ - - public static final String[] SUPP_CONTENT_TYPES = { IDocument.DEFAULT_CONTENT_TYPE, SUPP_TOOL, SUPP_TYPE, SUPP_CONTEXT, SUPP_COMMENT }; - - public SuppressionsPartitionScanner() { - IToken commentToken = new Token(SUPP_COMMENT); - - setPredicateRules(new IPredicateRule[] { - new EndOfLineRule("#", commentToken) //$NON-NLS-1$ - }); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsReconcilingStrategy.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsReconcilingStrategy.java deleted file mode 100644 index 47c56e34b3..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/SuppressionsReconcilingStrategy.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Phil Muldoon . - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Phil Muldoon - initial API. - * Red Hat - modifications for use with Valgrind plugins. - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.reconciler.DirtyRegion; -import org.eclipse.jface.text.reconciler.IReconcilingStrategy; -import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; -import org.eclipse.swt.widgets.Display; - -public class SuppressionsReconcilingStrategy implements IReconcilingStrategy, - IReconcilingStrategyExtension { - private SuppressionsEditor editor; - private IDocument document; - private List positions; - private IProgressMonitor monitor; - - public SuppressionsReconcilingStrategy(SuppressionsEditor editor) { - this.editor = editor; - positions = new ArrayList(); - } - - public void reconcile(IRegion partition) { - initialReconcile(); - } - - public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { - initialReconcile(); - } - - public void setDocument(IDocument document) { - this.document = document; - } - - public void initialReconcile() { - int start = -1; - int end = document.getLength(); - int worked = 0; - monitor.beginTask(Messages.getString("SuppressionsReconcilingStrategy.Monitor_title"), 10); //$NON-NLS-1$ - for (int pos = 0; pos < end; pos++) { - try { - char ch = document.getChar(pos); - if (ch == '{') { - start = pos; - } - else if (ch == '}' && start > 0) { - positions.add(new Position(start, pos - start + 1)); - start = -1; // reset - } - } catch (BadLocationException e) { - e.printStackTrace(); - } - - if (pos * 10 / end > worked) { - monitor.worked(1); - worked++; - } - } - monitor.done(); - - Display.getDefault().syncExec(new Runnable() { - public void run() { - editor.updateFoldingStructure(positions.toArray(new Position[positions.size()])); - } - }); - } - - public void setProgressMonitor(IProgressMonitor monitor) { - this.monitor = monitor; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ValgrindEditorPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ValgrindEditorPlugin.java deleted file mode 100644 index e701f0e728..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/ValgrindEditorPlugin.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui.editor; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class ValgrindEditorPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.ui.editor"; //$NON-NLS-1$ - - // The shared instance - private static ValgrindEditorPlugin plugin; - - /** - * The constructor - */ - public ValgrindEditorPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static ValgrindEditorPlugin getDefault() { - return plugin; - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/messages.properties deleted file mode 100644 index 85b2fef838..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/valgrind/ui/editor/messages.properties +++ /dev/null @@ -1 +0,0 @@ -SuppressionsReconcilingStrategy.Monitor_title=Reconciling Suppressions diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/.project b/valgrind/org.eclipse.linuxtools.valgrind.ui/.project index cae9d421ab..9082e7dfeb 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/.project +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/.project @@ -20,9 +20,15 @@ + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/ChangeLog b/valgrind/org.eclipse.linuxtools.valgrind.ui/ChangeLog index dc29e24236..699793c5e2 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/ChangeLog +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/ChangeLog @@ -1,3 +1,11 @@ +2009-07-30 Elliott Baron + + * src/org/eclipse/linuxtools/valgrind/ui: Removed. + * src/org/eclipse/linuxtools/internal/valgrind/ui: New package. + * .project: Added API analysis. + * META-INF/MANIFEST.MF: Export internal package. + * plugin.xml: Update class references. + 2009-07-28 Elliott Baron * META-INF/MANIFEST.MF: New dependencies. diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.ui/META-INF/MANIFEST.MF index b97ae93e8a..8516491576 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/META-INF/MANIFEST.MF +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/META-INF/MANIFEST.MF @@ -3,13 +3,14 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.linuxtools.valgrind.ui;singleton:=true Bundle-Version: 0.2.0.qualifier -Bundle-Activator: org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin +Bundle-Activator: org.eclipse.linuxtools.internal.valgrind.ui.ValgrindUIPlugin Bundle-Vendor: %Bundle-Vendor.0 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.linuxtools.valgrind.ui +Export-Package: org.eclipse.linuxtools.internal.valgrind.ui, + org.eclipse.linuxtools.valgrind.ui Bundle-Localization: plugin Import-Package: org.eclipse.cdt.debug.ui, org.eclipse.debug.core, @@ -18,5 +19,6 @@ Import-Package: org.eclipse.cdt.debug.ui, org.eclipse.debug.ui, org.eclipse.debug.ui.sourcelookup, org.eclipse.jface.text, + org.eclipse.linuxtools.internal.valgrind.core, org.eclipse.linuxtools.profiling.ui, org.eclipse.linuxtools.valgrind.core diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/plugin.xml b/valgrind/org.eclipse.linuxtools.valgrind.ui/plugin.xml index 7fc4eb2902..aed9df057c 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/plugin.xml +++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/plugin.xml @@ -7,7 +7,7 @@ - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.jface.viewers.TreeViewer; - -public class CollapseAction extends Action { - - protected TreeViewer viewer; - - public CollapseAction(TreeViewer viewer) { - super(Messages.getString("CollapseAction.Text")); //$NON-NLS-1$ - this.viewer = viewer; - } - - @Override - public void run() { - ITreeSelection selection = (ITreeSelection) viewer.getSelection(); - Object element = selection.getFirstElement(); - viewer.collapseToLevel(element, TreeViewer.ALL_LEVELS); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CoreMessagesViewer.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CoreMessagesViewer.java deleted file mode 100644 index 804afa41c0..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/CoreMessagesViewer.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui; - -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.IPersistableSourceLocator; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; -import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.linuxtools.profiling.ui.ProfileUIUtils; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -public class CoreMessagesViewer extends TreeViewer { - public IDoubleClickListener doubleClickListener; - public ITreeContentProvider contentProvider; - public IAction expandAction; - public IAction collapseAction; - - public CoreMessagesViewer(Composite parent, int style) { - super(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | style); - getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - contentProvider = new ITreeContentProvider() { - - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof Object[]) { - return (Object[]) parentElement; - } - return ((IValgrindMessage) parentElement).getChildren(); - } - - public Object getParent(Object element) { - return ((IValgrindMessage) element).getParent(); - } - - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - public void dispose() {} - - public void inputChanged(Viewer viewer, Object oldInput, - Object newInput) {} - - }; - setContentProvider(contentProvider); - - setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((IValgrindMessage) element).getText(); - } - - @Override - public Image getImage(Object element) { - Image image; - if (element instanceof ValgrindStackFrame) { - image = DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_STACKFRAME); - } - else { - image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); - } - return image; - } - - }); - - doubleClickListener = new IDoubleClickListener() { - - public void doubleClick(DoubleClickEvent event) { - Object element = ((TreeSelection) event.getSelection()).getFirstElement(); - if (element instanceof ValgrindStackFrame) { - ValgrindStackFrame frame = (ValgrindStackFrame) element; - ILaunch launch = frame.getLaunch(); - ISourceLocator locator = launch.getSourceLocator(); - if (locator instanceof AbstractSourceLookupDirector) { - AbstractSourceLookupDirector director = (AbstractSourceLookupDirector) locator; - ISourceLookupParticipant[] participants = director.getParticipants(); - if (participants.length == 0) { - // source locator likely disposed, try recreating it - IPersistableSourceLocator sourceLocator; - ILaunchConfiguration config = launch.getLaunchConfiguration(); - if (config != null) { - try { - String id = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null); - if (id == null) { - sourceLocator = CDebugUIPlugin.createDefaultSourceLocator(); - sourceLocator.initializeDefaults(config); - } else { - sourceLocator = DebugPlugin.getDefault().getLaunchManager().newSourceLocator(id); - String memento = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null); - if (memento == null) { - sourceLocator.initializeDefaults(config); - } else { - sourceLocator.initializeFromMemento(memento); - } - } - - // replace old source locator - locator = sourceLocator; - launch.setSourceLocator(sourceLocator); - } catch (CoreException e) { - e.printStackTrace(); - } - } - } - } - ISourceLookupResult result = DebugUITools.lookupSource(frame.getFile(), locator); - - try { - ProfileUIUtils.openEditorAndSelect(result, frame.getLine()); - } catch (PartInitException e) { - e.printStackTrace(); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - else { - if (getExpandedState(element)) { - collapseToLevel(element, TreeViewer.ALL_LEVELS); - } - else { - expandToLevel(element, 1); - } - } - } - }; - addDoubleClickListener(doubleClickListener); - - expandAction = new ExpandAction(this); - collapseAction = new CollapseAction(this); - - MenuManager manager = new MenuManager(); - manager.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - ITreeSelection selection = (ITreeSelection) getSelection(); - Object element = selection.getFirstElement(); - if (contentProvider.hasChildren(element)) { - manager.add(expandAction); - manager.add(collapseAction); - } - } - }); - - manager.setRemoveAllWhenShown(true); - Menu contextMenu = manager.createContextMenu(getTree()); - getControl().setMenu(contextMenu); - } - - public IDoubleClickListener getDoubleClickListener() { - return doubleClickListener; - } -} \ No newline at end of file diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java deleted file mode 100644 index 9524810f0f..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ExpandAction.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.jface.viewers.TreeViewer; - -public class ExpandAction extends Action { - - protected TreeViewer viewer; - - public ExpandAction(TreeViewer viewer) { - super(Messages.getString("ExpandAction.Text")); //$NON-NLS-1$ - this.viewer = viewer; - } - - @Override - public void run() { - ITreeSelection selection = (ITreeSelection) viewer.getSelection(); - Object element = selection.getFirstElement(); - viewer.expandToLevel(element, TreeViewer.ALL_LEVELS); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/Messages.java deleted file mode 100644 index 2e8c1c19e3..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.valgrind.ui.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindUIPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindUIPlugin.java deleted file mode 100644 index bbb905f142..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindUIPlugin.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui; - -import java.util.HashMap; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.linuxtools.valgrind.core.PluginConstants; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class ValgrindUIPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = PluginConstants.UI_PLUGIN_ID; - public static final String VIEW_ID = PLUGIN_ID + ".valgrindview"; //$NON-NLS-1$ - public static final String TOOLBAR_LOC_GROUP_ID = "toolbarLocal"; //$NON-NLS-1$ - public static final String TOOLBAR_EXT_GROUP_ID = "toolbarExtensions"; //$NON-NLS-1$ - - // Extension point constants - protected static final String EXT_ELEMENT = "view"; //$NON-NLS-1$ - protected static final String EXT_ATTR_ID = "definitionId"; //$NON-NLS-1$ - protected static final String EXT_ATTR_CLASS = "class"; //$NON-NLS-1$ - - protected HashMap toolMap; - - // The shared instance - private static ValgrindUIPlugin plugin; - - protected ValgrindViewPart view; - // The page containing the created Valgrind view - protected IWorkbenchPage activePage; - - /** - * The constructor - */ - public ValgrindUIPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - 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) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static ValgrindUIPlugin getDefault() { - return plugin; - } - - public void createView(final String contentDescription, final String toolID) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - try { - activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - activePage.showView(ValgrindUIPlugin.VIEW_ID, null, IWorkbenchPage.VIEW_CREATE); - - // create the view's tool specific controls and populate content description - view.createDynamicContent(contentDescription, toolID); - - view.refreshView(); - } catch (PartInitException e) { - e.printStackTrace(); - } catch (CoreException e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Shows the Valgrind view in the active page and gives it focus. - */ - public void showView() { - Display.getDefault().syncExec(new Runnable() { - public void run() { - try { - activePage.showView(ValgrindUIPlugin.VIEW_ID); - } catch (PartInitException e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Refreshes the Valgrind view - */ - public void refreshView() { - if (view != null) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - view.refreshView(); - } - }); - } - } - - /** - * Empties the contents of the view and restores its original state. - */ - public void resetView() { - if (view != null) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - try { - view.createDynamicContent(Messages.getString("ValgrindViewPart.No_Valgrind_output"), null); //$NON-NLS-1$ - } catch (CoreException e) { - e.printStackTrace(); - } - } - }); - } - } - - protected void setView(ValgrindViewPart view) { - this.view = view; - } - - /** - * @return the Valgrind view - */ - public ValgrindViewPart getView() { - return view; - } - - public static Shell getActiveWorkbenchShell() { - IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow(); - if (window != null) { - return window.getShell(); - } - return null; - } - - protected void initializeToolMap() { - toolMap = new HashMap(); - IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, PluginConstants.VIEW_EXT_ID); - IConfigurationElement[] configs = extPoint.getConfigurationElements(); - for (IConfigurationElement config : configs) { - if (config.getName().equals(EXT_ELEMENT)) { - String id = config.getAttribute(EXT_ATTR_ID); - if (id != null && config.getAttribute(EXT_ATTR_CLASS) != null) { - toolMap.put(id, config); - } - } - } - } - - protected HashMap getToolMap() { - if (toolMap == null) { - initializeToolMap(); - } - return toolMap; - } - - public IValgrindToolView getToolView(String id) throws CoreException { - IValgrindToolView view = null; - IConfigurationElement config = getToolMap().get(id); - if (config != null) { - Object obj = config.createExecutableExtension(EXT_ATTR_CLASS); - if (obj instanceof IValgrindToolView) { - view = (IValgrindToolView) obj; - } - } - if (view == null) { - throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, Messages.getString("ValgrindUIPlugin.Cannot_retrieve_view"))); //$NON-NLS-1$ - } - return view; - } -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindViewPart.java deleted file mode 100644 index 1253d08112..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/ValgrindViewPart.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Elliott Baron - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.valgrind.ui; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.linuxtools.valgrind.core.IValgrindMessage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.part.ViewPart; - -public class ValgrindViewPart extends ViewPart { - - protected PageBook pageBook; - protected Composite dynamicViewHolder; - protected IValgrindToolView dynamicView; - protected ActionContributionItem[] dynamicActions; - protected IValgrindMessage[] messages; - protected CoreMessagesViewer messagesViewer; - protected Action showCoreAction; - protected Action showToolAction; - protected boolean hasDynamicContent = false; - - @Override - public void createPartControl(Composite parent) { - setContentDescription(Messages.getString("ValgrindViewPart.No_Valgrind_output")); //$NON-NLS-1$ - - pageBook = new PageBook(parent, SWT.NONE); - pageBook.setLayoutData(new GridData(GridData.FILL_BOTH)); - - messagesViewer = new CoreMessagesViewer(pageBook, SWT.NONE); - - dynamicViewHolder = new Composite(pageBook, SWT.NONE); - GridLayout dynamicViewLayout = new GridLayout(); - dynamicViewLayout.marginWidth = dynamicViewLayout.marginHeight = 0; - dynamicViewHolder.setLayout(dynamicViewLayout); - dynamicViewHolder.setLayoutData(new GridData(GridData.FILL_BOTH)); - - showCoreAction = new Action(Messages.getString("ValgrindViewPart.Show_Core_Action"), IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$ - @Override - public void run() { - showCorePage(); - } - }; - showToolAction = new Action(Messages.getString("ValgrindViewPart.Show_Tool_Action"), IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$ - @Override - public void run() { - showToolPage(); - } - }; - - ValgrindUIPlugin.getDefault().setView(this); - } - - public IValgrindToolView createDynamicContent(String description, String toolID) throws CoreException { - setContentDescription(description); - - // remove tool specific toolbar controls - IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager(); - if (dynamicActions != null) { - for (ActionContributionItem item : dynamicActions) { - toolbar.remove(item); - } - } - - // remove old view controls - if (dynamicView != null) { - dynamicView.dispose(); - } - for (Control child : dynamicViewHolder.getChildren()) { - if (!child.isDisposed()) { - child.dispose(); - } - } - - if (toolID != null) { - dynamicView = ValgrindUIPlugin.getDefault().getToolView(toolID); - dynamicView.createPartControl(dynamicViewHolder); - - // create toolbar items - IAction[] actions = dynamicView.getToolbarActions(); - if (actions != null) { - dynamicActions = new ActionContributionItem[actions.length]; - for (int i = 0; i < actions.length; i++) { - dynamicActions[i] = new ActionContributionItem(actions[i]); - toolbar.appendToGroup(ValgrindUIPlugin.TOOLBAR_LOC_GROUP_ID, dynamicActions[i]); - } - } - } - else { - dynamicView = null; - } - - // remove old menu items - IMenuManager menu = getViewSite().getActionBars().getMenuManager(); - menu.removeAll(); - // was content was created? - hasDynamicContent = dynamicViewHolder.getChildren().length > 0; - if (hasDynamicContent) { - menu.add(showCoreAction); - menu.add(showToolAction); - } - - menu.update(true); - toolbar.update(true); - dynamicViewHolder.layout(true); - - return dynamicView; - } - - public void setMessages(IValgrindMessage[] messages) { - this.messages = messages; - } - - public IValgrindMessage[] getMessages() { - return messages; - } - - @Override - public void setFocus() { - if (dynamicView != null) { - dynamicView.setFocus(); - } - } - - public void refreshView() { - if (messages != null) { - messagesViewer.setInput(messages); - - // decide which page to show - if (hasDynamicContent && messages.length == 0) { - // no valgrind messages to show - showCoreAction.setEnabled(false); - showToolPage(); - } - else { - showCoreAction.setEnabled(true); - showCorePage(); - } - } - if (dynamicView != null) { - dynamicView.refreshView(); - } - } - - @Override - public void dispose() { - if (dynamicView != null) { - dynamicView.dispose(); - } - super.dispose(); - } - - public IValgrindToolView getDynamicView() { - return dynamicView; - } - - public CoreMessagesViewer getMessagesViewer() { - return messagesViewer; - } - - private void showCorePage() { - pageBook.showPage(messagesViewer.getControl()); - showCoreAction.setChecked(true); - showToolAction.setChecked(false); - } - - private void showToolPage() { - pageBook.showPage(dynamicViewHolder); - showToolAction.setChecked(true); - showCoreAction.setChecked(false); - } - -} diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/messages.properties b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/messages.properties deleted file mode 100644 index b9fff97c8e..0000000000 --- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/valgrind/ui/messages.properties +++ /dev/null @@ -1,7 +0,0 @@ -CollapseAction.Text=Collapse Beneath Selection -ExpandAction.Text=Expand Beneath Selection -ValgrindUIPlugin.Cannot_retrieve_view=Cannot retrieve view from extension -ValgrindViewPart.No_Valgrind_output=No Valgrind output to display at this time. -ValgrindViewPart.Select_a_recent_launch=Select a recent launch -ValgrindViewPart.Show_Core_Action=Show Valgrind Commentary -ValgrindViewPart.Show_Tool_Action=Show Tool Output -- cgit v1.2.3